path.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. methods:{
  29. navToDetailPage() {//跳转商品详情页
  30. this.$api.navigateTo(`/pages/goods/product?id=${this.productID}`)
  31. },
  32. initPath(option){
  33. if(!option.key || !option.type) return
  34. const link = uni.getStorageSync(option.key)
  35. const type = parseInt(option.type)
  36. uni.removeStorageSync(option.key) // 清除链接缓存
  37. //是word 或 ppt链接
  38. if(type === 1){
  39. this.activityPath = link
  40. return
  41. }
  42. //是pdf链接
  43. let URL_CONFIG = ''
  44. if(process.env.NODE_ENV === 'development'){
  45. URL_CONFIG = 'http://zzjtest.gz.aeert.com'
  46. }else{
  47. URL_CONFIG = 'https://www.caimei365.com/'
  48. }
  49. this.activityPath = `${URL_CONFIG}/document/pdfdetails.html?type=1&src=${link}`
  50. }
  51. }
  52. }
  53. </script>
  54. <style lang="scss">
  55. .activity{
  56. width: 100%;
  57. height: auto;
  58. image{
  59. width: 100%;
  60. height: auto;
  61. }
  62. }
  63. </style>