This commit is contained in:
yanran200730
2022-05-25 14:49:48 +08:00
parent 409a7ffb34
commit 4629399692
3 changed files with 10 additions and 18 deletions

View File

@@ -5,7 +5,7 @@
<span>*选择水印后相册只能上传该水印照片</span>
</div>
<div class="cell-group">
<div class="cell-item" hover-class="bg-hover" @click="currIndex = 0, checkedList = []">
<div class="cell-item" hover-class="bg-hover" @click="currIndex = 0, chooseIndex = -1">
<div class="cell-item__left">
<h2>不限</h2>
</div>
@@ -22,8 +22,8 @@
<h2>水印库</h2>
</div>
<div class="watermark-list" v-if="currIndex === 1">
<div class="item" @click="checked(item.id)" v-for="(item, index) in list" :key="index" :class="[checkedList.includes(item.id) ? 'active' : '']">
<image class="checked" v-if="checkedList.includes(item.id)" src="./images/xuanzhong.png" />
<div class="item" @click="chooseIndex = index" v-for="(item, index) in list" :key="index" :class="[chooseIndex === index ? 'active' : '']">
<image class="checked" v-if="chooseIndex === index" src="./images/xuanzhong.png" />
<image class="watermark" :src="item.thum" mode="aspectFill" />
</div>
</div>
@@ -42,8 +42,8 @@
return {
currIndex: 0,
config,
checkedList: [],
list: [],
chooseIndex: -1,
pageShow: false
}
},
@@ -51,7 +51,7 @@
onLoad (query) {
if (query.value) {
this.currIndex = 1
this.checkedList = query.value.split(',')
this.chooseIndex = query.value ? Number(query.value) : -1
}
this.getList()
@@ -60,7 +60,7 @@
methods: {
getList () {
this.$loading()
this.$http.post(`/api/appalbumtemplate/list?size=100&status=1`).then(res => {
this.$http.post(`/api/appalbumtemplate/list?size=1000&status=1`).then(res => {
if (res.code === 0) {
this.list = res.data.records
}
@@ -74,20 +74,11 @@
save () {
uni.$emit('change', {
type: 'watermark',
value: this.checkedList.length ? this.checkedList.join(',') : ''
value: this.chooseIndex > -1 ? this.chooseIndex : ''
})
uni.navigateBack({
delta: 1
})
},
checked (type) {
const i = this.checkedList.indexOf(type)
if (i > -1) {
this.checkedList.splice(i, 1)
} else {
this.checkedList.push(type)
}
}
}
}