Files
dvcp_v2_wxcp_app/src/project/caw/AppCountryAlbum/Photo.vue

182 lines
3.7 KiB
Vue
Raw Normal View History

2022-03-14 16:06:16 +08:00
<template>
2022-06-01 10:36:17 +08:00
<div class="photo" v-if="pageShow" @click="isShow = !isShow">
2022-05-26 11:33:30 +08:00
<div class="photo-wrapper">
2022-06-16 16:44:10 +08:00
<image mode="widthFix" :src="img" />
2022-05-26 11:33:30 +08:00
</div>
2022-06-16 10:07:14 +08:00
<div class="photo-bottom" :class="[isShow ? 'active' : '']">
2022-05-31 17:03:35 +08:00
<div class="top">
<h2>查看图片</h2>
<p>长按图片进行分享给他人</p>
2022-06-01 10:54:22 +08:00
<image @click.stop="isShow = false" src="./images/down_boldw.png" />
2022-05-31 17:03:35 +08:00
</div>
<div class="btns">
<div class="btn-item" hover-class="bg-hover" @click="back">
<image src="./images/fanhui-black.png" />
<span>返回</span>
2022-05-31 11:00:29 +08:00
</div>
2022-06-15 17:02:16 +08:00
<div class="btn-item" hover-class="bg-hover" v-if="createUserId === user.openId" @click="remove">
2022-05-31 17:03:35 +08:00
<image src="./images/remove-black.png" />
<span>删除</span>
2022-05-31 11:00:29 +08:00
</div>
2022-05-19 14:43:42 +08:00
</div>
2022-06-16 10:07:14 +08:00
</div>
2022-03-14 16:06:16 +08:00
</div>
</template>
<script>
2022-06-16 16:44:10 +08:00
import { mapState } from 'vuex'
2022-03-14 16:06:16 +08:00
export default {
name: 'Photo',
appName: '相片',
data () {
return {
2022-05-19 14:43:42 +08:00
img: '',
2022-05-31 11:00:29 +08:00
id: '',
2022-06-16 10:07:14 +08:00
isShow: true,
2022-06-02 15:47:15 +08:00
pageShow: false,
createUserId: ''
2022-03-14 16:06:16 +08:00
}
},
2022-06-10 09:32:49 +08:00
computed: {
...mapState(['user'])
},
2022-05-19 14:43:42 +08:00
onLoad (query) {
this.id = query.id
2022-05-31 14:36:03 +08:00
this.$loading()
2022-05-30 16:33:22 +08:00
this.$http.post(`/api/appalbumphoto/queryDetailById?id=${query.id}`).then(res => {
if (res.code == 0) {
this.img = res.data.photoUrl
2022-06-02 15:47:15 +08:00
this.createUserId = res.data.createUserId
2022-05-30 16:33:22 +08:00
}
2022-05-31 14:36:03 +08:00
this.$nextTick(() => {
this.pageShow = true
this.isShow = true
})
2022-05-30 16:33:22 +08:00
})
2022-03-14 16:06:16 +08:00
},
methods: {
back () {
uni.navigateBack({
delta: 1
})
2022-05-19 14:43:42 +08:00
},
remove () {
2022-05-25 14:10:30 +08:00
this.$confirm('确定删除该图片?').then(() => {
2022-05-19 14:43:42 +08:00
this.$http.post(`/api/appalbumphoto/delete?ids=${this.id}`).then(res => {
if (res.code == 0) {
this.$u.toast('删除成功')
uni.$emit('update')
this.back()
}
})
}).catch(() => {
})
2022-03-14 16:06:16 +08:00
}
}
}
</script>
<style lang="scss" scoped>
.photo {
position: relative;
width: 100%;
height: 100vh;
background: #000;
2022-05-26 11:33:30 +08:00
overflow-y: auto;
* {
box-sizing: border-box;
}
2022-05-31 11:00:29 +08:00
.photo-bottom {
2022-05-31 17:03:35 +08:00
position: fixed;
bottom: 0;
left: 0;
z-index: 11;
width: 100%;
transform: translateY(100%);
background: #fff;
border-radius: 32px 32px 0 0;
transition: all ease 0.4s;
&.active {
transform: translateY(0);
}
2022-05-31 11:00:29 +08:00
.top {
2022-03-14 16:06:16 +08:00
display: flex;
2022-05-31 11:00:29 +08:00
position: relative;
2022-03-14 16:06:16 +08:00
align-items: center;
justify-content: center;
2022-05-31 11:00:29 +08:00
flex-direction: column;
height: 96px;
h2 {
font-size: 28px;
color: #333333;
line-height: 40px;
}
2022-03-14 16:06:16 +08:00
2022-05-31 11:00:29 +08:00
p {
color: #999999;
font-size: 24px;
2022-05-27 11:58:32 +08:00
}
2022-03-14 16:06:16 +08:00
image {
2022-05-31 11:00:29 +08:00
position: absolute;
top: 50%;
right: 32px;
z-index: 1;
width: 32px;
height: 32px;
transform: translateY(-50%);
2022-03-14 16:06:16 +08:00
}
2022-05-31 11:00:29 +08:00
}
2022-03-14 16:06:16 +08:00
2022-05-31 11:00:29 +08:00
.btns {
display: flex;
align-items: center;
height: 216px;
div {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
flex: 1;
image {
width: 80px;
height: 80px;
}
span {
color: #333333;
font-size: 28px;
}
2022-03-14 16:06:16 +08:00
}
}
}
2022-05-31 11:00:29 +08:00
.photo-wrapper {
display: flex;
align-items: center;
width: 100%;
min-height: 100vh;
& > image {
width: 100%;
}
}
2022-03-14 16:06:16 +08:00
}
2022-05-19 14:43:42 +08:00
</style>