Files
dvcp_v2_wxcp_app/src/project/pidu/AppConversation/AppConversation.vue
2023-06-08 16:48:32 +08:00

207 lines
5.5 KiB
Vue

<template>
<div class="AppConversation">
<AiTopFixed>
<u-tabs :list="tabList" :is-scroll="false" :current="currentTabs" height="96" bg-color="#3975C6"
inactive-color="#A1C1E8" :bar-style="barStyle" :active-item-style="activeStyle" active-color="#ffffff " @change="change">
</u-tabs>
<div class="top-search">
<div class="left">
<u-search v-model="keyword" :clearabled="true" placeholder="请输入昵称" :show-action="false" bg-color="#F5F5F5"
search-icon-color="#999" color="#999" height="58" @search="getListInit" @clear="getListInit">
</u-search>
</div>
</div>
<div class="top-select">
<div class="item">
<AiAreaPicker v-model="areaId" :areaId="user.areaId" @select="areaSelect" :name.sync="areaName" style="color: #666" selectRoot>
<span style="margin-left: 4px" v-if="areaName">{{ areaName }}</span>
<span v-else style="color:#999;">行政区划</span>
<u-icon name="arrow-down" color="#999" size="28" style="margin-left: 4px" />
</AiAreaPicker>
</div>
<div class="item">
<AiPagePicker type="dept" :selected.sync="deptUserList" nodeKey="id" single @select="deptSelect">
<span class="label" v-if="deptUserList.length">{{deptUserList[0].name}}</span>
<span v-else style="color:#999;">部门名称</span>
<u-icon name="arrow-down" color="#999" size="24" style="margin-left:8px;"/>
</AiPagePicker>
</div>
</div>
</AiTopFixed>
<div class="user-list" v-if="list.length">
<div class="item" v-for="(item, index) in list" :key="index" @click="toDetail(item)">
<img :src="item.toUserAvatar" alt="" v-if="currentTabs == 1">
<p v-if="currentTabs == 1">{{item.toUserName}}</p>
<img src="./img/group-img.png" alt="" v-if="currentTabs != 1">
<p v-if="currentTabs != 1">{{item.roomName}}</p>
</div>
</div>
<AiEmpty v-else/>
</div>
</template>
<script>
import {mapState} from "vuex";
export default {
name: "AppConversation",
appName: "会话存档",
data() {
return {
tabList: [
{name: '群聊会话'},
{name: '私聊会话'},
],
currentTabs: 0,
barStyle: {
'width': '24px',
'height': '2px',
'border-radius': '0',
'bottom': '5px'
},
activeStyle: {
'font-weight' : '400',
},
keyword: '',
areaId: '',
areaName: '',
current: 1,
pages: 2,
list: [],
deptUserList: []
};
},
computed: {
...mapState(['user']),
},
onLoad() {
this.areaId = this.user.areaId
this.areaName = this.user.areaName
// this.deptUserList = [{id: this.user.departId, name: this.user.departName}]
this.getList()
},
onShow() {
},
methods: {
change(index) {
this.keyword = ''
this.currentTabs = index
this.getListInit()
},
getListInit() {
this.current = 1
this.pages = 2
this.list = []
this.getList()
},
areaSelect(e) {
this.areaId = e
this.getListInit()
},
deptSelect(e) {
this.deptUserList = e
this.getListInit()
},
getList() {
if(this.current > this.pages) return
this.$http.post(`/app/appsessionarchiveindex/listByUser`, null, {
params: {
current: this.current,
size: 10,
type: this.currentTabs == 1 ? 0 : 1,
areaId: this.areaId,
toUserName: this.currentTabs == 1 ? this.keyword : '',
roomName: this.currentTabs == 1 ? '' : this.keyword,
departmentId: this.deptUserList.length ? this.deptUserList[0].id : ''
}
}).then(res=> {
if(res?.data) {
this.list = this.current > 1 ? [...this.list, ...res.data.records]: res.data.records
this.pages = res.data.pages
}
})
},
toDetail(row) {
var query = row.type == 1 ? `?roomId=${row.roomId}` : `?toUserId=${row.toUserId}`
uni.navigateTo({ url: `./conversationDetail${query}&type=${row.type}`})
}
},
onReachBottom() {
this.current ++
this.getList()
}
};
</script>
<style lang="scss" scoped>
.AppConversation {
height: 100%;
::v-deep .AiTopFixed {
.placeholder {
.content {
padding: 0 !important;
}
}
.fixed {
margin: 0 !important;
.content {
padding: 0 !important;
}
}
}
.top-search {
padding: 20px 32px;
display: flex;
.left {
width: 100%;
}
}
.top-select {
display: flex;
padding: 28px 0;
.item {
flex: 1;
padding: 0 8px;
text-align: center;
span {
display: inline-block;
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 28px;
color: #666;
line-height: 40px;
}
}
}
.user-list {
border-top: 1px solid #eee;
background-color: #fff;
.item {
padding: 24px 0 0 32px;
display: flex;
img {
width: 80px;
height: 80px;
border-radius: 50%;
margin-right: 32px;
}
p {
padding-bottom: 32px;
width: calc(100% - 112px);
line-height: 80px;
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 32px;
color: #333;
letter-spacing: 0.3px;
border-bottom: 1px solid #eee;
}
}
.item:nth-last-child(1) {
p {
border-bottom: 0;
}
}
}
}
</style>