乡村相册

This commit is contained in:
yanran200730
2022-05-18 18:06:39 +08:00
parent 5e92053f60
commit ddc813efd1
18 changed files with 746 additions and 574 deletions

View File

@@ -7,7 +7,7 @@
<span>相册名称</span>
</div>
<div class="right">
<input placeholder="请输入相册名称" placeholder-style="color: #999" />
<input placeholder="请输入相册名称" v-model="albumName" placeholder-style="color: #999" />
</div>
</div>
<div class="form-group__item">
@@ -15,8 +15,8 @@
<label>*</label>
<span>水印</span>
</div>
<div class="right" @click="linkTo('./WatermarkSetting')">
<span>请选择</span>
<div class="right" @click="linkTo('./WatermarkSetting?value=' + watermarkId)">
<span>{{ watermarkId ? '已选择' : '不限' }}</span>
<image src="./images/right.png" />
</div>
</div>
@@ -26,22 +26,22 @@
<span>拍摄人</span>
</div>
<div class="right" @click="linkTo('./PersonnelSetting')">
<span>请选择</span>
<span>{{ createUserId ? '已选择' : '不限' }}</span>
<image src="./images/right.png" />
</div>
</div>
<div class="form-group__item" @click="linkTo('./SourceSetting')">
<div class="form-group__item" @click="linkTo('./SourceSetting?value=' + photoSource)">
<div class="left">
<label>*</label>
<span>照片来源</span>
</div>
<div class="right">
<span>请选择</span>
<span>{{ photoSource == 1 ? '仅限乡村相册拍摄' : '不限' }}</span>
<image src="./images/right.png" />
</div>
</div>
</div>
<div class="form-btn" hover-class="text-hover">保存</div>
<button :loading="isLoading" @click="save" class="form-btn" hover-class="text-hover">保存</button>
</div>
</template>
<script>
@@ -52,12 +52,31 @@
data () {
return {
albumName: '',
createUserId: '',
photoSource: 0,
watermarkId: '',
isLoading: false,
id: ''
}
},
onLoad () {
onLoad (query) {
this.id = query.id || ''
if (query.id) {
this.getInfo(query.id)
}
uni.$on('change', e => {
if (e.type === 'watermark') {
this.watermarkId = e.value
}
if (e.type === 'photoSource') {
this.photoSource = e.value
}
})
},
methods: {
@@ -65,6 +84,50 @@
uni.navigateTo({
url
})
},
getInfo (id) {
this.$http.post(`/api/appalbum/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.info = res.data
this.albumName = res.data.albumName
this.createUserId = res.data.createUserId || ''
this.photoSource = res.data.photoSource || 0
this.watermarkId = res.data.watermarkId || ''
}
})
},
save () {
if (!this.albumName) {
return this.$u.toast('请输入相册名称')
}
this.$loading()
this.$http.post('/api/appalbum/addOrUpdate', {
albumName: this.albumName,
createUserId: this.createUserId,
photoSource: this.photoSource,
watermarkId: this.watermarkId,
id: this.id || ''
}).then(res => {
if (res.code === 0) {
this.$u.toast(this.id ? '编辑成功' : '新建成功')
if (this.id) {
uni.$emit('change')
}
setTimeout(() => {
uni.navigateBack({
delta: 1
})
}, 500)
} else {
this.$hideLoading()
}
})
}
}
}
@@ -197,4 +260,4 @@
}
}
}
</style>
</style>