Files
dvcp_v2_wxcp_app/src/apps/AppMailList/AppMailList.vue

235 lines
5.9 KiB
Vue
Raw Normal View History

2021-12-21 15:41:51 +08:00
<template>
<div class="AppMailList">
2022-01-20 13:37:21 +08:00
<AiTopFixed>
2022-02-22 11:41:21 +08:00
<!-- <div class="header-top">
2022-01-20 15:30:05 +08:00
<div>区域选择</div>
<AiAreaPicker v-model="areaId" :areaId="user.areaId" @select="areaSelect" :name.sync="areaName">
2022-01-20 13:37:21 +08:00
<span class="label" v-if="areaName">{{ areaName }}</span>
<span v-else>请选择</span>
2022-01-20 15:30:05 +08:00
<u-icon name="arrow-right" color="#666" size="24" style="margin-left:4px;" />
2022-01-20 13:37:21 +08:00
</AiAreaPicker>
2022-02-22 11:41:21 +08:00
</div> -->
<div class="currentLeft-top">
<div class="left">
<AiAreaPicker v-model="areaId" :areaId="user.areaId" @select="areaSelect" :name.sync="areaName">
<span class="label" v-if="areaName">{{ areaName }}</span>
<span v-else>请选择</span>
2022-02-23 17:00:14 +08:00
<u-icon name="arrow-down" color="#666" size="24" style="margin-left: 4px" />
2022-02-22 11:41:21 +08:00
</AiAreaPicker>
</div>
2022-02-22 16:01:59 +08:00
<u-search v-model="keyword" :clearabled="true" placeholder="名称/类型/电话" :show-action="false" bg-color="#F5F5F5" search-icon-color="#ccc" color="#666" height="58" @search="getList" @clear="handerClear"></u-search>
2022-01-20 13:37:21 +08:00
</div>
</AiTopFixed>
2021-12-24 14:35:58 +08:00
<div class="list-content">
<u-index-list :scrollTop="scrollTop" :index-list="indexList">
<div v-for="(letter, index) in indexList" :key="index">
2022-02-23 17:00:14 +08:00
<u-index-anchor :index="letter" />
<div class="item" v-for="(item, index) in list.filter((e) => e.nameInitials == letter)" :key="index">
<div class="title">{{ item.label }}</div>
2021-12-24 14:35:58 +08:00
<div class="phone-list">
<div class="item-info">
2022-02-23 17:00:14 +08:00
<p>{{ item.name }}</p>
2021-12-24 14:35:58 +08:00
<div class="phone">
2022-02-23 17:00:14 +08:00
<span>{{ item.type }}</span
>{{ item.phone }}
2021-12-24 14:35:58 +08:00
</div>
</div>
</div>
2022-02-23 17:00:14 +08:00
<img :src="$cdn + 'common/phone.png'" alt="" @click="callPhone(item.phone)" class="phone-icon" />
2021-12-24 14:35:58 +08:00
</div>
</div>
</u-index-list>
</div>
2022-02-23 17:00:14 +08:00
<AiEmpty v-if="!list.length" />
2021-12-24 14:35:58 +08:00
<!-- <div class="id-list">
<div class="item" v-for="(item, index) in list" :key="index">
<u-index-anchor :index="item.label" />
</div>
</div> -->
<div class="footer-btn" @click="toAddList">我添加的</div>
2021-12-21 15:41:51 +08:00
</div>
</template>
<script>
2021-12-24 14:35:58 +08:00
import { mapState } from 'vuex'
2021-12-21 15:41:51 +08:00
export default {
2022-02-23 17:00:14 +08:00
name: 'AppMailList',
appName: '便民通讯录',
2021-12-24 14:35:58 +08:00
inject: {
2022-02-23 17:00:14 +08:00
root: {},
2021-12-24 14:35:58 +08:00
},
2021-12-21 15:41:51 +08:00
data() {
return {
2021-12-24 14:35:58 +08:00
scrollTop: 0,
list: [],
2022-01-20 13:37:21 +08:00
indexList: [],
areaId: '',
2022-02-22 11:41:21 +08:00
areaName: '',
2022-02-23 17:00:14 +08:00
keyword: '',
2021-12-21 15:41:51 +08:00
}
},
2021-12-24 14:35:58 +08:00
computed: { ...mapState(['user']) },
mounted() {
2022-01-20 13:37:21 +08:00
this.areaId = this.user.areaId
this.areaName = this.user.areaName
2022-01-04 10:11:22 +08:00
this.getList()
uni.$on('updateList', () => {
this.getList()
})
2021-12-24 15:27:36 +08:00
},
onShow() {
2022-02-23 17:00:14 +08:00
document.title = '便民通讯录'
2021-12-24 14:35:58 +08:00
},
2021-12-21 15:41:51 +08:00
methods: {
2022-01-20 13:37:21 +08:00
areaSelect(e) {
this.areaId = e
this.getList()
},
2021-12-24 14:35:58 +08:00
callPhone(phone) {
2022-02-23 17:00:14 +08:00
uni.makePhoneCall({ phoneNumber: phone })
2021-12-24 14:35:58 +08:00
},
2022-02-22 11:41:21 +08:00
handerClear() {
this.keyword = ''
this.getList()
},
2021-12-24 14:35:58 +08:00
getList() {
2022-02-23 17:00:14 +08:00
this.$http
.post(`/app/appconvenientaddressbook/list`, null, {
params: {
areaId: this.areaId,
isPublic: 1,
resource: 'portal',
size: 999,
name: this.keyword,
},
})
.then((res) => {
if (res.code == 0) {
this.indexList = [...new Set(res.data.records.map((e) => e.nameInitials))]
this.list = res.data.records
}
})
2021-12-24 14:35:58 +08:00
},
toAddList() {
// this.$emit('change', {
// type: 'MyAddList',
// })
2022-02-23 17:00:14 +08:00
uni.navigateTo({ url: `./myAddList` })
2021-12-24 14:35:58 +08:00
},
2021-12-21 15:41:51 +08:00
},
2021-12-24 14:35:58 +08:00
onPageScroll(e) {
2022-02-23 17:00:14 +08:00
this.scrollTop = e.scrollTop
},
2021-12-21 15:41:51 +08:00
}
</script>
<style lang="scss" scoped>
2021-12-24 14:35:58 +08:00
.AppMailList {
2022-02-23 17:00:14 +08:00
::v-deep .fixed {
2022-01-20 13:37:21 +08:00
z-index: 9999;
}
2022-01-20 15:30:05 +08:00
.header-top {
display: flex;
background: #fff;
justify-content: space-between;
align-items: center;
padding-top: 16px;
2022-01-20 13:37:21 +08:00
}
2021-12-30 19:12:56 +08:00
// background-color: #F3F6F9;
2022-02-23 17:00:14 +08:00
.list-content {
2021-12-24 14:35:58 +08:00
padding-bottom: 112px;
// .title{
// padding-left: 48px;
// line-height: 64px;
// font-size: 26px;
// font-family: PingFangSC-Semibold, PingFang SC;
// font-weight: 600;
// color: #999;
// }
2022-02-23 17:00:14 +08:00
.item {
2021-12-24 14:35:58 +08:00
position: relative;
}
2022-02-23 17:00:14 +08:00
.phone-list {
2021-12-24 14:35:58 +08:00
background-color: #fff;
width: 100%;
2022-02-23 17:00:14 +08:00
.item-info {
2021-12-24 14:35:58 +08:00
width: 680px;
padding: 32px 48px;
box-sizing: border-box;
2022-02-22 11:41:21 +08:00
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.02);
2022-02-23 17:00:14 +08:00
p {
2021-12-24 14:35:58 +08:00
font-size: 32px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #333;
line-height: 44px;
word-break: break-all;
margin-bottom: 8px;
width: 100%;
}
2022-02-23 17:00:14 +08:00
.phone {
2021-12-24 14:35:58 +08:00
font-size: 26px;
font-family: PingFangSC-Regular, PingFang SC;
color: #333;
line-height: 36px;
width: 100%;
word-break: break-all;
2022-02-23 17:00:14 +08:00
span {
2021-12-24 14:35:58 +08:00
display: inline-block;
margin-right: 16px;
color: #999;
}
}
}
}
}
2022-02-23 17:00:14 +08:00
.footer-btn {
2021-12-24 14:35:58 +08:00
width: 100%;
text-align: center;
height: 112px;
line-height: 112px;
2022-02-23 17:00:14 +08:00
background: #3975c6;
box-shadow: 0 1px 0 0 #eeeeee;
2021-12-24 14:35:58 +08:00
position: fixed;
bottom: 0;
left: 0;
font-size: 32px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
2022-02-23 17:00:14 +08:00
color: #fff;
2021-12-24 14:35:58 +08:00
z-index: 999;
}
2022-02-23 17:00:14 +08:00
::v-deep .u-index-anchor {
top: 0 !important;
2021-12-24 14:35:58 +08:00
}
2022-02-23 17:00:14 +08:00
.phone-icon {
2021-12-24 14:35:58 +08:00
width: 40px;
height: 40px;
vertical-align: sub;
position: absolute;
top: 60px;
right: 64px;
2022-02-22 11:41:21 +08:00
}
.currentLeft-top {
display: flex;
align-items: center;
.left {
width: 40%;
display: flex;
align-items: center;
img {
width: 48px;
height: 48px;
}
}
}
2022-02-23 17:00:14 +08:00
::v-deep .u-search {
margin-bottom: 0 !important;
2022-02-22 11:41:21 +08:00
}
2021-12-21 15:41:51 +08:00
}
2022-02-22 11:41:21 +08:00
</style>