提交 f5abd7e2 编写于 作者: 夏天。。's avatar 夏天。。

Merge remote-tracking branch 'origin/dev' into dev

{ {
"recommendations": ["johnsoncodehk.volar"] "recommendations": ["johnsoncodehk.volar"]
} }
# Vue 3 + Typescript + Vite # Vue 3 + Typescript + Vite
This template should help get you started developing with Vue 3 and Typescript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more. This template should help get you started developing with Vue 3 and Typescript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
## Recommended IDE Setup ## Recommended IDE Setup
- [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar) - [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar)
## Type Support For `.vue` Imports in TS ## Type Support For `.vue` Imports in TS
Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using manual `h(...)` calls), you can enable Volar's `.vue` type support plugin by running `Volar: Switch TS Plugin on/off` from VSCode command palette. Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using manual `h(...)` calls), you can enable Volar's `.vue` type support plugin by running `Volar: Switch TS Plugin on/off` from VSCode command palette.
// generated by unplugin-vue-components
// We suggest you to commit this file into source control
// Read more: https://github.com/vuejs/vue-next/pull/3399
declare module 'vue' {
export interface GlobalComponents {
AButton: typeof import('ant-design-vue/es')['Button']
AInput: typeof import('ant-design-vue/es')['Input']
APagination: typeof import('ant-design-vue/es')['Pagination']
ASelect: typeof import('ant-design-vue/es')['Select']
ASelectOption: typeof import('ant-design-vue/es')['SelectOption']
ATooltip: typeof import('ant-design-vue/es')['Tooltip']
Daily: typeof import('./src/components/Daily/index.vue')['default']
Home: typeof import('./src/components/Home/index.vue')['default']
MentalMap: typeof import('./src/components/MentalMap/index.vue')['default']
Total: typeof import('./src/components/Total/index.vue')['default']
}
}
export { }
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" /> <link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title> <title>Vite App</title>
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
<script type="module" src="/src/main.ts"></script> <script type="module" src="/src/main.ts"></script>
</body> </body>
</html> </html>
此差异已折叠。
{ {
"name": "olympicsystem", "name": "olympicsystem",
"private": true, "private": true,
"version": "0.0.0", "version": "0.0.0",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "vue-tsc --noEmit && vite build", "build": "vue-tsc --noEmit && vite build",
"preview": "vite preview" "preview": "vite preview"
}, },
"dependencies": { "dependencies": {
"@types/node": "^17.0.21", "@types/node": "^17.0.21",
"vue": "^3.2.25", "ant-design-vue": "^2.2.8",
"vue-router": "^4.0.13" "axios": "^0.26.1",
}, "vue": "^3.2.25",
"devDependencies": { "vue-axios": "^3.4.1",
"@vitejs/plugin-vue": "^2.2.0", "vue-router": "^4.0.13"
"less": "^4.1.2", },
"less-loader": "^10.2.0", "devDependencies": {
"typescript": "^4.5.4", "@vitejs/plugin-vue": "^2.2.0",
"vite": "^2.8.0", "less": "^4.1.2",
"vue-tsc": "^0.29.8" "less-loader": "^10.2.0",
} "typescript": "^4.5.4",
} "unplugin-vue-components": "^0.18.1",
"vite": "^2.8.0",
"vue-tsc": "^0.29.8"
}
}
<script setup lang="ts"> <script setup lang="ts">
import Header from './common/Header.vue' import Header from './common/Header.vue'
import Footer from './common/Footer.vue' import Footer from './common/Footer.vue'
</script> </script>
<template> <template>
<Header></Header> <Header></Header>
<router-view></router-view> <router-view></router-view>
<Footer></Footer> <Footer></Footer>
</template> </template>
<style> <style>
body { body {
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
#app { #app {
font-family: Avenir, Helvetica, Arial, sans-serif; font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
</style> </style>
export default {
baseUrl: {
dev: "http://101.132.99.44:8080", // 开发环境
// fat: 'http://xxx.xx.xx.xx:8080'
//uat : "http://production.com"
},
};
\ No newline at end of file
import { message } from "ant-design-vue";
import axios from "axios"; // 引用axios
import config from "./config";
const instance = axios.create({
baseURL: config.baseUrl.dev,
timeout: 60000,
});
//get请求
export function get(url: string, params = {}) {
return new Promise((resolve, reject) => {
instance
.get(url, {
params: params,
})
.then((response) => {
resolve(response.data);
})
.catch((err) => {
reject(err);
});
});
}
//post请求
export function post(url: string, data = {}) {
return new Promise((resolve, reject) => {
instance.post(url, data).then(
(response) => {
resolve(response.data);
},
(err) => {
reject(err);
}
);
});
}
import { get, post } from './http';
// Total部分
// 获取奖牌总榜数据
export const reqGetTotal = (data : any) => get("/total",data);
// Daily部分
// 获取比赛项目选项
export const reqGetItems = () => get("/getItems");
// 获取比赛场馆选项
export const reqGetSites = () => get("/getSites")
// 根据选择项搜索
export const reqSearch = (data : any) => get("/search", data);
body { body {
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
\ No newline at end of file
<template>
<div class="title">
<span>时间</span>
<span>大项</span>
<span>比赛</span>
<span>场馆</span>
<span>比赛状态</span>
<span>数据</span>
</div>
</template>
<script lang="ts">
export default {
name: 'DailyTitle',
setup() {
}
}
</script>
<style lang="less" scoped>
.title{
margin-bottom: 20px;
margin-top: 20px;
background-color: rgba(227, 235, 246, 0.8);
border-radius: 10px;
display: flex;
span {
color: #19489a;
font-size: 1.3em;
line-height: 3.2em;
letter-spacing: 5px;
font-weight: bold;
text-align: center;
display: block;
}
span:nth-child(1) {
width: 15%;
}
span:nth-child(2) {
width: 10%;
}
span:nth-child(3) {
width: 30%;
}
span:nth-child(4) {
width: 25%;
}
span:nth-child(5) {
width: 10%;
}
span:nth-child(6) {
width: 10%;
}
img {
width: 1.2em;
vertical-align: middle;
}
}
</style>
\ No newline at end of file
<template> <template>
<div class="main"> <div class="main">
<span>OlympicSystem © hocztms & daytoykkk</span> <span>OlympicSystem © hocztms & daytoykkk</span>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.main { .main {
height: 70px; height: 70px;
background: -webkit-linear-gradient(top, #788eb2, #546fa3, #244792); background: -webkit-linear-gradient(top, #788eb2, #546fa3, #244792);
text-align: center; text-align: center;
span { span {
font-size: 0.9em; font-size: 0.9em;
color: aliceblue; color: aliceblue;
line-height: 70px; line-height: 70px;
} }
} }
</style> </style>
\ No newline at end of file
<template> <template>
<div class="main"> <div class="main">
<div class="title" @click="toContent('/home')">首页</div> <div class="title" @click="toContent('/home')">首页</div>
<div class="title" @click="toContent('/total')">奖牌总榜</div> <div class="title" @click="toContent('/total')">奖牌总榜</div>
<div class="title" @click="toContent('/daily')">每日赛程</div> <div class="title" @click="toContent('/daily')">每日赛程</div>
<div class="title" @click="toContent('/mentalmap')">奖牌地图</div> <div class="title" @click="toContent('/mentalmap')">奖牌地图</div>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
const router = useRouter(); const router = useRouter();
// 页面跳转 // 页面跳转
const toContent = (path : string) => { const toContent = (path : string) => {
router.push(path); router.push(path);
} }
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.main { .main {
height: 65px; height: 65px;
background-color: #ecf0f6; background-color: #ecf0f6;
padding-left: 120px; padding-left: 120px;
display: flex; display: flex;
align-items: center; align-items: center;
.title { .title {
color: #343c76; color: #343c76;
margin-right: 50px; margin-right: 50px;
font-weight: bold; font-weight: bold;
font-size: 1.3em; font-size: 1.3em;
cursor: pointer; cursor: pointer;
} }
.title:hover{ .title:hover{
color: #a4aada; color: #a4aada;
} }
} }
</style> </style>
\ No newline at end of file
<template> <template>
<div class="title"> <div class="title">
<span>排名</span> <span>排名</span>
<span>国家/地区</span> <span>国家/地区</span>
<span><img src="../assets/img/gold.png" />金牌</span> <span><img src="../assets/img/gold.png" />金牌</span>
<span><img src="../assets/img/yinpai.png" />银牌</span> <span><img src="../assets/img/yinpai.png" />银牌</span>
<span><img src="../assets/img/tongpai.png" />铜牌</span> <span><img src="../assets/img/tongpai.png" />铜牌</span>
<span>总数</span> <span>总数</span>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
export default { export default {
name: 'TotalTitle', name: 'TotalTitle',
setup() { setup() {
} }
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.title{ .title{
display: flex; display: flex;
margin-bottom: 20px; margin-bottom: 20px;
span { span {
color: #131e56; color: #131e56;
font-size: 1.2em; font-size: 1.2em;
font-weight: bold; font-weight: bold;
display: block; display: block;
text-align: center; text-align: center;
} }
span:nth-child(1) { span:nth-child(1) {
width: 15%; width: 15%;
} }
span:nth-child(2) { span:nth-child(2) {
width: 35%; width: 35%;
} }
span:nth-child(3) { span:nth-child(3) {
width: 10%; width: 10%;
} }
span:nth-child(4) { span:nth-child(4) {
width: 10%; width: 10%;
} }
span:nth-child(5) { span:nth-child(5) {
width: 10%; width: 10%;
} }
span:nth-child(6) { span:nth-child(6) {
width: 20%; width: 20%;
} }
img { img {
width: 1.2em; width: 1.2em;
vertical-align: middle; vertical-align: middle;
} }
} }
</style> </style>
\ No newline at end of file
.main {
position: relative;
min-height: 600px;
background: url(../../assets/img/bg.png) no-repeat center center;
background-size :cover;
.mainBox {
width: 80%;
margin: 0 auto;
padding: 30px 0 60px 0;
// 模块标题和选择
.topBox {
display: flex;
justify-content: space-between;
.titleBox {
img {
width: 60px;
float: left;
}
p {
margin: 16px 0 0 20px;
padding: 5px 5px 5px 40px;
color: #1a2763;
background-color: rgba(242, 242, 242, 0.8);
border-top-right-radius: 15px;
font-size: 22px;
font-weight: bold;
letter-spacing: 8px;
}
}
.selectBox {
display: flex;
align-items: flex-end;
.ant-select {
min-width: 150px;
margin-right: 25px;
display: flex;
align-items: center;
color: #1a2763;
font-weight: 500;
}
.ant-input-affix-wrapper {
height: 32px;
width: 170px;
color: #1a2763;
}
}
}
// 列表
.listBox {
background-color: rgba(227, 235, 246, 0.8);
border-radius: 15px;
padding: 20px 0;
.listItem {
display: flex;
p {
margin: 0 auto;
color: #1a2763;
font-size: 1.2em;
letter-spacing: 5px;
}
span {
font-size: 1.1em;
line-height: 2.5em;
text-align: center;
display: block;
}
span:nth-child(1) {
width: 15%;
}
span:nth-child(2) {
width: 10%;
}
span:nth-child(3) {
width: 30%;
}
span:nth-child(4) {
width: 25%;
}
span:nth-child(5) {
width: 10%;
}
span:nth-child(6) {
width: 10%;
color: #194895;
cursor: pointer;
}
}
}
// 分页
.pagination {
margin-top: 20px;
display: flex;
flex-direction: row-reverse;
}
}
}
\ No newline at end of file
import { message } from 'ant-design-vue';
import { onMounted, reactive, defineComponent, toRefs } from 'vue'
import { reqGetItems, reqGetSites, reqSearch } from '../../api';
import DailyTitle from '../../common/DailyTitle.vue'
import { dailyItem, dateOption } from '../../config/dailyConfig';
export default defineComponent({
components: {
DailyTitle,
},
setup() {
let state = reactive({
optionIndex: 1, // 1根据比赛日期,2根据比赛项目,3根据比赛场馆
searchContent: "",
total: 1,
current: 1,
pageSize: 10,
itemOption: [],
siteOption: [],
list: [] as dailyItem[],
form: {
date: "选择比赛日期",
item: "选择比赛项目",
site: "选择比赛场馆"
}
})
onMounted(() => {
getList();
getItemOption();
getSiteOption();
})
// 获取比赛数据
const getList = async () => {
let reqData = {
date: state.form.date =="选择比赛日期" ? "":state.form.date,
item: state.form.item =="选择比赛项目" ? "":state.form.item,
site: state.form.site =="选择比赛场馆" ? "":state.form.site,
page: state.current,
size: state.pageSize
}
let res:any = await reqSearch(reqData);
if(res.code!=1) {
message.warning("error");
return;
}
state.list = res.data;
//todo total
}
// 获取比赛项目选项
const getItemOption = async () => {
let res:any = await reqGetItems();
state.itemOption = res.data;
}
// 获取比赛场馆选项
const getSiteOption = async () => {
let res:any = await reqGetSites();
state.siteOption = res.data;
}
// 选择
const handleSelectChange = () => {
getList();
}
//todo 分页
const handlePageChange = (page : number, pageSize :number) => {
state.current = page;
getList();
}
return {
...toRefs(state),
dateOption,
handleSelectChange,
handlePageChange
}
}
})
\ No newline at end of file
<template> <template>
<div class="main">每日赛程</div> <div class="main">
</template> <div class="mainBox">
<!-- 模块标题和选择 -->
<div class="topBox">
<script setup lang="ts"> <div class="titleBox">
import { onMounted, ref, reactive } from 'vue' <img src="../../assets/img/xiaoren1.png" />
import { useRoute, useRouter } from 'vue-router' <p>每日赛程</p>
</div>
const route = useRoute(); <div class="selectBox">
const router = useRouter(); <a-select v-model:value="form.date" @change="handleSelectChange">
<a-select-option
v-for="item of dateOption"
onMounted(() => { v-bind:key="item"
v-model:value="item.value"
>{{ item.label }}</a-select-option>
}) </a-select>
<a-select v-model:value="form.item" @change="handleSelectChange">
</script> <a-select-option
v-for="item of itemOption"
<style scoped> v-bind:key="item"
/* @import "./index.css"; */ v-model:value="item.value"
>{{ item }}</a-select-option>
</a-select>
<a-select v-model:value="form.site" @change="handleSelectChange">
<a-select-option
v-for="item of siteOption"
v-bind:key="item"
v-model:value="item.value"
>{{ item }}</a-select-option>
</a-select>
<a-input v-model:value="searchContent" placeholder="请输入关键字搜索" width="200px">
<template #suffix>
<img src="../../assets/img/search.png" width="16" />
</template>
</a-input>
</div>
</div>
<!-- 标题 -->
<DailyTitle></DailyTitle>
<!-- 列表 -->
<div class="listBox">
<div class="listItem" v-if="list.length==0">
<p>暂无数据</p>
</div>
<div v-else>
<div class="listItem" v-for="item of list" v-bind:key="item.matchId">
<span>{{ item.startdatecn }}</span>
<span>{{ item.itemcodename }}</span>
<span>{{ item.title }} {{item.homename? (item.homename + "VS" + item.awayname):""}}</span>
<span>{{ item.venuename }}</span>
<span>已结束</span>
<span>成绩公报</span>
</div>
</div>
</div>
<!-- 分页 -->
<div class="pagination">
<a-pagination
v-model:current="current"
:total="total"
show-less-items
@change="handlePageChange"
/>
</div>
</div>
</div>
</template>
<script lang="ts">
import Daily from './index';
export default Daily;
</script>
<style scoped lang="less">
@import "./index.less";
</style> </style>
\ No newline at end of file
.main { .main {
height: 800px; height: 800px;
background-image: url(../../assets/img/bg.png); background-image: url(../../assets/img/bg.png);
-moz-background-size :cover; -moz-background-size :cover;
-webkit-background-size :cover; -webkit-background-size :cover;
-o-background-size :cover; -o-background-size :cover;
background-size :cover; background-size :cover;
} }
\ No newline at end of file
import { onMounted, ref, reactive, defineComponent } from 'vue' import { onMounted, ref, reactive, defineComponent } from 'vue'
import { useRoute, useRouter } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
export default defineComponent({ export default defineComponent({
components: { components: {
}, },
setup() { setup() {
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
onMounted(() => { onMounted(() => {
}) })
} }
}) })
\ No newline at end of file
<template> <template>
<div class="main">首页</div> <div class="main">首页</div>
</template> </template>
<script lang="ts"> <script lang="ts">
import Home from "./index"; import Home from "./index";
export default Home; export default Home;
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
@import "./index.less"; @import "./index.less";
</style> </style>
\ No newline at end of file
<template> <template>
<div class="main">奖牌地图</div> <div class="main">奖牌地图</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref, reactive } from 'vue' import { onMounted, ref, reactive } from 'vue'
import { useRoute, useRouter } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
onMounted(() => { onMounted(() => {
}) })
</script> </script>
<style scoped> <style scoped>
/* @import "./index.css"; */ /* @import "./index.css"; */
</style> </style>
\ No newline at end of file
interface TotalItem { interface TotalItem {
gold: string, gold: string,
countryname: string, countryName: string,
count: string, count: string,
rank: string, medalRank: string,
silver: string, silver: string,
countryid: string, countryId: string,
bronze: string bronze: string,
} medalId?: string
}
export default TotalItem; export default TotalItem;
\ No newline at end of file
/// <reference types="vite/client" /> /// <reference types="vite/client" />
declare module '*.vue' { declare module '*.vue' {
import type { DefineComponent } from 'vue' import type { DefineComponent } from 'vue'
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
const component: DefineComponent<{}, {}, any> const component: DefineComponent<{}, {}, any>
export default component export default component
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册