feature: 开门红方案

1. 分享图片使用图片url
2. 拦截原生按钮, 关闭图片时不返回上级
This commit is contained in:
mengxiaolong
2020-12-04 10:49:13 +08:00
parent 64d9a02b64
commit 4d940776cb
2 changed files with 54 additions and 10 deletions

View File

@@ -44,8 +44,38 @@ export default {
},
created() {
this.getSchemePics()
this.interceptAppBtn()
},
methods: {
interceptAppBtn() {
setTimeout(() => {
// eslint-disable-next-line no-undef
EWebBridge.webCallAppInJs('webview_left_button', {
intercept: '1'
})
}, 100)
window.appCallBack = this.appCallBack
},
appCallBack(data) {
if (data.trigger == 'left_button_click') {
if (!this.isPrevShow) {
this.$jump({
flag: 'h5',
extra: {
title: '开门红专区',
forbidSwipeBack: 1,
url: location.origin + `/#/goodStart/prefecture`
},
routerInfo: {
path: `/goodStart/prefecture`,
type: '1'
}
})
} else {
this.isPrevShow = false
}
}
},
onPageChange(page) {
this.currentPage = page
},
@@ -63,16 +93,13 @@ export default {
this.images = [this.$assetsUrl + pic.picUrl]
},
shareImg() {
this.toDataURL(this.images[0], function(base64) {
const img = base64
// eslint-disable-next-line no-undef
EWebBridge.webCallAppInJs('bridge', {
flag: 'share',
extra: {
shareType: '1',
img
}
})
// eslint-disable-next-line no-undef
EWebBridge.webCallAppInJs('bridge', {
flag: 'share',
extra: {
shareType: '1',
img: this.images[0]
}
})
},
toDataURL(url, callback) {

View File

@@ -33,8 +33,25 @@ export default {
},
mounted() {
this.changeNavigator()
this.interceptAppBtn()
},
methods: {
interceptAppBtn() {
setTimeout(() => {
// eslint-disable-next-line no-undef
EWebBridge.webCallAppInJs('webview_left_button', {
intercept: '1'
})
}, 100)
window.appCallBack = this.appCallBack
},
appCallBack(data) {
if (data.trigger == 'left_button_click') {
this.$jump({
flag: 'home'
})
}
},
changeNavigator() {
setTimeout(() => {
// eslint-disable-next-line no-undef