Files
dvcp_v2_wxcp_app/library/project/fd/AppAnswer/answerDetail.vue
2024-10-31 14:34:57 +08:00

148 lines
2.9 KiB
Vue

<template>
<div class="answerDetail">
<div class="head">
<div class="left">
<img :src="info.createUserAvatar" alt="">
<div class="head_avtar">
<h4>{{ info.createUserName }}</h4>
<div class="col-999">{{ info.createUserDeptName }}</div>
</div>
</div>
<div class="right col-999">{{ info.createTime }}</div>
</div>
<div class="content">
{{ info.content }}
</div>
<div class="picture">
<img :src="item.url" v-for="(item,index) in info.files" :key="index" alt=""
@click="preview(info.files, item.url)">
</div>
<div class="btn_box" v-if="info.createUserId == user.id">
<div class="del" @click="deleteBtn(info.id)">删除</div>
<div class="edit" @click="editBtn()">修改</div>
</div>
</div>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: "answerDetail",
appName: "Ta的回答",
data() {
return {
info: {},
}
},
computed: {
...mapState(['user'])
},
methods: {
editBtn() {
uni.navigateTo({
url: './answerAdd?data=' + JSON.stringify(this.info)
})
},
deleteBtn(id) {
this.$confirm('确定要删除该回答吗?').then(()=> {
this.$http.post(`/app/applearningquestion/deleteAnswer?id=${id}`).then(res=> {
if(res?.code == 0) {
this.$u.toast('删除成功!')
setTimeout(()=> {
uni.navigateBack()
}, 500)
}
})
})
},
preview(images, img) {
uni.previewImage({
urls: images.map(v => v.url),
current: img
})
},
},
onLoad(o) {
this.info = JSON.parse(o.data)
},
}
</script>
<style lang="scss" scoped>
.answerDetail {
padding: 24px 32px 120px 32px;
box-sizing: border-box;
background: #FFF;
.head {
display: flex;
justify-content: space-between;
.left {
display: flex;
width: calc(100% - 280px);
img {
width: 80px;
height: 80px;
margin-right: 16px;
border-radius: 40px;
}
.head_avtar {
max-width: calc(100% - 96px);
}
}
.col-999 {
color: #999999;;
}
}
.content{
width: 100%;
word-break: break-all;
font-size: 28px;
color: #333;
line-height: 44px;
margin-top: 24px;
}
.picture {
margin-top: 24px;
img {
width: 220px;
height: 220px;
margin-right: 8px;
}
}
.btn_box {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 120px;
padding: 16px 32px;
box-sizing: border-box;
display: flex;
background: #f3f5f7;
z-index: 9;
div {
flex: 1;
border-radius: 44px;
text-align: center;
line-height: 88px;
font-size: 34px;
}
.del {
margin-right: 30px;
border: 1px solid #E23C3C;
color: #E23C3C;
}
.edit {
border: 1px solid #3975C6;
color: #3975C6;
}
}
}
</style>