mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/student-h5.git
synced 2025-12-22 09:16:48 +08:00
feat:增加loading
This commit is contained in:
@@ -96,7 +96,7 @@ import { useRouter } from "vue-router";
|
||||
// import UploadImg from "@/components/img/UploadImg.vue";
|
||||
import FileTypeImg from "@/components/FileTypeImg.vue";
|
||||
import { useRoute } from "vue-router/dist/vue-router";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { ElMessage, ElLoading } from "element-plus";
|
||||
import ReturnHead from "@/components/ReturnHead.vue";
|
||||
const fileList = ref([]);
|
||||
// const fielPath = ref(import.meta.env.VITE_FILE_PATH);
|
||||
@@ -115,9 +115,22 @@ const {
|
||||
query: { courseId: workId, type, id: taskId, infoId },
|
||||
} = useRoute();
|
||||
// console.log("type", type);
|
||||
const loading = ref(false); // loading
|
||||
const openLoading = () => {
|
||||
loading.value = ElLoading.service({
|
||||
lock: true,
|
||||
text: "Loading",
|
||||
background: "rgba(0, 0, 0, 0.7)",
|
||||
});
|
||||
};
|
||||
openLoading();
|
||||
const closeLoading = () => {
|
||||
loading.value.close();
|
||||
};
|
||||
const { data } =
|
||||
taskId && taskId !== "undefined"
|
||||
? useRequest(TASK_WORK_DETAIL, { workId, taskId, type }, (e) => {
|
||||
closeLoading();
|
||||
if (e.code === 6) {
|
||||
console.log("作业判断", e);
|
||||
router.push({
|
||||
@@ -126,6 +139,7 @@ const { data } =
|
||||
}
|
||||
})
|
||||
: useRequest(TASK_WORK_DETAIL, { workId, type }, (e) => {
|
||||
closeLoading();
|
||||
if (e.code === 6) {
|
||||
console.log("作业判断", e);
|
||||
router.push({
|
||||
|
||||
Reference in New Issue
Block a user