|
@@ -3,7 +3,7 @@ import VueQrcode from "@chenfengyuan/vue-qrcode";
|
|
|
import draggable from "vuedraggable";
|
|
|
import "viewerjs/dist/viewer.css";
|
|
|
import Viewer from "viewerjs";
|
|
|
-import { watch } from "vue";
|
|
|
+import { watch, onBeforeUnmount } from "vue";
|
|
|
import { store } from "@/store/store";
|
|
|
import { Eye, TrashOutline, Checkmark } from "@vicons/ionicons5";
|
|
|
import { useHandGetAnswer } from "./setups/useWXSocket";
|
|
@@ -11,12 +11,29 @@ const { loading: handLoading, handler: handHandler } = useHandGetAnswer();
|
|
|
|
|
|
const examQuestion = $computed(() => store.exam.currentQuestion);
|
|
|
const examRecordDataId = store.exam.examRecordDataId;
|
|
|
+let timer: any = null;
|
|
|
+let freeze = $ref(0);
|
|
|
+
|
|
|
const handGetAnswer = () => {
|
|
|
+ freeze = 20;
|
|
|
+ timer = setInterval(() => {
|
|
|
+ freeze = freeze - 1;
|
|
|
+ if (freeze == 0) {
|
|
|
+ clearInterval(timer);
|
|
|
+ timer = null;
|
|
|
+ }
|
|
|
+ }, 1000);
|
|
|
handHandler({
|
|
|
examRecordDataId: examRecordDataId,
|
|
|
questionOrder: examQuestion.order,
|
|
|
});
|
|
|
};
|
|
|
+onBeforeUnmount(() => {
|
|
|
+ if (timer) {
|
|
|
+ clearInterval(timer);
|
|
|
+ timer = null;
|
|
|
+ }
|
|
|
+});
|
|
|
const props = defineProps<{
|
|
|
defaultList: string[];
|
|
|
qrValue: string;
|
|
@@ -31,7 +48,6 @@ const emit = defineEmits<{
|
|
|
}>();
|
|
|
|
|
|
let uploadList: string[] = $ref([]);
|
|
|
-
|
|
|
watch(
|
|
|
() => props.defaultList,
|
|
|
() => (uploadList = [...props.defaultList])
|
|
@@ -54,7 +70,14 @@ watch(
|
|
|
// } else {
|
|
|
// totalList.push(...[...new Set(value.fileUrl.split(","))]);
|
|
|
// }
|
|
|
- totalList.push(...[...new Set(value.fileUrl.split(","))]);
|
|
|
+
|
|
|
+ // totalList.push(...[...new Set(value.fileUrl.split(","))]);
|
|
|
+ let arr = [...new Set(value.fileUrl.split(","))];
|
|
|
+ for (let i = 0; i < arr.length; i++) {
|
|
|
+ if (!totalList.includes(arr[i])) {
|
|
|
+ totalList.push(arr[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
);
|
|
@@ -278,8 +301,9 @@ function prepareUpload() {
|
|
|
type="primary"
|
|
|
size="large"
|
|
|
:loading="handLoading"
|
|
|
+ :disabled="freeze > 0"
|
|
|
@click="handGetAnswer"
|
|
|
- >刷新</n-button
|
|
|
+ >{{ freeze > 0 ? `倒计时${freeze}s` : "刷新" }}</n-button
|
|
|
>
|
|
|
<span style="margin-left: 10px">同步拍照作答</span>
|
|
|
</div>
|