From 531726439b6e595b0cb1b39412abac3495cb106c Mon Sep 17 00:00:00 2001 From: "@fawn-nine" <1271023382@qq.com> Date: Sun, 25 Jun 2023 14:19:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=95=E7=94=A8=E9=A1=B5=E9=9D=A2=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/page/Complete_profile.vue | 2 +- src/components/page/ReferenceEditor.vue | 198 +++++++++++++++++------ 2 files changed, 148 insertions(+), 52 deletions(-) diff --git a/src/components/page/Complete_profile.vue b/src/components/page/Complete_profile.vue index f99e2e0..1252077 100644 --- a/src/components/page/Complete_profile.vue +++ b/src/components/page/Complete_profile.vue @@ -76,6 +76,6 @@ p{color: #333;} .mt10{margin-top: 10px;} .more{font-weight: bold;} - .helpcontent{color: #888; margin-top: 150px;} + .helpcontent{color: #888; margin-top: 150px; padding-top: 30px; border-top: 2px solid #f1f1f1;} .helpcontent p{color: inherit; font-size: 12px;} \ No newline at end of file diff --git a/src/components/page/ReferenceEditor.vue b/src/components/page/ReferenceEditor.vue index d17016c..ea5fe80 100644 --- a/src/components/page/ReferenceEditor.vue +++ b/src/components/page/ReferenceEditor.vue @@ -1,6 +1,6 @@ @@ -135,17 +138,33 @@

现在您可以添加或者修改您的引用文献信息,如果您有引用文献的Doi数据,可以直接复制到Doi输入框,并提交,系统会自动识别您的引用文献,如果您没有Doi数据,也可以打开“Show Content”开关,直接填写您的引用文献内容。

- - - - +

There is no Doi data:

+ + + - + + + + + + + + + + + + + + + + + + + Cancel @@ -168,7 +187,7 @@
- @@ -182,7 +201,7 @@
-

  The above is the citation data identified according to your uploaded file, you can choose to import, or discard this data and import again.

+

  The above is the citation data identified according to your uploaded file, you can choose to import, or discard this data and upload again.

@@ -211,7 +230,7 @@ ], editboxVisible:false, helpVisible:false, - uploadVisible:false, + uploadVisible:true, linVisible:false, textarea:'', textareaVisible:false, @@ -220,15 +239,37 @@ referFile: '', }, // 引用表单 - refenceForm:{ - refer_content:'', + refenceForm:{ refer_doi:'', p_refer_id:null, // 当前行一行的引用序号 }, refenceFormrules:{ + refer_doi:[ + { required: true, message: 'The Doi cannot be empty', trigger: 'blur' }, + ] + }, + // 引用表单 + refenceLinkForm:{ + author:'', + title:'', + joura:'', + dateno:'', + link:'', + p_refer_id:null, // 当前行一行的引用序号 + }, + refenceLinkFormrules:{ + author:[ + { required: true, message: 'The author cannot be empty', trigger: 'blur' }, + ], title:[ { required: true, message: 'The title cannot be empty', trigger: 'blur' }, - ] + ], + dateno:[ + { required: true, message: 'The dateno cannot be empty', trigger: 'blur' }, + ], + link:[ + { required: true, message: 'The link cannot be empty', trigger: 'blur' }, + ] }, dialogTitle:'' } @@ -271,6 +312,7 @@ }, // 导入文本域 importText(){ + this.linVisible = false this.importIoading = true //console.log(this.form.referFile,'referFile') this.$api @@ -307,8 +349,16 @@ change(row, optitle){ this.dialogTitle = optitle this.editboxVisible = true - this.refenceForm.refer_doi = row.refer_doi - this.refenceForm.p_refer_id = row.p_refer_id + if(row.refer_doi){ + // 有doi + this.refenceForm.refer_doi = row.refer_doi + this.refenceForm.p_refer_id = row.p_refer_id + }else{ + // doi + this.contentVisible = true + } + + }, // 取消保存 @@ -316,14 +366,34 @@ this.editboxVisible = false // refenceForm this.$refs['refenceForm'].resetFields(); + this.refenceForm.refer_doi = '' this.dialogTitle = '' }, // 编辑引用 saveChange(){ - this.$refs.refenceForm.validate((valid) => { + if(this.contentVisible){ // 无doi形式 + this.editNoneDoi() + }else{ + this.editHaveDoi() + } + + }, + // 编辑无doi + editNoneDoi(){ + this.$refs.refenceLinkForm.validate((valid) => { this.addLoading = true if(valid){ + console.log('没有doi编辑情况') + } + }) + }, + + // 编辑有doi + editHaveDoi(){ + this.$refs.refenceForm.validate((valid) => { + this.addLoading = true + if(valid){ this.$api .post('api/Preaccept/editRefer', { // 'article_id': this.$route.query.id, @@ -336,7 +406,10 @@ this.$message.success('successed!') this.getRefData() this.cancelSave() - } else { + }else if(res.code == 1){ + this.addLoading = false + this.$message.error(res.msg) + } else { this.$message.error(res.msg); } }) @@ -351,9 +424,9 @@ // 保存新增 saveAdd(){ - this.$refs.refenceForm.validate((valid) => { - this.addLoading = true + this.$refs.refenceForm.validate((valid) => { if(valid){ + this.addLoading = true this.$api .post('api/Preaccept/addRefer', { 'article_id': this.$route.query.id, @@ -366,7 +439,13 @@ this.$message.success('successed!') this.getRefData() this.cancelSave() - } else { + }else if(res.code == 1){ + // doi 错误 + this.addLoading = false + this.$message.error(res.msg) + // this.getRefData() + // this.cancelSave() + } else { this.$message.error(res.msg); } }) @@ -440,17 +519,20 @@ this.$refs['uploadFile'].clearFiles(); }, // 清空引用文献 - removeAll(){ + removeAll(){ + this.$confirm('Are you sure you want to empty the reference?', 'Tips', { + confirmButtonText: 'Sure', + cancelButtonText: 'Cancel', + type: 'warning' + }).then(()=>{ this.$api .post('api/Preaccept/discardRefers', { 'article_id': this.$route.query.id }) .then(res => { if (res.code == 0) { - this.$message.success('success!') - setTimeout(()=>{ + this.$message.success('success!') location.reload() // 刷新本页面 - },2000) } else { this.$message.error(res.msg); @@ -459,6 +541,7 @@ .catch(err => { this.$message.error(err); }); + }).catch(()=>{}) }, // 添加一行 addLine(row, optitle){ @@ -539,11 +622,24 @@ // return this.baseUrl + 'api/Article/up_file/type/manuscirpt'; return this.baseUrl + 'api/Preaccept/up_refer_file'; }, - } - } + }, + watch: { + contentVisible: { + handler(newVal, oldVal) { + this.$nextTick(()=>{ + this.$refs['refenceLinkForm'].clearValidate() + this.$refs['refenceForm'].clearValidate() + }) + console.log(newVal) + }, + // immediate: true, + deep: true // 可以深度检测到 person 对象的属性值的变化 + } + } + } -