Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
tswj
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2022-06-22 17:21:27 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e5110d7b6de103f92be5f05eee7852efdd52efa5
e5110d7b
1 parent
c1b44e36
🐞 fix(我的留言): 还原老版本修复页面数据不刷新问题
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
8 deletions
src/views/me/message.vue
src/views/me/message.vue
View file @
e5110d7
...
...
@@ -23,8 +23,8 @@
<van-row>
<van-col>
<span style="color: #222222;">{{ item.c_action }}<span style="color: #0B3A72;">@{{ item.c_name }}</span>:{{
item.note
}}</span>
item.note
}}</span>
</van-col>
</van-row>
</div>
...
...
@@ -53,24 +53,79 @@
<script lang="ts" setup>
// import { mainStore } from '@/store'
import { no_image, icon_avatar } from '@/utils/generateIcons.js'
import { onActivated } from 'vue'
import {
ref,
onActivated } from 'vue'
import { onBeforeRouteLeave } from 'vue-router'
import _ from 'lodash'
import { Toast, Dialog } from 'vant';
// import { addPages } from '@/hooks/useKeepAlive'
import goToVideoDetail from '@/router/methods/videoDetail'
import { delCommentAPI } from '@/api/C/me'
import {
myCommentAPI,
delCommentAPI } from '@/api/C/me'
import { myCommentTimeAPI } from '@/api/C/perf'
import { useMessageList } from '@/composables';
// import { commentListType } from '@/@types/message/interface';
const { onLoad, scrollList:commentList, loading, finished, finishedTextStatus, emptyStatus, } = useMessageList();
onBeforeRouteLeave(async () => {
// 更新留言阅读情况
await myCommentTimeAPI({ optr_type: 'my_comment' });
})
// 我的留言接口联调
const loading = ref(false);
const finished = ref(false);
interface commentListType {
id: string;
avatar: string;
name: string;
kg_name: string;
comment_time: string;
note: string;
c_action: string;
c_name: string;
cover: string;
prod_id: string;
perf_id: string;
book_id: string;
perf_name: string;
book_name: string;
localism_type: string;
is_new: number;
}
const commentList = ref<commentListType[]>([])
let limit = ref(10);
let offset = ref(0)
// 因为不能让空图标提前出来的写法
const finishedTextStatus = ref(false);
const emptyStatus = ref(false);
const onLoad = async () => {
const { data } = await myCommentAPI({ limit: limit.value, offset: offset.value });
//
// _.each(data, item => {
// let arr = _.split(item.target_name, '@'); // 分割评论的动作和姓名
// item.c_action = arr[0]; // 评论动作
// item.c_name = arr[1]; // 评论姓名
// })
data.forEach((item: { target_name: string | null | undefined; c_action: string; c_name: string; }) => {
let arr = _.split(item.target_name, '@'); // 分割评论的动作和姓名
item.c_action = arr[0]; // 评论动作
item.c_name = arr[1]; // 评论姓名
});
commentList.value = [...commentList.value, ...data];
// commentList.value = _.uniqBy(commentList.value, 'id');
offset.value = commentList.value.length;
loading.value = false;
// 数据全部加载完成
if (!data.length) {
// 加载状态结束
finished.value = true;
}
// 隐藏loading标识,空列表图标
if (!commentList.value.length) {
finishedTextStatus.value = false;
emptyStatus.value = true;
} else {
emptyStatus.value = false;
}
}
const deleteComment = (id: string) => { // 删除评论
Dialog.confirm({
title: '温馨提示',
...
...
@@ -109,6 +164,7 @@ onActivated(() => { // keepAlive 重置后执行回调
color: #999999;
padding: 1rem;
line-height: 1.75;
.reply-wrapper {
background: #F7F7F7;
border-radius: 10px;
...
...
@@ -120,6 +176,7 @@ onActivated(() => { // keepAlive 重置后执行回调
color: #222222;
}
}
.spot {
color: red;
font-size: 2rem;
...
...
Please
register
or
login
to post a comment