Files
im-system/im-uniapp/wx/tabbar2/index.vue
2023-09-25 19:15:47 +08:00

104 lines
2.1 KiB
Vue

<template>
<view class="xw-book">
<watermark></watermark>
<uni-indexed-list-wx :options="list" @click="bindClick"></uni-indexed-list-wx>
<top-right-tool-wx ref="trtw"></top-right-tool-wx>
</view>
</template>
<script>
export default {
data() {
return {
list: []
}
},
onLoad() {},
onShow() {
this.getflist()
this.$store.dispatch('tabBarpull')
},
methods: {
bindClick(e){
//注释之前的旧代码,直接跳转到里聊天页
/*
uni.navigateTo({
url:'../personInfo/detail?param='+e.item.data.userId
})
*/
uni.navigateTo({
url: '../chatWindow/index?userId=' + e.item.data.userId + '&windowType=' + e.windowType
});
},
getflist(){
//TODO 从接口获取
var list=[
{
name:"测试18200702230",
avatar:"item.portrait",
userId:"18200702230",
userType:"item.userType",
chatNo:"item.chatNo"
},
{
name:"测试18200000000",
avatar:"item.portrait",
userId:"18200000000",
userType:"item.userType",
chatNo:"item.chatNo"
},{
name:"测试18200000001",
avatar:"item.portrait",
userId:"18200000001",
userType:"item.userType",
chatNo:"item.chatNo"
}
]
this.list=this.$fc.sortList({list:list,key:'name'})
this.$http.request({
url: '/friend/friendList',
method: 'POST',
data:JSON.stringify({}),
success: (res) => {
if (res.data.code == 200) {
var data=res.data.data
var list=[]
for (var i = 0; i < data.length; i++) {
var item=data[i]
list.push({
name:item.nickName,
avatar:item.portrait,
userId:item.userId,
userType:item.userType,
chatNo:item.chatNo
})
}
this.list=this.$fc.sortList({list:list,key:'name'})
}
}
});
},
},
onNavigationBarButtonTap(e) {
switch (e.index) {
case 0: //更多
this.$refs['trtw'].showTab();
break;
case 1: //搜索
uni.navigateTo({
url: '../search/index'
});
break;
default:
break;
}
},
}
</script>
<style scoped>
</style>