feat:修改学习路径图状态

This commit is contained in:
lixg
2022-12-16 18:20:04 +08:00
parent 7b7fe8568d
commit bc6eac5caf
3 changed files with 242 additions and 225 deletions

View File

@@ -15,38 +15,40 @@
<div class="title">
<div class="titleL">{{ i.chapterName }}</div>
<div class="titleR" :style="{ display: 'flex' }">
<img src="../../assets/image/pathdetails/circle.png"/>
<img src="../../assets/image/pathdetails/circle.png" />
<div class="titleRT">进行中</div>
</div>
<div
class="titleR"
:style="{ display: i.status === 2 ? 'flex' : 'none' }"
class="titleR"
:style="{ display: i.status === 2 ? 'flex' : 'none' }"
>
<img src="../../assets/image/pathdetails/circle2.png"/>
<img src="../../assets/image/pathdetails/circle2.png" />
<div class="titleRT" style="color: rgba(102, 102, 102, 1)">
未开始
</div>
</div>
</div>
<div
class="course"
v-for="(value, index) in i.taskProcessList.filter(e=>!whiteTypes(e.type))"
:key="index"
class="course"
v-for="(value, index) in i.taskProcessList.filter(
(e) => !whiteTypes(e.type)
)"
:key="index"
>
<div>
<div class="coursename">{{ value.name }}</div>
<div class="coursetag">
<div
class="tag1"
style="margin-right: 11px; margin-top: 16px"
v-if="value.flag"
class="tag1"
style="margin-right: 11px; margin-top: 16px"
v-if="value.flag"
>
必修
</div>
<div
class="tag2"
style="margin-right: 11px; margin-top: 16px"
v-if="!value.flag"
class="tag2"
style="margin-right: 11px; margin-top: 16px"
v-if="!value.flag"
>
选修
</div>
@@ -64,17 +66,17 @@
<!-- </div>-->
</div>
<div
class="progressBox"
:style="{ display: value.status === 1 ? 'block' : 'none' }"
class="progressBox"
:style="{ display: value.status === 1 ? 'block' : 'none' }"
>
<div>当前进度</div>
<div class="progress">
<div style="width: 291px">
<el-progress
:percentage="value.currentRatio"
:show-text="false"
:stroke-width="8"
:color="
:percentage="value.currentRatio"
:show-text="false"
:stroke-width="8"
:color="
{
0: 'rgba(238, 112, 108, 1)',
1: 'rgba(255, 151, 38, 1)',
@@ -87,13 +89,13 @@
/>
</div>
<div
style="
style="
font-size: 14px;
font-weight: 500;
color: #277aff;
margin-left: 10px;
"
:style="{
:style="{
color: {
0: 'rgba(238, 112, 108, 1)',
1: 'rgba(255, 151, 38, 1)',
@@ -110,18 +112,18 @@
</div>
</div>
<div
class="goclass"
:style="{
class="goclass"
:style="{
background: `${types.path[value.type] ? '#2478ff' : '#999'}`,
}"
@click="toFinish(value,i.chapterName)"
@click="toFinish(value, i.chapterName)"
>
{{
value.status === 1
? "已完成"
: types.path[value.type]
? types.toName[value.type]
: "未开放"
? "已完成"
: types.path[value.type]
? types.toName[value.type]
: "未开放"
}}
</div>
<!-- <div :style="{ display: value.status === 1 ? 'block' : 'none' }">-->
@@ -149,7 +151,7 @@
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="课程公告" name="first">
<div class="notice">
{{ data.remark || '暂无公告' }}
{{ data.remark || "暂无公告" }}
</div>
</el-tab-pane>
<el-tab-pane label="共享文档" name="second">
@@ -183,18 +185,18 @@
<div class="info">
<div class="title">
<img
style="width: 21px; height: 20px"
src="../../assets/image/pathdetails/info.png"
style="width: 21px; height: 20px"
src="../../assets/image/pathdetails/info.png"
/>
<div class="text" style="margin-left: 7px">个人信息</div>
<div class="box"></div>
</div>
<!-- todo #路径详情 个人信息缺少img和介绍-->
<div
class="teacheritem"
:style="{ 'border-bottom': '1px solid rgba(56, 125, 247, 0.2)' }"
class="teacheritem"
:style="{ 'border-bottom': '1px solid rgba(56, 125, 247, 0.2)' }"
>
<img class="peopleimg" :src="`/upload${userInfo.avatar}`"/>
<img class="peopleimg" :src="`/upload${userInfo.avatar}`" />
<div style="margin-left: 17px">
<div class="teacherName">
<div style="margin-right: 5px">
@@ -211,14 +213,14 @@
<div class="info" style="padding-top: 20px">
<div class="title">
<img
style="width: 18px; height: 17px"
src="../../assets/image/pathdetails/study.png"
style="width: 18px; height: 17px"
src="../../assets/image/pathdetails/study.png"
/>
<div class="text" style="margin-left: 9px">学习进度</div>
<div class="box"></div>
</div>
<div class="rate">
<div class="ratetext">上次学到启航班-领导寄语</div>
<div class="ratetext">上次学到:{{ data.lastLearned }}</div>
<div class="ratebtn">继续学习</div>
</div>
<div style="margin-top: 16px">
@@ -227,14 +229,10 @@
<div class="progress">
<div style="width: 291px">
<el-progress
:percentage="
parseInt(
(data.currentChapterCnt / data.totalChapterCnt) * 100
)
"
:show-text="false"
:stroke-width="8"
:color="
:percentage="parseInt(data.totalProgress * 100)"
:show-text="false"
:stroke-width="8"
:color="
{
0: 'rgba(238, 112, 108, 1)',
1: 'rgba(255, 151, 38, 1)',
@@ -242,17 +240,13 @@
3: 'rgba(59, 94, 251, 1)',
4: 'rgba(57, 219, 183, 1)',
5: 'rgba(57, 219, 183, 1)',
}[
parseInt(
data.currentChapterCnt / data.totalChapterCnt
)
]
}[parseInt(data.totalProgress)]
"
/>
</div>
<div
style="font-size: 14px; font-weight: 500; margin-left: 10px"
:style="{
style="font-size: 14px; font-weight: 500; margin-left: 10px"
:style="{
color: {
0: 'rgba(238, 112, 108, 1)',
1: 'rgba(255, 151, 38, 1)',
@@ -260,16 +254,10 @@
3: 'rgba(59, 94, 251, 1)',
4: 'rgba(57, 219, 183, 1)',
5: 'rgba(57, 219, 183, 1)',
}[
parseInt(data.currentChapterCnt / data.totalChapterCnt)
],
}[parseInt(data.totalProgress)],
}"
>
{{
parseInt(
(data.currentChapterCnt / data.totalChapterCnt) * 100
)
}}%
{{ parseInt(data.totalProgress * 100) }}%
</div>
</div>
</div>
@@ -280,12 +268,10 @@
<div class="progress">
<div style="width: 291px">
<el-progress
:percentage="
parseInt((data.currentReqCnt / data.totalReqCnt) * 100)
"
:show-text="false"
:stroke-width="8"
:color="
:percentage="parseInt(data.compulsoryProgress * 100)"
:show-text="false"
:stroke-width="8"
:color="
{
0: 'rgba(238, 112, 108, 1)',
1: 'rgba(255, 151, 38, 1)',
@@ -293,18 +279,18 @@
3: 'rgba(59, 94, 251, 1)',
4: 'rgba(57, 219, 183, 1)',
5: 'rgba(57, 219, 183, 1)',
}[parseInt(data.currentReqCnt / data.totalReqCnt)]
}[parseInt(data.compulsoryProgress)]
"
/>
</div>
<div
style="
style="
font-size: 14px;
font-weight: 500;
color: #277aff;
margin-left: 10px;
"
:style="{
:style="{
color: {
0: 'rgba(238, 112, 108, 1)',
1: 'rgba(255, 151, 38, 1)',
@@ -312,12 +298,10 @@
3: 'rgba(59, 94, 251, 1)',
4: 'rgba(57, 219, 183, 1)',
5: 'rgba(57, 219, 183, 1)',
}[parseInt(data.currentReqCnt / data.totalReqCnt)],
}[parseInt(data.compulsoryProgress)],
}"
>
{{
parseInt((data.currentReqCnt / data.totalReqCnt) * 100)
}}%
{{ parseInt(data.compulsoryProgress * 100) }}%
</div>
</div>
</div>
@@ -332,7 +316,7 @@
</template>
<script setup>
import {computed, reactive, ref, watch} from "vue";
import { computed, reactive, ref, watch } from "vue";
import word from "@/assets/image/file/word.png";
import ppt from "@/assets/image/file/ppt.png";
import pdf from "@/assets/image/file/pdf.png";
@@ -342,27 +326,27 @@ import medal1 from "@/assets/image/medal/medal1.png";
import medal2 from "@/assets/image/medal/medal2.png";
import medal3 from "@/assets/image/medal/medal3.png";
import img from "@/assets/image/uploadimg.png";
import {boeRequest, useRequest, request} from "@/api/request";
import {ROUTER_PROCESS, LINK_DETAILS} from "@/api/api";
import {useRoute, useRouter} from "vue-router";
import {ElMessage} from "element-plus";
import {useUserInfo} from "@/api/utils";
import { boeRequest, useRequest, request } from "@/api/request";
import { ROUTER_PROCESS, LINK_DETAILS } from "@/api/api";
import { useRoute, useRouter } from "vue-router";
import { ElMessage } from "element-plus";
import { useUserInfo } from "@/api/utils";
import store from "@/store";
const {
query: {routerId, routerName},
query: { routerId, routerName },
} = useRoute();
const router = useRouter();
const {data} = useRequest(ROUTER_PROCESS, {routerId});
const { data } = useRequest(ROUTER_PROCESS, { routerId });
console.log("ROUTER_PROCESS", data);
const userInfo = computed(() => store.state.userInfo);
console.log("userInfo", userInfo);
const activeName = ref("first");
const handleClick = (tab, event) => {
console.log(tab, event);
};
const path = {1: "path"};
const path = { 1: "path" };
const types = ref({
typeName: {
@@ -402,13 +386,18 @@ const types = ref({
4: "/homeworkpage",
5: import.meta.env.VITE_BOE_EXAM_DETAIL_URL, //考试
6: "/livebroadcast",
7: ({courseId}) => request(LINK_DETAILS(courseId), {}).then(({data: {linkAddress}}) => window.open(linkAddress)),//外联
7: ({ courseId }) =>
request(LINK_DETAILS(courseId), {}).then(({ data: { linkAddress } }) =>
window.open(linkAddress)
), //外联
8: "/discusspage",
9: "/moreactive",
10: ({
evaTyp,
targetId
}) => window.open((evaTyp === 1 ? import.meta.env.VITE_BOE_TEST_DETAIL_URL : import.meta.env.VITE_BOE_TEST_OUT_DETAIL_URL) + targetId), //测评
10: ({ evaTyp, targetId }) =>
window.open(
(evaTyp === 1
? import.meta.env.VITE_BOE_TEST_DETAIL_URL
: import.meta.env.VITE_BOE_TEST_OUT_DETAIL_URL) + targetId
), //测评
11: "/surveydetail",
12: "/ballotpage",
13: "/projectdetails",
@@ -421,19 +410,29 @@ function toFinish(d, sName) {
return;
}
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)
types.value.path[d.type] && types.value.path[d.type].startsWith("/") && router.push({
path: types.value.path[d.type],
query: {id: d.routerTaskId, type: 1, courseId: d.courseId, pName: data.value.name, sName},
})
} else if (typeof types.value.path[d.type] === 'function') {
types.value.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);
types.value.path[d.type] &&
types.value.path[d.type].startsWith("/") &&
router.push({
path: types.value.path[d.type],
query: {
id: d.routerTaskId,
type: 1,
courseId: d.courseId,
pName: data.value.name,
sName,
},
});
} else if (typeof types.value.path[d.type] === "function") {
types.value.path[d.type](d);
}
}
function whiteTypes(type) {
return import.meta.env.VITE_TASK_WHITE_TYPE.includes(type + '')
return import.meta.env.VITE_TASK_WHITE_TYPE.includes(type + "");
}
</script>