123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <template>
- <web-view :src="url" @message="handleGetMessage"/>
- </template>
- <script>
- import {h5BaseUrl} from '@/utils/config'
- import {apiGetSceneToParams} from '@/api/common'
- export default {
- data() {
- return {
- url:'',
- msgObj:{}
- };
- },
- onLoad(options) {
- this.init(options)
- wx.setVisualEffectOnCapture({visualEffect:'hidden'})
- },
- onUnload(){
- wx.setVisualEffectOnCapture({visualEffect:'none'})
- },
- onShareAppMessage() {
- return {
- title:this.msgObj.title,
- path:`/pages-report/chapterDetail?chapterId=${this.msgObj.chapterId}`,
- imageUrl:this.msgObj.shareImg||''
- }
- },
- methods: {
- async init(options){
- if(options.scene){
- const res=await apiGetSceneToParams({scene_key:options.scene})
- if(res.code==200){
- const obj=JSON.parse(res.data)
- options.chapterId=obj.chapterId
- }
- }
- let chapterId=options.chapterId
- let fromPage=options.fromPage||''
- const timestamp=new Date().getTime()
- const token=this.$store.state.user.token
- this.url=`${h5BaseUrl}/hzyb/report/chapterdetail?chapterId=${chapterId}&userId=${this.userInfo.user_id}&fromPage=${fromPage}&token=${token}×tamp=${timestamp}#wechat_redirect`
- },
- handleGetMessage(e){
- const data=e.detail.data[e.detail.data.length-1]
- console.log('h5传来的数据',data);
- this.msgObj=data
- }
- }
- };
- </script>
|