From 16213c0f85aa3ac8317797bf4a05fd12940e16d3 Mon Sep 17 00:00:00 2001
From: zhangwei <1504152376@qq.com>
Date: 星期三, 05 三月 2025 17:29:42 +0800
Subject: [PATCH] -

---
 src/pages/login/index.vue |  148 +++++++++----------------------------------------
 1 files changed, 27 insertions(+), 121 deletions(-)

diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue
index 278ce7a..75ada2c 100644
--- a/src/pages/login/index.vue
+++ b/src/pages/login/index.vue
@@ -7,10 +7,10 @@
 			</view>
 			<view class="login_btn">
 				<!-- #ifdef MP-WEIXIN || MP-QQ || MP-BAIDU -->
-				<button v-if="canIUseGetPhoneNumber" class="uni-tip-button" style="backgroundColor:#fece01;borderColor:#fece01"
-					@click="mobileAuthLogin">鎺堟潈骞剁櫥褰�</button>
-				<button style="backgroundColor:#fece01;borderColor:#fece01" v-else open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"
-					class="uni-tip-button">鎺堟潈骞剁櫥褰�</button>
+				<button v-if="canIUseGetPhoneNumber" class="uni-tip-button"
+					style="backgroundColor:#fece01;borderColor:#fece01" @click="mobileAuthLogin">鎺堟潈骞剁櫥褰�</button>
+				<button style="backgroundColor:#fece01;borderColor:#fece01" v-else open-type="getPhoneNumber"
+					@getphonenumber="getPhoneNumber" class="uni-tip-button">鎺堟潈骞剁櫥褰�</button>
 				<view class="no_login" @click="back" style="color:#fece01;borderColor:#fece01">
 					鏆備笉鎺堟潈
 				</view>
@@ -20,45 +20,26 @@
 						<label>
 							<checkbox value="1" :checked="isChecked" color="#fece01" style="transform:scale(0.7)" />
 							宸查槄璇诲苟鍚屾剰浠ヤ笅鍗忚
-							<text class="color-base-text" @click.stop="openPopup(1)">銆婄敤鎴锋湇鍔″崗璁��</text>鍜� <text
-								class="color-base-text" @click.stop="openPopup(2)">銆婇殣绉佹斂绛栥��</text>
+							<text class="color-base-text" @click.stop="toArticle(1)">銆婄敤鎴锋湇鍔″崗璁��</text>
+							<!-- 鍜� <text class="color-base-text" @click.stop="toArticle(2)">銆婇殣绉佹斂绛栥��</text> -->
 						</label>
 					</view>
 				</checkbox-group>
 			</view>
 		</view>
-		<uni-popup ref="popup" type="center">
-			<view class="bind-wrap">
-				<!-- #ifdef MP-WEIXIN || MP-QQ || MP-BAIDU -->
-				<view class="heard">鎻愮ず</view>
-				<view class="bind-tips">涓轰簡鏂逛究鎮ㄦ帴鏀堕�氱煡娑堟伅锛岄渶瑕佹偍瀹屾垚鎺堟潈</view>
-				<view class="auth-login ns-btn-default-all color-base-bg" @click="toWeb">
-					鍘绘巿鏉�
-				</view>
-				<!-- <button open-type="getPhoneNumber" class="auth-login ns-btn-default-all color-base-bg"
-					@getphonenumber="mobileAuthLogin"><text>鐐瑰嚮缁戝畾鎵嬫満鍙风爜</text></button> -->
-				<!-- #endif  -->
-			</view>
-		</uni-popup>
-		<uni-popup ref="bindMobile">
-			<view class="bind-wrap">
-				<!-- #ifdef MP-WEIXIN || MP-QQ || MP-BAIDU -->
-				<view class="heard">鎻愮ず</view>
-				<view class="bind-tips">涓轰簡鏂逛究鑱旂郴鎮紝闇�瑕佺粦瀹氭偍鐨勬墜鏈哄彿鐮�</view>
-				<button open-type="getPhoneNumber" class="auth-login ns-btn-default-all color-base-bg"
-					@getphonenumber="mobileAuthLogin"><text>鐐瑰嚮缁戝畾鎵嬫満鍙风爜</text></button>
-				<!-- #endif  -->
-			</view>
-		</uni-popup>
 	</view>
 </template>
 
 <script>
+	import {
+		mapActions,
+		mapGetters,
+		mapMutations
+	} from 'vuex'
 	export default {
 		data() {
 			return {
 				isChecked: false,
-				isCheckedSan: false,
 				canIUseGetPhoneNumber: false
 			};
 		},
@@ -68,84 +49,15 @@
 			// #endif
 		},
 		onShow() {
-			if (uni.getStorageSync('wx_openid_set') && uni.getStorageSync('wx_openid_set') == 1) {
-				uni.showLoading({
-					title: '鍔犺浇涓�',
-					mask: true
-				})
-				this.$api.temLogin({
-					data: {
-						uid: uni.getStorageSync('authInfo').id
-					},
-					success: res => {
 
-						if (res.code == 1) {
-							// uni.hideLoading()
-							// if (res.data.openid) this.authInfo.weapp_openid = res.data.openid;
-							// if (res.data.unionid) this.authInfo.wx_unionid = res.data.unionid;
-							if (res.data.wx_openid) {
-								this.$util.showToast({
-									title: "鐧诲綍鎴愬姛",
-									icon: "success"
-								})
-								uni.setStorage({
-									key: 'uid',
-									data: res.data.id,
-									success: () => {
-										uni.removeStorageSync('wx_openid_set');
-										uni.removeStorageSync('source_member');
-										uni.removeStorageSync('authInfo');
-										this.$api.temLogin({
-											data: {
-												uid: res.data.id,
-											},
-											success: res => {
-												if (res.code == 1) {
-													console.log(res)
-													uni.setStorageSync(
-														'is_perfect_user', '1')
-												} else {
-													uni.setStorageSync(
-														'is_perfect_user', res.code
-													)
-												}
-											},
-											fail: res => {
-												this.$util.showToast({
-													title: "鎺ュ彛閿欒"
-												});
-											}
-										});
-										// this.$store.dispatch('getCartNumber');
-										setTimeout(() => {
-											this.$util.redirectTo(
-												'/pages/index/index', {},
-												'tabbar')
-										}, 1000)
-									}
-								});
-							} else {
-								this.$util.showToast({
-									title: '鎺堟潈澶辫触'
-								});
-							}
-							if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
-						} else {
-							uni.removeStorageSync('uid')
-							this.$forceUpdate()
-							this.$util.showToast({
-								title: res.msg
-							});
-							if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
-						}
-					}
-				})
-			}
 		},
 		methods: {
-			openPopup(type) {
-				this.$util.redirectTo('/otherPages/member/webView/webView', {
-					link: type
+			...mapActions([
+				'getUserInfo'
+			]),
+			toArticle(type) {
+				uni.navigateTo({
+					url: '/pages/article/article'
 				})
 			},
 			changeAgree(e) {
@@ -156,21 +68,17 @@
 					this.isChecked = false
 				}
 			},
-			toWeb() {
+			back() {
+				uni.switchTab({
+					url: '/pages/index/index'
+				});
+			},
+			getPhoneNumber(e) {
 				if (!this.isChecked) {
-					return this.$util.showToast({
+					return this.$common.showToast({
 						title: "璇峰厛鍚屾剰鍗忚"
 					})
 				}
-				uni.setStorageSync('wx_openid_set', 1)
-				this.$util.redirectTo('/otherPages/member/webView/webView', {
-					uid: uni.getStorageSync('authInfo').id
-				})
-			},
-			back() {
-				uni.navigateBack()
-			},
-			getPhoneNumber(e) {
 				if (e.detail.errMsg == 'getPhoneNumber:ok') {
 					this.$db.set('queryPhoneNumber', 'getPhoneNumber:ok');
 					uni.login({
@@ -184,6 +92,7 @@
 							this.$api.CreateUser(obj).then(result => {
 								if (result.code == 1) {
 									this.$db.set('userToken', result.data.accessToken);
+									this.getUserInfo()
 									this.$util.redirectTo(
 										'/pages/index/index', {},
 										'tabbar')
@@ -206,23 +115,20 @@
 						title: "璇峰厛鍚屾剰鍗忚"
 					})
 				}
-
 				uni.login({
 					provider: 'weixin',
 					timeout: 3000,
 					success: res => {
 						this.$api.temLogin(res.code).then((result) => {
 							if (result.code == 1) {
-								this.$api.getUser().then(res => {
-									this.$db.set('userInfo', JSON.stringify(res.data))
-								})
 								this.$db.set('userToken', result.data.accessToken);
+								this.getUserInfo()
 								this.$util.redirectTo(
 									'/pages/index/index', {},
 									'tabbar')
 							} else {
 								this.$util.showToast({
-									title: result.msg
+									title: result.msg ? result.msg : result.error
 								});
 							}
 						}).catch((err) => {

--
Gitblit v1.9.1