From 2b1f3730260d2b2bff1f346060100e1d7cc34ced Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Wed, 11 Sep 2024 21:32:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=84=8F=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/applyForm/index.vue | 4 +- packages/apply/index.vue | 84 +++++++++++++++-------------- packages/booksubmit/appointment.vue | 4 +- packages/booksubmit/index.vue | 12 +++-- packages/course/detail.vue | 4 -- 5 files changed, 57 insertions(+), 51 deletions(-) diff --git a/components/applyForm/index.vue b/components/applyForm/index.vue index 67fb249..5748a21 100644 --- a/components/applyForm/index.vue +++ b/components/applyForm/index.vue @@ -252,7 +252,7 @@ let valueArr = [] let fileListArr = [] console.log("item.fileListArr",item.fileListArr) - if(item.fileListArr.length>0){ + if(item.fileListArr && item.fileListArr.length>0){ item.fileListArr.map(f=>{ if(f.response){ valueArr.push(f.response.url.replace(baseUrl, '')) @@ -262,6 +262,8 @@ fileListArr.push(f) } }) + }else{ + item.fileListArr = [] } item.value = valueArr.join(",") item.fileList = fileListArr diff --git a/packages/apply/index.vue b/packages/apply/index.vue index 879764b..616d57b 100644 --- a/packages/apply/index.vue +++ b/packages/apply/index.vue @@ -22,9 +22,10 @@ is_fee: 0, //需不需要缴费这个课程 form: {}, apply_form: [], - course_forms: [], - sign_id:'', // 报名的id - opType:'add', // edit 修改 + course_forms: [], + sign_id: '', // 报名的id + opType: 'add', // edit 修改 + isLocked: false } }, onReady() { @@ -32,8 +33,8 @@ }, onLoad(options) { this.course_id = options.id - if (options.type === 'edit') { - this.opType = 'edit' + if (options.type === 'edit') { + this.opType = 'edit' this.getSignDetail(options.id) } else { this.getCourseDetail(options.id) @@ -65,7 +66,7 @@ async getSignDetail(id) { const res = await this.$u.api.courseGetSign({ course_id: id - }) + }) this.sign_id = res.detail.id if (res.detail.data && res.detail.data.length > 0) { res.detail.data.map(item => { @@ -93,23 +94,17 @@ }) this.apply_form = _arr console.log("this.apply_form", this.apply_form, this.form) - // return - this.saveUser() - if(this.opType == 'edit'){ - this.updateApplyCourse() - }else{ - - this.applyCourse() + // return + if (this.isLocked) { + return + } + this.isLocked = true + this.saveUser() + if (this.opType == 'edit') { + this.updateApplyCourse() + } else { + this.applyCourse() } - // this.$refs.uForm.validate(valid => { - // if (valid) { - - // } else { - // console.log('验证失败'); - // // this.base.toast("验证失败") - // } - // }); - }, async saveUser() { let that = this @@ -119,11 +114,16 @@ // this.$u.api.user().then(res => { // this.$u.vuex('vuex_user', res.user) // }) + }).catch(err => { + console.log("err", err) + that.isLocked = false }) }, async applyCourse() { let that = this - // let that = this + // let that = this + + await this.$u.api.courseSign({ course_id: this.course_id, data: this.apply_form @@ -140,23 +140,29 @@ }) } + }).catch(err => { + console.log("err", err) + that.isLocked = false + }) + }, + // 更新报名信息 + async updateApplyCourse() { + let that = this + this.$u.api.courseUpdateSign({ + id: this.sign_id, + data: this.apply_form + }).then(res => { + that.base.toast("修改成功", 1500, function() { + setTimeout(function() { + uni.redirectTo({ + url: '/packages/mycourse/index' + }) + }, 500) + }) + }).catch(err => { + console.log("err", err) + that.isLocked = false }) - }, - // 更新报名信息 - async updateApplyCourse() { - let that = this - this.$u.api.courseUpdateSign({ - id: this.sign_id, - data:this.apply_form - }).then(res => { - that.base.toast("修改成功", 1500, function() { - setTimeout(function() { - uni.redirectTo({ - url: '/packages/mycourse/index' - }) - }, 500) - }) - }) }, // 订阅缴费 diff --git a/packages/booksubmit/appointment.vue b/packages/booksubmit/appointment.vue index de9aae5..6f0cab8 100644 --- a/packages/booksubmit/appointment.vue +++ b/packages/booksubmit/appointment.vue @@ -1,10 +1,10 @@