Commit 5d3b7224 authored by linwenqing's avatar linwenqing

improvement:我的信息列表样式优化

parent ebb38e5d
......@@ -40,9 +40,16 @@
<button
open-type="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>
</button>
</view>
......@@ -81,6 +88,7 @@ export default {
},
token: null,
code: '',
count: 0,
}
},
computed: {
......@@ -171,47 +179,58 @@ export default {
that.$u.toast('授权失败,请重新授权')
return
}
if (that.code) {
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)
}
},
})
}
that.syncUserinfo(params)
},
syncUserinfo(params) {
this.$u.api.loginWechatAuth(params).then((res) => {
this.student.phoneNumber = res.phoneNumber
this.$u.api.updateUserInfo({
phoneNumber: res.phoneNumber,
})
let that = this
uni.checkSession({
success() {
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() {
uni.navigateTo({
url: 'pages/login/index',
})
that.$u.toast('登录信息失效,请重新登录后重试')
setTimeout(() => {
uni.navigateTo({
url: 'pages/login/index',
})
}, 800)
},
changeHead() {
//获取图片
......@@ -328,8 +347,18 @@ button::after {
border-right-width: 0;
border-top-width: 0;
}
.fill-value {
color: #191c27;
line-height: 150rpx;
}
.empty-value {
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>
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