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

165 lines
3.4 KiB
Vue
Raw Normal View History

2022-03-14 16:06:16 +08:00
<template>
<div class="photo">
2022-05-26 11:33:30 +08:00
<div class="photo-wrapper">
<image mode="widthFix" :src="img" />
</div>
2022-03-14 16:06:16 +08:00
<div class="photo-footer">
2022-05-19 14:43:42 +08:00
<div class="item" @click="back">
<image src="./images/fanhui.png" />
<span>返回</span>
</div>
2022-05-24 11:14:29 +08:00
<!-- <div class="item" @click="share">
2022-03-14 16:06:16 +08:00
<image src="./images/fenxiang.png" />
<span>分享</span>
2022-05-24 11:14:29 +08:00
</div> -->
2022-05-19 14:43:42 +08:00
<div class="item" @click="remove">
2022-03-14 16:06:16 +08:00
<image src="./images/shanchu.png" />
<span>删除</span>
</div>
</div>
</div>
</template>
<script>
2022-05-24 11:14:29 +08:00
import {mapActions} 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: '',
id: ''
2022-03-14 16:06:16 +08:00
}
},
2022-05-19 14:43:42 +08:00
onLoad (query) {
this.id = query.id
this.img = query.url
2022-03-14 16:06:16 +08:00
},
methods: {
2022-05-24 11:14:29 +08:00
...mapActions(['wxInvoke']),
2022-03-14 16:06:16 +08:00
back () {
uni.navigateBack({
delta: 1
})
2022-05-19 14:43:42 +08:00
},
2022-05-24 11:14:29 +08:00
share () {
uni.showActionSheet({
itemList: ['分享', '微信分享'],
success: data => {
if (data.tapIndex === 0 || data.tapIndex === 1) {
if (data.tapIndex === 0) {
this.wxInvoke(['shareAppMessage', {
title: this.info.title,
desc: this.info.tableExplain,
link: this.linkUrl,
imgUrl: this.info.headPicture
}, () => {
this.isShow = false
}])
} else {
this.wxInvoke(['shareWechatMessage', {
title: this.info.title,
desc: this.info.tableExplain,
link: this.linkUrl,
imgUrl: this.info.headPicture
}, () => {
this.isShow = false
}])
}
}
}
})
},
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(() => {
})
},
preview (url) {
uni.previewImage({
urls: [url],
current: url
})
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;
}
.photo-wrapper {
display: flex;
align-items: center;
width: 100%;
min-height: 100vh;
padding-bottom: 216px;
& > image {
width: 100%;
}
}
2022-03-14 16:06:16 +08:00
.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;
2022-05-27 11:58:32 +08:00
height: 100%;
2022-03-14 16:06:16 +08:00
text-align: center;
2022-05-27 11:58:32 +08:00
&:active {
background: #000;
}
2022-03-14 16:06:16 +08:00
image {
width: 80px;
height: 80px;
}
span {
font-size: 28px;
color: #fff;
}
}
}
}
2022-05-19 14:43:42 +08:00
</style>