增加全部/个人页签

This commit is contained in:
aixianling
2022-03-15 17:04:28 +08:00
parent cd8aa29239
commit c39b0aabcf

View File

@@ -1,28 +1,30 @@
<template> <template>
<div class="AppMailList"> <div class="AppMailList">
<AiTopFixed> <AiTopFixed>
<u-search v-model="keyword" :clearabled="false" placeholder="请输入名称、类型或电话" :show-action="false" bg-color="#F5F5F5" search-icon-color="#999" color="#666" @search="getList"></u-search> <u-search v-model="keyword" :clearabled="false" placeholder="请输入名称、类型或电话" :show-action="false" bg-color="#F5F5F5"
search-icon-color="#999" color="#666" @search="getList"></u-search>
<u-tabs :list="tabs" :current="currentTab" @change="handleCurrentTab"/>
</AiTopFixed> </AiTopFixed>
<div class="list-content"> <div class="list-content">
<u-index-list :scrollTop="scrollTop" :index-list="indexList"> <u-index-list :scrollTop="scrollTop" :index-list="indexList">
<div v-for="(letter, index) in indexList" :key="index"> <div v-for="(letter, index) in indexList" :key="index">
<u-index-anchor :index="letter"/> <u-index-anchor :index="letter"/>
<div class="item" v-for="(item, index) in list.filter(e=>e.nameInitials==letter)" :key="index"> <div class="item" v-for="(item, index) in list.filter(e=>e.nameInitials==letter)" :key="index">
<div class="title">{{item.label}}</div> <div class="title">{{ item.label }}</div>
<div class="phone-list"> <div class="phone-list">
<div class="item-info"> <div class="item-info">
<p>{{item.name}}</p> <p>{{ item.name }}</p>
<div class="phone"> <div class="phone">
<span>{{item.type}}</span>{{item.phone}} <span>{{ item.type }}</span>{{ item.phone }}
</div> </div>
</div> </div>
</div> </div>
<img :src="$cdn + 'common/phone.png'" alt="" @click="callPhone(item.phone)" class="phone-icon" > <img :src="$cdn + 'common/phone.png'" alt="" @click="callPhone(item.phone)" class="phone-icon">
</div> </div>
</div> </div>
</u-index-list> </u-index-list>
</div> </div>
<AiEmpty v-if="!list.length" :noPermit="true" /> <AiEmpty v-if="!list.length" :noPermit="true"/>
<div class="footer-btn" @click="toAddList">我添加的</div> <div class="footer-btn" @click="toAddList">我添加的</div>
<AiFixedBtn> <AiFixedBtn>
<div class="addBtn iconfont iconfont-iconfangda" @tap="gotoAdd()"/> <div class="addBtn iconfont iconfont-iconfangda" @tap="gotoAdd()"/>
@@ -31,7 +33,8 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex' import {mapState} from 'vuex'
export default { export default {
name: "AppMailList", name: "AppMailList",
appName: "电话簿", appName: "电话簿",
@@ -44,34 +47,45 @@ export default {
list: [], list: [],
indexList: [], indexList: [],
keyword: '', keyword: '',
currentTab: 0
} }
}, },
computed: { ...mapState(['user']) }, computed: {
mounted() { ...mapState(['user']),
this.getList() tabs() {
uni.$on('updateList', () => { return [
this.getList() {name: "全部", search: {isPublic: 1}},
}) {name: "个人", search: {isPublic: 0, createUserId: this.user.id}}
]
},
currentSearch() {
return this.tabs?.[this.currentTab]?.search || {}
}
}, },
onShow() { onShow() {
document.title = "电话簿" document.title = "电话簿"
this.getList()
}, },
methods: { methods: {
handleCurrentTab(i) {
this.currentTab = i
this.getList()
},
callPhone(phone) { callPhone(phone) {
uni.makePhoneCall({phoneNumber: phone}) uni.makePhoneCall({phoneNumber: phone})
}, },
getList() { getList() {
this.$http.post(`/app/appconvenientaddressbook/list`, null, { this.$http.post(`/app/appconvenientaddressbook/list`, null, {
params: { params: {
isPublic: 1, ...this.currentSearch,
resource: "portal", resource: "portal",
size: 999, size: 999,
name: this.keyword name: this.keyword
} }
}).then(res => { }).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.indexList = [...new Set(res.data.records.map(e=>e.nameInitials))]; this.indexList = [...new Set(res.data.records.map(e => e.nameInitials))];
this.list = res.data.records; this.list = res.data.records;
} }
}) })
@@ -83,7 +97,7 @@ export default {
uni.navigateTo({url: `./myAddList`}) uni.navigateTo({url: `./myAddList`})
}, },
gotoAdd() { gotoAdd() {
uni.navigateTo({ url: './add' }) uni.navigateTo({url: './add'})
} }
}, },
onPageScroll(e) { onPageScroll(e) {
@@ -94,9 +108,10 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.AppMailList { .AppMailList {
::v-deep .fixed{ ::v-deep .fixed {
z-index: 9999; z-index: 9999;
} }
.header-top { .header-top {
display: flex; display: flex;
background: #fff; background: #fff;
@@ -104,8 +119,9 @@ export default {
align-items: center; align-items: center;
padding-top: 16px; padding-top: 16px;
} }
// background-color: #F3F6F9; // background-color: #F3F6F9;
.list-content{ .list-content {
padding-bottom: 112px; padding-bottom: 112px;
// .title{ // .title{
// padding-left: 48px; // padding-left: 48px;
@@ -115,18 +131,21 @@ export default {
// font-weight: 600; // font-weight: 600;
// color: #999; // color: #999;
// } // }
.item{ .item {
position: relative; position: relative;
} }
.phone-list{
.phone-list {
background-color: #fff; background-color: #fff;
width: 100%; width: 100%;
.item-info{
.item-info {
width: 680px; width: 680px;
padding: 32px 48px; padding: 32px 48px;
box-sizing: border-box; box-sizing: border-box;
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.02); box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.02);
p{
p {
font-size: 32px; font-size: 32px;
font-family: PingFangSC-Medium, PingFang SC; font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500; font-weight: 500;
@@ -136,14 +155,16 @@ export default {
margin-bottom: 8px; margin-bottom: 8px;
width: 100%; width: 100%;
} }
.phone{
.phone {
font-size: 26px; font-size: 26px;
font-family: PingFangSC-Regular, PingFang SC; font-family: PingFangSC-Regular, PingFang SC;
color: #333; color: #333;
line-height: 36px; line-height: 36px;
width: 100%; width: 100%;
word-break: break-all; word-break: break-all;
span{
span {
display: inline-block; display: inline-block;
margin-right: 16px; margin-right: 16px;
color: #999; color: #999;
@@ -152,7 +173,8 @@ export default {
} }
} }
} }
.footer-btn{
.footer-btn {
width: 100%; width: 100%;
text-align: center; text-align: center;
height: 112px; height: 112px;
@@ -168,10 +190,12 @@ export default {
color: #FFF; color: #FFF;
z-index: 999; z-index: 999;
} }
::v-deep .u-index-anchor {
top: 0!important; ::v-deep .u-index-anchor {
top: 0 !important;
} }
.phone-icon{
.phone-icon {
width: 40px; width: 40px;
height: 40px; height: 40px;
vertical-align: sub; vertical-align: sub;
@@ -180,9 +204,10 @@ export default {
right: 64px; right: 64px;
} }
::v-deep .u-search{ ::v-deep .u-search {
margin-bottom: 0!important; margin-bottom: 0 !important;
} }
.addBtn { .addBtn {
width: 96px; width: 96px;
height: 96px; height: 96px;