Fix:【商城小程序】消息列表增加删除会话按钮,在聊天框长按的位置弹出删除按钮,点击删除将该条聊天记录删除
This commit is contained in:
@@ -3,17 +3,31 @@
|
|||||||
<view v-if="list.length > 0">
|
<view v-if="list.length > 0">
|
||||||
<view
|
<view
|
||||||
v-for="(item,index) in list"
|
v-for="(item,index) in list"
|
||||||
:key="index" @click="goRoom(item)"
|
:key="index"
|
||||||
class="item flex"
|
class="item"
|
||||||
>
|
>
|
||||||
<image class="cover flex-0" :src="item.store_avatar || webUrl+'/20221114155314348118.png'"/>
|
<u-swipe-action
|
||||||
<view>
|
class="v12-mt-3"
|
||||||
<view class="flex jc-between ai-center">
|
>
|
||||||
<view class="name">{{ item.store_name }}</view>
|
<u-swipe-action-item
|
||||||
<view class="datetime" v-if="item.last_msg">{{ item.last_msg.created_at }}</view>
|
:options="options1"
|
||||||
|
:key="index"
|
||||||
|
@click.stop="removeRoom(item.room_id)"
|
||||||
|
>
|
||||||
|
<view>
|
||||||
|
<view class="v12-justify-between v12-pa-3 flex" @click="goRoom(item)">
|
||||||
|
<image class="cover flex-0" :src="item.store_avatar || webUrl+'/20221114155314348118.png'"/>
|
||||||
|
<view>
|
||||||
|
<view class="flex jc-between ai-center">
|
||||||
|
<view class="name">{{ item.store_name }}</view>
|
||||||
|
<view class="datetime" v-if="item.last_msg">{{ item.last_msg.created_at }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="sub one-t" v-if="item.last_msg">{{ item.last_msg.msg_type===0?item.last_msg.msg_content:'[图片]' }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="sub one-t" v-if="item.last_msg">{{ item.last_msg.msg_type===0?item.last_msg.msg_content:'[图片]' }}</view>
|
</u-swipe-action-item>
|
||||||
</view>
|
</u-swipe-action>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="v4-nodata" v-if="list.length===0">
|
<view class="v4-nodata" v-if="list.length===0">
|
||||||
@@ -32,7 +46,8 @@ export default {
|
|||||||
return {
|
return {
|
||||||
webUrl:this.$VUE_APP_RESOURCES_URL,
|
webUrl:this.$VUE_APP_RESOURCES_URL,
|
||||||
uid: null,
|
uid: null,
|
||||||
list: []
|
list: [],
|
||||||
|
options1: [{text: '删除', style: {color: '#fff', backgroundColor: '#C52733'} }]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: mapGetters(['userInfo']),
|
computed: mapGetters(['userInfo']),
|
||||||
@@ -56,6 +71,27 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
removeRoom(id) {
|
||||||
|
const _this = this
|
||||||
|
uni.showModal({
|
||||||
|
title:'确定删除消息?',
|
||||||
|
success:(res)=>{
|
||||||
|
if(res.confirm) {
|
||||||
|
uni.request({
|
||||||
|
url: _this.$SERVICE_API_URL + '//chat-remove',
|
||||||
|
method: 'POST',
|
||||||
|
data: {room_id: id},
|
||||||
|
success:(res)=>{
|
||||||
|
if(res.data.status_code === 200) {
|
||||||
|
_this.fetchList()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -70,7 +106,6 @@ export default {
|
|||||||
|
|
||||||
.item {
|
.item {
|
||||||
margin-bottom: 24rpx;
|
margin-bottom: 24rpx;
|
||||||
padding: 28rpx 20rpx 24rpx;
|
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user