fix: 优化布局和显示

1. 修复教师名称显示问题,现在显示正确的教师名称
2. 固定进度条宽度
3. 优化整体布局结构
This commit is contained in:
huertian 2025-01-02 16:44:19 +08:00
parent dc25135dd2
commit 8452965556
4 changed files with 40 additions and 28 deletions

View File

@ -280,7 +280,7 @@
- **查询参数**
- `page`: 页码(从 1 开始)
- `size`: 每页数量(默认 10
- `userId`: 用户ID可选
- `userId`: 用户 ID可选
- **成功响应**
```json
{
@ -326,10 +326,10 @@
### 2. 获取单个课程任务
- **接口**`GET /api/lesson-tasks/{id}`
- **描述**根据ID获取课程任务详情
- **描述**:根据 ID 获取课程任务详情
- **认证**:需要
- **路径参数**
- `id`: 课程任务ID
- `id`: 课程任务 ID
- **成功响应**
```json
{
@ -364,8 +364,7 @@
{
"courseName": "测试课程",
"microLessonName": "测试微课",
"userId": 1,
"advise": "任务说明"
"userId": 1
}
```
- **成功响应**
@ -385,7 +384,7 @@
"videoCreateTime": null,
"videoConfirmTime": null,
"finishTime": null,
"advise": "任务说明",
"advise": null,
"createdAt": 1735003870,
"updatedAt": 1735003870
}
@ -398,7 +397,7 @@
- **描述**:更新课程任务信息
- **认证**:需要
- **路径参数**
- `id`: 课程任务ID
- `id`: 课程任务 ID
- **请求体**
```json
{
@ -436,7 +435,7 @@
- **描述**:获取指定部门的课程任务列表
- **认证**:需要
- **路径参数**
- `departmentId`: 部门ID
- `departmentId`: 部门 ID
- **查询参数**
- `page`: 页码(从 1 开始)
- `size`: 每页数量(默认 10
@ -481,7 +480,7 @@
- **描述**:删除指定的课程任务
- **认证**:需要
- **路径参数**
- `id`: 课程任务ID
- `id`: 课程任务 ID
- **成功响应**
```json
{
@ -493,7 +492,7 @@
## 注意事项
1. 所有时间戳字段均使用秒级时间戳10位
1. 所有时间戳字段均使用秒级时间戳10 位)
2. 课程任务状态变更时会自动记录相应的时间戳
3. 部门课程任务列表会额外返回用户名信息
4. 分页参数中的页码从1开始
4. 分页参数中的页码从 1 开始

View File

@ -142,7 +142,13 @@ const getUsernameById = (userId: number) => {
const refresh = async () => {
try {
const startTime = Date.now()
await loadLessons()
const endTime = Date.now()
const duration = endTime - startTime
if (duration < 500) {
await new Promise(resolve => setTimeout(resolve, 500 - duration))
}
} catch (err) {
} finally {
uni.stopPullDownRefresh()
@ -175,12 +181,6 @@ onLoad(() => {
<div class="flex flex-col gap-1">
<p class="pt-1">
{{ 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>
<div class="flex items-center gap-1">
<wd-tag v-if="(() => {
@ -238,9 +238,9 @@ onLoad(() => {
</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 class="flex items-center gap-1">
<div v-else v-for="(lesson, i) in courses" :key="i" @click="openLessonDetail(lesson.id)"
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 self-center">
<wd-badge is-dot hidden>
<div is-dot>
<div v-if="calcLessonProgress(lesson) === 100" class="i-tabler-circle-check"></div>
@ -249,16 +249,18 @@ onLoad(() => {
</div>
</wd-badge>
<span>{{ lesson.microLessonName || '无标题微课' }}</span>
</div>
<div class="flex items-center gap-3 shrink-0">
<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 v-if="!user.hasRole('teacher') && getUsernameById(lesson.userId)"
class="text-xs text-gray-400 ml-2 whitespace-nowrap">
{{ getUsernameById(lesson.userId) }}
</span>
</wd-badge>
</div>
<div class="w-24 flex items-center gap-3">
<wd-progress :percentage="calcLessonProgress(lesson)"
:color="calcLessonProgress(lesson) === 100 ? '#34d399' : '#60a5fa'" hide-text />
<div class="w-16">
<wd-progress :percentage="calcLessonProgress(lesson)"
:color="calcLessonProgress(lesson) === 100 ? '#34d399' : '#60a5fa'" hide-text />
</div>
<div class="i-tabler-dots text-neutral-400 text-xl"></div>
</div>
</div>

View File

@ -57,7 +57,13 @@ onMounted(() => {
const refresh = async () => {
try {
const startTime = Date.now()
await loadLesson()
const endTime = Date.now()
const duration = endTime - startTime
if (duration < 500) {
await new Promise(resolve => setTimeout(resolve, 500 - duration))
}
} catch (err) {
} finally {
uni.stopPullDownRefresh()

View File

@ -325,13 +325,18 @@ onMounted(() => {
const refresh = async () => {
try {
const startTime = Date.now()
await updateLessons()
const endTime = Date.now()
const duration = endTime - startTime
if (duration < 500) {
await new Promise(resolve => setTimeout(resolve, 500 - duration))
}
} catch (err) {
} finally {
uni.stopPullDownRefresh()
}
}
//
onPullDownRefresh(() => {
refresh()
})