mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/student-h5.git
synced 2025-12-10 11:26:48 +08:00
feat:修改重新报名
This commit is contained in:
@@ -27,7 +27,7 @@ import { GET_USER_INFO } from "@/api/ThirdApi";
|
|||||||
import { getCookie } from "@/api/utils";
|
import { getCookie } from "@/api/utils";
|
||||||
|
|
||||||
import { USER_INFO } from "@/api/api";
|
import { USER_INFO } from "@/api/api";
|
||||||
console.log("版本2.1.10------------");
|
console.log("版本2.1.11------------");
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ export function useRequest(_url, params = {}, callback) {
|
|||||||
const state = reactive({
|
const state = reactive({
|
||||||
data: {},
|
data: {},
|
||||||
loading: false,
|
loading: false,
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(params, () => {
|
watch(params, () => {
|
||||||
@@ -58,7 +57,7 @@ export function useRequest(_url, params = {}, callback) {
|
|||||||
request(_url, params).then(r => {
|
request(_url, params).then(r => {
|
||||||
state.data = r.data
|
state.data = r.data
|
||||||
state.loading = false
|
state.loading = false
|
||||||
callback(r)
|
callback?.(r)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @Author: lixg lixg@dongwu-inc.com
|
* @Author: lixg lixg@dongwu-inc.com
|
||||||
* @Date: 2023-01-18 14:40:26
|
* @Date: 2023-01-18 14:40:26
|
||||||
* @LastEditors: lixg lixg@dongwu-inc.com
|
* @LastEditors: lixg lixg@dongwu-inc.com
|
||||||
* @LastEditTime: 2023-02-19 16:37:15
|
* @LastEditTime: 2023-03-09 11:39:58
|
||||||
* @FilePath: /stu_h5/src/components/img/UploadImg.vue
|
* @FilePath: /stu_h5/src/components/img/UploadImg.vue
|
||||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||||
-->
|
-->
|
||||||
@@ -63,18 +63,31 @@ const closeLoading = () => {
|
|||||||
function handleChange(e) {
|
function handleChange(e) {
|
||||||
openLoading();
|
openLoading();
|
||||||
console.log("上传", e);
|
console.log("上传", e);
|
||||||
if (e.response && e.response.code === 200) {
|
if (
|
||||||
e.url = e.response.data;
|
e.raw.name.includes(".mp4") ||
|
||||||
|
e.raw.name.includes(".jpeg") ||
|
||||||
|
e.raw.name.includes(".JPEG")
|
||||||
|
) {
|
||||||
|
files.value = [];
|
||||||
|
emit("update:value", files.value);
|
||||||
|
ElMessage.error(`暂不支持此格式文件上传`);
|
||||||
|
closeLoading();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
if (e.response && e.response.code === 200) {
|
||||||
|
e.url = e.response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
const index = files.value.findIndex((f) => f.uid === e.uid);
|
||||||
|
if (index === -1) {
|
||||||
|
files.value.unshift(e);
|
||||||
|
} else {
|
||||||
|
files.value[index] = e;
|
||||||
|
}
|
||||||
|
emit("update:fileList", files.value);
|
||||||
|
files.value = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
const index = files.value.findIndex((f) => f.uid === e.uid);
|
|
||||||
if (index === -1) {
|
|
||||||
files.value.unshift(e);
|
|
||||||
} else {
|
|
||||||
files.value[index] = e;
|
|
||||||
}
|
|
||||||
emit("update:fileList", files.value);
|
|
||||||
files.value = [];
|
|
||||||
closeLoading();
|
closeLoading();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -165,7 +165,11 @@ const state = reactive({
|
|||||||
isAllowSign: false,
|
isAllowSign: false,
|
||||||
closeBtn: true,
|
closeBtn: true,
|
||||||
});
|
});
|
||||||
|
onUnmounted(() => {
|
||||||
|
if (timer) {
|
||||||
|
clearInterval(timer);
|
||||||
|
}
|
||||||
|
});
|
||||||
const { isAllowSign, closeBtn } = toRefs(state);
|
const { isAllowSign, closeBtn } = toRefs(state);
|
||||||
|
|
||||||
const { data } = useRequest(ACTIVITY, { activityId, type }, (e) => {
|
const { data } = useRequest(ACTIVITY, { activityId, type }, (e) => {
|
||||||
@@ -240,11 +244,6 @@ function isSignClick() {
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
isSignClick();
|
isSignClick();
|
||||||
onUnmounted(() => {
|
|
||||||
if (timer) {
|
|
||||||
clearInterval(timer);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//是否显示头部公告
|
//是否显示头部公告
|
||||||
const isShowClose = () => {
|
const isShowClose = () => {
|
||||||
|
|||||||
@@ -190,6 +190,12 @@ const router = useRouter();
|
|||||||
const {
|
const {
|
||||||
query: { courseId, chapterOrStageId, infoId, id, btype, type },
|
query: { courseId, chapterOrStageId, infoId, id, btype, type },
|
||||||
} = useRoute();
|
} = useRoute();
|
||||||
|
onUnmounted(() => {
|
||||||
|
if (timer) {
|
||||||
|
clearInterval(timer);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const userInfo = computed(() => store.state.userInfo);
|
const userInfo = computed(() => store.state.userInfo);
|
||||||
const { data } = useRequest(VOTE_DETAIL3, { voteId: courseId, type }, (e) => {
|
const { data } = useRequest(VOTE_DETAIL3, { voteId: courseId, type }, (e) => {
|
||||||
if (e.code === 6) {
|
if (e.code === 6) {
|
||||||
@@ -229,9 +235,6 @@ let timer = setInterval(() => {
|
|||||||
clearInterval(timer);
|
clearInterval(timer);
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
onUnmounted(() => {
|
|
||||||
clearInterval(timer);
|
|
||||||
});
|
|
||||||
|
|
||||||
// 答题时间
|
// 答题时间
|
||||||
const answerTime = dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss");
|
const answerTime = dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
|||||||
@@ -96,6 +96,11 @@ const {
|
|||||||
},
|
},
|
||||||
} = useRoute();
|
} = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
onUnmounted(() => {
|
||||||
|
if (timer) {
|
||||||
|
clearInterval(timer);
|
||||||
|
}
|
||||||
|
});
|
||||||
const { data } = useRequest(EVALUATION_DETAIL, { evaluationId, type }, (e) => {
|
const { data } = useRequest(EVALUATION_DETAIL, { evaluationId, type }, (e) => {
|
||||||
if (e.code === 6) {
|
if (e.code === 6) {
|
||||||
router.push({
|
router.push({
|
||||||
@@ -130,9 +135,7 @@ let timer = setInterval(() => {
|
|||||||
clearInterval(timer);
|
clearInterval(timer);
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
onUnmounted(() => {
|
|
||||||
clearInterval(timer);
|
|
||||||
});
|
|
||||||
const goOuterChain = () => {
|
const goOuterChain = () => {
|
||||||
console.log("点击去查看");
|
console.log("点击去查看");
|
||||||
if (quizTaskId == null) {
|
if (quizTaskId == null) {
|
||||||
|
|||||||
@@ -400,7 +400,11 @@ const returnclick = () => {
|
|||||||
const {
|
const {
|
||||||
query: { courseId, type, id: taskId, projectStatus, projectEndTime },
|
query: { courseId, type, id: taskId, projectStatus, projectEndTime },
|
||||||
} = useRoute();
|
} = useRoute();
|
||||||
|
onUnmounted(() => {
|
||||||
|
if (timer) {
|
||||||
|
clearInterval(timer);
|
||||||
|
}
|
||||||
|
});
|
||||||
const { data } = useRequest(STU_OFFCOURSE_DETAIL, { courseId });
|
const { data } = useRequest(STU_OFFCOURSE_DETAIL, { courseId });
|
||||||
console.log("datadatadatadatadatadatadata", data);
|
console.log("datadatadatadatadatadatadata", data);
|
||||||
// console.log("项目状态字段传递", projectStatus, projectEndTime);
|
// console.log("项目状态字段传递", projectStatus, projectEndTime);
|
||||||
@@ -606,12 +610,6 @@ function toExamItem(obj) {
|
|||||||
|
|
||||||
// router.push({ path: import.meta.env.VITE_BOE_EXAM_DETAIL_URL+ obj.examinationTestId });
|
// router.push({ path: import.meta.env.VITE_BOE_EXAM_DETAIL_URL+ obj.examinationTestId });
|
||||||
}
|
}
|
||||||
|
|
||||||
onUnmounted(() => {
|
|
||||||
if (timer) {
|
|
||||||
clearInterval(timer);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
<botton
|
<botton
|
||||||
class="titlebtn"
|
class="titlebtn"
|
||||||
v-if="data.planDto?.applyFlag"
|
v-if="data.planDto?.applyFlag"
|
||||||
@click="onLineSignUp"
|
@click="onLineSignUp(false)"
|
||||||
:style="{
|
:style="{
|
||||||
background: isAllowSign
|
background: isAllowSign
|
||||||
? data.isSignUp || data.isRefused
|
? data.isSignUp || data.isRefused
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
}}
|
}}
|
||||||
</botton>
|
</botton>
|
||||||
<botton
|
<botton
|
||||||
v-if="data.isRefused"
|
v-if="data.isRefused && !data.isSignUpAgain"
|
||||||
class="titlebtn"
|
class="titlebtn"
|
||||||
style="background: rgb(57, 146, 249)"
|
style="background: rgb(57, 146, 249)"
|
||||||
@click="onLineSignUp(true)"
|
@click="onLineSignUp(true)"
|
||||||
@@ -260,18 +260,21 @@ watch(data, () => {
|
|||||||
isSignClick();
|
isSignClick();
|
||||||
});
|
});
|
||||||
// 报名
|
// 报名
|
||||||
function onLineSignUp() {
|
function onLineSignUp(isAgain) {
|
||||||
if (!state.isAllowSign) {
|
if (!state.isAllowSign) {
|
||||||
// console.log("data.signFlag", data.value.signFlag, isAllowSign);
|
// console.log("data.signFlag", data.value.signFlag, isAllowSign);
|
||||||
ElMessage.warning("未在允许报名时间范围内");
|
ElMessage.warning("未在允许报名时间范围内");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (data.value.isSignUp && data.value.isSignUp) {
|
if (data.value.isSignUp && !isAgain) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
request(FACETEACH_SIGNUP, { courseId });
|
request(FACETEACH_SIGNUP, { courseId });
|
||||||
data.value.isSignUp = true;
|
data.value.isSignUp = true;
|
||||||
ElMessage.success("报名成功");
|
//重置按钮
|
||||||
|
data.value.isSignUpAgain = isAgain;
|
||||||
|
data.value.isRefused = false;
|
||||||
|
ElMessage.success(isAgain ? "重新报名成功" : "报名成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
function formateArr(strs) {
|
function formateArr(strs) {
|
||||||
|
|||||||
@@ -83,7 +83,15 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<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 { request, useRequest } from "@/api/request";
|
||||||
import {
|
import {
|
||||||
TASK_WORK_COMMIT,
|
TASK_WORK_COMMIT,
|
||||||
@@ -114,6 +122,14 @@ const returnclick = () => {
|
|||||||
const {
|
const {
|
||||||
query: { courseId: workId, type, id: taskId, infoId },
|
query: { courseId: workId, type, id: taskId, infoId },
|
||||||
} = useRoute();
|
} = useRoute();
|
||||||
|
// 从报错信息来看 是因为内部 把这个组件看成了个异步组件 中间有代码是异步执行的 导致unmounted执行的时机不对。。放上面就好了
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
console.log("清除定时器");
|
||||||
|
if (timer) {
|
||||||
|
clearInterval(timer);
|
||||||
|
timer = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
// console.log("type", type);
|
// console.log("type", type);
|
||||||
const loading = ref(false); // loading
|
const loading = ref(false); // loading
|
||||||
const openLoading = () => {
|
const openLoading = () => {
|
||||||
@@ -127,6 +143,7 @@ openLoading();
|
|||||||
const closeLoading = () => {
|
const closeLoading = () => {
|
||||||
loading.value.close();
|
loading.value.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
const { data } =
|
const { data } =
|
||||||
taskId && taskId !== "undefined"
|
taskId && taskId !== "undefined"
|
||||||
? useRequest(TASK_WORK_DETAIL, { workId, taskId, type }, (e) => {
|
? useRequest(TASK_WORK_DETAIL, { workId, taskId, type }, (e) => {
|
||||||
@@ -179,9 +196,6 @@ let timer = setInterval(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
onUnmounted(() => {
|
|
||||||
clearInterval(timer);
|
|
||||||
});
|
|
||||||
|
|
||||||
const { data: submitList } = useRequest(TASK_WORK_SUBMIT_LIST, {
|
const { data: submitList } = useRequest(TASK_WORK_SUBMIT_LIST, {
|
||||||
workerId: workId,
|
workerId: workId,
|
||||||
|
|||||||
@@ -221,7 +221,11 @@ const router = useRouter();
|
|||||||
const returnclick = () => {
|
const returnclick = () => {
|
||||||
router.back();
|
router.back();
|
||||||
};
|
};
|
||||||
|
onUnmounted(() => {
|
||||||
|
if (timer) {
|
||||||
|
clearInterval(timer);
|
||||||
|
}
|
||||||
|
});
|
||||||
const { data } = useRequest(TASK_BROADCAST_DETAIL, { liveId, type }, (e) => {
|
const { data } = useRequest(TASK_BROADCAST_DETAIL, { liveId, type }, (e) => {
|
||||||
console.log("直播判断", e);
|
console.log("直播判断", e);
|
||||||
if (e.code === 6) {
|
if (e.code === 6) {
|
||||||
@@ -349,11 +353,6 @@ const closeBtn = ref(true);
|
|||||||
const isShowClose = () => {
|
const isShowClose = () => {
|
||||||
closeBtn.value = false;
|
closeBtn.value = false;
|
||||||
};
|
};
|
||||||
onUnmounted(() => {
|
|
||||||
if (timer) {
|
|
||||||
clearInterval(timer);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||||
|
|||||||
Reference in New Issue
Block a user