This commit is contained in:
liuye
2021-12-22 11:43:57 +08:00
parent 13b4b7342e
commit 7896d20f35
3 changed files with 37 additions and 60 deletions

View File

@@ -71,6 +71,7 @@ export default {
mounted() { mounted() {
this.$dict.load('yesOrNo').then(() => { this.$dict.load('yesOrNo').then(() => {
if(this.params.id) { if(this.params.id) {
console.log(122)
this.userInfo.id = this.params.id this.userInfo.id = this.params.id
this.getDetail() this.getDetail()
} }

View File

@@ -1,21 +1,28 @@
<template> <template>
<div class="list"> <div class="list">
<div class="list-content"> <div class="list-content">
<div class="item" :id="'id'+item.label" v-for="(item, index) in list" :key="index"> <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" v-for="(item, index) in list.filter(e=>e.nameInitials==letter)">
<div class="title">{{item.label}}</div> <div class="title">{{item.label}}</div>
<div class="phone-list"> <div class="phone-list">
<div class="item-info" v-for="(e, indexs) in item.dataList" :key="indexs"> <div class="item-info">
<p>{{e.name}}</p> <p>{{item.name}}</p>
<div class="phone"> <div class="phone">
<span>{{e.type}}</span>{{e.phone}} <span>{{item.type}}</span>{{item.phone}}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="id-list"> </u-index-list>
<a class="item" :href="'#id'+item.label" v-for="(item, index) in list" :key="index">{{item.label}}</a>
</div> </div>
<!-- <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> <div class="footer-btn" @click="toAddList">我添加的</div>
</div> </div>
</template> </template>
@@ -26,7 +33,9 @@ export default {
data() { data() {
return { return {
scrollTop: 0,
list: [], list: [],
indexList: []
} }
}, },
computed: { ...mapState(['user']) }, computed: { ...mapState(['user']) },
@@ -35,6 +44,9 @@ export default {
}, },
methods: { methods: {
idClick(id) {
document.getElementById('#id'+id).scrollIntoView();
},
getList() { getList() {
this.$http.post(`/app/appconvenientaddressbook/list`, null, { this.$http.post(`/app/appconvenientaddressbook/list`, null, {
params: { params: {
@@ -42,28 +54,8 @@ export default {
} }
}).then(res => { }).then(res => {
if (res.code == 0) { if (res.code == 0) {
var list = [] this.indexList = [...new Set(res.data.records.map(e=>e.nameInitials))];
var data = [] this.list = res.data.records;
res.data.records.map((item) => {
if(list.indexOf(item.nameInitials)) {
list.push(item.nameInitials)
}
})
list.map((item) => {
var obj = {
label: item,
dataList: []
}
data.push(obj)
})
data.map((item, index) => {
res.data.records.map((items) => {
if(item.label == items.nameInitials) {
data[index].dataList.push(items)
}
})
})
this.list = data
} }
}) })
}, },
@@ -81,14 +73,14 @@ export default {
background-color: #F3F6F9; background-color: #F3F6F9;
.list-content{ .list-content{
padding-bottom: 112px; padding-bottom: 112px;
.title{ // .title{
padding-left: 48px; // padding-left: 48px;
line-height: 64px; // line-height: 64px;
font-size: 26px; // font-size: 26px;
font-family: PingFangSC-Semibold, PingFang SC; // font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600; // font-weight: 600;
color: #999; // color: #999;
} // }
.phone-list{ .phone-list{
background-color: #fff; background-color: #fff;
width: 100%; width: 100%;
@@ -120,22 +112,6 @@ export default {
} }
} }
} }
.id-list{
width: 50px;
text-align: center;
position: fixed;
top: 160px;
right: 32px;
z-index: 99;
.item{
display: block;
font-size: 24px;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #CCC;
line-height: 40px;
}
}
.footer-btn{ .footer-btn{
width: 100%; width: 100%;
text-align: center; text-align: center;
@@ -152,8 +128,8 @@ export default {
color: #FFF; color: #FFF;
z-index: 999; z-index: 999;
} }
a { ::v-deep .u-index-anchor {
text-decoration: none; top: 0!important;
} }
} }
</style> </style>

View File

@@ -9,7 +9,7 @@
</div> </div>
</div> </div>
<div class="right"> <div class="right">
<img src="./img/edit-icon.png" alt="" @click="edit(item)"> <img src="./img/edit-icon.png" alt="" @click="edit(item.id)">
<img src="./img/del-icon.png" alt="" @click="del(item)"> <img src="./img/del-icon.png" alt="" @click="del(item)">
</div> </div>
</div> </div>