2 lines
1.6 KiB
JavaScript
2 lines
1.6 KiB
JavaScript
|
"use strict";const e=require("../../common/vendor.js"),t=require("../../utils/http.js");require("../../store/index.js");const o=require("../../utils/commUtils.js"),s=require("../../store/user.js");if(!Array){e.resolveComponent("layout-default-uni")()}Math||n();const n=()=>"../../components/TopBar.js",a={__name:"real-name-auth",setup(n){const a=e.ref("/static/permission/idcard.png"),i=e.ref("/static/permission/idcard_back.png"),r=e.ref(null),l=e.ref(null),u=s.useUserStore(),c=()=>{e.index.chooseImage({count:1,success:e=>{r.value=e.tempFilePaths[0],a.value=r.value}})},d=()=>{e.index.chooseImage({count:1,success:e=>{l.value=e.tempFilePaths[0],i.value=l.value}})},h=()=>{return o=this,s=null,n=function*(){if(r.value)if(l.value)try{e.index.showToast({title:"提交认证中",icon:"loading"}),r.value&&(yield t.httpUploadFile("/auth",r.value,"file",{type:"front"}),u.setUserInfo({isRealName:!0})),e.index.showToast({title:"提交认证成功",icon:"none"})}catch(o){if(413==o.statusCode)return void e.index.showToast({title:"图片大小不能超过 1MB",icon:"none"});e.index.showToast({title:"提交认证失败",icon:"none"})}else e.index.showToast({title:"请选择身份证国徽面图片",icon:"none"});else e.index.showToast({title:"请选择身份证人像面图片",icon:"none"})},new Promise(((e,t)=>{var a=e=>{try{r(n.next(e))}catch(o){t(o)}},i=e=>{try{r(n.throw(e))}catch(o){t(o)}},r=t=>t.done?e(t.value):Promise.resolve(t.value).then(a,i);r((n=n.apply(o,s)).next())}));var o,s,n};return(t,s)=>e.e({a:!e.unref(u).userInfo.isRealName},e.unref(u).userInfo.isRealName?{}:{b:a.value,c:e.o(c),d:i.value,e:e.o(d),f:e.o(h),g:e.o((t=>e.unref(o.toPath)("/")))})}};wx.createPage(a);
|