You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.6 KiB
62 lines
1.6 KiB
// pages/home/authory/index.js
|
|
import { certificateIdentity } from "../../../api/user"
|
|
const util = require('../../../utils/util')
|
|
const event = require('../../../utils/event')
|
|
const app = getApp()
|
|
|
|
Page({
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
form: { },
|
|
disable: true, // 是否不可以编辑, false:可编辑;true:不可编辑
|
|
auth: false
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
const that = this
|
|
wx.getStorage({
|
|
key: 'identityAuthToken',
|
|
success (res) {
|
|
that.setData({ form: JSON.parse(res.data)})
|
|
}
|
|
})
|
|
},
|
|
bindForm: function (e) {
|
|
this.data.form[e.target.id] = e.detail.value
|
|
},
|
|
submitForm: function(){
|
|
wx.showLoading({ title: '处理中', mask: true })
|
|
certificateIdentity(this.data.form).then(res => {
|
|
wx.hideLoading()
|
|
app.globalData.userInfo.isAuth = 1
|
|
app.globalData.userInfo.realName = this.data.form.realName
|
|
this.data.auth = true
|
|
this.wuxDialog = this.wuxDialog || this.selectComponent('#wux-dialog')
|
|
this.wuxDialog.open({
|
|
resetOnClose: true,
|
|
title: '温馨提示',
|
|
maskClosable: false,
|
|
content: '个人信息认证成功',
|
|
buttons: [ {
|
|
text: '确定',
|
|
type: 'primary',
|
|
onTap(e) {
|
|
wx.navigateBack()
|
|
}
|
|
}]
|
|
})
|
|
}).catch(error => {
|
|
wx.hideLoading()
|
|
util.showToast(error)
|
|
})
|
|
},
|
|
onUnload: function () {
|
|
if(this.data.auth){
|
|
event.emit('EventMessage', { what: 82, desc: 'Auth Success' })
|
|
}
|
|
}
|
|
})
|