Merge branch 'zcwy-zsx' into 'master'

Zcwy zsx

See merge request !53
This commit is contained in:
joshen
2024-05-28 19:19:39 +08:00
2 changed files with 38 additions and 19 deletions

View File

@@ -7,6 +7,7 @@ export default createStore({
state: { state: {
userInfo: {}, userInfo: {},
projectInfo: {}, projectInfo: {},
projectError: {},
routerInfo: {} routerInfo: {}
}, },
getters: {}, getters: {},
@@ -17,6 +18,9 @@ export default createStore({
SET_PROJECT_INFO(state, info) { SET_PROJECT_INFO(state, info) {
state.projectInfo = info; state.projectInfo = info;
}, },
SET_PROJECT_ERROR(state,error){
state.projectError = error;
},
INIT_PROJECT_INFO(state) { INIT_PROJECT_INFO(state) {
if (state.projectInfo.status === -1) { if (state.projectInfo.status === -1) {
state.projectInfo.stageProcessList.forEach((t) => { state.projectInfo.stageProcessList.forEach((t) => {
@@ -109,6 +113,7 @@ export default createStore({
getProjectInfo(content, { projectId }) { getProjectInfo(content, { projectId }) {
request(PROJECT_PROCESS, { projectId, type: 1 }).then(res => { request(PROJECT_PROCESS, { projectId, type: 1 }).then(res => {
content.commit("SET_PROJECT_INFO", res.data); content.commit("SET_PROJECT_INFO", res.data);
content.commit("SET_PROJECT_ERROR", res);
content.commit("INIT_PROJECT_INFO"); content.commit("INIT_PROJECT_INFO");
}); });
}, },

View File

@@ -3,8 +3,8 @@
<div class="pathdetails" style="padding: 30px"> <div class="pathdetails" style="padding: 30px">
<div class="pdname"> <div class="pdname">
{{ data.name }} {{ data?.name }}
<el-popover v-if="data.remark" ref="popover" popper-class="jianjie" placement="right" trigger="hover" :width="300" <el-popover v-if="data?.remark" ref="popover" popper-class="jianjie" placement="right" trigger="hover" :width="300"
:content="data.remark"> :content="data.remark">
<template #reference><span style="font-size: 16px;font-weight: 600;">简介></span></template> <template #reference><span style="font-size: 16px;font-weight: 600;">简介></span></template>
</el-popover> </el-popover>
@@ -13,7 +13,7 @@
<!-- 详细信息 --> <!-- 详细信息 -->
<div class="detailinfo"> <div class="detailinfo">
<div class="detailL"> <div class="detailL">
<div v-if="data.stageProcessList" v-for="(i, k) in data.stageProcessList" :key="k"> <div v-if="data?.stageProcessList" v-for="(i, k) in data?.stageProcessList" :key="k">
<div v-if="i.id == '0' && i.taskProcessList?.length == 0"></div> <div v-if="i.id == '0' && i.taskProcessList?.length == 0"></div>
<div v-else class="title"> <div v-else class="title">
<div class="titleL">{{ i.stageName }}</div> <div class="titleL">{{ i.stageName }}</div>
@@ -92,11 +92,11 @@
<el-tabs v-model="activeName" @tab-click="handleClick"> <el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="项目公告" name="first"> <el-tab-pane label="项目公告" name="first">
<!-- <pre class="notice">{{ data.notice || "暂无公告" }}</pre> --> <!-- <pre class="notice">{{ data.notice || "暂无公告" }}</pre> -->
<div class="notice">{{ data.notice || "暂无公告" }}</div> <div class="notice">{{ data?.notice || "暂无公告" }}</div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="共享文档" name="second"> <el-tab-pane label="共享文档" name="second">
<div style="padding: 19px 30px 17px 28px"> <div style="padding: 19px 30px 17px 28px">
<div v-for="(value, index) in JSON.parse(data.attach ? data.attach : '[]')" :key="index" style=" <div v-for="(value, index) in JSON.parse(data?.attach ? data?.attach : '[]')" :key="index" style="
display: flex; display: flex;
align-items: center; align-items: center;
margin-bottom: 15px;"> margin-bottom: 15px;">
@@ -125,7 +125,7 @@
</div> </div>
<!-- todo #路径详情 个人信息缺少img和介绍--> <!-- todo #路径详情 个人信息缺少img和介绍-->
<div class="teacheritem" :style="{ 'border-bottom': '1px solid rgba(56, 125, 247, 0.2)' }"> <div class="teacheritem" :style="{ 'border-bottom': '1px solid rgba(56, 125, 247, 0.2)' }">
<img class="peopleimg" :src="userInfo?.avatar" /> <img class="peopleimg" :src="userInfo?.avatar?.includes('upload')?userInfo?.avatar:'/upload'+userInfo?.avatar" />
<div style="margin-left: 17px"> <div style="margin-left: 17px">
<div class="teacherName"> <div class="teacherName">
<div style="margin-right: 5px"> <div style="margin-right: 5px">
@@ -143,9 +143,9 @@
<div class="box"></div> <div class="box"></div>
</div> </div>
<div class="rate" v-if="data.lastLearned"> <div class="rate" v-if="data?.lastLearned">
<div class="ratetext">上次学到:{{ data.lastLearned }}</div> <div class="ratetext">上次学到:{{ data?.lastLearned }}</div>
<div v-if="data.lastLearned" class="ratebtn" @click="continueLearn(data.lastLearnedId)">继续学习</div> <div v-if="data?.lastLearned" class="ratebtn" @click="continueLearn(data?.lastLearnedId)">继续学习</div>
</div> </div>
<div style="margin-top: 16px"> <div style="margin-top: 16px">
@@ -153,7 +153,7 @@
<div>总进度</div> <div>总进度</div>
<div class="progress"> <div class="progress">
<div style="width: 291px"> <div style="width: 291px">
<el-progress :percentage="parseInt((data.totalProgress || 0) * 100)" <el-progress :percentage="parseInt((data?.totalProgress || 0) * 100)"
:show-text="false" :stroke-width="8" :color=" :show-text="false" :stroke-width="8" :color="
{ {
0: 'rgba(238, 112, 108, 1)', 0: 'rgba(238, 112, 108, 1)',
@@ -162,11 +162,11 @@
3: 'rgba(59, 94, 251, 1)', 3: 'rgba(59, 94, 251, 1)',
4: 'rgba(57, 219, 183, 1)', 4: 'rgba(57, 219, 183, 1)',
5: 'rgba(57, 219, 183, 1)', 5: 'rgba(57, 219, 183, 1)',
}[parseInt(((data.totalProgress || 0) * 100) / 20)] }[parseInt(((data?.totalProgress || 0) * 100) / 20)]
" /> " />
</div> </div>
<div style="font-size: 14px; font-weight: 500; margin-left: 10px;color:#677d86;"> <div style="font-size: 14px; font-weight: 500; margin-left: 10px;color:#677d86;">
{{ parseInt((data.totalProgress || 0) * 100) }}% {{ parseInt((data?.totalProgress || 0) * 100) }}%
</div> </div>
</div> </div>
</div> </div>
@@ -176,7 +176,7 @@
<div>必修进度</div> <div>必修进度</div>
<div class="progress"> <div class="progress">
<div style="width: 291px"> <div style="width: 291px">
<el-progress :percentage="parseInt((data.compulsoryProgress || 0) * 100)" <el-progress :percentage="parseInt((data?.compulsoryProgress || 0) * 100)"
:show-text="false" :stroke-width="8" :color=" :show-text="false" :stroke-width="8" :color="
{ {
0: 'rgba(238, 112, 108, 1)', 0: 'rgba(238, 112, 108, 1)',
@@ -185,7 +185,7 @@
3: 'rgba(59, 94, 251, 1)', 3: 'rgba(59, 94, 251, 1)',
4: 'rgba(57, 219, 183, 1)', 4: 'rgba(57, 219, 183, 1)',
5: 'rgba(57, 219, 183, 1)', 5: 'rgba(57, 219, 183, 1)',
}[parseInt(((data.compulsoryProgress || 0) * 100) / 20)] }[parseInt(((data?.compulsoryProgress || 0) * 100) / 20)]
" /> " />
</div> </div>
<div style=" <div style="
@@ -193,7 +193,7 @@
font-weight: 500; font-weight: 500;
color: #277aff; color: #277aff;
margin-left: 10px;color:#677d86;"> margin-left: 10px;color:#677d86;">
{{parseInt(((data.compulsoryProgress || 0) * 100)) }}% {{parseInt(((data?.compulsoryProgress || 0) * 100)) }}%
</div> </div>
</div> </div>
</div> </div>
@@ -202,7 +202,7 @@
</div> </div>
<!-- 个人信息及学习进度 --> <!-- 个人信息及学习进度 -->
<!-- 学员积分及个人完成度排行榜 --> <!-- 学员积分及个人完成度排行榜 -->
<div class="detailRB" v-if="data.rankFlag"> <div class="detailRB" v-if="data?.rankFlag">
<div class="info"> <div class="info">
<div <div
style="display:flex;justify-content: space-between;align-items: center;height: 56px;padding-left: 27px;padding-right: 27px;"> style="display:flex;justify-content: space-between;align-items: center;height: 56px;padding-left: 27px;padding-right: 27px;">
@@ -212,7 +212,7 @@
<!-- <div style="font-size: 14px;color: rgba(51, 51, 51, 1);font-weight: 600;">完成度排行榜</div> --> <!-- <div style="font-size: 14px;color: rgba(51, 51, 51, 1);font-weight: 600;">完成度排行榜</div> -->
<el-select @change="choiceStatus" v-model="stateValue" class="m-2" mode="tags" placeholder="完成度排行榜" <el-select @change="choiceStatus" v-model="stateValue" class="m-2" mode="tags" placeholder="完成度排行榜"
style="width: 130px;border: 0px solid red !important; box-shadow:none !important; "> style="width: 130px;border: 0px solid red !important; box-shadow:none !important; ">
<el-option v-for="item in studyProgress" :key="item.value" :label="item.label" :value="item.value" :disabled="item.label.includes('小组') && data.groupId==null?true:false" :title="item.label.includes('小组') && data.groupId==null?'当前学员无小组':''"/> <el-option v-for="item in studyProgress" :key="item.value" :label="item.label" :value="item.value" :disabled="item.label.includes('小组') && data?.groupId==null?true:false" :title="item.label.includes('小组') && data?.groupId==null?'当前学员无小组':''"/>
</el-select> </el-select>
</div> </div>
<!-- line --> <!-- line -->
@@ -350,7 +350,7 @@
</div> </div>
</template> </template>
<script setup> <script setup>
import {computed, onMounted, ref} from "vue"; import {computed, onMounted, ref,watch} from "vue";
import {ElMessage} from "element-plus"; import {ElMessage} from "element-plus";
import {request} from "@/api/request"; import {request} from "@/api/request";
import { import {
@@ -366,7 +366,6 @@ import {useRoute, useRouter} from "vue-router";
import {PROJECT, TASK_TYPES} from "@/api/CONST"; import {PROJECT, TASK_TYPES} from "@/api/CONST";
import FileTypeImg from "@/components/FileTypeImg.vue"; import FileTypeImg from "@/components/FileTypeImg.vue";
import {useStore} from "vuex"; import {useStore} from "vuex";
const { const {
query: { courseId, projectId }, query: { courseId, projectId },
} = useRoute(); } = useRoute();
@@ -375,10 +374,25 @@ const { commit, dispatch, state } = useStore()
const store = useStore() const store = useStore()
const userInfo = computed(() => state.userInfo) const userInfo = computed(() => state.userInfo)
const data = computed(() => state.projectInfo) const data = computed(() => state.projectInfo)
const errorData = computed(() => state.projectError)
console.log(data) console.log(data)
const trueFalse = ref(false)
onMounted(() => { onMounted(() => {
if(projectId!=''||projectId!=undefined||projectId!=null){
dispatch('getProjectInfo', { projectId })
}else{
trueFalse.value = true
}
})
watch(()=>trueFalse.value,(val)=>{
dispatch('getProjectInfo', { projectId }) dispatch('getProjectInfo', { projectId })
}) })
watch(()=>errorData.value,(val)=>{
if(val.data == null){
ElMessage.error(val.msg)
window.parent.postMessage({ type: 'navigate', path: '/uc/study/task' }, '*');
}
},{deep:true})
const tableRankData = ref([]) const tableRankData = ref([])
const studyProgress = [ const studyProgress = [
{ {