Compare commits
merge into: majun:master
majun:dev
majun:guoyanqiang
majun:master
majun:songjie
pull from: majun:dev
majun:dev
majun:guoyanqiang
majun:master
majun:songjie
4 Commits
Author | SHA1 | Message | Date |
---|---|---|---|
|
1fd9806f47 |
宋杰4.29页面整合完成
|
3 weeks ago |
|
a55a800e50 |
Merge branch 'songjie' into dev
|
3 weeks ago |
|
252f9d01a0 |
宋杰主页提交4.28
|
3 weeks ago |
|
8c81241998 |
gyq_huodong_4.28
|
3 weeks ago |
23 changed files with 1582 additions and 483 deletions
-
639package-lock.json
-
7package.json
-
89src/App.vue
-
14src/api/axiosConfig.js
-
13src/api/homeApi.js
-
5src/api/index.js
-
86src/assets/base.css
-
BINsrc/assets/images/日历.png
-
6src/assets/main.css
-
44src/components/HelloWorld.vue
-
94src/components/TheWelcome.vue
-
86src/components/WelcomeItem.vue
-
7src/components/icons/IconCommunity.vue
-
7src/components/icons/IconDocumentation.vue
-
7src/components/icons/IconEcosystem.vue
-
7src/components/icons/IconSupport.vue
-
19src/components/icons/IconTooling.vue
-
29src/main.js
-
20src/router/index.js
-
15src/views/AboutView.vue
-
278src/views/ActivityManagement.vue
-
9src/views/HomeView.vue
-
582src/views/VotingManagement.vue
@ -1,85 +1,18 @@ |
|||||
<script setup> |
|
||||
import { RouterLink, RouterView } from 'vue-router' |
|
||||
import HelloWorld from './components/HelloWorld.vue' |
|
||||
</script> |
|
||||
|
|
||||
<template> |
<template> |
||||
<header> |
|
||||
<img alt="Vue logo" class="logo" src="@/assets/logo.svg" width="125" height="125" /> |
|
||||
|
|
||||
<div class="wrapper"> |
|
||||
<HelloWorld msg="You did it!" /> |
|
||||
|
|
||||
<nav> |
|
||||
<RouterLink to="/">Home</RouterLink> |
|
||||
<RouterLink to="/about">About</RouterLink> |
|
||||
</nav> |
|
||||
</div> |
|
||||
</header> |
|
||||
|
<!-- <div id="app"> |
||||
|
<voting-management></voting-management> |
||||
|
|
||||
<RouterView /> |
|
||||
|
</div> --> |
||||
|
<router-view></router-view> |
||||
</template> |
</template> |
||||
|
|
||||
<style scoped> |
|
||||
header { |
|
||||
line-height: 1.5; |
|
||||
max-height: 100vh; |
|
||||
} |
|
||||
|
|
||||
.logo { |
|
||||
display: block; |
|
||||
margin: 0 auto 2rem; |
|
||||
} |
|
||||
|
|
||||
nav { |
|
||||
width: 100%; |
|
||||
font-size: 12px; |
|
||||
text-align: center; |
|
||||
margin-top: 2rem; |
|
||||
} |
|
||||
|
|
||||
nav a.router-link-exact-active { |
|
||||
color: var(--color-text); |
|
||||
} |
|
||||
|
|
||||
nav a.router-link-exact-active:hover { |
|
||||
background-color: transparent; |
|
||||
} |
|
||||
|
|
||||
nav a { |
|
||||
display: inline-block; |
|
||||
padding: 0 1rem; |
|
||||
border-left: 1px solid var(--color-border); |
|
||||
} |
|
||||
|
|
||||
nav a:first-of-type { |
|
||||
border: 0; |
|
||||
} |
|
||||
|
|
||||
@media (min-width: 1024px) { |
|
||||
header { |
|
||||
display: flex; |
|
||||
place-items: center; |
|
||||
padding-right: calc(var(--section-gap) / 2); |
|
||||
} |
|
||||
|
|
||||
.logo { |
|
||||
margin: 0 2rem 0 0; |
|
||||
} |
|
||||
|
|
||||
header .wrapper { |
|
||||
display: flex; |
|
||||
place-items: flex-start; |
|
||||
flex-wrap: wrap; |
|
||||
} |
|
||||
|
<script> |
||||
|
// export default { |
||||
|
// name: 'App', |
||||
|
// }; |
||||
|
</script> |
||||
|
|
||||
nav { |
|
||||
text-align: left; |
|
||||
margin-left: -1rem; |
|
||||
font-size: 1rem; |
|
||||
|
<style> |
||||
|
/* 添加全局样式 */ |
||||
|
|
||||
padding: 1rem 0; |
|
||||
margin-top: 1rem; |
|
||||
} |
|
||||
} |
|
||||
</style> |
</style> |
@ -0,0 +1,14 @@ |
|||||
|
import axios from 'axios'; |
||||
|
|
||||
|
const instance = axios.create({ |
||||
|
baseURL: 'http://192.168.8.235:8000/api/vote', // 后端 API 基地址
|
||||
|
timeout: 3000, |
||||
|
}); |
||||
|
|
||||
|
export default instance; |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
@ -0,0 +1,13 @@ |
|||||
|
import service from "."; |
||||
|
const homeApi = { |
||||
|
//分页查询
|
||||
|
getHomeData(PageNo,PageSize) { |
||||
|
return service.post("/api/activity",{ |
||||
|
params:{ |
||||
|
PageNo, |
||||
|
PageSize |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}; |
||||
|
export default homeApi; |
@ -0,0 +1,5 @@ |
|||||
|
import axios from "axios"; |
||||
|
const service = axios.create({ |
||||
|
baseURL:"http://192.168.8.235:8000" |
||||
|
}); |
||||
|
export default service; |
@ -1,86 +0,0 @@ |
|||||
/* color palette from <https://github.com/vuejs/theme> */ |
|
||||
:root { |
|
||||
--vt-c-white: #ffffff; |
|
||||
--vt-c-white-soft: #f8f8f8; |
|
||||
--vt-c-white-mute: #f2f2f2; |
|
||||
|
|
||||
--vt-c-black: #181818; |
|
||||
--vt-c-black-soft: #222222; |
|
||||
--vt-c-black-mute: #282828; |
|
||||
|
|
||||
--vt-c-indigo: #2c3e50; |
|
||||
|
|
||||
--vt-c-divider-light-1: rgba(60, 60, 60, 0.29); |
|
||||
--vt-c-divider-light-2: rgba(60, 60, 60, 0.12); |
|
||||
--vt-c-divider-dark-1: rgba(84, 84, 84, 0.65); |
|
||||
--vt-c-divider-dark-2: rgba(84, 84, 84, 0.48); |
|
||||
|
|
||||
--vt-c-text-light-1: var(--vt-c-indigo); |
|
||||
--vt-c-text-light-2: rgba(60, 60, 60, 0.66); |
|
||||
--vt-c-text-dark-1: var(--vt-c-white); |
|
||||
--vt-c-text-dark-2: rgba(235, 235, 235, 0.64); |
|
||||
} |
|
||||
|
|
||||
/* semantic color variables for this project */ |
|
||||
:root { |
|
||||
--color-background: var(--vt-c-white); |
|
||||
--color-background-soft: var(--vt-c-white-soft); |
|
||||
--color-background-mute: var(--vt-c-white-mute); |
|
||||
|
|
||||
--color-border: var(--vt-c-divider-light-2); |
|
||||
--color-border-hover: var(--vt-c-divider-light-1); |
|
||||
|
|
||||
--color-heading: var(--vt-c-text-light-1); |
|
||||
--color-text: var(--vt-c-text-light-1); |
|
||||
|
|
||||
--section-gap: 160px; |
|
||||
} |
|
||||
|
|
||||
@media (prefers-color-scheme: dark) { |
|
||||
:root { |
|
||||
--color-background: var(--vt-c-black); |
|
||||
--color-background-soft: var(--vt-c-black-soft); |
|
||||
--color-background-mute: var(--vt-c-black-mute); |
|
||||
|
|
||||
--color-border: var(--vt-c-divider-dark-2); |
|
||||
--color-border-hover: var(--vt-c-divider-dark-1); |
|
||||
|
|
||||
--color-heading: var(--vt-c-text-dark-1); |
|
||||
--color-text: var(--vt-c-text-dark-2); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
*, |
|
||||
*::before, |
|
||||
*::after { |
|
||||
box-sizing: border-box; |
|
||||
margin: 0; |
|
||||
font-weight: normal; |
|
||||
} |
|
||||
|
|
||||
body { |
|
||||
min-height: 100vh; |
|
||||
color: var(--color-text); |
|
||||
background: var(--color-background); |
|
||||
transition: |
|
||||
color 0.5s, |
|
||||
background-color 0.5s; |
|
||||
line-height: 1.6; |
|
||||
font-family: |
|
||||
Inter, |
|
||||
-apple-system, |
|
||||
BlinkMacSystemFont, |
|
||||
'Segoe UI', |
|
||||
Roboto, |
|
||||
Oxygen, |
|
||||
Ubuntu, |
|
||||
Cantarell, |
|
||||
'Fira Sans', |
|
||||
'Droid Sans', |
|
||||
'Helvetica Neue', |
|
||||
sans-serif; |
|
||||
font-size: 15px; |
|
||||
text-rendering: optimizeLegibility; |
|
||||
-webkit-font-smoothing: antialiased; |
|
||||
-moz-osx-font-smoothing: grayscale; |
|
||||
} |
|
After Width: 200 | Height: 200 | Size: 5.0 KiB |
@ -1,44 +0,0 @@ |
|||||
<script setup> |
|
||||
defineProps({ |
|
||||
msg: { |
|
||||
type: String, |
|
||||
required: true, |
|
||||
}, |
|
||||
}) |
|
||||
</script> |
|
||||
|
|
||||
<template> |
|
||||
<div class="greetings"> |
|
||||
<h1 class="green">{{ msg }}</h1> |
|
||||
<h3> |
|
||||
You’ve successfully created a project with |
|
||||
<a href="https://vite.dev/" target="_blank" rel="noopener">Vite</a> + |
|
||||
<a href="https://vuejs.org/" target="_blank" rel="noopener">Vue 3</a>. |
|
||||
</h3> |
|
||||
</div> |
|
||||
</template> |
|
||||
|
|
||||
<style scoped> |
|
||||
h1 { |
|
||||
font-weight: 500; |
|
||||
font-size: 2.6rem; |
|
||||
position: relative; |
|
||||
top: -10px; |
|
||||
} |
|
||||
|
|
||||
h3 { |
|
||||
font-size: 1.2rem; |
|
||||
} |
|
||||
|
|
||||
.greetings h1, |
|
||||
.greetings h3 { |
|
||||
text-align: center; |
|
||||
} |
|
||||
|
|
||||
@media (min-width: 1024px) { |
|
||||
.greetings h1, |
|
||||
.greetings h3 { |
|
||||
text-align: left; |
|
||||
} |
|
||||
} |
|
||||
</style> |
|
@ -1,94 +0,0 @@ |
|||||
<script setup> |
|
||||
import WelcomeItem from './WelcomeItem.vue' |
|
||||
import DocumentationIcon from './icons/IconDocumentation.vue' |
|
||||
import ToolingIcon from './icons/IconTooling.vue' |
|
||||
import EcosystemIcon from './icons/IconEcosystem.vue' |
|
||||
import CommunityIcon from './icons/IconCommunity.vue' |
|
||||
import SupportIcon from './icons/IconSupport.vue' |
|
||||
|
|
||||
const openReadmeInEditor = () => fetch('/__open-in-editor?file=README.md') |
|
||||
</script> |
|
||||
|
|
||||
<template> |
|
||||
<WelcomeItem> |
|
||||
<template #icon> |
|
||||
<DocumentationIcon /> |
|
||||
</template> |
|
||||
<template #heading>Documentation</template> |
|
||||
|
|
||||
Vue’s |
|
||||
<a href="https://vuejs.org/" target="_blank" rel="noopener">official documentation</a> |
|
||||
provides you with all information you need to get started. |
|
||||
</WelcomeItem> |
|
||||
|
|
||||
<WelcomeItem> |
|
||||
<template #icon> |
|
||||
<ToolingIcon /> |
|
||||
</template> |
|
||||
<template #heading>Tooling</template> |
|
||||
|
|
||||
This project is served and bundled with |
|
||||
<a href="https://vite.dev/guide/features.html" target="_blank" rel="noopener">Vite</a>. The |
|
||||
recommended IDE setup is |
|
||||
<a href="https://code.visualstudio.com/" target="_blank" rel="noopener">VSCode</a> |
|
||||
+ |
|
||||
<a href="https://github.com/vuejs/language-tools" target="_blank" rel="noopener">Vue - Official</a>. If |
|
||||
you need to test your components and web pages, check out |
|
||||
<a href="https://vitest.dev/" target="_blank" rel="noopener">Vitest</a> |
|
||||
and |
|
||||
<a href="https://www.cypress.io/" target="_blank" rel="noopener">Cypress</a> |
|
||||
/ |
|
||||
<a href="https://playwright.dev/" target="_blank" rel="noopener">Playwright</a>. |
|
||||
|
|
||||
<br /> |
|
||||
|
|
||||
More instructions are available in |
|
||||
<a href="javascript:void(0)" @click="openReadmeInEditor"><code>README.md</code></a |
|
||||
>. |
|
||||
</WelcomeItem> |
|
||||
|
|
||||
<WelcomeItem> |
|
||||
<template #icon> |
|
||||
<EcosystemIcon /> |
|
||||
</template> |
|
||||
<template #heading>Ecosystem</template> |
|
||||
|
|
||||
Get official tools and libraries for your project: |
|
||||
<a href="https://pinia.vuejs.org/" target="_blank" rel="noopener">Pinia</a>, |
|
||||
<a href="https://router.vuejs.org/" target="_blank" rel="noopener">Vue Router</a>, |
|
||||
<a href="https://test-utils.vuejs.org/" target="_blank" rel="noopener">Vue Test Utils</a>, and |
|
||||
<a href="https://github.com/vuejs/devtools" target="_blank" rel="noopener">Vue Dev Tools</a>. If |
|
||||
you need more resources, we suggest paying |
|
||||
<a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">Awesome Vue</a> |
|
||||
a visit. |
|
||||
</WelcomeItem> |
|
||||
|
|
||||
<WelcomeItem> |
|
||||
<template #icon> |
|
||||
<CommunityIcon /> |
|
||||
</template> |
|
||||
<template #heading>Community</template> |
|
||||
|
|
||||
Got stuck? Ask your question on |
|
||||
<a href="https://chat.vuejs.org" target="_blank" rel="noopener">Vue Land</a> |
|
||||
(our official Discord server), or |
|
||||
<a href="https://stackoverflow.com/questions/tagged/vue.js" target="_blank" rel="noopener" |
|
||||
>StackOverflow</a |
|
||||
>. You should also follow the official |
|
||||
<a href="https://bsky.app/profile/vuejs.org" target="_blank" rel="noopener">@vuejs.org</a> |
|
||||
Bluesky account or the |
|
||||
<a href="https://x.com/vuejs" target="_blank" rel="noopener">@vuejs</a> |
|
||||
X account for latest news in the Vue world. |
|
||||
</WelcomeItem> |
|
||||
|
|
||||
<WelcomeItem> |
|
||||
<template #icon> |
|
||||
<SupportIcon /> |
|
||||
</template> |
|
||||
<template #heading>Support Vue</template> |
|
||||
|
|
||||
As an independent project, Vue relies on community backing for its sustainability. You can help |
|
||||
us by |
|
||||
<a href="https://vuejs.org/sponsor/" target="_blank" rel="noopener">becoming a sponsor</a>. |
|
||||
</WelcomeItem> |
|
||||
</template> |
|
@ -1,86 +0,0 @@ |
|||||
<template> |
|
||||
<div class="item"> |
|
||||
<i> |
|
||||
<slot name="icon"></slot> |
|
||||
</i> |
|
||||
<div class="details"> |
|
||||
<h3> |
|
||||
<slot name="heading"></slot> |
|
||||
</h3> |
|
||||
<slot></slot> |
|
||||
</div> |
|
||||
</div> |
|
||||
</template> |
|
||||
|
|
||||
<style scoped> |
|
||||
.item { |
|
||||
margin-top: 2rem; |
|
||||
display: flex; |
|
||||
position: relative; |
|
||||
} |
|
||||
|
|
||||
.details { |
|
||||
flex: 1; |
|
||||
margin-left: 1rem; |
|
||||
} |
|
||||
|
|
||||
i { |
|
||||
display: flex; |
|
||||
place-items: center; |
|
||||
place-content: center; |
|
||||
width: 32px; |
|
||||
height: 32px; |
|
||||
color: var(--color-text); |
|
||||
} |
|
||||
|
|
||||
h3 { |
|
||||
font-size: 1.2rem; |
|
||||
font-weight: 500; |
|
||||
margin-bottom: 0.4rem; |
|
||||
color: var(--color-heading); |
|
||||
} |
|
||||
|
|
||||
@media (min-width: 1024px) { |
|
||||
.item { |
|
||||
margin-top: 0; |
|
||||
padding: 0.4rem 0 1rem calc(var(--section-gap) / 2); |
|
||||
} |
|
||||
|
|
||||
i { |
|
||||
top: calc(50% - 25px); |
|
||||
left: -26px; |
|
||||
position: absolute; |
|
||||
border: 1px solid var(--color-border); |
|
||||
background: var(--color-background); |
|
||||
border-radius: 8px; |
|
||||
width: 50px; |
|
||||
height: 50px; |
|
||||
} |
|
||||
|
|
||||
.item:before { |
|
||||
content: ' '; |
|
||||
border-left: 1px solid var(--color-border); |
|
||||
position: absolute; |
|
||||
left: 0; |
|
||||
bottom: calc(50% + 25px); |
|
||||
height: calc(50% - 25px); |
|
||||
} |
|
||||
|
|
||||
.item:after { |
|
||||
content: ' '; |
|
||||
border-left: 1px solid var(--color-border); |
|
||||
position: absolute; |
|
||||
left: 0; |
|
||||
top: calc(50% + 25px); |
|
||||
height: calc(50% - 25px); |
|
||||
} |
|
||||
|
|
||||
.item:first-of-type:before { |
|
||||
display: none; |
|
||||
} |
|
||||
|
|
||||
.item:last-of-type:after { |
|
||||
display: none; |
|
||||
} |
|
||||
} |
|
||||
</style> |
|
@ -1,7 +0,0 @@ |
|||||
<template> |
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor"> |
|
||||
<path |
|
||||
d="M15 4a1 1 0 1 0 0 2V4zm0 11v-1a1 1 0 0 0-1 1h1zm0 4l-.707.707A1 1 0 0 0 16 19h-1zm-4-4l.707-.707A1 1 0 0 0 11 14v1zm-4.707-1.293a1 1 0 0 0-1.414 1.414l1.414-1.414zm-.707.707l-.707-.707.707.707zM9 11v-1a1 1 0 0 0-.707.293L9 11zm-4 0h1a1 1 0 0 0-1-1v1zm0 4H4a1 1 0 0 0 1.707.707L5 15zm10-9h2V4h-2v2zm2 0a1 1 0 0 1 1 1h2a3 3 0 0 0-3-3v2zm1 1v6h2V7h-2zm0 6a1 1 0 0 1-1 1v2a3 3 0 0 0 3-3h-2zm-1 1h-2v2h2v-2zm-3 1v4h2v-4h-2zm1.707 3.293l-4-4-1.414 1.414 4 4 1.414-1.414zM11 14H7v2h4v-2zm-4 0c-.276 0-.525-.111-.707-.293l-1.414 1.414C5.42 15.663 6.172 16 7 16v-2zm-.707 1.121l3.414-3.414-1.414-1.414-3.414 3.414 1.414 1.414zM9 12h4v-2H9v2zm4 0a3 3 0 0 0 3-3h-2a1 1 0 0 1-1 1v2zm3-3V3h-2v6h2zm0-6a3 3 0 0 0-3-3v2a1 1 0 0 1 1 1h2zm-3-3H3v2h10V0zM3 0a3 3 0 0 0-3 3h2a1 1 0 0 1 1-1V0zM0 3v6h2V3H0zm0 6a3 3 0 0 0 3 3v-2a1 1 0 0 1-1-1H0zm3 3h2v-2H3v2zm1-1v4h2v-4H4zm1.707 4.707l.586-.586-1.414-1.414-.586.586 1.414 1.414z" |
|
||||
/> |
|
||||
</svg> |
|
||||
</template> |
|
@ -1,7 +0,0 @@ |
|||||
<template> |
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="17" fill="currentColor"> |
|
||||
<path |
|
||||
d="M11 2.253a1 1 0 1 0-2 0h2zm-2 13a1 1 0 1 0 2 0H9zm.447-12.167a1 1 0 1 0 1.107-1.666L9.447 3.086zM1 2.253L.447 1.42A1 1 0 0 0 0 2.253h1zm0 13H0a1 1 0 0 0 1.553.833L1 15.253zm8.447.833a1 1 0 1 0 1.107-1.666l-1.107 1.666zm0-14.666a1 1 0 1 0 1.107 1.666L9.447 1.42zM19 2.253h1a1 1 0 0 0-.447-.833L19 2.253zm0 13l-.553.833A1 1 0 0 0 20 15.253h-1zm-9.553-.833a1 1 0 1 0 1.107 1.666L9.447 14.42zM9 2.253v13h2v-13H9zm1.553-.833C9.203.523 7.42 0 5.5 0v2c1.572 0 2.961.431 3.947 1.086l1.107-1.666zM5.5 0C3.58 0 1.797.523.447 1.42l1.107 1.666C2.539 2.431 3.928 2 5.5 2V0zM0 2.253v13h2v-13H0zm1.553 13.833C2.539 15.431 3.928 15 5.5 15v-2c-1.92 0-3.703.523-5.053 1.42l1.107 1.666zM5.5 15c1.572 0 2.961.431 3.947 1.086l1.107-1.666C9.203 13.523 7.42 13 5.5 13v2zm5.053-11.914C11.539 2.431 12.928 2 14.5 2V0c-1.92 0-3.703.523-5.053 1.42l1.107 1.666zM14.5 2c1.573 0 2.961.431 3.947 1.086l1.107-1.666C18.203.523 16.421 0 14.5 0v2zm3.5.253v13h2v-13h-2zm1.553 12.167C18.203 13.523 16.421 13 14.5 13v2c1.573 0 2.961.431 3.947 1.086l1.107-1.666zM14.5 13c-1.92 0-3.703.523-5.053 1.42l1.107 1.666C11.539 15.431 12.928 15 14.5 15v-2z" |
|
||||
/> |
|
||||
</svg> |
|
||||
</template> |
|
@ -1,7 +0,0 @@ |
|||||
<template> |
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="20" fill="currentColor"> |
|
||||
<path |
|
||||
d="M11.447 8.894a1 1 0 1 0-.894-1.789l.894 1.789zm-2.894-.789a1 1 0 1 0 .894 1.789l-.894-1.789zm0 1.789a1 1 0 1 0 .894-1.789l-.894 1.789zM7.447 7.106a1 1 0 1 0-.894 1.789l.894-1.789zM10 9a1 1 0 1 0-2 0h2zm-2 2.5a1 1 0 1 0 2 0H8zm9.447-5.606a1 1 0 1 0-.894-1.789l.894 1.789zm-2.894-.789a1 1 0 1 0 .894 1.789l-.894-1.789zm2 .789a1 1 0 1 0 .894-1.789l-.894 1.789zm-1.106-2.789a1 1 0 1 0-.894 1.789l.894-1.789zM18 5a1 1 0 1 0-2 0h2zm-2 2.5a1 1 0 1 0 2 0h-2zm-5.447-4.606a1 1 0 1 0 .894-1.789l-.894 1.789zM9 1l.447-.894a1 1 0 0 0-.894 0L9 1zm-2.447.106a1 1 0 1 0 .894 1.789l-.894-1.789zm-6 3a1 1 0 1 0 .894 1.789L.553 4.106zm2.894.789a1 1 0 1 0-.894-1.789l.894 1.789zm-2-.789a1 1 0 1 0-.894 1.789l.894-1.789zm1.106 2.789a1 1 0 1 0 .894-1.789l-.894 1.789zM2 5a1 1 0 1 0-2 0h2zM0 7.5a1 1 0 1 0 2 0H0zm8.553 12.394a1 1 0 1 0 .894-1.789l-.894 1.789zm-1.106-2.789a1 1 0 1 0-.894 1.789l.894-1.789zm1.106 1a1 1 0 1 0 .894 1.789l-.894-1.789zm2.894.789a1 1 0 1 0-.894-1.789l.894 1.789zM8 19a1 1 0 1 0 2 0H8zm2-2.5a1 1 0 1 0-2 0h2zm-7.447.394a1 1 0 1 0 .894-1.789l-.894 1.789zM1 15H0a1 1 0 0 0 .553.894L1 15zm1-2.5a1 1 0 1 0-2 0h2zm12.553 2.606a1 1 0 1 0 .894 1.789l-.894-1.789zM17 15l.447.894A1 1 0 0 0 18 15h-1zm1-2.5a1 1 0 1 0-2 0h2zm-7.447-5.394l-2 1 .894 1.789 2-1-.894-1.789zm-1.106 1l-2-1-.894 1.789 2 1 .894-1.789zM8 9v2.5h2V9H8zm8.553-4.894l-2 1 .894 1.789 2-1-.894-1.789zm.894 0l-2-1-.894 1.789 2 1 .894-1.789zM16 5v2.5h2V5h-2zm-4.553-3.894l-2-1-.894 1.789 2 1 .894-1.789zm-2.894-1l-2 1 .894 1.789 2-1L8.553.106zM1.447 5.894l2-1-.894-1.789-2 1 .894 1.789zm-.894 0l2 1 .894-1.789-2-1-.894 1.789zM0 5v2.5h2V5H0zm9.447 13.106l-2-1-.894 1.789 2 1 .894-1.789zm0 1.789l2-1-.894-1.789-2 1 .894 1.789zM10 19v-2.5H8V19h2zm-6.553-3.894l-2-1-.894 1.789 2 1 .894-1.789zM2 15v-2.5H0V15h2zm13.447 1.894l2-1-.894-1.789-2 1 .894 1.789zM18 15v-2.5h-2V15h2z" |
|
||||
/> |
|
||||
</svg> |
|
||||
</template> |
|
@ -1,7 +0,0 @@ |
|||||
<template> |
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor"> |
|
||||
<path |
|
||||
d="M10 3.22l-.61-.6a5.5 5.5 0 0 0-7.666.105 5.5 5.5 0 0 0-.114 7.665L10 18.78l8.39-8.4a5.5 5.5 0 0 0-.114-7.665 5.5 5.5 0 0 0-7.666-.105l-.61.61z" |
|
||||
/> |
|
||||
</svg> |
|
||||
</template> |
|
@ -1,19 +0,0 @@ |
|||||
<!-- This icon is from <https://github.com/Templarian/MaterialDesign>, distributed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) license--> |
|
||||
<template> |
|
||||
<svg |
|
||||
xmlns="http://www.w3.org/2000/svg" |
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" |
|
||||
aria-hidden="true" |
|
||||
role="img" |
|
||||
class="iconify iconify--mdi" |
|
||||
width="24" |
|
||||
height="24" |
|
||||
preserveAspectRatio="xMidYMid meet" |
|
||||
viewBox="0 0 24 24" |
|
||||
> |
|
||||
<path |
|
||||
d="M20 18v-4h-3v1h-2v-1H9v1H7v-1H4v4h16M6.33 8l-1.74 4H7v-1h2v1h6v-1h2v1h2.41l-1.74-4H6.33M9 5v1h6V5H9m12.84 7.61c.1.22.16.48.16.8V18c0 .53-.21 1-.6 1.41c-.4.4-.85.59-1.4.59H4c-.55 0-1-.19-1.4-.59C2.21 19 2 18.53 2 18v-4.59c0-.32.06-.58.16-.8L4.5 7.22C4.84 6.41 5.45 6 6.33 6H7V5c0-.55.18-1 .57-1.41C7.96 3.2 8.44 3 9 3h6c.56 0 1.04.2 1.43.59c.39.41.57.86.57 1.41v1h.67c.88 0 1.49.41 1.83 1.22l2.34 5.39z" |
|
||||
fill="currentColor" |
|
||||
></path> |
|
||||
</svg> |
|
||||
</template> |
|
@ -1,14 +1,29 @@ |
|||||
import './assets/main.css' |
|
||||
|
|
||||
import { createApp } from 'vue' |
|
||||
|
import { createApp } from 'vue' // 引入vue实例
|
||||
|
import App from './App.vue' // 引入App.vue
|
||||
|
import router from './router' // 引入router
|
||||
|
import axios from './api/axiosConfig'; // 引入axiosConfig
|
||||
|
import VotingManagement from './views/VotingManagement.vue' // 引入VotingManagement.vue
|
||||
|
import ElementPlus from 'element-plus' |
||||
|
import 'element-plus/dist/index.css' |
||||
|
import * as ElementPlusIconsVue from '@element-plus/icons-vue' |
||||
|
import zhCn from 'element-plus/es/locale/lang/zh-cn' |
||||
import { createPinia } from 'pinia' |
import { createPinia } from 'pinia' |
||||
|
|
||||
import App from './App.vue' |
|
||||
import router from './router' |
|
||||
|
const app = createApp(App) // 创建vue实例
|
||||
|
|
||||
|
|
||||
|
for (const [key, component] of Object.entries(ElementPlusIconsVue)) { |
||||
|
app.component(key, component) |
||||
|
} |
||||
|
|
||||
const app = createApp(App) |
|
||||
|
app.use(ElementPlus, { |
||||
|
locale: zhCn, |
||||
|
}) |
||||
|
|
||||
|
app.component('VotingManagement', VotingManagement) // 注册组件
|
||||
|
app.config.globalProperties.axios = axios; // 全局挂载axios
|
||||
|
|
||||
app.use(createPinia()) |
app.use(createPinia()) |
||||
app.use(router) |
app.use(router) |
||||
|
|
||||
|
app.use(ElementPlus) |
||||
app.mount('#app') |
app.mount('#app') |
@ -1,23 +1,21 @@ |
|||||
import { createRouter, createWebHistory } from 'vue-router' |
import { createRouter, createWebHistory } from 'vue-router' |
||||
import HomeView from '../views/HomeView.vue' |
|
||||
|
import ActivityManagement from '@/views/ActivityManagement.vue' |
||||
|
import VotingManagement from '@/views/VotingManagement.vue' |
||||
|
|
||||
const router = createRouter({ |
const router = createRouter({ |
||||
history: createWebHistory(import.meta.env.BASE_URL), |
history: createWebHistory(import.meta.env.BASE_URL), |
||||
routes: [ |
routes: [ |
||||
{ |
{ |
||||
path: '/', |
path: '/', |
||||
name: 'home', |
|
||||
component: HomeView, |
|
||||
|
name: 'activityManagement', |
||||
|
component: ActivityManagement, |
||||
}, |
}, |
||||
{ |
{ |
||||
path: '/about', |
|
||||
name: 'about', |
|
||||
// route level code-splitting
|
|
||||
// this generates a separate chunk (About.[hash].js) for this route
|
|
||||
// which is lazy-loaded when the route is visited.
|
|
||||
component: () => import('../views/AboutView.vue'), |
|
||||
|
path: '/vote/:id', |
||||
|
name: 'votingManagement', |
||||
|
component: VotingManagement, |
||||
}, |
}, |
||||
], |
|
||||
}) |
|
||||
|
] |
||||
|
}); |
||||
|
|
||||
export default router |
export default router |
@ -1,15 +0,0 @@ |
|||||
<template> |
|
||||
<div class="about"> |
|
||||
<h1>This is an about page</h1> |
|
||||
</div> |
|
||||
</template> |
|
||||
|
|
||||
<style> |
|
||||
@media (min-width: 1024px) { |
|
||||
.about { |
|
||||
min-height: 100vh; |
|
||||
display: flex; |
|
||||
align-items: center; |
|
||||
} |
|
||||
} |
|
||||
</style> |
|
@ -0,0 +1,278 @@ |
|||||
|
<template> |
||||
|
<el-container> |
||||
|
<el-header> |
||||
|
<h1>活动管理后台</h1> |
||||
|
</el-header> |
||||
|
|
||||
|
<el-main> |
||||
|
<el-row justify="start" align="middle"> |
||||
|
<el-col :span="24" class="header-actions"> |
||||
|
<el-button type="danger" @click="openAddActivityDialog">添加活动</el-button> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<el-table :data="paginatedActivities" style="width: 100%"> |
||||
|
<!-- <el-table-column label="序号" type="index" width="80" align="center" header-align="center"> |
||||
|
<template #default="{ $index }"> |
||||
|
{{ $index + 1 }} |
||||
|
</template> |
||||
|
</el-table-column> --> |
||||
|
<el-table-column type="index" :index="indexMethod" width="80" label="活动标题" /> |
||||
|
<el-table-column prop="title" label="活动标题" /> |
||||
|
<el-table-column prop="detail" label="活动详情" /> |
||||
|
<el-table-column prop="visit_count" label="访问人数" width="120" /> |
||||
|
<el-table-column prop="vote_count" label="投票人数" width="120" /> |
||||
|
<el-table-column prop="start" label="活动开始时间" /> |
||||
|
<el-table-column prop="end" label="活动结束时间" /> |
||||
|
<el-table-column prop="created_at" label="活动创建时间" /> |
||||
|
<el-table-column prop="status" label="活动状态"> |
||||
|
<template #default="scope"> |
||||
|
<span v-if="scope.row.status === 1">未开始</span> |
||||
|
<span v-if="scope.row.status === 2">进行中</span> |
||||
|
<span v-if="scope.row.status === 3">已结束</span> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column label="操作" width="180"> |
||||
|
<template #default="scope"> |
||||
|
<div class="operation-buttons"> |
||||
|
<el-button size="mini" type="default" @click="editActivity(scope.row)">修改</el-button> |
||||
|
<el-button size="mini" type="primary" @click="viewDetails(scope.row.id)">查看详情</el-button> |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
|
||||
|
<div class="pagination-container"> |
||||
|
<el-pagination background layout="prev, pager, next" :total="total" :page-size="itemsPerPage" |
||||
|
v-model:current-page="currentPage" @current-change="handlePageChange"> |
||||
|
</el-pagination> |
||||
|
</div> |
||||
|
</el-main> |
||||
|
|
||||
|
<!-- 添加活动对话框开始 --> |
||||
|
<el-dialog v-model="showAddActivityDialog" title="添加活动"> |
||||
|
<el-form :model="newActivity" ref="activityForm" label-width="120px"> |
||||
|
<el-form-item label="活动标题" :rules="[{ required: true, message: '请输入活动标题' }]"> |
||||
|
<el-input v-model="newActivity.title"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="活动详情" :rules="[{ required: true, message: '请输入活动详情' }]"> |
||||
|
<el-input type="textarea" v-model="newActivity.details"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="活动图标"> |
||||
|
<el-upload action="#" list-type="picture-card" :on-preview="handlePictureCardPreview" |
||||
|
:on-remove="handleRemove" :on-success="handleSuccess" :before-upload="beforeUpload"> |
||||
|
<el-icon class="avatar-uploader-icon"> |
||||
|
<Plus /> |
||||
|
</el-icon> |
||||
|
</el-upload> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="活动时间" :locale="zhCn" :rules="[{ required: true, message: '请选择活动时间' }]"> |
||||
|
<el-date-picker v-model="newActivity.date" type="datetimerange" start-placeholder="开始日期" |
||||
|
end-placeholder="结束日期"></el-date-picker> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="活动网址" :rules="[{ required: true, message: '请输入活动网址' }]"> |
||||
|
<el-input v-model="newActivity.url"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="选择市场" :rules="[{ required: true, message: '请选择活动面向的市场' }]"> |
||||
|
<el-select v-model="newActivity.market" placeholder="请选择市场"> |
||||
|
<el-option label="市场1" value="market1"></el-option> |
||||
|
<el-option label="市场2" value="market2"></el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="客户权限" :rules="[{ required: true, message: '请选择面向客户的级别' }]"> |
||||
|
<el-radio-group v-model="newActivity.clientLevel"> |
||||
|
<el-radio label="非网">非网</el-radio> |
||||
|
<el-radio label="半年版">半年版</el-radio> |
||||
|
<el-radio label="终免">终免</el-radio> |
||||
|
</el-radio-group> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
<span slot="footer" class="dialog-footer"> |
||||
|
<el-button @click="showAddActivityDialog = false">取 消</el-button> |
||||
|
<el-button type="primary" @click="addActivity">确 定</el-button> |
||||
|
</span> |
||||
|
</el-dialog> |
||||
|
<!-- 添加活动对话框结束 --> |
||||
|
</el-container> |
||||
|
</template> |
||||
|
|
||||
|
<script setup> |
||||
|
import { ref, computed } from 'vue'; |
||||
|
import { ElMessage } from 'element-plus'; |
||||
|
import zhCn from 'element-plus/es/locale/lang/zh-cn' |
||||
|
import homeApi from '@/api/homeApi'; |
||||
|
import router from '@/router'; |
||||
|
|
||||
|
function indexMethod(index){ |
||||
|
return itemsPerPage*(currentPage.value-1)+index+1; |
||||
|
} |
||||
|
//定义假id |
||||
|
const fakeId = ref(1); |
||||
|
|
||||
|
// 活动列表数据 |
||||
|
const activities = ref([]); |
||||
|
|
||||
|
// 分页获取所有活动 |
||||
|
function getAllActivities(currentPage, itemsPerPage) { |
||||
|
homeApi.getHomeData(currentPage, itemsPerPage) |
||||
|
.then(response => { |
||||
|
activities.value = response.data.data.list; |
||||
|
total.value = response.data.data.total; |
||||
|
console.log(activities.value); |
||||
|
console.log(total.value); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
// 默认第1页 |
||||
|
const currentPage = ref(1); |
||||
|
// 每页10条数据 |
||||
|
const itemsPerPage = 10; |
||||
|
//总条目数 |
||||
|
const total = ref(0); |
||||
|
getAllActivities(currentPage.value, itemsPerPage); |
||||
|
|
||||
|
|
||||
|
// 分页处理活动数据 |
||||
|
const paginatedActivities = computed(() => { |
||||
|
const start = (currentPage.value - 1) * itemsPerPage; |
||||
|
const end = start + itemsPerPage; |
||||
|
return activities.value.slice(start, end); |
||||
|
}); |
||||
|
|
||||
|
// 当前页改变时触发的事件 |
||||
|
const handlePageChange = (newPage) => { |
||||
|
getAllActivities(newPage, itemsPerPage); |
||||
|
}; |
||||
|
|
||||
|
// 添加的活动 |
||||
|
const newActivity = ref({ |
||||
|
id: null, |
||||
|
title: '', |
||||
|
details: '', |
||||
|
date: '', |
||||
|
url: '', |
||||
|
market: '', |
||||
|
clientLevel: '' |
||||
|
}); |
||||
|
|
||||
|
// 展示添加活动对话框 |
||||
|
const showAddActivityDialog = ref(false); |
||||
|
|
||||
|
// 添加新活动的方法 |
||||
|
const addActivity = () => { |
||||
|
newActivity.value.id = activities.value.length + 1; |
||||
|
newActivity.value.create_at = new Date().toISOString().split('T')[0]; // 设置当前时间为创建时间 |
||||
|
activities.value.push({ ...newActivity.value }); |
||||
|
newActivity.value = { |
||||
|
id: null, |
||||
|
title: '', |
||||
|
details: '', |
||||
|
date: '', |
||||
|
url: '', |
||||
|
market: '', |
||||
|
clientLevel: '' |
||||
|
}; |
||||
|
showAddActivityDialog.value = true; |
||||
|
ElMessage.success('活动添加成功'); |
||||
|
}; |
||||
|
|
||||
|
// 修改活动的方法 |
||||
|
const editActivity = (activity) => { |
||||
|
newActivity.value = { ...activity }; |
||||
|
showAddActivityDialog.value = true; |
||||
|
}; |
||||
|
|
||||
|
// 查看详情 |
||||
|
const viewDetails = (id) => { |
||||
|
console.log(id); |
||||
|
router.push({ name: 'votingManagement', params: { id: id } }); |
||||
|
// ElMessage.info(`活动ID: ${activity.id}, 活动标题: ${activity.title}, 日期: ${activity.start} - ${activity.end}, 访问人数: ${activity.visit_count}`); |
||||
|
}; |
||||
|
|
||||
|
const handlePictureCardPreview = (file) => { |
||||
|
console.log('Preview:', file); |
||||
|
}; |
||||
|
|
||||
|
const handleRemove = (file, fileList) => { |
||||
|
console.log('Remove:', file, fileList); |
||||
|
}; |
||||
|
|
||||
|
const handleSuccess = (response, file, fileList) => { |
||||
|
console.log('Success:', response, file, fileList); |
||||
|
}; |
||||
|
|
||||
|
const beforeUpload = (file) => { |
||||
|
const isJPG = file.type === 'image/jpeg'; |
||||
|
const isPNG = file.type === 'image/png'; |
||||
|
const isLt2M = file.size / 1024 / 1024 < 2; |
||||
|
|
||||
|
if (!isJPG && !isPNG) { |
||||
|
ElMessage.error('上传头像图片只能是 JPG 或 PNG 格式!'); |
||||
|
} |
||||
|
if (!isLt2M) { |
||||
|
ElMessage.error('上传头像图片大小不能超过 2MB!'); |
||||
|
} |
||||
|
return isJPG || isPNG && isLt2M; |
||||
|
}; |
||||
|
|
||||
|
// 状态对应的样式类 |
||||
|
const statusClassMap = { |
||||
|
'进行中': 'status-active', |
||||
|
'已完成': 'status-finished', |
||||
|
}; |
||||
|
|
||||
|
// 根据活动状态获取对应的样式类 |
||||
|
const getStatusClass = (status) => { |
||||
|
return statusClassMap[status] || 'status-default'; |
||||
|
}; |
||||
|
|
||||
|
// 打开添加活动对话框 |
||||
|
const openAddActivityDialog = () => { |
||||
|
newActivity.value = { |
||||
|
id: null, |
||||
|
title: '', |
||||
|
details: '', |
||||
|
date: '', |
||||
|
url: '', |
||||
|
market: '', |
||||
|
clientLevel: '' |
||||
|
}; |
||||
|
showAddActivityDialog.value = true; |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
.header-actions { |
||||
|
margin-left: 20px; |
||||
|
/* 调整按钮与标题之间的距离 */ |
||||
|
} |
||||
|
|
||||
|
.pagination-container { |
||||
|
position: absolute; |
||||
|
display: flex; |
||||
|
justify-content: center; |
||||
|
margin-top: 10rem; |
||||
|
left: 45%; |
||||
|
} |
||||
|
|
||||
|
.dialog-footer { |
||||
|
text-align: right; |
||||
|
} |
||||
|
|
||||
|
.operation-buttons { |
||||
|
display: flex; |
||||
|
justify-content: space-between; |
||||
|
} |
||||
|
|
||||
|
.status-active { |
||||
|
color: #409eff; |
||||
|
} |
||||
|
|
||||
|
.status-finished { |
||||
|
color: #6c757d; |
||||
|
text-decoration: line-through; |
||||
|
} |
||||
|
|
||||
|
.status-default { |
||||
|
color: #000; |
||||
|
} |
||||
|
</style> |
@ -1,9 +0,0 @@ |
|||||
<script setup> |
|
||||
import TheWelcome from '../components/TheWelcome.vue' |
|
||||
</script> |
|
||||
|
|
||||
<template> |
|
||||
<main> |
|
||||
<TheWelcome /> |
|
||||
</main> |
|
||||
</template> |
|
@ -0,0 +1,582 @@ |
|||||
|
<template> |
||||
|
<div class="container"> |
||||
|
<!-- 左侧菜单栏 --> |
||||
|
<div class="sidebar"> |
||||
|
<ul class="menu"> |
||||
|
<li class="menu-item active">投票管理</li> |
||||
|
<li class="menu-item">盲盒管理</li> |
||||
|
<li class="menu-item">大转盘管理</li> |
||||
|
</ul> |
||||
|
</div> |
||||
|
|
||||
|
<!-- 主内容区域 --> |
||||
|
<div class="main-content"> |
||||
|
<!-- 页面头部 --> |
||||
|
<header class="header"> |
||||
|
<div class="header-title">活动管理后台</div> |
||||
|
</header> |
||||
|
|
||||
|
<div class="content-container"> |
||||
|
<!-- 卡片容器 --> |
||||
|
<div class="card"> |
||||
|
<div class="card-header"> |
||||
|
<span class="card-title">查看详情</span> |
||||
|
<button class="back-btn" @click="goBack">返回上一页</button> |
||||
|
</div> |
||||
|
|
||||
|
<!-- 搜索按钮区域 --> |
||||
|
<div class="search-bar"> |
||||
|
<div class="search-input-area"> |
||||
|
<input type="text" class="search-input" placeholder="请输入精网号" v-model="searchId"> |
||||
|
<div class="dropdown"> |
||||
|
<select class="region-select" v-model="selectedRegion"> |
||||
|
<option value="">请选择地区</option> |
||||
|
<option value="北京">北京</option> |
||||
|
<option value="上海">上海</option> |
||||
|
<option value="香港">香港</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
<div class="date-range"> |
||||
|
<div class="date-picker"> |
||||
|
<img src="../assets/images/日历.png" alt="Calendar" |
||||
|
class="calendar-icon"> |
||||
|
<input type="date" class="date-input" placeholder="开始日期" v-model="startDate"> |
||||
|
</div> |
||||
|
<span class="date-separator">至</span> |
||||
|
<div class="date-picker"> |
||||
|
<img src="../assets/images/日历.png" alt="Calendar" |
||||
|
class="calendar-icon"> |
||||
|
<input type="date" class="date-input" placeholder="结束日期" v-model="endDate"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="search-buttons"> |
||||
|
<button class="search-btn" @click="searchVoteRecords">搜索</button> |
||||
|
<button class="export-btn" @click="exportExcel">导出Excel</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<!-- 表格数据展示 --> |
||||
|
<div class="table-container"> |
||||
|
<table class="data-table"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th>序号</th> |
||||
|
<th>姓名</th> |
||||
|
<th>精网号</th> |
||||
|
<th>地区</th> |
||||
|
<th>投票明细</th> |
||||
|
<th>投票时间</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<tr v-for="(record, index) in voteRecords" :key="index"> |
||||
|
<td>{{ index + 1 }}</td> |
||||
|
<td>{{ record.nickname }}</td> |
||||
|
<td>{{ record.jwcode }}</td> |
||||
|
<td>{{ record.dept }}</td> |
||||
|
<td>{{ record.options_title }}</td> |
||||
|
<td>{{ record.time }}</td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
|
||||
|
<!-- 分页 --> |
||||
|
<el-pagination class="pagination" v-model:current-page="currentPage" v-model:page-size="pageSize" :page-sizes="[5, 10, 20]" |
||||
|
:total="totalPages" @size-change="handleSizeChange" @current-change="handlePageChange" |
||||
|
layout="total, sizes, prev, pager, next, jumper" /> |
||||
|
|
||||
|
<!-- <div class="pagination"> |
||||
|
<div class="pagination-info">第 {{ currentPage }} 页</div> |
||||
|
<div class="page-size"> |
||||
|
<select class="page-size-select" v-model="pageSize"> |
||||
|
<option value="8">8条/页</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
<div class="page-numbers"> |
||||
|
<button class="page-btn" @click="changePage(currentPage - 1)" :disabled="currentPage === 1"><</button> |
||||
|
<button class="page-btn" v-for="page in totalPages" :key="page" @click="changePage(page)":class="{ active: page === currentPage }">{{ page }}</button> |
||||
|
<button class="page-btn" @click="changePage(currentPage + 1)":disabled="currentPage === totalPages">></button> |
||||
|
</div> |
||||
|
<div class="go-to-page"> |
||||
|
<span>前往第</span> |
||||
|
<input type="number" class="page-input" v-model.number="currentPage" @change="changePage(currentPage)" |
||||
|
min="1" :max="totalPages"> |
||||
|
<span>页</span> |
||||
|
</div> |
||||
|
</div> --> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { ref } from 'vue'; |
||||
|
import axiosInstance from '@/api/axiosConfig'; |
||||
|
import axiosexport from '@/api/axiosConfig'; |
||||
|
import { ElTable } from 'element-plus'; |
||||
|
import { useRoute } from 'vue-router'; |
||||
|
|
||||
|
export default { |
||||
|
|
||||
|
// 组件数据 |
||||
|
data() { |
||||
|
return { |
||||
|
// detailId: window.location.pathname.split('/').pop() || '24', |
||||
|
detailId: ref(0), |
||||
|
//detailId: 24, |
||||
|
searchId: '', |
||||
|
selectedRegion: '', |
||||
|
startDate: '', |
||||
|
endDate: '', |
||||
|
// currentPage: 1, |
||||
|
// pageSize: 8, |
||||
|
voteRecords: {}, |
||||
|
totalPages: ref(0), |
||||
|
totalRecords: 0, |
||||
|
currentPage: ref(1), |
||||
|
pageSize: ref(10), |
||||
|
route: useRoute(), |
||||
|
}; |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
methods: { |
||||
|
// 分页组件的 current-change 事件处理函数 |
||||
|
handlePageChange(val) { |
||||
|
console.log(`current page: ${val}`); |
||||
|
this.fetchVoteRecords(); // 当页码改变时,重新获取数据 |
||||
|
}, |
||||
|
handleSizeChange(val) { |
||||
|
this.fetchVoteRecords(); |
||||
|
}, |
||||
|
|
||||
|
// 获取投票记录 |
||||
|
async fetchVoteRecords(detailId) { |
||||
|
try { |
||||
|
const params = { |
||||
|
PageNo: this.currentPage, |
||||
|
PageSize: this.pageSize, |
||||
|
ActivityId: this.detailId, |
||||
|
}; |
||||
|
const response = await axiosInstance.post('', params); |
||||
|
this.voteRecords = response.data.data.list; |
||||
|
this.totalPages = response.data.data.total; |
||||
|
console.log(response.data.data.list); |
||||
|
// this.totalRecords = response.data.data.total; |
||||
|
} catch (error) { |
||||
|
console.error('获取投票记录失败:', error); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
// 搜索投票记录 |
||||
|
async searchVoteRecords() { |
||||
|
try { |
||||
|
const params = { |
||||
|
jwcode: this.searchId, |
||||
|
dept: this.selectedRegion, |
||||
|
startDate: this.startDate, |
||||
|
endDate: this.endDate, |
||||
|
PageNo: this.currentPage, |
||||
|
PageSize: this.pageSize, |
||||
|
ActivityId: this.detailId, |
||||
|
}; |
||||
|
const response = await axiosInstance.post('', params); |
||||
|
this.voteRecords = response.data.data.list; |
||||
|
this.totalRecords = response.data.data.total; |
||||
|
this.currentPage = 1; |
||||
|
this.totalPages = Math.ceil(this.totalRecords / this.pageSize); |
||||
|
} catch (error) { |
||||
|
console.error('搜索投票记录失败:', error); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
// 导出Excel |
||||
|
async exportExcel() { |
||||
|
try { |
||||
|
// 构建请求参数 |
||||
|
const params = { |
||||
|
jwcode: this.searchId, |
||||
|
dept: this.selectedRegion, |
||||
|
startDate: this.startDate, |
||||
|
endDate: this.endDate, |
||||
|
ActivityId: this.detailId |
||||
|
}; |
||||
|
// 发起 POST 请求,设置响应类型为 blob |
||||
|
const response = await axiosInstance.post('http://192.168.8.235:8000/api/export', params, { |
||||
|
responseType: 'blob' |
||||
|
}); |
||||
|
|
||||
|
// 创建 Blob 对象并生成临时 URL |
||||
|
const url = window.URL.createObjectURL(new Blob([response.data])); |
||||
|
// 创建 <a> 标签用于触发下载 |
||||
|
const link = document.createElement('a'); |
||||
|
link.href = url; |
||||
|
// 设置下载文件名 |
||||
|
link.setAttribute('download', '投票记录.xlsx'); |
||||
|
document.body.appendChild(link); |
||||
|
// 模拟点击下载 |
||||
|
link.click(); |
||||
|
// 释放临时 URL |
||||
|
window.URL.revokeObjectURL(url); |
||||
|
// 移除 <a> 标签 |
||||
|
document.body.removeChild(link); |
||||
|
} catch (error) { |
||||
|
console.error('导出 Excel 失败:', error); |
||||
|
// 可以添加提示用户导出失败的逻辑,如使用 Element Plus 的消息提示 |
||||
|
// ElMessage.error('导出 Excel 失败,请稍后重试'); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
// 切换页码 |
||||
|
// changePage(page) { |
||||
|
// if (page >= 1 && page <= this.totalPages) { |
||||
|
// this.currentPage = page; |
||||
|
// this.fetchVoteRecords(); |
||||
|
// } |
||||
|
// }, |
||||
|
|
||||
|
// 返回上一页 |
||||
|
goBack() { |
||||
|
window.history.back(); |
||||
|
}, |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
//组件挂载后获取投票记录 |
||||
|
mounted() { |
||||
|
this.detailId = this.route.params.id; |
||||
|
console.log(this.route.params.id); |
||||
|
console.log(this.detailId); |
||||
|
this.fetchVoteRecords(this.detailId); |
||||
|
} |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<style scoped> |
||||
|
/* 全局容器样式 */ |
||||
|
.container { |
||||
|
font-family: "PingFang SC", "Microsoft YaHei", sans-serif; |
||||
|
width: 100%; |
||||
|
height: 100vh; |
||||
|
background-color: #f5f5f5; |
||||
|
display: flex; |
||||
|
flex-direction: row; |
||||
|
} |
||||
|
|
||||
|
/* 左侧菜单栏样式 */ |
||||
|
.sidebar { |
||||
|
width: 9%; |
||||
|
height: 85.5%; |
||||
|
background-color: #fff; |
||||
|
padding: 0.5% 0; |
||||
|
box-shadow: 3px 0 4px rgba(0, 0, 0, 0.05); |
||||
|
margin-top: 5.6rem; |
||||
|
margin-left: 1.6%; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
.menu { |
||||
|
list-style: none; |
||||
|
padding: 0; |
||||
|
margin: 0; |
||||
|
} |
||||
|
|
||||
|
.menu-item { |
||||
|
padding: 1rem 2.4rem; |
||||
|
cursor: pointer; |
||||
|
color: #666; |
||||
|
transition: background-color 0.3s; |
||||
|
} |
||||
|
|
||||
|
.menu-item:hover { |
||||
|
background-color: #e6e6e6; |
||||
|
} |
||||
|
|
||||
|
.menu-item.active { |
||||
|
background-color: #fff; |
||||
|
color: #ff6b6b; |
||||
|
font-weight: bold; |
||||
|
border-left: 3px solid #ff6b6b; |
||||
|
} |
||||
|
|
||||
|
/* 主内容区域样式 */ |
||||
|
.main-content { |
||||
|
flex: 1; |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
} |
||||
|
|
||||
|
/* 页面头部样式 */ |
||||
|
.header { |
||||
|
display: flex; |
||||
|
justify-content: space-between; |
||||
|
align-items: center; |
||||
|
height: 4.7rem; |
||||
|
padding: 0 12.5rem; |
||||
|
background-color: #fff; |
||||
|
box-shadow: 0 5px 4px rgba(0, 0, 0, 0.05); |
||||
|
margin-left: -16rem; |
||||
|
} |
||||
|
|
||||
|
.header-title { |
||||
|
font-size: 23px; |
||||
|
/* font-weight: bold; */ |
||||
|
color: #333; |
||||
|
margin-top: -0.3rem; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/* 内容容器样式 */ |
||||
|
.content-container { |
||||
|
flex: 1; |
||||
|
padding: 20px; |
||||
|
} |
||||
|
|
||||
|
/* 卡片样式 */ |
||||
|
.card { |
||||
|
width: 96%; |
||||
|
height: 100%; |
||||
|
background-color: #fff; |
||||
|
/* box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); */ |
||||
|
box-shadow: 1px 5px 8px rgba(0, 0, 0, 0.05); |
||||
|
overflow: hidden; |
||||
|
margin-top: -0.3%; |
||||
|
} |
||||
|
|
||||
|
/* 卡片头部样式 */ |
||||
|
.card-header { |
||||
|
display: flex; |
||||
|
justify-content: space-between; |
||||
|
align-items: center; |
||||
|
padding: 15px 20px; |
||||
|
border-bottom: 1px solid #eee; |
||||
|
} |
||||
|
|
||||
|
.card-title { |
||||
|
font-size: 16px; |
||||
|
font-weight: bold; |
||||
|
color: #333; |
||||
|
margin-left: 1rem; |
||||
|
} |
||||
|
|
||||
|
.back-btn { |
||||
|
padding: 6px 12px; |
||||
|
border: 1px solid #e75d5d; |
||||
|
border-radius: 4px; |
||||
|
background-color: #fff; |
||||
|
color: #e75d5d; |
||||
|
font-size: 14px; |
||||
|
cursor: pointer; |
||||
|
margin-right: 2rem; |
||||
|
} |
||||
|
|
||||
|
/* 搜索框区域样式 */ |
||||
|
.search-bar { |
||||
|
padding: 20px; |
||||
|
background-color: #fff; |
||||
|
display: flex; |
||||
|
justify-content: space-between; |
||||
|
align-items: center; |
||||
|
} |
||||
|
|
||||
|
.search-input-area { |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
gap: 18px; |
||||
|
} |
||||
|
|
||||
|
.search-input { |
||||
|
width: 8rem; |
||||
|
padding: 8px 12px; |
||||
|
border: 2px solid #ddd; |
||||
|
border-radius: 7px; |
||||
|
font-size: 14px; |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
.region-select { |
||||
|
width: 9rem; |
||||
|
padding: 8px 12px; |
||||
|
border: 2px solid #ddd; |
||||
|
border-radius: 7px; |
||||
|
font-size: 14px; |
||||
|
color: #999; |
||||
|
/* 设置输入框内文字颜色 */ |
||||
|
} |
||||
|
|
||||
|
.date-range { |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
gap: 10px; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
.date-picker { |
||||
|
position: relative; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
} |
||||
|
|
||||
|
.calendar-icon { |
||||
|
width: 14%; |
||||
|
position: absolute; |
||||
|
left: 8px; |
||||
|
top: 49%; |
||||
|
transform: translateY(-50%); |
||||
|
color: #999; |
||||
|
} |
||||
|
|
||||
|
.date-input { |
||||
|
padding: 8px 12px 8px 28px; |
||||
|
border: 2px solid #ddd; |
||||
|
border-radius: 7px; |
||||
|
font-size: 14px; |
||||
|
color: #999; |
||||
|
/* 设置输入框内文字颜色 */ |
||||
|
} |
||||
|
|
||||
|
.date-separator { |
||||
|
margin: 0 10px; |
||||
|
color: #666; |
||||
|
} |
||||
|
|
||||
|
.search-buttons { |
||||
|
display: flex; |
||||
|
gap: 5px; |
||||
|
margin-right: 38rem; |
||||
|
} |
||||
|
|
||||
|
.search-btn, |
||||
|
.export-btn { |
||||
|
padding: 9px 20px; |
||||
|
border: none; |
||||
|
border-radius: 6px; |
||||
|
font-size: 14px; |
||||
|
cursor: pointer; |
||||
|
/* margin-right: 19.3rem; */ |
||||
|
} |
||||
|
|
||||
|
.search-btn { |
||||
|
background-color: #e63946; |
||||
|
color: #fff; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
.export-btn { |
||||
|
background-color: #e63946; |
||||
|
color: #fff; |
||||
|
/* margin-right: 20rem; */ |
||||
|
} |
||||
|
|
||||
|
/* 表格区域样式 */ |
||||
|
.table-container { |
||||
|
padding: 3px 13px; |
||||
|
} |
||||
|
|
||||
|
.data-table { |
||||
|
width: 100%; |
||||
|
border-collapse: collapse; |
||||
|
} |
||||
|
|
||||
|
.data-table th { |
||||
|
padding: 15px; |
||||
|
text-align: center; |
||||
|
background-color: #f5f5f5; |
||||
|
font-weight: normal; |
||||
|
color: #666; |
||||
|
border-bottom: 1px solid #ddd; |
||||
|
} |
||||
|
|
||||
|
.data-table td { |
||||
|
padding: 14px 16px; |
||||
|
text-align: center; |
||||
|
border-bottom: 2px solid #eee; |
||||
|
font-size: 15px; |
||||
|
} |
||||
|
|
||||
|
.even-row { |
||||
|
background-color: #fff; |
||||
|
} |
||||
|
|
||||
|
.odd-row { |
||||
|
background-color: #fff; |
||||
|
} |
||||
|
|
||||
|
/* 分页区域样式 */ |
||||
|
.pagination { |
||||
|
width: 10%; |
||||
|
|
||||
|
display: flex; |
||||
|
justify-content: space-between; |
||||
|
align-items: center; |
||||
|
padding: 20px 20px; |
||||
|
border-top: 1px solid #eee; |
||||
|
margin-top: 2.2rem; |
||||
|
margin-left: 65rem; |
||||
|
} |
||||
|
|
||||
|
.pagination-info { |
||||
|
font-size: 14px; |
||||
|
color: #666; |
||||
|
font-weight: bold; |
||||
|
margin-left: 45rem; |
||||
|
} |
||||
|
|
||||
|
.page-size { |
||||
|
margin-left: -11rem; |
||||
|
} |
||||
|
|
||||
|
.page-size-select { |
||||
|
padding: 5px 12px; |
||||
|
border: 2px solid #ddd; |
||||
|
font-size: 14px; |
||||
|
} |
||||
|
|
||||
|
.page-numbers { |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
gap: 0px; |
||||
|
margin-left: -6rem; |
||||
|
} |
||||
|
|
||||
|
.page-btn { |
||||
|
width: 1.5rem; |
||||
|
display: flex; |
||||
|
justify-content: center; |
||||
|
align-items: center; |
||||
|
border: 0px solid #ddd; |
||||
|
background-color: #fff; |
||||
|
cursor: pointer; |
||||
|
font-size: 15px; |
||||
|
} |
||||
|
|
||||
|
.page-btn.active { |
||||
|
background-color: #f0f0f0; |
||||
|
font-weight: bold; |
||||
|
} |
||||
|
|
||||
|
.go-to-page { |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
gap: 5px; |
||||
|
font-size: 14px; |
||||
|
} |
||||
|
|
||||
|
.page-input { |
||||
|
width: 40px; |
||||
|
padding: 5px 4px; |
||||
|
border: 2px solid #ddd; |
||||
|
border-radius: 4px; |
||||
|
text-align: center; |
||||
|
font-size: 14px; |
||||
|
} |
||||
|
</style> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue