ct
This commit is contained in:
@@ -35,14 +35,14 @@
|
|||||||
|
|
||||||
<div class="options" v-if="form.type == 1">
|
<div class="options" v-if="form.type == 1">
|
||||||
<div class="oneopt">
|
<div class="oneopt">
|
||||||
<div class="items info" v-for="(item, index) in list" :key="index">
|
<!-- <div class="items info" v-for="(item, index) in list" :key="index">
|
||||||
<img src="./img/22.png" alt="" @click="del(index)" />
|
<img src="./img/22.png" alt="" @click="del(index)" />
|
||||||
<div class="rightopts" style="color: #666">{{ item }}</div>
|
<div class="rightopts" style="color: #666">{{ item }}</div>
|
||||||
</div>
|
</div> -->
|
||||||
<div class="items">
|
<div class="items" v-for="(item, index) in list" :key="index">
|
||||||
<img src="./img/22.png" alt="" />
|
<img src="./img/22.png" alt="" @click="del(index)" />
|
||||||
<div class="rightopts">
|
<div class="rightopts">
|
||||||
<u-input v-model="contents" placeholder="选项" maxlength="200" :clearable="false" />
|
<u-input v-model="item.content" placeholder="选项" maxlength="200" :clearable="false" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="items" @click="addOpts">
|
<div class="items" @click="addOpts">
|
||||||
@@ -133,6 +133,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
submit() {
|
submit() {
|
||||||
|
let list = []
|
||||||
if (this.flag) return
|
if (this.flag) return
|
||||||
if (!this.form.content) {
|
if (!this.form.content) {
|
||||||
return this.$u.toast('请输入主题')
|
return this.$u.toast('请输入主题')
|
||||||
@@ -146,26 +147,27 @@ export default {
|
|||||||
if (!this.form.publicityDeadline) {
|
if (!this.form.publicityDeadline) {
|
||||||
return this.$u.toast('请选择公示截止时间')
|
return this.$u.toast('请选择公示截止时间')
|
||||||
}
|
}
|
||||||
if (this.form.type == 1 && this.opts == 0 && !this.contents) {
|
|
||||||
return this.$u.toast('请输入单选选项')
|
|
||||||
}
|
|
||||||
if (this.opts == 1 && !this.list.length) {
|
|
||||||
return this.$u.toast('请输入多选选项')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.contents) {
|
if (this.form.type === '1') {
|
||||||
this.list.push(this.contents)
|
if (!this.list.length) {
|
||||||
}
|
return this.$u.toast('请添加选项')
|
||||||
if (this.opts == 1) {
|
}
|
||||||
var lists = []
|
if (this.list.length < 2) {
|
||||||
this.list.map((item, index) => {
|
return this.$u.toast('选项不能少于2个')
|
||||||
item.contents == item, item.item == this.keys[index]
|
}
|
||||||
lists.push({
|
|
||||||
content: item,
|
list = this.list.map((v, index) => {
|
||||||
item: this.keys[index],
|
return {
|
||||||
})
|
content: v.content,
|
||||||
|
item: this.keys[index]
|
||||||
|
}
|
||||||
})
|
})
|
||||||
console.log(lists)
|
|
||||||
|
for (let i = 0; i < list.length; i ++) {
|
||||||
|
if (!list[i].content) {
|
||||||
|
return this.$u.toast(`请输入弟${i + 1}个选项的内容`)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var params = {
|
var params = {
|
||||||
@@ -173,7 +175,7 @@ export default {
|
|||||||
// voteItems: this.list,
|
// voteItems: this.list,
|
||||||
areaId: this.form.areaId,
|
areaId: this.form.areaId,
|
||||||
areaName: this.form.areaName,
|
areaName: this.form.areaName,
|
||||||
voteItems: lists,
|
voteItems: list,
|
||||||
anonymous: this.checked == true ? 1 : 0,
|
anonymous: this.checked == true ? 1 : 0,
|
||||||
createUserId: this.user.id,
|
createUserId: this.user.id,
|
||||||
createUserName: this.user.name,
|
createUserName: this.user.name,
|
||||||
@@ -194,11 +196,12 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
addOpts() {
|
addOpts() {
|
||||||
if (!this.contents) {
|
// if (!this.contents) {
|
||||||
return this.$u.toast('请输入选项内容')
|
// return this.$u.toast('请输入选项内容')
|
||||||
}
|
// }
|
||||||
this.list.push(this.contents)
|
this.list.push({
|
||||||
this.contents = ''
|
content: ''
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
del(index) {
|
del(index) {
|
||||||
@@ -211,8 +214,6 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
confirmTime(e) {
|
confirmTime(e) {
|
||||||
console.log(e)
|
|
||||||
|
|
||||||
if (this.showStartTime == true) {
|
if (this.showStartTime == true) {
|
||||||
var nowTime = new Date().getTime() * 1
|
var nowTime = new Date().getTime() * 1
|
||||||
|
|
||||||
|
|||||||
@@ -36,9 +36,9 @@
|
|||||||
<b v-text="op.createUserName" />
|
<b v-text="op.createUserName" />
|
||||||
<span class="tags">{{ data.createUserId === op.createUserId ? '话事人' : '居民' }}</span>
|
<span class="tags">{{ data.createUserId === op.createUserId ? '话事人' : '居民' }}</span>
|
||||||
</div>
|
</div>
|
||||||
<u-icon name="thumb-up" :label="op.suport" :color="op.isSuport ? 'red' : '#ccc'" @click="like(op.id)" />
|
<u-icon name="thumb-up" :label="op.suport" :color="op.isSuport ? 'red' : '#ccc'" @click="like(op.id)" />
|
||||||
</div>
|
</div>
|
||||||
<div class="content" v-text="op.content" @click="dele" />
|
<div class="content" v-text="op.content" />
|
||||||
<div class="content color-999" v-text="op.createTime" />
|
<div class="content color-999" v-text="op.createTime" />
|
||||||
</div>
|
</div>
|
||||||
<AiEmpty v-if="!data.messages.length"></AiEmpty>
|
<AiEmpty v-if="!data.messages.length"></AiEmpty>
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
<div class="vote-item" v-for="(item, index) in data.voteList" :key="index">
|
<div class="vote-item" v-for="(item, index) in data.voteList" :key="index">
|
||||||
<span>{{ item.content }}</span>
|
<span>{{ item.content }}</span>
|
||||||
<i>{{ item.count }}</i>
|
<i>{{ item.count }}</i>
|
||||||
<em :style="{ width: item.percentage }"></em>
|
<em :style="{width: item.percentage}"></em>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -98,7 +98,7 @@ export default {
|
|||||||
content: '',
|
content: '',
|
||||||
flag: false,
|
flag: false,
|
||||||
pageShow: false,
|
pageShow: false,
|
||||||
isAnnouncer: false,
|
isAnnouncer: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -120,78 +120,69 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
getDetail() {
|
getDetail() {
|
||||||
this.$loading()
|
this.$loading()
|
||||||
this.$http
|
this.$http.post(`/app/appvillagediscuss/queryDetailById?id=${this.id}`).then((res) => {
|
||||||
.post(`/app/appvillagediscuss/queryDetailById?id=${this.id}`)
|
if (res?.data) {
|
||||||
.then((res) => {
|
this.data = {
|
||||||
if (res?.data) {
|
...res.data,
|
||||||
this.data = {
|
avatar: res.data.createUserName?.substr(0, 2) || '游客',
|
||||||
...res.data,
|
messages: res.data.messages ? res.data.messages.map(v => {
|
||||||
avatar: res.data.createUserName?.substr(0, 2) || '游客',
|
return {
|
||||||
messages: res.data.messages
|
...v,
|
||||||
? res.data.messages.map((v) => {
|
isSuport: v.suportUser ? v.suportUser.indexOf(this.user.id) > -1 : false
|
||||||
return {
|
}
|
||||||
...v,
|
}) : []
|
||||||
isSuport: v.suportUser ? v.suportUser.indexOf(this.user.id) > -1 : false,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
: [],
|
|
||||||
}
|
|
||||||
this.data.images = JSON.parse(res.data.images)
|
|
||||||
this.isAnnouncer = this.user.id === res.data.createUserId
|
|
||||||
|
|
||||||
var discussTime = (new Date(res.data.discussDeadline).getTime() * 1) / 1000
|
|
||||||
var nowTime = (new Date().getTime() * 1) / 1000
|
|
||||||
if (discussTime >= nowTime) {
|
|
||||||
this.timestamp = discussTime - nowTime
|
|
||||||
}
|
|
||||||
|
|
||||||
if (res.data.voteType === '1') {
|
|
||||||
const total = Object.values(res.data.statistic).reduce((x, y) => {
|
|
||||||
return x + y
|
|
||||||
})
|
|
||||||
this.data.voteList = res.data.voteItems.map((v) => {
|
|
||||||
return {
|
|
||||||
...v,
|
|
||||||
count: res.data.statistic[v.item],
|
|
||||||
percentage: (res.data.statistic[v.item] / total) * 100 + '%',
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$hideLoading()
|
|
||||||
this.pageShow = true
|
|
||||||
} else {
|
|
||||||
this.$hideLoading()
|
|
||||||
}
|
}
|
||||||
})
|
this.data.images = JSON.parse(res.data.images)
|
||||||
.catch(() => {
|
this.isAnnouncer = this.user.id === res.data.createUserId
|
||||||
this.$hideLoading()
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
like(id) {
|
var discussTime = (new Date(res.data.discussDeadline).getTime() * 1) / 1000
|
||||||
this.$loading()
|
var nowTime = (new Date().getTime() * 1) / 1000
|
||||||
this.$http
|
if (discussTime >= nowTime) {
|
||||||
.post(`/app/appvillagediscussmessage/suport?id=${id}&userId=${this.user.id}`)
|
this.timestamp = discussTime - nowTime
|
||||||
.then((res) => {
|
}
|
||||||
this.$hideLoading()
|
|
||||||
if (res.code === 0) {
|
|
||||||
this.$u.toast('点赞成功')
|
|
||||||
|
|
||||||
this.$nextTick(() => {
|
if (res.data.type === '1') {
|
||||||
this.getDetail()
|
const total = Object.values(res.data.statistic).reduce((x, y) => {
|
||||||
|
return x + y
|
||||||
|
})
|
||||||
|
this.data.voteList = res.data.voteItems.map(v => {
|
||||||
|
return {
|
||||||
|
...v,
|
||||||
|
count: res.data.statistic[v.item],
|
||||||
|
percentage: (res.data.statistic[v.item] / total) * 100 + '%'
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} else {
|
|
||||||
this.$u.toast(res.msg)
|
|
||||||
}
|
}
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
this.$hideLoading()
|
this.$hideLoading()
|
||||||
this.$u.toast(e)
|
this.pageShow = true
|
||||||
})
|
} else {
|
||||||
|
this.$hideLoading()
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
this.$hideLoading()
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
dele() {},
|
like (id) {
|
||||||
|
this.$loading()
|
||||||
|
this.$http.post(`/app/appvillagediscussmessage/suport?id=${id}&userId=${this.user.id}`).then(res => {
|
||||||
|
this.$hideLoading()
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.$u.toast('点赞成功')
|
||||||
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.getDetail()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$u.toast(res.msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
}).catch((e) => {
|
||||||
|
this.$hideLoading()
|
||||||
|
this.$u.toast(e)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
publish() {
|
publish() {
|
||||||
if (this.flag) return
|
if (this.flag) return
|
||||||
@@ -260,17 +251,15 @@ export default {
|
|||||||
handleComplete() {
|
handleComplete() {
|
||||||
this.$confirm('是否要结束公示')
|
this.$confirm('是否要结束公示')
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.$http
|
this.$http.post('/app/appvillagediscuss/finishPublic', {
|
||||||
.post('/app/appvillagediscuss/finishPublic', {
|
status: '2',
|
||||||
status: '2',
|
id: this.id
|
||||||
id: this.id,
|
}).then((res) => {
|
||||||
})
|
if (res?.code == 0) {
|
||||||
.then((res) => {
|
this.$u.toast('已结束公示!')
|
||||||
if (res?.code == 0) {
|
this.getDetail()
|
||||||
this.$u.toast('已结束公示!')
|
}
|
||||||
this.getDetail()
|
})
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
.catch(() => 0)
|
.catch(() => 0)
|
||||||
},
|
},
|
||||||
@@ -293,7 +282,7 @@ export default {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 32px;
|
font-size: 32px;
|
||||||
background: #1365dd;
|
background: #1365DD;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.detail-active {
|
&.detail-active {
|
||||||
@@ -388,7 +377,7 @@ export default {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
background: #1aaaff;
|
background: #1AAAFF;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,10 +399,10 @@ export default {
|
|||||||
line-height: 64px;
|
line-height: 64px;
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
padding: 0 32px;
|
padding: 0 32px;
|
||||||
background: #ffffff;
|
background: #FFFFFF;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border: 1px solid #95cbff;
|
border: 1px solid #95CBFF;
|
||||||
|
|
||||||
em {
|
em {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -421,13 +410,13 @@ export default {
|
|||||||
top: 0;
|
top: 0;
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: #dce8f4;
|
background: #DCE8F4;
|
||||||
}
|
}
|
||||||
|
|
||||||
span {
|
span {
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
color: #5b84b3;
|
color: #5B84B3;
|
||||||
font-size: 28px;
|
font-size: 28px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -435,7 +424,7 @@ export default {
|
|||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
color: #5b84b3;
|
color: #5B84B3;
|
||||||
font-size: 28px;
|
font-size: 28px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -505,7 +494,7 @@ export default {
|
|||||||
.u-input {
|
.u-input {
|
||||||
background: #f7f7f7;
|
background: #f7f7f7;
|
||||||
border-radius: 8px 8px 0 0;
|
border-radius: 8px 8px 0 0;
|
||||||
padding: 10px !important;
|
padding: 10px!important;
|
||||||
margin: 0 30px 0 30px;
|
margin: 0 30px 0 30px;
|
||||||
.uni-textarea-placeholder {
|
.uni-textarea-placeholder {
|
||||||
padding: 16px 0 0 16px;
|
padding: 16px 0 0 16px;
|
||||||
|
|||||||
Reference in New Issue
Block a user