|
|
@ -13,38 +13,45 @@ function getToken() { |
|
|
|
if (parts.length > 1) { |
|
|
|
token = parts[1].split("&")[0]; // 进一步截取 & 之前的字符串 |
|
|
|
} |
|
|
|
console.log("token字符串:",token); // 输出 token 的值 |
|
|
|
console.log("token字符串:", token); // 输出 token 的值 |
|
|
|
|
|
|
|
} |
|
|
|
getToken(); |
|
|
|
const candidates = ref([]) |
|
|
|
function loadCandidates() { |
|
|
|
CanApi.getCandidates(token).then(result =>{ |
|
|
|
CanApi.getCandidates(token).then(result => { |
|
|
|
candidates.value = result.data; |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
loadCandidates(); |
|
|
|
//对话窗 |
|
|
|
const detailVisible = ref(false); |
|
|
|
const details = ref([]) |
|
|
|
function searchDetail(scope){ |
|
|
|
function searchDetail(scope) { |
|
|
|
console.log(scope); |
|
|
|
|
|
|
|
detailVisible.value = true; |
|
|
|
CanApi.Detail(scope).then(result =>{ |
|
|
|
CanApi.Detail(scope).then(result => { |
|
|
|
details.value = result.data; |
|
|
|
for (let i = 0; i < details.value.length; i++) { |
|
|
|
if (details.value[i] && details.value[i].voteTime) { |
|
|
|
details.value[i].voteTime = details.value[i].voteTime.replace('T', ' '); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
//序号 |
|
|
|
const indexMethod = function(index) { |
|
|
|
return index +1; |
|
|
|
const indexMethod = function (index) { |
|
|
|
return index + 1; |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<template> |
|
|
|
<el-table class="table" :data="candidates" style="width: 100%"> |
|
|
|
<el-table-column type="index" :index="indexMethod" label="序号" width="180" /> |
|
|
|
<el-table-column prop="name" label="候选人姓名" width="180" /> |
|
|
|
<el-table-column prop="name" label="候选国家" width="180" /> |
|
|
|
<el-table-column prop="votes" label="获得票数" /> |
|
|
|
<el-table-column label="操作"> |
|
|
|
<template #default="scope"> |
|
|
@ -56,8 +63,7 @@ const indexMethod = function(index) { |
|
|
|
</el-table> |
|
|
|
<!-- 对话框 --> |
|
|
|
<el-dialog v-model="detailVisible" title="投票详情" width="520" center> |
|
|
|
<el-table |
|
|
|
:data="details" class="table-detail" > |
|
|
|
<el-table :data="details" class="table-detail"> |
|
|
|
<el-table-column prop="jwCode" label="投票人精网号" width="150" /> |
|
|
|
<el-table-column prop="voteTime" label="投票时间" width="200" /> |
|
|
|
</el-table> |
|
|
@ -84,7 +90,8 @@ const indexMethod = function(index) { |
|
|
|
.button:hover { |
|
|
|
cursor: pointer; |
|
|
|
} |
|
|
|
.el-dialog__body{ |
|
|
|
|
|
|
|
.el-dialog__body { |
|
|
|
margin: 0 auto; |
|
|
|
} |
|
|
|
</style> |