Pārlūkot izejas kodu

增加开发体验版本打开调试设置

jwyu 3 gadi atpakaļ
vecāks
revīzija
fc8b433bdd
2 mainītis faili ar 20 papildinājumiem un 19 dzēšanām
  1. 10 10
      App.vue
  2. 10 9
      pages/pc.vue

+ 10 - 10
App.vue

@@ -11,29 +11,29 @@
 			uni.getSystemInfo({
 				success: function (res) {
 					if (res.windowWidth > 700) {
-						
-						const params=options.query
+						const params=options.query//此处的query就是在pc分享钩子函数中拼接的参数
 						let paramsStr=`xcxPath=${decodeURIComponent(options.path)}`
 						for(const key in params){
 							paramsStr=`${paramsStr}&${key}=${params[key]}`
 						}
 						console.log('进入pc');
-						// uni.showToast({
-						// 	title:'进入pc',
-						// 	icon:'none'
-						// })
 						uni.reLaunch({
 							url: `/pages/pc?${paramsStr}`,
 						});
 					}
 				},
 				fail:function(res){
-					// uni.showToast({
-					// 	title: '判断进入pc失败',
-					// 	icon: 'none'
-					// })
 				}
 			})
+
+
+			const env=uni.getAccountInfoSync().miniProgram
+			if(env.envVersion!=='release'){
+				// 打开调试
+				wx.setEnableDebug({
+				enableDebug: true
+				})
+			}
 		},
 		onHide: function() {
 			console.log('App Hide')

+ 10 - 9
pages/pc.vue

@@ -9,7 +9,7 @@ import {pcBaseUrl} from '../utils/config'
 const mapObj=new Map([
     ['pages/activity/activity','/activity/list'],
     ['pages-activity/detail','/activity/detail']
-])
+])//map映射小程序页面路径对应h5页面路径
 export default {
     data () {
         return {
@@ -21,7 +21,7 @@ export default {
         console.log('pc页面onload数据',options);
         let paramsObj={
             ...options,
-            token:this.$store.state.user.token,
+            token:this.$store.state.user.token||uni.getStorageSync("token"),
             timestamp:new Date().getTime(),//防止缓存
         }
         delete paramsObj.xcxPath
@@ -37,13 +37,6 @@ export default {
         console.log('拼接字符串:',paramsObjStr);
         this.url=`${pcBaseUrl}${mapObj.get(decodeURIComponent(options.xcxPath))||'/'}?${paramsObjStr}`      
     },
-    onShow() {
-        uni.hideHomeButton({
-            fail:(e)=>{
-                console.log(e);
-            }
-        })
-    },
     onShareAppMessage({webViewUrl}) {
         // console.log(webViewUrl);
         let paramsStr=''
@@ -68,6 +61,14 @@ export default {
             console.log('h5传来的数据',data);
             this.msgObj=data
         }
+    },
+
+    onShow() {
+        uni.hideHomeButton({
+            fail:(e)=>{
+                console.log(e);
+            }
+        })
     }
 }
 </script>