From e755ab6c6edddf4accb51e241e6ec04c27cea091 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期二, 16 九月 2025 11:35:07 +0800
Subject: [PATCH] 前端
---
small-program/pages/login/login.vue | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 51 insertions(+), 7 deletions(-)
diff --git a/small-program/pages/login/login.vue b/small-program/pages/login/login.vue
index 172951b..972aa1e 100644
--- a/small-program/pages/login/login.vue
+++ b/small-program/pages/login/login.vue
@@ -2,21 +2,62 @@
<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 class="bluetxt" @click="jumpService(4)">銆婄敤鎴峰崗璁��</text>锛�<text class="bluetxt" @click="jumpService(5)"> 銆婇殣绉佸崗璁斂绛栥��</text></text>
</view>
</view>
</template>
-
<script>
+import { mapState } from 'vuex'
export default {
+ computed: {
+ ...mapState(['userInfo','openid'])
+ },
data() {
return {
-
- };
+ agree:false
+ }
+ },
+ methods: {
+ jumpService(flag) {
+ uni.navigateTo({
+ url: '/pages/rich-text-page/rich-text-page?flag='+flag
+ })
+ },
+ 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.$emit('refresh')
+ uni.navigateBack({ delta: 1 });
+ }
+ })
+ }
}
}
</script>
@@ -73,4 +114,7 @@
}
}
}
+ .bluetxt{
+ color: royalblue !important;
+ }
</style>
--
Gitblit v1.9.3