This commit is contained in:
花有清香月有阴
2022-02-15 11:21:11 +08:00
parent da1d271b72
commit ef5c05d1d5

View File

@@ -3,8 +3,7 @@
<div class="areaSelection">
<div class="area">区域选择</div>
<div class="select">
<ai-area-picker ref="area" class="ai-area" :value="areaId" :name.sync="areaName" :areaId="$areaId"
@select="areaSelect">
<ai-area-picker ref="area" class="ai-area" :value="areaId" :name.sync="areaName" :areaId="$areaId" @select="areaSelect">
<div class="ai-area__wrapper">
<span class="label" v-if="areaName">{{ areaName }}</span>
<span v-else>请选择</span>
@@ -16,9 +15,8 @@
<template v-if="list.length">
<u-index-list :scrollTop="scrollTop" :index-list="indexList">
<div v-for="(letter, index) in indexList" :key="index">
<u-index-anchor :index="letter"/>
<div class="item" hover-class="bg-hover" @click="phone(item)"
v-for="(item, index) in list.filter(e=>e.nameInitials==letter)" :key="index">
<u-index-anchor :index="letter" />
<div class="item" hover-class="bg-hover" @click="phone(item)" v-for="(item, index) in list.filter((e) => e.nameInitials == letter)" :key="index">
<label>{{ item.name }}</label>
<div class="info">
{{ item.type }}<span>{{ item.phone }}</span>
@@ -32,11 +30,11 @@
</template>
<script>
import {mapState} from 'vuex'
import { mapState } from 'vuex'
export default {
name: "AppAddressBook",
appName: "便民通讯录",
name: 'AppAddressBook',
appName: '便民通讯录',
data() {
return {
scrollTop: 0,
@@ -49,34 +47,36 @@ export default {
}
},
onLoad() {
this.userInfo = uni.getStorageSync("userInfo");
this.userInfo = uni.getStorageSync('userInfo')
this.areaId = this.$areaId
this.areaName = this.$areaName
this.getList();
this.getList()
},
computed: {
...mapState(['user'])
...mapState(['user']),
},
methods: {
phone({phone: phoneNumber}) {
uni.makePhoneCall({phoneNumber});
phone({ phone: phoneNumber }) {
uni.makePhoneCall({ phoneNumber })
},
getList() {
this.$instance.post("/app/appconvenientaddressbook/list", null, {
params: {
isPublic: 1,
resource: "portal",
areaId: this.areaId,
size: 999
}
}).then(res => {
if (res?.data) {
this.indexList = [...new Set(res.data.records.map(e => e.nameInitials))];
this.list = res.data.records;
}
})
this.$instance
.post('/app/appconvenientaddressbook/list', null, {
params: {
isPublic: 1,
resource: 'portal',
areaId: this.areaId,
size: 999,
},
})
.then((res) => {
if (res?.data) {
this.indexList = [...new Set(res.data.records.map((e) => e.nameInitials))]
this.list = res.data.records
}
})
},
areaSelect(v) {
this.areaId = v
@@ -90,9 +90,8 @@ export default {
},
},
onPageScroll(e) {
this.scrollTop = e.scrollTop;
this.scrollTop = e.scrollTop
},
}
</script>
@@ -105,7 +104,7 @@ export default {
width: 100%;
height: 120px;
line-height: 120px;
background-color: #FFFF;
background-color: #ffff;
.select {
text-align: right;
@@ -115,7 +114,7 @@ export default {
.item {
box-sizing: border-box;
padding: 32px 48px;
background: #FFFFFF;
background: #ffffff;
box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.02);
& > label {