-
30.gitignore
-
3.vscode/extensions.json
-
29README.md
-
13index.html
-
8jsconfig.json
-
3011package-lock.json
-
22package.json
-
BINpublic/favicon.ico
-
13src/App.vue
-
BINsrc/assets/1.png
-
BINsrc/assets/2.png
-
BINsrc/assets/3.png
-
0src/assets/base.css
-
BINsrc/assets/bg.png
-
BINsrc/assets/bg@2x.png
-
1src/assets/logo.svg
-
3src/assets/main.css
-
BINsrc/assets/top.png
-
BINsrc/assets/前三.png
-
BINsrc/assets/头像框.png
-
BINsrc/assets/寻找队医.png
-
BINsrc/assets/投票规则.png
-
17src/main.js
-
22src/router/index.js
-
12src/stores/counter.js
-
95src/views/BackView.vue
-
423src/views/FrontView.vue
-
18vite.config.js
@ -0,0 +1,30 @@ |
|||
# Logs |
|||
logs |
|||
*.log |
|||
npm-debug.log* |
|||
yarn-debug.log* |
|||
yarn-error.log* |
|||
pnpm-debug.log* |
|||
lerna-debug.log* |
|||
|
|||
node_modules |
|||
.DS_Store |
|||
dist |
|||
dist-ssr |
|||
coverage |
|||
*.local |
|||
|
|||
/cypress/videos/ |
|||
/cypress/screenshots/ |
|||
|
|||
# Editor directories and files |
|||
.vscode/* |
|||
!.vscode/extensions.json |
|||
.idea |
|||
*.suo |
|||
*.ntvs* |
|||
*.njsproj |
|||
*.sln |
|||
*.sw? |
|||
|
|||
*.tsbuildinfo |
@ -0,0 +1,3 @@ |
|||
{ |
|||
"recommendations": ["Vue.volar"] |
|||
} |
@ -0,0 +1,29 @@ |
|||
# voting_Vue |
|||
|
|||
This template should help get you started developing with Vue 3 in Vite. |
|||
|
|||
## Recommended IDE Setup |
|||
|
|||
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur). |
|||
|
|||
## Customize configuration |
|||
|
|||
See [Vite Configuration Reference](https://vite.dev/config/). |
|||
|
|||
## Project Setup |
|||
|
|||
```sh |
|||
npm install |
|||
``` |
|||
|
|||
### Compile and Hot-Reload for Development |
|||
|
|||
```sh |
|||
npm run dev |
|||
``` |
|||
|
|||
### Compile and Minify for Production |
|||
|
|||
```sh |
|||
npm run build |
|||
``` |
@ -0,0 +1,13 @@ |
|||
<!DOCTYPE html> |
|||
<html lang=""> |
|||
<head> |
|||
<meta charset="UTF-8"> |
|||
<link rel="icon" href="/favicon.ico"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|||
<title>Vite App</title> |
|||
</head> |
|||
<body> |
|||
<div id="app"></div> |
|||
<script type="module" src="/src/main.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,8 @@ |
|||
{ |
|||
"compilerOptions": { |
|||
"paths": { |
|||
"@/*": ["./src/*"] |
|||
} |
|||
}, |
|||
"exclude": ["node_modules", "dist"] |
|||
} |
3011
package-lock.json
File diff suppressed because it is too large
View File
@ -0,0 +1,22 @@ |
|||
{ |
|||
"name": "voting-vue", |
|||
"version": "0.0.0", |
|||
"private": true, |
|||
"type": "module", |
|||
"scripts": { |
|||
"dev": "vite", |
|||
"build": "vite build", |
|||
"preview": "vite preview" |
|||
}, |
|||
"dependencies": { |
|||
"element-plus": "^2.9.1", |
|||
"pinia": "^2.2.6", |
|||
"vue": "^3.5.13", |
|||
"vue-router": "^4.4.5" |
|||
}, |
|||
"devDependencies": { |
|||
"@vitejs/plugin-vue": "^5.2.1", |
|||
"vite": "^6.0.1", |
|||
"vite-plugin-vue-devtools": "^7.6.5" |
|||
} |
|||
} |
@ -0,0 +1,13 @@ |
|||
<script setup> |
|||
import { RouterLink, RouterView } from 'vue-router' |
|||
</script> |
|||
|
|||
<template> |
|||
|
|||
|
|||
<RouterView /> |
|||
</template> |
|||
|
|||
<style scoped> |
|||
|
|||
</style> |
After Width: 37 | Height: 88 | Size: 682 B |
After Width: 45 | Height: 66 | Size: 1.8 KiB |
After Width: 47 | Height: 67 | Size: 1.5 KiB |
After Width: 750 | Height: 2048 | Size: 1001 KiB |
After Width: 1500 | Height: 4096 | Size: 2.9 MiB |
@ -0,0 +1 @@ |
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 261.76 226.69"><path d="M161.096.001l-30.225 52.351L100.647.001H-.005l130.877 226.688L261.749.001z" fill="#41b883"/><path d="M161.096.001l-30.225 52.351L100.647.001H52.346l78.526 136.01L209.398.001z" fill="#34495e"/></svg> |
@ -0,0 +1,3 @@ |
|||
html,body{ |
|||
height: 100vh; |
|||
} |
After Width: 425 | Height: 80 | Size: 15 KiB |
After Width: 698 | Height: 237 | Size: 107 KiB |
After Width: 188 | Height: 192 | Size: 27 KiB |
After Width: 691 | Height: 180 | Size: 76 KiB |
After Width: 298 | Height: 56 | Size: 12 KiB |
@ -0,0 +1,17 @@ |
|||
import './assets/main.css' |
|||
|
|||
import { createApp } from 'vue' |
|||
import { createPinia } from 'pinia' |
|||
|
|||
import App from './App.vue' |
|||
import router from './router' |
|||
import ElementPlus from 'element-plus' |
|||
import 'element-plus/dist/index.css' |
|||
|
|||
const app = createApp(App) |
|||
|
|||
app.use(createPinia()) |
|||
app.use(router) |
|||
|
|||
app.use(ElementPlus) |
|||
app.mount('#app') |
@ -0,0 +1,22 @@ |
|||
import { createRouter, createWebHistory } from 'vue-router' |
|||
import FrontView from '../views/FrontView.vue' |
|||
import BackView from '@/views/BackView.vue' |
|||
|
|||
|
|||
const router = createRouter({ |
|||
history: createWebHistory(import.meta.env.BASE_URL), |
|||
routes: [ |
|||
{ |
|||
path: '/', |
|||
name: 'front', |
|||
component: FrontView, |
|||
}, |
|||
{ |
|||
path: '/back', |
|||
name: 'back', |
|||
component: BackView |
|||
}, |
|||
], |
|||
}) |
|||
|
|||
export default router |
@ -0,0 +1,12 @@ |
|||
import { ref, computed } from 'vue' |
|||
import { defineStore } from 'pinia' |
|||
|
|||
export const useCounterStore = defineStore('counter', () => { |
|||
const count = ref(0) |
|||
const doubleCount = computed(() => count.value * 2) |
|||
function increment() { |
|||
count.value++ |
|||
} |
|||
|
|||
return { count, doubleCount, increment } |
|||
}) |
@ -0,0 +1,95 @@ |
|||
<script setup> |
|||
import { ref } from 'vue'; |
|||
|
|||
|
|||
const candidates = ref([]) |
|||
function loadCandidates() { |
|||
candidates.value = [ |
|||
{ |
|||
id: 1, |
|||
name: "tom", |
|||
votes: 122, |
|||
}, |
|||
{ |
|||
id: 2, |
|||
name: "lili", |
|||
votes: 123, |
|||
}, |
|||
{ |
|||
id: 3, |
|||
name: "ming", |
|||
votes: 124, |
|||
}, |
|||
{ |
|||
id: 1, |
|||
name: "janey", |
|||
votes: 122, |
|||
} |
|||
] |
|||
} |
|||
loadCandidates(); |
|||
//对话窗 |
|||
const detailVisible = ref(false); |
|||
const details = [ |
|||
{ |
|||
id: "90037845", |
|||
time: "2024-10-10 20:30:31" |
|||
}, |
|||
{ |
|||
id: "90037846", |
|||
time: "2024-10-10 20:30:41" |
|||
}, |
|||
{ |
|||
id: "90037847", |
|||
time: "2024-10-10 20:30:51" |
|||
}, |
|||
] |
|||
</script> |
|||
|
|||
<template> |
|||
<el-table class="table" :data="candidates" style="width: 100%"> |
|||
<el-table-column prop="id" label="序号" width="180" /> |
|||
<el-table-column prop="name" label="候选人姓名" width="180" /> |
|||
<el-table-column prop="votes" label="获得票数" /> |
|||
<el-table-column label="操作"> |
|||
<template #default="scope"> |
|||
<div class="button" @click="detailVisible = true"> |
|||
投票详情 |
|||
</div> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<!-- 对话框 --> |
|||
<el-dialog v-model="detailVisible" title="投票详情" width="800"> |
|||
<el-table |
|||
:data="details" class="table-detail"> |
|||
<el-table-column property="id" label="投票人精网号" width="150" /> |
|||
<el-table-column property="time" label="投票时间" width="200" /> |
|||
</el-table> |
|||
</el-dialog> |
|||
|
|||
</template> |
|||
|
|||
<style scoped> |
|||
.table { |
|||
display: flex; |
|||
justify-content: center; |
|||
/* 水平居中 */ |
|||
margin: auto; |
|||
/* 使元素在容器中垂直居中 */ |
|||
width: 100%; |
|||
margin-top: 50px; |
|||
margin-left: 50px; |
|||
} |
|||
|
|||
.button { |
|||
color: rgb(51, 155, 240); |
|||
} |
|||
|
|||
.button:hover { |
|||
cursor: pointer; |
|||
} |
|||
.el-dialog__body{ |
|||
margin: 0 auto; |
|||
} |
|||
</style> |
@ -0,0 +1,423 @@ |
|||
<script setup> |
|||
import { ref } from 'vue'; |
|||
|
|||
const candidates = ref([]); |
|||
//后七名 |
|||
const backCandidates = ref([ |
|||
{ |
|||
id: 4, |
|||
name:"tom", |
|||
avatar:"../assets/头像框.png", |
|||
votes:100 |
|||
}, |
|||
{ |
|||
id: 5, |
|||
name:"tom", |
|||
avatar:"../assets/头像框.png", |
|||
votes:100 |
|||
} |
|||
|
|||
]) |
|||
//加载候选人 |
|||
function loadCandidates() { |
|||
candidates.value = [ |
|||
{ |
|||
id: 1, |
|||
|
|||
} |
|||
] |
|||
} |
|||
</script> |
|||
|
|||
<template> |
|||
<div class="container"> |
|||
<!-- 上半部分内容 --> |
|||
<div class="header"> |
|||
<div class="channle"> |
|||
<span class="channle-write">Homily Chart 第一频道</span> |
|||
</div> |
|||
<div class="title"> |
|||
</div> |
|||
<!-- 投票规则 --> |
|||
<div class="rules"></div> |
|||
<div class="rules-content"> |
|||
每人每天最多可以投三票<br> |
|||
当天不可重复投一个人<br> |
|||
统计累计票数最多的三个人 |
|||
</div> |
|||
</div> |
|||
<!-- 排名信息 --> |
|||
<div class="content"> |
|||
<!-- 第一名 --> |
|||
<div class="first"> |
|||
<!-- 头像框 --> |
|||
<div class="avatar-box1"></div> |
|||
<!-- 头像图片 --> |
|||
<!-- 投票按钮 --> |
|||
<div class="one-button1">投票</div> |
|||
<!-- 有多少人投票 --> |
|||
<div class="votes1">已有500人投票</div> |
|||
<!-- 排名1 --> |
|||
<div class="num1"></div> |
|||
</div> |
|||
<!-- 第二名 --> |
|||
<div class="second"> |
|||
<!-- 头像框 --> |
|||
<div class="avatar-box2"></div> |
|||
<!-- 头像图片 --> |
|||
<!-- 投票按钮 --> |
|||
<div class="one-button2">投票</div> |
|||
<!-- 有多少人投票 --> |
|||
<div class="votes2">已有400人投票</div> |
|||
<!-- 排名1 --> |
|||
<div class="num2"></div> |
|||
</div> |
|||
<!-- 第三名 --> |
|||
<div class="third"> |
|||
<!-- 头像框 --> |
|||
<div class="avatar-box3"></div> |
|||
<!-- 头像图片 --> |
|||
<!-- 投票按钮 --> |
|||
<div class="one-button3">投票</div> |
|||
<!-- 有多少人投票 --> |
|||
<div class="votes3">已有400人投票</div> |
|||
<!-- 排名1 --> |
|||
<div class="num3"></div> |
|||
</div> |
|||
<!-- 一二三 --> |
|||
<div class="yes"></div> |
|||
<!-- 后七名循环列表 --> |
|||
<div class="rand-box"> |
|||
<div class="list" |
|||
v-for="backCandidate in backCandidates"> |
|||
<!-- 排名 --> |
|||
<div class="num">{{ backCandidate.id }}</div> |
|||
<!-- 头像 --> |
|||
<img class="list-avatar" |
|||
src="../assets/头像框.png"> |
|||
<!-- 投票数 --> |
|||
<div class="votes">已有{{backCandidate.votes}}人投票</div> |
|||
<!-- 投票按钮 --> |
|||
<div class="list-button">投票</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<style scoped> |
|||
/* 手机 */ |
|||
/* @media (max-width:750px) { |
|||
.container { |
|||
background-image: url('../assets/bg.png'); |
|||
} |
|||
} */ |
|||
|
|||
/* 平板 */ |
|||
/* @media (min-width: 750px) and (max-width:1280px) { |
|||
.container { |
|||
background-image: url('../assets/bg.png'); |
|||
} |
|||
} */ |
|||
|
|||
/* @media (min-width:1280px) { */ |
|||
.container { |
|||
background-image: url('../assets/bg@2x.png'); |
|||
/* background-size: 100% 100%; */ |
|||
background-size: contain; |
|||
width: 750px; |
|||
height: 2048px; |
|||
margin-left: auto; |
|||
margin-right: auto; |
|||
position: relative; |
|||
} |
|||
|
|||
.header { |
|||
position: relative; |
|||
} |
|||
|
|||
.channle { |
|||
position: relative; |
|||
background-image: url(../assets/top.png); |
|||
width: 425px; |
|||
height: 80px; |
|||
margin: auto; |
|||
overflow: visible; |
|||
/* background: linear-gradient(90deg, #FFE89C, #FFFBF2); */ |
|||
} |
|||
|
|||
.channle-write { |
|||
color: #FFFFFF; |
|||
font-weight: 1000; |
|||
width: 344px; |
|||
height: 34px; |
|||
font-size: 30px; |
|||
line-height: 20.06px; |
|||
border-width: 3px; |
|||
|
|||
text-shadow: 2px 2px 2px #F14509, -2px -1px 2px #F14509, 1px -1px 2px #F14509, -2px 3px 2px #F14509; |
|||
position: absolute; |
|||
/* 添加这一行 */ |
|||
top: 50%; |
|||
/* 垂直居中 */ |
|||
left: 55%; |
|||
/* 水平居中 */ |
|||
transform: translate(-50%, -50%); |
|||
/* 调整位置 */ |
|||
} |
|||
|
|||
.title { |
|||
background-image: url(../assets/寻找队医.png); |
|||
width: 691px; |
|||
height: 180px; |
|||
position: absolute; |
|||
left: 34px; |
|||
top: 122px; |
|||
} |
|||
|
|||
.rules { |
|||
background-image: url(../assets/投票规则.png); |
|||
width: 297.12px; |
|||
height: 54.94px; |
|||
position: absolute; |
|||
left: 226.44px; |
|||
top: 317.59px; |
|||
} |
|||
|
|||
.rules-content { |
|||
position: absolute; |
|||
left: 205px; |
|||
top: 389px; |
|||
width: 343px; |
|||
height: 98px; |
|||
color: #FFFFFF; |
|||
font-size: 24px; |
|||
font-weight: 700; |
|||
font-family: Alibaba PuHuiTi; |
|||
/* margin: auto; */ |
|||
text-align: center; |
|||
} |
|||
|
|||
.yes { |
|||
background-image: url(../assets/前三.png); |
|||
height: 237px; |
|||
width: 698px; |
|||
position: absolute; |
|||
left: 26px; |
|||
top: 707px; |
|||
} |
|||
|
|||
.avatar-box1 { |
|||
background-image: url(../assets/头像框.png); |
|||
position: absolute; |
|||
left: 278px; |
|||
top: 501px; |
|||
width: 188px; |
|||
height: 192px; |
|||
} |
|||
|
|||
.one-button1 { |
|||
position: absolute; |
|||
left: 294.31px; |
|||
top: 653.53px; |
|||
width: 155.66px; |
|||
height: 41.56px; |
|||
border-radius: 20px 20px 20px 20px; |
|||
background: linear-gradient(81deg, #FFE89C, #FFC040); |
|||
border: #FA765D solid 2px; |
|||
/* 文字 */ |
|||
font-weight: 700; |
|||
font-size: 24px; |
|||
color: #E8160C; |
|||
text-align: center; |
|||
} |
|||
|
|||
.votes1 { |
|||
position: absolute; |
|||
left: 279px; |
|||
top: 700px; |
|||
width: 191px; |
|||
height: 28px; |
|||
font-family: Alibaba PuHuiTi; |
|||
font-size: 24px; |
|||
font-weight: 700; |
|||
color: #E84E07; |
|||
z-index: 999; |
|||
} |
|||
|
|||
.num1 { |
|||
background-image: url(../assets/1.png); |
|||
position: absolute; |
|||
left: 351px; |
|||
top: 779px; |
|||
width: 37px; |
|||
height: 88px; |
|||
/* z-index: 999; */ |
|||
} |
|||
|
|||
.avatar-box2 { |
|||
background-image: url(../assets/头像框.png); |
|||
position: absolute; |
|||
left: 41px; |
|||
top: 556px; |
|||
width: 188px; |
|||
height: 192px; |
|||
} |
|||
|
|||
.one-button2 { |
|||
position: absolute; |
|||
left: 57.31px; |
|||
top: 708.53px; |
|||
width: 155.66px; |
|||
height: 41.56px; |
|||
border-radius: 20px 20px 20px 20px; |
|||
background: linear-gradient(81deg, #FFE89C, #FFC040); |
|||
border: #FA765D solid 2px; |
|||
/* 文字 */ |
|||
font-weight: 700; |
|||
font-size: 24px; |
|||
color: #E8160C; |
|||
text-align: center; |
|||
} |
|||
|
|||
.votes2 { |
|||
position: absolute; |
|||
left: 55px; |
|||
top: 759px; |
|||
width: 170px; |
|||
height: 23px; |
|||
font-family: Alibaba PuHuiTi; |
|||
font-size: 24px; |
|||
font-weight: 700; |
|||
color: #E84E07; |
|||
z-index: 999; |
|||
} |
|||
|
|||
.num2 { |
|||
background-image: url(../assets/2.png); |
|||
position: absolute; |
|||
left: 112px; |
|||
top: 825px; |
|||
width: 45px; |
|||
height: 66px; |
|||
/* z-index: 999; */ |
|||
} |
|||
|
|||
.avatar-box3 { |
|||
background-image: url(../assets/头像框.png); |
|||
position: absolute; |
|||
left: 519px; |
|||
top: 556px; |
|||
width: 188px; |
|||
height: 192px; |
|||
} |
|||
|
|||
.one-button3 { |
|||
position: absolute; |
|||
left: 535.31px; |
|||
top: 708.53px; |
|||
width: 155.66px; |
|||
height: 41.56px; |
|||
border-radius: 20px 20px 20px 20px; |
|||
background: linear-gradient(81deg, #FFE89C, #FFC040); |
|||
border: #FA765D solid 2px; |
|||
/* 文字 */ |
|||
font-weight: 700; |
|||
font-size: 24px; |
|||
color: #E8160C; |
|||
text-align: center; |
|||
} |
|||
|
|||
.votes3 { |
|||
position: absolute; |
|||
left: 535px; |
|||
top: 759px; |
|||
width: 170px; |
|||
height: 23px; |
|||
font-family: Alibaba PuHuiTi; |
|||
font-size: 24px; |
|||
font-weight: 700; |
|||
color: #E84E07; |
|||
z-index: 999; |
|||
} |
|||
|
|||
.num3 { |
|||
background-image: url(../assets/3.png); |
|||
position: absolute; |
|||
left: 566px; |
|||
top: 825px; |
|||
width: 47px; |
|||
height: 67px; |
|||
/* z-index: 999; */ |
|||
} |
|||
|
|||
.rand-box { |
|||
background-color: #FFFFFF; |
|||
border: #F14509 solid 2px; |
|||
border-radius: 27.78px 27.78px 27.78px 27.78px; |
|||
position: absolute; |
|||
left: 42.8px; |
|||
top: 922.56px; |
|||
width: 666.06px; |
|||
height: 1016.75px; |
|||
/* box-shadow: 3px 8px 19px 0 #66f1291f; */ |
|||
box-shadow: 9px 9px 19px -9px #F1291F40; |
|||
} |
|||
.list{ |
|||
display: flex; |
|||
/* display: inline-block; */ |
|||
align-items: center; |
|||
margin-top: 10px; |
|||
margin-bottom: 10px; |
|||
margin-left: 20px; |
|||
padding: 10px; |
|||
border-bottom: 1px solid #B24300; |
|||
} |
|||
|
|||
.num{ |
|||
font-family: zihunxingmouhei_trial; |
|||
font-size: 26px; /* 排名字体大小 */ |
|||
font-weight: 800; /* 排名字体加粗 */ |
|||
color: #F4850D; |
|||
margin-right: 18px; /* 与头像之间的间距 */ |
|||
margin-left: 20px; |
|||
} |
|||
.list-avatar { |
|||
width: 98.13px; |
|||
height: 98.13px; |
|||
border-radius: 50%; /* 圆形头像 */ |
|||
margin-right: 35px; /* 与投票数之间的间距 */ |
|||
} |
|||
|
|||
.votes { |
|||
font-size: 28px; /* 投票数字体大小 */ |
|||
font-weight: 400; |
|||
width: 190px; |
|||
height: 27px; |
|||
flex-grow: 1; /* 填充剩余空间 */ |
|||
|
|||
color: #F4850D; /* 投票数字体颜色 */ |
|||
margin-right: 20px; /* 与投票按钮之间的间距 */ |
|||
} |
|||
|
|||
.list-button { |
|||
|
|||
background: linear-gradient(81deg, #FFE89C, #FFC040); |
|||
border: #FA765D solid 2px; |
|||
width: 143.88px; |
|||
height: 48.4px; |
|||
border-radius: 24.15px 24.15px 24.15px 24.15px; |
|||
cursor: pointer; /* 鼠标悬停时的指针样式 */ |
|||
transition: background-color 0.3s; /* 背景颜色变化的过渡效果 */ |
|||
/* 文字 */ |
|||
font-weight: 800; |
|||
font-size: 26px; |
|||
color: #E8160C; |
|||
text-align: center; |
|||
letter-spacing: 7px; |
|||
} |
|||
|
|||
.list-button:hover { |
|||
background-color: #e6b800; /* 鼠标悬停时的背景颜色 */ |
|||
} |
|||
/* } */ |
|||
</style> |
@ -0,0 +1,18 @@ |
|||
import { fileURLToPath, URL } from 'node:url' |
|||
|
|||
import { defineConfig } from 'vite' |
|||
import vue from '@vitejs/plugin-vue' |
|||
import vueDevTools from 'vite-plugin-vue-devtools' |
|||
|
|||
// https://vite.dev/config/
|
|||
export default defineConfig({ |
|||
plugins: [ |
|||
vue(), |
|||
vueDevTools(), |
|||
], |
|||
resolve: { |
|||
alias: { |
|||
'@': fileURLToPath(new URL('./src', import.meta.url)) |
|||
}, |
|||
}, |
|||
}) |