From 8ee015485bfd69afcc276e84a2998c64b0256458 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期三, 16 七月 2025 18:27:12 +0800
Subject: [PATCH] 前端
---
 small-program/pages/login/login.vue |   49 ++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 42 insertions(+), 7 deletions(-)
diff --git a/small-program/pages/login/login.vue b/small-program/pages/login/login.vue
index 172951b..ccf4eeb 100644
--- a/small-program/pages/login/login.vue
+++ b/small-program/pages/login/login.vue
@@ -2,21 +2,56 @@
 	<view class="box">
 		<view class="box-title">娆㈣繋浣跨敤杩戝揩</view>
 		<view class="box-tips">璇风櫥褰�</view>
-		<view class="box-btn">鎵嬫満鍙蜂竴閿櫥褰�</view>
+		<view class="box-btn" >
+			<button  class="box-btn"  v-if="agree" open-type="getPhoneNumber" @getphonenumber="getPhone" >鎵嬫満鍙蜂竴閿櫥褰�</button>
+		    <button  class="box-btn"  v-if="!agree" @click="tipAgree">鎵嬫満鍙蜂竴閿櫥褰�</button> 
+		</view>
 		<view class="box-footer">
-			<image src="/static/icon/ic_notagree@2x.png" mode="widthFix"></image>
-			<!-- <image src="/static/icon/ic_agree@2x.png" mode="widthFix"></image> -->
-			<text>鎴戝凡闃呰骞跺悓鎰忋�婄敤鎴峰崗璁�嬶紝銆婇殣绉佸崗璁斂绛栥��</text>
+			<image src="/static/icon/ic_notagree@2x.png" mode="widthFix" v-if="!agree" @click="agreeDo"></image>
+			<image src="/static/icon/ic_agree@2x.png" mode="widthFix" v-if="agree" @click="agreeDo"></image> 
+			<text @click="agreeDo">鎴戝凡闃呰骞跺悓鎰忋�婄敤鎴峰崗璁�嬶紝銆婇殣绉佸崗璁斂绛栥��</text>
 		</view>
 	</view>
 </template>
-
 <script>
+import { mapState } from 'vuex'
 	export default {
+		computed: {
+			...mapState(['userInfo','openid'])
+		},
 		data() {
 			return {
-				
-			};
+				agree:false
+			}
+		},
+		methods: {
+			agreeDo(){
+				this.agree = !this.agree
+			},
+			tipAgree(){
+				uni.showToast({ title: '璇峰厛宸查槄璇诲苟鍚屾剰銆婄敤鎴峰崗璁�嬶紝銆婇殣绉佸崗璁斂绛栥��', icon: 'error', duration: 2000 });
+			},
+			getPhone(e) {
+				console.log(e)
+				if(!this.agree ){
+					return
+				}
+				if (e.detail.errMsg !== 'getPhoneNumber:ok') {
+					uni.showToast({ title: '鑾峰彇鎺堟潈鎵嬫満鍙峰け璐�', icon: 'error', duration: 2000 });
+					return
+				}
+				var that = this;
+				that.$u.api.wxAuthPhone({
+					code: e.detail.code,
+					openid: that.openid||''
+				}).then(result => {
+					if (result.code === 200) {
+						that.$store.commit('setUserInfo', result.data.member)
+						that.$store.commit('setToken', result.data.token)
+						uni.navigateBack({ delta: 1 });
+					}
+				})
+			}
 		}
 	}
 </script>
--
Gitblit v1.9.3