BUG 30927

This commit is contained in:
aixianling
2022-08-18 16:25:06 +08:00
parent 044f0e32ff
commit 09871bc5bd

View File

@@ -4,10 +4,10 @@
<h2>标签列表</h2>
<div class="tags-list">
<div class="item"
v-for="(item, index) in list"
:class="[checked.includes(item.id) ? 'active' : '']"
:key="index"
@click="onClick(item.id)">
v-for="(item, index) in list"
:class="[checked.includes(item.id) ? 'active' : '']"
:key="index"
@click="onClick(item.id)">
{{ item.labelName }}
</div>
</div>
@@ -19,121 +19,126 @@
</template>
<script>
export default {
appName: '居民标签',
export default {
appName: '居民标签',
data () {
return {
currIndex: 0,
list: [],
checked: []
data() {
return {
currIndex: 0,
list: [],
checked: []
}
},
onLoad(query) {
this.getList()
if (query.ids) {
this.checked = query.ids.split(',')
}
},
methods: {
getList() {
this.$loading()
this.$http.post('/app/appresidentlabelinfo/list?size=1000').then((res) => {
if (res.code == 0) {
this.list = res.data.records
}
})
},
onClick(id) {
const index = this.checked.indexOf(id)
if (index === -1) {
this.checked.push(id)
} else {
this.checked.splice(index, 1)
}
},
onLoad (query) {
this.getList()
if (query.ids) {
this.checked = query.ids.split(',')
submit() {
if (!this.checked.length) {
return this.$u.toast('请选择标签')
}
},
methods: {
getList() {
this.$loading()
this.$http.post('/app/appresidentlabelinfo/list?size=1000').then((res) => {
if (res.code == 0) {
this.list = res.data.records
}
})
},
const list = this.list.filter(v => {
return this.checked.includes(v.id)
})
onClick (id) {
const index = this.checked.indexOf(id)
uni.$emit('onChecked', list)
if (index === -1) {
this.checked.push(id)
} else {
this.checked.splice(index, 1)
}
},
submit () {
if (!this.checked.length) {
return this.$u.toast('请选择标签')
}
const list = this.list.filter(v => {
return this.checked.includes(v.id)
})
uni.$emit('onChecked', list)
uni.navigateBack()
}
uni.navigateBack()
}
}
}
</script>
<style lang="scss" scoped>
.tags {
padding: 16px 0 130px;
.tags {
padding: 16px 0 130px;
* {
box-sizing: border-box;
* {
box-sizing: border-box;
}
.add-btn {
position: fixed;
bottom: 0;
left: 0;
z-index: 999;
width: 100%;
height: 112px;
line-height: 112px;
background: #3975C6;
font-size: 32px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #FFF;
div {
text-align: center;
}
}
.add-btn {
position: fixed;
bottom: 0;
left: 0;
z-index: 999;
width: 100%;
height: 112px;
line-height: 112px;
background: #3975C6;
.tags-group {
margin-bottom: 16px;
padding: 0 32px 16px;
background: #fff;
& > h2 {
height: 108px;
line-height: 108px;
color: #333333;
font-size: 32px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #FFF;
div{
text-align: center;
}
}
.tags-group {
margin-bottom: 16px;
padding: 0 32px 16px;
background: #fff;
.tags-list {
display: flex;
flex-wrap: wrap;
line-height: 1;
& > h2 {
height: 108px;
line-height: 108px;
.item {
height: 64px;
line-height: 64px;
margin: 0 16px 16px 0;
padding: 0 32px;
color: #333333;
font-size: 32px;
}
font-size: 28px;
background: #F3F4F7;
border-radius: 4px;
max-width: 100%;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
.tags-list {
display: flex;
flex-wrap: wrap;
line-height: 1;
.item {
height: 64px;
line-height: 64px;
margin: 0 16px 16px 0;
padding: 0 32px;
color: #333333;
font-size: 28px;
background: #F3F4F7;
border-radius: 4px;
&.active {
color: #fff;
background: #1365DD;
}
&.active {
color: #fff;
background: #1365DD;
}
}
}
}
}
</style>