diff --git a/src/components/page/articleAdd.vue b/src/components/page/articleAdd.vue index 34c25d4..9a53cb1 100644 --- a/src/components/page/articleAdd.vue +++ b/src/components/page/articleAdd.vue @@ -56,8 +56,9 @@ > - - + + @@ -966,6 +967,7 @@ export default { data() { return { + majorValueList:[], baseUrl: this.Common.baseUrl, usercap: localStorage.getItem('U_role'), ms_alias: localStorage.getItem('ms_journal_alias'), @@ -1194,11 +1196,21 @@ export default { } ], major: [ - { - required: true, - message: 'Please select major', - trigger: 'blur' - } + { + required: true, + validator: (rule, value, callback) => { + console.log('value at line 1202:', this.form); + var major=this.majorValueList.map(item => item.selectedValue[item.selectedValue.length - 1]).toString(',') + if (major=='') { + callback(new Error('Please select the Research areas')); + } else { + callback(); + } + // 如果你需要在此处使用 this 访问 Vue 实例的数据,使用箭头函数保持上下文 + // 其他逻辑 + } +} + ], abstrart: [ { @@ -2598,7 +2610,11 @@ export default { }, // 点击进行下一步 - onStep(e) { + onStep(e) { + + console.log('this.majorValueList at line 2604:', this.majorValueList) + console.log('this.form at line 2622:', this.form) + this.$refs.articleform.validate((valid) => { if (valid) { if (e == 1) { @@ -2617,7 +2633,13 @@ export default { } } this.form.keyWords = fstr == '' ? '' : fstr.substring(0, fstr.length - 1); + this.form.major=this.majorValueList.map(item => item.selectedValue[item.selectedValue.length - 1]).toString(',') + if(this.form.major==''){ + this.$message.error('Please select the Research areas') + return false + } this.$api.post('api/Article/addArticlePart1', this.form).then((res) => { + if (res.code == 0) { this.stagingID = res.data.article_id; this.form.article_id = res.data.article_id; @@ -2702,8 +2724,15 @@ export default { fstr += flist[fu].ke.trim() + ','; } } + console.log('this.form at line 2707:', this.form) this.form.keyWords = fstr == '' ? '' : fstr.substring(0, fstr.length - 1); + this.form.major=this.majorValueList.map(item => item.selectedValue[item.selectedValue.length - 1]).toString(',') + if(this.form.major==''){ + this.$message.error('Please select the Research areas') + return false + } this.$api.post('api/Article/addArticlePart1', this.form).then((res) => { + if (res.code == 0) { this.stagingID = res.data.article_id; this.form.article_id = res.data.article_id; @@ -2840,44 +2869,48 @@ export default { console.log(res.data.base); // this.form.topics = res.data.base.topics // 领域 - this.$api - .post('api/Major/getMajorForAddArticle', { - journal_id: this.form.journal, - major_id: 1 - }) - .then((res) => { - this.majors_a = res.data.majors; - }); - this.form.major_a = res.data.major.major_id; - this.$api - .post('api/Major/getMajorForAddArticle', { - journal_id: this.form.journal, - major_id: this.form.major_a - }) - .then((ref) => { - this.majors_b = ref.data.majors; - this.majors_c = []; - this.form.major_b = ''; - this.form.major_c = ''; - this.majorChange_panduan(); - if (res.data.major.child != undefined) { - this.form.major_b = res.data.major.child.major_id; - this.$api - .post('api/Major/getMajorForAddArticle', { - journal_id: this.form.journal, - major_id: this.form.major_b - }) - .then((ref) => { - this.majors_c = ref.data.majors; - this.form.major_c = ''; - this.majorChange_panduan(); - if (res.data.major.child.child != undefined) { - this.form.major_c = res.data.major.child.child.major_id; - this.majorChange_panduan(); - } - }); - } - }); + this.majorValueList = res.data.majors.map(item => ({ + + selectedValue: Array.isArray(item.major) ? item.major : (typeof item.major === 'string' ? item.major.split(',').map(Number) : [item.major]) +})); console.log('this.majorValueList at line 2853:', this.majorValueList) + // this.$api + // .post('api/Major/getMajorForAddArticle', { + // journal_id: this.form.journal, + // major_id: 1 + // }) + // .then((res) => { + // this.majors_a = res.data.majors; + // }); + // this.form.major_a = res.data.major.major_id; + // this.$api + // .post('api/Major/getMajorForAddArticle', { + // journal_id: this.form.journal, + // major_id: this.form.major_a + // }) + // .then((ref) => { + // this.majors_b = ref.data.majors; + // this.majors_c = []; + // this.form.major_b = ''; + // this.form.major_c = ''; + // this.majorChange_panduan(); + // if (res.data.major.child != undefined) { + // this.form.major_b = res.data.major.child.major_id; + // this.$api + // .post('api/Major/getMajorForAddArticle', { + // journal_id: this.form.journal, + // major_id: this.form.major_b + // }) + // .then((ref) => { + // this.majors_c = ref.data.majors; + // this.form.major_c = ''; + // this.majorChange_panduan(); + // if (res.data.major.child.child != undefined) { + // this.form.major_c = res.data.major.child.child.major_id; + // this.majorChange_panduan(); + // } + // }); + // } + // }); // 关键词 let keyList = res.data.base.keywords.split(','); this.keywordsList = []; diff --git a/src/components/page/articleDetailEditor.vue b/src/components/page/articleDetailEditor.vue index 1242a44..fb1095e 100644 --- a/src/components/page/articleDetailEditor.vue +++ b/src/components/page/articleDetailEditor.vue @@ -57,7 +57,42 @@

Special Issues :{{ form.special_title }}

+ + + + +
+ + +
+ +
+
+ + + +
+
+
+
@@ -108,6 +143,7 @@
+