Files
dvcp_v2_wechat_app/src/mods/AppVillager/AppVillager.vue

592 lines
15 KiB
Vue
Raw Normal View History

2022-02-16 20:37:46 +08:00
<template>
2022-02-18 18:34:57 +08:00
<div class="Page" v-if="showPage">
2022-02-18 09:36:31 +08:00
<u-tabs class="u-tabs1" :list="tabs" :is-scroll="false" :current="tabIndex0" @change="change" bg-color="#197df0" style="width: 50%" active-color="#FFF;" inactive-color="#FFF"></u-tabs>
2022-02-16 20:37:46 +08:00
<div class="top">
2022-02-18 09:36:31 +08:00
<div class="tabIndex012" v-if="tabIndex0 != 3">
2022-02-18 11:05:14 +08:00
<div class="tags" @click="show = true">{{ TopicName }}</div>
<u-select v-model="show" :list="$dict.getDict('villagerCircleTopic')" value-name="dictValue" label-name="dictName" @confirm="conTopic"></u-select>
2022-02-16 20:37:46 +08:00
</div>
2022-02-18 09:36:31 +08:00
<u-tabs class="u-tabs2" :list="tabList" :is-scroll="false" :current="tabCurrent1" @change="changetabIndex" bg-color="#fff" active-color="#333;" inactive-color="#999" v-if="tabIndex0 == 3"></u-tabs>
2022-02-16 20:37:46 +08:00
2022-02-18 09:36:31 +08:00
<div class="indexTab22" v-if="tabIndex0 == 3">
<div class="tags" v-for="(e, i) in itemList" :key="i" :class="indexTab2 == i ? 'active' : 'noactive'" @click="hander(i)">{{ e.name }}</div>
2022-02-16 20:37:46 +08:00
</div>
</div>
<div class="middle">
<div class="datas" v-if="data.length">
2022-02-18 11:05:14 +08:00
<div class="card" v-for="(item, index) in data" :key="index" @click="toDetail(item)">
2022-02-16 20:37:46 +08:00
<div class="cardTop">
2022-02-18 15:45:31 +08:00
<img :src="item.avatarUrl || user.avatarUrl" alt="" />
2022-02-16 20:37:46 +08:00
<div class="rightTop">
<div class="leftStaus">
2022-02-18 15:45:31 +08:00
<span class="names">{{ item.createUserName || user.realName }}</span>
2022-02-16 20:37:46 +08:00
2022-02-18 15:45:31 +08:00
<span class="titless">
<span v-if="item.topic" class="topics"> {{ $dict.getLabel('villagerCircleTopic', item.topic) }} |</span>
<span> {{ item.createTime }}</span>
</span>
2022-02-16 20:37:46 +08:00
</div>
2022-02-17 18:17:40 +08:00
<div class="statusDele">
2022-02-18 11:05:14 +08:00
<div class="status status0" :class="item.auditStatus == 0 ? 'status0' : item.auditStatus == 1 ? 'status1' : 'status2'" v-if="tabIndex0 == 3">{{ $dict.getLabel('auditStatus', item.status) }}</div>
2022-02-17 18:17:40 +08:00
2022-02-18 17:51:56 +08:00
<!-- <div class="statusRight">
2022-02-18 15:45:31 +08:00
<div class="dels" @click.stop="toAdd(item)">编辑</div>
<div class="dels" @click.stop=";(delShow = true), (deleId = item.id)">删除</div>
2022-02-18 17:51:56 +08:00
</div> -->
2022-02-18 18:34:57 +08:00
<img src="https://cdn.cunwuyun.cn/dvcp/AppVillager/4.png" alt="" @click.stop=";(delAndEdit = true), (editId = item.id), (deleId = item.id), (statDisabled = item.status)" class="dels" />
2022-02-17 18:17:40 +08:00
</div>
2022-02-16 20:37:46 +08:00
</div>
</div>
2022-02-18 15:45:31 +08:00
<div class="tabCurrent0" v-if="tabCurrent1 != 1">
2022-02-18 11:05:14 +08:00
<div class="cardConts">{{ item.content }}</div>
2022-02-16 20:37:46 +08:00
2022-02-18 11:05:14 +08:00
<div class="cardImg" v-if="item.pictures">
2022-02-18 15:45:31 +08:00
<img :src="items.url" alt="" v-for="(items, i) in item.pictures" :key="i" @click.stop="previewImage(item.pictures, items.url)" />
2022-02-16 20:37:46 +08:00
</div>
<div class="cardBot">
2022-02-17 10:01:37 +08:00
<div class="icons">
2022-02-16 20:37:46 +08:00
<u-icon name="map-fill"></u-icon>
2022-02-18 11:05:14 +08:00
<span>{{ item.gpsDesc }}</span>
2022-02-16 20:37:46 +08:00
</div>
2022-02-18 09:36:31 +08:00
<div class="icones" v-if="tabIndex0 != 3">
2022-02-16 20:37:46 +08:00
<div class="img1">
2022-02-18 15:45:31 +08:00
<img src="https://cdn.cunwuyun.cn/dvcp/AppVillager/1.png" alt="" class="img11" />
2022-02-16 20:37:46 +08:00
</div>
<div class="rightFlex">
2022-02-18 15:45:31 +08:00
<img src="https://cdn.cunwuyun.cn/dvcp/AppVillager/2.png" alt="" class="img2" />
<img src="https://cdn.cunwuyun.cn/dvcp/AppVillager/3.png" alt="" class="img3" @click.stop="like(item)" v-if="item.upFlag == 0" />
<img src="https://cdn.cunwuyun.cn/dvcp/AppVillager/33.png" alt="" class="img3" @click.stop="like(item)" v-if="item.upFlag == 1" />
2022-02-16 20:37:46 +08:00
</div>
</div>
</div>
</div>
2022-02-18 09:36:31 +08:00
<div class="tabCurrent11" v-if="tabIndex0 == 3 && tabCurrent1 == 1">
2022-02-18 15:45:31 +08:00
<div class="cardsConts">{{ item.content }}</div>
2022-02-16 20:37:46 +08:00
<div class="reply">
2022-02-18 15:45:31 +08:00
<span class="toReply">回复的话题 </span>
<span class="contens">{{ item.villagerCircleInfo.content }}</span>
2022-02-16 20:37:46 +08:00
</div>
2022-02-18 15:45:31 +08:00
<div class="nopass" v-if="item.status == 2">
2022-02-16 20:37:46 +08:00
<span>未通过理由</span>
2022-02-18 15:45:31 +08:00
<span>{{ item.auditOpinion }}</span>
2022-02-16 20:37:46 +08:00
</div>
</div>
</div>
</div>
2022-02-18 11:05:14 +08:00
<AiEmpty description="暂无数据" class="emptyWrap" v-else></AiEmpty>
2022-02-16 20:37:46 +08:00
</div>
2022-02-18 17:51:56 +08:00
<img class="addBtn" src="https://cdn.cunwuyun.cn/dvcp/AppVillager/icon111.png" alt="" v-if="tabIndex0 == 3 && tabCurrent1 == 1" @click.native="toAdd()" />
2022-02-17 18:17:40 +08:00
<u-modal v-model="delShow" content="确定删除该数据" :mask-close-able="true" @confirm="confirmDel"></u-modal>
2022-02-18 17:51:56 +08:00
2022-02-18 18:34:57 +08:00
<u-mask :show="delAndEdit" @click=";(delAndEdit = false), (statDisabled = '')">
2022-02-18 17:51:56 +08:00
<div class="warp">
<div class="rect" @tap.stop="toAdd(0)">编辑</div>
<div class="rect" @tap.stop=";(delAndEdit = false), (delShow = true)">删除</div>
</div>
</u-mask>
2022-02-16 20:37:46 +08:00
</div>
</template>
<script>
2022-02-18 11:05:14 +08:00
import { mapState } from 'vuex'
2022-02-16 20:37:46 +08:00
export default {
name: 'AppVillager',
appName: '村民圈',
components: {},
props: {},
data() {
return {
2022-02-18 18:34:57 +08:00
showPage: false,
2022-02-16 20:37:46 +08:00
tabs: [
{
name: '本村',
},
{
name: '本镇',
},
{
name: '本县',
},
{
name: '我参与的',
},
],
2022-02-18 09:36:31 +08:00
tabIndex0: 0,
2022-02-16 20:37:46 +08:00
tabList: [
{
name: '我的话题',
},
{
name: '我的评论',
},
],
2022-02-18 09:36:31 +08:00
tabCurrent1: 0,
2022-02-16 20:37:46 +08:00
data: [{ value: 0, title: '弃捐勿复道,努力加餐饭' }],
itemList: [
{
name: '全部',
2022-02-18 09:36:31 +08:00
indexTab2: 0,
2022-02-16 20:37:46 +08:00
},
{
name: '已通过',
2022-02-18 09:36:31 +08:00
indexTab2: 1,
2022-02-16 20:37:46 +08:00
},
{
name: '未通过',
2022-02-18 09:36:31 +08:00
indexTab2: 2,
2022-02-16 20:37:46 +08:00
},
{
name: '审核中',
2022-02-18 09:36:31 +08:00
indexTab2: 3,
2022-02-16 20:37:46 +08:00
},
],
2022-02-18 09:36:31 +08:00
indexTab2: 0,
2022-02-17 18:17:40 +08:00
delShow: false,
2022-02-17 19:03:11 +08:00
current: 1,
2022-02-18 11:05:14 +08:00
show: false,
TopicValue: '0',
TopicName: '美丽庭院',
2022-02-18 15:45:31 +08:00
flag: false,
2022-02-18 17:51:56 +08:00
delAndEdit: false,
editId: '',
2022-02-18 18:34:57 +08:00
statDisabled: '',
2022-02-16 20:37:46 +08:00
}
},
2022-02-18 11:05:14 +08:00
computed: { ...mapState(['user']) },
2022-02-16 20:37:46 +08:00
watch: {},
2022-02-17 18:17:40 +08:00
onLoad() {
2022-02-18 11:05:14 +08:00
this.$dict.load('villagerCircleTopic', 'auditStatus').then(() => {
this.getList()
2022-02-17 18:17:40 +08:00
})
},
2022-02-16 20:37:46 +08:00
onShow() {
uni.$on('updateList', () => {
this.getList()
})
},
methods: {
2022-02-17 19:03:11 +08:00
getList() {
this.$instance
2022-02-18 11:05:14 +08:00
.post(this.tabIndex0 == 3 ? '/app/appvillagercircleinfo/list-xcxme' : '/app/appvillagercircleinfo/list-xcx', null, {
2022-02-17 19:03:11 +08:00
params: {
size: 6,
current: this.current,
2022-02-18 11:05:14 +08:00
topic: this.tabIndex0 != 3 ? this.TopicValue : '',
2022-02-18 15:45:31 +08:00
status: this.tabIndex0 == 3 && this.indexTab2 == 0 ? '' : this.tabIndex0 == 3 && this.indexTab2 == 1 ? 1 : this.tabIndex0 == 3 && this.indexTab2 == 2 ? 2 : this.tabIndex0 == 3 && this.indexTab2 == 3 ? 0 : '',
2022-02-18 11:05:14 +08:00
areaId: this.tabIndex0 != 3 ? this.user.areaId : '',
listType: this.tabIndex0 == 3 && this.tabCurrent1 == 0 ? '0' : this.tabIndex0 == 3 && this.tabCurrent1 == 1 ? '1' : this.tabIndex0 == 0 ? '0' : this.tabIndex0 == 1 ? '1' : this.tabIndex0 == 2 ? '2' : '',
2022-02-17 19:03:11 +08:00
},
})
.then((res) => {
if (res.code == 0) {
this.data = this.current > 1 ? [...this.data, ...res.data.records] : res.data.records
}
})
2022-02-18 18:34:57 +08:00
.finally(() => {
this.showPage = true
})
2022-02-17 19:03:11 +08:00
},
2022-02-18 15:45:31 +08:00
init() {
2022-02-18 11:05:14 +08:00
this.data = []
2022-02-16 20:37:46 +08:00
this.current = 1
2022-02-18 11:05:14 +08:00
this.getList()
2022-02-16 20:37:46 +08:00
},
2022-02-18 15:45:31 +08:00
change(index) {
this.tabIndex0 = index
this.init()
},
2022-02-16 20:37:46 +08:00
changetabIndex(e) {
2022-02-18 09:36:31 +08:00
this.tabCurrent1 = e
2022-02-18 15:45:31 +08:00
this.$nextTick(() => {
this.indexTab2 = 0
this.init()
})
2022-02-16 20:37:46 +08:00
},
hander(i) {
2022-02-18 09:36:31 +08:00
this.indexTab2 = i
2022-02-18 15:45:31 +08:00
this.$nextTick(() => {
this.init()
})
2022-02-16 20:37:46 +08:00
},
toDetail(item) {
2022-02-18 15:45:31 +08:00
this.$linkTo(`./detail?id=${item.id}&avatarUrl=${item.avatarUrl ? item.avatarUrl : ''}&tabCurrent1=${this.tabCurrent1}`)
2022-02-16 20:37:46 +08:00
},
2022-02-18 17:51:56 +08:00
toAdd(index) {
2022-02-18 18:36:36 +08:00
if (this.statDisabled == 0 && index == 0) {
2022-02-18 18:34:57 +08:00
this.delAndEdit = false
return this.$u.toast('该数据未审核')
}
2022-02-18 17:51:56 +08:00
this.delAndEdit = false
if (index == 0) {
this.$linkTo(`./add?id=${this.editId}`)
2022-02-18 09:36:31 +08:00
} else {
this.$linkTo(`./add`)
}
2022-02-16 20:37:46 +08:00
},
2022-02-17 18:17:40 +08:00
confirmDel() {
this.$instance
2022-02-18 17:51:56 +08:00
.post(this.tabIndex0 == 3 && this.tabCurrent1 == 1 ? '/app/appvillagercirclecomment/delete' : '/app/appvillagercircleinfo/delete', null, {
params: {
ids: this.deleId,
},
})
2022-02-17 18:17:40 +08:00
.then((res) => {
2022-02-18 17:51:56 +08:00
if (res.code == 0) {
2022-02-17 18:17:40 +08:00
this.deleShow = false
this.modalShow = false
this.deleId = ''
2022-02-18 18:34:57 +08:00
this.statDisabled = ''
this.$u.toast('删除成功')
2022-02-18 17:51:56 +08:00
this.init()
2022-02-17 18:17:40 +08:00
}
})
.catch((e) => {
this.$u.toast(e)
})
},
2022-02-18 11:05:14 +08:00
conTopic(e) {
this.TopicValue = e[0].value
this.TopicName = e[0].label
2022-02-18 15:45:31 +08:00
this.$nextTick(() => {
this.init()
})
2022-02-18 11:05:14 +08:00
},
previewImage(images, img) {
uni.previewImage({
urls: images.map((v) => v.url),
current: img,
})
},
2022-02-18 15:45:31 +08:00
like(item) {
if (this.flag) return
this.flag = true
this.$instance
.post(`/app/appvillagercircleinfo/up?id=${item.id}`)
.then((res) => {
if (res.code === 0) {
this.$u.toast(item.upFlag == 0 ? '点赞成功' : '取消点赞成功')
this.init()
setTimeout(() => {
this.flag = false
}, 600)
}
})
.catch((err) => {
this.$u.toast(err)
this.flag = false
})
},
2022-02-18 17:51:56 +08:00
toDel() {},
2022-02-16 20:37:46 +08:00
},
2022-02-17 19:03:11 +08:00
onReachBottom() {
this.current = this.current + 1
this.getList()
},
2022-02-16 20:37:46 +08:00
}
</script>
<style scoped lang="scss">
.Page {
2022-02-18 11:05:14 +08:00
height: 100%;
background: #fff;
2022-02-16 20:37:46 +08:00
.active {
color: #4181ff !important;
border: 1px solid #4181ff !important;
}
.noactive {
color: #666;
border: 1px solid #ddd;
}
::v-deep .u-tabs1 {
.u-tabs {
padding-top: 32px;
padding-bottom: 60px;
padding-right: 300px;
width: 100%;
background: #197df0;
}
}
.top {
2022-02-18 17:51:56 +08:00
padding: 0 16px 32px 16px;
2022-02-16 20:37:46 +08:00
background: #fff;
border-radius: 32px 32px 0px 0px;
margin-top: -30px;
2022-02-18 17:51:56 +08:00
overflow: hidden;
2022-02-16 20:37:46 +08:00
.tabIndex012 {
padding-top: 32px;
display: flex;
2022-02-17 18:17:40 +08:00
flex-wrap: wrap;
2022-02-16 20:37:46 +08:00
.tags {
padding: 8px 32px;
background: #ffffff;
border-radius: 32px;
margin-left: 16px;
border: 1px solid #4181ff;
}
2022-02-17 18:17:40 +08:00
.tags:nth-child(n + 4) {
margin-top: 10px;
}
2022-02-16 20:37:46 +08:00
}
2022-02-18 09:36:31 +08:00
.indexTab22 {
2022-02-16 20:37:46 +08:00
padding-top: 32px;
display: flex;
.tags {
padding: 8px 32px;
background: #ffffff;
border-radius: 32px;
margin-left: 16px;
border: 1px solid #ddd;
}
}
::v-deep .u-tabs2 {
.u-tabs {
padding: 0 !important;
}
}
}
.middle {
padding: 0 32px;
background: #fff;
.datas {
.card {
padding: 32px 0 48px 0;
2022-02-17 10:01:02 +08:00
box-shadow: inset 0px -1px 0px 0px #dddddd;
2022-02-16 20:37:46 +08:00
.cardTop {
display: flex;
img {
width: 96px;
height: 96px;
border-radius: 50%;
}
.rightTop {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
.leftStaus {
display: flex;
flex-direction: column;
margin-left: 16px;
.names {
font-size: 32px;
font-weight: 500;
}
.titless {
font-size: 26px;
color: #6e727a;
2022-02-17 10:01:02 +08:00
margin-top: 6px;
2022-02-18 15:45:31 +08:00
.topics {
margin-right: 8px;
}
2022-02-16 20:37:46 +08:00
}
}
2022-02-17 18:17:40 +08:00
.statusDele {
display: flex;
align-items: center;
.status {
font-size: 28px;
}
.status0 {
color: #42d784;
}
.status1 {
color: #ff4466;
}
.status2 {
color: #ff883c;
}
2022-02-18 15:45:31 +08:00
.statusRight {
display: flex;
flex-direction: column;
align-items: center;
.dels {
2022-02-18 17:51:56 +08:00
position: relative;
2022-02-18 15:45:31 +08:00
margin-left: 20px;
2022-02-18 17:51:56 +08:00
width: 68px;
height: 68px;
2022-02-18 15:45:31 +08:00
}
2022-02-17 18:17:40 +08:00
}
2022-02-16 20:37:46 +08:00
}
}
}
.tabCurrent0 {
.cardConts {
margin-top: 24px;
font-size: 32px;
}
.cardImg {
margin-top: 24px;
img {
width: 226px;
height: 226px;
margin-right: 4px;
}
img:nth-child(3n + 0) {
margin-right: 0;
}
}
.cardBot {
margin-top: 24px;
2022-02-17 10:01:37 +08:00
.icons {
2022-02-16 20:37:46 +08:00
padding: 8px 32px 8px 16px;
background: #eff1f3;
border-radius: 28px;
}
2022-02-17 10:01:37 +08:00
.icones {
2022-02-16 20:37:46 +08:00
display: flex;
justify-content: space-between;
margin-top: 24px;
.img1 {
width: 60%;
.img11 {
width: 48px;
height: 48px;
}
}
.rightFlex {
display: flex;
justify-content: space-between;
2022-02-17 10:01:02 +08:00
width: 27%;
2022-02-16 20:37:46 +08:00
.img2,
.img3 {
width: 48px;
height: 48px;
}
}
}
}
}
2022-02-18 09:36:31 +08:00
.tabCurrent11 {
2022-02-16 20:37:46 +08:00
.cardsConts {
margin-top: 24px;
font-size: 32px;
}
.reply {
padding: 24px;
background: #f3f6f9;
border-radius: 16px;
2022-02-18 18:34:57 +08:00
margin-top: 24px;
2022-02-16 20:37:46 +08:00
.toReply {
font-size: 26px;
color: #999999;
}
.contens {
color: #333;
}
}
.nopass {
padding: 24px;
margin-top: 24px;
background: #fff5f7;
border-radius: 16px;
font-size: 26px;
color: #ff4466;
}
}
}
}
}
.AiFixedBtn {
.movableArea {
.addBtn {
display: flex;
justify-content: center;
align-items: center;
width: 96px;
height: 96px;
flex-shrink: 0;
background: #fff;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
font-size: 28px;
color: #1365dd;
border-radius: 50%;
}
}
}
2022-02-17 18:17:40 +08:00
.addBtn {
position: fixed;
right: 5%;
bottom: 15%;
width: 96px;
height: 96px;
line-height: 96px;
text-align: center;
font-size: 24px;
color: #1365dd;
border-radius: 50%;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
}
2022-02-18 17:51:56 +08:00
::v-deep .u-mask {
.warp {
position: absolute;
top: 251px;
right: 70px;
display: flex;
flex-direction: column;
align-items: center;
width: 45%;
height: 22%;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
border-radius: 5%;
.rect {
height: 50%;
width: 100%;
text-align: center;
line-height: 4;
background: #fff;
}
}
}
2022-02-16 20:37:46 +08:00
}
</style>