From 2cdde4c98b75e3edc9b070e01a905a2b75bf987b Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期五, 10 十月 2025 14:54:16 +0800
Subject: [PATCH] 定制商品不能加入购物车
---
pages/passport/wechatMPLogin.vue | 129 ++++++++++++++++++++++++++++++++++---------
1 files changed, 102 insertions(+), 27 deletions(-)
diff --git a/pages/passport/wechatMPLogin.vue b/pages/passport/wechatMPLogin.vue
index 41199bc..f42635d 100644
--- a/pages/passport/wechatMPLogin.vue
+++ b/pages/passport/wechatMPLogin.vue
@@ -3,17 +3,33 @@
<u-navbar :custom-back="back" title="灏忕▼搴忕櫥褰�"></u-navbar>
<u-modal v-model="phoneAuthPopup" :mask-close-able="true" :title="projectName+'鍟嗗煄'"
:show-confirm-button="false">
+
<div class="tips">
- 涓轰簡鏇村ソ鍦扮敤鎴蜂綋楠岋紝闇�瑕佹偍鎺堟潈鎵嬫満鍙�
+ 涓轰簡鏇村ソ鍦扮敤鎴蜂綋楠岋紝闇�瑕佹偍鎺堟潈鎵嬫満鍙峰拰鏄电О
</div>
- <button class="register" type="primary" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
- 鍘绘巿鏉�
+ <view class="auth-row">
+ <text class="label">鏄电О:</text>
+ <input
+ class="register"
+ type="nickname"
+ v-model="nickName"
+ placeholder="璇疯緭鍏ユ樀绉�"
+ >
+ </input>
+ </view>
+ <button :class="isDisabled ? 'noRegister' : 'register'" type="primary" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" :disabled="isDisabled">
+ 涓嬩竴姝�
</button>
+
</u-modal>
+
<view class="wx-auth-container">
<div class="box">
<view class="logo-info">
<text class="title">娆㈣繋杩涘叆{{ projectName }}</text>
+ </view>
+ <view>
+ <text class="small-title">浣犲ソ,姝ゆ湇鍔′粎缁挎弧绛愪細鍛樹娇鐢�</text>
</view>
<view class="small-tips">
<view>涓烘偍鎻愪緵浼樿川鏈嶅姟,{{ projectName }}闇�瑕佽幏鍙栦互涓嬩俊鎭�</view>
@@ -33,14 +49,13 @@
</u-checkbox>
</div>
</div>
+
</view>
</view>
</template>
<script>
- import UCheckBox from '@/uview-components/uview-ui/components/u-checkbox/u-checkbox.vue';
- import UNavbar from '@/uview-components/uview-ui/components/u-navbar/u-navbar.vue';
- import UModel from '@/uview-components/uview-ui/components/u-modal/u-modal.vue';
+ import '@/components/uview-components/uview-ui';
import {
mpAutoLogin
} from "@/api/connect.js";
@@ -49,14 +64,14 @@
whetherNavigate
} from "@/utils/Foundation"; //鐧诲綍璺宠浆
import {
- getUserInfo
+ getUserInfo,updateMemberNickName
} from "@/api/members";
import storage from "@/utils/storage.js";
import config from '@/config/config'
export default {
- components: {UCheckBox, UModel,UNavbar},
data() {
return {
+ isDisabled:true,
lightColor:this.$lightColor,
checked:false,
configs:config,
@@ -96,6 +111,15 @@
});
},
+ watch:{
+ nickName(newVal){
+ if(this.nickName.trim().length === 0){
+ this.isDisabled = true;
+ }else{
+ this.isDisabled = false
+ }
+ }
+ },
methods: {
/**
* TODO 姝ゆ柟娉曚笉涓�瀹氭槸鏈�浼樿В锛屽鏋滄湁鏇村ソ鐨勫姙娉曡鍦� https://gitee.com/beijing_hongye_huicheng/lilishop/issues 涓彁鍑�
@@ -110,14 +134,11 @@
whetherNavigate("wx");
},
backToHome() {
- uni.switchTab({
- url: `/pages/tabbar/home/index`,
+ uni.redirectTo({
+ url: `/pages/tabbar/index/home`,
});
},
-
-
-
-
+
//鑾峰彇鐢ㄦ埛淇℃伅
getUserProfile(e) {
if(!this.checked){
@@ -134,10 +155,15 @@
uni.getUserProfile({
desc: "鐢ㄤ簬瀹屽杽浼氬憳璧勬枡", // 澹版槑鑾峰彇鐢ㄦ埛涓汉淇℃伅鍚庣殑鐢ㄩ�旓紝鍚庣画浼氬睍绀哄湪寮圭獥涓紝璇疯皑鎱庡~鍐�
success: (res) => {
- console.log("success", res)
- this.nickName = res.userInfo.nickName;
- this.image = res.userInfo.avatarUrl;
-
+ // console.log("success", res)
+ //閲嶇疆鎸夐挳鏄剧ず
+
+
+ // this.$refs.nicknameInput.focus();
+ // this.nickName = res.userInfo.nickName;
+ // this.image = res.userInfo.avatarUrl;
+ // 鎵撳嵃寰俊鍚嶇О
+ // console.log("寰俊鏄电О:", this.nickName);
/**
* 鏍规嵁鍏湁鐨勯厤缃缃櫥褰曟柟寮�
*/
@@ -158,6 +184,7 @@
image,
nickName,
}).then((apiRes) => {
+ console.log(apiRes)
storage.setAccessToken(apiRes.data.result.accessToken);
storage.setRefreshToken(apiRes.data.result.refreshToken);
// 鐧诲綍鎴愬姛
@@ -165,6 +192,7 @@
title: "鐧诲綍鎴愬姛!",
icon: "none",
});
+
//鑾峰彇鐢ㄦ埛淇℃伅
getUserInfo().then((user) => {
storage.setUserInfo(user.data.result);
@@ -185,11 +213,12 @@
this.logingFlag = false;
}
},
-
//鑾峰彇鎵嬫満鍙锋巿鏉�
- getPhoneNumber(e) {
+ getPhoneNumber(e) {
+
let iv = e.detail.iv;
let encryptedData = e.detail.encryptedData;
+
if (!e.detail.encryptedData) {
uni.showToast({
title: "璇锋巿浜堟墜鏈哄彿鐮佹潈闄愶紝鎵嬫満鍙风爜浼氬拰浼氬憳绯荤粺鐢ㄦ埛缁戝畾锛�",
@@ -197,10 +226,18 @@
});
return;
}
-
+
let code = this.code;
let image = this.image;
let nickName = this.nickName;
+
+ console.log('getPhoneNumber:' + code)
+
+ console.log('getPhoneNumber:' + image)
+
+ console.log('getPhoneNumber:' + nickName)
+
+
mpAutoLogin({
encryptedData,
iv,
@@ -208,6 +245,7 @@
image,
nickName,
}).then((res) => {
+ //鐧诲綍鎴愬姛淇敼鐢ㄦ埛鐨勬樀绉�
storage.setAccessToken(res.data.result.accessToken);
storage.setRefreshToken(res.data.result.refreshToken);
// 鐧诲綍鎴愬姛
@@ -216,14 +254,29 @@
icon: "none",
});
//鑾峰彇鐢ㄦ埛淇℃伅
- getUserInfo().then((user) => {
- storage.setUserInfo(user.data.result);
- storage.setHasLogin(true);
-
+ getUserInfo().then(async (user) => {
+ console.log(user)
+ const form ={
+ memberId:user.data.result.id,
+ nickName:this.nickName
+ }
+ let name = '';
+ await updateMemberNickName(form).then(res =>{
+ if(res.statusCode === 200){
+ name = res.data.data;
+ }
+ })
+ user.data.result.nickName = name
+ storage.setUserInfo(user.data.result);
+ storage.setHasLogin(true);
+
+
uni.navigateBack({
delta: 1,
});
});
+
+
});
},
@@ -234,6 +287,19 @@
};
</script>
<style lang="scss" scoped>
+ .auth-row {
+ text-align: left;
+ margin: 6% 10%;
+ display: flex;
+ align-items: center;
+ margin-bottom: 30rpx;
+ }
+
+ .label {
+ width: 150rpx;
+ font-size: 32rpx;
+ color: #333;
+ }
/*寰俊鎺堟潈*/
page {
background-color: #ffffff;
@@ -287,7 +353,12 @@
.box {
margin: 0 32rpx;
}
-
+ .small-title {
+ width: 94%;
+ padding: 20rpx;
+ font-size: 34rpx;
+ margin: 0 0 20rpx;
+ }
/* 鏂囧瓧鎻愮ず*/
.small-tips {
width: 94%;
@@ -309,7 +380,11 @@
margin-top: 48rpx;
line-height: 1.75;
}
-
+ .noRegister{
+ color: #b8b8b8 !important;
+ border: none !important;
+ background: #fff !important;
+ }
.register {
color: $weChat-color !important;
border: none !important;
--
Gitblit v1.8.0