ylong 7 hónapja
szülő
commit
02ee788474

+ 16 - 37
App.vue

@@ -39,62 +39,41 @@ export default {
 					params[key] = value;
 				});
 
-				console.log('解析出的 scene 参数:', params);
-				// 假设链接参数中有一个名为 inviteCode 的参数
-				if (params.inviteCode) {
-					uni.setStorageSync('inviteCode', params.inviteCode)
-					console.log('解析出的 inviteCode 参数:', params.inviteCode);
-					this.slientLogin(params.inviteCode, 'inviteCode');
-				} else if (params.upsellCode) {
-					// 用于书籍加价的邀请码,关联订单 id 和 isbn
-					uni.setStorageSync('upsellCode', params.upsellCode)
-					this.globalData.upsellCode = params.upsellCode
-					console.log('解析出的 upsellCode 参数:', params.upsellCode);
-					this.slientLogin(params.upsellCode, 'upsellCode');
-				} else if(params.exclusiveCode) {
-					uni.setStorageSync('exclusiveCode', params.exclusiveCode)
-					this.globalData.exclusiveCode = params.exclusiveCode
-					console.log('解析出的 exclusiveCode 参数:', params.exclusiveCode);
-					this.slientLogin(params.exclusiveCode, 'exclusiveCode');
-				}else{
+				let keys = Object.keys(params)
+				if (keys.length > 0) {
+					this.slientLogin(params);
+					if (params.inviteCode) {
+						uni.setStorageSync('inviteCode', params.inviteCode)
+					}
+				} else {
 					this.slientLogin();
 				}
 			}
 			// #endif
 
 			// 如果链接参数中有一个名为 inviteCode 的参数
-			if (options.query.inviteCode) {
-				uni.setStorageSync('inviteCode', options.query.inviteCode)
-				this.slientLogin(options.query.inviteCode, 'inviteCode');
-			}
+			this.slientLogin(options.query);
 			// 如果链接参数中有一个名为 upsellCode 的参数
 			if (options.query.upsellCode) {
 				uni.setStorageSync('upsellCode', options.query.upsellCode)
-				this.globalData.upsellCode = options.query.upsellCode
-				this.slientLogin(options.query.upsellCode, 'upsellCode');
-			}
-			// 如果链接参数中有一个名为 exclusiveCode 的参数
-			if (options.query.exclusiveCode) {
-				uni.setStorageSync('exclusiveCode', options.query.exclusiveCode)
-				this.globalData.exclusiveCode = options.query.exclusiveCode
-				this.slientLogin(options.query.exclusiveCode, 'exclusiveCode');
 			}
-		}else{
+		} else {
 			this.slientLogin()
 		}
 	},
+	onUnload() {
+		uni.removeStorageSync('loginType')
+	},
 	methods: {
-		slientLogin(code2, type) {
+		slientLogin(params = {}) {
 			uni.login({
 				success(res) {
 					//plat	integer($int32)平台 1-微信 2-支付宝
 					let platform = uni.getSystemInfoSync().uniPlatform
-					console.log(platform, 'platform')
-					let data = { code: res.code, plat: platform === 'mp-alipay' ? 2 : 1  }
-					if (type) {
-						data[type] = code2
-					}
+					let data = { code: res.code, plat: platform === 'mp-alipay' ? 2 : 1 }
+					data = { ...data, ...params }
 					uni.setStorageSync('loginType', data)
+					console.log('登录参数:', data)
 
 					uni.$u.http
 						.post("/user/miniLogin", data)

+ 11 - 12
api/auth.js

@@ -1,14 +1,13 @@
 // 静默登录方法
-export const silentLogin = (upsellCode) => {
+export const silentLogin = () => {
     return new Promise((resolve, reject) => {
         uni.login({
             success(loginRes) {
-                let data = uni.getStorageSync('loginType') || {}
-                data.code = loginRes.code
-				if(upsellCode){
-					data.upsellCode = upsellCode
-				}
-				console.log(data,upsellCode, "登录参数2");
+                let platform = uni.getSystemInfoSync().uniPlatform
+                let data = uni.getStorageSync("loginType") || {};
+                data.code = loginRes.code;
+                data.plat = platform === 'mp-alipay' ? 2 : 1
+                console.log("登录参数2", data);
 
                 uni.$u.http
                     .post("/user/wxLogin", data)
@@ -20,21 +19,21 @@ export const silentLogin = (upsellCode) => {
                             resolve(response.data);
                         } else {
                             console.log("静默登录失败");
-                            uni.removeStorageSync('token');
+                            uni.removeStorageSync("token");
                             reject(response);
                         }
                     })
                     .catch((error) => {
                         console.log("静默登录异常");
-                        uni.removeStorageSync('token');
+                        uni.removeStorageSync("token");
                         reject(error);
                     });
             },
             fail: (error) => {
                 console.log("获取登录code失败");
-                uni.removeStorageSync('token');
+                uni.removeStorageSync("token");
                 reject(error);
-            }
+            },
         });
     });
-} 
+};

+ 1 - 1
pages-mine/components/service-promise.vue

@@ -7,7 +7,7 @@
         </view>
         <view class="promise-item">
             <u-icon name="clock-fill" color="#FFFFFF" size="32"></u-icon>
-            <text>24小时验</text>
+            <text>72小时验</text>
         </view>
         <view class="promise-item">
             <u-icon name="yuan-circle-fill" color="#FFFFFF" size="32"></u-icon>

+ 3 - 3
pages/home/components/ServiceGuarantee.vue

@@ -13,13 +13,13 @@
                     <view class="item-desc">本单不合格书籍可免费退回,您可在订单审核完成后,提交申请退回。</view>
                 </view>
 
-                <!-- 24小时验 -->
+                <!-- 72小时验 -->
                 <view class="guarantee-item">
                     <view class="item-header">
                         <image src="/static/img/1-2.png" mode="widthFix" class="item-icon"></image>
-                        <text class="item-title">24小时验</text>
+                        <text class="item-title">72小时验</text>
                     </view>
-                    <view class="item-desc">本单获得24小时验资格,订单将在"到仓签收"后24小时内验货完毕,未完成验货将获得3元补贴到余额,可随验货书款一起提现。</view>
+                    <view class="item-desc">本单获得72小时验资格,订单将在"到仓签收"后72小时内验货完毕,未完成验货将获得3元补贴到余额,可随验货书款一起提现。</view>
                 </view>
 
                 <!-- 极速打款 -->

+ 2 - 2
pages/home/components/ServiceInfo.vue

@@ -8,7 +8,7 @@
             </view>
             <view class="icon-item">
                 <image src="/static/img/2.png" mode="widthFix" style="width: 30rpx; height: 30rpx"></image>
-                <text style="margin-left: 6rpx">24小时验</text>
+                <text style="margin-left: 6rpx">72小时验</text>
                 <text style="margin-left: 4rpx"> > </text>
             </view>
             <view class="icon-item">
@@ -54,7 +54,7 @@ export default {
                 },
                 {
                     icon: "/static/img/2.png",
-                    text: "24小时验",
+                    text: "72小时验",
                 },
                 {
                     icon: "/static/img/3.png",

+ 8 - 1
pages/home/components/upsell-qrcode.vue

@@ -10,7 +10,14 @@
       <!-- 顶部标题 -->
       <view class="header">
         <view class="title-text">
-          让好友打开<text class="green">微信</text>扫一扫
+          让好友打开
+          <!-- #ifdef MP-WEIXIN -->
+          <text class="green">微信</text>
+          <!-- #endif -->
+          <!-- #ifdef MP-ALIPAY -->
+          <text class="green">支付宝</text>
+          <!-- #endif -->
+          扫一扫
         </view>
         <view class="subtitle-text">加油!你就要成功了</view>
       </view>

+ 0 - 27
pages/home/index.vue

@@ -213,7 +213,6 @@ import UpsellBook from "./components/upsell-book.vue";
 import UpsellRules from "./components/upsell-rules.vue";
 import UpsellShare from "./components/upsell-share.vue";
 import UpsellQrcode from "./components/upsell-qrcode.vue";
-import { silentLogin } from "@/api/auth";
 const app = getApp();
 
 export default {
@@ -399,32 +398,6 @@ export default {
             this.$refs.upsellQrcodeRef.open(data);
         },
 
-        slientLogin() {
-            let inviteCode = uni.getStorageSync("inviteCode") || "";
-            let token = uni.getStorageSync("token");
-            if (token) return;
-            uni.login({
-                success(res) {
-                    uni.$u.http
-                        .post("/user/wxLogin", {
-                            code: res.code,
-                            inviteCode,
-                        })
-                        .then((response) => {
-                            if (response.code == 200) {
-                                uni.setStorageSync(
-                                    "token",
-                                    response.data.token
-                                );
-                            }
-                        });
-                },
-                fail: (err) => {
-                    console.log(err, "wx.login登录失败");
-                },
-            });
-        },
-
         //查看活动规则
         handleViewSellRules() {
             this.$refs.upsellRulesRef.open();

+ 1 - 1
pages/mine/index.vue

@@ -121,7 +121,7 @@ export default {
 				userId: 0,
 				openid: '',
 				imgPath: '',
-				nickName: '这里是微信昵称.',
+				nickName: '这里是昵称.',
 				mobile: '',
 				tags: [],
 				accountMoney: 0,