Commit 2b3c3363 authored by Facius's avatar Facius

Merge branch 'dev-v1.0.0' of https://git.banshouhui.com/wuzhenzhe/study into dev-v1.0.0

parents 831ec110 cf72d855
...@@ -258,6 +258,6 @@ page { ...@@ -258,6 +258,6 @@ page {
} }
} }
::v-deep u-cell-item .u-cell { ::v-deep u-cell-item .u-cell {
padding: 35rpx 32rpx !important; padding: 50rpx 32rpx !important;
} }
</style> </style>
...@@ -40,9 +40,16 @@ ...@@ -40,9 +40,16 @@
<button <button
open-type="getPhoneNumber" open-type="getPhoneNumber"
@getphonenumber="getPhonenumber" @getphonenumber="getPhonenumber"
style="background: none;font-size: 26rpx;padding-right: 0;" style="
background: none;
font-size: 26rpx;
padding-right: 0;
padding-right: 0;
text-align: right;
width: 300rpx;
height: 150rpx;"
> >
<text v-if="getMobile">{{ getMobile }}</text> <text v-if="getMobile" class="fill-value">{{ getMobile }}</text>
<text v-else class="empty-value">去绑定</text> <text v-else class="empty-value">去绑定</text>
</button> </button>
</view> </view>
...@@ -81,6 +88,7 @@ export default { ...@@ -81,6 +88,7 @@ export default {
}, },
token: null, token: null,
code: '', code: '',
count: 0,
} }
}, },
computed: { computed: {
...@@ -171,47 +179,58 @@ export default { ...@@ -171,47 +179,58 @@ export default {
that.$u.toast('授权失败,请重新授权') that.$u.toast('授权失败,请重新授权')
return return
} }
if (that.code) { that.syncUserinfo(params)
console.log('走的第一个')
uni.checkSession({
success() {
console.log('走的第一个1')
//session_key 未过期,并且在本生命周期一直有效
params.code = that.code
that.syncUserinfo(params)
},
fail() {
console.log('走的第一个2')
// session_key 已经失效,需要重新执行登录流程
that.toLogin()
},
})
} else {
console.log('走的第二个')
uni.login({
provider: 'weixin',
success: (code_res) => {
if (code_res.errMsg == 'login:ok') {
that.code = code_res.code
params.code = code_res.code
that.syncUserinfo(params)
}
},
})
}
}, },
syncUserinfo(params) { syncUserinfo(params) {
this.$u.api.loginWechatAuth(params).then((res) => { let that = this
this.student.phoneNumber = res.phoneNumber uni.checkSession({
this.$u.api.updateUserInfo({ success() {
phoneNumber: res.phoneNumber, console.log('走的第一个1')
}) //session_key 未过期,并且在本生命周期一直有效
uni.login({
provider: 'weixin',
success: (code_res) => {
if (code_res.errMsg == 'login:ok') {
console.log('走的第一个2')
params.code = code_res.code
that.$u.api
.loginWechatAuth(params)
.then((res) => {
that.student.phoneNumber = res.phoneNumber
that.$u.api
.updateUserInfo({
phoneNumber: res.phoneNumber,
})
.then((ret) => {
that.$u.toast('绑定成功!')
})
})
.catch((err) => {
that.toLogin()
})
}
},
})
},
fail() {
console.log('走的第二个1', params)
// session_key 已经失效,需要重新执行登录流程
that.count++
if (that.count > 1) {
console.log('重试次数大于1')
that.toLogin()
}
that.syncUserinfo(params)
},
}) })
}, },
toLogin() { toLogin() {
uni.navigateTo({ that.$u.toast('登录信息失效,请重新登录后重试')
url: 'pages/login/index', setTimeout(() => {
}) uni.navigateTo({
url: 'pages/login/index',
})
}, 800)
}, },
changeHead() { changeHead() {
//获取图片 //获取图片
...@@ -328,8 +347,18 @@ button::after { ...@@ -328,8 +347,18 @@ button::after {
border-right-width: 0; border-right-width: 0;
border-top-width: 0; border-top-width: 0;
} }
.fill-value {
color: #191c27;
line-height: 150rpx;
}
.empty-value { .empty-value {
color: #2953ff; color: #2953ff;
line-height: 150rpx;
}
::v-deep u-cell-item .u-cell {
padding: 50rpx 0rpx !important;
}
::v-deep u-cell-item:nth-child(3) .u-cell {
padding: 0 !important;
} }
</style> </style>
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