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

430 lines
9.9 KiB
Vue
Raw Normal View History

2022-05-23 15:23:10 +08:00
<template>
<div class="photo">
<div class="photo-top">
2022-05-27 09:48:24 +08:00
<div class="photo-top__middle" @click="isShow = true">
2022-05-23 15:23:10 +08:00
<span>保存至{{ albumName || '默认相册' }}</span>
<image src="./images/to-right.png" />
</div>
</div>
2022-05-26 11:35:49 +08:00
<div class="photo-wrapper">
<image mode="widthFix" :src="img" />
</div>
2022-05-23 15:23:10 +08:00
<div class="photo-footer">
<div class="item" @click="back">
<image src="./images/fanhui.png" />
<span>返回</span>
</div>
<div class="item" @click="upload">
<image src="./images/shangchuan.png" />
<span>上传</span>
</div>
</div>
2022-05-27 09:48:24 +08:00
<u-popup v-model="isShow" :closeable="false" border-radius="32" height="70%" mode="bottom">
<div class="album">
<div class="top">
<span @click="isShow = false">取消</span>
<span @click="onConfirm">确定</span>
</div>
<scroll-view scroll-y class="album-list__wrapper">
<div
class="item"
@click="currIndex = index"
v-for="(item, index) in albumList"
:key="index"
:class="[currIndex === index ? 'active' : '']">
<image class="checked" v-if="currIndex === index" src="./images/xuanzhong.png" />
<image class="icon" v-if="!item.lastPhotoUrl" src="./images/icon.png" />
<image class="img" v-if="item.lastPhotoUrl" :src="item.lastPhotoUrl" mode="aspectFill" />
<div class="item-bottom">
<h2>{{ item.albumName }}</h2>
<div class="item-bottom__info">
<div class="left">
<span>今日新增</span>
<i>{{ item.dayPhtoto }}</i>
<span></span>
</div>
<div class="right">
<image src="./images/zhaopianshuliang.png" />
<span>{{ item.photoTotal || 0 }}</span>
</div>
</div>
</div>
</div>
</scroll-view>
</div>
</u-popup>
2022-05-23 15:23:10 +08:00
</div>
</template>
<script>
export default {
name: 'Photo',
appName: '拼图汇报',
data () {
return {
img: '',
type: '',
albumList: [],
albumName: '',
albumId: '',
templateId: '',
2022-05-27 09:48:24 +08:00
isShow: false,
2022-06-15 16:30:45 +08:00
currIndex: 0,
fileId: ''
2022-05-23 15:23:10 +08:00
}
},
computed: {
defaultValue () {
if (!this.albumList.length) {
return [0]
}
return [this.albumList.map(v => v.value).indexOf(this.albumId)]
}
},
onLoad (query) {
this.img = query.img
this.type = query.type
this.templateId = query.templateId
2022-05-30 17:55:58 +08:00
this.albumId = query.albumId
2022-06-15 16:30:45 +08:00
this.fileId = query.fileId
2022-05-23 15:23:10 +08:00
this.getWatermarkList()
},
methods: {
back () {
uni.navigateBack({
delta: 1
})
},
upload () {
this.$loading()
this.$http.post('/api/appalbumphoto/addOrUpdate', {
albumId: this.albumId,
photoUrl: this.img,
watermarkType: this.type,
templateId: this.templateId
}).then(res => {
if (res.code === 0) {
this.$u.toast('新增成功')
setTimeout(() => {
uni.reLaunch({
2022-06-06 16:09:29 +08:00
url: './AppCountryAlbum'
2022-05-23 15:23:10 +08:00
})
}, 500)
}
uni.hideLoading()
})
},
2022-05-27 09:48:24 +08:00
onConfirm () {
this.albumId = this.albumList[this.currIndex].value
this.albumName = this.albumList[this.currIndex].label
this.isShow = false
2022-05-23 15:23:10 +08:00
},
getWatermarkList () {
this.$http.post('/api/appalbum/list', null, {
parmas: {
size: 1000
}
}).then(res => {
if (res.code === 0) {
this.albumList = res.data.records.map(v => {
return {
2022-05-27 09:48:24 +08:00
...v,
2022-05-23 15:23:10 +08:00
label: v.albumName,
value: v.id
}
})
2022-05-30 17:55:58 +08:00
if (this.albumId) {
this.albumName = this.albumList.filter((v, index) => {
if (v.value === this.albumId) {
this.currIndex = index
}
return v.value === this.albumId
})[0].label
} else {
this.albumName = this.albumList[0].label
this.albumId = this.albumList[0].value
}
2022-05-23 15:23:10 +08:00
}
})
}
}
}
</script>
<style lang="scss" scoped>
.photo {
position: relative;
width: 100%;
height: 100vh;
2022-05-26 11:35:49 +08:00
overflow-y: auto;
2022-05-23 15:23:10 +08:00
background: #000;
2022-05-27 09:48:24 +08:00
* {
box-sizing: border-box;
}
.album {
height: 100%;
overflow: hidden;
.album-list__wrapper {
display: flex;
align-items: center;
flex-wrap: wrap;
justify-content: space-between;
.item {
display: inline-block;
position: relative;
width: 328px;
height: 328px;
margin-bottom: 32px;
box-shadow: 0px 4px 8px 0px rgba(17, 67, 110, 0.1);
border-radius: 16px;
overflow: hidden;
background: #EFF5FA;
&:nth-of-type(2n) {
margin-left: 30px;
}
&.active {
border: 4px solid #2477F1;
}
.img {
width: 100%;
height: 100%;
}
.item-bottom {
position: absolute;
left: 0;
bottom: 0;
z-index: 1;
width: 100%;
padding: 20px 16px 16px;
background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.6) 100%);
box-shadow: 0px 4px 8px 0px rgba(17, 67, 110, 0.1);
& > h2 {
margin-bottom: 14px;
font-size: 32px;
color: #fff;
}
.item-bottom__info {
display: flex;
align-items: center;
justify-content: space-between;
.right {
display: flex;
align-items: center;
justify-content: space-between;
width: 86px;
height: 48px;
padding: 0 8px;
color: #fff;
background: rgba(0, 0, 0, 0.5);
box-shadow: 0px 4px 8px 0px rgba(17, 67, 110, 0.1);
border-radius: 8px;
image {
width: 28px;
height: 28px;
}
span {
font-size: 28px;
}
}
.left {
span {
color: #c6c5c4;
font-size: 28px;
}
i {
padding: 0 3px;
color: #fff;
font-size: 28px;
font-style: normal;
}
}
}
}
& > span {
position: absolute;
left: 16px;
top: 16px;
z-index: 1;
width: 94px;
height: 40px;
line-height: 40px;
text-align: center;
color: #fff;
font-size: 28px;
background: #FF524F;
box-shadow: 0px 4px 8px 0px rgba(17, 67, 110, 0.1);
border-radius: 8px;
}
.checked {
position: absolute;
top: 0;
right: 0;
z-index: 1;
width: 64px;
height: 64px;
}
.icon {
position: absolute;
top: 50%;
left: 50%;
z-index: 1;
width: 80px;
height: 80px;
transform: translate(-50%, -50%);
}
}
}
scroll-view {
height: calc(100% - 96px);
padding: 0 32px;
font-size: 0;
}
.top {
display: flex;
align-items: center;
justify-content: space-between;
height: 96px;
padding: 0 32px;
font-size: 32px;
color: #999;
font-weight: 600;
span:last-child {
color: #222;
}
}
}
2022-05-26 11:35:49 +08:00
.photo-wrapper {
display: flex;
align-items: center;
width: 100%;
min-height: 100vh;
padding-bottom: 216px;
& > image {
width: 100%;
}
}
2022-05-23 15:23:10 +08:00
.photo-top {
display: flex;
position: fixed;
align-items: center;
2022-05-31 11:00:29 +08:00
justify-content: center;
2022-05-23 15:23:10 +08:00
top: 0;
left: 0;
z-index: 11;
width: 100%;
height: 128px;
padding: 0 32px;
background: rgba(0, 0, 0, 0.5);
& > image {
width: 28px;
height: 28px;
}
& > span {
color: #cbcbcb;
font-size: 32px;
}
.photo-top__middle {
display: flex;
align-items: center;
justify-content: center;
2022-05-24 16:31:10 +08:00
width: 400px;
2022-05-23 15:23:10 +08:00
height: 72px;
line-height: 1;
background: #0B111F;
border-radius: 40px;
font-size: 28px;
color: #cbcbcb;
2022-05-24 16:31:10 +08:00
span {
max-width: 70%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
2022-05-23 15:23:10 +08:00
image {
width: 32px;
height: 32px;
margin-left: 16px;
}
}
}
.photo-footer {
display: flex;
position: fixed;
align-items: center;
bottom: 0;
left: 0;
z-index: 1;
width: 100%;
height: 216px;
background: #1E1E21;
.item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
flex: 1;
text-align: center;
image {
width: 80px;
height: 80px;
}
span {
font-size: 28px;
color: #fff;
}
}
}
& > image {
width: 100%;
min-height: calc(100% - 216px);
}
}
</style>