From 3c738f4fe2762bba8087e5a22fc0dc06560eab0e Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Thu, 08 Aug 2024 10:01:17 +0800
Subject: [PATCH] 三色任务与自查任务
---
subPackage/article/detail.vue | 415 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 384 insertions(+), 31 deletions(-)
diff --git a/subPackage/article/detail.vue b/subPackage/article/detail.vue
index 7a63a3f..890ddde 100644
--- a/subPackage/article/detail.vue
+++ b/subPackage/article/detail.vue
@@ -42,10 +42,10 @@
</view>
<text class="f-28 c-99">共{{applyList.length}}人</text>
</view>
- <button v-if="computeEndTime > 0 && !applyInfo.userId" class="apply-btn bgc-main c-ff "
+ <button v-if="computeEndTime > 0 && !applyInfo.householdId" class="apply-btn bgc-main c-ff "
@click="handleApply()">报名</button>
- <button v-if="applyInfo.userId && computeEndTime > 0"
+ <button v-if="applyInfo.householdId && computeEndTime > 0"
class="apply-btn bgc-lightblue c-main border-current">已报名</button>
<button v-if="computeEndTime <= 0"
@@ -61,19 +61,44 @@
<!-- <u-icon name="arrow-right" color="#999"></u-icon> -->
</view>
</view>
- <view class="explain-row c-main f-28">
- 投票{{!isEnd && !isComplete?"进行中":"已结束"}}
+
+ <view class="explain-row ">
+ <text class="f-28 c-main" v-if="!isEnd && !isComplete && isStart">投票进行中</text>
+ <text class="f-28 c-main" v-if="isComplete && !isEnd">投票已提交</text>
+ <text class="f-28 c-main" v-if="isEnd">投票已结束</text>
+ <text class="f-28 c-main" v-if="!isStart">投票未开始</text>
+ <text class="ml-20 f-26 " v-if="applyInfo.voteRestrictions == 1">(该议题为一户一票)</text>
+ <view class="f-26 mt-20 fw" v-if="!isStart">
+ {{applyInfo.startTime }} -
+ {{applyInfo.endTime}}
+ </view>
</view>
+
<view class="vote bgc-ff">
<view class="mb-20" v-for="(item,index) in voteTopicList" :key="index">
<view class="vote-title">
- <!-- <text class="f-30 fw">{{item.discussContent}}</text> -->
- <text class="f-26 ml-10">{{item.optionRange == 0?"(单选)":"(多选)"}}</text>
+ <text v-if="item.mandatoryFlag == 2" class="vote-sign">*</text>
+ <text class="f-30 fw">{{item.discussContent}}</text>
+ <text class="f-26 ml-10" v-if="item.optionRange == 0">(单选)</text>
+ <text class="f-26 ml-10" v-if="item.optionRange == 1 && !item.optionNumber">(多选)</text>
+ <text class="f-26 ml-10"
+ v-if="item.optionRange == 1 && item.optionNumber>0 && !item.optionNumberMin">
+ (多选{{`最多可选${item.optionNumber}项`}})
+ </text>
+ <text class="f-26 ml-10"
+ v-if="item.optionRange == 1 && item.optionNumber>0 && item.optionNumberMin > 0">
+ (多选 {{`最少需选${item.optionNumberMin}项`}},{{`最多可选${item.optionNumber}项`}})
+ </text>
</view>
+ <view class="file-btn f-26 " v-if="item.attachment"
+ @click="navToDocument(item.attachment)">
+ {{item.discussContent}}附件
+ </view>
+
<view class="" v-if="item.optionRange == 0">
<u-radio-group size="22" iconPlacement="right" activeColor="#017BFC" placement="column"
v-model="item.selected" @change="selectOption($event,index)"
- :disabled="item.isSubmit || isEnd">
+ :disabled="item.isSubmit || isEnd || isComplete || !isStart">
<view class="mb-30" v-for="(i,k) in item.children">
<u-radio :label="i.optionContent" :name="i.id"></u-radio>
<view class="flex j-c-s-b a-i-c mt-10">
@@ -86,17 +111,18 @@
</view>
<text class="c-33 f-28"
- v-if="i.number && item.isSubmit">{{i.number}}人</text>
+ v-if="i.number && item.isSubmit && item.voteNumberPublic == 1">{{i.number}}人</text>
</view>
</view>
</u-radio-group>
</view>
<view class="" v-if="item.optionRange == 1">
<u-checkbox-group size="22" iconPlacement="right" activeColor="#017BFC"
- placement="column" v-model="item.selected" :disabled="isSubmit"
+ placement="column" v-model="item.selected" :disabled="item.isSubmit || isEnd"
@change="selectOption($event,index)" shape="circle" labelColor="#333">
<view class="mb-30" v-for="(i,k) in item.children" :key="k">
- <u-checkbox :label="i.optionContent" :name="i.id"></u-checkbox>
+ <u-checkbox :label="i.optionContent" :name="i.id"
+ :disabled="i.disabled"></u-checkbox>
<view class="flex j-c-s-b a-i-c mt-10">
<view class="mt-10" style="width:80%;">
<uv-line-progress v-if="item.selected" height="6" :showText="false"
@@ -105,21 +131,23 @@
<uv-line-progress v-else height="6"
:showText="false"></uv-line-progress>
</view>
- <text class="c-33 f-28" v-if="i.number">{{i.number}}人</text>
+ <text class="c-33 f-28"
+ v-if="i.number && item.voteNumberPublic == 1">{{i.number}}人</text>
</view>
</view>
</u-checkbox-group>
</view>
</view>
- <button class="apply-btn bgc-main c-ff" v-if="!isEnd && !isComplete"
+ <button class="apply-btn bgc-main c-ff" v-if="!isEnd && !isComplete && isStart"
@click="submitVote()">提交</button>
- <button class="apply-btn bgc-gray c-d1" v-if="isComplete && !isEnd">已提交</button>
- <button class="apply-btn bgc-gray c-d1" v-if="isEnd">已结束</button>
+ <button class="apply-btn bgc-gray c-dd" v-if="isComplete && !isEnd">已提交</button>
+ <button class="apply-btn bgc-gray c-dd" v-if="isEnd">已结束</button>
+ <button class="apply-btn bgc-gray c-dd" v-if="!isStart">未开始</button>
</view>
</view>
</view>
- <view class="comment bgc-ff mt-20" v-if="commentList.length">
+ <view class="comment bgc-ff mt-20" v-if="commentList.length && detailInfo.iscomment == 1">
<caption-row title="用户评论" />
<view class="comment-list ">
<view class="comment-item flex " v-for="(item,index) in commentList" :key="index">
@@ -139,7 +167,7 @@
</view>
- <view class="footer">
+ <view class="footer" v-if="detailInfo.iscomment == 1">
<u-search searchIcon='edit-pen' :animation="true" placeholder="写评论" disabled
@click="navToComment"></u-search>
</view>
@@ -153,17 +181,47 @@
<u-icon name="thumb-up-fill" size="22" color="#fff"></u-icon>
</view>
</view> -->
+
+ <u-popup :show="isShowPopup" @close="isShowPopup = false" mode="center" :round="10" :closeable="true">
+ <view class='login-mode'>
+ <view class="f-30 fw">
+ 安全验证
+ </view>
+ <view class="f-30 mt-30">
+ {{phone}}
+ </view>
+ <view class='flex a-i-c login-input'>
+ <input class='f-30 c-33' type='number' placeholder='请输入验证码' v-model="validationCode"
+ placeholder-class='c-aa f-28'></input>
+ <button class='login-input-btn f-24 c-33' :disabled="validationCode?true:false"
+ @click='getValidationCode'>{{text}}</button>
+ </view>
+ <!-- <button class='login-btn c-ff f-30' :class='validationCode?"bgc-main":""'
+ :disabled="validationCode?false:true">确定</button> -->
+ <button class='login-btn c-ff f-30 bgc-main' @click="confirmValidationCode()">确定</button>
+ </view>
+ </u-popup>
+
</view>
</template>
<script>
import {
getDetail,
- getCommentList
+ getCommentList,
+ addPointsNumber
} from '@/api/article/article.js'
import * as communityModel from "@/api/community/community.js"
import tagCell from '@/components/noticeList/tagCell.vue'
import captionRow from "@/components/caption/caption.vue"
+ import {
+ minioBaseUrl
+ } from "@/common/setting.js"
+
+ import {
+ sendCode
+ } from "@/api/system/index.js"
+
export default {
components: {
tagCell,
@@ -188,10 +246,17 @@
isComplete: false, // 是否完成全部投票
UParseStyle: {
img: 'width: 100%; float: left;'
- }
+ },
+ isShowPopup: false,
+ validationCode: "",
+ phone: "",
+ text: "获取验证码",
+ isSendCode: false,
+ isStart: false //投票是否开始
}
},
onLoad(option) {
+ console.log(option)
this.$set(this.params, "id", option.id);
if (option.type) {
// this.$set(this.params, "eventType", option.type);
@@ -199,12 +264,25 @@
// this.pdId = option.pdId;
this.$set(this.params, "type", option.type);
this.curSite = uni.getStorageSync("siteInfo")
+ if (option.type == 6) {
+ console.log(222)
+ this.addNumber(option.id);
+ }
}
this.getDetailInfo()
+
+ if (this.curSite.relationship == 18) { //租客隐藏投票、报名信息
+ this.isLoad = false;
+ }
+
this.getAritcleComment();
uni.$on('refreshComment', () => {
this.getAritcleComment()
})
+ let {
+ phone
+ } = uni.getStorageSync("userInfo")
+ this.phone = `${phone.substr(0,4)}****${phone.substr(8)}`
},
computed: {
@@ -213,12 +291,34 @@
let endTimestamp = new Date(this.applyInfo.endTime).getTime();
if (Number(endTimestamp) - Number(curTimestamp) <= 0) {
this.isEnd = true;
+ this.setOptionDisable() //时间结束,所有多项按钮禁用
}
return Number(endTimestamp) - Number(curTimestamp)
+ },
+ computeStartTime() {
+ let curTimestamp = new Date().getTime();
+ let startTimestamp = new Date(this.applyInfo.startTime).getTime();
+ if (Number(curTimestamp) - Number(startTimestamp) >= 0) {
+ this.isStart = true;
+ } else {
+ this.setOptionDisable()
+ this.isStart = false;
+ //时间没到,所有多项按钮禁用
+ }
+ // return Number(endTimestamp) - Number(curTimestamp)
}
},
methods: {
+
+ addNumber(id) {
+ addPointsNumber({
+ houseCode: this.curSite.houseCode,
+ id
+ }).then(res => {
+ console.log(res)
+ })
+ },
toNumber(val) {
return Number(val)
@@ -229,6 +329,7 @@
},
getDetailInfo() {
+ this.params.houseCode = uni.getStorageSync("curHouseCode")
getDetail(this.params).then(res => {
this.detailInfo = res.data;
this.type = res.data.type
@@ -261,7 +362,8 @@
//报名列表
getApplyList() {
communityModel.getApplyList({
- articleId: this.params.id
+ articleId: this.params.id,
+ houseCode: uni.getStorageSync("curHouseCode")
}).then(res => {
// console.log(res)
if (res.code == 200) {
@@ -273,11 +375,16 @@
//报名、投票详情
getApplyDetail() {
communityModel.getApplyDetail({
- articleId: this.params.id
+ articleId: this.params.id,
+ houseCode: uni.getStorageSync("curHouseCode")
}).then(res => {
// console.log(res)
if (res.code == 200) {
this.applyInfo = res.data;
+ if (res.data.voteRestrictions == 1 && res.data.disabled) {
+ this.isComplete = true; //一户一票
+ this.setOptionDisable()
+ }
}
})
},
@@ -285,21 +392,26 @@
//获取投票议题
getVoteList() {
communityModel.getVoteTopics({
- articleId: this.params.id
+ articleId: this.params.id,
+ houseCode: uni.getStorageSync("curHouseCode")
}).then(res => {
if (res.code == 200) {
let data = res.data;
let tempArr = [];
+ let count = 0;
if (data.length) {
for (let i of data) {
if (i.selected) {
+ this.isComplete = true;
tempArr.push(i);
- if (typeof i.selected == "string" && i.optionRange == 0) {
+ if (typeof(i.selected) == "string" && i.optionRange == 0) {
this.isSubmit = true;
i.isSubmit = true;
i.selected = Number(i.selected)
+
+
}
- if (typeof i.selected == "string" && i.optionRange == 1) {
+ if (typeof(i.selected) == "string" && i.optionRange == 1) {
this.isSubmit = true;
i.isSubmit = true;
i.selected = JSON.parse(i.selected)
@@ -308,9 +420,15 @@
}
}
this.voteTopicList = data;
- if (data.length == tempArr.length) {
- this.isComplete = true;
+ // if (data.length == tempArr.length) {
+ // this.isComplete = true;
+ // this.setOptionDisable()
+ // }
+ if (this.isComplete) {
+ this.setOptionDisable();
}
+
+
}
})
},
@@ -367,9 +485,35 @@
selectOption(id, index) {
let item = this.voteTopicList[index];
- item.selected = id;
+ if (id.length <= item.optionNumber) {
+ item.selected = id;
+ }
+ for (let i = 0, ii = item.children.length; i < ii; i++) {
+ item.children[i].selected = false;
+ for (let k = 0, kk = item.selected.length; k < kk; k++) {
+ if (item.children[i].id === item.selected[k]) {
+ item.children[i].selected = true;
+ }
+ item.children[i].disabled = false;
+ if (item.selected.length == item.optionNumber) {
+ if (!item.children[i].selected) {
+ item.children[i].disabled = true;
+ }
+ }
+ }
+ }
this.$set(this.voteTopicList, index, item);
},
+
+
+ setOptionDisable() {
+ for (let i = 0, ii = this.voteTopicList.length; i < ii; i++) {
+ for (let k = 0, kk = this.voteTopicList[i].children.length; k < kk; k++) {
+ this.voteTopicList[i].children[k].disabled = true;
+ }
+ }
+ },
+
getParams(signPath) {
let list = JSON.parse(JSON.stringify(this.voteTopicList));
@@ -383,18 +527,73 @@
i.signaturePath = signPath ? signPath : ""
arr.push(i)
}
+ // else if (!i.selected && i.mandatoryFlag == 2) {
+ // this.$showTips('必填议题请选择选项')
+ // return;
+ // }
+
}
return arr;
+ },
+
+
+ checkOption() {
+ let list = this.voteTopicList;
+ for (let i = 0, ii = list.length; i < ii; i++) {
+ if (list[i].optionRange == 0) {
+ if (!list[i].selected && list[i].mandatoryFlag == 2) {
+ this.$showTips('必填议题请选择选项')
+ return false;
+ }
+ } else {
+ if (list[i].mandatoryFlag == 2) {
+ if (list[i].selected) {
+ if (list[i].optionNumberMin && (list[i].optionNumberMin > list[i].selected
+ .length)) { //判断最少需选
+ this.$showTips(`第${i+1}个议题最少需选${list[i].optionNumberMin}项`)
+ return false;
+ }
+ } else {
+ this.$showTips('必填议题请选择选项')
+ return false;
+ }
+ }
+ }
+ }
+ },
+
+ confirmValidationCode() {
+ if (!this.validationCode) {
+ this.$showTips("请输入验证码");
+ return
+ }
+ this.voteRequest()
},
//提交投票
submitVote() {
if (this.applyInfo.signatureFlag == 1) {
+ if (this.voteTopicList.length == 1 && (this.voteTopicList[0].mandatoryFlag == 1 || !this.voteTopicList[
+ 0].mandatoryFlag) && !this.voteTopicList[0].selected) {
+ this.$showTips("请选择议题选项");
+ return
+ } else {
+ if (this.checkOption() === false) return;
+ }
+
uni.navigateTo({
url: `signature?type=2`
})
} else {
- this.voteRequest()
+ if (this.voteTopicList.length == 1 && (this.voteTopicList[0].mandatoryFlag == 1 || !this.voteTopicList[
+ 0].mandatoryFlag) && !this.voteTopicList[0].selected) {
+ this.$showTips("请选择议题选项");
+ return
+ } else {
+ if (this.checkOption() === false) return;
+ }
+ this.isShowPopup = true;
+ // this.voteRequest()
}
@@ -414,17 +613,22 @@
// }
},
- voteRequest(signPath) {
+ voteRequest(signPath, code) {
let data = this.getParams(signPath)
uni.showLoading({
title: "加载中..."
});
- communityModel.addVoteOperate(data).then(res => {
+ communityModel.addVoteOperate({
+ phone: uni.getStorageSync("userInfo").phone,
+ code: code ? code : this.validationCode,
+ children: data
+ }).then(res => {
uni.hideLoading()
if (res.code == 200) {
uni.showToast({
title: "操作成功"
})
+ this.isShowPopup = false;
this.$nextTick(() => {
this.getApplyDetail();
this.getVoteList();
@@ -438,6 +642,67 @@
uni.navigateTo({
url: `comment?id=${this.params.id}`
})
+ },
+
+
+ getValidationCode() {
+ // let phone_reg = /^1(3|4|5|6|7|8|9)\d{9}$/;
+ // if (!phone_reg.test(this.phone)) {
+ // this.$showTips("手机号码有误~");
+ // return false;
+ // }
+ // this.sendValidationCode();
+ if (this.isSendCode) return;
+ let second = 60;
+ this.isSendCode = true;
+ sendCode({
+ phone: uni.getStorageSync("userInfo").phone,
+ }).then(res => {
+ if (res.code == 200) {
+ let time = setInterval(() => {
+ second--
+ this.text = `${second}秒后获取`
+ if (second == 0 || !this.isLogin) {
+ clearInterval(time);
+ this.isSendCode = false
+ this.text = "获取验证码";
+ }
+ }, 1000)
+ } else {
+ this.isSendCode = false;
+ }
+ })
+ },
+
+
+ navToDocument(url) {
+
+ wx.showLoading({
+ title: "加载中...",
+ });
+ wx.downloadFile({
+ url: `${minioBaseUrl}${url}`,
+ success: function(res) {
+ const filePath = res.tempFilePath;
+ wx.openDocument({
+ filePath: filePath,
+ fileType: 'pdf',
+ showMenu: true,
+ success: function(res) {
+ wx.hideLoading();
+ },
+ complete: function(err) {
+ console.log("complete===>", err);
+ },
+ fail: function(res) {
+ console.log("打开失败");
+ },
+ });
+ },
+ });
+ // uni.navigateTo({
+ // url: `document?url=${url}`
+ // })
}
}
}
@@ -527,8 +792,8 @@
border: 1px solid currentColor
}
- .c-d1 {
- color: #d1d1d1;
+ .c-dd {
+ color: #ddd
}
.c-33 {
@@ -540,6 +805,10 @@
.vote-title {
padding: 30rpx 0;
+ }
+
+ .vote-sign {
+ color: red;
}
}
@@ -599,4 +868,88 @@
.mb-30 {
margin-bottom: 30rpx;
}
+
+ .login-mode {
+ padding: 20rpx;
+ }
+
+ .login-input {
+ height: 90rpx;
+ border-radius: 45rpx;
+ background-color: #f0f0f0;
+ padding: 0 30rpx 0 40rpx;
+ margin-top: 20rpx;
+ width: 550rpx;
+ box-sizing: border-box;
+ }
+
+ .login-input text {
+ flex: 1;
+ }
+
+ .login-input input {
+ height: 90rpx;
+ width: 100%;
+ // flex: 3
+ }
+
+ .login-input-btn {
+ width: 200rpx;
+ height: 60rpx;
+ line-height: 60rpx;
+ border-radius: 30rpx;
+ padding: 0;
+ margin: 0;
+ transition: all ease-out .3s;
+ border: none;
+ }
+
+ .login-input-btn::after {
+ border: none;
+ }
+
+ .login-input-btn[disabled] {
+ background-color: #fff !important;
+ color: #aaa !important;
+ }
+
+ .login-explain {
+ margin-top: 10rpx;
+ }
+
+ .login-btn {
+ width: 550rpx;
+ height: 90rpx;
+ line-height: 90rpx;
+ border-radius: 45rpx;
+ margin-top: 50rpx;
+ transition: all ease-out .3s;
+ }
+
+ .login-btn[disabled] {
+ background-color: #9DB9F7 !important;
+ color: #fff !important;
+ }
+
+ .c-aa {
+ color: #aaa;
+ }
+
+ .c-33 {
+ color: #333;
+ }
+
+ .mt-30 {
+ margin-top: 30rpx;
+ }
+
+ .file-btn {
+ display: inline-block;
+ padding: 10rpx 20rpx;
+ border-radius: 6rpx;
+ color: #fff;
+ margin-bottom: 20rpx;
+ text-align: center;
+ background-color: #999;
+ }
</style>
\ No newline at end of file
--
Gitblit v1.9.3