reportDetail.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <web-view :src="url" @message="handleGetMessage"></web-view>
  3. </template>
  4. <script>
  5. import {h5BaseUrl} from '@/utils/config'
  6. import {apiGetSceneToParams} from '@/api/common'
  7. export default {
  8. data () {
  9. return {
  10. url:'',
  11. msgObj:{}
  12. }
  13. },
  14. onLoad(options) {
  15. this.init(options)
  16. },
  17. onShareAppMessage() {
  18. return {
  19. title:this.msgObj.title,
  20. path:`/pages-report/reportDetail?reportId=${this.msgObj.reportId}`,
  21. imageUrl:this.msgObj.shareImg||''
  22. }
  23. },
  24. methods: {
  25. async init(options){
  26. console.log('options',options);
  27. if(options.scene){
  28. const res=await apiGetSceneToParams({scene_key:options.scene})
  29. if(res.code==200){
  30. console.log(res);
  31. const obj=JSON.parse(res.data)
  32. console.log(obj);
  33. options.reportId=obj.reportId
  34. console.log(options);
  35. }
  36. }
  37. let reportId=options.reportId
  38. const timestamp=new Date().getTime()
  39. const token=this.$store.state.user.token
  40. this.url=`${h5BaseUrl}/hzyb/report/detail?reportId=${reportId}&userId=${this.userInfo.user_id}&fromPage=${options.fromPage||''}&token=${token}&timestamp=${timestamp}#wechat_redirect`
  41. },
  42. handleGetMessage(e){
  43. const data=e.detail.data[e.detail.data.length-1]
  44. console.log('h5传来的数据',data);
  45. this.msgObj=data
  46. }
  47. }
  48. }
  49. </script>