|
@@ -0,0 +1,777 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <div class="edito">
|
|
|
+ <div
|
|
|
+ class="onlineTextMain"
|
|
|
+ v-loading="loading"
|
|
|
+ element-loading-background="rgba(225,225,225,0.1)"
|
|
|
+ >
|
|
|
+ <div class="flex1">
|
|
|
+ <div class="btn-grounp">
|
|
|
+ 文章内容
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ style="
|
|
|
+ float: right;
|
|
|
+ margin-top: 0.3em;
|
|
|
+ margin-right: 0.5em;
|
|
|
+ padding: 0 1.8em;
|
|
|
+ "
|
|
|
+ @click="getServer"
|
|
|
+ :loading="loading"
|
|
|
+ >
|
|
|
+ 校验
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ class="clearError"
|
|
|
+ type="primary"
|
|
|
+ style="
|
|
|
+ float: right;
|
|
|
+ margin-top: 0.3em;
|
|
|
+ margin-right: 0.5em;
|
|
|
+ padding: 0 1.8em;
|
|
|
+ "
|
|
|
+ @click="exportFun"
|
|
|
+ >
|
|
|
+ 导出
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ class="clearError"
|
|
|
+ type="primary"
|
|
|
+ style="float: right; margin-top: 0.3em; margin-right: 0em"
|
|
|
+ @click="clearError"
|
|
|
+ :icon="Delete"
|
|
|
+ >
|
|
|
+ 清空
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ <div class="Fle">
|
|
|
+ <Editor v-model:rawText="rawText" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="flex2">
|
|
|
+ <div class="btn-grounp">校对结果</div>
|
|
|
+ <div style="padding: 1em 1em 0 1em">
|
|
|
+ <div class="tabs">
|
|
|
+ <div
|
|
|
+ class="tab"
|
|
|
+ @click="() => changeTabAll()"
|
|
|
+ style="background-color: #2974ff; color: #fff"
|
|
|
+ >
|
|
|
+ <p>全部错误</p>
|
|
|
+ {{ search.tabs[0] ? search.tabs[0].num : 0 }}
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="tab"
|
|
|
+ @click="() => changeTab(1)"
|
|
|
+ v-if="tabSelect[1]"
|
|
|
+ :style="{
|
|
|
+ backgroundColor: getTypeError(1, 'rgba'),
|
|
|
+ color: getTypeError(1, 'rgb'),
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <p>严重错误</p>
|
|
|
+ {{ search.tabs[1] ? search.tabs[1].num : 0 }}
|
|
|
+ </div>
|
|
|
+ <div class="tab" @click="() => changeTab(1)" v-else>
|
|
|
+ <p>严重错误</p>
|
|
|
+ {{ search.tabs[1] ? search.tabs[1].num : 0 }}
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="tab"
|
|
|
+ @click="() => changeTab(3)"
|
|
|
+ v-if="tabSelect[3]"
|
|
|
+ :style="{
|
|
|
+ backgroundColor: getTypeError(3, 'rgba'),
|
|
|
+ color: getTypeError(3, 'rgb'),
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <p>一般错误</p>
|
|
|
+ {{ search.tabs[3] ? search.tabs[3].num : 0 }}
|
|
|
+ </div>
|
|
|
+ <div class="tab" @click="() => changeTab(3)" v-else>
|
|
|
+ <p>一般错误</p>
|
|
|
+ {{ search.tabs[3] ? search.tabs[3].num : 0 }}
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="tab"
|
|
|
+ @click="() => changeTab(2)"
|
|
|
+ v-if="tabSelect[2]"
|
|
|
+ :style="{
|
|
|
+ backgroundColor: getTypeError(2, 'rgba'),
|
|
|
+ color: 'rgba(73, 92, 202, 1)',
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <p>疑错</p>
|
|
|
+ {{ search.tabs[2] ? search.tabs[2].num : 0 }}
|
|
|
+ </div>
|
|
|
+ <div class="tab" @click="() => changeTab(2)" v-else>
|
|
|
+ <p>疑错</p>
|
|
|
+ {{ search.tabs[2] ? search.tabs[2].num : 0 }}
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="tab"
|
|
|
+ v-if="tabSelect[4]"
|
|
|
+ @click="() => changeTab(4)"
|
|
|
+ :style="{
|
|
|
+ backgroundColor: getTypeError(4, 'rgba'),
|
|
|
+ color: 'rgba(156, 133, 255, 1)',
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <p>
|
|
|
+ 自定义错误
|
|
|
+ <el-popover
|
|
|
+ placement="top-start"
|
|
|
+ :width="200"
|
|
|
+ trigger="hover"
|
|
|
+ content="若自定义的词语(除正词外)与系统通用逻辑检测出的错误重叠,则该词语会展示两条错误。例:“尊守”为系统检出的错误,若同时设置“尊守”为禁用词,则当文章中出现“尊守”时,会展示两条错误,一条为系统检出,一条为自定义禁用词错误。"
|
|
|
+ >
|
|
|
+ <template #reference>
|
|
|
+ <div
|
|
|
+ style="
|
|
|
+ display: inline-block;
|
|
|
+ border: 1px solid rgb(156, 133, 255);
|
|
|
+ vertical-align: middle;
|
|
|
+ border-radius: 50%;
|
|
|
+ width: 1.2em;
|
|
|
+ height: 1.2em;
|
|
|
+ line-height: 1.2em;
|
|
|
+ text-align: center;
|
|
|
+ color: #5e5e5e;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ ?
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-popover>
|
|
|
+ </p>
|
|
|
+ {{ search.tabs[4] ? search.tabs[4].num : 0 }}
|
|
|
+ </div>
|
|
|
+ <div class="tab" v-else @click="() => changeTab(4)">
|
|
|
+ <p>
|
|
|
+ 自定义错误
|
|
|
+ <el-popover
|
|
|
+ placement="top-start"
|
|
|
+ :width="200"
|
|
|
+ trigger="hover"
|
|
|
+ content="若自定义的词语(除正词外)与系统通用逻辑检测出的错误重叠,则该词语会展示两条错误。例:“尊守”为系统检出的错误,若同时设置“尊守”为禁用词,则当文章中出现“尊守”时,会展示两条错误,一条为系统检出,一条为自定义禁用词错误。"
|
|
|
+ >
|
|
|
+ <template #reference>
|
|
|
+ <div
|
|
|
+ style="
|
|
|
+ display: inline-block;
|
|
|
+ border: 1px solid rgb(156, 133, 255);
|
|
|
+ vertical-align: middle;
|
|
|
+ border-radius: 50%;
|
|
|
+ width: 1.2em;
|
|
|
+ height: 1.2em;
|
|
|
+ line-height: 1.2em;
|
|
|
+ text-align: center;
|
|
|
+ color: #5e5e5e;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ ?
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-popover>
|
|
|
+ </p>
|
|
|
+ {{ search.tabs[4] ? search.tabs[4].num : 0 }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <el-radio-group v-model="tabAct">
|
|
|
+ <el-radio :label="0"
|
|
|
+ >未处理: {{ search.list.length }}</el-radio
|
|
|
+ >
|
|
|
+ <el-radio :label="1"
|
|
|
+ >已忽略: {{ search.list1.length }}</el-radio
|
|
|
+ >
|
|
|
+ <el-radio :label="2"
|
|
|
+ >已替换: {{ search.list2.length }}</el-radio
|
|
|
+ >
|
|
|
+ </el-radio-group>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="search">
|
|
|
+ <div v-if="tabAct === 0">
|
|
|
+ <div v-for="(item, index) in search.list" :key="index">
|
|
|
+ <div v-for="(v, i) in item.htmlWords" :key="'son' + i">
|
|
|
+ <div
|
|
|
+ v-if="tabSelect[item.um_error_level]"
|
|
|
+ class="searchEnd"
|
|
|
+ :style="{
|
|
|
+ borderColor: getTypeError(item.um_error_level, 'rgb'),
|
|
|
+ backgroundColor:
|
|
|
+ select === index
|
|
|
+ ? getTypeError(item.um_error_level, 'rgba')
|
|
|
+ : '',
|
|
|
+ }"
|
|
|
+ @click="() => changeselect(index, item.type.belongId)"
|
|
|
+ >
|
|
|
+ <p style="display: flex">
|
|
|
+ <span
|
|
|
+ v-text="v.word"
|
|
|
+ :style="{
|
|
|
+ flex: 1,
|
|
|
+ color: getTypeError(item.um_error_level, 'rgb'),
|
|
|
+ }"
|
|
|
+ ></span>
|
|
|
+ <span
|
|
|
+ style="flex: 1; text-align: right; color: #2dc76d"
|
|
|
+ v-text="item.suggest[i]"
|
|
|
+ ></span>
|
|
|
+ </p>
|
|
|
+ <p style="line-height: 2.5em">
|
|
|
+ <span
|
|
|
+ :style="{
|
|
|
+ float: 'left',
|
|
|
+ fontSize: '12px',
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <span style="vertical-align: middle; margin-right: 5px">
|
|
|
+ 错误原因:{{ item.youmeiWordName }}
|
|
|
+ </span>
|
|
|
+ <el-popover
|
|
|
+ v-if="item.explanation"
|
|
|
+ placement="top-start"
|
|
|
+ :width="200"
|
|
|
+ trigger="hover"
|
|
|
+ :content="item.explanation"
|
|
|
+ >
|
|
|
+ <template #reference>
|
|
|
+ <div
|
|
|
+ style="
|
|
|
+ display: inline-block;
|
|
|
+ border: 1px solid #5e5e5e;
|
|
|
+ vertical-align: middle;
|
|
|
+ border-radius: 50%;
|
|
|
+ width: 1.2em;
|
|
|
+ height: 1.2em;
|
|
|
+ line-height: 1.2em;
|
|
|
+ text-align: center;
|
|
|
+ color: #5e5e5e;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ ?
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-popover>
|
|
|
+ </span>
|
|
|
+ <span style="float: right; text-align: right">
|
|
|
+ <span
|
|
|
+ class="btn"
|
|
|
+ v-if="item.suggest[i]"
|
|
|
+ @click.stop="
|
|
|
+ () =>
|
|
|
+ clearEle(
|
|
|
+ item.colorPosition,
|
|
|
+ item.suggest[i],
|
|
|
+ index,
|
|
|
+ 2
|
|
|
+ )
|
|
|
+ "
|
|
|
+ >替换</span
|
|
|
+ >
|
|
|
+ <span
|
|
|
+ class="btn"
|
|
|
+ v-if="isDel(item.type.belongId)"
|
|
|
+ @click.stop="
|
|
|
+ () =>
|
|
|
+ removeEle(
|
|
|
+ item.colorPosition,
|
|
|
+ item.suggest[i],
|
|
|
+ index,
|
|
|
+ 2
|
|
|
+ )
|
|
|
+ "
|
|
|
+ >删除
|
|
|
+ </span>
|
|
|
+ <span
|
|
|
+ class="btn"
|
|
|
+ @click.stop="
|
|
|
+ () =>
|
|
|
+ clearEle(
|
|
|
+ item.colorPosition,
|
|
|
+ item.wordHtml,
|
|
|
+ index,
|
|
|
+ 1
|
|
|
+ )
|
|
|
+ "
|
|
|
+ >忽略</span
|
|
|
+ >
|
|
|
+ </span>
|
|
|
+ <span style="clear: both; display: block"></span>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <el-empty
|
|
|
+ description="所选类型下暂无信息"
|
|
|
+ v-if="!search.list || !search.list.length"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div v-if="tabAct === 1">
|
|
|
+ <div v-for="(item, index) in search.list1 || []" :key="index">
|
|
|
+ <div v-for="(v, i) in item.htmlWords" :key="'son' + i">
|
|
|
+ <div
|
|
|
+ class="searchEnd"
|
|
|
+ v-if="tabSelect[item.um_error_level]"
|
|
|
+ :style="{
|
|
|
+ borderColor: getTypeError(item.um_error_level, 'rgb'),
|
|
|
+ backgroundColor:
|
|
|
+ select === index
|
|
|
+ ? getTypeError(item.um_error_level, 'rgba')
|
|
|
+ : '',
|
|
|
+ }"
|
|
|
+ @click="() => changeselect(index, item.type.belongId)"
|
|
|
+ >
|
|
|
+ <p style="display: flex">
|
|
|
+ <span
|
|
|
+ v-text="v.word"
|
|
|
+ :style="{
|
|
|
+ flex: 1,
|
|
|
+ color: getTypeError(item.um_error_level, 'rgb'),
|
|
|
+ }"
|
|
|
+ ></span>
|
|
|
+ <span
|
|
|
+ style="flex: 1; text-align: right; color: #2dc76d"
|
|
|
+ v-text="item.suggest[i]"
|
|
|
+ ></span>
|
|
|
+ </p>
|
|
|
+ <p style="line-height: 2.5em">
|
|
|
+ <span
|
|
|
+ :style="{
|
|
|
+ float: 'left',
|
|
|
+ fontSize: '12px',
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <span style="vertical-align: middle; margin-right: 5px">
|
|
|
+ 错误原因:{{ item.youmeiWordName }}
|
|
|
+ </span>
|
|
|
+ <el-popover
|
|
|
+ v-if="item.explanation"
|
|
|
+ placement="top-start"
|
|
|
+ :width="200"
|
|
|
+ trigger="hover"
|
|
|
+ :content="item.explanation"
|
|
|
+ >
|
|
|
+ <template #reference>
|
|
|
+ <div
|
|
|
+ style="
|
|
|
+ display: inline-block;
|
|
|
+ border: 1px solid #5e5e5e;
|
|
|
+ vertical-align: middle;
|
|
|
+ border-radius: 50%;
|
|
|
+ width: 1.2em;
|
|
|
+ height: 1.2em;
|
|
|
+ line-height: 1.2em;
|
|
|
+ text-align: center;
|
|
|
+ color: #5e5e5e;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ ?
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-popover>
|
|
|
+ </span>
|
|
|
+ <span style="float: right; text-align: right">
|
|
|
+ <span
|
|
|
+ class="btn"
|
|
|
+ @click.stop="() => back(item, index, 1)"
|
|
|
+ >撤销</span
|
|
|
+ >
|
|
|
+ </span>
|
|
|
+ <span style="clear: both; display: block"></span>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <el-empty
|
|
|
+ description="所选类型下暂无信息"
|
|
|
+ v-if="!search.list1 || !search.list1.length"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div v-if="tabAct === 2">
|
|
|
+ <div v-for="(item, index) in search.list2 || []" :key="index">
|
|
|
+ <div v-for="(v, i) in item.htmlWords" :key="'son' + i">
|
|
|
+ <div
|
|
|
+ class="searchEnd"
|
|
|
+ v-if="tabSelect[item.um_error_level]"
|
|
|
+ :style="{
|
|
|
+ borderColor: getTypeError(item.um_error_level, 'rgb'),
|
|
|
+ backgroundColor:
|
|
|
+ select === index
|
|
|
+ ? getTypeError(item.um_error_level, 'rgba')
|
|
|
+ : '',
|
|
|
+ }"
|
|
|
+ @click="() => changeselect(index, item.type.belongId)"
|
|
|
+ >
|
|
|
+ <p style="display: flex">
|
|
|
+ <span
|
|
|
+ v-text="v.word"
|
|
|
+ :style="{
|
|
|
+ flex: 1,
|
|
|
+ color: getTypeError(item.um_error_level, 'rgb'),
|
|
|
+ }"
|
|
|
+ ></span>
|
|
|
+ <span
|
|
|
+ style="flex: 1; text-align: right; color: #2dc76d"
|
|
|
+ v-text="item.suggest[i]"
|
|
|
+ ></span>
|
|
|
+ </p>
|
|
|
+ <p style="line-height: 2.5em">
|
|
|
+ <span
|
|
|
+ :style="{
|
|
|
+ float: 'left',
|
|
|
+ fontSize: '12px',
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <span style="vertical-align: middle; margin-right: 5px">
|
|
|
+ 错误原因:{{ item.youmeiWordName }}
|
|
|
+ </span>
|
|
|
+ <el-popover
|
|
|
+ v-if="item.explanation"
|
|
|
+ placement="top-start"
|
|
|
+ :width="200"
|
|
|
+ trigger="hover"
|
|
|
+ :content="item.explanation"
|
|
|
+ >
|
|
|
+ <template #reference>
|
|
|
+ <div
|
|
|
+ style="
|
|
|
+ display: inline-block;
|
|
|
+ border: 1px solid #5e5e5e;
|
|
|
+ vertical-align: middle;
|
|
|
+ border-radius: 50%;
|
|
|
+ width: 1.2em;
|
|
|
+ height: 1.2em;
|
|
|
+ line-height: 1.2em;
|
|
|
+ text-align: center;
|
|
|
+ color: #5e5e5e;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ ?
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-popover>
|
|
|
+ </span>
|
|
|
+ <span style="float: right; text-align: right">
|
|
|
+ <span
|
|
|
+ class="btn"
|
|
|
+ @click.stop="() => back(item, index, 2)"
|
|
|
+ >
|
|
|
+ 撤销
|
|
|
+ </span>
|
|
|
+ </span>
|
|
|
+
|
|
|
+ <span style="clear: both; display: block"></span>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <el-empty
|
|
|
+ description="所选类型下暂无信息"
|
|
|
+ v-if="!search.list2 || !search.list2.length"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import Editor from '@/components/editor.vue';
|
|
|
+import config from '@/config/index';
|
|
|
+import { ElMessage } from 'element-plus';
|
|
|
+import { Delete } from '@element-plus/icons-vue';
|
|
|
+import { reactive, ref, nextTick } from 'vue';
|
|
|
+import errType from '../../../config/errtype';
|
|
|
+document.title = '稿前校对';
|
|
|
+const loading = ref(false);
|
|
|
+
|
|
|
+const rawText = ref('');
|
|
|
+const tabSelect = reactive([true, true, true, true, true]);
|
|
|
+const urlData = geturl();
|
|
|
+let search = reactive({
|
|
|
+ list: [],
|
|
|
+ list1: [],
|
|
|
+ list2: [],
|
|
|
+ tabs: [
|
|
|
+ {
|
|
|
+ num: 0,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+});
|
|
|
+const tabAct = ref(0);
|
|
|
+const select = ref(0);
|
|
|
+function clearError() {
|
|
|
+ rawText.value = '';
|
|
|
+ search.list = [];
|
|
|
+ search.list1 = [];
|
|
|
+ search.list2 = [];
|
|
|
+ search.tabs = [{ num: 0 }];
|
|
|
+}
|
|
|
+
|
|
|
+function getTypeError(key, type) {
|
|
|
+ if (type == 'rgb') return type + '(' + errType[key] + ')';
|
|
|
+ if (type == 'rgba') return type + '(' + errType[key] + ', 0.1)';
|
|
|
+ return '';
|
|
|
+}
|
|
|
+
|
|
|
+function changeselect(index) {
|
|
|
+ const oldEle = document.querySelector(
|
|
|
+ "[data-umpos='" + search.list[select.value].colorPosition + "']"
|
|
|
+ );
|
|
|
+ const newEle = document.querySelector(
|
|
|
+ "[data-umpos='" + search.list[index].colorPosition + "']"
|
|
|
+ );
|
|
|
+ oldEle.style.backgroundColor = '';
|
|
|
+ newEle.style.backgroundColor =
|
|
|
+ 'rgba(' + errType[search.list[index].um_error_level] + ', 0.5)';
|
|
|
+ select.value = index;
|
|
|
+}
|
|
|
+
|
|
|
+function clearEle(colorPosition, text, i, type) {
|
|
|
+ const newEle = document.querySelector("[data-umpos='" + colorPosition + "']");
|
|
|
+ newEle.setAttribute('style', '');
|
|
|
+ newEle.innerText = text;
|
|
|
+ const item = JSON.parse(JSON.stringify(search.list[i]));
|
|
|
+ search['list' + type].push(item);
|
|
|
+ search.list.splice(i, 1);
|
|
|
+ rawText.value = document.querySelector('.Fle .text').innerHTML;
|
|
|
+}
|
|
|
+
|
|
|
+function isDel(id) {
|
|
|
+ const Del = {
|
|
|
+ 105: true,
|
|
|
+ 108: true,
|
|
|
+ 112: true,
|
|
|
+ 111: true,
|
|
|
+ 201: true,
|
|
|
+ };
|
|
|
+ return Del[id];
|
|
|
+}
|
|
|
+
|
|
|
+function removeEle(colorPosition, text, i) {
|
|
|
+ const newEle = document.querySelector("[data-umpos='" + colorPosition + "']");
|
|
|
+ newEle.remove();
|
|
|
+ rawText.value = document.querySelector('.text').innerHTML;
|
|
|
+ search.list.splice(i, 1);
|
|
|
+}
|
|
|
+
|
|
|
+function back(v, i, type) {
|
|
|
+ const newEle = document.querySelector(
|
|
|
+ "[data-umpos='" + v.colorPosition + "']"
|
|
|
+ );
|
|
|
+ newEle.style.borderColor = 'rgb(' + errType[v.um_error_level] + ')';
|
|
|
+ const item = JSON.parse(JSON.stringify(search['list' + type][i]));
|
|
|
+ search.list.push(item);
|
|
|
+ search['list' + type].splice(i, 1);
|
|
|
+}
|
|
|
+function getServer() {
|
|
|
+ if (!window.fetch) return;
|
|
|
+ loading.value = true;
|
|
|
+ const ele = document.createElement('div');
|
|
|
+ ele.innerHTML = rawText.value;
|
|
|
+ if (!urlData.spm) {
|
|
|
+ if (location.replace) location.replace('https://home.sxtvs.net/');
|
|
|
+ else location.href = 'https://home.sxtvs.net/';
|
|
|
+ }
|
|
|
+ window
|
|
|
+ .fetch('https://topic.smcic.net/youmei/check', {
|
|
|
+ method: 'POST',
|
|
|
+ body: JSON.stringify({
|
|
|
+ raw: ele.innerText,
|
|
|
+ text: rawText.value || config.base.default_text || '',
|
|
|
+ }),
|
|
|
+ headers: {
|
|
|
+ 'Content-Type': 'application/json',
|
|
|
+ spm: urlData.spm || '',
|
|
|
+ },
|
|
|
+ })
|
|
|
+ .then(json => json.json())
|
|
|
+ .then(res => {
|
|
|
+ loading.value = false;
|
|
|
+ if (!res || res.code !== 0)
|
|
|
+ return ElMessage({
|
|
|
+ type: 'error',
|
|
|
+ message: res.message || '请稍后再试!',
|
|
|
+ onClose() {
|
|
|
+ if (res.code !== 1000) return;
|
|
|
+ if (location.replace) location.replace('https://home.sxtvs.net/');
|
|
|
+ else location.href = 'https://home.sxtvs.net/';
|
|
|
+ },
|
|
|
+ });
|
|
|
+ search.list = res.data.checklist || [];
|
|
|
+ search.list1 = [];
|
|
|
+ search.list2 = [];
|
|
|
+ rawText.value = res.data.rawText || '';
|
|
|
+ nextTick(() => {
|
|
|
+ const tabs = [
|
|
|
+ {
|
|
|
+ num: 0,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ for (let i = 0; i < search.list.length; i++) {
|
|
|
+ const item = search.list[i];
|
|
|
+ const ele = document.querySelector(
|
|
|
+ "[data-umpos='" + item.colorPosition + "']"
|
|
|
+ );
|
|
|
+ ele.style.borderBottom =
|
|
|
+ '3px solid rgb(' + errType[item.um_error_level] + ')';
|
|
|
+ if (!tabs[item.um_error_level])
|
|
|
+ tabs[item.um_error_level] = {
|
|
|
+ num: 0,
|
|
|
+ };
|
|
|
+ tabs[0].num += 1;
|
|
|
+ tabs[item.um_error_level].num += 1;
|
|
|
+ if (i !== 0) continue;
|
|
|
+ ele.style.backgroundColor =
|
|
|
+ 'rgba(' + errType[item.um_error_level] + ',0.5)';
|
|
|
+ }
|
|
|
+ search.tabs = tabs;
|
|
|
+ });
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+function geturl() {
|
|
|
+ const searchText = location.hash.split('?')[1] || '';
|
|
|
+ let search = searchText.replace('?', '').split('&');
|
|
|
+ let obj = {};
|
|
|
+ for (let i = 0; i < search.length; i++) {
|
|
|
+ const v = search[i].split('=');
|
|
|
+ obj[v[0]] = v[1] || '';
|
|
|
+ }
|
|
|
+ return obj;
|
|
|
+}
|
|
|
+
|
|
|
+function changeTab(i) {
|
|
|
+ tabSelect[i] = !tabSelect[i];
|
|
|
+}
|
|
|
+
|
|
|
+function changeTabAll() {
|
|
|
+ let t = tabSelect.filter(v => !v).length ? true : false;
|
|
|
+ for (let i = 0; i < tabSelect.length; i++) {
|
|
|
+ tabSelect[i] = t;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 导出word
|
|
|
+function exportFun() {
|
|
|
+ /**
|
|
|
+ * wps: kswps
|
|
|
+ * docx: msword
|
|
|
+ */
|
|
|
+ let blob = new Blob([`<body>${rawText.value}</body>`], {
|
|
|
+ type: 'application/kswps',
|
|
|
+ });
|
|
|
+ let url = URL.createObjectURL(blob);
|
|
|
+ let link = document.createElement('a');
|
|
|
+ link.setAttribute('href', url);
|
|
|
+ link.setAttribute('download', `智能校对.docx`);
|
|
|
+ link.click();
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.onlineTextMain {
|
|
|
+ padding: 1em;
|
|
|
+ display: flex;
|
|
|
+}
|
|
|
+
|
|
|
+.onlineTextMain > div {
|
|
|
+ flex: 3;
|
|
|
+ margin-right: 0.5em;
|
|
|
+ border: 1px solid #eee;
|
|
|
+ height: calc(100vh - 106px);
|
|
|
+}
|
|
|
+.onlineTextMain .flex2 {
|
|
|
+ flex: 2;
|
|
|
+}
|
|
|
+.onlineTextMain > div:last-child {
|
|
|
+ margin-right: 0;
|
|
|
+}
|
|
|
+.btn-grounp {
|
|
|
+ color: #666;
|
|
|
+ background-color: #f9fafc;
|
|
|
+ line-height: 2.52em;
|
|
|
+ padding-left: 0.5em;
|
|
|
+ border-bottom: 1px solid #eee;
|
|
|
+}
|
|
|
+.search {
|
|
|
+ padding: 1em;
|
|
|
+ font-size: 12px;
|
|
|
+ height: calc(100% - 172px);
|
|
|
+ overflow: auto;
|
|
|
+}
|
|
|
+.searchEnd {
|
|
|
+ border: 1px solid;
|
|
|
+ border-top: 4px solid;
|
|
|
+ margin-bottom: 1em;
|
|
|
+ padding: 5px 35px;
|
|
|
+ font-size: 14px;
|
|
|
+ line-height: 1.5em;
|
|
|
+}
|
|
|
+.btn {
|
|
|
+ display: inline-block;
|
|
|
+ background: rgba(41, 116, 255, 0.1);
|
|
|
+ color: #2974ff;
|
|
|
+ padding: 3px 15px;
|
|
|
+ height: 1.5em;
|
|
|
+ line-height: 1.5em;
|
|
|
+ margin-left: 0.3em;
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
+
|
|
|
+.flex1 {
|
|
|
+ line-height: 1.5em;
|
|
|
+ min-height: 1.5em;
|
|
|
+}
|
|
|
+.flex1 span {
|
|
|
+ display: inline-block;
|
|
|
+}
|
|
|
+.tabs {
|
|
|
+ display: flex;
|
|
|
+ margin: 0.5em 0;
|
|
|
+}
|
|
|
+.tab {
|
|
|
+ flex: 1;
|
|
|
+ margin-left: 0.3em;
|
|
|
+ border-radius: 2px;
|
|
|
+ background-color: rgba(144, 144, 144, 0.1);
|
|
|
+ color: #909090;
|
|
|
+ line-height: 1.6em;
|
|
|
+ padding: 3px 15px;
|
|
|
+ text-align: center;
|
|
|
+ font-size: 12px;
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
+
|
|
|
+.Fle {
|
|
|
+ height: calc(100vh-226px);
|
|
|
+}
|
|
|
+.tab p {
|
|
|
+ white-space: nowrap;
|
|
|
+}
|
|
|
+.clearError {
|
|
|
+ float: right;
|
|
|
+}
|
|
|
+</style>
|
|
|
+
|
|
|
+<style>
|
|
|
+.edito .el-popper.is-light,
|
|
|
+.edito .el-popper .el-popper__arrow::before {
|
|
|
+ background-color: #2974ff !important;
|
|
|
+ color: #fff;
|
|
|
+ border-color: #2974ff !important;
|
|
|
+}
|
|
|
+.edito {
|
|
|
+ min-width: 1280px;
|
|
|
+ margin: 0 auto;
|
|
|
+}
|
|
|
+.example-showcase .el-loading-mask {
|
|
|
+ z-index: 9;
|
|
|
+}
|
|
|
+</style>
|