jwyu 2 years ago
parent
commit
b621572676

+ 19 - 4
pages-activity/detail.vue

@@ -185,6 +185,7 @@ import {
     apiActivityRegister,
     apiActivityCancelRegister
 } from "@/api/activity";
+import {apiGetSceneToParams} from '@/api/common'
 import {baseApiUrl} from '@/utils/config.js'
 import sharePoster from '../components/sharePoster/sharePoster.vue'
 const moment=require('@/utils/moment-with-locales.min')
@@ -218,7 +219,7 @@ export default {
         
       },
       code_scene(){//生成海报的小程序页面参数
-        return  `id=${this.id}`
+        return  JSON.stringify({id:this.id})
       }
     },
     data() {
@@ -243,9 +244,14 @@ export default {
         };
     },
     onLoad(options) {
-        this.id = options.id;
-        this.getDetail();
-        this.getAudios()
+        if(options.scene){
+            this.init(options.scene)
+        }else{
+            this.id = options.id;
+            this.getDetail();
+            this.getAudios()
+        }
+        
     },
     onUnload(){
         // 存一次
@@ -282,6 +288,15 @@ export default {
         }
     },
     methods: {
+        async init(e){
+            const res=await apiGetSceneToParams({scene_key:e})
+            if(res.code==200){
+                const obj=JSON.parse(res.data)
+                this.id=obj.id 
+                this.getDetail()
+                this.getAudios()
+            }
+        },
         formatActivityTime(start,end){
             const week=moment(start).format('dddd');
             const day=moment(start).format('YYYY-MM-DD');

+ 11 - 2
pages-chart/chartDetail.vue

@@ -4,6 +4,7 @@
 
 <script>
 import {h5BaseUrl} from '../utils/config'
+import {apiGetSceneToParams} from '@/api/common'
 export default {
     data () {
         return {
@@ -28,18 +29,26 @@ export default {
         }
         return {
             title:this.msgObj.title||'ETA图库',
-            path:`/pages-chart/chartDetail?${paramsStr}`,
+            path:`/pages-chart/chartDetail?${paramsStr}&from=share`,
             imageUrl:this.msgObj.shareImg||''
         }
     },
 
     methods: {
-        init(options){
+        async init(options){
+            if(options.scene){
+                const res=await apiGetSceneToParams({scene_key:options.scene})
+                if(res.code==200){
+                    options=JSON.parse(res.data)
+                }
+            }
+
             const queryObj={
                 ChartInfoId:options.chartInfoId,
                 searchVal:encodeURIComponent(options.searchVal),//避免在链接中带有中文字符,在 iOS 中会有打开白屏的问题,建议加一下 encodeURIComponent
                 MyChartId:options.MyChartId,
                 MyChartClassifyId:options.MyChartClassifyId,
+                from:options.from||'',
                 token:this.$store.state.user.token||uni.getStorageSync("token"),
                 timestamp:new Date().getTime(),//防止缓存
             }

+ 18 - 5
pages-report/chapterDetail.vue

@@ -4,6 +4,7 @@
 
 <script>
 import {h5BaseUrl} from '@/utils/config'
+import {apiGetSceneToParams} from '@/api/common'
 export default {
   data() {
     return {
@@ -12,11 +13,7 @@ export default {
     };
   },
   onLoad(options) {
-    let chapterId=options.chapterId
-    let fromPage=options.fromPage||''
-    const timestamp=new Date().getTime()
-    const token=this.$store.state.user.token
-    this.url=`${h5BaseUrl}/hzyb/report/chapterdetail?chapterId=${chapterId}&fromPage=${fromPage}&token=${token}&timestamp=${timestamp}#wechat_redirect`
+    this.init(options)
   },
   onShareAppMessage() {
     return {
@@ -25,6 +22,22 @@ export default {
     }
   },
   methods: {
+    async init(options){
+      if(options.scene){
+        const res=await apiGetSceneToParams({scene_key:options.scene})
+        if(res.code==200){
+          const obj=JSON.parse(res.data)
+          options.chapterId=obj.chapterId
+        }
+      }
+
+      let chapterId=options.chapterId
+      let fromPage=options.fromPage||''
+      const timestamp=new Date().getTime()
+      const token=this.$store.state.user.token
+      this.url=`${h5BaseUrl}/hzyb/report/chapterdetail?chapterId=${chapterId}&fromPage=${fromPage}&token=${token}&timestamp=${timestamp}#wechat_redirect`
+    },
+
     handleGetMessage(e){
       const data=e.detail.data[e.detail.data.length-1]
       console.log('h5传来的数据',data);

+ 18 - 4
pages-report/reportDetail.vue

@@ -4,6 +4,7 @@
 
 <script>
 import {h5BaseUrl} from '@/utils/config'
+import {apiGetSceneToParams} from '@/api/common'
 export default {
     data () {
         return {
@@ -12,10 +13,8 @@ export default {
         }
     },
     onLoad(options) {
-        let reportId=options.reportId
-        const timestamp=new Date().getTime()
-        const token=this.$store.state.user.token
-        this.url=`${h5BaseUrl}/hzyb/report/detail?reportId=${reportId}&token=${token}&timestamp=${timestamp}#wechat_redirect`
+        this.init(options)
+        
     },
     onShareAppMessage() {
         return {
@@ -24,6 +23,21 @@ export default {
         }
     },
     methods: {
+        async init(options){
+            if(options.scene){
+                const res=await apiGetSceneToParams({scene_key:options.scene})
+                if(res.code==200){
+                    const obj=JSON.parse(res.data)
+                    options.reportId=obj.reportId
+                }
+            }
+
+            let reportId=options.reportId
+            const timestamp=new Date().getTime()
+            const token=this.$store.state.user.token
+            this.url=`${h5BaseUrl}/hzyb/report/detail?reportId=${reportId}&token=${token}&timestamp=${timestamp}#wechat_redirect`
+        },
+
         handleGetMessage(e){
             const data=e.detail.data[e.detail.data.length-1]
             console.log('h5传来的数据',data);

+ 25 - 8
pages-report/reportList.vue

@@ -68,6 +68,7 @@ import searchBox from "./components/searchBox.vue";
 import audioBox from './components/audioBox.vue'
 import sharePoster from '@/components/sharePoster/sharePoster.vue'
 import {apiReportList,apiSubClassifyList} from '@/api/report'
+import {apiGetSceneToParams} from '@/api/common'
 const moment=require('@/utils/moment-with-locales.min')
 export default {
   computed: {
@@ -107,7 +108,7 @@ export default {
       return obj
     },
     code_scene(){
-      return `classifyId=${this.classifyId}&classifyName=${this.classifyName}`
+      return JSON.stringify({classifyId:this.classifyId,classifyName:this.classifyName})
     }
   },
   components: {
@@ -132,13 +133,17 @@ export default {
     };
   },
   onLoad(options) {
-    console.log(options);
-    this.classifyId=options.classifyId
-    this.classifyName=decodeURIComponent(options.classifyName)
-    // 设置title
-    uni.setNavigationBarTitle({ title: decodeURIComponent(options.classifyName) })
-    this.getList()
-    this.getClassifyList()
+    if(options.scene){
+      this.init(options.scene)
+    }else{
+      this.classifyId=options.classifyId
+      this.classifyName=decodeURIComponent(options.classifyName)
+      // 设置title
+      uni.setNavigationBarTitle({ title: decodeURIComponent(options.classifyName) })
+      this.getList()
+      this.getClassifyList()
+    }
+    
   },
   onPullDownRefresh() {
     this.page=1
@@ -161,6 +166,18 @@ export default {
     }
   },
   methods: {
+    async init(e){
+      const res=await apiGetSceneToParams({scene_key:e})
+      if(res.code==200){
+        const obj=JSON.parse(res.data)
+        this.classifyId=obj.classifyId
+        this.classifyName=decodeURIComponent(obj.classifyName)
+        uni.setNavigationBarTitle({ title: decodeURIComponent(obj.classifyName) })
+        this.getList()
+        this.getClassifyList()
+      }
+    },
+
     //获取研报列表
     async getList(){
       const res=await apiReportList({

+ 20 - 4
pages-report/specialColumn/detail.vue

@@ -58,6 +58,7 @@
 
 <script>
 import {apiSpecialColumnDetail,apiSpecialColumnReportList} from '@/api/report'
+import {apiGetSceneToParams} from '@/api/common'
 import audioBox from '../components/audioBox.vue'
 import sharePoster from '@/components/sharePoster/sharePoster.vue'
 export default {
@@ -82,7 +83,7 @@ export default {
             }
         },
         code_scene(){
-            return `columnId=${this.columnId}`
+            return JSON.stringify({columnId:this.columnId})
         }
     },
     components: {
@@ -102,9 +103,14 @@ export default {
         }
     },
     onLoad(options) {
-        this.columnId=options.columnId
-        this.getDetail()
-        this.getList()
+        if(options.scene){
+            this.init(options.scene)
+        }else{
+            this.columnId=options.columnId
+            this.getDetail()
+            this.getList()
+        }
+        
     },
     onPullDownRefresh() {
         this.getDetail()
@@ -128,6 +134,16 @@ export default {
         }
     },
     methods: {
+        async init(e){
+            const res=await apiGetSceneToParams({scene_key:e})
+            if(res.code==200){
+                const obj=JSON.parse(res.data)
+                this.columnId=obj.columnId 
+                this.getDetail()
+                this.getList()
+            }
+        },
+
         async getDetail(){
             const res=await apiSpecialColumnDetail({classify_id_second:Number(this.columnId)})
             if(res.code===200){

+ 23 - 6
pages-report/specialColumn/list.vue

@@ -35,6 +35,7 @@
 
 <script>
 import {apiSpecialColumnList} from '@/api/report'
+import {apiGetSceneToParams} from '@/api/common'
 import sharePoster from '@/components/sharePoster/sharePoster.vue'
 export default {
   components: {
@@ -73,7 +74,7 @@ export default {
 
     },
     code_scene(){
-      return `classifyId=${this.classifyId}&classifyName=${this.classifyName}`
+      return JSON.stringify({classifyId:this.classifyId,classifyName:this.classifyName})
     }
   },
   data () {
@@ -86,11 +87,16 @@ export default {
     }
   },
   onLoad(options) {
-    this.classifyId=options.classifyId
-    // 设置title
-    this.classifyName=decodeURIComponent(options.classifyName)
-    uni.setNavigationBarTitle({ title: decodeURIComponent(options.classifyName) })
-    this.getList()
+    if(options.scene){
+      this.init(options.scene)
+    }else{
+      this.classifyId=options.classifyId
+      // 设置title
+      this.classifyName=decodeURIComponent(options.classifyName)
+      uni.setNavigationBarTitle({ title: decodeURIComponent(options.classifyName) })
+      this.getList()
+    }
+    
   },
   onPullDownRefresh() {
     this.list=[]
@@ -106,6 +112,17 @@ export default {
     }
   },
   methods: {
+    async init(e){
+      const res=await apiGetSceneToParams({scene_key:e})
+      if(res.code==200){
+        const obj=JSON.parse(res.data)
+        this.classifyId=obj.classifyId
+        this.classifyName=decodeURIComponent(obj.classifyName)
+        uni.setNavigationBarTitle({ title: decodeURIComponent(obj.classifyName) })
+        this.getList()
+      }
+    },
+
     async getList(){
       this.finished=false
       const res=await apiSpecialColumnList({classify_id_first:Number(this.classifyId)})