登录 修改

This commit is contained in:
魏啾
2024-05-30 09:56:54 +08:00
parent cb7d853707
commit 9c636e6948
3 changed files with 33 additions and 35 deletions

View File

@@ -3,10 +3,10 @@ const debug = process.env.NODE_ENV == 'development' ? true : false;
const proxyApi = "/api"
// #endif
// #ifdef MP-WEIXIN || APP
// const proxyApi = 'http://192.168.2.96:9889/cashierService' // 王伟
const proxyApi = 'http://192.168.2.42:9889/cashierService' // 王伟
// const proxyApi = 'http://192.168.2.74:9888/cashierService' // 帆哥
// const proxyApiwws = 'ws://192.168.2.74:9888/cashierService' // 测试
const proxyApi = 'https://wxcashiertest.sxczgkj.cn/cashierService' // 测试
// const proxyApi = 'https://wxcashiertest.sxczgkj.cn/cashierService' // 测试
const proxyApiwws = 'wss://wxcashiertest.sxczgkj.cn/cashierService' // 测试
// #endif
@@ -19,7 +19,6 @@ const baseUrlwws = 'ws://cashier.sxczgkj.cn/cashierService'
// const baseUrl = debug ? proxyApi : 'https://cashier.sxczgkj.cn/cashierService'// 线上
// const baseUrlwws = debug ? proxyApiwws : 'wss://cashier.sxczgkj.cn/cashierService' // 线上
const baseUrl = 'https://wxcashiertest.sxczgkj.cn/cashierService'// 测试
// const baseUrl = 'http://192.168.2.96:9889/cashierService'
const baseUrlwws ='wss://wxcashiertest.sxczgkj.cn/cashierService' // 测试
// #endif

View File

@@ -24,7 +24,7 @@
<input type="mobile" v-model="form.code" placeholder="请输入短信验证码" maxlength="6" />
<view class="repeats">
<view v-if="showText == true" class="yzm"
style="padding: 8rpx 16rpx 6rpx 16rpx; background: #288efb; border-radius: 15rpx"
style="padding: 8rpx 16rpx 6rpx 16rpx; background: #F1CB66; border-radius: 15rpx"
@click="CodeRegister">
{{ Recapture }}
</view>
@@ -39,13 +39,13 @@
<text @click="passwords">忘记密码</text>
</view> -->
<!-- #ifdef MP-WEIXIN -->
<button class="toLogin" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" v-if="!showbox">手机号快速登录
<button class="toLogin" open-type="getPhoneNumber" @getphonenumber="userlogin" v-if="!showbox">手机号快速登录
</button>
<view class="toLogin" v-if="showbox" @click="toLoginconfirm">登录</view>
<view class="toLogins" @click="showbox = !showbox">其他手机号登录/注册</view>
<!-- #endif -->
<!-- #ifdef APP-PLUS || H5 -->
<button class="toLogin" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" v-if="!showbox">手机号快速登录
<button class="toLogin" open-type="getPhoneNumber" @getphonenumber="userlogin" v-if="!showbox">手机号快速登录
</button>
<view class="toLogin" v-if="showbox" @click="toLoginconfirm">登录</view>
<view class="toLogins" @click="showbox = !showbox">其他手机号登录/注册</view>
@@ -297,28 +297,29 @@
}
},
async getPhoneNumber(res) { // 获取手机号
var resdataa = res
console.log(res)
// #ifdef MP-WEIXIN
uni.login({
provider: 'weixin',
success: async (data) => {
let resdata = await this.api.logingetPhoneNumber({
code: data.code,
iv: resdataa.detail.iv,
encryptedData: resdataa.detail.encryptedData
})
console.log(resdata)
if (resdata.data) {
this.phone = resdata.data
this.userlogin()
}
}
});
// #endif
},
async userlogin() {
// async getPhoneNumber(res) { // 获取手机号
// var resdataa = res
// console.log(res)
// // #ifdef MP-WEIXIN
// uni.login({
// provider: 'weixin',
// success: async (data) => {
// let resdata = await this.api.logingetPhoneNumber({
// code: data.code,
// iv: resdataa.detail.iv,
// encryptedData: resdataa.detail.encryptedData
// })
// console.log(resdata)
// if (resdata.data) {
// this.phone = resdata.data
// this.userlogin()
// }
// }
// });
// // #endif
// },
async userlogin(reslange) {
var resdataa = reslange
// #ifdef MP-WEIXIN
uni.login({
provider: 'weixin',
@@ -330,12 +331,10 @@
uni.cache.set('weixincode', data.code);
let res = await this.api.userwxlogin({
code: uni.cache.get('weixincode'), //临时登录凭证
encryptedData: infoRes
.encryptedData, // 用户非敏感信息
rawData: infoRes.rawData,
signature: infoRes.signature,
iv: infoRes.iv,
phone: this.phone
iv: resdataa.detail.iv,
encryptedData: resdataa.detail.encryptedData
})
if (res.code == 0) {
uni.cache.set('token', res.data.token);

View File

@@ -86,9 +86,9 @@
</view>
</view>
<!-- <view class="card" style="padding-bottom: 20rpx;">
<image :src="srcimge" show-menu-by-longpress="true" style="width: 100%;" mode="widthFix"></image>
</view> -->
<view class="card" style="padding-bottom: 20rpx;" v-if="listinfo.shopQrcode">
<image :src="listinfo.shopQrcode" show-menu-by-longpress="true" style="width: 100%;" mode="widthFix"></image>
</view>
<view :style="{height:height}">