diff --git a/pages/train_management/face_authentication.nvue b/pages/train_management/face_authentication.nvue index 968d07c..f923d69 100644 --- a/pages/train_management/face_authentication.nvue +++ b/pages/train_management/face_authentication.nvue @@ -136,6 +136,7 @@ USERAVATARURL }) uni.$u.toast('人脸认证成功') + uni.$emit('joinClass') setTimeout(() => { uni.navigateBack({ delta: 2 diff --git a/pages/train_management/realname_info_auth.vue b/pages/train_management/realname_info_auth.vue index 82f71a9..6b2e14b 100644 --- a/pages/train_management/realname_info_auth.vue +++ b/pages/train_management/realname_info_auth.vue @@ -173,7 +173,9 @@ export default { trigger: ['blur', 'change'] } ] - } + }, + formData: {}, + files: [] } }, @@ -192,8 +194,24 @@ export default { this.ruleFormData.userInfo.sex = sex; this.ruleFormData.userInfo.degreeOfEducation = degreeOfEducation; }, - + mounted(){ + uni.$on('joinClass',this.fnJoinClass) + }, + beforeMount(){ + uni.$off('joinClass') + }, methods: { + fnJoinClass(){ + joinClass({ + files: this.files, + formData: this.formData, + }) + .then(() => { + uni.redirectTo({ + url: '/pages/train_management/index' + }); + }) + }, handleEducationClick() { this.$refs.uPicker.setIndexs([0]) this.fnGetDataDictionary('d7d80f08d73a4accbccf4fd3d8d1d867') @@ -247,16 +265,16 @@ export default { await this.$refs.uFormRef .validate() .then(async () => { - let files = [] + // let files = [] if (this.ruleFormData.userInfo.gradeCertificate[0]) { - files.push({ + this.files.push({ name: 'certificatefile', file: this.ruleFormData.userInfo.gradeCertificate[0], uri: this.ruleFormData.userInfo.gradeCertificate[0].url }) } if (this.ruleFormData.userInfo.writeSign) { - files.push({ + this.files.push({ name: 'signfile', uri: this.ruleFormData.userInfo.writeSign }) @@ -265,22 +283,11 @@ export default { const params = { ...this.ruleFormData.userInfo } delete params.gradeCertificate delete params.writeSign - await joinClass({ - files, - formData: { ...params, classId,USER_ID:this.$store.getters.getUserInfo.USER_ID } + this.formData= { ...params, classId,USER_ID:this.$store.getters.getUserInfo.USER_ID } + uni.$u.route({ + url: '/pages/train_management/face_authentication', + params: { ...this.routeQuery, type: 'scan_face' } }) - .then(() => { - uni.$u.toast('保存成功') - setTimeout(() => { - uni.$u.route({ - url: '/pages/train_management/face_authentication', - params: { ...this.routeQuery, type: 'scan_face' } - }) - }, 1500) - }) - .catch((err) => { - if (err) uni.$u.toast(err.msg) - }) }) .catch((e) => { uni.$u.toast('请补全必填项')