地区筛选

This commit is contained in:
花有清香月有阴
2022-01-07 10:26:12 +08:00
parent 4977989abd
commit f094d39092
2 changed files with 101 additions and 23 deletions

View File

@@ -1,10 +1,17 @@
<template>
<div class="AppVillageDiscuss">
<AiTopFixed v-if="tabs.length > 0">
<div class="tab-select">
<div class="item" :class="{ active: type == item.dictValue }" v-for="item in tabs" :key="item.dictValue" @click="tabClick(item.dictValue)">{{ item.dictName }}<span /></div>
</div>
<AiTopFixed>
<u-tabs :list="tabslist" :is-scroll="false" :current="currentTabs" active-color="#fff" inactive-color="#CDDCF0" bg-color="#3975C6" @change="change"></u-tabs>
</AiTopFixed>
<div class="areatop">
<u-form label-width="auto">
<u-form-item label="区域选择" right-icon="arrow-right" :border-bottom="false" class="addresss">
<AiAreaPicker v-model="areaId" :areaId="user.areaId" @select="seachObj" :name.sync="areaName"></AiAreaPicker>
</u-form-item>
</u-form>
</div>
<template v-if="datas.length > 0">
<AiCard v-for="(item, i) in datas" :ref="item.id" :key="i" @click.native="toAdd(item, 1)">
<template #custom>
@@ -59,10 +66,24 @@ export default {
pages: 0,
deletShow: false,
deletId: '',
type: '0',
listName: '',
tabIndex: 0,
showBackTop: false,
tabslist: [
{
name: '进行中',
},
{
name: '公示中',
},
{
name: '已完成',
},
],
currentTabs: 0,
areaName: '',
areaId: '',
}
},
computed: {
@@ -77,6 +98,9 @@ export default {
onLoad(o) {
this.moduleId = o.moduleId
this.listName = o.listName
this.areaName = this.user.areaName
this.getList()
uni.$on('update', () => {
this.getList()
@@ -90,26 +114,10 @@ export default {
this.showBackTop = obj.scrollTop > 0
},
methods: {
previewImage(images, img) {
uni.previewImage({
urls: images.map((v) => v.url),
current: img,
})
},
tabClick(type) {
this.type = type
this.current = 1
this.getList()
},
search() {
this.current = 1
this.getList()
},
getList() {
let { current, type } = this
this.$http
.post('/app/appvillagediscuss/list', null, {
params: { size: 20, current, type },
params: { size: 20, current: this.current, status: this.currentTabs, areaId: this.areaId },
})
.then((res) => {
if (res?.data) {
@@ -125,6 +133,37 @@ export default {
})
},
change(e) {
console.log(e)
this.areaId = ''
this.datas = []
this.current = 1
this.currentTabs = e
this.getList()
},
seachObj(e) {
this.areaId = e
this.current = 1
this.getList()
},
previewImage(images, img) {
uni.previewImage({
urls: images.map((v) => v.url),
current: img,
})
},
// tabClick(type) {
// this.type = type
// this.current = 1
// this.getList()
// },
search() {
this.current = 1
this.getList()
},
toAdd(item, type) {
if (item?.id) {
this.$refs?.[item.id]?.[0]?.handleClose()
@@ -172,6 +211,38 @@ export default {
.AppVillageDiscuss {
height: 100%;
.areatop {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
.u-form {
width: 100%;
.addresss {
.u-form-item__body {
.u-form-item--right {
.u-form-item--right__content {
.u-form-item--right__content__slot {
.AiAreaPicker {
width: 100%;
display: flex;
justify-content: flex-end;
.areaSelector {
.location {
opacity: 0;
}
}
}
}
}
}
}
}
}
}
.avatar {
height: 64px;
width: 64px;

View File

@@ -9,18 +9,22 @@
</div>
<div class="statusTag" :class="{ over: data.status > 0 }" v-text="data.status == 0 ? (data.type == 0 ? '征集中' : '投票中') : $dict.getLabel('discussStatus', data.status)" />
</div>
<div class="header-middle">
<div class="contsnts">
<u-parse :html="data.content"></u-parse>
</div>
</div>
<div class="img-list" v-if="data.images && data.images.length && data.contentType != 1">
<img :src="item.accessUrl" alt="" v-for="(item, index) in data.images" :key="index" @click="previewImage(data.images, item.accessUrl)" />
</div>
<div class="img-list" v-if="data.images && data.images.length && data.contentType == 1">
<video class="video" :src="data.images[0].url"></video>
</div>
</AiTopFixed>
<div v-if="data.type == 0" class="comments">
<span class="totalCount">
<span class="total" v-text="`全部评论(${commentCount})`" />
@@ -39,7 +43,9 @@
<div class="content color-999" v-text="op.createTime" />
</div>
</div>
<div v-else-if="data.type == 1" class="comments"></div>
<div class="bottomBar">
<div v-if="data.status < 2" @click="handleComplete">结束公示</div>
</div>
@@ -84,7 +90,8 @@ export default {
this.data = {
...res.data,
avatar: res.data.createUserName?.substr(0, 2) || '游客',
images: JSON.parse(res.data.images),
images: res.data.images,
// images: JSON.parse(res.data.images) || [],
messages: res.data.messages || [],
}
var discussTime = (new Date(res.data.discussDeadline).getTime() * 1) / 1000