Browse Source

分享功能

jwyu 2 years ago
parent
commit
9df21516ee

+ 16 - 2
pages-report/chapterDetail.vue

@@ -1,5 +1,5 @@
 <template>
-  <web-view :src="url" />
+  <web-view :src="url" @message="handleGetMessage"/>
 </template>
 
 <script>
@@ -7,7 +7,8 @@ import {h5BaseUrl} from '@/utils/config'
 export default {
   data() {
     return {
-      url:''
+      url:'',
+      msgObj:{}
     };
   },
   onLoad(options) {
@@ -17,6 +18,19 @@ export default {
     const token=this.$store.state.user.token
     this.url=`${h5BaseUrl}/hzyb/report/chapterdetail?chapterId=${chapterId}&fromPage=${fromPage}&token=${token}&timestamp=${timestamp}#wechat_redirect`
   },
+  onShareAppMessage() {
+    return {
+      title:msgObj.title,
+      path:`/pages-report/chapterDetail?chapterId=${msgObj.chapterId}`
+    }
+  },
+  methods: {
+    handleGetMessage(e){
+      const data=e.detail.data[e.detail.data.length-1]
+      console.log('h5传来的数据',data);
+      this.msgObj=data
+    }
+  }
 };
 </script>
 

+ 5 - 0
pages-report/classify.vue

@@ -35,6 +35,11 @@ export default {
       uni.stopPullDownRefresh()
     }, 1500);
   },
+  onShareAppMessage() {
+    return {
+      title:"FICC研报分类"
+    }
+  },
   methods: {
     async getClassifyList(){
       const res=await apiReportClassify()

+ 16 - 2
pages-report/reportDetail.vue

@@ -1,5 +1,5 @@
 <template>
-    <web-view :src="url"></web-view>
+    <web-view :src="url" @message="handleGetMessage"/></web-view>
 </template>
 
 <script>
@@ -7,7 +7,8 @@ import {h5BaseUrl} from '@/utils/config'
 export default {
     data () {
         return {
-            url:''
+            url:'',
+            msgObj:{}
         }
     },
     onLoad(options) {
@@ -16,6 +17,19 @@ export default {
         const token=this.$store.state.user.token
         this.url=`${h5BaseUrl}/hzyb/report/detail?reportId=${reportId}&token=${token}&timestamp=${timestamp}#wechat_redirect`
     },
+    onShareAppMessage() {
+        return {
+        title:msgObj.title,
+        path:`/pages-report/reportDetail?reportId=${msgObj.reportId}`
+        }
+    },
+    methods: {
+        handleGetMessage(e){
+            const data=e.detail.data[e.detail.data.length-1]
+            console.log('h5传来的数据',data);
+            this.msgObj=data
+        }
+    }
     
 }
 </script>

+ 7 - 0
pages-report/reportList.vue

@@ -60,6 +60,7 @@ export default {
   data() {
     return {
       classifyId:0,
+      classifyName:'',
 
       classifyList:[],
       selectSecClassifyId:0,
@@ -75,6 +76,7 @@ export default {
   },
   onLoad(options) {
     this.classifyId=options.classifyId
+    this.classifyName=options.classifyName
     // 设置title
     uni.setNavigationBarTitle({ title: decodeURIComponent(options.classifyName)+'列表' })
     this.getList()
@@ -95,6 +97,11 @@ export default {
     this.page++
     this.getList()
   },
+  onShareAppMessage() {
+    return {
+      title:this.classifyName+'列表'
+    }
+  },
   methods: {
     //获取研报列表
     async getList(){

+ 5 - 0
pages-report/specialColumn/detail.vue

@@ -73,6 +73,11 @@ export default {
             this.getList()
         }
     },
+    onShareAppMessage() {
+        return {
+            title:this.info.classify_name_second
+        }
+    },
     methods: {
         async getDetail(){
             const res=await apiSpecialColumnDetail({classify_id_second:Number(this.columnId)})

+ 5 - 0
pages-report/specialColumn/list.vue

@@ -46,6 +46,11 @@ export default {
       uni.stopPullDownRefresh()
     }, 1500);
   },
+  onShareAppMessage() {
+    return {
+      title:this.classifyName
+    }
+  },
   methods: {
     async getList(){
       this.finished=false

+ 5 - 0
pages/report/report.vue

@@ -116,6 +116,11 @@ export default {
     this.page++
     this.getReportList()
   },
+  onShareAppMessage() {
+    return {
+      title:"FICC研报"
+    }
+  },
   methods: {
     initNavBar(){
       let menuButtonInfo = uni.getMenuButtonBoundingClientRect()