You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
2.8 KiB
106 lines
2.8 KiB
<template>
|
|
<view>
|
|
<cu-custom bgColor="bg-main-bar" :isBack="true">
|
|
<template #backText></template>
|
|
<template #content>群聊列表</template>
|
|
<template #right>
|
|
<view class="f-20 ml-10 mr-10" @tap="search()">
|
|
<text class="cuIcon-search"></text>
|
|
</view>
|
|
</template>
|
|
</cu-custom>
|
|
<view class="cu-list menu-avatar no-padding">
|
|
<view class="cu-item" v-for="(items,sub) in groupList" :key="sub" @tap='openDetails(items)'>
|
|
<block v-for="(itemse,indexs) in imglist" :key="indexs" v-if="network_log == 'none'">
|
|
<view v-if="items.imgname == itemse.name" class='cu-avatar lg radius mr-15' :style="[{backgroundImage:'url('+ itemse.path +')'}]"></view>
|
|
</block>
|
|
<view v-else class='cu-avatar lg radius mr-15' :style="[{backgroundImage:'url('+items.avatar+')'}]">
|
|
</view>
|
|
<view class="content" style="white-space: pre-wrap;line-break: anywhere;">
|
|
<view class="c-333">{{items.displayName}}</view>
|
|
</view>
|
|
<view class="action">
|
|
<text class="c-999 cuIcon-peoplefill" v-if="items.owner_id==userInfo.user_id"></text>
|
|
</view>
|
|
|
|
</view>
|
|
<Empty v-if="!groupList.length" noDatatext="暂无群聊" textcolor="#999" ></Empty>
|
|
</view>
|
|
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { storeToRefs } from 'pinia';
|
|
import { useMsgStore } from '@/store/message';
|
|
import { useloginStore } from '@/store/login'
|
|
import pinia from '@/store/index'
|
|
// #ifdef APP-PLUS
|
|
import {getSavedImages} from '@/utils/LocalFileSystemURL.js'
|
|
// #endif
|
|
const userStore = useloginStore(pinia);
|
|
const msgStore = useMsgStore(pinia)
|
|
const {contacts,network_log} = storeToRefs(msgStore);
|
|
/**
|
|
* 初始的引导页
|
|
*/
|
|
export default {
|
|
name : "group",
|
|
data() {
|
|
return {
|
|
groupList:[],
|
|
userInfo:userStore.userInfo,
|
|
imglist:[],
|
|
network_log:network_log,
|
|
};
|
|
},
|
|
created() {},
|
|
mounted(){
|
|
this.initContacts(this.msgs);
|
|
// #ifdef APP-PLUS
|
|
this.getImagePath()
|
|
// #endif
|
|
},
|
|
methods: {
|
|
initContacts(arr){
|
|
const allContacts=uni.getStorageSync('allContacts');
|
|
const contacts=allContacts.filter((item)=>{
|
|
return item.is_group==1;
|
|
})
|
|
// 将联系人进行排序
|
|
const sorted = contacts.sort((a, b) => {
|
|
if (a.index === '#') {
|
|
return 1;
|
|
}
|
|
if (b.index === '#') {
|
|
return -1;
|
|
}
|
|
return a.index.localeCompare(b.index, 'zh');
|
|
});
|
|
this.groupList=sorted;
|
|
},
|
|
async getImagePath(){
|
|
this.imglist = await getSavedImages()
|
|
this.imglist.map(item => {
|
|
item.path = plus.io.convertLocalFileSystemURL(item.path)
|
|
});
|
|
// console.info('读取地址',this.imglist);
|
|
},
|
|
// 打开聊天
|
|
openDetails(items){
|
|
uni.navigateTo({
|
|
url:"/pages/message/chat?id="+items.id
|
|
})
|
|
},
|
|
search(){
|
|
uni.navigateTo({
|
|
url:"/pages/index/search?type=3"
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
</style>
|