diff --git a/package_sub/pages/BatchForm/BatchForm.vue b/package_sub/pages/BatchForm/BatchForm.vue index 7af7235..7c92425 100644 --- a/package_sub/pages/BatchForm/BatchForm.vue +++ b/package_sub/pages/BatchForm/BatchForm.vue @@ -94,21 +94,23 @@ + @click="forSchoolName = { needSpec: (school.specialty && school.specialty.length > 0), code: `${currentBatch.id}-${item.id}-${school.id}-code`, value: `${currentBatch.id}-${item.id}-${school.id}-value` },getSchools(item.id),isShowSchoolSelect = true"> + @click="forSchoolName = { needSpec: (school.specialty && school.specialty.length > 0), code: `${currentBatch.id}-${item.id}-${school.id}-code`, value: `${currentBatch.id}-${item.id}-${school.id}-value` },getSchools(item.id),isShowSchoolSelect = true"> @@ -132,6 +134,7 @@ val === label) + let flag = false + const comparePrefix = (str1, str2) => { + const parts1 = str1.split('-'); + const parts2 = str2.split('-'); + + return parts1[0] === parts2[0] && parts1[1] === parts2[1]; + } + findSameSchoolName.forEach(([key, value]) => { + if (comparePrefix(key, this.forSchoolName.value)) { + flag = true + } + }) + if (flag) { + this.$u.toast("选择学校重复") + return + } if (this.forSchoolName.code) { this.flatForm[this.forSchoolName.code] = value } @@ -341,18 +363,23 @@ export default { console.error(err) } }, - async getSchools() { + async getSchools(batchSubId) { try { - const { list } = await this.$u.api.schoolList({ - page: 1, - page_size: 9999, - group: this.aspiration.group - }) - this.schoolList = list.data.map(school => ({ + this.schoolList = this.schoolMap.get(batchSubId)?.map(school => ({ value: school.code, label: school.name, extra: school.id - })) + })) || [] + // const { list } = await this.$u.api.schoolList({ + // page: 1, + // page_size: 9999, + // group: this.aspiration.group + // }) + // this.schoolList = list.data.map(school => ({ + // value: school.code, + // label: school.name, + // extra: school.id + // })) // this.schoolList = this.areaList.map(area => ({ // id: area.id, // value: area.id, @@ -381,6 +408,9 @@ export default { try { const { batchSubs } = await this.$u.api.batchDetail({ id: batchId }) this.batchSub[batchId] = batchSubs + batchSubs.forEach(batchSub => { + this.schoolMap.set(batchSub.id, batchSub.school) + }) const formBatch = this.subForm.find(i => i.batchId === batchId) formBatch.batchSubs = batchSubs.map(resSub => ({ @@ -457,10 +487,20 @@ export default { this.form.aspiration_id = list[0].id this.aspiration = list[0] + + if (this.aspiration.image_id && this.aspiration.image) { + this.$u.route({ + url: '/package_sub/pages/LoadImage/LoadImage', + params: { + src: this.aspiration.image.url + } + }) + return + } this.setTitle() } else { this.$u.toast("暂未获取到当年模版") - this.stepClick('prev') + return 1 } } catch (err) { console.error(err) @@ -468,16 +508,18 @@ export default { }, async stepClick(type='next') { if (type === 'next') { + let notConfig if (this.step === 1 && !this.config) { - await this.getConfig() - await this.getSchools() + notConfig = await this.getConfig() + // await this.getSchools() } - if (this.step < (1 + this.batches.length)) { + if (this.step < (1 + this.batches.length) && !notConfig) { this.step = this.step + 1 } } else if (type === 'prev') { if (this.step === 1) { this.form.group = '' + this.aspiration = null this.config = null } else if (this.step > 1) { @@ -592,7 +634,7 @@ export default { }, created() { this.getArea().then(_ => { - this.getSchools() + // this.getSchools() }) }, } diff --git a/package_sub/pages/LoadImage/LoadImage.vue b/package_sub/pages/LoadImage/LoadImage.vue new file mode 100644 index 0000000..2261995 --- /dev/null +++ b/package_sub/pages/LoadImage/LoadImage.vue @@ -0,0 +1,22 @@ + + + + + diff --git a/pages.json b/pages.json index 9c7456e..2c8f036 100644 --- a/pages.json +++ b/pages.json @@ -106,15 +106,19 @@ { "path": "pages/webview/webview", "style": { - "navigationBarTitleText": "页面", - "enablePullDownRefresh": true + "navigationBarTitleText": "页面" } }, { "path": "pages/RecommendForm/RecommendForm", "style": { - "navigationBarTitleText": "冲、稳、保", - "enablePullDownRefresh": true + "navigationBarTitleText": "冲、稳、保" + } + }, + { + "path": "pages/LoadImage/LoadImage", + "style": { + "navigationBarTitleText": " " } } ]