path.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <view class="activity">
  3. <!-- <image @click.stop="navToDetailPage" src="https://img.caimei365.com/group1/M00/03/9A/Cmis216Zf8GAb_UqABE6NiwUUZs004.jpg" mode="widthFix"></image> -->
  4. <web-view :webview-styles="webviewStyles" :src="activityPath"></web-view>
  5. </view>
  6. </template>
  7. <script>
  8. export default {
  9. data() {
  10. return {
  11. webviewStyles: {
  12. progress: {
  13. color: '#FF3333'
  14. }
  15. },
  16. productID:'',
  17. activityPath:'',
  18. }
  19. },
  20. onLoad(option) {
  21. // 普通传参
  22. if(option.link) {
  23. this.activityPath = option.link
  24. return
  25. }
  26. this.initPath(option)
  27. },
  28. // onShareAppMessage(options){//分享转发
  29. // if (res.from === 'button') {
  30. // // 来自页面内转发按钮
  31. // }
  32. // console.log(options)
  33. // return {
  34. // title: '认证通111',
  35. // }
  36. // },
  37. methods:{
  38. navToDetailPage() {//跳转商品详情页
  39. this.$api.navigateTo(`/pages/goods/product?id=${this.productID}`)
  40. },
  41. initPath(option){
  42. if(!option.key || !option.type) return
  43. const link = uni.getStorageSync(option.key)
  44. const type = parseInt(option.type)
  45. uni.removeStorageSync(option.key) // 清除链接缓存
  46. //是word 或 ppt链接
  47. if(type === 1){
  48. this.activityPath = link
  49. return
  50. }
  51. //是pdf链接
  52. let URL_CONFIG = ''
  53. if(process.env.NODE_ENV === 'development'){
  54. URL_CONFIG = 'http://zzjtest.gz.aeert.com'
  55. }else{
  56. URL_CONFIG = 'https://www.caimei365.com/'
  57. }
  58. this.activityPath = `${URL_CONFIG}/document/pdfdetails.html?type=1&src=${link}`
  59. },
  60. },
  61. }
  62. </script>
  63. <style lang="scss">
  64. .activity{
  65. width: 100%;
  66. height: auto;
  67. image{
  68. width: 100%;
  69. height: auto;
  70. }
  71. }
  72. </style>