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.

76 lines
2.9 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

const app = getApp();
Page({
data: {
information : "## **认证须知**\n1. 你需要准备有效的身份证正面(人像面)的证件照照片,请确保证件照片清晰可见,**严禁PS**\n\n2. 我们将在你提交认证信息后的24小时不包含节假日内完成审核审核结果将会以系统消息的形式发送给你\n\n3. 实名认证审核完成后,**无法删除**,请谨慎填写;\n\n4. 实名认证审核完成后系统将自动发放500个金币作为奖励\n\n5. 我们会确保你所提供的信息均处于严格的保密状态,不会泄露;\n\n6. 如存在恶意乱填写姓名,证件号,及上传与实名认证证件无关图片者,一经发现将**冻结EduCoder账号**。\n\n7. 提交实名认证后系统会自动将状态改为已认证,你将可以体验平台需要实名认证的功能;如果在认证后的使用过程中未通过审核,你将不能继续体验需要认证的功能。\n\n",
attachDir:global.config.attachDir
},
onLoad(){
this.refresh();
},
refresh(){
app.api("users.accounts")()
.then(res=>{
let {name, show_realname, gender,id:user_id} = res;
this.setData({ name, show_realname, gender, user_id});
})
},
onGenderChange({detail:{value}}){
value = parseInt(value);
this.setData({ gender: value });
},
onSubmit(e){
let {detail:{value}} = e;
if(!this.checkInput(value)) return;
value.attachment_ids[0] = parseInt(value.attachment_ids[0]);
value.gender = parseInt(value.gender);
app.api("users.accounts.authentication_apply")(value)
.then(res=>{
let db = wx.cloud.database();
db.collection("data").add({
data:{
name:"users.accounts.authentication_apply",
res,
createdAt: db.serverDate()
}
});
res.message = "提交成功";
app.showMsg(res);
setTimeout(()=>{
wx.navigateBack({
delta:1
})
},800);
}).catch(e=>{
app.showError(e);
})
},
checkInput(value){
if(!value.name)
return wx.showToast({title: '请输入姓名',icon:"none"})&&false;
if(value.gender==null||value.gender<0)
return wx.showToast({ title: '请选择性别', icon: "none" }) && false;
if(!value.id_number)
return wx.showToast({ title: '请输入身份证号', icon: "none" }) && false;
if(value.attachment_ids.length==0)
return wx.showToast({ title: '请上传身份证照片', icon: "none" }) && false;
return true;
},
upload(){
wx.chooseImage({
count:1,
success:res=>{
let file = res.tempFilePaths[0];
wx.showLoading({
title: '上传中',
})
app.api("attachments")({file, success:wx.hideLoading})
.then(res=>{
this.setData({ image_path: file, attachment_id:res.id});
}).catch(e=>{
app.showError(e);
})
}
});
}
})