path.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 = 'https://www-b.caimei365.com'
  46. }
  47. this.activityPath = `${URL_CONFIG}/document/pdfdetails.html?type=1&src=${link}`
  48. }
  49. }
  50. }
  51. </script>
  52. <style lang="scss">
  53. .activity{
  54. width: 100%;
  55. height: auto;
  56. image{
  57. width: 100%;
  58. height: auto;
  59. }
  60. }
  61. </style>