yuxingxing преди 2 години
родител
ревизия
ba4c06def6
променени са 3 файла, в които са добавени 1278 реда и са изтрити 387 реда
  1. 13 0
      pages.json
  2. 865 0
      pages/users/register/index.vue
  3. 400 387
      pages/users/wechat_login/index.vue

+ 13 - 0
pages.json

@@ -884,6 +884,19 @@
 						}
 					}
 				},
+				{
+					"path": "register/index",
+					"style": {
+						"navigationBarTitleText": "注册",
+						"app-plus": {
+							// #ifdef APP-PLUS
+							"titleNView": {
+								"type": "default"
+							}
+							// #endif
+						}
+					}
+				},
 				{
 					"path": "login/index",
 					"style": {

+ 865 - 0
pages/users/register/index.vue

@@ -0,0 +1,865 @@
+<template>
+	<view class="login-wrapper" :style="colorStyle">
+		<view class="shading">
+			<!-- <image :src="logoUrl" v-if="logoUrl" /> -->
+			<image src="@/static/images/logo@2x.png" />
+		</view>
+		<view class="whiteBg" v-if="formItem === 1">
+			<view class="list" v-if="current !== 1">
+				<form @submit.prevent="submit">
+					<view class="item">
+						<view class="acea-row row-middle">
+							<image src="../static/phone_1.png" style="width: 24rpx; height: 34rpx;"></image>
+							<input type="text" :placeholder="$t(`输入手机号码`)" v-model="account" maxlength="11" required />
+						</view>
+					</view>
+					<view class="item">
+						<view class="acea-row row-middle">
+							<image src="../static/code_1.png" style="width: 28rpx; height: 32rpx;"></image>
+							<input type="password" :placeholder="$t(`填写登录密码`)" v-model="password" required />
+						</view>
+					</view>
+				</form>
+				<!-- <navigator class="forgetPwd" hover-class="none" url="/pages/users/retrievePassword/index">
+					<span class="iconfont icon-wenti"></span>忘记密码
+				</navigator> -->
+			</view>
+			<view class="list" v-if="current !== 0 || appLoginStatus || appleLoginStatus">
+				<view class="item">
+					<view class="acea-row row-middle">
+						<image src="../static/phone_1.png" style="width: 24rpx; height: 34rpx;"></image>
+						<input type="text" :placeholder="$t(`请输入手机号码`)" v-model="account" maxlength="11" />
+					</view>
+				</view>
+				<view class="item">
+					<view class="acea-row row-middle">
+						<image src="../static/code_2.png" style="width: 28rpx; height: 32rpx;"></image>
+						<input type="text" :placeholder="$t(`请输入验证码`)" maxlength="6" class="codeIput"
+							v-model="captcha" />
+						<view class="wrap">
+							<u-toast ref="uToast"></u-toast>
+							<u-code :seconds="seconds" @end="end" @start="start" ref="uCode" @change="codeChange">
+							</u-code>
+							<u-button class="code" size="small" shape="circle" @click="getCode" plain>{{
+									tips
+							}}
+							</u-button>
+						</view>
+					</view>
+				</view>
+				<view class="item" v-if="isShowCode">
+					<view class="acea-row row-middle">
+						<image src="../static/code_2.png" style="width: 28rpx; height: 32rpx;"></image>
+						<input type="text" :placeholder="$t(`请输入验证码`)" class="codeIput" v-model="codeVal" />
+						<view class="code" @click="again"><img :src="codeUrl" /></view>
+					</view>
+				</view>
+				<view class="item">
+					<view class="acea-row row-middle">
+						<image src="../static/code_1.png" style="width: 28rpx; height: 32rpx;"></image>
+						<input type="password" :placeholder="$t(`请输入登录密码`)" v-model="password" required />
+					</view>
+				</view>
+				<view class="item">
+					<view class="acea-row row-middle">
+						<image src="../static/code_1.png" style="width: 28rpx; height: 32rpx;"></image>
+						<input type="password" :placeholder="$t(`请确认登录密码`)" v-model="passwordConfirm" required />
+					</view>
+				</view>
+				<view class="item">
+					<view class="acea-row row-middle">
+						<!-- <image src="@/static/images/contact.png" style="width: 28rpx; height: 32rpx;"></image> -->
+						<u-icon name="share" color="#b7b5b5"></u-icon>
+						<input type="text" :placeholder="$t(`邀请码(6KYSYX)`)" v-model="codeInvitation" required />
+					</view>
+				</view>
+			</view>
+			<view class="protocol">
+				<checkbox-group @change='ChangeIsDefault'>
+					<checkbox :class="inAnimation ? 'trembling' : ''" @animationend='inAnimation = false'
+						:checked="protocol ? true : false" />{{ $t(`已同意`) }} <text class="main-color"
+						@click="privacy(4)">{{ $t(`《注册协议》`) }}</text>
+						<text class="main-color"
+						@click="privacy(4)">{{ $t(`《商城须知》`) }}</text>
+					<text class="main-color" @click="privacy(3)">{{ $t(`《隐私政策》`) }}</text>
+				</checkbox-group>
+			</view>
+			<view class="logon" @click="loginMobile" v-if="current !== 0">{{ $t(`同意协议注册`) }}</view>
+			<view class="logon" @click="submit" v-if="current === 0">{{ $t(`同意协议注册`) }}</view>
+			<!-- #ifndef APP-PLUS -->
+			<!-- <view class="tips">
+				<view v-if="current == 0" @click="current = 1">{{ $t(`快速登录`) }}</view>
+				<view v-if="current == 1" @click="current = 0">{{ $t(`账号登录`) }}</view>
+			</view> -->
+			<!-- #endif -->
+			<!-- #ifdef APP-PLUS -->
+			<view class="appLogin" v-if="!appLoginStatus && !appleLoginStatus">
+				<view class="hds">
+					<span class="line"></span>
+					<p>{{ $t(`其他方式登录`) }}</p>
+					<span class="line"></span>
+				</view>
+				<view class="btn-wrapper">
+					<view class="btn wx" @click="wxLogin">
+						<span class="iconfont icon-s-weixindenglu1"></span>
+					</view>
+					<view class="btn mima" v-if="current == 1" @click="current = 0">
+						<span class="iconfont icon-s-mimadenglu1"></span>
+					</view>
+					<view class="btn yanzheng" v-if="current == 0" @click="current = 1">
+						<span class="iconfont icon-s-yanzhengmadenglu1"></span>
+					</view>
+					<view class="apple-btn" @click="appleLogin" v-if="appleShow">
+						<view class="iconfont icon-s-pingguo"></view>
+					</view>
+				</view>
+			</view>
+			<!-- #endif -->
+		</view>
+		<view class="bottom"></view>
+	</view>
+</template>
+<script>
+import dayjs from "@/plugin/dayjs/dayjs.min.js";
+import sendVerifyCode from "@/mixins/SendVerifyCode";
+import {
+	loginH5,
+	loginMobile,
+	registerVerify,
+	register,
+	getCodeApi,
+	getUserInfo,
+	appleLogin
+} from "@/api/user";
+import attrs, {
+	required,
+	alpha_num,
+	chs_phone
+} from "@/utils/validate";
+import {
+	getLogo
+} from "@/api/public";
+// import cookie from "@/utils/store/cookie";
+import {
+	VUE_APP_API_URL
+} from "@/utils";
+// #ifdef APP-PLUS
+import {
+	wechatAppAuth
+} from '@/api/api.js'
+// #endif
+const BACK_URL = "login_back_url";
+import colors from '@/mixins/color.js';
+export default {
+	name: "Login",
+	mixins: [sendVerifyCode, colors],
+	data: function () {
+		return {
+			tips: '',
+			seconds: 60,
+			inAnimation: false,
+			protocol: false,
+			navList: [this.$t(`快速登录`), this.$t(`账号登录`)],
+			current: 1,
+			account: "",
+			password: "",
+			passwordConfirm: "",
+			codeInvitation: "",
+			captcha: "",
+			formItem: 1,
+			type: "login",
+			logoUrl: "",
+			keyCode: "",
+			codeUrl: "",
+			codeVal: "",
+			isShowCode: false,
+			appLoginStatus: false, // 微信登录强制绑定手机号码状态
+			appUserInfo: null, // 微信登录保存的用户信息
+			appleLoginStatus: false, // 苹果登录强制绑定手机号码状态
+			appleUserInfo: null,
+			appleShow: false, // 苹果登录版本必须要求ios13以上的
+			keyLock: true
+		};
+	},
+	watch: {
+		formItem: function (nval, oVal) {
+			if (nval == 1) {
+				this.type = 'login'
+			} else {
+				this.type = 'register'
+			}
+		}
+	},
+	onLoad() {
+		let self = this
+		uni.getSystemInfo({
+			success: (res) => {
+				if (res.platform.toLowerCase() == 'ios' && this.getSystem(res.system)) {
+					self.appleShow = true
+				}
+			}
+		});
+	},
+	mounted: function () {
+		// this.getCode();
+		// this.getLogoImage();
+	},
+	methods: {
+		codeChange(text) {
+			this.tips = text;
+		},
+		ChangeIsDefault(e) {
+			this.$set(this, 'protocol', !this.protocol);
+		},
+		privacy(type) {
+			uni.navigateTo({
+				url: "/pages/users/privacy/index?type=" + type
+			})
+		},
+		// IOS 版本号判断
+		getSystem(system) {
+			let str
+			system.toLowerCase().indexOf('ios') === -1 ? str = system : str = system.split(' ')[1]
+			if (str.indexOf('.'))
+				return str.split('.')[0] >= 13
+			return str >= 13
+		},
+		// 苹果登录
+		appleLogin() {
+			let self = this
+			this.account = ''
+			this.captcha = ''
+			if (!self.protocol) {
+				this.inAnimation = true
+				return self.$util.Tips({
+					title: '请先阅读并同意协议'
+				});
+			}
+			uni.showLoading({
+				title: this.$t(`登录中`)
+			})
+			uni.login({
+				provider: 'apple',
+				timeout: 10000,
+				success(loginRes) {
+					uni.getUserInfo({
+						provider: 'apple',
+						success: function (infoRes) {
+							self.appleUserInfo = infoRes.userInfo
+							self.appleLoginApi()
+						},
+						fail() {
+							uni.showToast({
+								title: self.$t(`获取用户信息失败`),
+								icon: 'none',
+								duration: 2000
+							})
+						},
+						complete() {
+							uni.hideLoading()
+						}
+					});
+				},
+				fail(error) {
+					console.log(error)
+				}
+			})
+		},
+		// 苹果登录Api
+		appleLoginApi() {
+			let self = this
+			appleLogin({
+				openId: self.appleUserInfo.openId,
+				email: self.appleUserInfo.email || '',
+				phone: this.account,
+				captcha: this.captcha
+			}).then(({
+				data
+			}) => {
+				if (data.isbind) {
+					uni.showModal({
+						title: self.$t(`提示`),
+						content: self.$t(`请绑定手机号后,继续操作`),
+						showCancel: false,
+						success: function (res) {
+							if (res.confirm) {
+								self.current = 1
+								self.appleLoginStatus = true
+							}
+						}
+					});
+				} else {
+					self.$store.commit("LOGIN", {
+						'token': data.token,
+						'time': data.expires_time - self.$Cache.time()
+					});
+					let backUrl = self.$Cache.get(BACK_URL) || "/pages/index/index";
+					self.$Cache.clear(BACK_URL);
+					self.$store.commit("SETUID", data.userInfo.userId);
+					uni.reLaunch({
+						url: backUrl
+					});
+				}
+			}).catch(error => {
+				uni.showModal({
+					title: self.$t(`提示`),
+					content: self.$t(`错误信息`) + `${error}`,
+					success: function (res) {
+						if (res.confirm) {
+							console.log(self.$t(`用户点击确定`));
+						} else if (res.cancel) {
+							console.log(self.$t(`用户点击取消`));
+						}
+					}
+				});
+			})
+		},
+		// App微信登录
+		wxLogin() {
+			let self = this
+			this.account = ''
+			this.captcha = ''
+			if (!self.protocol) {
+				this.inAnimation = true
+				return self.$util.Tips({
+					title: '请先阅读并同意协议'
+				});
+			}
+			uni.showLoading({
+				title: self.$t(`登录中`)
+			})
+			uni.login({
+				provider: 'weixin',
+				success: function (loginRes) {
+					// 获取用户信息
+					uni.getUserInfo({
+						provider: 'weixin',
+						success: function (infoRes) {
+							self.appUserInfo = infoRes.userInfo
+							self.wxLoginApi()
+						},
+						fail() {
+							uni.showToast({
+								title: self.$t(`获取用户信息失败`),
+								icon: 'none',
+								duration: 2000
+							})
+						},
+						complete() {
+							uni.hideLoading()
+						}
+					});
+				},
+				fail() {
+					uni.showToast({
+						title: self.$t(`登录失败`),
+						icon: 'none',
+						duration: 2000
+					})
+				}
+			});
+		},
+
+		wxLoginApi() {
+			let self = this
+			wechatAppAuth({
+				userInfo: self.appUserInfo,
+				phone: this.account,
+				code: this.captcha
+			}).then(({
+				data
+			}) => {
+				if (data.isbind) {
+					uni.showModal({
+						title: self.$t(`提示`),
+						content: self.$t(`请绑定手机号后,继续操作`),
+						showCancel: false,
+						success: function (res) {
+							if (res.confirm) {
+								self.current = 1
+								self.appLoginStatus = true
+							}
+						}
+					});
+				} else {
+					self.$store.commit("LOGIN", {
+						'token': data.token,
+						'time': data.expires_time - self.$Cache.time()
+					});
+					let backUrl = self.$Cache.get(BACK_URL) || "/pages/index/index";
+					self.$Cache.clear(BACK_URL);
+					self.$store.commit("SETUID", data.userInfo.userId);
+					uni.reLaunch({
+						url: backUrl
+					});
+				}
+			}).catch(error => {
+				uni.showModal({
+					title: self.$t(`提示`),
+					content: self.$t(`错误信息`) + `${error}`,
+					success: function (res) {
+						if (res.confirm) {
+							console.log(self.$t(`用户点击确定`));
+						} else if (res.cancel) {
+							console.log(self.$t(`用户点击取消`));
+						}
+					}
+				});
+			})
+		},
+		again() {
+			this.codeUrl =
+				VUE_APP_API_URL +
+				"/sms_captcha?" +
+				"key=" +
+				this.keyCode +
+				Date.parse(new Date());
+		},
+		code() {
+			let that = this
+			if (!that.protocol) {
+				this.inAnimation = true
+				return that.$util.Tips({
+					title: '请先阅读并同意协议'
+				});
+			}
+			getCodeApi()
+				.then(res => {
+					that.keyCode = res.data.key;
+					that.getCode();
+				})
+				.catch(res => {
+					that.$util.Tips({
+						title: res
+					});
+				});
+		},
+		async getLogoImage() {
+			let that = this;
+			let logoUrl = "https://demo26.crmeb.net/statics/system_images/login_logo.jpeg"
+			that.logoUrl = logoUrl;
+			getLogo(2).then(res => {
+				that.logoUrl = res.data.logo_url;
+			});
+		},
+		async loginMobile() {
+			let that = this;
+			if (!that.account) return that.$util.Tips({
+				title: that.$t(`请输入手机号码`)
+			});
+			if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
+				title: that.$t(`请输入正确的手机号码`)
+			});
+			if (!that.captcha) return that.$util.Tips({
+				title: that.$t(`请输入验证码`)
+			});
+			if (!/^[\w\d]+$/i.test(that.captcha)) return that.$util.Tips({
+				title: that.$t(`请输入正确的验证码`)
+			});
+			if (!that.password) return that.$util.Tips({
+				title: that.$t(`请输入登录密码`)
+			});
+			if (/^([0-9]|[a-z]|[A-Z]){0,6}$/i.test(that.password)) return that.$util.Tips({
+				title: that.$t(`您输入的密码过于简单`)
+			});
+			if (!that.passwordConfirm) return that.$util.Tips({
+				title: that.$t(`请确认登录密码`)
+			});
+			if (that.passwordConfirm != that.password) return that.$util.Tips({
+				title: that.$t(`确认密码与登录密码不一致,请修正后注册`)
+			});
+			if (!that.codeInvitation) return that.$util.Tips({
+				title: that.$t(`请输入邀请码`)
+			});
+			if (!that.protocol) {
+				this.inAnimation = true
+				return that.$util.Tips({
+					title: '请先阅读并同意协议'
+				});
+			}
+			if (that.appLoginStatus) {
+				that.wxLoginApi()
+			} else if (that.appleLoginStatus) {
+				that.appleLoginApi()
+			} else {
+				if (this.keyLock) {
+					this.keyLock = !this.keyLock
+				} else {
+					return that.$util.Tips({
+						title: that.$t(`请勿重复点击`)
+					});
+				}
+				loginMobile({
+					phone: that.account,
+					captcha: that.captcha,
+					spread: that.$Cache.get("spread")
+				})
+					.then(res => {
+						let data = res.data;
+						that.$store.commit("LOGIN", {
+							'token': data.token,
+							'time': data.expires_time - this.$Cache.time()
+						});
+						let backUrl = that.$Cache.get(BACK_URL) || "/pages/index/index";
+						that.$Cache.clear(BACK_URL);
+						getUserInfo().then(res => {
+							this.keyLock = true
+							that.$store.commit("SETUID", res.data.userId);
+							if (backUrl.indexOf('/pages/users/login/index') !== -1) {
+								backUrl = '/pages/index/index';
+							}
+							uni.reLaunch({
+								url: backUrl
+							});
+						})
+					})
+					.catch(res => {
+						this.keyLock = true
+						that.$util.Tips({
+							title: res
+						});
+					});
+			}
+
+		},
+		async register() {
+			let that = this;
+			if (!that.protocol) {
+				this.inAnimation = true
+				return that.$util.Tips({
+					title: '请先阅读并同意协议'
+				});
+			}
+			if (!that.account) return that.$util.Tips({
+				title: that.$t(`请填写手机号码`)
+			});
+			if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
+				title: that.$t(`请输入正确的手机号码`)
+			});
+			if (!that.captcha) return that.$util.Tips({
+				title: that.$t(`请填写验证码`)
+			});
+			if (!/^[\w\d]+$/i.test(that.captcha)) return that.$util.Tips({
+				title: that.$t(`请输入正确的验证码`)
+			});
+			if (!that.password) return that.$util.Tips({
+				title: that.$t(`请填写密码`)
+			});
+			if (/^([0-9]|[a-z]|[A-Z]){0,6}$/i.test(that.password)) return that.$util.Tips({
+				title: that.$t(`您输入的密码过于简单`)
+			});
+			register({
+				account: that.account,
+				captcha: that.captcha,
+				password: that.password,
+				spread: that.$Cache.get("spread")
+			})
+				.then(res => {
+					that.$util.Tips({
+						title: res
+					});
+					that.formItem = 1;
+				})
+				.catch(res => {
+					that.$util.Tips({
+						title: res
+					});
+				});
+		},
+		async getCode() {
+			let that = this;
+			if (this.$refs.uCode.canGetCode) {
+				// 模拟向后端请求验证码
+				uni.showLoading({
+					title: '正在获取验证码'
+				})
+				setTimeout(() => {
+					uni.hideLoading();
+					// 这里此提示会被this.start()方法中的提示覆盖
+					uni.$u.toast('验证码已发送');
+					// 通知验证码组件内部开始倒计时
+					this.$refs.uCode.start();
+				}, 2000);
+			} else {
+				uni.$u.toast('倒计时结束后再发送');
+			}
+			// if (!that.protocol) {
+			// 	this.inAnimation = true
+			// 	return that.$util.Tips({
+			// 		title: '请先阅读并同意协议'
+			// 	});
+			// }
+			// if (!that.account) return that.$util.Tips({
+			// 	title: that.$t(`请填写手机号码`)
+			// });
+			// if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
+			// 	title: that.$t(`请输入正确的手机号码`)
+			// });
+			// if (that.formItem == 2) that.type = "register";
+
+			// await registerVerify({
+			// 	phone: that.account,
+			// 	type: that.type,
+			// 	key: that.keyCode,
+			// 	code: that.codeVal
+			// })
+			// 	.then(res => {
+			// 		that.$util.Tips({
+			// 			title: res.msg
+			// 		});
+			// 		that.sendCode();
+			// 	})
+			// 	.catch(res => {
+			// 		that.$util.Tips({
+			// 			title: res
+			// 		});
+			// 	});
+		},
+		navTap: function (index) {
+			this.current = index;
+		},
+		async submit() {
+			let that = this;
+			if (!that.protocol) {
+				this.inAnimation = true
+				return that.$util.Tips({
+					title: '请先阅读并同意协议'
+				});
+			}
+			if (!that.account) return that.$util.Tips({
+				title: that.$t(`请填写账号`)
+			});
+			if (!/^[\w\d]{5,16}$/i.test(that.account)) return that.$util.Tips({
+				title: that.$t(`请输入正确的账号`)
+			});
+			if (!that.password) return that.$util.Tips({
+				title: that.$t(`请填写密码`)
+			});
+			if (this.keyLock) {
+				this.keyLock = !this.keyLock
+			} else {
+				return that.$util.Tips({
+					title: that.$t(`请勿重复点击`)
+				});
+			}
+			loginH5({
+				account: that.account,
+				password: that.password,
+				spread: that.$Cache.get("spread")
+			})
+				.then(({
+					data
+				}) => {
+					that.$store.commit("LOGIN", {
+						'token': data.token,
+						'time': data.expires_time - this.$Cache.time()
+					});
+					let backUrl = that.$Cache.get(BACK_URL) || "/pages/index/index";
+					that.$Cache.clear(BACK_URL);
+					getUserInfo().then(res => {
+						this.keyLock = true
+						that.$store.commit("SETUID", res.data.userId);
+						uni.reLaunch({
+							url: backUrl
+						});
+					}).catch(error => {
+						this.keyLock = true
+					})
+				})
+				.catch(e => {
+					this.keyLock = true
+					that.$util.Tips({
+						title: e
+					});
+				});
+		}
+	}
+};
+</script>
+<style>
+page {
+	background: #fff;
+}
+</style>
+<style lang="scss">
+.appLogin {
+	margin-top: 60rpx;
+
+	.hds {
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		font-size: 24rpx;
+		color: #B4B4B4;
+
+		.line {
+			width: 68rpx;
+			height: 1rpx;
+			background: #CCCCCC;
+		}
+
+		p {
+			margin: 0 20rpx;
+		}
+	}
+
+	.btn-wrapper {
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		margin-top: 30rpx;
+
+		.btn {
+			display: flex;
+			align-items: center;
+			justify-content: center;
+			width: 68rpx;
+			height: 68rpx;
+			border-radius: 50%;
+		}
+
+		.apple-btn {
+			display: flex;
+			align-items: center;
+			justify-content: center;
+			width: 68rpx;
+			height: 68rpx;
+			border-radius: 50%;
+			background: #000;
+
+
+			.icon-s-pingguo {
+				color: #fff;
+				font-size: 44rpx;
+			}
+		}
+
+		.iconfont {
+			font-size: 40rpx;
+			color: #fff;
+		}
+
+		.wx {
+			margin-right: 30rpx;
+			background-color: #61C64F;
+		}
+
+		.mima {
+			margin-right: 30rpx;
+			background-color: #28B3E9;
+		}
+
+		.yanzheng {
+			margin-right: 30rpx;
+			background-color: #F89C23;
+		}
+
+	}
+}
+
+.code img {
+	width: 100%;
+	height: 100%;
+}
+
+.acea-row.row-middle {
+	input {
+		margin-left: 20rpx;
+		display: block;
+	}
+}
+
+.login-wrapper {
+	padding: 30rpx;
+
+	.shading {
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		width: 100%;
+
+		/* #ifdef APP-VUE */
+		margin-top: 50rpx;
+		/* #endif */
+		/* #ifndef APP-VUE */
+
+		margin-top: 20rpx;
+		/* #endif */
+
+
+		image {
+			width: 240rpx;
+			height: 120rpx;
+		}
+	}
+
+	.whiteBg {
+		margin-top: 100rpx;
+
+		.list {
+			border-radius: 16rpx;
+			overflow: hidden;
+
+			.item {
+				border-bottom: 1px solid #F0F0F0;
+				background: #fff;
+
+				.row-middle {
+					position: relative;
+					padding: 16rpx 45rpx;
+
+					input {
+						flex: 1;
+						font-size: 28rpx;
+						height: 80rpx;
+					}
+
+					.code {
+						position: absolute;
+						right: 30rpx;
+						top: 50%;
+						color: var(--view-theme);
+						font-size: 26rpx;
+						transform: translateY(-50%);
+					}
+				}
+			}
+		}
+
+		.logon {
+			display: flex;
+			align-items: center;
+			justify-content: center;
+			width: 100%;
+			height: 86rpx;
+			margin-top: 80rpx;
+			background-color: var(--view-theme);
+			border-radius: 120rpx;
+			color: #FFFFFF;
+			font-size: 30rpx;
+		}
+
+		.tips {
+			margin: 30rpx;
+			text-align: center;
+			color: #999;
+		}
+	}
+}
+
+.protocol {
+	margin-top: 40rpx;
+	color: #999999;
+	font-size: 24rpx;
+	text-align: center;
+	bottom: 20rpx;
+}
+
+.trembling {
+	animation: shake 0.6s;
+}
+
+.main-color {
+	color: var(--view-theme);
+}
+</style>

+ 400 - 387
pages/users/wechat_login/index.vue

@@ -9,7 +9,7 @@
 			<view class="icon" @click="home" v-else>
 				<image src="../static/home.png"></image>
 			</view> -->
-			{{$t(`账户登录`)}}
+			{{ $t(`账户登录`) }}
 		</view>
 		<!-- #endif -->
 		<view class="wechat_login">
@@ -18,19 +18,20 @@
 			</view>
 			<view class="btn-wrapper">
 				<!-- #ifdef H5 -->
-				<button hover-class="none" @click="wechatLogin" class="bg-green btn1">{{$t(`微信登录`)}}</button>
+				<button hover-class="none" @click="wechatLogin" class="bg-green btn1">{{ $t(`微信登录`) }}</button>
 				<!-- #endif -->
 				<!-- #ifdef MP -->
 				<button v-if="canUseGetUserProfile && code" hover-class="none" @tap="getUserProfile"
-					class="bg-green btn1">{{$t(`微信用户一键登录`)}}</button>
+					class="bg-green btn1">{{ $t(`微信用户一键登录`) }}</button>
 				<button v-else hover-class="none" open-type="getUserInfo" @getuserinfo="setUserInfo"
-					class="bg-green btn1">{{$t(`微信用户一键登录`)}}</button>
+					class="bg-green btn1">{{ $t(`微信用户一键登录`) }}</button>
 				<!-- #endif -->
-				<button hover-class="none" @click="isUp = true" class="btn2">{{$t(`手机号登录/注册`)}}</button>
+				<button hover-class="none" @click="isUp = true" class="btn2">{{ $t(`手机号登录/注册`) }}</button>
 			</view>
 		</view>
 		<block v-if="isUp">
-			<mobileLogin :isUp="isUp" @close="maskClose" :wxcode="code" :authKey="authKey" @wechatPhone="wechatPhone"></mobileLogin>
+			<mobileLogin :isUp="isUp" @close="maskClose" :wxcode="code" :authKey="authKey" @wechatPhone="wechatPhone">
+			</mobileLogin>
 		</block>
 		<block v-if="isPhoneBox">
 			<routinePhone :logoUrl="logoUrl" :isPhoneBox="isPhoneBox" @close="bindPhoneClose" :authKey="authKey">
@@ -40,429 +41,441 @@
 </template>
 
 <script>
-	const app = getApp();
-	let statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
-	import mobileLogin from '../components/login_mobile/index.vue';
-	import routinePhone from '../components/login_mobile/routine_phone.vue';
-	import {
-		getLogo,
-		silenceAuth,
-		getUserPhone,
-		wechatAuthV2
-	} from '@/api/public';
-	import {
-		LOGO_URL,
-		EXPIRES_TIME,
-		USER_INFO,
-		STATE_R_KEY
-	} from '@/config/cache';
-	import {
-		getUserInfo
-	} from '@/api/user.js';
-	import Routine from '@/libs/routine';
-	import wechat from '@/libs/wechat';
-	import colors from '@/mixins/color.js';
-	export default {
-		mixins:[colors],
-		data() {
-			return {
-				isUp: false,
-				phone: '',
-				statusBarHeight: statusBarHeight,
-				isHome: false,
-				isPhoneBox: false,
-				logoUrl: '',
-				code: '',
-				authKey: '',
-				options: '',
-				userInfo: {},
-				codeNum: 0,
-				canUseGetUserProfile: false
-			};
+const app = getApp();
+let statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
+import mobileLogin from '../components/login_mobile/index.vue';
+import routinePhone from '../components/login_mobile/routine_phone.vue';
+import {
+	getLogo,
+	silenceAuth,
+	getUserPhone,
+	wechatAuthV2
+} from '@/api/public';
+import {
+	LOGO_URL,
+	EXPIRES_TIME,
+	USER_INFO,
+	STATE_R_KEY
+} from '@/config/cache';
+import {
+	getUserInfo
+} from '@/api/user.js';
+import Routine from '@/libs/routine';
+import wechat from '@/libs/wechat';
+import colors from '@/mixins/color.js';
+export default {
+	mixins: [colors],
+	data() {
+		return {
+			isUp: false,
+			phone: '',
+			statusBarHeight: statusBarHeight,
+			isHome: false,
+			isPhoneBox: false,
+			logoUrl: '',
+			code: '',
+			authKey: '',
+			options: '',
+			userInfo: {},
+			codeNum: 0,
+			canUseGetUserProfile: false
+		};
+	},
+	components: {
+		mobileLogin,
+		routinePhone
+	},
+	onLoad(options) {
+		if (uni.getUserProfile) {
+			this.canUseGetUserProfile = true
+		}
+		this.logoUrl = "https://demo26.crmeb.net/statics/system_images/login_logo.jpeg";
+		// getLogo().then(res => {
+		// 	this.logoUrl = res.data.logo_url;
+		// });
+		let that = this;
+		// #ifdef MP
+		Routine.getCode()
+			.then(code => {
+				this.code = code
+			})
+		// #endif
+		// #ifdef H5
+		document.body.addEventListener('focusout', () => {
+			setTimeout(() => {
+				const scrollHeight = document.documentElement.scrollTop || document.body
+					.scrollTop ||
+					0;
+				window.scrollTo(0, Math.max(scrollHeight - 1, 0));
+			}, 100);
+		});
+		const {
+			code,
+			state,
+			scope
+		} = options;
+		this.options = options;
+		// 获取确认授权code
+		this.code = code || '';
+		if (code && this.options.scope !== 'snsapi_base') {
+			let spread = app.globalData.spid ? app.globalData.spid : '';
+			//公众号授权登录回调
+			wechat
+				.auth(code, state)
+				.then(res => {
+					if (res.key !== undefined && res.key) {
+						that.authKey = res.key;
+						that.isUp = true;
+					} else {
+						let time = res.expires_time - that.$Cache.time();
+						that.$store.commit('LOGIN', {
+							token: res.token,
+							time: time
+						});
+						that.userInfo = res.userInfo;
+						that.$store.commit('SETUID', res.userInfo.userId);
+						that.$store.commit('UPDATE_USERINFO', res.userInfo);
+						that.wechatPhone();
+					}
+				})
+				.catch(error => {
+					// location.replace("/");
+				});
+		}
+		// #endif
+		let pages = getCurrentPages();
+		let prePage = pages[pages.length - 2];
+		if (prePage && prePage.route == 'pages/order_addcart/order_addcart') {
+			this.isHome = true;
+		} else {
+			this.isHome = false;
+		}
+	},
+	methods: {
+		back() {
+			uni.navigateBack();
+		},
+		home() {
+			uni.switchTab({
+				url: '/pages/index/index'
+			})
 		},
-		components: {
-			mobileLogin,
-			routinePhone
+		// 弹窗关闭
+		maskClose() {
+			this.isUp = false;
 		},
-		onLoad(options) {
-			if (uni.getUserProfile) {
-				this.canUseGetUserProfile = true
+		bindPhoneClose(data) {
+			if (data.isStatus) {
+				this.isPhoneBox = false;
+				this.$util.Tips({
+					title: this.$t(`登录成功`),
+					icon: 'success'
+				}, {
+					tab: 3
+				});
+			} else {
+				this.isPhoneBox = false;
 			}
-			this.logoUrl = "https://demo26.crmeb.net/statics/system_images/login_logo.jpeg";
-			// getLogo().then(res => {
-			// 	this.logoUrl = res.data.logo_url;
-			// });
-			let that = this;
-			// #ifdef MP
+		},
+		// #ifdef MP
+		// 小程序获取手机号码
+		getphonenumber(e) {
+			uni.showLoading({
+				title: this.$t(`正在登录中`)
+			});
 			Routine.getCode()
 				.then(code => {
-					this.code = code
+					this.getUserPhoneNumber(e.detail.encryptedData, e.detail.iv, code);
 				})
-			// #endif
-			// #ifdef H5
-			document.body.addEventListener('focusout', () => {
-				setTimeout(() => {
-					const scrollHeight = document.documentElement.scrollTop || document.body
-						.scrollTop ||
-						0;
-					window.scrollTo(0, Math.max(scrollHeight - 1, 0));
-				}, 100);
-			});
-			const {
-				code,
-				state,
-				scope
-			} = options;
-			this.options = options;
-			// 获取确认授权code
-			this.code = code || '';
-			if (code && this.options.scope !== 'snsapi_base') {
-				let spread = app.globalData.spid ? app.globalData.spid : '';
-				//公众号授权登录回调
-				wechat
-					.auth(code, state)
-					.then(res => {
-						if (res.key !== undefined && res.key) {
-							that.authKey = res.key;
-							that.isUp = true;
-						} else {
-							let time = res.expires_time - that.$Cache.time();
-							that.$store.commit('LOGIN', {
-								token: res.token,
-								time: time
-							});
-							that.userInfo = res.userInfo;
-							that.$store.commit('SETUID', res.userInfo.userId);
-							that.$store.commit('UPDATE_USERINFO', res.userInfo);
-							that.wechatPhone();
-						}
-					})
-					.catch(error => {
-						// location.replace("/");
-					});
-			}
-			// #endif
-			let pages = getCurrentPages();
-			let prePage = pages[pages.length - 2];
-			if (prePage && prePage.route == 'pages/order_addcart/order_addcart') {
-				this.isHome = true;
-			} else {
-				this.isHome = false;
-			}
+				.catch(error => {
+					uni.$emit('closePage', false);
+					uni.hideLoading();
+				});
 		},
-		methods: {
-			back() {
-				uni.navigateBack();
-			},
-			home() {
-				uni.switchTab({
-					url: '/pages/index/index'
-				})
-			},
-			// 弹窗关闭
-			maskClose() {
-				this.isUp = false;
-			},
-			bindPhoneClose(data) {
-				if (data.isStatus) {
-					this.isPhoneBox = false;
+		// 小程序获取手机号码回调
+		getUserPhoneNumber(encryptedData, iv, code) {
+			getUserPhone({
+				encryptedData: encryptedData,
+				iv: iv,
+				code: code,
+				spread_spid: app.globalData.spid,
+				spread_code: app.globalData.code
+			})
+				.then(res => {
+					let time = res.data.expires_time - this.$Cache.time();
+					this.$store.commit('LOGIN', {
+						token: res.data.token,
+						time: time
+					});
+					this.userInfo = res.data.userInfo;
+					this.$store.commit('SETUID', res.data.userInfo.userId);
+					this.$store.commit('UPDATE_USERINFO', res.data.userInfo);
+					this.$Cache.clear('snsapiKey');
 					this.$util.Tips({
 						title: this.$t(`登录成功`),
 						icon: 'success'
 					}, {
 						tab: 3
 					});
-				} else {
-					this.isPhoneBox = false;
-				}
-			},
-			// #ifdef MP
-			// 小程序获取手机号码
-			getphonenumber(e) {
-				uni.showLoading({
-					title: this.$t(`正在登录中`)
-				});
-				Routine.getCode()
-					.then(code => {
-						this.getUserPhoneNumber(e.detail.encryptedData, e.detail.iv, code);
-					})
-					.catch(error => {
-						uni.$emit('closePage', false);
-						uni.hideLoading();
-					});
-			},
-			// 小程序获取手机号码回调
-			getUserPhoneNumber(encryptedData, iv, code) {
-				getUserPhone({
-						encryptedData: encryptedData,
-						iv: iv,
-						code: code,
-						spread_spid: app.globalData.spid,
-						spread_code: app.globalData.code
-					})
-					.then(res => {
-						let time = res.data.expires_time - this.$Cache.time();
-						this.$store.commit('LOGIN', {
-							token: res.data.token,
-							time: time
-						});
-						this.userInfo = res.data.userInfo;
-						this.$store.commit('SETUID', res.data.userInfo.userId);
-						this.$store.commit('UPDATE_USERINFO', res.data.userInfo);
-						this.$Cache.clear('snsapiKey');
-						this.$util.Tips({
-							title: this.$t(`登录成功`),
-							icon: 'success'
-						}, {
-							tab: 3
-						});
-					})
-					.catch(res => {
-						uni.hideLoading();
-					});
-			},
-			/**
-			 * 获取个人用户信息
-			 */
-			getUserInfo: function() {
-				let that = this;
-				getUserInfo().then(res => {
+				})
+				.catch(res => {
 					uni.hideLoading();
-					that.userInfo = res.data;
-					that.$store.commit('SETUID', res.data.userId);
-					that.$store.commit('UPDATE_USERINFO', res.data);
-					that.$util.Tips({
-						title: that.$t(`登录成功`),
-						icon: 'success'
-					}, {
-						tab: 3
-					});
 				});
-			},
-			setUserInfo(e) {
-				uni.showLoading({
-					title: this.$t(`正在登录中`)
+		},
+		/**
+		 * 获取个人用户信息
+		 */
+		getUserInfo: function () {
+			let that = this;
+			getUserInfo().then(res => {
+				uni.hideLoading();
+				that.userInfo = res.data;
+				that.$store.commit('SETUID', res.data.userId);
+				that.$store.commit('UPDATE_USERINFO', res.data);
+				that.$util.Tips({
+					title: that.$t(`登录成功`),
+					icon: 'success'
+				}, {
+					tab: 3
 				});
-				Routine.getCode()
-					.then(code => {
-						this.getWxUser(code);
-					})
-					.catch(res => {
-						uni.hideLoading();
-					});
-			},
-			//小程序授权api替换 getUserInfo
-			getUserProfile() {
-				uni.showLoading({
-					title: this.$t(`正在登录中`)
+			});
+		},
+		setUserInfo(e) {
+			uni.showLoading({
+				title: this.$t(`正在登录中`)
+			});
+			Routine.getCode()
+				.then(code => {
+					this.getWxUser(code);
+				})
+				.catch(res => {
+					uni.hideLoading();
 				});
-				let self = this;
-				Routine.getUserProfile()
-					.then(res => {
-						let userInfo = res.userInfo;
-						console.log(this.code);
-						console.log(userInfo);
-						userInfo.code = this.code;
-						// userInfo.spread_spid = app.globalData.spid || this.$Cache.get('spread'); //获取推广人ID
-						// userInfo.spread_code = app.globalData.code; //获取推广人分享二维码ID
-						// 模拟授权登录成功
-						self.$store.commit('LOGIN', {
-							token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ2NC5jcm1lYi5uZXQiLCJhdWQiOiJ2NC5jcm1lYi5uZXQiLCJpYXQiOjE2NjY1Nzk2NzgsIm5iZiI6MTY2NjU3OTY3OCwiZXhwIjoxNjY5MTcxNjc4LCJqdGkiOnsiaWQiOjM0MzkxLCJ0eXBlIjoiYXBpIn19.GA3Lyr3HueKXwz9GWS6KrO4rYKmJzn3l7ko1nsl7E7Q',
-							time: 9999999999999
-						});
-						this.getUserInfo()
-						// Routine.authUserInfo(userInfo)
-						// 	.then(res => {
-						// 		if (res.data.key !== undefined && res.data.key) {
-						// 			uni.hideLoading();
-						// 			self.authKey = res.data.key;
-						// 			self.isPhoneBox = true;
-						// 		} else {
-						// 			uni.hideLoading();
-						// 			let time = res.data.expires_time - self.$Cache.time();
-						// 			self.$store.commit('LOGIN', {
-						// 				token: res.data.token,
-						// 				time: time
-						// 			});
-						// 			this.getUserInfo()
-						// 		}
-						// 	})
-						// 	.catch(res => {
-						// 		uni.hideLoading();
-						// 		uni.showToast({
-						// 			title: res.msg,
-						// 			icon: 'none',
-						// 			duration: 2000
-						// 		});
-						// 	});
-					})
-					.catch(res => {
-						uni.hideLoading();
+		},
+		//小程序授权api替换 getUserInfo
+		getUserProfile() {
+			uni.showLoading({
+				title: this.$t(`正在登录中`)
+			});
+			let self = this;
+			Routine.getUserProfile()
+				.then(res => {
+					let userInfo = res.userInfo;
+					console.log(this.code);
+					console.log(userInfo);
+					userInfo.code = this.code;
+					uni.showToast({
+						title: "手机号暂未注册,即将跳转注册界面",
+						icon: 'none',
+						duration: 2000
 					});
-			},
-			getWxUser(code) {
-				let self = this;
-				Routine.getUserInfo()
-					.then(res => {
-						let userInfo = res.userInfo;
-						userInfo.code = code;
-						userInfo.spread_spid = app.globalData.spid; //获取推广人ID
-						userInfo.spread_code = app.globalData.code; //获取推广人分享二维码ID
-						Routine.authUserInfo(userInfo)
-							.then(res => {
-								if (res.data.key !== undefined && res.data.key) {
-									uni.hideLoading();
-									self.authKey = res.data.key;
-									self.isPhoneBox = true;
-								} else {
-									uni.hideLoading();
-									let time = res.data.expires_time - self.$Cache.time();
-									self.$store.commit('LOGIN', {
-										token: res.data.token,
-										time: time
-									});
-									self.$util.Tips({
-										title: res.msg,
-										icon: 'success'
-									}, {
-										tab: 3
-									});
-								}
-							})
-							.catch(res => {
+					setTimeout(() => {
+						// 自动登录失败时,跳转用户注册
+						uni.navigateTo({
+							url: '/pages/users/register/index'
+						})
+					}, 2000);
+
+					// userInfo.spread_spid = app.globalData.spid || this.$Cache.get('spread'); //获取推广人ID
+					// userInfo.spread_code = app.globalData.code; //获取推广人分享二维码ID
+					// 模拟授权登录成功
+					// self.$store.commit('LOGIN', {
+					// 	token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ2NC5jcm1lYi5uZXQiLCJhdWQiOiJ2NC5jcm1lYi5uZXQiLCJpYXQiOjE2NjY1Nzk2NzgsIm5iZiI6MTY2NjU3OTY3OCwiZXhwIjoxNjY5MTcxNjc4LCJqdGkiOnsiaWQiOjM0MzkxLCJ0eXBlIjoiYXBpIn19.GA3Lyr3HueKXwz9GWS6KrO4rYKmJzn3l7ko1nsl7E7Q',
+					// 	time: 9999999999999
+					// });
+					// this.getUserInfo()
+					// Routine.authUserInfo(userInfo)
+					// 	.then(res => {
+					// 		if (res.data.key !== undefined && res.data.key) {
+					// 			uni.hideLoading();
+					// 			self.authKey = res.data.key;
+					// 			self.isPhoneBox = true;
+					// 		} else {
+					// 			uni.hideLoading();
+					// 			let time = res.data.expires_time - self.$Cache.time();
+					// 			self.$store.commit('LOGIN', {
+					// 				token: res.data.token,
+					// 				time: time
+					// 			});
+					// 			this.getUserInfo()
+					// 		}
+					// 	})
+					// 	.catch(res => {
+					// 		uni.hideLoading();
+					// 		uni.showToast({
+					// 			title: res.msg,
+					// 			icon: 'none',
+					// 			duration: 2000
+					// 		});
+					// 	});
+				})
+				.catch(res => {
+					uni.hideLoading();
+				});
+		},
+		getWxUser(code) {
+			let self = this;
+			Routine.getUserInfo()
+				.then(res => {
+					let userInfo = res.userInfo;
+					userInfo.code = code;
+					userInfo.spread_spid = app.globalData.spid; //获取推广人ID
+					userInfo.spread_code = app.globalData.code; //获取推广人分享二维码ID
+					Routine.authUserInfo(userInfo)
+						.then(res => {
+							if (res.data.key !== undefined && res.data.key) {
+								uni.hideLoading();
+								self.authKey = res.data.key;
+								self.isPhoneBox = true;
+							} else {
 								uni.hideLoading();
-								uni.showToast({
+								let time = res.data.expires_time - self.$Cache.time();
+								self.$store.commit('LOGIN', {
+									token: res.data.token,
+									time: time
+								});
+								self.$util.Tips({
 									title: res.msg,
-									icon: 'none',
-									duration: 2000
+									icon: 'success'
+								}, {
+									tab: 3
 								});
+							}
+						})
+						.catch(res => {
+							uni.hideLoading();
+							uni.showToast({
+								title: res.msg,
+								icon: 'none',
+								duration: 2000
 							});
-					})
-					.catch(res => {
-						uni.hideLoading();
-					});
-			},
+						});
+				})
+				.catch(res => {
+					uni.hideLoading();
+				});
+		},
 
-			// #endif
-			// #ifdef H5
-			// 获取url后面的参数
-			getQueryString(name) {
-				var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
-				var reg_rewrite = new RegExp('(^|/)' + name + '/([^/]*)(/|$)', 'i');
-				var r = window.location.search.substr(1).match(reg);
-				var q = window.location.pathname.substr(1).match(reg_rewrite);
-				if (r != null) {
-					return unescape(r[2]);
-				} else if (q != null) {
-					return unescape(q[2]);
-				} else {
-					return null;
+		// #endif
+		// #ifdef H5
+		// 获取url后面的参数
+		getQueryString(name) {
+			var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
+			var reg_rewrite = new RegExp('(^|/)' + name + '/([^/]*)(/|$)', 'i');
+			var r = window.location.search.substr(1).match(reg);
+			var q = window.location.pathname.substr(1).match(reg_rewrite);
+			if (r != null) {
+				return unescape(r[2]);
+			} else if (q != null) {
+				return unescape(q[2]);
+			} else {
+				return null;
+			}
+		},
+		// 公众号登录
+		wechatLogin() {
+			if (!this.code || this.options.scope !== 'snsapi_base') {
+				this.$wechat.oAuth('snsapi_userinfo', '/pages/users/wechat_login/index');
+			} else {
+				if (this.authKey) {
+					this.isUp = true;
 				}
-			},
-			// 公众号登录
-			wechatLogin() {
-				if (!this.code || this.options.scope !== 'snsapi_base') {
-					this.$wechat.oAuth('snsapi_userinfo', '/pages/users/wechat_login/index');
-				} else {
-					if (this.authKey) {
-						this.isUp = true;
-					}
+			}
+		},
+		// 输入手机号后的回调
+		wechatPhone() {
+			console.log(2222)
+			this.$Cache.clear('snsapiKey');
+			if (this.options.back_url) {
+				let url = uni.getStorageSync('snRouter');
+				url = url.indexOf('/pages/index/index') != -1 ? '/' : url;
+				if (url.indexOf('/pages/users/wechat_login/index') !== -1) {
+					url = '/';
 				}
-			},
-			// 输入手机号后的回调
-			wechatPhone() {
-				console.log(2222)
-				this.$Cache.clear('snsapiKey');
-				if (this.options.back_url) {
-					let url = uni.getStorageSync('snRouter');
-					url = url.indexOf('/pages/index/index') != -1 ? '/' : url;
-					if (url.indexOf('/pages/users/wechat_login/index') !== -1) {
-						url = '/';
-					}
-					if (!url) {
-						url = '/pages/index/index';
-					}
-					this.isUp = false;
-					uni.showToast({
-						title: this.$t(`登录成功`),
-						icon: 'none'
-					});
-					setTimeout(res => {
-						location.href = url;
-					}, 800);
-				} else {
-					this.isUp = false;
-					uni.showToast({
-						title: this.$t(`登录成功`),
-						icon: 'none'
-					});
-					setTimeout(res => {
-						location.href = '/pages/index/index';
-					}, 800);
+				if (!url) {
+					url = '/pages/index/index';
 				}
+				this.isUp = false;
+				uni.showToast({
+					title: this.$t(`登录成功`),
+					icon: 'none'
+				});
+				setTimeout(res => {
+					location.href = url;
+				}, 800);
+			} else {
+				this.isUp = false;
+				uni.showToast({
+					title: this.$t(`登录成功`),
+					icon: 'none'
+				});
+				setTimeout(res => {
+					location.href = '/pages/index/index';
+				}, 800);
 			}
-			// #endif
 		}
-	};
+		// #endif
+	}
+};
 </script>
 
 <style lang="scss">
-	page {
-		background: #fff;
-	}
+page {
+	background: #fff;
+}
 
-	.wechat_login {
-		padding: 72rpx 34rpx;
+.wechat_login {
+	padding: 72rpx 34rpx;
 
-		.img image {
-			width: 100%;
-		}
+	.img image {
+		width: 100%;
+	}
 
-		.btn-wrapper {
-			margin-top: 86rpx;
-			padding: 0 66rpx;
+	.btn-wrapper {
+		margin-top: 86rpx;
+		padding: 0 66rpx;
 
-			button {
-				width: 100%;
-				height: 86rpx;
-				line-height: 86rpx;
-				margin-bottom: 40rpx;
-				border-radius: 120rpx;
-				font-size: 30rpx;
+		button {
+			width: 100%;
+			height: 86rpx;
+			line-height: 86rpx;
+			margin-bottom: 40rpx;
+			border-radius: 120rpx;
+			font-size: 30rpx;
 
-				&.btn1 {
-					color: #fff;
-				}
+			&.btn1 {
+				color: #fff;
+			}
 
-				&.btn2 {
-					color: #666666;
-					border: 1px solid #666666;
-				}
+			&.btn2 {
+				color: #666666;
+				border: 1px solid #666666;
 			}
 		}
 	}
+}
 
-	.title-bar {
-		position: relative;
-		display: flex;
-		align-items: center;
-		justify-content: center;
-		font-size: 36rpx;
-	}
+.title-bar {
+	position: relative;
+	display: flex;
+	align-items: center;
+	justify-content: center;
+	font-size: 36rpx;
+}
 
-	.icon {
-		position: absolute;
-		left: 30rpx;
-		top: 0;
-		display: flex;
-		align-items: center;
-		justify-content: center;
-		width: 86rpx;
-		height: 86rpx;
+.icon {
+	position: absolute;
+	left: 30rpx;
+	top: 0;
+	display: flex;
+	align-items: center;
+	justify-content: center;
+	width: 86rpx;
+	height: 86rpx;
 
-		image {
-			width: 50rpx;
-			height: 50rpx;
-		}
+	image {
+		width: 50rpx;
+		height: 50rpx;
 	}
+}
 </style>