添加评论回复的楼中楼功能,移除过时的评论赏金功能#37
Open
wangzh12023 wants to merge 14 commits intoShanghaitechGeekPie:masterfrom
Open
Conversation
HeZeBang
reviewed
Jul 12, 2025
Member
HeZeBang
left a comment
There was a problem hiding this comment.
- 所有的在子页面 patch 的 mock 都是没有必要的,太过于侵入了。最佳实践是在各种 use... 获取数据的时候进行 patch,或更不侵入的应该是直接在用
useMuation或者useFetcher这些接口调用的时候,做字符串网址匹配,并且 phantom 或者别的样例返回 - 常量应该放到统一的地方,例如
environment.js - login 等可以根据你的 Mock 来判断是否应该用真实数据,而不是强制写入
- CommentCard 的底部由于新增了按钮,在响应式设计的时候在窄屏幕会有溢出问题,可以修改断点比例
- 新增的回复 UI 在回复楼中楼的时候有暗黑模式适应问题
- 评论回复缺少 mock,不能复现期望的结果
- TeacherAll 少许粗糙,缺少分页,不过没关系
src/views/User.vue
Outdated
Comment on lines
+119
to
+125
|
|
||
| // 使用 mock 数据 | ||
| if (mockDataManager.isEnabled()) { | ||
| status.profileLoading = false; | ||
| status.commentLoading = false; | ||
| } | ||
|
|
src/views/TeacherDetails.vue
Outdated
Comment on lines
+138
to
+143
|
|
||
| // 使用 mock 数据 | ||
| if (mockDataManager.isEnabled()) { | ||
| status.loading = false; | ||
| } | ||
|
|
Member
There was a problem hiding this comment.
Suggested change
| // 使用 mock 数据 | |
| if (mockDataManager.isEnabled()) { | |
| status.loading = false; | |
| } | |
src/views/Recent.vue
Outdated
Comment on lines
+84
to
+90
|
|
||
| // 使用mock数据 | ||
| if (mockDataManager.isEnabled()) { | ||
| commentText.value = mockDataManager.getData('comments'); | ||
| status.commentLoading = false; | ||
| } | ||
|
|
Member
There was a problem hiding this comment.
没有必要
Suggested change
| // 使用mock数据 | |
| if (mockDataManager.isEnabled()) { | |
| commentText.value = mockDataManager.getData('comments'); | |
| status.commentLoading = false; | |
| } | |
src/views/CourseAll.vue
Outdated
Comment on lines
+184
to
+189
|
|
||
| // 使用 mock 数据 | ||
| if (mockDataManager.isEnabled()) { | ||
| courseText.value = mockDataManager.getData('courses'); | ||
| status.loading = false; | ||
| } |
Member
There was a problem hiding this comment.
没有必要
Suggested change
| // 使用 mock 数据 | |
| if (mockDataManager.isEnabled()) { | |
| courseText.value = mockDataManager.getData('courses'); | |
| status.loading = false; | |
| } |
src/views/Active.vue
Outdated
Comment on lines
+155
to
+163
|
|
||
| // 使用 mock 数据 | ||
| if (mockDataManager.isEnabled()) { | ||
| const mockActiveData = mockDataManager.getData('activeData'); | ||
| status.loading = mockActiveData.loading; | ||
| status.errorMessage = mockActiveData.errorMessage; | ||
| status.success = mockActiveData.success; | ||
| } | ||
|
|
Comment on lines
+4
to
+14
| <div v-if="!showAll && replies.length > displayLimit" class="mb-2"> | ||
| <v-btn | ||
| text | ||
| small | ||
| color="primary" | ||
| @click="showAll = true" | ||
| > | ||
| 查看全部 {{ replies.length }} 条回复 | ||
| <v-icon small class="ml-1">{{ mdiChevronDown }}</v-icon> | ||
| </v-btn> | ||
| </div> |
Member
There was a problem hiding this comment.
位置有点反直觉,我期望的是这个显示在最下面,否则有点反直觉。并且最下面有个最好渐隐的效果,可以用 css 中的 mask 或者 filter 实现。可以参考 CSDN 那种读到一半然后让你付费解锁那种的设计(x
| isError: false, | ||
| }); | ||
|
|
||
| const replyMutation = useMutation('/comment/reply/post', { |
Comment on lines
+10
to
+21
| // mock数据 | ||
| if (mockManager.shouldUseMock()) { | ||
| if (address.includes('/comment/recent')) { | ||
| return await mockManager.mockSuccess(mockManager.getMockData('comments')); | ||
| } else if (address.includes('/course/all')) { | ||
| return await mockManager.mockSuccess(mockManager.getMockData('courses')); | ||
| } else if (address.includes('/teacher/')) { | ||
| return await mockManager.mockSuccess(mockManager.getMockData('teachers')[0]); | ||
| } | ||
| // 默认返回空数据 | ||
| return await mockManager.mockSuccess([]); | ||
| } |
Member
There was a problem hiding this comment.
尝试把所有的 mock 都写到一个文件里,不要侵入别的文件,并且做好匹配(例如使用字典而不是连环的 if)
src/composables/users/useUser.js
Outdated
Comment on lines
+94
to
+106
| // mock数据 | ||
| if (mockDataManager.isEnabled()) { | ||
| const id = parseInt(route.params.id); | ||
| const mockUser = mockDataManager.getData('users').find(user => user.id === id) || mockDataManager.getData('userProfile'); | ||
| useRefCopy(mockUser, userProfile); | ||
| userProfile.nickname = useUserName(userProfile); | ||
| userProfile.grade = gradeItems[userProfile.grade]; | ||
| userProfile.year = userProfile.year === 0 ? '暂不透露' : userProfile.year; | ||
| status.profileLoading = false; | ||
| return; | ||
| } | ||
|
|
||
|
|
| @@ -1,7 +1,123 @@ | |||
| <template> | |||
| <v-container></v-container> | |||
| <div style="min-height: 100%"> | |||
…23/coursebench-frontend into nested-comments-mock-v
wangzh12023
commented
Jul 13, 2025
Author
wangzh12023
left a comment
There was a problem hiding this comment.
- 对于mock数据已移动到mockService.js同一管理,全局变量放入environments.js统一管理
- 修改了展开回复和收起回复的位置
- 修改了replyList的背景颜色
- unresolved: 深色主题背景测试未测试(没看到怎么调深色背景,无法测试)
- unresolved: api修改验证行为,目前待商榷如何验证
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
新功能
移除内容
待确认
useCommentReply.js,部分mock数据参考/src/composables/global/usePhantomData.js