修改阶段状态

This commit is contained in:
yuping
2023-02-18 12:54:42 +08:00
parent 5dc9c0ef0d
commit e75e61d337
2 changed files with 1054 additions and 1016 deletions

View File

@@ -18,21 +18,11 @@
<div v-if="i.stageId == '0' && i.taskProcessList.length == 0"></div>
<div v-else class="title">
<div class="titleL">{{ i.stageName }}</div>
<!-- 当前任务已结束的时候显示下面 -->
<div v-if="i.status==3" class="titleR" :style="{ display: 'flex' }">
<div style="width:8px;height:8px;border-radius:8px;border:2px solid #999;"></div>
<div class="titleRT" style="color:#999;">已结束</div>
</div>
<!-- 未开始 -->
<div v-else-if="i.status==2" class="titleR" :style="{ display: 'flex' }">
<div style="width:8px;height:8px;border-radius:8px;border:2px solid #999;"></div>
<div class="titleRT" style="color:#999;">未开始</div>
</div>
<!-- 默认进行中状态 -->
<div v-else class="titleR" :style="{ display: 'flex' }">
<div class="titleR" :style="{ display: 'flex' }">
<img src="../../assets/image/pathdetails/circle.png"/>
<div class="titleRT">
{{ queryAllStatus(i.taskProcessList) ? '已完成' : '进行中' }}
<div class="titleRT"
:style="(i.stageStatusName === '未开始' || i.stageStatusName === '已结束') && 'color:#999'">
{{ i.stageStatusName }}
</div>
</div>
<!-- <div class="titleR" :style="{ display: i.status === 2 ? 'flex' : 'none' }">
@@ -149,7 +139,9 @@
align-items: center;
margin-bottom: 15px;">
<!-- <img :src="value.img" style="width: 22px; height: 26px"/> -->
<FileTypeImg :v-model="value.name? value.name : value.slice(value.lastIndexOf('/')+1,value.indexOf('-')) + value.slice(value.lastIndexOf('.'))" :style="{width: '22px',height: '26px'}"></FileTypeImg>
<FileTypeImg
:v-model="value.name? value.name : value.slice(value.lastIndexOf('/')+1,value.indexOf('-')) + value.slice(value.lastIndexOf('.'))"
:style="{width: '22px',height: '26px'}"></FileTypeImg>
<div class="sharedocname">{{ value.name }}</div>
<div class="download">
<img
@@ -253,12 +245,14 @@
<!-- 学员积分及个人完成度排行榜 -->
<div class="detailRB">
<div class="info">
<div style="display:flex;justify-content: space-between;align-items: center;height: 56px;padding-left: 27px;padding-right: 27px;">
<div
style="display:flex;justify-content: space-between;align-items: center;height: 56px;padding-left: 27px;padding-right: 27px;">
<div
@click="tabChange(1)"
style="font-size: 14px;color: rgba(51, 51, 51, 1);font-weight: 600;cursor: pointer;"
:style="{}"
>积分排行榜</div>
>积分排行榜
</div>
<!-- <div style="font-size: 14px;color: rgba(51, 51, 51, 1);font-weight: 600;">完成度排行榜</div> -->
<el-select
@change="choiceStatus"
@@ -279,24 +273,33 @@
<div style="display: flex;height: 1px;background-color: #ecf5ff;justify-content: space-between;">
<div v-if="tabValue==1" style="width:90px;height: 2px;background-color: #409EFF;margin-left: 18px;"></div>
<div v-else style="width:90px;height: 2px;background-color: rgba(0,0,0,0);margin-left: 18px;"></div>
<div v-if="tabValue!==1" style="width:146px;height: 2px;background-color: #409EFF;margin-right: 18px;"></div>
<div v-if="tabValue!==1"
style="width:146px;height: 2px;background-color: #409EFF;margin-right: 18px;"></div>
<div v-else style="width:146px;height: 2px;background-color: rgba(0,0,0,0);margin-right: 18px;"></div>
</div>
<!-- line -->
<div style="width: 100%;display: flex;flex-direction: column;height: 66px;justify-content: center;">
<div style="display: flex;justify-content: space-between;">
<div style="width:90px;margin-left: 50px;font-size: 14px;color: rgba(103, 125, 134, 1);">我的排名:{{ myIndex }}</div>
<div style="width:90px;margin-left: 50px;font-size: 14px;color: rgba(103, 125, 134, 1);">
我的排名:{{ myIndex }}
</div>
<div style="width:146px;margin-right: -30px;font-size: 14px;color: rgba(103, 125, 134, 1);">
{{ tabValue == 1 ? "项目积分 " : "完成度 " }} {{ tabValue == 1 ? myPoint : myRateStr }}
</div>
</div>
</div>
<!-- 排行榜列表 -->
<div style="display: flex;padding-top: 30px;padding-bottom: 100px;background: linear-gradient(0deg, rgba(36,120,255,0) 0%, rgba(36,120,255,0.15) 100%);">
<div
style="display: flex;padding-top: 30px;padding-bottom: 100px;background: linear-gradient(0deg, rgba(36,120,255,0) 0%, rgba(36,120,255,0.15) 100%);">
<div style="display: flex;justify-content: center;align-items: center;width: 100%;">
<div style="font-size: 14px;color:rgba(36, 120, 255, 1);font-weight: 600;">排名</div>
<div style="margin-left: 110px;margin-right: 110px;font-size: 14px;color:rgba(36, 120, 255, 1);font-weight: 600;">名称</div>
<div style="font-size: 14px;color:rgba(36, 120, 255, 1);font-weight: 600;">{{tabValue==1?"积分":"进度"}}</div>
<div
style="margin-left: 110px;margin-right: 110px;font-size: 14px;color:rgba(36, 120, 255, 1);font-weight: 600;">
名称
</div>
<div style="font-size: 14px;color:rgba(36, 120, 255, 1);font-weight: 600;">
{{ tabValue == 1 ? "积分" : "进度" }}
</div>
</div>
</div>
<!-- 学员列表 -->
@@ -304,7 +307,8 @@
<div
v-for="(item,i) in tableRankData" :key="i"
style="display: flex;justify-content: center;align-items: center;width: 100%;position: relative;top:-60px;margin-bottom: 38px;">
<div style="font-size: 14px;color:rgba(36, 120, 255, 1);font-weight: 600;width:30%;display: flex;justify-content: center;align-items: center;position: relative;">
<div
style="font-size: 14px;color:rgba(36, 120, 255, 1);font-weight: 600;width:30%;display: flex;justify-content: center;align-items: center;position: relative;">
{{ i + 1 == 1 || i + 1 == 2 || i + 1 == 3 ? '' : i + 1 }}
<img
v-if="i + 1 == 1"
@@ -327,14 +331,16 @@
src="../../assets/image/rankme.png"
/>
</div>
<div style="font-size: 14px;color:rgba(36, 120, 255, 1);font-weight: 600;width:34%;display: flex;justify-content: center;align-items: center;">
<div
style="font-size: 14px;color:rgba(36, 120, 255, 1);font-weight: 600;width:34%;display: flex;justify-content: center;align-items: center;">
<img
style="width: 28px; height: 28px;border-radius: 28px;"
:src="item?.avatar"
/>
{{ item.name }}
</div>
<div style="font-size: 14px;color:rgba(36, 120, 255, 1);font-weight: 600;width:30%;display: flex;justify-content: center;align-items: center;">
<div
style="font-size: 14px;color:rgba(36, 120, 255, 1);font-weight: 600;width:30%;display: flex;justify-content: center;align-items: center;">
{{ tabValue == 1 ? item?.pointsCount : item?.rateStr }}
</div>
</div>
@@ -343,13 +349,16 @@
<div
v-if="myIndex > tableRankData.length"
style="display: flex;justify-content: center;align-items: center;width: 100%;position: relative;top:-60px;margin-bottom: 38px;">
<div style="font-size: 14px;color:rgba(36, 120, 255, 1);font-weight: 600;width:30%;display: flex;justify-content: center;align-items: center;">
<div
style="font-size: 14px;color:rgba(36, 120, 255, 1);font-weight: 600;width:30%;display: flex;justify-content: center;align-items: center;">
{{ '...' }}
</div>
<div style="font-size: 14px;color:rgba(36, 120, 255, 1);font-weight: 600;width:34%;display: flex;justify-content: center;align-items: center;">
<div
style="font-size: 14px;color:rgba(36, 120, 255, 1);font-weight: 600;width:34%;display: flex;justify-content: center;align-items: center;">
{{ '' }}
</div>
<div style="font-size: 14px;color:rgba(36, 120, 255, 1);font-weight: 600;width:30%;display: flex;justify-content: center;align-items: center;">
<div
style="font-size: 14px;color:rgba(36, 120, 255, 1);font-weight: 600;width:30%;display: flex;justify-content: center;align-items: center;">
{{ '' }}
</div>
</div>
@@ -357,21 +366,24 @@
<div
v-if="myIndex > tableRankData.length"
style="display: flex;justify-content: center;align-items: center;width: 100%;position: relative;top:-60px;margin-bottom: 38px;">
<div style="font-size: 14px;color:rgba(36, 120, 255, 1);font-weight: 600;width:30%;display: flex;justify-content: center;align-items: center;">
<div
style="font-size: 14px;color:rgba(36, 120, 255, 1);font-weight: 600;width:30%;display: flex;justify-content: center;align-items: center;">
{{ myIndex }}
<img
style="width: 24px; height: 24px;position: absolute;left:110px;"
src="../../assets/image/rankme.png"
/>
</div>
<div style="font-size: 14px;color:rgba(36, 120, 255, 1);font-weight: 600;width:34%;display: flex;justify-content: center;align-items: center;">
<div
style="font-size: 14px;color:rgba(36, 120, 255, 1);font-weight: 600;width:34%;display: flex;justify-content: center;align-items: center;">
<img
style="width: 28px; height: 28px;border-radius: 28px;"
:src="tableRankData[myIndex-1]?.avatar"
/>
{{ tableRankData[myIndex - 1]?.name }}
</div>
<div style="font-size: 14px;color:rgba(36, 120, 255, 1);font-weight: 600;width:30%;display: flex;justify-content: center;align-items: center;">
<div
style="font-size: 14px;color:rgba(36, 120, 255, 1);font-weight: 600;width:30%;display: flex;justify-content: center;align-items: center;">
{{ tabValue == 1 ? tableRankData[myIndex - 1]?.pointsCount : tableRankData[myIndex - 1]?.rateStr }}
</div>
</div>
@@ -397,7 +409,7 @@
</div>
</template>
<script setup>
import { computed, reactive, ref } from "vue";
import {computed, reactive, ref, watch} from "vue";
import {ElLoading} from 'element-plus'
import img from "@/assets/image/uploadimg.png";
import {useRequest, request} from "@/api/request";
@@ -418,6 +430,7 @@ import { ElMessage } from "element-plus";
import {PROJECT} from "@/api/CONST";
import FileTypeImg from "@/components/FileTypeImg.vue";
import {UPDATE_CURRENT_TASK} from "../../api/api";
import dayjs from "dayjs";
const {
query: {courseId, projectId},
@@ -427,6 +440,10 @@ const router = useRouter();
const {data} = useRequest(PROJECT_PROCESS, {
projectId: projectId || courseId,
});
watch(() => data.value.stageProcessList, () => {
data.value.stageProcessList.forEach((t)=>{t.stageStatusName = getTaskStatus(t)})
}, {deep: true})
const studyProgress = [
{
@@ -508,7 +525,21 @@ request(PointList, {projectId:projectId}).then(res=>{
});
console.log("datadata", data);
function getTaskStatus(d){
if (data.value.status !== 3) {
return '已结束'
}
if (dayjs().isBefore(dayjs(d.beginTime)) || !d.taskProcessList?.filter(t => t.status === 1)?.length) {
return '未开始'
}
if (dayjs().isAfter(dayjs(data.value.endTime))) {
return '已结束'
}
if (d.taskProcessList?.filter(t => t.status === 1)?.length === d.taskProcessList?.length) {
return '已完成'
}
return '进行中'
}
const loading = ref(false);
loading.value = ElLoading.service({
@@ -845,9 +876,11 @@ async function toFinish(d, sName, chapterOrStageId) {
types.value.path[d.type](d);
}
}
function whiteTypes(type) {
return import.meta.env.VITE_TASK_WHITE_TYPE.includes("-" + type + "-");
}
// 查询当前阶段所有任务是否都完成
const queryAllStatus = (data) => {
// status === 1 已完成

View File

@@ -20,16 +20,10 @@
<div class="titleL">{{ data.currentStageName }}</div>
<div class="titleR" :style="{ display: 'flex' }">
<img :src="data.currentChapterCnt ? circle : circle2" />
<div class="titleRT">
<!-- <div class="titleRT" :style="{ color: data.currentChapterCnt ? '' : 'rgba(102, 102, 102, 1)' }"> -->
<!-- {{ data.currentChapterCnt ? '进行中' : '未开始' }} -->
进行中
<div class="titleRT" :style="(stageStatusName === '未开始' || stageStatusName === '已结束') && 'color:#999'">{{stageStatusName}}</div>
</div>
</div>
</div>
<div class="course" v-for="(value, index) in data.taskBoList?.filter(
(e) => !whiteTypes(e.type)
)" :key="index">
<div class="course" v-for="(value, index) in data.taskBoList?.filter((e) => !whiteTypes(e.type))" :key="index">
<div style="width: 70%">
<div v-if="value.name.length > 50" class="coursename" :title="value.name">
<el-popover ref="popover" placement="right" trigger="hover" :width="300" :content="value.name">
@@ -294,9 +288,20 @@ const returnclick = () => {
};
const { data } = useRequest(ROUTER_PROCESS, { routerId });
const userInfo = computed(() => store.state.userInfo);
console.log('lalalallala', data)
const activeName = ref("first");
const stageStatusName = computed(()=>{
if(data.value.status !== 1){
return '已结束'
}
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 handleClick = (tab, event) => {
console.log(tab, event);
};
@@ -369,9 +374,9 @@ function judgeTaskIsEnd(type, endTimes, status) {
case 1:
status == 3 ? isEnd = true : nowTime > endTime ? isEnd = true : isEnd = false;
break;
case 3:
status == 3 ? 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 == 3 ? isEnd = true : nowTime > endTime ? isEnd = true : isEnd = false;
break;
@@ -385,7 +390,7 @@ function judgeTaskIsEnd(type, endTimes, status) {
return isEnd;
}
function toFinish(d) {
async function toFinish(d) {
console.log(d)
console.log(data.value.currentStageId, routerId)
@@ -455,7 +460,7 @@ function toFinish(d) {
router.push({
path: '/externalexamination',
query: {
id: d.routerTaskId,
id: d.id,
type: ROUTER,
infoId: routerId,
courseId: d.courseId,
@@ -506,14 +511,14 @@ function toFinish(d) {
}
}
//更新学员当前任务
request(UPDATE_CURRENT_TASK,{id:d.routerTaskId,type:ROUTER,pid:routerId,name:d.name})
await request(UPDATE_CURRENT_TASK, {id: d.id, type: ROUTER, pid: routerId, name: d.name})
if (d.type === 3 || d.type === 7) {
d.status!==1 && request(STUDY_RECORD, {
d.status !== 1 && await request(STUDY_RECORD, {
studentId: userInfo.value.id,
targetId: data.value.routerId,
logo: ROUTER,
stageOrChapterId: data.value.currentStageId,
taskId: d.routerTaskId,
taskId: d.id,
});
// 此处判断外链跳转详情界面
@@ -521,7 +526,7 @@ function toFinish(d) {
router.push({
path: '/outerchain',
query: {
id: d.routerTaskId,
id: d.id,
type: ROUTER,
infoId: routerId,
courseId: d.courseId,
@@ -543,7 +548,7 @@ function toFinish(d) {
router.push({
path: '/evaluation',
query: {
id: d.routerTaskId,
id: d.id,
type: ROUTER,
infoId: routerId,
courseId: d.courseId,
@@ -596,7 +601,7 @@ function toFinish(d) {
router.push({
path: types.value.path[d.type],
query: {
id: d.routerTaskId,
id: d.id,
type: ROUTER,
infoId: routerId,
courseId: d.courseId,