增加分享优惠券功能
This commit is contained in:
@@ -16,13 +16,16 @@
|
||||
:key="item.id"
|
||||
@click="toDetail(item)"
|
||||
>
|
||||
<view class="u-flex">
|
||||
<view class="u-flex avatar">
|
||||
<up-avatar
|
||||
size="118rpx"
|
||||
:src="item.avatar"
|
||||
shape="square"
|
||||
round="8rpx"
|
||||
></up-avatar>
|
||||
<view class="bandage" v-if="item.unread_count > 0">{{
|
||||
item.unread_count >= 99 ? "99" : item.unread_count
|
||||
}}</view>
|
||||
</view>
|
||||
<view class="u-flex-1 u-flex u-row-between u-p-l-14">
|
||||
<view style="max-width: 364rpx">
|
||||
@@ -48,23 +51,25 @@ const list = ref([]);
|
||||
|
||||
async function getList() {
|
||||
const res = await chatApi.messageSessionList({});
|
||||
list.value = (res.list || []).filter(v=>!v.is_del)
|
||||
list.value = (res.list || []).filter((v) => !v.is_del);
|
||||
}
|
||||
|
||||
async function clearAllmsg() {
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "确定要清空所有消息吗?",
|
||||
content: "确定要清空所有未读消息吗?",
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
const res = await chatApi.clearAllmsg({});
|
||||
const res = await chatApi.messageMarkReadAll({session_ids: list.value.map(v=>v.session_id).join(',')});
|
||||
if (res) {
|
||||
uni.showToast({
|
||||
title: "清空成功",
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
getList();
|
||||
setTimeout(() => {
|
||||
getList();
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -72,10 +77,21 @@ async function clearAllmsg() {
|
||||
}
|
||||
|
||||
function toDetail(item) {
|
||||
go.to("PAGES_CHAT_CHAT", { group_id: item.group_id,session_id: item.session_id });
|
||||
go.to("PAGES_CHAT_CHAT", {
|
||||
group_id: item.group_id,
|
||||
session_id: item.session_id,
|
||||
});
|
||||
}
|
||||
|
||||
onShow(getList);
|
||||
const messageUnreadCount = ref(0);
|
||||
onShow(() => {
|
||||
getList();
|
||||
// 获取未读消息总数
|
||||
chatApi.messageUnreadCount({}).then((res) => {
|
||||
console.log(res);
|
||||
messageUnreadCount.value = res.total;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -94,6 +110,25 @@ onShow(getList);
|
||||
background-color: #fff;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 16rpx;
|
||||
.avatar {
|
||||
position: relative;
|
||||
.bandage {
|
||||
position: absolute;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 50%;
|
||||
background: #ff1c1c;
|
||||
font-size: 24rpx;
|
||||
color: #ffffff;
|
||||
width: 38rpx;
|
||||
height: 38rpx;
|
||||
text-align: center;
|
||||
line-height: 38rpx;
|
||||
right: -10rpx;
|
||||
top: -10rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user