居民活动

This commit is contained in:
花有清香月有阴
2021-12-17 11:55:28 +08:00
parent 65bcb8bc7c
commit a48554d9f9
6 changed files with 1070 additions and 312 deletions

View File

@@ -1,52 +1,149 @@
<template>
<div class="page" v-if="pageShow">
<div class="header">
<div class="user-info">
<image class="user-name-bg" :src="info.avatar" />
<div class="info">
<div>{{ info.name }}</div>
<p>{{ info.createTime }}<span v-if="info.userId == user.id" @click="del">删除帖子</span></p>
</div>
<div class="page">
<div class="header-content">
<div class="header-top">
<img :src="detail.url" alt="" />
</div>
<p class="text-content">{{ info.content }}</p>
<div class="img-list" v-if="info.images.length">
<img :src="item.url" :key="index" v-for="(item, index) in info.images" @click.stop="previewImage(info.images, item.url)" />
</div>
</div>
<div class="reply-list">
<div class="item" v-for="(item, index) in info.replyList" :key="index" @click="replyClick(item)">
<div class="user-img">
<img :src="item.headPortrait" alt="" />
</div>
<div class="item-info">
<div class="user-info">
<span class="user-name">{{ item.createUserName }}</span>
<span class="time">{{ item.createTime }}</span>
<div class="header-middle">
<div class="img-title">{{ detail.title }}</div>
<div class="header-middle-bottom">
<div class="left">
<div class="left-btn" :class="'status' + detail.status">{{ $dict.getLabel('newActivityStatus', detail.status) }}</div>
</div>
<p class="text">
<span v-if="item.lastReplyName"
>回复<span class="color-365D92">{{ item.lastReplyName }}</span></span
>{{ item.content }}
</p>
<div class="right">
<img :src="detail.avatar" alt="" />
<span>{{ detail.createUserName }}</span>
</div>
</div>
<div class="cards">
<div class="cards-left">活动时间</div>
<div class="cards-right">{{ detail.beginTime }}-{{ detail.endTime }}</div>
</div>
<div class="cards">
<div class="cards-left">活动人数</div>
<div class="cards-right" @click="toSignUser()">
<span>
<span :style="{ color: detail.realNum == detail.total ? '#FF4466 ' : '#1C6BDF' }">{{ detail.realNum || 0 }}</span>
<span v-if="detail.total != 0">/{{ detail.total }}</span>
<span v-else>/不限</span>
</span>
<u-icon name="arrow-right" color="#DDDDDD" size="28" style="margin-left: 8px"></u-icon>
</div>
</div>
<div class="cards">
<div class="cards-left">活动地点</div>
<div class="cards-right" style="width: 75%; text-align: right">{{ detail.address }}</div>
</div>
</div>
<div class="header-bottom">
<!-- v-if="detail.status == 1 || detail.status == 2 || detail.status == 3" -->
<div class="tab-title">
<span :class="current == 0 ? 'active' : ''" @click="change(0)">活动详情</span>
<span :class="current == 1 ? 'active' : ''" @click="change(1)">活动动态</span>
</div>
<!-- <div class="info-title" v-else>活动详情</div> -->
<div class="content-details" v-if="current == 0">
<div v-html="detail.content"></div>
</div>
<div class="content-trends" v-if="current == 1">
<div class="details" v-if="activeList.length > 0">
<div class="card" v-for="(item, index) in activeList" :key="index" @click="toDetail(item.id)">
<div class="card-nav">
<div class="avatar">
<img :src="item.avatar" alt="" style="width: 100%; height: 100%" v-if="item.avatar" />
<span v-else>
<span v-if="item.name">{{ item.name.substring(item.name.length, item.name.length - 2) }}</span>
</span>
</div>
<div class="right">
<span class="name">{{ item.name }}</span>
<span class="time">{{ item.createTime }}</span>
</div>
</div>
<div class="card-font">
{{ item.content }}
</div>
<div class="card-img">
<img :src="e.url" v-for="(e, i) in imgList[index]" :key="i" alt="" @click.stop="previewImage(info.images, item.url)" />
</div>
<div class="card-icon">
<div>
<i class="iconfont">&#xe69d;</i>
<span>{{ item.viewNum ? item.viewNum : 0 }}</span>
</div>
<div>
<i class="iconfont">&#xe6a2;</i>
<span>{{ item.replyNum ? item.replyNum : 0 }}</span>
</div>
<div>
<i class="iconfont">&#xe698;</i>
<span>{{ item.supportNum ? item.supportNum : 0 }}</span>
</div>
</div>
</div>
<div class="card-bottom"></div>
</div>
<AiEmpty v-else />
</div>
</div>
</div>
<div class="reply-bottom">
<div class="input" @click="showReply = true">我来说两句</div>
<div class="support" @click="support()">
<!-- <AiIcon icon="iconpraiseactive2x" size="18" v-if="info.mySupport == 1" style="vertical-align: middle" />
<i class="iconfont" v-else>&#xe698;</i> -->
</div>
<div class="addicon" @click="toPublicPage()">
<u-icon name="plus" color="#1365DD" size="50"></u-icon>
</div>
<div class="btn" v-if="detail.status == 0 && detail.createUserId == user.partyId">
<div class="edit" @click="editActive">编辑</div>
<div class="public" style="background: #3671ee" @click="changeStatus(1, '是否发布?')">发布活动</div>
</div>
<div class="btn" v-if="detail.realNum < detail.total && detail.status == 1 && detail.myReport == 0">
<div class="edit" @click="callPhone(detail.contactPhone)">电话咨询</div>
<div class="public" style="background: #3671ee" @click="changeStatus(2, '是否报名?')">立即报名</div>
</div>
<div class="btn" v-if="detail.status == 1 && detail.myReport == 0 && detail.total == 0">
<div class="edit" @click="callPhone(detail.contactPhone)">电话咨询</div>
<div class="public" style="background: #3671ee" @click="changeStatus(2, '是否报名?')">立即报名</div>
</div>
<div class="btn" v-if="detail.status == 1 && detail.myReport == 1">
<div class="edit" @click="callPhone(detail.contactPhone)">电话咨询</div>
<div class="public" style="background: #3671ee" @click="changeStatus(3, '是否取消报名?取消报名无法重新报名!')">取消报名</div>
</div>
<div class="btn" v-if="detail.realNum == detail.total && detail.status == 1 && detail.status == 1 && detail.total != 0">
<div class="max">已满员</div>
</div>
<div class="btn" v-if="detail.myReport == 1 && detail.status == 2">
<div class="edit" @click="callPhone(detail.contactPhone)">联系负责人</div>
<div class="public" style="background: #ffd8df; color: #ff4466" v-if="detail.allow1 == 0">未签到</div>
<div class="public" style="background: #3671ee; color: #ffffff" v-if="detail.allow1 == 1" @click="sign(0)">签到</div>
<div class="public" style="background: #cbead9; color: #20bc65" v-if="detail.allow1 == 2">已签到</div>
</div>
<div class="btn" v-if="detail.status == 5">
<div class="edit" @click="callPhone(detail.contactPhone)">联系负责人</div>
<div class="public" style="background: #cbead9; color: #20bc65" v-if="detail.allow2 == 1" @click="sign(1)">离场签到</div>
<div class="public" style="background: #cbead9; color: #20bc65" v-if="detail.allow2 == 2">已离场签到</div>
<div class="public" style="background: #ffd8df; color: #ff4466" v-if="detail.allow2 == 0">未离场签到</div>
</div>
<u-popup v-model="showReply" mode="bottom">
<div class="reply-content">
<u-input v-model.trim="content" type="textarea" :height="144" :auto-height="true" placeholder="写下你的想法…" placeholder-style="color:#999999;font-size:24rpx;" maxlength="1000" />
<div class="btn">
<span class="clear" @click="content = ''">清空内容</span>
<span class="confirm" @click="confirmReply()">发表</span>
</div>
</div>
</u-popup>
</div>
</template>
@@ -60,130 +157,156 @@ export default {
},
data() {
return {
info: {},
pageShow: false,
id: '',
supportFlag: true,
showReply: false,
content: '',
lastReplyId: '',
lastReplyName: '',
detail: {},
activeList: [],
imgList: [],
list: [
{
name: '活动详情',
},
{
name: '活动动态',
},
],
current: 0,
}
},
onLoad(query) {
this.id = query.id
this.getInfo()
uni.$emit('refresh')
onLoad(option) {
this.id = option.id
this.$dict.load(['newActivityStatus']).then(() => {
this.getDetail()
})
},
methods: {
getInfo() {
this.$loading()
this.$http.post(`/app/apppostinfo/queryDetailById?id=${this.id}`).then((res) => {
if (res.code === 0) {
this.info = res.data
getDetail() {
this.$instance.post(`/app/appactivityinfo/queryDetailById?id=${this.id}&partyId=${this.user.partyId}`).then((res) => {
if (res?.data) {
res.data.beginTime = res.data.beginTime.substring(0, 16)
res.data.endTime = res.data.endTime.substring(0, 16)
this.detail = res.data
this.getActiveList()
}
})
},
getActiveList() {
this.$instance.post(`/app/apppostinfo/list?activityId=${this.id}`).then((res) => {
if (res?.data) {
this.activeList = res.data.records
if (res.data.images) {
this.info.images = JSON.parse(res.data.images)
} else {
this.info.images = []
}
if (res.data.replyList.length) {
res.data.replyList.map((item) => {
item.createTime = item.createTime.substring(0, 19)
})
}
uni.setNavigationBarTitle({ title: this.info.userId == this.user.id ? '我的帖子' : 'Ta的帖子' })
this.$nextTick(() => {
this.pageShow = true
})
}
})
},
support() {
if (this.supportFlag) {
this.supportFlag = false
this.$http
.post(`/app/apppostsupport/support`, {
postId: this.id,
createUserId: this.user.partyId,
})
.then((res) => {
if (res.code == 0) {
uni.$emit('refresh')
this.supportFlag = true
if (this.info.mySupport == 1) {
this.info.mySupport = 0
} else {
this.info.mySupport = 1
if (this.activeList) {
let imagesList = []
this.activeList.map((item) => {
if (item.images) {
item.images = JSON.parse(item.images || '[]')
imagesList.push(item.images)
}
}
})
}
},
confirmReply() {
if (!this.content) {
return this.$toast('请输入回复内容')
}
var params = {
postId: this.id,
content: this.content,
createUserId: this.user.partyId,
createUserName: this.user.realName,
headPortrait: this.user.avatarUrl,
lastReplyId: this.lastReplyId ? this.lastReplyId : '',
lastReplyName: this.lastReplyName ? this.lastReplyName : '',
}
this.$http.post(`/app/apppostreply/addOrUpdate`, params).then((res) => {
if (res.code == 0) {
uni.$emit('refresh')
this.$toast('提交成功')
this.lastReplyId = ''
this.lastReplyName = ''
this.content = ''
this.showReply = false
this.getInfo()
return item
})
this.imgList = imagesList
}
}
})
},
replyClick(e) {
change(index) {
this.current = index
},
toPublicPage() {
uni.navigateTo({
url: `./AddPosts?id=${this.id}`,
})
},
editActive() {
uni.navigateTo({ url: `./AddActive?id=${this.id}` })
},
changeStatus(status, text) {
uni.showModal({
title: '提示',
content: `是否回复${e.createUserName}的评论?`,
content: `${text}`,
confirmText: '确定',
success: (res) => {
if (res.confirm) {
uni.$emit('refresh')
this.showReply = true
this.lastReplyId = e.id
this.lastReplyName = e.createUserName
success: (e) => {
if (status == 1) {
//发布
this.changeStatusConfirm(status)
}
if (status == 2) {
//报名
this.report()
}
if (status == 3) {
//取消报名
this.cancelReport()
}
},
})
},
del() {
uni.showModal({
title: '提示',
content: `是否删除该帖子?`,
confirmText: '确定',
success: (res) => {
if (res.confirm) {
this.confirmDel()
cancelReport() {
this.$instance
.post(`/app/appactivityuser/removeReport`, {
activityId: this.id,
partyId: this.user.partyId,
})
.then((res) => {
if (res.code == 0) {
this.$toast('提交成功')
this.getDetail()
}
},
})
})
},
confirmDel() {
this.$http.post(`/app/apppostinfo/delete?id=${this.id}`).then((res) => {
if (res.code == 0) {
this.$toast('删除成功')
setTimeout(() => {
uni.$emit('refresh')
uni.navigateBack({ delta: 1 })
}, 3000)
}
})
changeStatusConfirm(status) {
this.$instance
.post(`/app/appactivityinfo/changeStatus`, {
id: this.id,
status: status,
})
.then((res) => {
if (res.code == 0) {
this.$toast('提交成功')
this.getDetail()
}
})
},
callPhone(phone) {
uni.makePhoneCall({ phoneNumber: phone })
},
report() {
this.$instance
.post(`/app/appactivityuser/report`, {
activityId: this.id,
partyId: this.user.partyId,
name: this.user.realName,
orgId: this.user.partyOrgId,
orgName: this.user.partyOrgName,
phone: this.user.phone,
communityId: this.user.communityId,
})
.then((res) => {
if (res.code == 0) {
this.$toast('报名成功')
this.getDetail()
}
})
},
toSignUser() {
var isAdmin = this.detail.createUserId == this.user.partyId ? 1 : 0
uni.navigateTo({ url: `./SignUser?id=${this.id}&isAdmin=${isAdmin}&status=${this.detail.status}` })
},
sign(status) {
//status 0开始签到 1离场签到
this.$instance
.post(`/app/appactivityuser/sign`, {
activityId: this.id,
partyId: this.user.partyId,
})
.then((res) => {
if (res.code == 0) {
this.$toast(status == 1 ? '离场签到成功' : '签到成功')
this.getDetail()
}
})
},
toDetail(id) {
this.linkTo(`./detail?id=${id}`)
},
previewImage(images, img) {
uni.previewImage({
@@ -194,193 +317,286 @@ export default {
},
}
</script>
<style lang="scss" scoped>
<style scoped lang="scss">
.page {
width: 100%;
height: 100%;
background-color: #f6f7f9;
}
.color-365D92 {
color: #365d92;
}
.header {
background-color: #fff;
padding: 26px 30px 32px;
.user-info {
display: flex;
margin-bottom: 32px;
.user-name-bg {
width: 64px;
height: 64px;
line-height: 64px;
.info-title {
padding-left: 32px;
line-height: 108px;
font-size: 32px;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #333;
}
.tab-title {
line-height: 108px;
font-size: 32px;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #333;
span {
display: inline-block;
width: 192px;
text-align: center;
background: #4e8eee;
font-size: 24px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #fff;
margin-right: 16px;
border-radius: 50%;
}
.info {
div {
font-size: 26px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #333;
line-height: 26px;
margin-bottom: 10px;
}
p {
font-size: 22px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #999;
line-height: 22px;
}
span {
color: #3376fd;
margin-left: 16px;
}
.active {
color: #3671ee;
border-bottom: 4px solid #3671ee;
}
}
.text-content {
font-size: 26px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #333;
line-height: 42px;
word-break: break-all;
.status0 {
background: #000;
}
.img-list {
margin-top: 16px;
img {
width: 224px;
height: 224px;
margin-right: 8px;
}
img:nth-of-type(3n) {
margin-right: 0;
}
.status1 {
background: #ff883c;
}
}
.reply-list {
padding: 0 32px 112px;
.item {
display: flex;
padding: 32px 0;
border-bottom: 2px solid #eee;
.user-img {
width: 96px;
height: 96px;
margin-right: 24px;
.status3 {
background: #1aaaff;
}
.status2 {
background: #42d784;
}
.status4,
.status5 {
background: #e4e4e4;
}
.header-content {
padding-bottom: 150px;
.header-top {
width: 100%;
height: 440px;
img {
width: 96px;
height: 96px;
border-radius: 50%;
width: 100%;
height: 100%;
}
}
.item-info {
width: calc(100% - 116px);
}
.user-info {
display: flex;
justify-content: space-between;
margin-bottom: 10px;
.user-name {
font-size: 30px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #365d92;
line-height: 42px;
.header-middle {
padding: 32px 32px 0 32px;
.img-title {
font-size: 36px;
font-weight: 600;
}
.time {
font-size: 22px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #999;
line-height: 42px;
.header-middle-bottom {
display: flex;
justify-content: space-between;
margin-top: 32px;
.left {
.left-btn {
padding: 4px 8px;
border-radius: 8px;
font-size: 26px;
color: #ffffff;
text-align: center;
}
}
.right {
img {
width: 40px;
height: 40px;
border-radius: 50%;
vertical-align: text-top;
margin-right: 8px;
}
}
}
.cards {
display: flex;
justify-content: space-between;
border-bottom: 2px solid #eee;
padding: 36px 0;
line-height: 40px;
font-size: 28px;
.cards-left {
color: #999;
}
.cards-right {
color: #333;
}
}
}
.text {
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
color: #333;
line-height: 40px;
word-break: break-all;
.header-bottom {
background: #fff;
.content-details {
padding: 32px 32px 80px 32px;
.font {
margin-top: 32px;
font-size: 30px;
line-height: 1.5;
}
.font-img {
margin-top: 26px;
width: 100%;
height: 480px;
}
}
.content-trends {
// padding-bottom: 40px;
.details {
.card {
padding: 26px 32px 28px 32px;
.card-nav {
display: flex;
.avatar {
width: 64px;
height: 64px;
line-height: 60px;
background: #4e8eee;
border-radius: 50%;
text-align: center;
font-size: 24px;
font-weight: 500;
color: #ffffff;
margin-right: 16px;
}
.right {
// display: inline;
display: flex;
flex-direction: column;
.name {
font-size: 26px;
font-weight: 500;
}
.time {
font-size: 22px;
color: #999999;
}
}
}
.card-font {
margin-top: 36px;
line-height: 1.6;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
}
.card-img {
margin-top: 16px;
img {
width: 224px;
height: 224px;
margin-right: 8px;
}
img:last-child {
margin-right: 0;
}
}
.card-icon {
display: flex;
justify-content: space-between;
margin-top: 28px;
div {
display: flex;
align-items: center;
span {
font-size: 24px;
}
}
}
}
}
::v-deep .emptyWrap {
// background-color: pink;
padding-bottom: 50px;
}
.noDeatil {
background-color: #f3f6f9;
img {
width: 400px;
height: 240px;
transform: translate(50%, 25%);
padding-bottom: 156px;
}
}
.card-bottom {
height: 20px;
background-color: #f3f6f9;
}
}
}
}
}
.reply-bottom {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 104px;
padding: 22px 30px 24px;
box-sizing: border-box;
background-color: #fff;
font-size: 30px;
font-family: PingFangSC-Regular, PingFang SC;
color: #333;
line-height: 58px;
.input {
display: inline-block;
width: 580px;
height: 58px;
line-height: 58px;
text-align: center;
background: #f0f0f0;
border-radius: 30px;
font-size: 26px;
font-family: PingFangSC-Regular, PingFang SC;
color: #666;
margin-right: 42px;
}
.support {
display: inline-block;
}
.iconfont {
display: inline-block;
width: 36px;
height: 36px;
font-size: 36px;
color: #333;
margin-right: 8px;
}
}
.reply-content {
width: 100%;
padding: 32px;
box-sizing: border-box;
background: #fff;
::v-deep .u-input {
background-color: #f7f7f7 !important;
border-radius: 8px !important;
padding: 24px !important;
font-size: 26px !important;
.addicon {
position: fixed;
bottom: 280px;
right: 30px;
background: #fefefe;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
border-radius: 50%;
padding: 26px 24px 22px 24px;
}
.btn {
position: fixed;
bottom: 0;
width: 100%;
// height: 112px;
background: #f3f6f9;
display: flex;
justify-content: space-between;
padding: 24px 0;
span {
line-height: 64px;
padding: 32px 0;
text-align: center;
.edit {
width: 254px;
height: 92px;
line-height: 92px;
background: #ffffff;
border-radius: 8px;
border: 2px solid #3671ee;
font-size: 34px;
font-weight: 500;
color: #3671ee;
margin-left: 32px;
}
.clear {
font-size: 26px;
font-family: PingFangSC-Regular, PingFang SC;
color: #666;
.public {
width: 400px;
line-height: 92px;
border-radius: 8px;
font-size: 34px;
font-weight: 500;
color: #ffffff;
margin-right: 32px;
}
.confirm {
width: 144px;
height: 64px;
text-align: center;
background: #135ab8;
border-radius: 32px;
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
color: #fff;
.max {
margin: 0 auto;
width: 686px;
height: 92px;
line-height: 92px;
background: #cbddf9;
border-radius: 8px;
font-size: 34px;
font-weight: 500;
color: #ffffff;
}
}
}

View File

@@ -126,8 +126,8 @@
import { mapState } from 'vuex'
export default {
name: 'AppActive',
appName: '居民活动',
name: 'AppActive',
appName: '居民议事',
components: {},
computed: {
...mapState(['user']),