|
@@ -40,7 +40,8 @@
|
|
</view>
|
|
</view>
|
|
<view class="form-item">
|
|
<view class="form-item">
|
|
<u-input height="80" placeholder="请输入密码" border-color="#d0d0d0" v-model="userNameForm.password"
|
|
<u-input height="80" placeholder="请输入密码" border-color="#d0d0d0" v-model="userNameForm.password"
|
|
- :border="true" class="form-item-input" @confirm="userNameLoginHandle" type="password" password-icon/>
|
|
|
|
|
|
+ :border="true" class="form-item-input" @confirm="userNameLoginHandle" type="password"
|
|
|
|
+ password-icon />
|
|
</view>
|
|
</view>
|
|
<view class="form-button" @click="userNameLoginHandle">
|
|
<view class="form-button" @click="userNameLoginHandle">
|
|
立即登录
|
|
立即登录
|
|
@@ -60,19 +61,17 @@
|
|
half-width="200">使用第三方账号登录</u-divider>
|
|
half-width="200">使用第三方账号登录</u-divider>
|
|
<view class="app-icon mb-30">
|
|
<view class="app-icon mb-30">
|
|
<!-- v-if="canIUseGetUserProfile" -->
|
|
<!-- v-if="canIUseGetUserProfile" -->
|
|
- <u-button @click="getUserProfile" class="custom-button"
|
|
|
|
- style="width: 40px;" plain :hair-line="false">
|
|
|
|
|
|
+ <!-- <u-button @click="getUserProfile" class="custom-button" style="width: 40px;" plain :hair-line="false">
|
|
<image src="https://sylwt.top/api/visitor/resources/image?name=/ydl/menber-center/weixin.png"
|
|
<image src="https://sylwt.top/api/visitor/resources/image?name=/ydl/menber-center/weixin.png"
|
|
mode="aspectFit" style="width: 40px;height: 40px;" />
|
|
mode="aspectFit" style="width: 40px;height: 40px;" />
|
|
- </u-button>
|
|
|
|
|
|
+ </u-button> -->
|
|
<!-- v-else -->
|
|
<!-- v-else -->
|
|
- <u-button open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber" class="custom-button"
|
|
|
|
|
|
+ <!-- <u-button open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber" class="custom-button"
|
|
style="width: 40px;" plain :hair-line="false">
|
|
style="width: 40px;" plain :hair-line="false">
|
|
<image src="https://sylwt.top/api/visitor/resources/image?name=/ydl/menber-center/weixin.png"
|
|
<image src="https://sylwt.top/api/visitor/resources/image?name=/ydl/menber-center/weixin.png"
|
|
mode="aspectFit" style="width: 40px;height: 40px;" />
|
|
mode="aspectFit" style="width: 40px;height: 40px;" />
|
|
- </u-button>
|
|
|
|
- <u-button @click="handleWxLogin()" class="custom-button"
|
|
|
|
- style="width: 40px;" plain :hair-line="false">
|
|
|
|
|
|
+ </u-button> -->
|
|
|
|
+ <u-button @click="handleWxLogin()" class="custom-button" style="width: 40px;" plain :hair-line="false">
|
|
<image src="https://sylwt.top/api/visitor/resources/image?name=/ydl/menber-center/weixin.png"
|
|
<image src="https://sylwt.top/api/visitor/resources/image?name=/ydl/menber-center/weixin.png"
|
|
mode="aspectFit" style="width: 40px;height: 40px;" />
|
|
mode="aspectFit" style="width: 40px;height: 40px;" />
|
|
</u-button>
|
|
</u-button>
|
|
@@ -113,7 +112,8 @@
|
|
getCaptchaImage,
|
|
getCaptchaImage,
|
|
checknumberCaptcha,
|
|
checknumberCaptcha,
|
|
smsSend,
|
|
smsSend,
|
|
- loginPhone
|
|
|
|
|
|
+ loginPhone,
|
|
|
|
+ wxLoginOpenid
|
|
} from "@/api/user.js"
|
|
} from "@/api/user.js"
|
|
import {
|
|
import {
|
|
msg,
|
|
msg,
|
|
@@ -180,31 +180,31 @@
|
|
phone,
|
|
phone,
|
|
captcha
|
|
captcha
|
|
} = this.phoneForm;
|
|
} = this.phoneForm;
|
|
-
|
|
|
|
|
|
+
|
|
// 手机号正则验证
|
|
// 手机号正则验证
|
|
if (!/^1[3-9]\d{9}$/.test(phone)) {
|
|
if (!/^1[3-9]\d{9}$/.test(phone)) {
|
|
msg("请输入正确的手机号");
|
|
msg("请输入正确的手机号");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
-
|
|
|
|
- if(this.getPhoneCapt <= 0){
|
|
|
|
|
|
+
|
|
|
|
+ if (this.getPhoneCapt <= 0) {
|
|
msg("请先获取手机验证码");
|
|
msg("请先获取手机验证码");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
// 验证码存在性检查
|
|
// 验证码存在性检查
|
|
if (!captcha) {
|
|
if (!captcha) {
|
|
msg("请输入验证码");
|
|
msg("请输入验证码");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
let checkUserBook = await this.checkUserBook()
|
|
let checkUserBook = await this.checkUserBook()
|
|
if (!this.checkUserBook()) return;
|
|
if (!this.checkUserBook()) return;
|
|
// console.log(this.phoneForm)
|
|
// console.log(this.phoneForm)
|
|
uni.showLoading({
|
|
uni.showLoading({
|
|
title: '正在登录...'
|
|
title: '正在登录...'
|
|
})
|
|
})
|
|
- loginPhone(this.phoneForm).then(res=>{
|
|
|
|
|
|
+ loginPhone(this.phoneForm).then(res => {
|
|
// msg("登录成功");
|
|
// msg("登录成功");
|
|
console.log(res);
|
|
console.log(res);
|
|
})
|
|
})
|
|
@@ -309,9 +309,9 @@
|
|
uni.showLoading({
|
|
uni.showLoading({
|
|
title: '正在校验验证码'
|
|
title: '正在校验验证码'
|
|
})
|
|
})
|
|
-
|
|
|
|
|
|
+
|
|
const checkRes = await checknumberCaptcha(this.numberCaptchaForm);
|
|
const checkRes = await checknumberCaptcha(this.numberCaptchaForm);
|
|
- if(!checkRes.data.valid){
|
|
|
|
|
|
+ if (!checkRes.data.valid) {
|
|
uni.showToast({
|
|
uni.showToast({
|
|
title: '验证码输入错误',
|
|
title: '验证码输入错误',
|
|
icon: 'none'
|
|
icon: 'none'
|
|
@@ -322,8 +322,8 @@
|
|
const codeRes = await smsSend({
|
|
const codeRes = await smsSend({
|
|
phone: this.phoneForm.phone
|
|
phone: this.phoneForm.phone
|
|
});
|
|
});
|
|
-
|
|
|
|
- if(codeRes && codeResdata.captchaUuid){
|
|
|
|
|
|
+
|
|
|
|
+ if (codeRes && codeResdata.captchaUuid) {
|
|
this.getPhoneCapt++;
|
|
this.getPhoneCapt++;
|
|
this.phoneForm.captchaUuid = codeRes.captchaUuid
|
|
this.phoneForm.captchaUuid = codeRes.captchaUuid
|
|
this.closePopup();
|
|
this.closePopup();
|
|
@@ -339,29 +339,37 @@
|
|
title: '正在获取图片'
|
|
title: '正在获取图片'
|
|
})
|
|
})
|
|
const img = await getCaptchaImage();
|
|
const img = await getCaptchaImage();
|
|
- if(!img.data.numberCaptchaSrc){
|
|
|
|
|
|
+ if (!img.data.numberCaptchaSrc) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
this.numberCaptchaForm.numberCaptchaUuid = img.data.numberCaptchaUuid
|
|
this.numberCaptchaForm.numberCaptchaUuid = img.data.numberCaptchaUuid
|
|
this.numberCaptchaSrc = img.data.numberCaptchaSrc;
|
|
this.numberCaptchaSrc = img.data.numberCaptchaSrc;
|
|
uni.hideLoading();
|
|
uni.hideLoading();
|
|
},
|
|
},
|
|
-
|
|
|
|
|
|
+
|
|
// --------验证码 end---------
|
|
// --------验证码 end---------
|
|
async handleWxLogin() {
|
|
async handleWxLogin() {
|
|
- try {
|
|
|
|
- // 获取code
|
|
|
|
- const loginRes = await uni.login({
|
|
|
|
- provider: 'weixin'
|
|
|
|
- });
|
|
|
|
- const code = loginRes.code;
|
|
|
|
- console.log(11, loginRes);
|
|
|
|
- } catch (error) {
|
|
|
|
- console.error('微信登录失败:', error);
|
|
|
|
- }
|
|
|
|
|
|
+ const loginRes = await wx.login();
|
|
|
|
+ const code = loginRes.code;
|
|
|
|
+ console.log("最新code", code)
|
|
|
|
+ wxLoginOpenid({code}).then(res=>{
|
|
|
|
+ console.log("weixinlogin", res)
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // try {
|
|
|
|
+ // // 获取code
|
|
|
|
+ // const code = loginRes.code;
|
|
|
|
+ // console.log(code)
|
|
|
|
+ // wxLoginOpenid({code}).then(res=>{
|
|
|
|
+ // console.log("weixinlogin", res)
|
|
|
|
+ // })
|
|
|
|
+ // } catch (error) {
|
|
|
|
+ // console.log('微信登录失败:', error);
|
|
|
|
+ // }
|
|
},
|
|
},
|
|
decryptPhoneNumber(e) {
|
|
decryptPhoneNumber(e) {
|
|
- console.log(1111,e)
|
|
|
|
|
|
+ console.log(1111, e)
|
|
if (e.detail.encryptedData) {
|
|
if (e.detail.encryptedData) {
|
|
const {
|
|
const {
|
|
encryptedData,
|
|
encryptedData,
|