Commit 227de48b authored by linwenqing's avatar linwenqing

refactor:我的信息,认证样式优化

parent f6cfded1
...@@ -171,6 +171,9 @@ export default { ...@@ -171,6 +171,9 @@ export default {
} }
}, },
onLoad() { onLoad() {
this.checkType = '特种作业操作证查询'
},
onShow: function(param) {
if (!this.vuex_token) { if (!this.vuex_token) {
this.$u.toast('请先登录') this.$u.toast('请先登录')
let that = this let that = this
...@@ -180,9 +183,6 @@ export default { ...@@ -180,9 +183,6 @@ export default {
}) })
}, 1000) }, 1000)
} }
this.checkType = '特种作业操作证查询'
},
onShow: function(param) {
// try { // try {
// if (param.tabs) { // if (param.tabs) {
// this.current = param.tabs // this.current = param.tabs
......
...@@ -45,7 +45,7 @@ export default { ...@@ -45,7 +45,7 @@ export default {
return { return {
title: '我的题库', title: '我的题库',
nothing: process.uniEnv.qn_base_url + 'zanwucuoti@3x.png', nothing: process.uniEnv.qn_base_url + 'zanwucuoti@3x.png',
lists: null, lists: [],
} }
}, },
onLoad() { onLoad() {
...@@ -107,18 +107,19 @@ export default { ...@@ -107,18 +107,19 @@ export default {
case 15: case 15:
status = '已失效' status = '已失效'
data[i].statusStyle = { color: '#9EA5BB' } data[i].statusStyle = { color: '#9EA5BB' }
data[i].subtitle = '题库已失效' data[i].subtitle = '题库已过期'
break break
default: default:
break break
} }
data[i].status = status data[i].status = status
this.lists.push(data[i])
} }
if (data.length > 0) { // if (data.length > 0) {
this.lists = data // this.lists = data
console.log('tiku data', data) // console.log('tiku data', data)
} // }
}) })
}, },
getTodayDate() { getTodayDate() {
......
...@@ -15,7 +15,9 @@ ...@@ -15,7 +15,9 @@
<text class="line-1" <text class="line-1"
>请上传您的:<text class="name">身份证</text> >请上传您的:<text class="name">身份证</text>
</text> </text>
<view style="margin: 24rpx 0;">
<text class="line-2">请按照下面提示依次点击上传身份证正反面</text> <text class="line-2">请按照下面提示依次点击上传身份证正反面</text>
</view>
<view class="upload-image"> <view class="upload-image">
<image <image
class="cert-image" class="cert-image"
...@@ -159,6 +161,8 @@ export default { ...@@ -159,6 +161,8 @@ export default {
this.student.identityNumber = res.number this.student.identityNumber = res.number
}) })
.catch((data) => { .catch((data) => {
this.student.name = ''
this.student.identityNumber = ''
this.$u.toast('识别身份证信息错误') this.$u.toast('识别身份证信息错误')
}) })
}) })
...@@ -176,6 +180,7 @@ export default { ...@@ -176,6 +180,7 @@ export default {
this.student.certificateValidityDate = res.expire this.student.certificateValidityDate = res.expire
}) })
.catch((data) => { .catch((data) => {
this.student.certificateValidityDate = ''
this.$u.toast('识别身份证信息错误') this.$u.toast('识别身份证信息错误')
}) })
}) })
...@@ -201,17 +206,14 @@ page { ...@@ -201,17 +206,14 @@ page {
background-color: #f7f9fc; background-color: #f7f9fc;
background-size: 100% 920rpx; background-size: 100% 920rpx;
background-repeat: no-repeat; background-repeat: no-repeat;
height: 120vh; height: 100vh;
position: absolute;
top: 0;
width: 100%; width: 100%;
overflow-x: hidden;
} }
.content { .content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%; width: 100%;
height: 100%;
overflow: auto;
} }
.upload-image { .upload-image {
padding: 0 28rpx; padding: 0 28rpx;
......
...@@ -150,41 +150,62 @@ export default { ...@@ -150,41 +150,62 @@ export default {
}) })
}, },
getPhonenumber(e) { getPhonenumber(e) {
var that = this console.log('eeeee', e)
login.appLogin().then((res) => { let that = this
that.code = res.code let params = {}
var code = that.code
if (e && e.detail) { if (e && e.detail) {
if (e.detail.errMsg.indexOf('user deny') > -1) { if (e.detail.errMsg.indexOf('user deny') > -1) {
//拒绝授权 //拒绝授权
return
} else if (e.detail.encryptedData && e.detail.iv) { } else if (e.detail.encryptedData && e.detail.iv) {
//允许授权-解析-更新手机号 //允许授权-解析-更新手机号
let params = { params = {
encryptedData: e.detail.encryptedData, encryptedData: e.detail.encryptedData,
iv: e.detail.iv, iv: e.detail.iv,
} }
} else {
that.$u.toast(e.detail.errMsg)
return
}
} else {
that.$u.toast('授权失败,请重新授权')
return
}
if (that.code) {
console.log('走的第一个')
uni.checkSession({ uni.checkSession({
success(ccc) { success() {
console.log('走的第一个1')
//session_key 未过期,并且在本生命周期一直有效 //session_key 未过期,并且在本生命周期一直有效
params.code = code params.code = that.code
that.$u.api.loginWechatAuth(params).then((res) => { that.syncUserinfo(params)
that.student.phoneNumber = res.phoneNumber
that.$u.api.updateUserInfo({
phoneNumber: res.phoneNumber,
})
})
}, },
fail() { fail() {
console.log('走的第一个2')
// session_key 已经失效,需要重新执行登录流程 // session_key 已经失效,需要重新执行登录流程
that.toLogin() that.toLogin()
}, },
}) })
} else { } else {
this.$u.toast(e.detail.errMsg) 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)
} }
} else { },
this.$u.toast('授权失败,请重新授权') })
} }
},
syncUserinfo(params) {
this.$u.api.loginWechatAuth(params).then((res) => {
this.student.phoneNumber = res.phoneNumber
this.$u.api.updateUserInfo({
phoneNumber: res.phoneNumber,
})
}) })
}, },
toLogin() { toLogin() {
......
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