|
|
|
@ -1,13 +1,13 @@ |
|
|
|
<script setup lang="ts"> |
|
|
|
import { getVoteprogress, voteMember } from '../../api/votingElection' |
|
|
|
import useUserStore from '@/store/user' |
|
|
|
const userStore = useUserStore() |
|
|
|
import { getVoteprogress, voteMember } from '../../api/votingElection' |
|
|
|
import useUserStore from '@/store/user' |
|
|
|
const userStore = useUserStore() |
|
|
|
|
|
|
|
const xjList = ref<any>({}) |
|
|
|
const xjList = ref<any>({}) |
|
|
|
|
|
|
|
const doSearch = (_formData : { page : number; limit : number }, onSuccess : Function) => { |
|
|
|
const doSearch = (_formData: { page: number; limit: number }, onSuccess: Function) => { |
|
|
|
getVoteprogress().then((res) => { |
|
|
|
const { data } = res as { data : { candidate : any[] } } |
|
|
|
const { data } = res as { data: { candidate: any[] } } |
|
|
|
xjList.value = data || {} |
|
|
|
onSuccess({ |
|
|
|
data: { |
|
|
|
@ -16,9 +16,9 @@ |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const buttlist = ref([ |
|
|
|
const buttlist = ref([ |
|
|
|
{ |
|
|
|
type: '1', |
|
|
|
butname: '同意' |
|
|
|
@ -31,12 +31,12 @@ |
|
|
|
type: '3', |
|
|
|
butname: '弃权' |
|
|
|
} |
|
|
|
]) |
|
|
|
]) |
|
|
|
|
|
|
|
const params = ref([]) |
|
|
|
const selectBut = (data : any, cardid : any, type : string, butname : string) => { |
|
|
|
const params = ref([]) |
|
|
|
const selectBut = (data: any, cardid: any, type: string, butname: string) => { |
|
|
|
if (cardid) { |
|
|
|
const target = data.find((card : { id : any }) => card.id === cardid) |
|
|
|
const target = data.find((card: { id: any }) => card.id === cardid) |
|
|
|
uni.showModal({ |
|
|
|
title: '您本轮选举投' + butname + '票', |
|
|
|
content: '确定吗?', |
|
|
|
@ -52,18 +52,18 @@ |
|
|
|
}) |
|
|
|
params.value.push(target) |
|
|
|
} else { |
|
|
|
data.forEach((ele : { vote_result : number; id : any }) => { |
|
|
|
data.forEach((ele: { vote_result: number; id: any }) => { |
|
|
|
ele.vote_result = 1 |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
const allChange = () => { |
|
|
|
} |
|
|
|
const allChange = () => { |
|
|
|
uni.showModal({ |
|
|
|
title: '您本轮选举全投同意票', |
|
|
|
content: '确定吗?', |
|
|
|
success: function (res) { |
|
|
|
if (res.confirm) { |
|
|
|
xjList.value.data?.forEach((ele : { vote_result : number }) => { |
|
|
|
xjList.value.data?.forEach((ele: { vote_result: number }) => { |
|
|
|
ele.vote_result = 1 |
|
|
|
}) |
|
|
|
params.value = xjList.value.candidate |
|
|
|
@ -73,15 +73,15 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function extractTwoProps(arr : any, key1 : string, key2 : string) { |
|
|
|
function extractTwoProps(arr: any, key1: string, key2: string) { |
|
|
|
return arr.map(({ [key1]: prop1, [key2]: prop2 }) => ({ |
|
|
|
[key1]: prop1, |
|
|
|
[key2]: prop2 |
|
|
|
})) |
|
|
|
} |
|
|
|
const submit = () => { |
|
|
|
} |
|
|
|
const submit = () => { |
|
|
|
let param = { |
|
|
|
openid: userStore.openId, |
|
|
|
id: xjList.value.id, |
|
|
|
@ -94,18 +94,29 @@ |
|
|
|
duration: 1500 // 持续时长,单位ms |
|
|
|
}) |
|
|
|
} else { |
|
|
|
voteMember(param).then((res) => { |
|
|
|
console.log(res, 555555555555555) |
|
|
|
}) |
|
|
|
} |
|
|
|
voteMember(param) |
|
|
|
} |
|
|
|
onShow(() => { |
|
|
|
} |
|
|
|
|
|
|
|
const showDialog = ref(false) |
|
|
|
const navto = (url: string, mode: pageMode = 'navigateTo') => uni.$util.goToPage({ url: url ?? 'pages/index/index', mode }) |
|
|
|
const isEmptyObject = (obj: any) => { |
|
|
|
if (obj == null) return true |
|
|
|
if (typeof obj !== 'object' || Array.isArray(obj)) return true |
|
|
|
return Reflect.ownKeys(obj).length === 0 |
|
|
|
} |
|
|
|
|
|
|
|
onShow(() => { |
|
|
|
if (userStore.mobile === '') { |
|
|
|
uni.navigateTo({ |
|
|
|
url: '/pages/login/login' |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
if (isEmptyObject(userStore.userInfo)) { |
|
|
|
showDialog.value = true |
|
|
|
} |
|
|
|
}) |
|
|
|
</script> |
|
|
|
|
|
|
|
<template> |
|
|
|
@ -132,9 +143,13 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="bottomp"> |
|
|
|
<view class="minbut" v-for="(item, ele) in buttlist" :key="ele" |
|
|
|
<view |
|
|
|
class="minbut" |
|
|
|
v-for="(item, ele) in buttlist" |
|
|
|
:key="ele" |
|
|
|
@click="selectBut(data, row.id, item.type, item.butname)" |
|
|
|
:class="{ active: row.vote_result === item.type }"> |
|
|
|
:class="{ active: row.vote_result === item.type }" |
|
|
|
> |
|
|
|
{{ item.butname }} |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
@ -147,16 +162,29 @@ |
|
|
|
<view class="tjtp" @click="submit">提交投票</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view style="display: grid;align-items: center;justify-content: center;width: 100%;height: 100vh;align-content: center;" v-else> |
|
|
|
<img style="width: 188px;height: 140px;" src="@/static/img/Group.png" alt="" /> |
|
|
|
<text class="nodata"> |
|
|
|
暂时没有选举 请刷新重试 |
|
|
|
</text> |
|
|
|
<view style="display: grid; align-items: center; justify-content: center; width: 100%; height: 100vh; align-content: center" v-else> |
|
|
|
<img style="width: 188px; height: 140px" src="@/static/img/Group.png" alt="" /> |
|
|
|
<text class="nodata">暂时没有选举 请刷新重试</text> |
|
|
|
</view> |
|
|
|
<u-modal |
|
|
|
title="提示" |
|
|
|
:show="showDialog" |
|
|
|
width="650rpx" |
|
|
|
:confirm-color="'#2979ff'" |
|
|
|
:cancel-color="'#606266'" |
|
|
|
:show-confirm-button="true" |
|
|
|
:show-cancel-button="false" |
|
|
|
:close-on-click-overlay="true" |
|
|
|
@confirm="navto('pages/mine/index', 'reLaunch')" |
|
|
|
@cancel="showDialog = false" |
|
|
|
@close="showDialog = false" |
|
|
|
> |
|
|
|
请您签到之后再进行投票! |
|
|
|
</u-modal> |
|
|
|
</template> |
|
|
|
|
|
|
|
<style scoped lang="scss"> |
|
|
|
.box { |
|
|
|
.box { |
|
|
|
width: 100%; |
|
|
|
background-color: #f9fafb; |
|
|
|
|
|
|
|
@ -386,13 +414,13 @@ |
|
|
|
bottom: 0; |
|
|
|
border-top: 2rpx solid #ebebec; |
|
|
|
} |
|
|
|
} |
|
|
|
.nodata { |
|
|
|
} |
|
|
|
.nodata { |
|
|
|
margin-top: 43px; |
|
|
|
font-family: Source Han Sans; |
|
|
|
font-size: 18px; |
|
|
|
font-weight: 500; |
|
|
|
letter-spacing: normal; |
|
|
|
color: #34343F; |
|
|
|
} |
|
|
|
color: #34343f; |
|
|
|
} |
|
|
|
</style> |