16.61b6e2b3a90a18d28d5b.js 8.3 KB

1
  1. webpackJsonp([16],{jcw8:function(t,e){},ygwZ:function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=a("SQ4B"),n=a("b9vf"),o=a("qI5z"),s=a("vGYV"),r={name:"IndividualAuthentication",data:function(){var t=this;return{userId:0,user:{},loading:!1,isModifyMode:!1,authentication:{IDCardPositivePhoto:s.c.image,realName:"",IDCard:"",bankAccount:"",address:"",authStatus:{},explain:""},rules:{IDCard:[{required:!0,message:"请输入身份证号",trigger:"blur"},{min:18,max:18,message:"身份证号输入有误",trigger:"blur"}],realName:[{required:!0,message:"请输入身份证上的姓名",trigger:"blur"}],IDCardPositivePhoto:[{validator:function(t,e,a){console.log(e),null==e||""==e?a(new Error("手持身份证照片不能为空")):a()},trigger:"blue"}],bankAccount:[{required:!0,message:"请输入银行卡账户",trigger:"blur"},{min:16,max:19,message:"银行卡账户输入有误",trigger:"blur"},{validator:function(e,a,i){t.checkNumber(a)?i():i(new Error("对银行卡账户有误"))},trigger:"blur"}],address:[{required:!0,message:"请输入地址",trigger:"blur"}]}}},mounted:function(){var t=this;this.$nextTick(function(){t.init()})},watch:{deep:!0},methods:{init:function(){this.setUserInfo(),this.getAuthInfo()},getAuthInfo:function(){this.showLoading(),Object(s.u)(this.user.userVO.id,this.getAuthInfoSuccess,this.getAuthInfoFail)},getAuthInfoSuccess:function(t){this.hideLoading(),this.authentication.IDCardPositivePhoto=null==t.idCardPositivePhotoi?s.c.image:t.idCardPositivePhotoi,this.authentication.realName=null==t.realName?"暂未填写":t.realName,this.authentication.IDCard=null==t.idcard?"暂未填写":t.idcard,this.authentication.bankAccount=null==t.bankAccount?"暂未填写":t.bankAccount,this.authentication.address=null==t.address?"暂未填写":t.address,this.authentication.authStatus=t.authStatus,this.authentication.explain=t.explain,console.log(this.authentication)},getAuthInfoFail:function(t){this.hideLoading(),Object(o.a)("error","加载认证信息失败:"+t.data)},modifyInfo:function(){this.isModifyMode=!0},updateAuthInfo:function(){var t=this;this.$refs.authentication.validate(function(e){if(!e)return Object(o.a)("error","表单填写错误!"),!1;t.showLoading();var a={userId:t.user.userVO.id,realName:t.authentication.realName,bankAccount:t.authentication.bankAccount,address:t.authentication.address,IDCardPositivePhoto:t.authentication.IDCardPositivePhoto,IDCard:t.authentication.IDCard};Object(s.P)(t.user.userVO.id,a,t.updateAuthInfoSuccess,t.updateAuthInfoFail)})},updateAuthInfoSuccess:function(t){var e=this;this.hideLoading(),this.authentication.IDCardPositivePhoto=null==t.idCardPositivePhotoi?s.c.image:t.idCardPositivePhotoi,this.authentication.realName=null==t.realName?"暂未填写":t.realName,this.authentication.IDCard=null==t.idcard?"暂未填写":t.idcard,this.authentication.bankAccount=null==t.bankAccount?"暂未填写":t.bankAccount,this.authentication.address=null==t.address?"暂未填写":t.address,this.cancelModify(),Object(o.a)("success","认证信息修改成功,正在为您刷新用户信息"),Object(s.v)().then(function(t){Object(s.K)("user",t),e.user=t,e.sendBusMessage(),Object(s.K)("rolesPermissions",Object(s.B)(t.roleList)),e.hideLoading(),Object(o.a)("success","用户信息刷新成功")}).catch(function(t){e.hideLoading(),Object(o.a)("error","重新获取用户信息失败:"+t.data)})},updateAuthInfoFail:function(t){this.hideLoading(),Object(o.a)("error",t.data)},cancelModify:function(){this.getAuthInfo(),this.isModifyMode=!1},handleRemove:function(t,e){console.log(t,e)},handleExceed:function(t,e){this.$message.warning("当前限制选择 1 个文件,本次选择了 "+t.length+" 个文件,共选择了 "+(t.length+e.length)+" 个文件")},beforeRemove:function(t,e){},beforeFileUpload:function(t){if(t.size>1e7)return Object(o.a)("error","单个文件大小不能超过10M"),!1;var e=t.namep,a=e.lastIndexOf(".");if(a<=0)return Object(o.a)("error","只能上传png/jpg格式的文件"),!1;var i=e.substr(a);return".jpg"!==i&&".png"!==i?(Object(o.a)("error","只能上传png/jpg格式的文件"),!1):void 0},uploadFile:function(t){var e=this;this.showLoading();var a=new FormData;a.append("file",t.file),i.a.upload(n.a.FILE.UPLOAD_IMAGE.replace("{userId}",this.user.userVO.id),a,{headers:{"Content-Type":"multipart/form-data"}}).then(function(t){e.hideLoading(),console.log("上传成功"),e.authentication.IDCardPositivePhoto=t.data,console.log(t.data),Object(o.a)("success","上传成功"),e.$refs.authentication.validateField("IDCardPositivePhoto")}).catch(function(t){e.hideLoading();try{413===t.response.status?Object(o.a)("error","文件过大,请选择小于20M的图片"):500===t.response.status&&Object(o.a)("error","上传文件发生错误,请稍后重试")}catch(e){Object(o.a)("error",t.data)}})},setUserInfo:function(){this.user=Object(s.J)("user")},showLoading:function(){this.loading=!0},hideLoading:function(){this.loading=!1},sendBusMessage:function(){this.$root.$emit("user",this.user)},checkNumber:function(t){return/^\d+$/.test(t)}},created:function(){}},u={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],staticClass:"create-container"},[a("div",{staticClass:"create-body"},[a("div",{staticClass:"title"},[t._v("个人信息认证")]),t._v(" "),a("el-form",{ref:"authentication",staticClass:"demo-report",attrs:{model:t.authentication,rules:t.rules,"label-width":"12%"}},[a("el-form-item",{attrs:{label:"姓名",prop:"realName"}},[t.isModifyMode?a("el-input",{model:{value:t.authentication.realName,callback:function(e){t.$set(t.authentication,"realName",e)},expression:"authentication.realName"}}):t._e(),t._v(" "),t.isModifyMode?t._e():a("span",[t._v(t._s(t.authentication.realName))])],1),t._v(" "),a("el-form-item",{attrs:{prop:"IDCardPositivePhoto",label:"手持身份证照片"}},[t.isModifyMode?a("el-upload",{staticClass:"avatar-uploader",attrs:{action:"","show-file-list":!1,"http-request":t.uploadFile,"before-upload":t.beforeFileUpload}},[t.authentication.IDCardPositivePhoto?a("img",{staticClass:"avatar",attrs:{src:t.authentication.IDCardPositivePhoto}}):a("i",{staticClass:"el-icon-plus avatar-uploader-icon"})]):t._e(),t._v(" "),t.isModifyMode?t._e():a("span",[a("el-image",{staticStyle:{width:"100px"},attrs:{src:t.authentication.IDCardPositivePhoto,fit:"scale-down"}})],1)],1),t._v(" "),a("el-form-item",{attrs:{label:"身份证号",prop:"IDCard"}},[t.isModifyMode?a("el-input",{model:{value:t.authentication.IDCard,callback:function(e){t.$set(t.authentication,"IDCard",e)},expression:"authentication.IDCard"}}):t._e(),t._v(" "),t.isModifyMode?t._e():a("span",[t._v(t._s(t.authentication.IDCard))])],1),t._v(" "),t.isModifyMode?t._e():a("el-form-item",{attrs:{label:"认证状态",prop:"name"}},[a("el-tag",{attrs:{type:t.authentication.authStatus.style}},[t._v(t._s(t.authentication.authStatus.text))])],1),t._v(" "),t.isModifyMode||"认证失败"!=t.authentication.authStatus.text?t._e():a("el-form-item",{attrs:{label:"失败原因",prop:"name"}},[null!=t.authentication.explain&&""!=t.authentication.explain?a("el-link",{attrs:{type:"danger",disabled:""}},[t._v("\n "+t._s(t.authentication.explain)+"\n ")]):t._e(),t._v(" "),null==t.authentication.explain||""==t.authentication.explain?a("el-link",{attrs:{type:"danger",disabled:""}},[t._v("管理员未填写\n ")]):t._e()],1),t._v(" "),a("el-form-item",{attrs:{label:"地址",prop:"address"}},[t.isModifyMode?a("el-input",{model:{value:t.authentication.address,callback:function(e){t.$set(t.authentication,"address",e)},expression:"authentication.address"}}):t._e(),t._v(" "),t.isModifyMode?t._e():a("span",[t._v(t._s(t.authentication.address))])],1),t._v(" "),t.isModifyMode?t._e():a("el-form-item",["认证通过"!=t.authentication.authStatus.text?a("div",{staticClass:"btn btn-medium btn-info",on:{click:function(e){return t.modifyInfo()}}},[t._v("修改\n ")]):t._e()]),t._v(" "),t.isModifyMode?a("el-form-item",[a("div",{staticClass:"btn btn-primary btn-info",on:{click:function(e){return t.updateAuthInfo()}}},[t._v("提交")]),t._v(" "),a("div",{staticClass:"btn btn-primary",on:{click:function(e){return t.cancelModify()}}},[t._v("取消")])]):t._e()],1)],1)])},staticRenderFns:[]};var c=a("VU/8")(r,u,!1,function(t){a("jcw8")},"data-v-f9970644",null);e.default=c.exports}});