feat: 更新课程管理功能

This commit is contained in:
Hvemi_han 2024-12-23 15:22:59 +08:00
parent bb319d7946
commit 5babb8f930
7 changed files with 100 additions and 65 deletions

1
components.d.ts vendored
View File

@ -9,6 +9,7 @@ declare module 'vue' {
export interface GlobalComponents {
PageWrapper: typeof import('./src/components/page-wrapper.vue')['default']
TabBar: typeof import('./src/components/TabBar.vue')['default']
WdBadge: typeof import('wot-design-uni/components/wd-badge/wd-badge.vue')['default']
WdButton: typeof import('wot-design-uni/components/wd-button/wd-button.vue')['default']
WdCell: typeof import('wot-design-uni/components/wd-cell/wd-cell.vue')['default']
WdCellGroup: typeof import('wot-design-uni/components/wd-cell-group/wd-cell-group.vue')['default']

View File

@ -198,6 +198,7 @@ export default class BussApi {
*/
static updateLessonTask(id: number, params: UpdateLessonTaskRequest): Promise<LessonTask> {
const user = useUser();
console.log("params: " + JSON.stringify(params))
return http
.server()
.put(`lesson-tasks/${id}`, params, {

View File

@ -5,6 +5,7 @@ export const useConfig = defineStore('config', () => {
// const BASE_URL = ref<string>("https://ppmp.fenshenzhike.com/api");
// const BASE_URL = ref<string>("http://localhost:1218/api");
const BASE_URL = ref<string>("http://192.168.0.178:1218/api");
// const BASE_URL = ref<string>("http://192.30.5.16:1218/api");
return {
BASE_URL

View File

@ -60,7 +60,8 @@
"navigationBarTextStyle": "black",
"navigationBarTitleText": "XSH PPMP",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
"backgroundColor": "#F8F8F8",
"enablePullDownRefresh": true
},
"easycom": {
"autoscan": true,

View File

@ -165,9 +165,6 @@ const getUsernameById = (userId: number) => {
<wd-tag custom-class="op-60" plain>
{{ courses.length }}节微课
</wd-tag>
<!-- <wd-tag v-if="teacherFilterValue === 0" custom-class="w-fit" plain>
{{ getUsernameById(courses[0]?.userId) }}
</wd-tag> -->
</div>
</div>
<div class="flex items-center gap-4">
@ -199,12 +196,16 @@ const getUsernameById = (userId: number) => {
</template>
<div class="w-full">
<wd-status-tip v-if="courses.length === 0" image="content" tip="没有课程小节" />
<div v-else v-for="(lesson, i) in courses" :key="i" @click="openLessonDetail(lesson.id)"
class="w-full py-2 flex justify-between items-center gap-20 border-b border-b-solid border-neutral-100 last:border-b-0 first:pt-0 last:pb-0">
<div v-else v-for="(lesson, i) in courses" :key="i" @click="openLessonDetail(lesson.id)" class="w-full py-2 flex justify-between items-center gap-20 border-b border-b-solid border-neutral-100
last:border-b-0 first:pt-0 last:pb-0">
<div class="flex items-center gap-1">
<div v-if="calcLessonProgress(lesson) === 100" class="i-tabler-circle-check"></div>
<div v-else-if="calcLessonProgress(lesson) === 0" class="i-tabler-circle-dashed"></div>
<div v-else class="i-tabler-hourglass-empty"></div>
<wd-badge is-dot hidden>
<div is-dot>
<div v-if="calcLessonProgress(lesson) === 100" class="i-tabler-circle-check"></div>
<div v-else-if="calcLessonProgress(lesson) === 0" class="i-tabler-circle-dashed"></div>
<div v-else class="i-tabler-hourglass-empty"></div>
</div>
</wd-badge>
<span>{{ lesson.microLessonName || '无标题视频' }}</span>
</div>
<div class="w-24 flex items-center gap-3">

View File

@ -8,6 +8,7 @@ import { useMessage, useToast } from 'wot-design-uni';
import StatusBlock from './StatusBlock.vue';
import { useRoute } from 'uni-mini-router';
import { useUser } from '@/stores/useUser';
import { onPullDownRefresh } from '@dcloudio/uni-app'
const route = useRoute()
const message = useMessage()
@ -31,6 +32,7 @@ const pickerLessonColumns = computed(() => {
}) : []
})
const pickerLessonValue = ref()
const adviseText = ref('')
const selectedLesson = computed(() => {
if (!pickerLessonValue.value) return null
@ -72,11 +74,8 @@ const onStep1 = () => {
msg: '正在提交...'
})
const params = {
advise: JSON.stringify({
method: script_file_destination.value,
uploaded: false
}),
scriptUploadTime: dayjs().unix(),
// advise: adviseText.value,
// scriptUploadTime: dayjs().unix(),
courseName: selectedLesson.value.courseName,
microLessonName: selectedLesson.value.microLessonName,
userId: selectedLesson.value.userId,
@ -97,6 +96,7 @@ const onStep1 = () => {
}
const onStep2 = (rejected: boolean = false) => {
console.log("adviseText.value: " + adviseText.value)
message.confirm({
title: rejected ? '驳回脚本' : '通过脚本',
msg: rejected ? '脚本不符合要求,驳回制作方重做' : '请确认脚本合格无误后,再确认审核通过'
@ -113,17 +113,15 @@ const onStep2 = (rejected: boolean = false) => {
BussApi.updateLessonTask(
selectedLesson.value.id,
rejected ? {
advise: JSON.stringify({
...parseCombinedFileString(selectedLesson.value, 'advise'),
uploaded: false
}),
scriptUploadTime: 0,
advise: adviseText.value.toString(),
// scriptUploadTime: 0,
courseName: selectedLesson.value.courseName,
microLessonName: selectedLesson.value.microLessonName,
userId: selectedLesson.value.userId,
progressStatus: 0
} : {
scriptConfirmTime: dayjs().unix(),
advise: adviseText.value.toString(),
// scriptConfirmTime: dayjs().unix(),
courseName: selectedLesson.value.courseName,
microLessonName: selectedLesson.value.microLessonName,
userId: selectedLesson.value.userId,
@ -142,6 +140,7 @@ const onStep2 = (rejected: boolean = false) => {
}
const onStep3 = (rejected: boolean = false) => {
console.log("adviseText.value: " + adviseText.value)
message.confirm({
title: rejected ? '驳回视频' : '通过视频',
msg: rejected ? '视频不符合要求,驳回制作方重做' : '请确认视频合格无误后,再确认审核通过'
@ -158,17 +157,15 @@ const onStep3 = (rejected: boolean = false) => {
BussApi.updateLessonTask(
selectedLesson.value.id,
rejected ? {
advise: JSON.stringify({
...parseCombinedFileString(selectedLesson.value, 'advise'),
uploaded: false
}),
videoCaptureTime: 0,
advise: adviseText.value.toString(),
// videoCaptureTime: 0,
courseName: selectedLesson.value.courseName,
microLessonName: selectedLesson.value.microLessonName,
userId: selectedLesson.value.userId,
progressStatus: 1
} : {
videoConfirmTime: dayjs().unix(),
advise: adviseText.value.toString(),
// videoConfirmTime: dayjs().unix(),
courseName: selectedLesson.value.courseName,
microLessonName: selectedLesson.value.microLessonName,
userId: selectedLesson.value.userId,
@ -187,6 +184,7 @@ const onStep3 = (rejected: boolean = false) => {
}
const onPostProduction = (rejected: boolean = false) => {
console.log("adviseText.value: " + adviseText.value)
message.confirm({
title: rejected ? '驳回后期制作' : '通过后期制作',
msg: rejected ? '后期制作不符合要求,驳回制作方重做' : '请确认后期制作合格无误后,再确认审核通过'
@ -203,17 +201,15 @@ const onPostProduction = (rejected: boolean = false) => {
BussApi.updateLessonTask(
selectedLesson.value.id,
rejected ? {
advise: JSON.stringify({
...parseCombinedFileString(selectedLesson.value, 'advise'),
uploaded: false
}),
videoCaptureTime: 0,
advise: adviseText.value.toString(),
// videoCaptureTime: 0,
courseName: selectedLesson.value.courseName,
microLessonName: selectedLesson.value.microLessonName,
userId: selectedLesson.value.userId,
progressStatus: 2
} : {
videoConfirmTime: dayjs().unix(),
advise: adviseText.value.toString(),
// videoConfirmTime: dayjs().unix(),
courseName: selectedLesson.value.courseName,
microLessonName: selectedLesson.value.microLessonName,
userId: selectedLesson.value.userId,
@ -232,6 +228,7 @@ const onPostProduction = (rejected: boolean = false) => {
}
const updateLessons = async () => {
adviseText.value = ""
if (!user.userinfo) {
toast.error({ msg: '请先登录' })
return
@ -289,6 +286,20 @@ const updateLessons = async () => {
onMounted(() => {
updateLessons()
})
const refresh = async () => {
try {
await updateLessons()
} catch (err) {
} finally {
//
uni.stopPullDownRefresh()
}
}
//
onPullDownRefresh(() => {
refresh()
})
</script>
<template>
@ -310,21 +321,27 @@ onMounted(() => {
</div>
<div v-if="selectedLessonStage?.step === 0" class="px-2">
<wd-cell-group>
<wd-cell title="脚本提交途径" :title-width="'100px'" center custom-class="mb-4">
<wd-radio-group v-model="script_file_destination" shape="button">
<wd-radio value="wechat">微信</wd-radio>
<wd-radio value="qq">QQ</wd-radio>
<wd-radio value="platform">平台</wd-radio>
</wd-radio-group>
</wd-cell>
</wd-cell-group>
<wd-button type="primary" block @click="onStep1" custom-class="w-full">提交脚本</wd-button>
<div v-if="user.hasRole('teacher')">
<wd-cell-group>
<wd-cell title="脚本提交途径" :title-width="'100px'" center custom-class="mb-4">
<wd-radio-group v-model="script_file_destination" shape="button">
<wd-radio value="wechat">微信</wd-radio>
<wd-radio value="qq">QQ</wd-radio>
<wd-radio value="platform">平台</wd-radio>
</wd-radio-group>
</wd-cell>
</wd-cell-group>
<wd-button type="primary" block @click="onStep1" custom-class="w-full">提交脚本</wd-button>
</div>
<StatusBlock v-else title="脚本还未提交" subtitle="请耐心等待审核">
<template #icon>
<div class="i-tabler-progress-bolt text-7xl text-neutral-400"></div>
</template>
</StatusBlock>
</div>
<div v-if="selectedLessonStage?.step === 1">
<StatusBlock v-if="!parseCombinedFileString(selectedLesson!, 'advise')?.uploaded" title="脚本已提交"
subtitle="请耐心等待审核">
<StatusBlock v-if="user.hasRole('teacher')" title="脚本已提交" subtitle="请耐心等待审核">
<template #icon>
<div class="i-tabler-progress-bolt text-7xl text-neutral-400"></div>
</template>
@ -335,47 +352,66 @@ onMounted(() => {
<div class="i-tabler-progress-check text-7xl text-neutral-400"></div>
</template>
</StatusBlock>
<div class="mt-4 px-4 space-y-2">
<wd-button type="primary" :round="false" block @click="onStep2()">通过</wd-button>
<wd-button type="error" :round="false" block @click="onStep2(true)">驳回</wd-button>
<div class="mt-4 space-y-4">
<div class="bg-neutral000 rounded-lg px-4 py-3">
<wd-input v-model="adviseText" title="审核建议" type="text" show-clear show-word-limit :maxlength="50"
placeholder="请输入审核建议..." block />
</div>
<div class="flex gap-3 px-4">
<wd-button type="primary" block @click="onStep2()">通过</wd-button>
<wd-button type="error" block @click="onStep2(true)">驳回</wd-button>
</div>
</div>
</div>
</div>
<div v-if="selectedLessonStage?.step === 2">
<StatusBlock v-if="!parseCombinedFileString(selectedLesson!, 'advise')?.uploaded" title="视频拍摄进行中"
subtitle="请等待线下视频拍摄">
<StatusBlock v-if="user.hasRole('teacher')" title="视频拍摄进行中" subtitle="请等待线下视频拍摄">
<template #icon>
<div class="i-tabler-capture text-7xl text-neutral-400"></div>
</template>
</StatusBlock>
<!-- && selectedLesson && selectedLesson?.videoCaptureTime > 0 -->
<div v-else>
<StatusBlock title="视频拍摄已完成" subtitle="请核对后审核">
<template #icon>
<div class="i-tabler-capture-filled text-7xl text-neutral-400"></div>
</template>
</StatusBlock>
<div class="mt-4 px-4 space-y-2">
<wd-button type="primary" :round="false" block @click="onStep3()">通过</wd-button>
<wd-button type="error" :round="false" block @click="onStep3(true)">驳回</wd-button>
<div class="mt-4 space-y-4">
<div class="bg-neutral000 rounded-lg px-4 py-3">
<wd-input v-model="adviseText" title="审核建议" type="text" show-clear show-word-limit :maxlength="50"
placeholder="请输入审核建议..." block />
</div>
<div class="flex gap-3 px-4">
<wd-button type="primary" block @click="onStep3()">通过</wd-button>
<wd-button type="error" block @click="onStep3(true)">驳回</wd-button>
</div>
</div>
</div>
</div>
<div v-if="selectedLessonStage?.step === 3">
<StatusBlock v-if="!parseCombinedFileString(selectedLesson!, 'advise')?.uploaded" title="后期制作进行中"
subtitle="请等待视频后期制作">
<StatusBlock v-if="user.hasRole('teacher')" title="后期制作进行中" subtitle="请等待视频后期制作">
<template #icon>
<div class="i-tabler-video text-7xl text-neutral-400"></div>
</template>
</StatusBlock>
<!-- && selectedLesson && selectedLesson?.videoPostProductionTime > 0 -->
<div v-else>
<StatusBlock title="后期制作已完成" subtitle="请核对后审核">
<template #icon>
<div class="i-tabler-video-filled text-7xl text-neutral-400"></div>
<div class="i-tabler-video text-7xl text-neutral-400"></div>
</template>
</StatusBlock>
<div class="mt-4 px-4 space-y-2">
<wd-button type="primary" :round="false" block @click="onPostProduction()">通过</wd-button>
<wd-button type="error" :round="false" block @click="onPostProduction(true)">驳回</wd-button>
<div class="mt-4 space-y-4">
<div class="bg-neutral000 rounded-lg px-4 py-3">
<wd-input v-model="adviseText" title="审核建议" type="text" show-clear show-word-limit :maxlength="50"
placeholder="请输入审核建议..." block />
</div>
<div class="flex gap-3 px-4">
<wd-button type="primary" block @click="onPostProduction()">通过</wd-button>
<wd-button type="error" block @click="onPostProduction(true)">驳回</wd-button>
</div>
</div>
</div>
</div>

View File

@ -28,12 +28,6 @@ export interface LessonTask {
createdAt: number;
/** 更新时间(时间戳) */
updatedAt: number;
/** 脚本文件路径 */
script_file?: string;
/** 视频拍摄文件路径 */
capture_file?: string;
/** 素材文件路径 */
material_file?: string;
}
export interface LessonTaskPagination {