path.vue 2.1 KB

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