优化
部署生产环境 / 发布版本 (push) Successful in 18s Details
部署生产环境 / 编译发布 (push) Failing after 3m29s Details

This commit is contained in:
yj 2024-06-11 16:31:04 +08:00
parent c384cb6934
commit 14a8bde1fe
3 changed files with 40 additions and 32 deletions

View File

@ -53,33 +53,7 @@ const activeNames = ref([
"otherPoint", "otherPoint",
]); ]);
const list = ref<any>([]); const list = ref<any>([]);
const getData = (data: any, templateInfo: any): void => { const getData = (data: any): void => {
//
let msg = "";
if (!templateInfo.headList[2].point.length && !templateInfo.tailsList[2].point.length) {
msg = "考号未框选!";
}
if (!templateInfo.headList[1].point.length && !templateInfo.tailsList[1].point.length) {
msg = "学科未框选!";
}
if (templateInfo.hasPosition) {
if (templateInfo.imgSrc.length === 2) {
if (
templateInfo.headList[0].point.length !== 4 ||
templateInfo.tailsList[0].point.length !== 4
) {
msg = "定位点未框选完成!";
}
} else {
if (templateInfo.headList[0].point.length !== 4) {
msg = "定位点未框选完成!";
}
}
}
if (msg) {
ElMessage.error(msg);
return;
}
// //
changeData(data); changeData(data);
// //

View File

@ -163,7 +163,11 @@
<el-button type="primary" size="large" @click="btnClick('save')" <el-button type="primary" size="large" @click="btnClick('save')"
> </el-button > </el-button
> >
<el-button type="primary" size="large" @click="btnClick('lock')" <el-button
type="primary"
size="large"
@click="btnClick('lock')"
:disabled="isLock"
> </el-button > </el-button
> >
</div> </div>
@ -503,7 +507,7 @@
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, reactive, ref, nextTick } from "vue"; import { onMounted, reactive, ref, nextTick, watch } from "vue";
import { fabric } from "fabric"; import { fabric } from "fabric";
import { createWorker } from "tesseract.js"; import { createWorker } from "tesseract.js";
import html2canvas from "html2canvas"; import html2canvas from "html2canvas";
@ -712,6 +716,7 @@ const templateInfo = reactive<any>({
questionList: [], questionList: [],
otherData: [], otherData: [],
}); });
const isLock = ref<boolean>(false);
// //
const ctx = ref<any>(null); const ctx = ref<any>(null);
const fabricGroup = ref<any>(null); const fabricGroup = ref<any>(null);
@ -747,7 +752,34 @@ onMounted(() => {
} }
}); });
}); });
watch(
() => templateInfo,
(_new, _old) => {
if (!_new.headList[2].point.length && !_new.tailsList[2].point.length) {
isLock.value = true;
return;
}
if (!_new.headList[1].point.length && !_new.tailsList[1].point.length) {
isLock.value = true;
return;
}
if (_new.hasPosition) {
if (_new.imgSrc.length === 2) {
if (_new.headList[0].point.length !== 4 || _new.tailsList[0].point.length !== 4) {
isLock.value = true;
return;
}
} else {
if (_new.headList[0].point.length !== 4) {
isLock.value = true;
return;
}
}
}
isLock.value = false;
},
{ deep: true }
);
// //
const initCanvas = (): void => { const initCanvas = (): void => {
imgDom.value = document.getElementById("picture-img"); imgDom.value = document.getElementById("picture-img");
@ -1311,6 +1343,7 @@ const boxSelectAfter = async (): Promise<void> => {
lock: true, lock: true,
text: `识别中...`, text: `识别中...`,
background: "rgba(0, 0, 0, 0.7)", background: "rgba(0, 0, 0, 0.7)",
body: true,
}); });
const canvas = await html2canvas(imgDom.value, { const canvas = await html2canvas(imgDom.value, {
scale: 4, scale: 4,
@ -2714,7 +2747,7 @@ const btnClick = (str: string): void => {
if (str === "save") { if (str === "save") {
save(true); save(true);
} else { } else {
LockListRef.value.getData(data, templateInfo); LockListRef.value.getData(data);
} }
}; };

View File

@ -101,7 +101,8 @@ class Request {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
loading = ElLoading.service({ loading = ElLoading.service({
lock: true, lock: true,
background: 'rgba(255,255, 255, 0.3)', background: 'rgba(0,0, 0, 0.7)',
text: `加载中...`,
body: true body: true
}) })
if (config.interceptors?.requestInterceptors) { if (config.interceptors?.requestInterceptors) {