mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/student-h5.git
synced 2025-12-22 09:16:48 +08:00
feat:修改重新报名
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user