Commit faf7b5f5 authored by 罗超's avatar 罗超

1

parent 94ed0d8f
...@@ -405,8 +405,8 @@ export default { ...@@ -405,8 +405,8 @@ export default {
data.baseInfo[3].desc = res.Data.SurplusHours + "课时"; data.baseInfo[3].desc = res.Data.SurplusHours + "课时";
data.baseInfo[3].jumpUrl = data.baseInfo[3].jumpUrl =
"/pages/surplusTime/surplusTime?id=" + res.Data.ClassId; "/pages/surplusTime/surplusTime?id=" + res.Data.ClassId;
data.baseInfo[4].desc = res.Data.ContractNum; // data.baseInfo[4].desc = res.Data.ContractNum;
data.baseInfo[5].desc = res.Data.TeacherName; data.baseInfo[4].desc = res.Data.TeacherName;
} }
}, },
async getActivityData() { async getActivityData() {
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
</view> </view>
<view class="flex flex_between_center btnBox"> <view class="flex flex_between_center btnBox">
<view class="loginBtn flex flex_center_center" @click="login">账号登录</view> <view class="loginBtn flex flex_center_center" @click="login">账号登录</view>
<button class="loginBtn" open-type="getPhoneNumber" @getphonenumber="getphonenumber">手机号一键登录</button> <button class="phoneBtn flex flex_center_center" open-type="getPhoneNumber" @getphonenumber="getphonenumber">手机号一键登录</button>
</view> </view>
<!-- <view class="auth" @click="authLogin"> 授权手机号一键登录 </view> --> <!-- <view class="auth" @click="authLogin"> 授权手机号一键登录 </view> -->
...@@ -65,6 +65,10 @@ export default { ...@@ -65,6 +65,10 @@ export default {
let msg = reactive({ let msg = reactive({
Account: "", Account: "",
Password: "", Password: "",
});
let data =reactive({
phoneNum: "",
openid:""
}); });
let methods = { let methods = {
usernameInput(val) { usernameInput(val) {
...@@ -106,35 +110,66 @@ export default { ...@@ -106,35 +110,66 @@ export default {
setTimeout(() => { setTimeout(() => {
let data = uni.getStorageSync("userInfo"); let data = uni.getStorageSync("userInfo");
if (data) { if (data) {
console.log(137, data);
that.jumpPage(); that.jumpPage();
} }
}, 1000); }, 1000);
} }
}, },
//获取手机号
getphonenumber(e){ getphonenumber(e){
console.log(117,e) if(e.detail.encryptedData&&e.detail.iv){
let encryptedData = e.detail.encryptedData; let encryptedData = e.detail.encryptedData;
let iv = e.detail.iv; let iv = e.detail.iv;
uni.login({ uni.login({
provider: 'weixin', provider: 'weixin',
success: async (loginRes)=> { success: async (loginRes)=> {
let code=loginRes.code let code=loginRes.code
//解密手机号
let res = await parsePhone({ let res = await parsePhone({
encryptedData, encryptedData,
iv, iv,
code code
}) })
console.log(0,res) if(res){
data.phoneNum=res.Data.phoneNumber
data.openid=res.Data.openid
that.phoneNumLogin()
}
} }
}); });
}else{
uni.showToast({
title: '授权失败',
duration: 2000,
icon: "error",
});
}
},
//手机号授权登录
async phoneNumLogin(){
let res=await phoneLogin({
Account:data.phoneNum,
OpenId:data.openid
})
if(res){
res.Data.Account =data.phoneNum;
uni.setStorageSync("userInfo", res.Data);
Toast.success("登录成功");
setTimeout(() => {
let data = uni.getStorageSync("userInfo");
if (data) {
console.log(147, data);
that.jumpPage();
}
}, 1000);
}
} }
}; };
onMounted(() => {}); onMounted(() => {});
let that = methods; let that = methods;
return { return {
...toRefs(msg), ...toRefs(msg),
...toRefs(data),
...methods, ...methods,
}; };
}, },
...@@ -174,7 +209,7 @@ export default { ...@@ -174,7 +209,7 @@ export default {
} }
.loginBtn { .loginBtn {
width: 260rpx; width: 280rpx;
height: 90rpx; height: 90rpx;
background-color: #00acf9; background-color: #00acf9;
border-radius: 12rpx; border-radius: 12rpx;
...@@ -183,7 +218,17 @@ export default { ...@@ -183,7 +218,17 @@ export default {
font-weight: 500; font-weight: 500;
color: #ffffff; color: #ffffff;
} }
.phoneBtn{
width: 280rpx;
height: 90rpx;
background-color: #E6A23C;
border-radius: 12rpx;
font-size: 32rpx;
font-family: PingFang SC;
font-weight: 500;
color: #ffffff;
margin: 0;
}
.auth { .auth {
text-align: center; text-align: center;
font-size: 26rpx; font-size: 26rpx;
...@@ -201,8 +246,8 @@ export default { ...@@ -201,8 +246,8 @@ export default {
.btnBox{ .btnBox{
width: 600rpx; width: 600rpx;
height: 90rpx; height: 90rpx;
/* background-color: #00acf9; */
border-radius: 12rpx; border-radius: 12rpx;
overflow: hidden;
margin: 0 auto; margin: 0 auto;
font-size: 32rpx; font-size: 32rpx;
font-family: PingFang SC; font-family: PingFang SC;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment