Bladeren bron

优化分享

maple 11 maanden geleden
bovenliggende
commit
7639cb1a17
3 gewijzigde bestanden met toevoegingen van 50 en 46 verwijderingen
  1. 2 1
      common/jswx.js
  2. 2 2
      manifest.json
  3. 46 43
      pages/goods.vue

+ 2 - 1
common/jswx.js

@@ -2,7 +2,8 @@ import jswx from 'weixin-js-sdk'
 import sign from './sign.js'
 console.log('jswx===>>', jswx)
 console.log('sign===>>', sign)
-// 
+const appid = "wxe7a47acc00b6aa5d";
+const appSecret = "11d94f98e6dd0e09a5b7872fb88fdb91";
 // 初始化微信配置
 jswx.config({
   debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "宜格分享",
     "appid" : "__UNI__90011BF",
     "description" : "应用描述",
-    "versionName" : "1.0.4",
-    "versionCode" : 104,
+    "versionName" : "1.0.5",
+    "versionCode" : 105,
     "transformPx" : false,
     /* 5+App特有相关 */
     "app-plus" : {

+ 46 - 43
pages/goods.vue

@@ -226,18 +226,18 @@
       openApp() {
         const ua = navigator.userAgent.toLowerCase()
         const isWeixin = ua.indexOf('micromessenger') != -1;
-        if(isWeixin){
-        	this.showHint = isWeixin;
-        	uni.pageScrollTo({
-        		scrollTop:0
-        	})
-        }else{
-        	const osName = uni.getSystemInfoSync().osName
-        	if (osName == 'android') {
-        	  this.getData(0)
-        	} else {
-        	  this.getData(1)
-        	}
+        if (isWeixin) {
+          this.showHint = isWeixin;
+          uni.pageScrollTo({
+            scrollTop: 0
+          })
+        } else {
+          const osName = uni.getSystemInfoSync().osName
+          if (osName == 'android') {
+            this.getData(0)
+          } else {
+            this.getData(1)
+          }
         }
       },
       getData(type) {
@@ -260,9 +260,14 @@
       browserOpenApp(type, url) {
         let that = this
         that.opening = true
+        let params = JSON.stringify({
+          goodsTypeJump: that.options.type,
+          goodsIdJump: that.options.id
+        })
+        let schemeUrl = `ygfwUrlSchemes://jumpType=goods&goodsType=${that.options.type}&goodsId=${that.options.id}`
         if (type == 0) { //  安卓处理
           let ifr = document.createElement('iframe');
-          ifr.src = `ygfwUrlSchemes://goodsTypeJump=${this.options.type}&goodsIdJump=${this.options.id}`;
+          ifr.src = schemeUrl;
           ifr.style.display = 'none';
           document.body.appendChild(ifr);
           that.timer = window.setTimeout(function() { //  未安装的情况
@@ -277,9 +282,7 @@
             }
           }, 5000)
         } else { //  IOS处理
-          let url = `ygfwUrlSchemes://goodsTypeJump=${this.options.type}&goodsIdJump=${this.options.id}`
-          alert(url)
-          window.location = url
+          window.location = schemeUrl
           that.timer = setTimeout(function() { //  未安装的情况
             that.opening = false
             //  跳转app store
@@ -934,36 +937,36 @@
       font-size: 28rpx;
     }
   }
-  
+
   .view-alert {
-  	/* position: absolute;
+    /* position: absolute;
   	left: 0;
   	top: 0;
   	z-index: 9; */
-  	width: 750rpx;
-  	background: rgb(52, 52, 52);
-  	margin-left: 0px;
-  	margin-right: 0px;
-  	padding: 60rpx 30rpx 60rpx 60rpx;
-  	box-shadow: rgba(22, 22, 23, 0.62) 0px -10px 16px inset;
-  	display: flex;
-  	justify-content: space-between;
-  	align-items: stretch;
-  	box-sizing: border-box;
-  
-  	.alert-text {
-  		flex: 1;
-  		color: #7f7e7e;
-  		font-weight: 400 !important;
-  		padding-right: 60rpx;
-  		line-height: 1.5;
-  	}
-  
-  	.alert-arrow {
-  		flex-shrink: 0;
-  		width: 60rpx;
-  		height: 60rpx;
-  		margin-top: -30rpx;
-  	}
+    width: 750rpx;
+    background: rgb(52, 52, 52);
+    margin-left: 0px;
+    margin-right: 0px;
+    padding: 60rpx 30rpx 60rpx 60rpx;
+    box-shadow: rgba(22, 22, 23, 0.62) 0px -10px 16px inset;
+    display: flex;
+    justify-content: space-between;
+    align-items: stretch;
+    box-sizing: border-box;
+
+    .alert-text {
+      flex: 1;
+      color: #7f7e7e;
+      font-weight: 400 !important;
+      padding-right: 60rpx;
+      line-height: 1.5;
+    }
+
+    .alert-arrow {
+      flex-shrink: 0;
+      width: 60rpx;
+      height: 60rpx;
+      margin-top: -30rpx;
+    }
   }
 </style>