feat:修改重新报名

This commit is contained in:
lixg
2023-03-09 11:56:33 +08:00
parent 4c99334e3c
commit daa85bad28
10 changed files with 79 additions and 48 deletions

View File

@@ -83,7 +83,15 @@
</template>
<script setup>
import { computed, onUnmounted, reactive, ref, toRefs, watch } from "vue";
import {
computed,
onUnmounted,
onBeforeUnmount,
reactive,
ref,
toRefs,
watch,
} from "vue";
import { request, useRequest } from "@/api/request";
import {
TASK_WORK_COMMIT,
@@ -114,6 +122,14 @@ const returnclick = () => {
const {
query: { courseId: workId, type, id: taskId, infoId },
} = useRoute();
// 从报错信息来看 是因为内部 把这个组件看成了个异步组件 中间有代码是异步执行的 导致unmounted执行的时机不对。。放上面就好了
onBeforeUnmount(() => {
console.log("清除定时器");
if (timer) {
clearInterval(timer);
timer = null;
}
});
// console.log("type", type);
const loading = ref(false); // loading
const openLoading = () => {
@@ -127,6 +143,7 @@ openLoading();
const closeLoading = () => {
loading.value.close();
};
const { data } =
taskId && taskId !== "undefined"
? useRequest(TASK_WORK_DETAIL, { workId, taskId, type }, (e) => {
@@ -179,9 +196,6 @@ let timer = setInterval(() => {
}
}
}, 1000);
onUnmounted(() => {
clearInterval(timer);
});
const { data: submitList } = useRequest(TASK_WORK_SUBMIT_LIST, {
workerId: workId,