diff --git a/src/api/index.js b/src/api/index.js index 487fb66..525753d 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -19,8 +19,8 @@ const service = axios.create({ // baseURL: 'https://submission.tmrjournals.com/', //正式 记得切换 // baseURL: 'http://www.tougao.com/', //测试本地 记得切换 // baseURL: 'http://192.168.110.110/tougao/public/index.php/', - baseURL: '/api', //本地 - // baseURL: '/', //正式 + // baseURL: '/api', //本地 + baseURL: '/', //正式 }); diff --git a/src/common/js/commonJS.js b/src/common/js/commonJS.js index 60bb1ab..eae4459 100644 --- a/src/common/js/commonJS.js +++ b/src/common/js/commonJS.js @@ -1244,7 +1244,38 @@ str = str.replace(regex, function (match, content, offset, fullString) { }, - + getCleanTextForCount(html) { + if (!html) return ""; + + // 创建临时容器解析 HTML + const tempDiv = document.createElement('div'); + tempDiv.innerHTML = html; + + // A. 特殊处理 wmath:只拿它里面的公式文本,扔掉里面生成的 mjx-container 等标签 + const wmaths = tempDiv.querySelectorAll('wmath'); + wmaths.forEach(wm => { + // textContent 会拿到最原始的公式字符,忽略内部所有标签 + const textNode = document.createTextNode(wm.textContent); + wm.parentNode.replaceChild(textNode, wm); + }); + + // B. 获取现在的 HTML 内容 + let result = tempDiv.innerHTML; + + // C. 去掉特定排版标签的“壳”(保留里面的文字) + // 包含 b, strong, br, em, i, sup, sub 等 + result = result.replace(/<(p|div|b|strong|br|em|i|sup|sub)[^>]*>/gi, ""); + result = result.replace(/<\/(p|div|b|strong|br|em|i|sup|sub)>/gi, ""); + + + + // E. 彻底“脱水”:去掉 HTML 实体、换行符、所有空格 + result = result.replace(/ /ig, ""); + result = result.replace(/[\r\n\t]/g, ""); + result = result.replace(/\s+/g, ""); + + return result; + }, diff --git a/src/components/page/components/reviewArticle/author.vue b/src/components/page/components/reviewArticle/author.vue index c990abd..070732e 100644 --- a/src/components/page/components/reviewArticle/author.vue +++ b/src/components/page/components/reviewArticle/author.vue @@ -17,9 +17,6 @@ :form="baseQuestionform" @update="(e) => (questionform = e)" > - - - @@ -134,7 +131,6 @@ export default { recommend: [{ required: true, message: 'please select', trigger: 'blur' }] }; } - }, questionSubmit() { if (this.questionform.is_anonymous == '' && this.questionform.is_anonymous != '0') { @@ -161,30 +157,29 @@ export default { } let Char_Cter = null; // 验证相加的字数 - if (this.isNewForm) { - Char_Cter = [ - this.questionform.qu5contents, - this.questionform.qu6contents, - this.questionform.qu7contents, - this.questionform.qu8contents, - this.questionform.qu9contents, - this.questionform.qu10contents, - this.questionform.qu11contents, - this.questionform.qu12contents, - this.questionform.qu13contents, - this.questionform.qu14contents, - this.questionform.comment - ].join(' '); - } else { - Char_Cter = [ - this.questionform.qu9contents, - this.questionform.qu10contents, - this.questionform.qu11contents, - this.questionform.qu12contents, - this.questionform.qu13contents, - this.questionform.comment - ].join(' '); - } + const contents = this.isNewForm + ? [ + this.questionform.qu5contents, + this.questionform.qu6contents, + this.questionform.qu7contents, + this.questionform.qu8contents, + this.questionform.qu9contents, + this.questionform.qu10contents, + this.questionform.qu11contents, + this.questionform.qu12contents, + this.questionform.qu13contents, + this.questionform.qu14contents, + this.questionform.comment + ] + : [ + this.questionform.qu9contents, + this.questionform.qu10contents, + this.questionform.qu11contents, + this.questionform.qu12contents, + this.questionform.qu13contents, + this.questionform.comment + ]; + Char_Cter = this.$commonJS.getCleanTextForCount(contents.join(' ')); if (new RegExp('[\\u4E00-\\u9FFF]+', 'g').test(Char_Cter)) { //中文 diff --git a/src/components/page/components/reviewArticle/index.vue b/src/components/page/components/reviewArticle/index.vue index 9d759b3..40c1a70 100644 --- a/src/components/page/components/reviewArticle/index.vue +++ b/src/components/page/components/reviewArticle/index.vue @@ -342,6 +342,7 @@ export default { return content; }, + async questionSubmit() { if (this.questionform.is_anonymous == '' && this.questionform.is_anonymous != '0') { @@ -368,30 +369,29 @@ export default { } let Char_Cter = null; // 验证相加的字数 - if (this.isNewForm) { - Char_Cter = [ - this.questionform.qu5contents, - this.questionform.qu6contents, - this.questionform.qu7contents, - this.questionform.qu8contents, - this.questionform.qu9contents, - this.questionform.qu10contents, - this.questionform.qu11contents, - this.questionform.qu12contents, - this.questionform.qu13contents, - this.questionform.qu14contents, - this.questionform.comment - ].join(' '); - } else { - Char_Cter = [ - this.questionform.qu9contents, - this.questionform.qu10contents, - this.questionform.qu11contents, - this.questionform.qu12contents, - this.questionform.qu13contents, - this.questionform.comment - ].join(' '); - } + const contents = this.isNewForm ? [ + this.questionform.qu5contents, + this.questionform.qu6contents, + this.questionform.qu7contents, + this.questionform.qu8contents, + this.questionform.qu9contents, + this.questionform.qu10contents, + this.questionform.qu11contents, + this.questionform.qu12contents, + this.questionform.qu13contents, + this.questionform.qu14contents, + this.questionform.comment +] : [ + this.questionform.qu9contents, + this.questionform.qu10contents, + this.questionform.qu11contents, + this.questionform.qu12contents, + this.questionform.qu13contents, + this.questionform.comment +]; +Char_Cter = this.$commonJS.getCleanTextForCount(contents.join(' ')); + + if (new RegExp('[\\u4E00-\\u9FFF]+', 'g').test(Char_Cter)) { //中文 @@ -447,7 +447,7 @@ if(this.questionform.confident != ''){ confidentStr = await this.abstractFormat(this.questionform.confident); } - +return this.$refs.question.validate((valid) => { if (valid) {