删除会话功能开发
This commit is contained in:
@@ -25,16 +25,23 @@
|
||||
<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 }"
|
||||
class="drawer-row-content"
|
||||
>
|
||||
{{ item.title }}
|
||||
<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="deleteSession(item)">
|
||||
<uni-icons type="trash" size="24" color="#FF4444"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class="drawer-row-title" v-else>
|
||||
{{ item.title }}
|
||||
@@ -166,6 +173,21 @@ const changeDialogue = (item) => {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const deleteSession = (item) => {
|
||||
if (item.sessionId) {
|
||||
uni.showModal({
|
||||
content: '确认删除该会话?',
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
await useChatGroupDBStore().deleteSession(item.sessionId);
|
||||
$api.msg('会话删除成功');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function updateSetting() {
|
||||
$api.msg('该功能正在开发中,敬请期待后续更新!');
|
||||
}
|
||||
@@ -276,6 +298,11 @@ footer-height = 147rpx
|
||||
overflow:hidden; //超出的文本隐藏
|
||||
text-overflow:ellipsis; //溢出用省略号显示
|
||||
white-space:nowrap; //溢出不换行
|
||||
.drawer-row-content
|
||||
display: flex
|
||||
align-items: center
|
||||
justify-content: space-between
|
||||
width: 100%
|
||||
.drawer-row-title
|
||||
color: #A6A6A6;
|
||||
font-weight: 500;
|
||||
@@ -285,6 +312,7 @@ footer-height = 147rpx
|
||||
margin-top: 75rpx
|
||||
margin-bottom: 24rpx
|
||||
.drawer-row-list
|
||||
flex: 1
|
||||
height: 99rpx;
|
||||
line-height: 99rpx
|
||||
font-size: 42rpx
|
||||
@@ -293,6 +321,12 @@ footer-height = 147rpx
|
||||
font-weight: 500;
|
||||
color: #595959;
|
||||
padding: 0 36rpx
|
||||
.drawer-row-delete
|
||||
padding: 0 18rpx
|
||||
height: 99rpx
|
||||
display: flex
|
||||
align-items: center
|
||||
justify-content: center
|
||||
.drawer-row-active
|
||||
.drawer-row-list:active
|
||||
color: #333333;
|
||||
|
||||
Reference in New Issue
Block a user