reportDetail.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. }
  22. },
  23. methods: {
  24. async init(options){
  25. console.log('options',options);
  26. if(options.scene){
  27. const res=await apiGetSceneToParams({scene_key:options.scene})
  28. if(res.code==200){
  29. console.log(res);
  30. const obj=JSON.parse(res.data)
  31. console.log(obj);
  32. options.reportId=obj.reportId
  33. console.log(options);
  34. }
  35. }
  36. let reportId=options.reportId
  37. const timestamp=new Date().getTime()
  38. const token=this.$store.state.user.token
  39. this.url=`${h5BaseUrl}/hzyb/report/detail?reportId=${reportId}&token=${token}&timestamp=${timestamp}#wechat_redirect`
  40. },
  41. handleGetMessage(e){
  42. const data=e.detail.data[e.detail.data.length-1]
  43. console.log('h5传来的数据',data);
  44. this.msgObj=data
  45. }
  46. }
  47. }
  48. </script>