Pārlūkot izejas kodu

第一次进入默认不选择隐私协议

xiaohaizhao 2 gadi atpakaļ
vecāks
revīzija
fc6a63a6a5

+ 1 - 0
pages/login/modules/agreement.js

@@ -23,6 +23,7 @@ Component({
                 isAgree
             })
             this.triggerEvent("callBack", isAgree)
+            wx.setStorageSync('isAgree', isAgree);
         },
         checkTheAgreement() {
             wx.showLoading({

+ 61 - 57
pages/login/phone.js

@@ -1,62 +1,66 @@
 import Toast from '@vant/weapp/toast/toast';
 const _Http = getApp().globalData.http,
-    loginMsg = require("./modules/login");
+	loginMsg = require("./modules/login");
 Page({
 
-    /**
-     * 页面的初始数据
-     */
-    data: {
-        isAgree: true,
-        disabled: true, //是否禁用
-        loading: false, //登陆中
-    },
-    onLoad(options) {},
-    /* 微信登录 */
-    wechatLogin() {
-        if (!this.data.isAgree) return Toast({
-            message: '请阅读并勾选用户协议',
-            position: 'bottom'
-        });
-        wx.login({
-            success(res) {
-                if (res.code) {
-                    _Http.loginbywechat({
-                        wechat_code: res.code,
-                        "systemclient": "wechatsaletool"
-                    }).then(res => {
-                        console.log("微信快捷登录", res)
-                        if (res.code == 0) return wx.showToast({
-                            title: res.msg,
-                            icon: "none"
-                        })
-                        loginMsg.loginMsg(res);
-                    })
-                } else {
-                    console.log('登录失败!' + res.errMsg)
-                }
-            }
-        })
-    },
-    /* 用户登录 */
-    userLogin() {
-        if (this.data.loading || this.data.disabled) return;
-        if (!this.data.isAgree) return Toast({
-            message: '请阅读并勾选用户协议',
-            position: 'bottom'
-        });
-        this.setData({
-            loading: true
-        })
-        this.selectComponent('#login').handleLogin();
-    },
-    /* 授权 */
-    agreementChange({
-        detail
-    }) {
-        this.setData({
-            isAgree: detail
-        })
-    },
-    onShareAppMessage() {}
+	/**
+	 * 页面的初始数据
+	 */
+	data: {
+		isAgree: false,
+		disabled: true, //是否禁用
+		loading: false, //登陆中
+	},
+	onLoad(options) {
+		if (wx.getStorageSync('isAgree')) this.setData({
+			isAgree: wx.getStorageSync('isAgree')
+		})
+	},
+	/* 微信登录 */
+	wechatLogin() {
+		if (!this.data.isAgree) return Toast({
+			message: '请阅读并勾选用户协议',
+			position: 'bottom'
+		});
+		wx.login({
+			success(res) {
+				if (res.code) {
+					_Http.loginbywechat({
+						wechat_code: res.code,
+						"systemclient": "wechatsaletool"
+					}).then(res => {
+						console.log("微信快捷登录", res)
+						if (res.code == 0) return wx.showToast({
+							title: res.msg,
+							icon: "none"
+						})
+						loginMsg.loginMsg(res);
+					})
+				} else {
+					console.log('登录失败!' + res.errMsg)
+				}
+			}
+		})
+	},
+	/* 用户登录 */
+	userLogin() {
+		if (this.data.loading || this.data.disabled) return;
+		if (!this.data.isAgree) return Toast({
+			message: '请阅读并勾选用户协议',
+			position: 'bottom'
+		});
+		this.setData({
+			loading: true
+		})
+		this.selectComponent('#login').handleLogin();
+	},
+	/* 授权 */
+	agreementChange({
+		detail
+	}) {
+		this.setData({
+			isAgree: detail
+		})
+	},
+	onShareAppMessage() {}
 })

+ 1 - 0
pages/login/phone.json

@@ -4,6 +4,7 @@
         "Agreement": "./modules/agreement",
         "van-divider": "@vant/weapp/divider/index",
         "account": "./modules/account",
+        "van-toast": "@vant/weapp/toast/index",
         "phone": "./modules/phone"
     }
 }

+ 1 - 0
pages/tabbar/mine/index.js

@@ -70,6 +70,7 @@ Page({
 				let loginMsg = wx.getStorageSync("loginMsg");
 				wx.clearStorageSync();
 				wx.setStorageSync('loginMsg', loginMsg)
+				wx.setStorageSync('isAgree', true)
 				setTimeout(() => {
 					wx.reLaunch({
 						url: '/pages/login/phone',