mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-student.git
synced 2025-12-22 09:16:49 +08:00
提交
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
export const PROJECT = 1;
|
||||
export const ROUTER = 2;
|
||||
export const COURSE = 3;
|
||||
export const GROWTH = 4;
|
||||
|
||||
export const TASK_TYPES = {
|
||||
typeName: {
|
||||
|
||||
@@ -132,3 +132,13 @@ export const EditVoteInvolvedAndBrowse = `/vote/editVoteInvolvedAndBrowse post`
|
||||
export const ROUTER_DETAIL_CHAPTER_LIST = `/stu/router/chapterPcList`
|
||||
|
||||
|
||||
|
||||
/**专业力必修模块 */
|
||||
let baseUrl = "/growth"
|
||||
// let baseUrl = ""
|
||||
//查询专业力必修详情
|
||||
export const PROFESSIONAL_STUDENT_DETAIL = id => `${baseUrl}/professional/student/studentGrowthDetail/${id}`
|
||||
//查询专业力必修详情
|
||||
export const PROFESSIONAL_STUDENT_TASKLIST = `${baseUrl}/professional/student/studentTaskList`
|
||||
//记录当前学习任务
|
||||
export const PROFESSIONAL_STUDENT_LEARN = `${baseUrl}/professional/student/learnCourse`
|
||||
@@ -1,24 +1,25 @@
|
||||
import {useRoute, useRouter} from "vue-router/dist/vue-router";
|
||||
import {useStore} from "vuex";
|
||||
import {TASK_TYPES} from "@/api/CONST";
|
||||
import {computed, watchEffect} from "vue";
|
||||
import { useRoute, useRouter } from "vue-router/dist/vue-router";
|
||||
import { useStore } from "vuex";
|
||||
import { TASK_TYPES } from "@/api/CONST";
|
||||
import { computed, watchEffect } from "vue";
|
||||
|
||||
export function useTaskPage() {
|
||||
const router = useRouter()
|
||||
const {query: {id: taskId, type, infoId}} = useRoute()
|
||||
const {state, dispatch} = useStore()
|
||||
const info = computed(() => type == 1 ? state.projectInfo : state.routerInfo)
|
||||
|
||||
const taskList = computed(() => type == 1 ? info.value.stageProcessList.flatMap(t => t.taskProcessList.map(s => ({
|
||||
...s,
|
||||
stageId: t.id,
|
||||
stageName: t.name
|
||||
}))) : info.value.taskBoList)
|
||||
const { query: { id: taskId, type, infoId } } = useRoute()
|
||||
const { state, dispatch } = useStore()
|
||||
const info = computed(() => type == 1 ? state.projectInfo : type == 2 ? state.routerInfo : state.growthInfo)
|
||||
const taskList = computed(() => {
|
||||
return type == 1 ? info.value.stageProcessList.flatMap(t => t.taskProcessList.map(s => ({
|
||||
...s,
|
||||
stageId: t.id,
|
||||
stageName: t.name
|
||||
}))) : type == 2 ? info.value.taskBoList : []
|
||||
})
|
||||
const index = computed(() => taskList.value?.findIndex(t => t.id == taskId))
|
||||
const hasPrev = computed(() => index.value - 1 > 0)
|
||||
const hasNext = computed(() => taskList.value.length > index.value)
|
||||
const hasNext = computed(() => index.value !== -1 && taskList.value?.length > index.value)
|
||||
|
||||
type == 1 ? dispatch('getProjectInfo', {projectId: infoId}) : dispatch('getRouterInfo', {routerId: infoId})
|
||||
type == 1 ? dispatch('getProjectInfo', { projectId: infoId }) : type == 2 ? dispatch('getRouterInfo', { routerId: infoId }) : dispatch('getGrowthInfo', { routerId: infoId })
|
||||
|
||||
function nextPage() {
|
||||
toPage(taskList.value[index.value + 1])
|
||||
@@ -49,5 +50,5 @@ export function useTaskPage() {
|
||||
}
|
||||
}
|
||||
|
||||
return {hasPrev, hasNext, nextPage, prevPage}
|
||||
return { hasPrev, hasNext, nextPage, prevPage }
|
||||
}
|
||||
Reference in New Issue
Block a user