fix: 优化布局和显示
1. 修复教师名称显示问题,现在显示正确的教师名称 2. 固定进度条宽度 3. 优化整体布局结构
This commit is contained in:
21
API文档.md
21
API文档.md
@ -280,7 +280,7 @@
|
|||||||
- **查询参数**:
|
- **查询参数**:
|
||||||
- `page`: 页码(从 1 开始)
|
- `page`: 页码(从 1 开始)
|
||||||
- `size`: 每页数量(默认 10)
|
- `size`: 每页数量(默认 10)
|
||||||
- `userId`: 用户ID(可选)
|
- `userId`: 用户 ID(可选)
|
||||||
- **成功响应**:
|
- **成功响应**:
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@ -326,10 +326,10 @@
|
|||||||
### 2. 获取单个课程任务
|
### 2. 获取单个课程任务
|
||||||
|
|
||||||
- **接口**:`GET /api/lesson-tasks/{id}`
|
- **接口**:`GET /api/lesson-tasks/{id}`
|
||||||
- **描述**:根据ID获取课程任务详情
|
- **描述**:根据 ID 获取课程任务详情
|
||||||
- **认证**:需要
|
- **认证**:需要
|
||||||
- **路径参数**:
|
- **路径参数**:
|
||||||
- `id`: 课程任务ID
|
- `id`: 课程任务 ID
|
||||||
- **成功响应**:
|
- **成功响应**:
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@ -364,8 +364,7 @@
|
|||||||
{
|
{
|
||||||
"courseName": "测试课程",
|
"courseName": "测试课程",
|
||||||
"microLessonName": "测试微课",
|
"microLessonName": "测试微课",
|
||||||
"userId": 1,
|
"userId": 1
|
||||||
"advise": "任务说明"
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
- **成功响应**:
|
- **成功响应**:
|
||||||
@ -385,7 +384,7 @@
|
|||||||
"videoCreateTime": null,
|
"videoCreateTime": null,
|
||||||
"videoConfirmTime": null,
|
"videoConfirmTime": null,
|
||||||
"finishTime": null,
|
"finishTime": null,
|
||||||
"advise": "任务说明",
|
"advise": null,
|
||||||
"createdAt": 1735003870,
|
"createdAt": 1735003870,
|
||||||
"updatedAt": 1735003870
|
"updatedAt": 1735003870
|
||||||
}
|
}
|
||||||
@ -398,7 +397,7 @@
|
|||||||
- **描述**:更新课程任务信息
|
- **描述**:更新课程任务信息
|
||||||
- **认证**:需要
|
- **认证**:需要
|
||||||
- **路径参数**:
|
- **路径参数**:
|
||||||
- `id`: 课程任务ID
|
- `id`: 课程任务 ID
|
||||||
- **请求体**:
|
- **请求体**:
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@ -436,7 +435,7 @@
|
|||||||
- **描述**:获取指定部门的课程任务列表
|
- **描述**:获取指定部门的课程任务列表
|
||||||
- **认证**:需要
|
- **认证**:需要
|
||||||
- **路径参数**:
|
- **路径参数**:
|
||||||
- `departmentId`: 部门ID
|
- `departmentId`: 部门 ID
|
||||||
- **查询参数**:
|
- **查询参数**:
|
||||||
- `page`: 页码(从 1 开始)
|
- `page`: 页码(从 1 开始)
|
||||||
- `size`: 每页数量(默认 10)
|
- `size`: 每页数量(默认 10)
|
||||||
@ -481,7 +480,7 @@
|
|||||||
- **描述**:删除指定的课程任务
|
- **描述**:删除指定的课程任务
|
||||||
- **认证**:需要
|
- **认证**:需要
|
||||||
- **路径参数**:
|
- **路径参数**:
|
||||||
- `id`: 课程任务ID
|
- `id`: 课程任务 ID
|
||||||
- **成功响应**:
|
- **成功响应**:
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@ -493,7 +492,7 @@
|
|||||||
|
|
||||||
## 注意事项
|
## 注意事项
|
||||||
|
|
||||||
1. 所有时间戳字段均使用秒级时间戳(10位)
|
1. 所有时间戳字段均使用秒级时间戳(10 位)
|
||||||
2. 课程任务状态变更时会自动记录相应的时间戳
|
2. 课程任务状态变更时会自动记录相应的时间戳
|
||||||
3. 部门课程任务列表会额外返回用户名信息
|
3. 部门课程任务列表会额外返回用户名信息
|
||||||
4. 分页参数中的页码从1开始
|
4. 分页参数中的页码从 1 开始
|
||||||
|
@ -142,7 +142,13 @@ const getUsernameById = (userId: number) => {
|
|||||||
|
|
||||||
const refresh = async () => {
|
const refresh = async () => {
|
||||||
try {
|
try {
|
||||||
|
const startTime = Date.now()
|
||||||
await loadLessons()
|
await loadLessons()
|
||||||
|
const endTime = Date.now()
|
||||||
|
const duration = endTime - startTime
|
||||||
|
if (duration < 500) {
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 500 - duration))
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
} finally {
|
} finally {
|
||||||
uni.stopPullDownRefresh()
|
uni.stopPullDownRefresh()
|
||||||
@ -175,12 +181,6 @@ onLoad(() => {
|
|||||||
<div class="flex flex-col gap-1">
|
<div class="flex flex-col gap-1">
|
||||||
<p class="pt-1">
|
<p class="pt-1">
|
||||||
{{ courseName || '无标题课程' }}
|
{{ courseName || '无标题课程' }}
|
||||||
<wd-badge hidden is-dot :top="-10">
|
|
||||||
<span v-if="!user.hasRole('teacher') && getUsernameById(courses[0]?.userId)"
|
|
||||||
class=" text-xs text-gray-400 ml-2">
|
|
||||||
<!-- {{ getUsernameById(courses[0]?.userId) }} -->
|
|
||||||
</span>
|
|
||||||
</wd-badge>
|
|
||||||
</p>
|
</p>
|
||||||
<div class="flex items-center gap-1">
|
<div class="flex items-center gap-1">
|
||||||
<wd-tag v-if="(() => {
|
<wd-tag v-if="(() => {
|
||||||
@ -238,9 +238,9 @@ onLoad(() => {
|
|||||||
</template>
|
</template>
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<wd-status-tip v-if="courses.length === 0" image="content" tip="没有课程小节" />
|
<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
|
<div v-else v-for="(lesson, i) in courses" :key="i" @click="openLessonDetail(lesson.id)"
|
||||||
last:border-b-0 first:pt-0 last:pb-0">
|
class="w-full py-2 gap-12 flex justify-between items-center 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 class="flex items-center gap-1 self-center">
|
||||||
<wd-badge is-dot hidden>
|
<wd-badge is-dot hidden>
|
||||||
<div is-dot>
|
<div is-dot>
|
||||||
<div v-if="calcLessonProgress(lesson) === 100" class="i-tabler-circle-check"></div>
|
<div v-if="calcLessonProgress(lesson) === 100" class="i-tabler-circle-check"></div>
|
||||||
@ -249,16 +249,18 @@ onLoad(() => {
|
|||||||
</div>
|
</div>
|
||||||
</wd-badge>
|
</wd-badge>
|
||||||
<span>{{ lesson.microLessonName || '无标题微课' }}</span>
|
<span>{{ lesson.microLessonName || '无标题微课' }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-3 shrink-0">
|
||||||
<wd-badge hidden is-dot :top="-10">
|
<wd-badge hidden is-dot :top="-10">
|
||||||
<span v-if="!user.hasRole('teacher') && getUsernameById(courses[0]?.userId)"
|
<span v-if="!user.hasRole('teacher') && getUsernameById(lesson.userId)"
|
||||||
class=" text-xs text-gray-400 ml-2">
|
class="text-xs text-gray-400 ml-2 whitespace-nowrap">
|
||||||
{{ getUsernameById(courses[0]?.userId) }}
|
{{ getUsernameById(lesson.userId) }}
|
||||||
</span>
|
</span>
|
||||||
</wd-badge>
|
</wd-badge>
|
||||||
</div>
|
<div class="w-16">
|
||||||
<div class="w-24 flex items-center gap-3">
|
|
||||||
<wd-progress :percentage="calcLessonProgress(lesson)"
|
<wd-progress :percentage="calcLessonProgress(lesson)"
|
||||||
:color="calcLessonProgress(lesson) === 100 ? '#34d399' : '#60a5fa'" hide-text />
|
:color="calcLessonProgress(lesson) === 100 ? '#34d399' : '#60a5fa'" hide-text />
|
||||||
|
</div>
|
||||||
<div class="i-tabler-dots text-neutral-400 text-xl"></div>
|
<div class="i-tabler-dots text-neutral-400 text-xl"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -57,7 +57,13 @@ onMounted(() => {
|
|||||||
|
|
||||||
const refresh = async () => {
|
const refresh = async () => {
|
||||||
try {
|
try {
|
||||||
|
const startTime = Date.now()
|
||||||
await loadLesson()
|
await loadLesson()
|
||||||
|
const endTime = Date.now()
|
||||||
|
const duration = endTime - startTime
|
||||||
|
if (duration < 500) {
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 500 - duration))
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
} finally {
|
} finally {
|
||||||
uni.stopPullDownRefresh()
|
uni.stopPullDownRefresh()
|
||||||
|
@ -325,13 +325,18 @@ onMounted(() => {
|
|||||||
|
|
||||||
const refresh = async () => {
|
const refresh = async () => {
|
||||||
try {
|
try {
|
||||||
|
const startTime = Date.now()
|
||||||
await updateLessons()
|
await updateLessons()
|
||||||
|
const endTime = Date.now()
|
||||||
|
const duration = endTime - startTime
|
||||||
|
if (duration < 500) {
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 500 - duration))
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
} finally {
|
} finally {
|
||||||
uni.stopPullDownRefresh()
|
uni.stopPullDownRefresh()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 添加下拉刷新处理函数
|
|
||||||
onPullDownRefresh(() => {
|
onPullDownRefresh(() => {
|
||||||
refresh()
|
refresh()
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user