|
@@ -19,12 +19,27 @@ const hanldeItemClick = ({ sessionId }) => {
|
|
|
uni.navigateBack({ delta: 1 });
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+const hanldeItemLongpress = ({ id }) => {
|
|
|
+ uni.showModal({
|
|
|
+ title: "提示",
|
|
|
+ content: "请确认,是否删除该记录",
|
|
|
+ success: async (status) => {
|
|
|
+ if (status.confirm) {
|
|
|
+ await chatApi.delAnswerItem(id);
|
|
|
+ initHistoryList();
|
|
|
+ uni.showToast({ title: '删除成功', icon: 'none', duration: 3000, mask: true });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
// 前往个人中心
|
|
|
const onJumpToUser = () => {
|
|
|
uni.navigateTo({ url: '/pages/user/index' })
|
|
|
}
|
|
|
|
|
|
-onMounted(() => {
|
|
|
+const initHistoryList = () => {
|
|
|
chatApi.getQaHistoryList().then(({ data }) => {
|
|
|
historyList.value = Object.keys(data).map(key => {
|
|
|
const children = data[key];
|
|
@@ -39,7 +54,10 @@ onMounted(() => {
|
|
|
}
|
|
|
})?.sort((a, b) => dayjs(b.title).diff(dayjs(a.title)));
|
|
|
});
|
|
|
-})
|
|
|
+}
|
|
|
+
|
|
|
+onMounted(() => initHistoryList());
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
@@ -51,7 +69,7 @@ onMounted(() => {
|
|
|
<view class="history-list">
|
|
|
<view class="history-item" v-for="item, index in historyList" :key="index">
|
|
|
<view class="title">{{ item.title }}</view>
|
|
|
- <view class="item-inner" v-for="val, i in item.children" :key="i" @click="hanldeItemClick(val)">
|
|
|
+ <view class="item-inner" v-for="val, i in item.children" :key="i" @click="hanldeItemClick(val)" @longpress="hanldeItemLongpress(val)">
|
|
|
<view class="time">{{ val.time }}</view>
|
|
|
<view class="info">
|
|
|
<view class="circle"></view>
|