Compare commits

...

3 Commits

  1. 17
      src/api/common.ts
  2. 9
      src/api/votingElection.ts
  3. 41
      src/pages/electionList/index.vue
  4. 46
      src/pages/electionList/info.vue
  5. 529
      src/pages/myElection/index.vue
  6. 690
      src/pages/votingElection/index.vue
  7. 3
      src/utils/http.ts

17
src/api/common.ts

@ -0,0 +1,17 @@
import { request } from '@/utils/http'
export function getVoteList(data: pageType) {
return request.http({
url: '/api/vote_list',
method: 'GET',
data
})
}
export function getVoteDetail(data: { id: number }) {
return request.http({
url: '/api/vote_result_detail',
method: 'GET',
data
})
}

9
src/api/votingElection.ts

@ -1,12 +1,10 @@
import { request } from '@/utils/http'
// 获取投票选举(正在进行)
export function getVoteprogress() {
return request.http({
url: '/api/vote_progress',
method: "GET"
method: 'GET'
})
}
@ -22,7 +20,6 @@ export function voteMember(data: any) {
export function getMyvote() {
return request.http({
url: '/api/my_vote',
method: "GET"
method: 'GET'
})
}
}

41
src/pages/electionList/index.vue

@ -1,11 +1,10 @@
<script setup lang="ts">
import { getVoteList } from '@/api/common'
const navto = (url: string, params = {}) => uni.$util.goToPage({ url, params })
const doSearch = (_formData: { page: number; limit: number }, onSuccess: Function) => {
onSuccess({
data: {
data: [{ name: '测试一' }, { name: '测试二' }],
total: 4
}
const doSearch = (formData: { page: number; limit: number }, onSuccess: Function) => {
getVoteList(formData).then((res) => {
const { data } = res as { data: { data: any; total: number } }
onSuccess({ data })
})
}
</script>
@ -18,36 +17,38 @@ const doSearch = (_formData: { page: number; limit: number }, onSuccess: Functio
<view class="flex">
<view class="flex1">
<view class="flex-center-start">
<text class="text-ellipsis title">{{ '2024年度学生会主席选举' }}</text>
<text class="status b">进行中</text>
<!-- <text class="status f">未开始</text> -->
<!-- <text class="status e">已结束</text> -->
<text class="text-ellipsis title">{{ row.title }}</text>
<text class="status b" v-if="row.status === 2">进行中</text>
<text class="status f" v-else-if="row.status === 1">未开始</text>
<text class="status e" v-else>已结束</text>
</view>
<view class="time">{{ '投票时间:2024-03-01 至 2024-03-07' }}</view>
<view class="time">{{ `投票时间:${row.start_time}${row.end_time}` }}</view>
</view>
<view :class="{ arrow: true, active: row.showInfo }" @click="row.showInfo = !row.showInfo">
<u-icon name="arrow-down" color="#9CA3AF" />
</view>
</view>
<view class="info" v-if="row.showInfo">
<view class="flex info-items" v-for="(v, k) of 2" :key="k">
<view class="head"></view>
<view class="flex info-items" v-for="(v, k) of row.candidate" :key="k">
<view class="head">
<image :src="v.photo" mode="aspectFill" />
</view>
<view class="content flex1">
<view class="name flex-center-start">
<text>陈佳怡</text>
<!-- <text class="status">当选</text> -->
<text class="status un">未当选</text>
<text>{{ v.name }}</text>
<text class="status" v-if="v.vote_result == 1">当选</text>
<text class="status un" v-else>未当选</text>
</view>
<view class="votes">得票数286</view>
<view class="votes">得票数{{ v.agree_num }}</view>
</view>
<view class="progress">
<u-line-progress :percentage="60" height="8rpx" active-color="#2563EB" :show-text="false" />
<view class="progress-text">60%</view>
<u-line-progress :percentage="v.ageree_percent" height="8rpx" active-color="#2563EB" :show-text="false" />
<view class="progress-text">{{ v.ageree_percent }}%</view>
</view>
</view>
<view class="info-bts" @click.stop="navto('pages/electionList/info')">查看投票详情</view>
<view class="info-bts" @click.stop="navto('pages/electionList/info', { id: row.id })">查看投票详情</view>
</view>
</view>
</template>

46
src/pages/electionList/info.vue

@ -1,56 +1,68 @@
<script setup lang="ts"></script>
<script setup lang="ts">
import { getVoteDetail } from '@/api/common'
const info = ref<any>({})
onLoad((opt) => {
getVoteDetail({ id: opt?.id }).then((res: any) => {
info.value = res.data
})
})
</script>
<template>
<view class="electionList-info">
<view class="head">
<view class="title">2024年度业主委员会主任选举</view>
<view class="title">{{ info.title }}</view>
<view class="status">
<text style="color: #4b5563; margin-right: 16rpx">已结束</text>
<text style="color: #6b7280">2024-01-15 10:00 ~ 2024-01-16 10:00</text>
<text style="color: #6b7280">{{ info.start_time }} ~ {{ info.end_time }}</text>
</view>
</view>
<view class="countview flex-center-between">
<view class="flex column items">
<u-count-to :start-val="0" :end-val="20" bold font-size="48rpx" color="#2563EB" />
<u-count-to :start-val="0" :end-val="info.member_num" bold font-size="48rpx" color="#2563EB" />
<view class="tip">参选人数</view>
</view>
<view class="flex column items">
<u-count-to :start-val="0" :end-val="20" bold font-size="48rpx" color="#2563EB" />
<u-count-to :start-val="0" :end-val="info.candidate_num" bold font-size="48rpx" color="#2563EB" />
<view class="tip">候选人数</view>
</view>
<view class="flex column items">
<u-count-to :start-val="0" :end-val="20" bold font-size="48rpx" color="#2563EB" />
<u-count-to :start-val="0" :end-val="info.elected_num" bold font-size="48rpx" color="#2563EB" />
<view class="tip">当选人数</view>
</view>
</view>
<view class="content" v-for="(v, k) of 4" :key="k">
<view class="content" v-for="(v, k) of info.candidate" :key="k">
<view class="flex">
<view class="headimg"></view>
<view class="name">陈志明</view>
<view class="status">当选</view>
<!-- <view class="status un">未当选</view> -->
<view class="headimg">
<image :src="v.photo" mode="aspectFill" />
</view>
<view class="name">{{ v.name }}</view>
<view class="status" v-if="v.vote_result == 1">当选</view>
<view class="status un" v-else>未当选</view>
</view>
<view class="progress">
<view class="flex-center-between progress-text">
<text>同意</text>
<text class="b">98 (62.8%)</text>
<text class="b">{{ v.agree_num }} ({{ v.ageree_percent.toFixed(2) }}%)</text>
</view>
<u-line-progress :percentage="62.8" height="8rpx" active-color="#2563EB" :show-text="false" />
<u-line-progress :percentage="v.ageree_percent" height="8rpx" active-color="#2563EB" :show-text="false" />
</view>
<view class="progress">
<view class="flex-center-between progress-text">
<text>反对</text>
<text class="e">35 (22.4%)</text>
<text class="e">{{ v.disagree_num }} ({{ v.giveup_percent.toFixed(2) }}%)</text>
</view>
<u-line-progress :percentage="22.4" height="8rpx" active-color="#ef4444" :show-text="false" />
<u-line-progress :percentage="v.giveup_percent" height="8rpx" active-color="#ef4444" :show-text="false" />
</view>
<view class="progress">
<view class="flex-center-between progress-text">
<text>弃权</text>
<text class="f">23 (14.8%)</text>
<text class="f">{{ v.giveup_num }} ({{ v.giveup_percent.toFixed(2) }}%)</text>
</view>
<u-line-progress :percentage="14.8" height="8rpx" active-color="#9CA3AF" :show-text="false" />
<u-line-progress :percentage="v.giveup_percent" height="8rpx" active-color="#9CA3AF" :show-text="false" />
</view>
</view>
</view>

529
src/pages/myElection/index.vue

@ -1,272 +1,271 @@
<template>
<view class="container">
<scroll-view class="scroll-view" scroll-y @scrolltolower="loadMore" :show-scrollbar="false">
<view v-for="(item, index) in electionList" :key="index" class="election-item">
<view class="year-title">
<view class="headpart">
<text class="title">{{ item.title }}</text>
<view class="type" :style="
item.type == '投票中'
? 'background: #DBEAFE;color: #3B82F6;'
: item.type == '当选'
? 'background: #DCFCE7;color: #10B981'
: 'background: #F3F4F6;color: #4B5563'
">
{{ item.type }}
</view>
</view>
</view>
<view class="flex-center-between" style="display: flex">
<view style="display: grid">
<view
v-for="(candidate, cIndex) in item.candidates.slice(0, expandedStates[index] ? item.candidates.length : 1)"
:key="cIndex" class="candidate-item">
<view class="info-section">
<view style="display: flex; align-items: center">
<img style="width: 96rpx; height: 96rpx; border-radius: 50%" :src="item.img"
alt="" />
<view style="margin-left: 24rpx; display: grid">
<text class="name">{{ candidate.name }}</text>
<text class="college">{{ candidate.college }}</text>
</view>
</view>
<view style="display: flex; margin-top: 24rpx">
我的选择
<view :class="['choice-tag', choiceClass(candidate.choice)]">
{{ choiceText(candidate.choice) }}
</view>
</view>
</view>
</view>
</view>
<view class="expand-btn" @click="toggleExpand(index)">
<text :class="['arrow', expandedStates[index] ? 'up' : 'down']"></text>
</view>
</view>
</view>
</scroll-view>
</view>
<view class="container">
<scroll-view class="scroll-view" scroll-y @scrolltolower="loadMore" :show-scrollbar="false">
<view v-for="(item, index) in electionList" :key="index" class="election-item">
<view class="year-title">
<view class="headpart">
<text class="title">{{ item.title }}</text>
<view
class="type"
:style="
item.type == '投票中'
? 'background: #DBEAFE;color: #3B82F6;'
: item.type == '当选'
? 'background: #DCFCE7;color: #10B981'
: 'background: #F3F4F6;color: #4B5563'
"
>
{{ item.type }}
</view>
</view>
</view>
<view class="flex-center-between" style="display: flex">
<view style="display: grid">
<view
v-for="(candidate, cIndex) in item.candidates.slice(0, expandedStates[index] ? item.candidates.length : 1)"
:key="cIndex"
class="candidate-item"
>
<view class="info-section">
<view style="display: flex; align-items: center">
<img style="width: 96rpx; height: 96rpx; border-radius: 50%" :src="item.img" alt="" />
<view style="margin-left: 24rpx; display: grid">
<text class="name">{{ candidate.name }}</text>
<text class="college">{{ candidate.college }}</text>
</view>
</view>
<view style="display: flex; margin-top: 24rpx">
我的选择
<view :class="['choice-tag', choiceClass(candidate.choice)]">
{{ choiceText(candidate.choice) }}
</view>
</view>
</view>
</view>
</view>
<view class="expand-btn" @click="toggleExpand(index)">
<text :class="['arrow', expandedStates[index] ? 'up' : 'down']"></text>
</view>
</view>
</view>
</scroll-view>
</view>
</template>
<script setup>
import {
ref,
watch
} from 'vue'
import {
getMyvote
} from '../../api/votingElection'
const electionList = ref([])
const page = ref(1)
const pageSize = ref(10)
const loading = ref(false)
const noMoreData = ref(false)
//
const expandedStates = ref([])
watch(
() => electionList.value,
(newVal) => {
expandedStates.value = newVal.map(() => false)
}, {
immediate: true
}
)
const toggleExpand = (index) => {
expandedStates.value[index] = !expandedStates.value[index]
}
const choiceClass = (choice) => {
switch (choice) {
case 1:
return 'agree'
case 0:
return 'oppose'
case 2:
return 'abstain'
default:
return ''
}
}
const choiceText = (choice) => {
return ({
1: '同意',
0: '反对',
2: '弃权'
} [choice] || '')
}
//
const getList = async () => {
try {
loading.value = true
//
const mockData = await getMyvote().then((res)=> {
})
//
dataList.value = [...dataList.value, ...mockData]
//
noMoreData.value = mockData.length < pageSize.value
} finally {
loading.value = false
}
}
//
const loadMore = () => {
if (loading.value || noMoreData.value) return
page.value += 1
getList()
}
onMounted(() => {
getList()
})
import { ref, watch } from 'vue'
import { getMyvote } from '../../api/votingElection'
const electionList = ref([])
const page = ref(1)
const pageSize = ref(10)
const loading = ref(false)
const noMoreData = ref(false)
//
const expandedStates = ref([])
watch(
() => electionList.value,
(newVal) => {
expandedStates.value = newVal.map(() => false)
},
{
immediate: true
}
)
const toggleExpand = (index) => {
expandedStates.value[index] = !expandedStates.value[index]
}
const choiceClass = (choice) => {
switch (choice) {
case 1:
return 'agree'
case 0:
return 'oppose'
case 2:
return 'abstain'
default:
return ''
}
}
const choiceText = (choice) => {
return (
{
1: '同意',
0: '反对',
2: '弃权'
}[choice] || ''
)
}
//
const getList = async () => {
try {
loading.value = true
//
const mockData = await getMyvote()
//
dataList.value = [...dataList.value, ...mockData]
//
noMoreData.value = mockData.length < pageSize.value
} finally {
loading.value = false
}
}
//
const loadMore = () => {
if (loading.value || noMoreData.value) return
page.value += 1
getList()
}
onMounted(() => {
getList()
})
</script>
<style scoped lang="scss">
.container {
padding: 20rpx;
background-color: #f9fafb;
height: 100vh;
}
.election-item {
margin-bottom: 30rpx;
padding: 34rpx;
border-radius: 24rpx;
background: linear-gradient(0deg, rgba(0, 0, 0, 0.001), rgba(0, 0, 0, 0.001)), #ffffff;
box-sizing: border-box;
border: 2rpx solid #f3f4f6;
box-shadow: 0rpx 2rpx 4rpx 0rpx rgba(0, 0, 0, 0.05);
}
.year-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
.headpart {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
.title {
font-family: Roboto;
font-size: 32rpx;
font-weight: 500;
letter-spacing: normal;
color: #000000;
}
.type {
font-family: Roboto;
font-size: 24rpx;
font-weight: normal;
/* 自动布局 */
display: flex;
flex-direction: column;
padding: 4rpx 16rpx;
gap: 0rpx 20rpx;
flex-wrap: wrap;
align-content: flex-start;
border-radius: 24rpx;
}
}
}
.candidate-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20rpx 0;
}
.info-section {
flex: 1;
display: flex;
flex-direction: column;
}
.name {
font-family: Roboto;
font-size: 28rpx;
font-weight: 500;
letter-spacing: normal;
color: #000000;
}
.college {
font-family: Roboto;
font-size: 24rpx;
font-weight: normal;
letter-spacing: normal;
color: #6b7280;
}
.choice-tag {
display: flex;
justify-content: center;
align-items: center;
font-family: Roboto;
font-size: 28rpx;
font-weight: normal;
}
.agree {
color: #3b82f6;
}
.oppose {
color: #f44336;
}
.abstain {
color: #9ca3af;
}
.year-title {
display: flex;
justify-content: space-between;
align-items: center;
}
.expand-btn {
display: flex;
align-items: center;
color: #666;
font-size: 26rpx;
padding: 10rpx 20rpx;
}
.arrow {
display: inline-block;
width: 0;
height: 0;
margin-left: 10rpx;
border-left: 10rpx solid transparent;
border-right: 10rpx solid transparent;
}
.down {
border-top: 15rpx solid #999;
}
.up {
border-bottom: 15rpx solid #999;
}
/* 优化候选人项间距 */
.candidate-item:last-child {
border-bottom: none;
}
</style>
.container {
padding: 20rpx;
background-color: #f9fafb;
height: 100vh;
}
.election-item {
margin-bottom: 30rpx;
padding: 34rpx;
border-radius: 24rpx;
background: linear-gradient(0deg, rgba(0, 0, 0, 0.001), rgba(0, 0, 0, 0.001)), #ffffff;
box-sizing: border-box;
border: 2rpx solid #f3f4f6;
box-shadow: 0rpx 2rpx 4rpx 0rpx rgba(0, 0, 0, 0.05);
}
.year-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
.headpart {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
.title {
font-family: Roboto;
font-size: 32rpx;
font-weight: 500;
letter-spacing: normal;
color: #000000;
}
.type {
font-family: Roboto;
font-size: 24rpx;
font-weight: normal;
/* 自动布局 */
display: flex;
flex-direction: column;
padding: 4rpx 16rpx;
gap: 0rpx 20rpx;
flex-wrap: wrap;
align-content: flex-start;
border-radius: 24rpx;
}
}
}
.candidate-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20rpx 0;
}
.info-section {
flex: 1;
display: flex;
flex-direction: column;
}
.name {
font-family: Roboto;
font-size: 28rpx;
font-weight: 500;
letter-spacing: normal;
color: #000000;
}
.college {
font-family: Roboto;
font-size: 24rpx;
font-weight: normal;
letter-spacing: normal;
color: #6b7280;
}
.choice-tag {
display: flex;
justify-content: center;
align-items: center;
font-family: Roboto;
font-size: 28rpx;
font-weight: normal;
}
.agree {
color: #3b82f6;
}
.oppose {
color: #f44336;
}
.abstain {
color: #9ca3af;
}
.year-title {
display: flex;
justify-content: space-between;
align-items: center;
}
.expand-btn {
display: flex;
align-items: center;
color: #666;
font-size: 26rpx;
padding: 10rpx 20rpx;
}
.arrow {
display: inline-block;
width: 0;
height: 0;
margin-left: 10rpx;
border-left: 10rpx solid transparent;
border-right: 10rpx solid transparent;
}
.down {
border-top: 15rpx solid #999;
}
.up {
border-bottom: 15rpx solid #999;
}
/* 优化候选人项间距 */
.candidate-item:last-child {
border-bottom: none;
}
</style>

690
src/pages/votingElection/index.vue

@ -1,378 +1,378 @@
<script setup lang="ts">
import { getVoteprogress, voteMember } from '../../api/votingElection'
import { getUserList } from '../../api/user'
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({})
const doSearch = (_formData : { page : number; limit : number }, onSuccess : Function) => {
getVoteprogress().then((res) => {
xjList.value = res.data
res.data.data = res.data.candidate;
// 2.
delete res.data.candidate;
res.data.total = res.data.candidate?.length
const { data } = res as { data : { data : any; total : number } }
onSuccess({ data })
})
const xjList = ref({})
const doSearch = (_formData: { page: number; limit: number }, onSuccess: Function) => {
getVoteprogress().then((res) => {
xjList.value = res.data
res.data.data = res.data.candidate
// 2.
delete res.data.candidate
res.data.total = res.data.candidate?.length
const { data } = res as { data: { data: any; total: number } }
onSuccess({ data })
})
}
}
const buttlist = ref([
{
type: '1',
butname: '同意'
},
{
type: '2',
butname: '反对'
},
{
type: '3',
butname: '弃权'
}
])
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)
uni.showModal({
title: '您本轮选举投' + butname + '票',
content: '确定吗?',
success: function (res) {
if (res.confirm) {
if (target) {
target.vote_result = type
}
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
params.value.push(target)
} else {
data.forEach((ele: { vote_result: number; id: any }) => {
ele.vote_result = 1
})
}
}
const allChange = () => {
uni.showModal({
title: '您本轮选举全投同意票',
content: '确定吗?',
success: function (res) {
if (res.confirm) {
xjList.value.data?.forEach((ele: { vote_result: number }) => {
ele.vote_result = 1
})
params.value = xjList.value.data
submit()
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
}
const buttlist = ref([
{
type: '1',
butname: '同意'
},
{
type: '2',
butname: '反对'
},
{
type: '3',
butname: '弃权'
}
])
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)
uni.showModal({
title: '您本轮选举投' + butname + '票',
content: '确定吗?',
success: function (res) {
if (res.confirm) {
if (target) {
target.vote_result = type
}
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
params.value.push(target)
} else {
data.forEach((ele : {
vote_result : number; id : any;
}) => {
ele.vote_result = 1
})
}
}
const allChange = () => {
uni.showModal({
title: '您本轮选举全投同意票',
content: '确定吗?',
success: function (res) {
if (res.confirm) {
xjList.value.data?.forEach((ele : { vote_result : number; }) => {
ele.vote_result = 1
})
params.value = xjList.value.data
submit()
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
}
function extractTwoProps(arr:any, key1:string, key2:string) {
return arr.map(({ [key1]: prop1, [key2]: prop2 }) => ({
[key1]: prop1,
[key2]: prop2
}));
}
const submit = () => {
let param = {
openid: userStore.openId,
id: xjList.value.id,
candidate: JSON.stringify(extractTwoProps(params.value,'id','vote_result'))
}
if(param.candidate === '[]') {
uni.showToast({
title: '未选举',
icon: 'none', // 'success', 'loading', 'none'
duration: 1500 // ms
});
} else {
voteMember(param).then((res)=> {
console.log(res,555555555555555)
})
}
}
function extractTwoProps(arr: any, key1: string, key2: string) {
return arr.map(({ [key1]: prop1, [key2]: prop2 }) => ({
[key1]: prop1,
[key2]: prop2
}))
}
const submit = () => {
let param = {
openid: userStore.openId,
id: xjList.value.id,
candidate: JSON.stringify(extractTwoProps(params.value, 'id', 'vote_result'))
}
if (param.candidate === '[]') {
uni.showToast({
title: '未选举',
icon: 'none', // 'success', 'loading', 'none'
duration: 1500 // ms
})
} else {
voteMember(param).then((res) => {
console.log(res, 555555555555555)
})
}
}
</script>
<template>
<!-- 你的页面内容 -->
<view class="box">
<view class="headpart">
<view class="title">{{ xjList.title }}</view>
<view class="time">投票开始时间{{ xjList.start_time }}</view>
<view class="time">投票截止时间{{ xjList.end_time }}</view>
</view>
<ex-list ref="reListRef" custom-list-type="custom" :on-form-search="doSearch">
<template v-slot="{ data }">
<view class="tppart">
<view class="tpone" v-for="(row, index) of data" :key="'tpone' + index">
<view class="topp">
<img style="width: 96rpx; height: 96rpx; border-radius: 50%" :src="row.photo" alt="" />
<view class="rightpart">
<view class="name">
{{ row.name }}
</view>
<view class="class">
{{ row.position }}
</view>
</view>
</view>
<view class="bottomp">
<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 }">
{{ item.butname }}
</view>
</view>
</view>
</view>
</template>
</ex-list>
<view class="bottbutton">
<view class="qbty" @click="allChange">全部同意</view>
<view class="tjtp" @click="submit">提交投票</view>
</view>
</view>
<!-- 你的页面内容 -->
<view class="box">
<view class="headpart">
<view class="title">{{ xjList.title }}</view>
<view class="time">投票开始时间{{ xjList.start_time }}</view>
<view class="time">投票截止时间{{ xjList.end_time }}</view>
</view>
<ex-list ref="reListRef" custom-list-type="custom" :on-form-search="doSearch">
<template v-slot="{ data }">
<view class="tppart">
<view class="tpone" v-for="(row, index) of data" :key="'tpone' + index">
<view class="topp">
<img style="width: 96rpx; height: 96rpx; border-radius: 50%" :src="row.photo" alt="" />
<view class="rightpart">
<view class="name">
{{ row.name }}
</view>
<view class="class">
{{ row.position }}
</view>
</view>
</view>
<view class="bottomp">
<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 }"
>
{{ item.butname }}
</view>
</view>
</view>
</view>
</template>
</ex-list>
<view class="bottbutton">
<view class="qbty" @click="allChange">全部同意</view>
<view class="tjtp" @click="submit">提交投票</view>
</view>
</view>
</template>
<style scoped lang="scss">
.box {
width: 100%;
background-color: #f9fafb;
.box {
width: 100%;
background-color: #f9fafb;
.headpart {
width: 92%;
height: 194rpx;
border-radius: 24rpx;
background-color: #eff6ff;
margin: 32rpx auto;
padding: 20rpx 3%;
.headpart {
width: 92%;
height: 194rpx;
border-radius: 24rpx;
background-color: #eff6ff;
margin: 32rpx auto;
padding: 20rpx 3%;
.title {
color: #2563eb;
font-size: 28rpx;
margin-top: 16rpx;
}
.title {
color: #2563eb;
font-size: 28rpx;
margin-top: 16rpx;
}
.time {
margin-top: 16rpx;
color: #4b5563;
font-size: 28rpx;
}
}
.time {
margin-top: 16rpx;
color: #4b5563;
font-size: 28rpx;
}
}
.tppart {
width: 100%;
max-height: 69vh;
overflow-y: auto;
display: grid;
justify-items: center;
.tppart {
width: 100%;
max-height: 69vh;
overflow-y: auto;
display: grid;
justify-items: center;
.tpone {
width: 91%;
height: 264rpx;
padding: 20rpx 4%;
box-sizing: border-box;
border-radius: 24rpx;
background: linear-gradient(0deg, rgba(0, 0, 0, 0.001), rgba(0, 0, 0, 0.001)), #ffffff;
box-sizing: border-box;
border: 2rpx solid #f3f4f6;
box-shadow:
0rpx 2rpx 4rpx -2rpx rgba(0, 0, 0, 0.1),
0rpx 2rpx 6rpx 0rpx rgba(0, 0, 0, 0.1);
margin-top: 32rpx;
display: grid;
.tpone {
width: 91%;
height: 264rpx;
padding: 20rpx 4%;
box-sizing: border-box;
border-radius: 24rpx;
background: linear-gradient(0deg, rgba(0, 0, 0, 0.001), rgba(0, 0, 0, 0.001)), #ffffff;
box-sizing: border-box;
border: 2rpx solid #f3f4f6;
box-shadow:
0rpx 2rpx 4rpx -2rpx rgba(0, 0, 0, 0.1),
0rpx 2rpx 6rpx 0rpx rgba(0, 0, 0, 0.1);
margin-top: 32rpx;
display: grid;
.topp {
display: flex;
.topp {
display: flex;
.rightpart {
margin-left: 32rpx;
display: grid;
justify-items: left;
align-content: baseline;
.rightpart {
margin-left: 32rpx;
display: grid;
justify-items: left;
align-content: baseline;
.name {
font-family: Roboto;
font-size: 28rpx;
font-weight: 500;
line-height: 42rpx;
letter-spacing: normal;
color: #000000;
margin-top: 7rpx;
}
.name {
font-family: Roboto;
font-size: 28rpx;
font-weight: 500;
line-height: 42rpx;
letter-spacing: normal;
color: #000000;
margin-top: 7rpx;
}
.class {
font-family: Roboto;
font-size: 28rpx;
font-weight: normal;
line-height: 40rpx;
letter-spacing: normal;
color: #6b7280;
margin-top: 7rpx;
}
}
}
.class {
font-family: Roboto;
font-size: 28rpx;
font-weight: normal;
line-height: 40rpx;
letter-spacing: normal;
color: #6b7280;
margin-top: 7rpx;
}
}
}
.bottomp {
display: flex;
justify-content: space-between;
gap: 0rpx 20rpx;
.bottomp {
display: flex;
justify-content: space-between;
gap: 0rpx 20rpx;
.minbut {
flex: 1;
width: 190rpx;
height: 76rpx;
/* 自动布局 */
display: flex;
justify-content: center;
padding: 16rpx 32rpx;
flex-wrap: wrap;
align-content: flex-start;
border-radius: 8rpx;
background: #ffffff;
box-sizing: border-box;
border: 2rpx solid #d1d5db;
font-family: Roboto;
font-size: 28rpx;
font-weight: normal;
line-height: 40rpx;
text-align: center;
letter-spacing: normal;
color: #4b5563;
}
.minbut {
flex: 1;
width: 190rpx;
height: 76rpx;
/* 自动布局 */
display: flex;
justify-content: center;
padding: 16rpx 32rpx;
flex-wrap: wrap;
align-content: flex-start;
border-radius: 8rpx;
background: #ffffff;
box-sizing: border-box;
border: 2rpx solid #d1d5db;
font-family: Roboto;
font-size: 28rpx;
font-weight: normal;
line-height: 40rpx;
text-align: center;
letter-spacing: normal;
color: #4b5563;
}
.minbut.active {
border: 2rpx solid #2563eb;
color: #2563eb;
}
}
}
.minbut.active {
border: 2rpx solid #2563eb;
color: #2563eb;
}
}
}
.tpone:first-child {
margin-top: 0;
}
}
.tpone:first-child {
margin-top: 0;
}
}
.bottbutton {
width: 100%;
height: 10vh;
display: flex;
padding: 24rpx 32rpx;
gap: 0rpx 24rpx;
flex-wrap: wrap;
align-content: flex-start;
background: #ffffff;
box-sizing: border-box;
border-width: 2rpx 0rpx 0rpx 0rpx;
border-style: solid;
border-color: #f3f4f6;
position: fixed;
bottom: 0;
.bottbutton {
width: 100%;
height: 10vh;
display: flex;
padding: 24rpx 32rpx;
gap: 0rpx 24rpx;
flex-wrap: wrap;
align-content: flex-start;
background: #ffffff;
box-sizing: border-box;
border-width: 2rpx 0rpx 0rpx 0rpx;
border-style: solid;
border-color: #f3f4f6;
position: fixed;
bottom: 0;
.qbty {
width: 331rpx;
height: 90rpx;
/* 自动布局 */
display: flex;
box-sizing: border-box;
justify-content: center;
padding: 24rpx 0rpx;
gap: 0rpx 20rpx;
flex-wrap: wrap;
border-radius: 8rpx;
background: #eff6ff;
font-family: Roboto;
font-size: 28rpx;
font-weight: 500;
line-height: 42rpx;
text-align: center;
letter-spacing: normal;
color: #2563eb;
}
.qbty {
width: 331rpx;
height: 90rpx;
/* 自动布局 */
display: flex;
box-sizing: border-box;
justify-content: center;
padding: 24rpx 0rpx;
gap: 0rpx 20rpx;
flex-wrap: wrap;
border-radius: 8rpx;
background: #eff6ff;
font-family: Roboto;
font-size: 28rpx;
font-weight: 500;
line-height: 42rpx;
text-align: center;
letter-spacing: normal;
color: #2563eb;
}
.tjtp {
width: 331rpx;
height: 90rpx;
/* 自动布局 */
display: flex;
box-sizing: border-box;
justify-content: center;
padding: 24rpx 0rpx;
gap: 0rpx 20rpx;
flex-wrap: wrap;
border-radius: 8rpx;
background: #2563eb;
font-family: Roboto;
font-size: 28rpx;
font-weight: 500;
line-height: 42rpx;
text-align: center;
letter-spacing: normal;
color: #ffffff;
}
}
.tjtp {
width: 331rpx;
height: 90rpx;
/* 自动布局 */
display: flex;
box-sizing: border-box;
justify-content: center;
padding: 24rpx 0rpx;
gap: 0rpx 20rpx;
flex-wrap: wrap;
border-radius: 8rpx;
background: #2563eb;
font-family: Roboto;
font-size: 28rpx;
font-weight: 500;
line-height: 42rpx;
text-align: center;
letter-spacing: normal;
color: #ffffff;
}
}
.address-items {
padding: 20rpx 15rpx 32rpx 28rpx;
background-color: #fff;
border-bottom: 2rpx solid #f5f5f5;
.address-items {
padding: 20rpx 15rpx 32rpx 28rpx;
background-color: #fff;
border-bottom: 2rpx solid #f5f5f5;
.left {
flex: 1;
overflow: hidden;
.left {
flex: 1;
overflow: hidden;
.name {
font-size: 28rpx;
font-weight: 700;
color: #101010;
line-height: 40rpx;
margin-right: 16rpx;
}
.name {
font-size: 28rpx;
font-weight: 700;
color: #101010;
line-height: 40rpx;
margin-right: 16rpx;
}
.isdefault {
font-size: 20rpx;
font-weight: 400;
color: #fff;
padding: 4rpx 12rpx;
border-radius: 8rpx;
background: linear-gradient(90deg, #4778ff 0%, #4778ffb8 100%);
}
.isdefault {
font-size: 20rpx;
font-weight: 400;
color: #fff;
padding: 4rpx 12rpx;
border-radius: 8rpx;
background: linear-gradient(90deg, #4778ff 0%, #4778ffb8 100%);
}
.info {
width: 100%;
color: #666;
font-size: 24rpx;
font-weight: 400;
margin-top: 12rpx;
}
}
.info {
width: 100%;
color: #666;
font-size: 24rpx;
font-weight: 400;
margin-top: 12rpx;
}
}
.right {
width: 140rpx;
padding-left: 32rpx;
font-size: 24rpx;
font-weight: 400;
color: #4979ff;
text-align: right;
}
}
.right {
width: 140rpx;
padding-left: 32rpx;
font-size: 24rpx;
font-weight: 400;
color: #4979ff;
text-align: right;
}
}
.buts {
width: 100%;
height: 10vh;
background-color: F3F4F6;
position: fixed;
bottom: 0;
border-top: 2rpx solid #ebebec;
}
}
</style>
.buts {
width: 100%;
height: 10vh;
background-color: F3F4F6;
position: fixed;
bottom: 0;
border-top: 2rpx solid #ebebec;
}
}
</style>

3
src/utils/http.ts

@ -30,8 +30,6 @@ export const request = {
const header = Object.assign({ 'content-type': 'application/json', Authorization: '' }, headers)
console.log('request Url:', url)
uni.request({
url,
header,
@ -39,6 +37,7 @@ export const request = {
data,
success(res) {
const data = res.data as { code: number; data: object; msg: string }
switch (data.code) {
case 1:
resolve(res.data)

Loading…
Cancel
Save