Files
dvcp_v2_wxcp_app/src/saas/AppCountryAlbum/WatermarkSetting.vue

234 lines
4.9 KiB
Vue
Raw Normal View History

2022-03-09 18:03:11 +08:00
<template>
2022-05-24 16:31:10 +08:00
<div class="WatermarkSetting" v-if="pageShow">
2022-03-11 16:48:38 +08:00
<div class="title">
<h2>水印选择</h2>
<span>*选择水印后相册只能上传该水印照片</span>
</div>
<div class="cell-group">
2022-05-25 14:49:48 +08:00
<div class="cell-item" hover-class="bg-hover" @click="currIndex = 0, chooseIndex = -1">
2022-03-11 16:48:38 +08:00
<div class="cell-item__left">
<h2>不限</h2>
</div>
<div class="cell-item__check" :class="[currIndex === 0 ? 'active' : '']"></div>
</div>
<div class="cell-item" hover-class="bg-hover" @click="currIndex = 1">
<div class="cell-item__left">
<h2>从库中选择水印</h2>
</div>
<div class="cell-item__check" :class="[currIndex === 1 ? 'active' : '']"></div>
</div>
</div>
2022-05-18 18:06:39 +08:00
<div class="title" v-if="currIndex === 1">
2022-03-11 16:48:38 +08:00
<h2>水印库</h2>
</div>
2022-05-18 18:06:39 +08:00
<div class="watermark-list" v-if="currIndex === 1">
2022-05-25 14:49:48 +08:00
<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" />
2022-05-25 14:57:37 +08:00
<image class="watermark" :src="item.thum" mode="scaleToFill" />
2022-03-11 16:48:38 +08:00
</div>
</div>
2022-05-18 18:06:39 +08:00
<div class="form-btn" hover-class="text-hover" @click="save">保存</div>
2022-03-11 16:48:38 +08:00
</div>
2022-03-09 18:03:11 +08:00
</template>
<script>
2022-05-18 18:06:39 +08:00
import { config } from './config'
2022-03-09 18:03:11 +08:00
export default {
2022-03-11 16:48:38 +08:00
name: 'WatermarkSetting',
2022-03-09 18:03:11 +08:00
2022-03-11 16:48:38 +08:00
appName: '水印选择',
2022-03-09 18:03:11 +08:00
data () {
return {
2022-03-11 16:48:38 +08:00
currIndex: 0,
2022-05-18 18:06:39 +08:00
config,
2022-05-24 16:31:10 +08:00
list: [],
2022-05-25 14:49:48 +08:00
chooseIndex: -1,
2022-05-24 16:31:10 +08:00
pageShow: false
2022-03-09 18:03:11 +08:00
}
},
2022-05-18 18:06:39 +08:00
onLoad (query) {
if (query.value) {
this.currIndex = 1
2022-05-25 14:49:48 +08:00
this.chooseIndex = query.value ? Number(query.value) : -1
2022-05-18 18:06:39 +08:00
}
2022-05-24 16:31:10 +08:00
this.getList()
2022-03-09 18:03:11 +08:00
},
methods: {
2022-05-24 16:31:10 +08:00
getList () {
this.$loading()
2022-05-25 14:49:48 +08:00
this.$http.post(`/api/appalbumtemplate/list?size=1000&status=1`).then(res => {
2022-05-24 16:31:10 +08:00
if (res.code === 0) {
this.list = res.data.records
}
this.pageShow = true
this.$hideLoading()
})
},
2022-05-18 18:06:39 +08:00
save () {
uni.$emit('change', {
type: 'watermark',
2022-05-25 16:57:05 +08:00
value: this.chooseIndex > -1 ? String(this.chooseIndex) : ''
2022-05-18 18:06:39 +08:00
})
uni.navigateBack({
delta: 1
2022-03-11 16:48:38 +08:00
})
}
2022-03-09 18:03:11 +08:00
}
}
</script>
<style lang="scss" scoped>
2022-03-11 16:48:38 +08:00
.WatermarkSetting {
padding-bottom: 130px;
* {
box-sizing: border-box;
}
.watermark-list {
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
background: #fff;
padding: 16px;
.item {
2022-05-18 18:06:39 +08:00
display: flex;
2022-03-11 16:48:38 +08:00
position: relative;
2022-05-18 18:06:39 +08:00
align-items: center;
justify-content: center;
2022-03-11 16:48:38 +08:00
margin-bottom: 16px;
width: 352px;
height: 240px;
border-radius: 8px;
font-size: 0;
2022-05-18 18:06:39 +08:00
background: #2A3540;
2022-03-11 16:48:38 +08:00
&.active {
2022-05-18 18:06:39 +08:00
border: 4px solid #2477F1;
2022-03-11 16:48:38 +08:00
}
.checked {
position: absolute;
top: 0;
right: 0;
z-index: 1;
width: 64px;
height: 64px;
}
.watermark {
2022-05-25 14:57:37 +08:00
width: 236px;
2022-05-18 18:06:39 +08:00
height: 200px;
2022-03-11 16:48:38 +08:00
}
&:nth-of-type(2n) {
margin-right: 0;
}
}
}
.form-btn {
position: fixed;
bottom: 0;
left: 0;
z-index: 1;
width: 100%;
height: 112px;
line-height: 112px;
text-align: center;
color: #fff;
font-size: 32px;
background: #1365DD;
&:active {
opacity: 0.8;
}
}
.tips {
line-height: 44px;
margin: 32px;
font-size: 28px;
color: #999999;
white-space: pre-line;
}
2022-03-09 18:03:11 +08:00
2022-03-11 16:48:38 +08:00
.title {
display: flex;
align-items: center;
height: 96px;
padding: 0 32px;
h2 {
font-weight: normal;
color: #666666;
font-size: 32px;
}
span {
margin-left: 16px;
color: #999999;
font-size: 30px;
}
}
.cell-group {
.cell-item {
display: flex;
align-items: center;
justify-content: space-between;
height: 108px;
margin-bottom: 16px;
padding: 0 32px;
background: #FFFFFF;
&:active {
background: #eee;
}
image {
width: 32px;
height: 32px;
}
&:last-child {
margin-bottom: 0;
}
h2 {
margin-bottom: 12px;
color: #333333;
font-size: 32px;
}
p {
color: #999999;
font-size: 28px;
}
.cell-item__check {
flex-shrink: 1;
width: 32px;
height: 32px;
border-radius: 50%;
border: 4px solid #CCCCCC;
transition: all ease 0.3s;
&.active {
border: 10px solid #1365DD;
}
}
}
}
}
2022-05-18 18:06:39 +08:00
</style>