| @@ -0,0 +1,33 @@ | |||||
| import request from '@/utils/request' | |||||
| // 查询投票主题列表 | |||||
| export function listPoll(query) { | |||||
| return request({ | |||||
| url: '/poll/poll/list', | |||||
| method: 'get', | |||||
| params: query | |||||
| }) | |||||
| } | |||||
| // 查询投票主题详细 | |||||
| export function getPoll(id) { | |||||
| return request({ | |||||
| url: '/poll/poll/get/' + id, | |||||
| method: 'get' | |||||
| }) | |||||
| } | |||||
| // 新增投票主题 | |||||
| export function votePoll(id,list) { | |||||
| return request({ | |||||
| url: '/poll/poll/votePoll/'+ id +'/'+ list, | |||||
| method: 'get' | |||||
| }) | |||||
| } | |||||
| // 查询投票详情列表 | |||||
| export function listPollVote(query) { | |||||
| return request({ | |||||
| url: '/poll/pollVote/list', | |||||
| method: 'get', | |||||
| params: query | |||||
| }) | |||||
| } | |||||
| @@ -645,6 +645,15 @@ export const constantRoutes = [ | |||||
| }, | }, | ||||
| component: (resolve) => require(['@/views/onlineHome/zdjs'], resolve) | component: (resolve) => require(['@/views/onlineHome/zdjs'], resolve) | ||||
| }, | }, | ||||
| { | |||||
| path: '/onlineHome/homePollDetail', | |||||
| name: 'homePollDetail', | |||||
| meta: { | |||||
| title: '投票详情', | |||||
| hidden: true, | |||||
| }, | |||||
| component: (resolve) => require(['@/views/onlineHome/homePollDetail'], resolve) | |||||
| }, | |||||
| { | { | ||||
| path: '/flowChart', | path: '/flowChart', | ||||
| name: 'flowChart', | name: 'flowChart', | ||||
| @@ -57,7 +57,6 @@ | |||||
| <van-row style="text-align: center;margin-top: 40px"> | <van-row style="text-align: center;margin-top: 40px"> | ||||
| <van-button color="#1D6FE9" style="border-radius: 6px;width: 90%;margin: 0 auto" @click="adviceAdd">提交</van-button> | <van-button color="#1D6FE9" style="border-radius: 6px;width: 90%;margin: 0 auto" @click="adviceAdd">提交</van-button> | ||||
| </van-row> | </van-row> | ||||
| <onlineHomeIndex></onlineHomeIndex> | |||||
| </div> | </div> | ||||
| </template> | </template> | ||||
| @@ -270,9 +270,6 @@ | |||||
| </template> | </template> | ||||
| </van-cell> | </van-cell> | ||||
| </van-cell-group> | </van-cell-group> | ||||
| <onlineHomeIndex></onlineHomeIndex> | |||||
| </div> | </div> | ||||
| </template> | </template> | ||||
| @@ -87,7 +87,6 @@ | |||||
| title="截止时间" | title="截止时间" | ||||
| :formatter="formatter" | :formatter="formatter" | ||||
| />--> | />--> | ||||
| <onlineHomeIndex></onlineHomeIndex> | |||||
| </div> | </div> | ||||
| </template> | </template> | ||||
| @@ -29,7 +29,6 @@ | |||||
| </van-row> | </van-row> | ||||
| </template> | </template> | ||||
| </van-cell> | </van-cell> | ||||
| <onlineHomeIndex></onlineHomeIndex> | |||||
| </div> | </div> | ||||
| </template> | </template> | ||||
| @@ -29,7 +29,6 @@ | |||||
| </van-row> | </van-row> | ||||
| </template> | </template> | ||||
| </van-cell> | </van-cell> | ||||
| <onlineHomeIndex></onlineHomeIndex> | |||||
| </div> | </div> | ||||
| </template> | </template> | ||||
| @@ -94,7 +94,6 @@ | |||||
| </van-collapse-item> | </van-collapse-item> | ||||
| </van-collapse> | </van-collapse> | ||||
| </van-cell-group> | </van-cell-group> | ||||
| <onlineHomeIndex></onlineHomeIndex> | <onlineHomeIndex></onlineHomeIndex> | ||||
| </div> | </div> | ||||
| </template> | </template> | ||||
| @@ -6,83 +6,52 @@ | |||||
| @click-left="$router.back(-1)" | @click-left="$router.back(-1)" | ||||
| > | > | ||||
| <template #right> | <template #right> | ||||
| <van-image src=""></van-image> | |||||
| <van-image | |||||
| width="18" | |||||
| height="18" | |||||
| src="../../../static/images/onlineHome/voteMenu.png"/> | |||||
| </template> | </template> | ||||
| </van-nav-bar> | </van-nav-bar> | ||||
| <van-row style="margin-top: 20px"> | |||||
| <van-col span="20" offset="2"> | |||||
| <H3 style="line-height: 20px;">活动主题活动主题活动主题活动主题</H3> | |||||
| </van-col> | |||||
| </van-row> | |||||
| <van-row style="margin-top: 10px"> | |||||
| <van-col span="20" offset="2"> | |||||
| <h4 style="color: #878787;line-height: 20px;">活动描述活动描述活动描述</h4> | |||||
| </van-col> | |||||
| </van-row> | |||||
| <van-row style="margin-top: 10px"> | |||||
| <van-col span="9" offset="2"> | |||||
| <van-image | |||||
| width="12" | |||||
| height="12" | |||||
| style="display: inline-block;" | |||||
| src="../../../static/images/onlineHome/vote1.png" | |||||
| /> | |||||
| <p style="display: inline-block;color:#1D6FE9 ">实名</p> | |||||
| <van-image | |||||
| width="12" | |||||
| height="12" | |||||
| style="display: inline-block;" | |||||
| src="../../../static/images/onlineHome/vote1.png" | |||||
| /> | |||||
| <p style="display: inline-block;color:#1D6FE9 ">单选</p> | |||||
| <van-image | |||||
| width="12" | |||||
| height="12" | |||||
| style="display: inline-block;" | |||||
| src="../../../static/images/onlineHome/vote1.png" | |||||
| /> | |||||
| <p style="display: inline-block;color:#1D6FE9 ">多选</p> | |||||
| </van-col> | |||||
| <van-col span="8" offset="5"> | |||||
| <van-image | |||||
| width="12" | |||||
| height="12" | |||||
| style="display: inline-block;" | |||||
| src="../../../static/images/onlineHome/vote.png" | |||||
| /> | |||||
| <p style="display: inline-block">3人已参与</p> | |||||
| </van-col> | |||||
| </van-row> | |||||
| <van-checkbox-group v-model="result" style="margin-top: 20px"> | |||||
| <van-cell-group style="width: 96%;margin:2%;border-radius: 6px;overflow: hidden;padding-top: 10px;padding-bottom: 10px;box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);"> | |||||
| <van-cell title="选项1"> | |||||
| <template #icon> | |||||
| <van-image | |||||
| fit="contain" | |||||
| height="18" | |||||
| style="margin-right: 10px" | |||||
| src="../../../static/images/onlineHome/home3.png" | |||||
| /> | |||||
| </template> | |||||
| <van-checkbox name="a" style="float: right"/> | |||||
| </van-cell> | |||||
| <van-row> | |||||
| <van-col span="15" :offset="2" style=" margin-top: 7px;"> | |||||
| <van-progress :percentage="87" :show-pivot="false"/> | |||||
| </van-col> | |||||
| <van-col span="5" :offset="2"> | |||||
| 57票 87% | |||||
| </van-col> | |||||
| </van-row> | |||||
| </van-cell-group> | |||||
| </van-checkbox-group> | |||||
| <onlineHomeIndex></onlineHomeIndex> | |||||
| <van-list> | |||||
| <van-row v-for="(item,index) in list" :key="index" style="background:#fff;width: 96%;margin:2%;border-radius: 6px;overflow: hidden;padding-top: 10px;padding-bottom: 10px;box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);"> | |||||
| <van-col span="3" style="text-align: center;"> | |||||
| <van-image | |||||
| width="18" | |||||
| height="18" | |||||
| style="display: inline-block;margin-top: 16px" | |||||
| src="../../../static/images/onlineHome/home3.png" | |||||
| /> | |||||
| </van-col> | |||||
| <van-col span="17"> | |||||
| <van-row> | |||||
| <h3 style="line-height: 26px">{{item.subjectName}}</h3> | |||||
| </van-row> | |||||
| <van-row> | |||||
| <p v-if="new Date(item.startTime) > new Date()" style="line-height: 26px"> | |||||
| 开始时间:{{item.startTime}} | |||||
| </p> | |||||
| <p v-if="new Date(item.startTime) <= new Date() && new Date(item.endTime) >= new Date()" style="line-height: 26px"> | |||||
| 截止时间:{{item.endTime}} | |||||
| </p> | |||||
| <p v-if="new Date(item.endTime) < new Date()" style="line-height: 26px"> | |||||
| 发起人:{{item.promoters}} | |||||
| </p> | |||||
| </van-row> | |||||
| </van-col> | |||||
| <van-col span="4"> | |||||
| <h3 v-if="new Date(item.startTime) > new Date()" style="line-height: 50px;color: #1D6FE9" >未开始</h3> | |||||
| <h3 v-if="new Date(item.endTime) < new Date()" style="line-height: 50px;color: #1D6FE9" @click="go(item.id)">查看</h3> | |||||
| <h3 v-if="new Date(item.startTime) <= new Date() && new Date(item.endTime) >= new Date()" style="line-height: 50px;color: #1D6FE9" @click="go(item.id)">投票</h3> | |||||
| </van-col> | |||||
| </van-row> | |||||
| </van-list> | |||||
| </div> | </div> | ||||
| </template> | </template> | ||||
| <script> | <script> | ||||
| import onlineHomeIndex from "../onlineHomeIndex"; | import onlineHomeIndex from "../onlineHomeIndex"; | ||||
| import {getFinancialInAndOut} from "../../api/onlineHome/finacial"; | |||||
| import {listPoll} from "../../api/onlineHome/poll"; | |||||
| export default { | export default { | ||||
| components: { | components: { | ||||
| @@ -92,17 +61,44 @@ | |||||
| data() { | data() { | ||||
| return { | return { | ||||
| activeName: 'a', | activeName: 'a', | ||||
| list: [], | |||||
| list: [{},{}], | |||||
| loading: false, | loading: false, | ||||
| finished: false, | finished: false, | ||||
| result:[], | result:[], | ||||
| // 查询参数 | |||||
| queryParams: { | |||||
| // 分页 | |||||
| pageNum: 1, | |||||
| pageSize: 10, | |||||
| // 查询排序 | |||||
| //orderByColumn: "id", | |||||
| //isAsc: "desc", | |||||
| subjectName: null, | |||||
| status: 3 | |||||
| }, | |||||
| }; | }; | ||||
| }, | }, | ||||
| created() { | |||||
| this.getList(); | |||||
| }, | |||||
| methods: { | |||||
| go(val){ | |||||
| this.$router.push({path:'/onlineHome/homePollDetail',query:{id:val}}); | |||||
| }, | |||||
| getList(){ | |||||
| this.loading = true; | |||||
| listPoll(this.queryParams).then(response => { | |||||
| this.list = response.rows; | |||||
| this.total = response.total; | |||||
| this.loading = false; | |||||
| }); | |||||
| }, | |||||
| }, | |||||
| } | } | ||||
| </script> | </script> | ||||
| <style scoped> | <style scoped> | ||||
| >>>.van-cell::after { | |||||
| >>>.van-col::after { | |||||
| border-bottom: none; | border-bottom: none; | ||||
| } | } | ||||
| </style> | </style> | ||||
| @@ -0,0 +1,219 @@ | |||||
| <template> | |||||
| <div class="app-container"> | |||||
| <van-nav-bar | |||||
| title="投票" | |||||
| left-arrow | |||||
| @click-left="$router.back(-1)" | |||||
| > | |||||
| <template #right> | |||||
| <van-image src=""></van-image> | |||||
| </template> | |||||
| </van-nav-bar> | |||||
| <van-row style="margin-top: 20px"> | |||||
| <van-col span="20" offset="2"> | |||||
| <H3 style="line-height: 20px;">{{form.subjectName}}</H3> | |||||
| </van-col> | |||||
| </van-row> | |||||
| <van-row style="margin-top: 10px"> | |||||
| <van-col span="20" offset="2"> | |||||
| <h4 style="color: #878787;line-height: 20px;">{{form.description}}</h4> | |||||
| </van-col> | |||||
| </van-row> | |||||
| <van-row style="margin-top: 10px"> | |||||
| <van-col span="9" offset="2"> | |||||
| <van-image | |||||
| v-if="form.anonymous==1" | |||||
| width="12" | |||||
| height="12" | |||||
| style="display: inline-block;" | |||||
| src="../../../static/images/onlineHome/vote1.png" | |||||
| /> | |||||
| <p style="display: inline-block;color:#1D6FE9 ">实名</p> | |||||
| <van-image | |||||
| v-if="form.type==1" | |||||
| width="12" | |||||
| height="12" | |||||
| style="display: inline-block;" | |||||
| src="../../../static/images/onlineHome/vote1.png" | |||||
| /> | |||||
| <p v-if="form.type==1" style="display: inline-block;color:#1D6FE9 ">单选</p> | |||||
| <van-image | |||||
| v-if="form.type==2" | |||||
| width="12" | |||||
| height="12" | |||||
| style="display: inline-block;" | |||||
| src="../../../static/images/onlineHome/vote1.png" | |||||
| /> | |||||
| <p v-if="form.type==2" style="display: inline-block;color:#1D6FE9 ">多选</p> | |||||
| </van-col> | |||||
| <van-col span="8" offset="5"> | |||||
| <van-image | |||||
| width="12" | |||||
| height="12" | |||||
| style="display: inline-block;" | |||||
| src="../../../static/images/onlineHome/vote.png" | |||||
| /> | |||||
| <p style="display: inline-block">{{this.form.nums}}人已参与</p> | |||||
| </van-col> | |||||
| </van-row> | |||||
| <van-checkbox-group v-if="form.type==2" v-model="result" style="margin-top: 20px"> | |||||
| <van-cell-group v-for="(item,index) in pollOptions" :key="index" style="width: 96%;margin:2%;border-radius: 6px;overflow: hidden;padding-top: 10px;padding-bottom: 10px;box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);"> | |||||
| <van-cell :title="item.name"> | |||||
| <template #icon> | |||||
| <van-image | |||||
| fit="contain" | |||||
| height="18" | |||||
| style="margin-right: 10px" | |||||
| src="../../../static/images/onlineHome/home3.png" | |||||
| /> | |||||
| </template> | |||||
| <van-checkbox :name="item.id" style="float: right"/> | |||||
| </van-cell> | |||||
| <van-row> | |||||
| <van-col span="15" :offset="2" style="margin-top: 7px;"> | |||||
| <van-progress v-if="result.indexOf(item.id)==-1" :percentage="voteNum>0?((item.num/voteNum)*100).toFixed(2):0" :show-pivot="false"/> | |||||
| <van-progress v-if="result.indexOf(item.id)!=-1" :percentage="(voteNum+result.length)>0?(((item.num+1)/(voteNum+result.length))*100).toFixed(2):0" :show-pivot="false"/> | |||||
| </van-col> | |||||
| <van-col span="5" :offset="2" v-if="result.indexOf(item.id)==-1"> | |||||
| {{item.num}}票 {{voteNum>0?((item.num/voteNum)*100).toFixed(2):0}}% | |||||
| </van-col> | |||||
| <van-col span="5" :offset="2" v-if="result.indexOf(item.id)!=-1"> | |||||
| {{item.num+1}}票 {{(voteNum+result.length)>0?(((item.num+1)/(voteNum+result.length))*100).toFixed(2):0}}% | |||||
| </van-col> | |||||
| </van-row> | |||||
| </van-cell-group> | |||||
| </van-checkbox-group> | |||||
| <van-radio-group v-if="form.type==1" v-model="result1" style="margin-top: 20px"> | |||||
| <van-cell-group v-for="(item,index) in pollOptions" :key="index" style="width: 96%;margin:2%;border-radius: 6px;overflow: hidden;padding-top: 10px;padding-bottom: 10px;box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);"> | |||||
| <van-cell :title="item.name"> | |||||
| <template #icon> | |||||
| <van-image | |||||
| fit="contain" | |||||
| height="18" | |||||
| style="margin-right: 10px" | |||||
| src="../../../static/images/onlineHome/home3.png" | |||||
| /> | |||||
| </template> | |||||
| <van-radio :name="item.id" style="float: right" /> | |||||
| </van-cell> | |||||
| <van-row> | |||||
| <van-col span="15" :offset="2" style="margin-top: 7px;"> | |||||
| <van-progress v-if="result1!=item" :percentage="voteNum>0?((item.num/voteNum)*100).toFixed(2):0" :show-pivot="false"/> | |||||
| <van-progress v-if="result1==item" :percentage="voteNum>0?(((item.num+1)/(voteNum+1))*100).toFixed(2):0" :show-pivot="false"/> | |||||
| </van-col> | |||||
| <van-col span="5" :offset="2" v-if="result1!=item.id"> | |||||
| {{item.num}}票 {{voteNum>0?((item.num/voteNum)*100).toFixed(2):0}}% | |||||
| </van-col> | |||||
| <van-col span="5" :offset="2" v-if="result1==item.id"> | |||||
| {{item.num+1}}票 {{voteNum>0?(((item.num+1)/(voteNum+1))*100).toFixed(2):0}}% | |||||
| </van-col> | |||||
| </van-row> | |||||
| </van-cell-group> | |||||
| </van-radio-group> | |||||
| <van-row style="text-align: center;margin-top: 40px" v-if="isPoll"> | |||||
| <van-button color="#1D6FE9" style="border-radius: 6px;width: 90%;margin: 0 auto" @click="submit">提交</van-button> | |||||
| </van-row> | |||||
| </div> | |||||
| </template> | |||||
| <script> | |||||
| import onlineHomeIndex from "../onlineHomeIndex"; | |||||
| import {getPoll, listPollVote, votePoll} from "../../api/onlineHome/poll"; | |||||
| export default { | |||||
| components: { | |||||
| onlineHomeIndex | |||||
| }, | |||||
| name: "homePollDetail", | |||||
| data() { | |||||
| return { | |||||
| loading: false, | |||||
| form:{}, | |||||
| pollOptions:[], | |||||
| id:this.$route.query.id, | |||||
| voteNum:0, | |||||
| result:[], | |||||
| result1:"", | |||||
| isPoll:true, | |||||
| }; | |||||
| }, | |||||
| created() { | |||||
| this.getInfo(this.id); | |||||
| listPollVote().then(res => { | |||||
| if(res.rows.length>0){ | |||||
| res.rows.map(r => { | |||||
| if(r.pollId==this.id){ | |||||
| this.isPoll=false | |||||
| } | |||||
| }) | |||||
| } | |||||
| }) | |||||
| }, | |||||
| methods:{ | |||||
| reset(){ | |||||
| this.pollOptions = [] | |||||
| }, | |||||
| getInfo(val){ | |||||
| this.reset(); | |||||
| this.loading = true | |||||
| getPoll(val).then(response => { | |||||
| response.data.options.map(res => { | |||||
| this.voteNum += res.num | |||||
| this.pollOptions.push(res) | |||||
| }) | |||||
| this.form = response.data; | |||||
| this.loading = true | |||||
| }); | |||||
| }, | |||||
| submit(){ | |||||
| let list = [] | |||||
| let _this = this | |||||
| if (this.form.type == 1) { | |||||
| if (this.result1 != "") { | |||||
| list.push(this.pollRadioValue) | |||||
| } else { | |||||
| this.$toast({ | |||||
| icon: 'error', // 找到自己需要的图标 | |||||
| message: '请选择一个选项', | |||||
| duration:"1000", | |||||
| onClose:function(){ | |||||
| return false; | |||||
| } | |||||
| }) | |||||
| } | |||||
| } else { | |||||
| if (this.result.length > 0) { | |||||
| list = this.result | |||||
| } else { | |||||
| this.$toast({ | |||||
| icon: 'error', // 找到自己需要的图标 | |||||
| message: '请至少选择一个选项', | |||||
| duration:"1000", | |||||
| onClose:function(){ | |||||
| return false; | |||||
| } | |||||
| }) | |||||
| } | |||||
| } | |||||
| votePoll(this.id,list).then(response => { | |||||
| this.$toast({ | |||||
| icon: 'success', // 找到自己需要的图标 | |||||
| message: '保存成功', | |||||
| duration:"1000", | |||||
| onClose:function(){ | |||||
| _this.getInfo(this.id); | |||||
| } | |||||
| }) | |||||
| }); | |||||
| }, | |||||
| }, | |||||
| } | |||||
| </script> | |||||
| <style scoped> | |||||
| >>>.van-cell::after { | |||||
| border-bottom: none; | |||||
| } | |||||
| </style> | |||||
| @@ -83,7 +83,6 @@ | |||||
| title="截止时间" | title="截止时间" | ||||
| :formatter="formatter" | :formatter="formatter" | ||||
| />--> | />--> | ||||
| <onlineHomeIndex></onlineHomeIndex> | |||||
| </div> | </div> | ||||
| </template> | </template> | ||||
| @@ -83,7 +83,6 @@ | |||||
| title="截止时间" | title="截止时间" | ||||
| :formatter="formatter" | :formatter="formatter" | ||||
| />--> | />--> | ||||
| <onlineHomeIndex></onlineHomeIndex> | |||||
| </div> | </div> | ||||
| </template> | </template> | ||||
| @@ -60,7 +60,6 @@ | |||||
| </template> | </template> | ||||
| </van-cell> | </van-cell> | ||||
| </van-cell-group> | </van-cell-group> | ||||
| <onlineHomeIndex></onlineHomeIndex> | |||||
| </div> | </div> | ||||
| </template> | </template> | ||||
| @@ -35,7 +35,6 @@ | |||||
| </template> | </template> | ||||
| </van-cell> | </van-cell> | ||||
| </van-cell-group> | </van-cell-group> | ||||
| <onlineHomeIndex></onlineHomeIndex> | |||||
| </div> | </div> | ||||
| </template> | </template> | ||||
| @@ -43,7 +43,6 @@ | |||||
| <van-row style="text-align: center;margin-top: 40px"> | <van-row style="text-align: center;margin-top: 40px"> | ||||
| <van-button color="#1D6FE9" style="border-radius: 6px;width: 90%;margin: 0 auto" @click="submit">完成</van-button> | <van-button color="#1D6FE9" style="border-radius: 6px;width: 90%;margin: 0 auto" @click="submit">完成</van-button> | ||||
| </van-row> | </van-row> | ||||
| <onlineHomeIndex></onlineHomeIndex> | |||||
| </div> | </div> | ||||
| </template> | </template> | ||||
| @@ -95,7 +95,6 @@ | |||||
| </van-tab> | </van-tab> | ||||
| <van-tab title="农户画像">农户画像</van-tab> | <van-tab title="农户画像">农户画像</van-tab> | ||||
| </van-tabs> | </van-tabs> | ||||
| <onlineHomeIndex></onlineHomeIndex> | |||||
| </div> | </div> | ||||
| </template> | </template> | ||||
| @@ -55,7 +55,6 @@ | |||||
| </van-list> | </van-list> | ||||
| </van-tab> | </van-tab> | ||||
| </van-tabs> | </van-tabs> | ||||
| <onlineHomeIndex></onlineHomeIndex> | |||||
| </div> | </div> | ||||
| </template> | </template> | ||||
| @@ -30,7 +30,6 @@ | |||||
| </van-row> | </van-row> | ||||
| </template> | </template> | ||||
| </van-cell> | </van-cell> | ||||
| <onlineHomeIndex></onlineHomeIndex> | |||||
| </div> | </div> | ||||
| </template> | </template> | ||||
| @@ -29,7 +29,6 @@ | |||||
| </van-row> | </van-row> | ||||
| </template> | </template> | ||||
| </van-cell> | </van-cell> | ||||
| <onlineHomeIndex></onlineHomeIndex> | |||||
| </div> | </div> | ||||
| </template> | </template> | ||||