From 0ad4dfee853c397cf58c109670e79bc93d3b7eba Mon Sep 17 00:00:00 2001
From: Hx <2294602187@qq.com>
Date: Fri, 28 Mar 2025 18:32:26 +0800
Subject: [PATCH] =?UTF-8?q?=E9=80=89=E4=B8=BE=E5=88=97=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/common.ts | 17 ++++++++++++
src/pages/electionList/index.vue | 41 ++++++++++++++--------------
src/pages/electionList/info.vue | 46 ++++++++++++++++++++------------
src/utils/http.ts | 3 +--
4 files changed, 68 insertions(+), 39 deletions(-)
create mode 100644 src/api/common.ts
diff --git a/src/api/common.ts b/src/api/common.ts
new file mode 100644
index 0000000..692c02b
--- /dev/null
+++ b/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
+ })
+}
diff --git a/src/pages/electionList/index.vue b/src/pages/electionList/index.vue
index d210237..abaa607 100644
--- a/src/pages/electionList/index.vue
+++ b/src/pages/electionList/index.vue
@@ -1,11 +1,10 @@
@@ -18,36 +17,38 @@ const doSearch = (_formData: { page: number; limit: number }, onSuccess: Functio
- {{ '2024年度学生会主席选举' }}
- 进行中
-
-
+ {{ row.title }}
+ 进行中
+ 未开始
+ 已结束
- {{ '投票时间:2024-03-01 至 2024-03-07' }}
+ {{ `投票时间:${row.start_time} 至 ${row.end_time}` }}
-
-
+
+
+
+
- 陈佳怡
-
- 未当选
+ {{ v.name }}
+ 当选
+ 未当选
- 得票数:286
+ 得票数:{{ v.agree_num }}
-
- 60%
+
+ {{ v.ageree_percent }}%
- 查看投票详情
+ 查看投票详情
diff --git a/src/pages/electionList/info.vue b/src/pages/electionList/info.vue
index adb0e66..b0bf738 100644
--- a/src/pages/electionList/info.vue
+++ b/src/pages/electionList/info.vue
@@ -1,56 +1,68 @@
-
+
- 2024年度业主委员会主任选举
+ {{ info.title }}
已结束
- 2024-01-15 10:00 ~ 2024-01-16 10:00
+ {{ info.start_time }} ~ {{ info.end_time }}
-
+
参选人数
-
+
候选人数
-
+
当选人数
-
+
-
- 陈志明
- 当选
-
+
+
+
+ {{ v.name }}
+ 当选
+ 未当选
同意
- 98 票(62.8%)
+ {{ v.agree_num }} 票({{ v.ageree_percent.toFixed(2) }}%)
-
+
反对
- 35 票 (22.4%)
+ {{ v.disagree_num }} 票({{ v.giveup_percent.toFixed(2) }}%)
-
+
弃权
- 23 票 (14.8%)
+ {{ v.giveup_num }} 票({{ v.giveup_percent.toFixed(2) }}%)
-
+
diff --git a/src/utils/http.ts b/src/utils/http.ts
index 9bfc34b..20a5692 100644
--- a/src/utils/http.ts
+++ b/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)