feat:修改版本

This commit is contained in:
lixg
2023-02-28 17:10:08 +08:00
parent 01b905af96
commit 59de81a021
10 changed files with 441 additions and 120 deletions

3
.env
View File

@@ -14,9 +14,10 @@ VITE_BOE_PATH_DETAIL_URL=//u-pre.boe.com/pc/forward?to=/student-h5
VITE_BOE_API_URL=https://u-pre.boe.com VITE_BOE_API_URL=https://u-pre.boe.com
VITE_TASK_WHITE_TYPE=-8-,-12-,-13- VITE_TASK_WHITE_TYPE=-22-
# boe域名 # boe域名
VITE_BOE_BASE_URL=//u-pre.boe.com VITE_BOE_BASE_URL=//u-pre.boe.com
#评论上传图片 #评论上传图片
VITE_IMG=/manageApi VITE_IMG=/manageApi
VITE_BASE_FILE_PATH=/fe-student-h5/upload VITE_BASE_FILE_PATH=/fe-student-h5/upload
VITE_FILE_PATH=/upload/

View File

@@ -12,7 +12,7 @@ VITE_BOE_PATH_DETAIL_URL=//u.boe.com/pc/forward?to=/student-h5
VITE_BOE_API_URL=https://u.boe.com VITE_BOE_API_URL=https://u.boe.com
VITE_TASK_WHITE_TYPE=-8-,-12-,-13- VITE_TASK_WHITE_TYPE=-22-
VITE_BOE_BASE_URL=//u.boe.com VITE_BOE_BASE_URL=//u.boe.com
VITE_IMG=/manageApi VITE_IMG=/manageApi

View File

@@ -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("版本1.2.10------------"); console.log("版本1.2.11------------");
const store = useStore(); const store = useStore();
const router = useRouter(); const router = useRouter();

View File

@@ -2,10 +2,57 @@
* @Author: lixg lixg@dongwu-inc.com * @Author: lixg lixg@dongwu-inc.com
* @Date: 2023-01-16 13:59:11 * @Date: 2023-01-16 13:59:11
* @LastEditors: lixg lixg@dongwu-inc.com * @LastEditors: lixg lixg@dongwu-inc.com
* @LastEditTime: 2023-01-16 13:59:17 * @LastEditTime: 2023-02-28 16:38:39
* @FilePath: /stu_h5/src/api/CONST.js * @FilePath: /stu_h5/src/api/CONST.js
* @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
*/ */
export const PROJECT = 1; export const PROJECT = 1;
export const ROUTER = 2; export const ROUTER = 2;
export const COURSE = 3; export const COURSE = 3;
export const TASK_TYPES = {
typeName: {
1: "在线",
2: "面授",
3: "案例",
4: "作业",
5: "考试",
6: "直播",
7: "外链",
8: "讨论",
9: "活动",
10: "测评",
11: "评估",
12: "投票",
13: "项目",
},
toName: {
1: "去上课",
2: "去上课",
3: "去阅读",
4: "去完成",
5: "去完成",
6: "去观看",
7: "去查看",
8: "去讨论",
9: "去签到",
10: "去完成",
11: "去完成",
12: "去投票",
13: "去完成",
},
path: {
1: ({ courseId }) => window.open(window.location.protocol + import.meta.env.VITE_BOE_ONLINE_CLASS_URL + courseId), //在线
2: ({ courseId }) => window.open(`${location.protocol}//${location.host}${import.meta.env.VITE_BASE_API}/stu/project/redirectDetail?courseId=${courseId}`, '_top'),
3: ({ courseId }) => window.open(window.location.protocol + import.meta.env.VITE_BOE_CASS_DETAIL_URL + courseId), //案例
4: "/homeworkpage",
5: ({ examType }) => examType === 2 ? '/externalexam' : (window.location.protocol + import.meta.env.VITE_BOE_EXAM_DETAIL_URL), //考试
6: "/liveboradcast",
7: '/outerchain', //外联
8: "/discusspage",
9: "/activitiespage",
10: "/evaluation", //测评
11: "/investigatpage",
12: "/ballotpage",
13: "/projectdetails",
},
}

View File

@@ -1,18 +1,98 @@
/*
* @Author: lixg lixg@dongwu-inc.com
* @Date: 2023-01-17 19:47:07
* @LastEditors: lixg lixg@dongwu-inc.com
* @LastEditTime: 2023-02-28 15:31:03
* @FilePath: /stu_h5/src/store/index.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { createStore } from 'vuex' import { createStore } from 'vuex'
import { PROJECT_PROCESS, ROUTER_PROCESS } from "@/api/api";
import { request } from "@/api/request";
import { TASK_TYPES } from "@/api/CONST";
export default createStore({ export default createStore({
state: { state: {
userInfo: {} userInfo: {},
projectInfo: {},
routerInfo: {}
}, },
getters: { getters: {
}, },
mutations: { mutations: {
SET_USER(state, userInfo) { SET_USER(state, userInfo) {
state.userInfo = userInfo state.userInfo = userInfo
}, },
SET_PROJECT_INFO(state, info) {
state.projectInfo = info
},
INIT_PROJECT_INFO(state) {
if (state.projectInfo.status === -1) {
state.projectInfo.stageProcessList.forEach((t) => {
t.statusName = '已结束';
t.taskProcessList?.forEach((s) => s.statusName = '已结束')
})
return
}
if (state.projectInfo.unlockMode === 1) {
state.projectInfo.stageProcessList.forEach((t) => {
t.statusName = '进行中'
t.taskProcessList?.forEach((s) => s.statusName = (s.status === 1) ? '已完成' : TASK_TYPES.toName[s.type])
t.taskProcessList?.every((s) => s.status === 1) && (t.statusName = '已完成')
})
return
}
state.projectInfo.stageProcessList?.some((t) => {
t.statusName = '已完成'
const stageState = t.taskProcessList?.some((s) => {
s.unlock = true
s.statusName = '已完成'
s.status !== 1 && (s.statusName = TASK_TYPES.toName[s.type])
return state.projectInfo.unlockMode === 2 ? s.status !== 1 : (s.status !== 1 && s.flag)
})
stageState && (t.statusName = '进行中');
return stageState
})
},
SET_ROUTER_INFO(state, info) {
state.routerInfo = info
},
INIT_ROUTER_INFO(state) {
// state.routerInfo.unlockMode 1自由模式 2闯关模式 3 闯关模式 必修 flag true
if (state.routerInfo.status === -1) {
state.routerInfo.statusName = '已结束'
state.routerInfo.taskBoList.forEach((t) => t.statusName = '已结束')
return
}
state.routerInfo.statusName = '进行中'
if (state.routerInfo.unlockMode === 1) {
state.routerInfo.taskBoList?.forEach((s) => s.statusName = (s.status === 1) ? '已完成' : TASK_TYPES.toName[s.type])
state.routerInfo.taskBoList?.every((s) => s.status === 1) && (state.routerInfo.statusName = '已完成')
return
}
state.routerInfo.statusName = '已完成'
state.routerInfo.taskBoList?.some((s) => {
s.unlock = true
s.statusName = '已完成'
s.status !== 1 && (s.statusName = TASK_TYPES.toName[s.type])
return state.routerInfo.unlockMode === 2 ? s.status !== 1 : (s.status !== 1 && s.flag)
}) && (state.routerInfo.statusName = '进行中')
},
}, },
actions: { actions: {
}, getProjectInfo(content, { projectId }) {
modules: { request(PROJECT_PROCESS, { projectId }).then(res => {
} content.commit('SET_PROJECT_INFO', res.data)
content.commit('INIT_PROJECT_INFO')
})
},
getRouterInfo(content, { routerId }) {
request(ROUTER_PROCESS, { routerId }).then(res => {
content.commit('SET_ROUTER_INFO', res.data)
content.commit('INIT_ROUTER_INFO')
})
},
},
modules: {}
}) })

View File

@@ -128,7 +128,11 @@ editorConfig.MENU_CONF["uploadImage"] = {
closeLoading(); closeLoading();
if (res.data.code === 200) { if (res.data.code === 200) {
// 最后插入图片 url alt href // 最后插入图片 url alt href
insertFn(res.data.data, file.name, res.data.data); insertFn(
import.meta.env.VITE_FILE_PATH + res.data.data,
file.name,
import.meta.env.VITE_FILE_PATH + res.data.data
);
} }
}); });
}, },

View File

@@ -91,7 +91,7 @@
</div> </div>
<img <img
v-if="values.singleOptionPictureAddress" v-if="values.singleOptionPictureAddress"
:src="values.singleOptionPictureAddress" :src="fielPath + values.singleOptionPictureAddress"
style=" style="
width: 70px; width: 70px;
height: 70px; height: 70px;
@@ -108,7 +108,6 @@
<div <div
v-for="(values, indexs) in value.multipleChoiceVoList" v-for="(values, indexs) in value.multipleChoiceVoList"
:key="indexs" :key="indexs"
style="display: flex; align-items: center"
:style="{ 'margin-top': '22px' }" :style="{ 'margin-top': '22px' }"
@click=" @click="
() => { () => {
@@ -119,6 +118,7 @@
} }
" "
> >
<div style="display: flex; align-items: center">
<img <img
style="width: 14px; height: 14px" style="width: 14px; height: 14px"
:src="values.select ? checkbox : checkbox2" :src="values.select ? checkbox : checkbox2"
@@ -134,6 +134,21 @@
{{ values.multipleOptionName }} {{ values.multipleOptionName }}
</div> </div>
</div> </div>
<img
v-if="values.multipleOptionPictureAddress"
:src="
values.multipleOptionPictureAddress
? fielPath + values.multipleOptionPictureAddress
: ''
"
style="
width: 70px;
height: 70px;
margin-left: 20px;
margin-top: 10px;
"
/>
</div>
</div> </div>
</div> </div>
<div v-else-if="value.questionType == '3'"> <div v-else-if="value.questionType == '3'">
@@ -211,6 +226,7 @@ import { ASSESSMENT_QUERY, ASSESSMENT_SUBMIT } from "@/api/api";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import ReturnHead from "@/components/ReturnHead.vue"; import ReturnHead from "@/components/ReturnHead.vue";
import dayjs from "dayjs"; import dayjs from "dayjs";
const fielPath = ref(import.meta.env.VITE_FILE_PATH);
const { const {
query: { query: {
courseId, courseId,

View File

@@ -31,21 +31,24 @@
<div <div
class="circular" class="circular"
:style=" :style="
(stageStatusName === '未开始' || data.statusName === '已完成' || data.statusName === '进行中'
stageStatusName === '已结束') && ? 'border: 1px solid #0060ff'
'border: 1px solid #999;' : 'border: 1px solid #999'
" "
></div> ></div>
<!-- <div class="text9">进行中</div> --> <!-- <div class="text9">进行中</div> -->
<div <div
class="text9" class="text9"
:style=" :style="
(stageStatusName === '未开始' || data.statusName === '已完成' || data.statusName === '进行中'
stageStatusName === '已结束') && ? 'color:#0060ff'
'color:#999' : 'color:#999'
" "
> >
{{ stageStatusName }} {{
data.statusName ||
(data.unlockMode === 1 ? "未开始" : "未解锁")
}}
</div> </div>
<!-- <div class="btn1"></div> --> <!-- <div class="btn1"></div> -->
</div> </div>
@@ -53,14 +56,16 @@
<div class="secondcontent"> <div class="secondcontent">
<div <div
class="question" class="question"
v-for="(el, index) in data?.taskBoList" v-for="(el, index) in data?.taskBoList?.filter(
(e) => !whiteTypes(e.type)
)"
:key="index" :key="index"
:style="{ :style="{
height: el.type === 1 ? '90px' : '72px', height: el.type === 1 ? '90px' : '72px',
}" }"
> >
<div style="width: calc(100% - 80px)"> <div style="width: calc(100% - 80px)">
<div class="issue"> <div class="issue" :title="el.name">
{{ el.name }} {{ el.name }}
</div> </div>
<div v-if="el.type === 1" class="progressBox"> <div v-if="el.type === 1" class="progressBox">
@@ -128,23 +133,26 @@
选修 选修
</div> </div>
<div class="tag3" style="margin-right: 11px; margin-top: 3px"> <div class="tag3" style="margin-right: 11px; margin-top: 3px">
{{ types.typeName[el.type] || "" }} {{ TASK_TYPES.typeName[el.type] || "" }}
</div> </div>
</div> </div>
</div> </div>
<div <div
class="goclass" class="goclass"
:style="{ :style="{
background: `${types.path[el.type] ? '#2478ff' : '#999'}`, background:
el.statusName !== '已结束' &&
(el.statusName || data.unlockMode === 1)
? '#2478ff'
: '#999',
}" }"
@click="toFinish(el)" @click="toFinish(el)"
> >
{{ {{
el.status === 1 el.statusName ||
? "已完成" (data.unlockMode === 1
: types.path[el.type] ? TASK_TYPES.toName[el.type]
? types.toName[el.type] : "未解锁")
: "未开放"
}} }}
</div> </div>
</div> </div>
@@ -156,7 +164,7 @@
</template> </template>
<script setup> <script setup>
import { computed, reactive, ref, watch } from "vue"; import { computed, reactive, ref, watch, onMounted } from "vue";
// import circle from "../../assets/image/pathdetails/circle.png"; // import circle from "../../assets/image/pathdetails/circle.png";
// import circle2 from "../../assets/image/pathdetails/circle2.png"; // import circle2 from "../../assets/image/pathdetails/circle2.png";
import { boeRequest, useRequest, request } from "@/api/request"; import { boeRequest, useRequest, request } from "@/api/request";
@@ -170,8 +178,9 @@ import {
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import store from "@/store"; import store from "@/store";
import { ROUTER } from "@/api/CONST"; import { ROUTER, TASK_TYPES } from "@/api/CONST";
import ReturnHead from "@/components/ReturnHead.vue"; import ReturnHead from "@/components/ReturnHead.vue";
import { useStore } from "vuex";
const { const {
query: { routerId, routerName }, query: { routerId, routerName },
} = useRoute(); } = useRoute();
@@ -179,22 +188,12 @@ const router = useRouter();
const returnclick = () => { const returnclick = () => {
router.back(); router.back();
}; };
const { data } = useRequest(ROUTER_PROCESS, { routerId: routerId }); const { commit, dispatch, state } = useStore();
const stageStatusName = computed(() => { const data = computed(() => state.routerInfo);
if (data.value.status !== 1) { onMounted(() => {
return "已结束"; dispatch("getRouterInfo", { routerId });
}
if (!data.value.taskBoList?.filter((t) => t.status === 1)?.length) {
return "未开始";
}
if (
data.value.taskBoList.filter((t) => t.status === 1).length ===
data.value.taskBoList.length
) {
return "已完成";
}
return "进行中";
}); });
const userInfo = computed(() => store.state.userInfo); const userInfo = computed(() => store.state.userInfo);
console.log("lalalallala", data, userInfo); console.log("lalalallala", data, userInfo);
const activeName = ref("first"); const activeName = ref("first");
@@ -272,10 +271,63 @@ const types = ref({
}, },
}); });
// 判断当前任务已结束及时间意义上的结束 提示用户
function judgeTaskIsEnd(type, endTimes, status) {
// type 任务类型 endTime 结束时间 status 任务状态 (状态 0 未完成 1 已完成 2 未开始 -1 已结束)
console.log(type, endTimes, status);
let isEnd = false;
let nowTime = new Date().getTime();
let endTime = new Date().getTime(endTimes);
switch (type) {
case 1:
status == -1
? (isEnd = true)
: nowTime > endTime
? (isEnd = true)
: (isEnd = false);
break;
// case 3:
// status == 3 ? isEnd = true : nowTime > endTime ? isEnd = true : isEnd = false;
// break;
case 5:
status == -1
? (isEnd = true)
: nowTime > endTime
? (isEnd = true)
: (isEnd = false);
break;
case 7:
status == -1
? (isEnd = true)
: nowTime > endTime
? (isEnd = true)
: (isEnd = false);
break;
case 10:
status == -1
? (isEnd = true)
: nowTime > endTime
? (isEnd = true)
: (isEnd = false);
break;
}
return isEnd;
}
function toFinish(d) { function toFinish(d) {
console.log(d); console.log(d);
console.log(data.value.currentStageId, routerId); console.log(data.value.currentStageId, routerId);
if (!types.value.path[d.type]) { if (data.value.unlockMode !== 1 && !d.statusName) {
ElMessage.warning("当前未解锁");
return;
}
if (
data.value.endTime &&
judgeTaskIsEnd(d.type, data.value.endTime, data.value.status)
) {
ElMessage.error("当前任务已结束");
return;
}
if (!TASK_TYPES.path[d.type]) {
ElMessage.error("暂时未开放"); ElMessage.error("暂时未开放");
return; return;
} }
@@ -376,20 +428,15 @@ function toFinish(d) {
pid: routerId, pid: routerId,
name: d.name, name: d.name,
}); });
if (typeof types.value.path[d.type] === "string") { const path =
// console.log( typeof TASK_TYPES.path[d.type] === "string"
// "types.value.path[d.type]", ? TASK_TYPES.path[d.type]
// types.value.path[d.type], : TASK_TYPES.path[d.type](d);
// import.meta.env.VITE_BOE_EXAM_DETAIL_URL, path && path.startsWith("http")
// import.meta.env.VITE_BOE_ONLINE_CLASS_URL ? window.open(path + d.targetId, "_top")
// ); : path.startsWith("/")
types.value.path[d.type] && ? router.push({
types.value.path[d.type].startsWith("http") && path,
window.open(types.value.path[d.type] + d.targetId, "_top");
types.value.path[d.type] &&
types.value.path[d.type].startsWith("/") &&
router.push({
path: types.value.path[d.type],
query: { query: {
id: d.id, id: d.id,
type: ROUTER, type: ROUTER,
@@ -404,12 +451,45 @@ function toFinish(d) {
evaType: d.evaType, evaType: d.evaType,
btype: 2, btype: 2,
}, },
}); })
} else if (typeof types.value.path[d.type] === "function") { : "";
console.log("ddddddd", d); // if (typeof types.value.path[d.type] === "string") {
types.value.path[d.type](d); // // console.log(
// console.log("types.value.path[d.type](d)", d); // // "types.value.path[d.type]",
// // types.value.path[d.type],
// // import.meta.env.VITE_BOE_EXAM_DETAIL_URL,
// // import.meta.env.VITE_BOE_ONLINE_CLASS_URL
// // );
// types.value.path[d.type] &&
// types.value.path[d.type].startsWith("http") &&
// window.open(types.value.path[d.type] + d.targetId, "_top");
// types.value.path[d.type] &&
// types.value.path[d.type].startsWith("/") &&
// router.push({
// path: types.value.path[d.type],
// query: {
// id: d.id,
// type: ROUTER,
// infoId: routerId,
// courseId: d.courseId,
// pName: data.value.name,
// sName: data.value.currentStageName,
// chapterOrStageId: data.value.currentStageId,
// studentId: userInfo.value.id,
// status: d.status,
// targetId: d.targetId,
// evaType: d.evaType,
// btype: 2,
// },
// });
// } else if (typeof types.value.path[d.type] === "function") {
// console.log("ddddddd", d);
// types.value.path[d.type](d);
// // console.log("types.value.path[d.type](d)", d);
// }
} }
function whiteTypes(type) {
return import.meta.env.VITE_TASK_WHITE_TYPE.includes("-" + type + "-");
} }
</script> </script>

View File

@@ -2,7 +2,7 @@
* @Author: lixg lixg@dongwu-inc.com * @Author: lixg lixg@dongwu-inc.com
* @Date: 2023-01-19 11:28:11 * @Date: 2023-01-19 11:28:11
* @LastEditors: lixg lixg@dongwu-inc.com * @LastEditors: lixg lixg@dongwu-inc.com
* @LastEditTime: 2023-02-28 14:47:12 * @LastEditTime: 2023-02-28 16:40:49
* @FilePath: /stu_h5/src/views/projectdetails/ProjectPath.vue * @FilePath: /stu_h5/src/views/projectdetails/ProjectPath.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
--> -->
@@ -179,15 +179,15 @@ const handleClick = (tab, event) => {
console.log("selectTab", selectTab.value); console.log("selectTab", selectTab.value);
}; };
const goDetails = () => { const goDetails = () => {
// router.push({
// path: "/pathdetails",
// query: { routerId: 459 },
// });
router.push({ router.push({
path: "/projectdetails", path: "/pathdetails",
query: { projectId: 684 }, query: { routerId: 462 },
}); });
// router.push({ // router.push({
// path: "/projectdetails",
// query: { projectId: 684 },
// });
// router.push({
// path: "/faceteach", // path: "/faceteach",
// query: { type: 3, courseId: 290 }, // query: { type: 3, courseId: 290 },
// }); // });

View File

@@ -51,33 +51,90 @@
border: 2px solid #999; border: 2px solid #999;
" "
:style=" :style="
(item.stageStatusName === '未开始' || item.statusName === '已完成' || item.statusName === '进行中'
item.stageStatusName === '已结束') && ? 'border: 2px solid #0060ff'
'border: 1px solid #999;' : 'border: 1px solid #999;'
" "
></div> ></div>
<div <div
class="text9" class="text9"
:style=" :style="
(item.stageStatusName === '未开始' || item.statusName === '已完成' || item.statusName === '进行中'
item.stageStatusName === '已结束') && ? 'color:#0060ff'
'color:#999' : 'color:#999'
" "
> >
{{ item.stageStatusName }} {{
item.statusName ||
(data.unlockMode === 1 ? "未开始" : "未解锁")
}}
</div> </div>
</div> </div>
</div> </div>
<div class="secondcontent"> <div class="secondcontent">
<div <div
class="question" class="question"
v-for="(el, index) in item.taskProcessList" v-for="(el, index) in item.taskProcessList
.sort((a, b) => {
return a.id - b.id;
})
.filter((e) => !whiteTypes(e.type))"
:key="index" :key="index"
:style="{ height: el.type === 1 ? '90px' : '72px' }"
> >
<div style="width: calc(100% - 80px)"> <div style="width: calc(100% - 80px)">
<div class="issue"> <div class="issue" :title="el.name">
{{ el.name }} {{ el.name }}
</div> </div>
<div v-if="el.type === 1" class="progressBox">
<!-- <div>当前进度</div> -->
<div
class="progress"
style="
display: flex;
align-items: center;
margin-bottom: 3px;
"
>
<div style="width: 200px">
<el-progress
:percentage="parseInt(el.currentRatio)"
:show-text="false"
:stroke-width="8"
:color="
{
0: 'rgba(238, 112, 108, 1)',
1: 'rgba(255, 151, 38, 1)',
2: 'rgba(39, 122, 255, 1)',
3: 'rgba(59, 94, 251, 1)',
4: 'rgba(57, 219, 183, 1)',
5: 'rgba(57, 219, 183, 1)',
}[parseInt(parseInt(el.currentRatio) / 20)]
"
/>
</div>
<div
style="
font-size: 12px;
font-weight: 500;
color: #277aff;
margin-left: 10px;
"
:style="{
color: {
0: 'rgba(238, 112, 108, 1)',
1: 'rgba(255, 151, 38, 1)',
2: 'rgba(39, 122, 255, 1)',
3: 'rgba(59, 94, 251, 1)',
4: 'rgba(57, 219, 183, 1)',
5: 'rgba(57, 219, 183, 1)',
}[parseInt(parseInt(el.currentRatio) / 20)],
}"
>
{{ parseInt(el.currentRatio) }}%
</div>
</div>
</div>
<div class="coursetag"> <div class="coursetag">
<div <div
class="tag1" class="tag1"
@@ -97,23 +154,26 @@
class="tag3" class="tag3"
style="margin-right: 11px; margin-top: 3px" style="margin-right: 11px; margin-top: 3px"
> >
{{ types.typeName[el.type] || "" }} {{ TASK_TYPES.typeName[el.type] || "" }}
</div> </div>
</div> </div>
</div> </div>
<div <div
class="goclass" class="goclass"
:style="{
background: `${types.path[el.type] ? '#2478ff' : '#999'}`,
}"
@click="toFinish(el)" @click="toFinish(el)"
:style="{
background:
el.statusName !== '已结束' &&
(el.statusName || data.unlockMode === 1)
? '#2478ff'
: '#999',
}"
> >
{{ {{
el.status === 1 el.statusName ||
? "已完成" (data.unlockMode === 1
: types.path[el.type] ? TASK_TYPES.toName[el.type]
? types.toName[el.type] : "未解锁")
: "未开放"
}} }}
</div> </div>
</div> </div>
@@ -143,7 +203,7 @@
</template> </template>
<script setup> <script setup>
import { computed, reactive, ref, watch } from "vue"; import { computed, reactive, ref, watch, onMounted } from "vue";
import { ElLoading } from "element-plus"; import { ElLoading } from "element-plus";
import { useRequest, request } from "@/api/request"; import { useRequest, request } from "@/api/request";
import { import {
@@ -157,15 +217,18 @@ import { useRoute, useRouter } from "vue-router";
import store from "@/store"; import store from "@/store";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import ReturnHead from "@/components/ReturnHead.vue"; import ReturnHead from "@/components/ReturnHead.vue";
import { PROJECT } from "@/api/CONST"; import { PROJECT, TASK_TYPES } from "@/api/CONST";
import dayjs from "dayjs"; import dayjs from "dayjs";
import { useStore } from "vuex";
const { const {
query: { courseId, projectId }, query: { courseId, projectId },
} = useRoute(); } = useRoute();
const router = useRouter(); const router = useRouter();
const { commit, dispatch, state } = useStore();
const data = computed(() => state.projectInfo);
const { data } = useRequest(PROJECT_PROCESS, { onMounted(() => {
projectId: projectId || courseId, dispatch("getProjectInfo", { projectId });
}); });
watch( watch(
() => data.value.stageProcessList, () => data.value.stageProcessList,
@@ -334,6 +397,10 @@ function judgeTaskIsEnd(type, endTimes, status) {
} }
function toFinish(d, sName, chapterOrStageId) { function toFinish(d, sName, chapterOrStageId) {
if (data.value.unlockMode !== 1 && !d.statusName) {
ElMessage.warning("当前未解锁");
return;
}
console.log("dddddd", data, d, sName, chapterOrStageId); console.log("dddddd", data, d, sName, chapterOrStageId);
if (judgeTaskIsEnd(d.type, data.value.endTime, data.value.status)) { if (judgeTaskIsEnd(d.type, data.value.endTime, data.value.status)) {
@@ -430,7 +497,7 @@ function toFinish(d, sName, chapterOrStageId) {
} }
} }
if (!types.value.path[d.type]) { if (!TASK_TYPES.path[d.type]) {
ElMessage.error("暂时未开放"); ElMessage.error("暂时未开放");
return; return;
} }
@@ -438,18 +505,18 @@ function toFinish(d, sName, chapterOrStageId) {
//更新学员当前任务 //更新学员当前任务
request(UPDATE_CURRENT_TASK, { request(UPDATE_CURRENT_TASK, {
id: d.id, id: d.id,
type: ROUTER, type: PROJECT,
pid: routerId, pid: projectId,
name: d.name, name: d.name,
}); });
if (typeof types.value.path[d.type] === "string") { if (typeof TASK_TYPES.path[d.type] === "string") {
types.value.path[d.type] && TASK_TYPES.path[d.type] &&
types.value.path[d.type].startsWith("http") && TASK_TYPES.path[d.type].startsWith("http") &&
window.open(types.value.path[d.type] + d.targetId, "_top"); window.open(TASK_TYPES.path[d.type] + d.targetId, "_top");
types.value.path[d.type] && TASK_TYPES.path[d.type] &&
types.value.path[d.type].startsWith("/") && TASK_TYPES.path[d.type].startsWith("/") &&
router.push({ router.push({
path: types.value.path[d.type], path: TASK_TYPES.path[d.type],
query: { query: {
id: d.id, id: d.id,
type: PROJECT, type: PROJECT,
@@ -465,9 +532,35 @@ function toFinish(d, sName, chapterOrStageId) {
btype: 1, btype: 1,
}, },
}); });
} else if (typeof types.value.path[d.type] === "function") { } else if (typeof TASK_TYPES.path[d.type] === "function") {
types.value.path[d.type](d); TASK_TYPES.path[d.type](d);
} }
// if (typeof types.value.path[d.type] === "string") {
// types.value.path[d.type] &&
// types.value.path[d.type].startsWith("http") &&
// window.open(types.value.path[d.type] + d.targetId, "_top");
// types.value.path[d.type] &&
// types.value.path[d.type].startsWith("/") &&
// router.push({
// path: types.value.path[d.type],
// query: {
// id: d.id,
// type: PROJECT,
// infoId: data.value.projectId,
// courseId: d.courseId,
// pName: data.value.name,
// sName,
// chapterOrStageId: data.value.currentStageId,
// studentId: userInfo.value.id,
// status: d.status,
// targetId: d.targetId,
// evaType: d.evaType,
// btype: 1,
// },
// });
// } else if (typeof types.value.path[d.type] === "function") {
// types.value.path[d.type](d);
// }
} }
function whiteTypes(type) { function whiteTypes(type) {
return import.meta.env.VITE_TASK_WHITE_TYPE.includes("-" + type + "-"); return import.meta.env.VITE_TASK_WHITE_TYPE.includes("-" + type + "-");