整条会话删除功能开发

This commit is contained in:
冯辉
2026-03-16 14:46:36 +08:00
parent 5046e7467f
commit eb324ceada
2 changed files with 128 additions and 35 deletions

View File

@@ -25,16 +25,20 @@
<scroll-view scroll-y :show-scrollbar="false" class="chat-scroll">
<view
class="drawer-rows"
@click="changeDialogue(item)"
v-for="(item, index) in filteredList"
:key="item.id"
>
<view
v-if="!item.isTitle"
class="drawer-row-list"
:class="{ 'drawer-row-active': item.sessionId === chatSessionID }"
>
{{ item.title }}
<view v-if="!item.isTitle" class="drawer-row-container">
<view
class="drawer-row-list"
:class="{ 'drawer-row-active': item.sessionId === chatSessionID }"
@click="changeDialogue(item)"
>
{{ item.title }}
</view>
<view class="drawer-row-delete" @click.stop="deleteDialogue(item)">
<uni-icons type="trash" size="24" color="#FF4D4F"></uni-icons>
</view>
</view>
<view class="drawer-row-title" v-else>
{{ item.title }}
@@ -166,6 +170,21 @@ const changeDialogue = (item) => {
});
}
};
const deleteDialogue = (item) => {
if (item.sessionId) {
uni.showModal({
content: '确定删除该会话吗?',
success(res) {
if (res.confirm) {
useChatGroupDBStore().deleteDialogue(item.sessionId);
$api.msg('会话删除成功');
}
}
});
}
};
function updateSetting() {
$api.msg('该功能正在开发中,敬请期待后续更新!');
}
@@ -271,33 +290,56 @@ footer-height = 98rpx
flex: 1
overflow: hidden
.drawer-rows
padding: 0 28rpx;
// border-bottom: 2rpx dashed #e8e8e8
overflow:hidden; //超出的文本隐藏
text-overflow:ellipsis; //溢出用省略号显示
white-space:nowrap; //溢出不换行
.drawer-row-title
color: #A6A6A6;
font-weight: 500;
font-weight: bold;
font-size: 28rpx
padding: 0 24rpx
margin-top: 50rpx
margin-bottom: 16rpx
.drawer-row-list
height: 66rpx;
line-height: 66rpx
font-size: 28rpx
overflow: hidden
text-overflow: ellipsis
font-weight: 500;
color: #595959;
padding: 0 24rpx
.drawer-row-active
.drawer-row-list:active
color: #333333;
background: #F6F6F6;
border-radius: 16rpx 16rpx 16rpx 16rpx;
padding: 0 28rpx;
// border-bottom: 2rpx dashed #e8e8e8
overflow:hidden; //超出的文本隐藏
text-overflow:ellipsis; //溢出用省略号显示
white-space:nowrap; //溢出不换行
.drawer-row-title
color: #A6A6A6;
font-weight: 500;
font-weight: bold;
font-size: 28rpx
padding: 0 24rpx
margin-top: 50rpx
margin-bottom: 16rpx
.drawer-row-container
display: flex
align-items: center
justify-content: space-between
padding: 0 24rpx
height: 66rpx
.drawer-row-list
flex: 1
height: 66rpx
line-height: 66rpx
font-size: 28rpx
overflow: hidden
text-overflow: ellipsis
font-weight: 500;
color: #595959;
.drawer-row-delete
margin-left: 20rpx
display: flex
align-items: center
justify-content: center
padding: 10rpx
opacity: 0.6
&:hover
&:active
opacity: 1
.drawer-row-active
color: #333333;
background: #F6F6F6;
border-radius: 16rpx 16rpx 16rpx 16rpx;
.drawer-row-list:active
color: #333333;
background: #F6F6F6;
border-radius: 16rpx 16rpx 16rpx 16rpx;
/* 主要内容区域 */