Files
number_zj/20220330_Vote/Ewide.Web.Entry/Views/Manage/Expert.cshtml
2022-03-31 09:07:38 +08:00

120 lines
4.2 KiB
Plaintext

@*
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="http://lib.baomitu.com/qs/6.10.3/qs.min.js"></script>
</head>
<body>
<div id="app" v-loading="loading">
<h3 style="text-align:center;">2021年度宁波市“甬江建设杯”选票结果</h3>
<el-table :data="tableData" style="width: 20%;margin:0 auto;">
<el-table-column prop="login_code" label="专家"> </el-table-column>
<el-table-column prop="is_vote" label="是否投票" width="120">
<template slot-scope="scope">
<el-tag type="info" v-if="scope.row.is_vote==true">已投</el-tag>
<el-tag type="danger" v-else>未投</el-tag>
</template>
</el-table-column>
</el-table>
<h3 style="text-align:center;">
<el-button @@click="load_vote">刷新数据</el-button>
<el-button @@click="show_expert_vote">查看项目投票情况</el-button>
</h3>
</div>
</body>
<style scoped>
.buhuanhang {
white-space: nowrap;
width: 21%;
}
</style>
<script>
new Vue({
el: '#app',
data: function () {
return {
tableData: [],
loading: false,
token: ''
}
},
created: function () {
this.check_login()
this.loading = true;
this.load_vote();
},
methods: {
show_expert_vote() {
location = '/gb/yjb/manage/index'
},
check_login() {
this.token = window.sessionStorage.getItem('__TOKEN');
if (!this.token)
location = '/gb/yjb/manage/login'
},
load_vote() {
this.loading = true;
let _this = this;
axios({
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
method: 'post',
url: '/gb/yjb/api/projects/expert-vote',
data: {},
responseType: "json",
headers: {
Authorization: 'Bearer ' + _this.token
}
}).then(function (response) {
_this.tableData = response.data.data
console.log(_this.tableData)
_this.loading = false;
}).catch(function (error) {
console.log(error)
_this.$message({
type: 'error',
message: error.message
})
_this.loading = false;
})
},
loading_false() { this.loading = false },
dateFormat(fmt, date) {
let ret;
const opt = {
"Y+": date.getFullYear().toString(), // 年
"m+": (date.getMonth() + 1).toString(), // 月
"d+": date.getDate().toString(), // 日
"H+": date.getHours().toString(), // 时
"M+": date.getMinutes().toString(), // 分
"S+": date.getSeconds().toString() // 秒
// 有其他格式化字符需求可以继续添加,必须转化成字符串
};
for (let k in opt) {
ret = new RegExp("(" + k + ")").exec(fmt);
if (ret) {
fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
};
};
return fmt;
}
}
})
</script>
</html>