@ -0,0 +1,8 @@ |
|||
[*.{js,jsx,ts,tsx,vue}] |
|||
indent_style = space |
|||
indent_size = 2 |
|||
end_of_line = lf |
|||
trim_trailing_whitespace = true |
|||
insert_final_newline = true |
|||
max_line_length = 140 |
|||
root = true |
@ -0,0 +1 @@ |
|||
VITE_API_URL=http://localhost:4001 |
@ -0,0 +1 @@ |
|||
VITE_API_URL=https://www.tall.wiki |
@ -0,0 +1 @@ |
|||
VITE_API_URL=https://test.tall.wiki |
@ -0,0 +1,10 @@ |
|||
node_modules |
|||
dist/ |
|||
test |
|||
build/ |
|||
babel.config.js |
|||
package.json |
|||
postcss.config.js |
|||
.eslintrc.js |
|||
vite.config.js |
|||
*/Middle.vue |
@ -0,0 +1,55 @@ |
|||
module.exports = { |
|||
env: { |
|||
browser: true, |
|||
es2021: true, |
|||
}, |
|||
extends: ['plugin:vue/essential', 'airbnb-base', 'plugin:prettier/recommended'], |
|||
parserOptions: { |
|||
ecmaVersion: 12, |
|||
sourceType: 'module', |
|||
}, |
|||
plugins: ['vue'], |
|||
rules: { |
|||
'import/no-unresolved': 0, |
|||
'import/extensions': 0, |
|||
'no-plusplus': 0, |
|||
'no-use-before-define': [ |
|||
'error', |
|||
{ |
|||
functions: false, |
|||
classes: true, |
|||
variables: true, |
|||
}, |
|||
], |
|||
'consistent-return': 0, |
|||
'vue/html-self-closing': 'off', |
|||
'no-unused-expressions': 'off', |
|||
'vue/no-mutating-props': 'off', |
|||
'vue/no-multiple-template-root': 'off', |
|||
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', |
|||
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', |
|||
'no-param-reassign': 'off', |
|||
'max-len': [ |
|||
'error', |
|||
{ |
|||
code: 140, |
|||
tabWidth: 2, |
|||
}, |
|||
], |
|||
'object-curly-newline': ['error', { multiline: true }], |
|||
'arrow-parens': ['error', 'as-needed'], |
|||
'linebreak-style': 'off', |
|||
'vue/attributes-order': 'off', |
|||
'vue/singleline-html-element-content-newline': 'off', |
|||
'vue/max-attributes-per-line': 'off', |
|||
'vue/multiline-html-element-content-newline': 'off', |
|||
'vue/html-indent': 'off', |
|||
'vue/html-closing-bracket-newline': [ |
|||
'error', |
|||
{ |
|||
singleline: 'never', |
|||
multiline: 'always', |
|||
}, |
|||
], |
|||
}, |
|||
}; |
@ -0,0 +1,8 @@ |
|||
node_modules |
|||
.DS_Store |
|||
dist |
|||
dist-ssr |
|||
*.local |
|||
.eslintcache |
|||
.idea |
|||
.vscode |
@ -0,0 +1,4 @@ |
|||
#!/bin/sh |
|||
. "$(dirname "$0")/_/husky.sh" |
|||
|
|||
npx lint-staged |
@ -0,0 +1 @@ |
|||
registry=https://registry.npm.taobao.org |
@ -0,0 +1,13 @@ |
|||
{ |
|||
"printWidth": 140, |
|||
"singleQuote": true, |
|||
"semi": true, |
|||
"trailingComma": "all", |
|||
"arrowParens": "avoid", |
|||
"tabWidth": 2, |
|||
"useTabs": false, |
|||
"bracketSpacing": true, |
|||
"jsxBracketSameLine": false, |
|||
"proseWrap": "always", |
|||
"endOfLine": "lf" |
|||
} |
@ -0,0 +1,7 @@ |
|||
# Vue 3 + Vite |
|||
|
|||
This template should help get you started developing with Vue 3 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 |
|||
|
|||
- [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar) |
@ -0,0 +1,19 @@ |
|||
const path = require('path'); |
|||
|
|||
const resolve = dir => path.join(__dirname, dir); |
|||
|
|||
module.exports = { |
|||
resolve: { |
|||
alias: { |
|||
'~': __dirname, |
|||
'@': resolve('src'), |
|||
views: resolve('src/views'), |
|||
components: resolve('src/components'), |
|||
assets: resolve('src/assets'), |
|||
utils: resolve('src/utils'), |
|||
store: resolve('src/store'), |
|||
apis: resolve('src/apis'), |
|||
config: resolve('src/config'), |
|||
}, |
|||
}, |
|||
}; |
@ -0,0 +1 @@ |
|||
module.exports = {extends: ['@commitlint/config-angular']}; |
@ -0,0 +1,14 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en"> |
|||
<head> |
|||
<meta charset="UTF-8" /> |
|||
<link rel="icon" href="/favicon.ico" /> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
|||
<title>康复游戏</title> |
|||
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/normalize/8.0.1/normalize.min.css" /> |
|||
</head> |
|||
<body> |
|||
<div id="app"></div> |
|||
<script type="module" src="/src/main.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,72 @@ |
|||
{ |
|||
"name": "vue3-vite-template", |
|||
"version": "0.0.0", |
|||
"scripts": { |
|||
"dev": "vite --mode test", |
|||
"build": "vite build --mode production", |
|||
"serve": "vite preview", |
|||
"cz": "git add . && git cz", |
|||
"format": "prettier --write ./src", |
|||
"lint": "eslint ./src --ext .vue,.js,.ts", |
|||
"fix": "eslint --fix ./src --ext .vue,.js,.ts", |
|||
"prepare": "husky install" |
|||
}, |
|||
"dependencies": { |
|||
"@vitejs/plugin-vue": "^1.9.3", |
|||
"axios": "^0.23.0", |
|||
"dayjs": "^1.10.7", |
|||
"echarts": "^5.2.2", |
|||
"echarts-gl": "^2.0.8", |
|||
"element-plus": "^1.1.0-beta.24", |
|||
"lodash": "^4.17.21", |
|||
"vite": "^2.6.4", |
|||
"vite-plugin-compression": "^0.3.5", |
|||
"vite-plugin-windicss": "^1.4.11", |
|||
"vue": "^3.2.16", |
|||
"vue-router": "^4.0.12", |
|||
"vuex": "^4.0.2", |
|||
"windicss": "^3.1.9" |
|||
}, |
|||
"devDependencies": { |
|||
"@commitlint/cli": "^13.2.1", |
|||
"@commitlint/config-angular": "^13.2.0", |
|||
"commitizen": "^4.2.4", |
|||
"cz-conventional-changelog": "^3.3.0", |
|||
"eslint": "^7.32.0", |
|||
"eslint-config-airbnb-base": "^14.2.1", |
|||
"eslint-config-prettier": "^8.3.0", |
|||
"eslint-plugin-html": "^6.2.0", |
|||
"eslint-plugin-import": "^2.25.2", |
|||
"eslint-plugin-prettier": "^4.0.0", |
|||
"eslint-plugin-vue": "^7.19.1", |
|||
"husky": "^7.0.2", |
|||
"lint-staged": "^11.2.3", |
|||
"prettier": "^2.4.1", |
|||
"unplugin-vue-components": "^0.15.6", |
|||
"vite-plugin-linter": "^1.0.1", |
|||
"vite-plugin-pwa": "^0.11.6" |
|||
}, |
|||
"browserslist": [ |
|||
"Android >= 4", |
|||
"ios >= 8" |
|||
], |
|||
"config": { |
|||
"commitizen": { |
|||
"path": "./node_modules/cz-conventional-changelog" |
|||
} |
|||
}, |
|||
"lint-staged": { |
|||
"src/**/*.{js,ts,jsx,json,css,vue}": [ |
|||
"eslint --fix", |
|||
"git add" |
|||
], |
|||
"*.js": "eslint --cache --fix" |
|||
}, |
|||
"husky": { |
|||
"hooks": { |
|||
"prepare-commit-msg": "exec < /dev/tty && git cz --hook || true", |
|||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS", |
|||
"pre-commit": "lint-staged" |
|||
} |
|||
} |
|||
} |
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,96 @@ |
|||
<template> |
|||
<div class="page"> |
|||
<router-view></router-view> |
|||
</div> |
|||
</template> |
|||
|
|||
<script setup> |
|||
import { onMounted, provide } from 'vue'; |
|||
|
|||
provide('scene', 'center'); |
|||
|
|||
function setRem(html) { |
|||
html.style.fontSize = `${html.clientWidth / 1920}px`; |
|||
} |
|||
|
|||
onMounted(() => { |
|||
const html = document.documentElement; |
|||
setRem(html); |
|||
window.addEventListener( |
|||
'resize', |
|||
() => { |
|||
setRem(html); |
|||
}, |
|||
false, |
|||
); |
|||
}); |
|||
</script> |
|||
|
|||
<style> |
|||
html, |
|||
body, |
|||
#app, |
|||
.page { |
|||
height: 100%; |
|||
} |
|||
|
|||
* { |
|||
user-select: none; |
|||
} |
|||
|
|||
html { |
|||
background-size: cover; |
|||
background: url('@/assets/bg.png') no-repeat fixed center center; |
|||
overflow: hidden; |
|||
} |
|||
|
|||
.clear:after { |
|||
content: ''; |
|||
display: block; |
|||
height: 0; |
|||
visibility: hidden; |
|||
clear: both; |
|||
} |
|||
.float-left { |
|||
float: left; |
|||
} |
|||
.float-right { |
|||
float: right; |
|||
} |
|||
.absolute { |
|||
position: absolute; |
|||
} |
|||
.fixed { |
|||
position: fixed; |
|||
} |
|||
.relative { |
|||
position: relative; |
|||
} |
|||
.flex { |
|||
display: flex; |
|||
} |
|||
.flex-1 { |
|||
flex: 1; |
|||
} |
|||
.items-center { |
|||
align-items: center; |
|||
} |
|||
.justify-center { |
|||
justify-content: center; |
|||
} |
|||
.m-t { |
|||
margin-top: 10rem; |
|||
} |
|||
.m-b { |
|||
margin-bottom: 10rem; |
|||
} |
|||
.p { |
|||
padding: 10rem; |
|||
} |
|||
.p-16 { |
|||
padding: 16rem; |
|||
} |
|||
.overflow-hidden { |
|||
overflow: hidden; |
|||
} |
|||
</style> |
@ -0,0 +1,8 @@ |
|||
// noinspection SpellCheckingInspection
|
|||
|
|||
import http from 'utils/axios'; |
|||
|
|||
// 获取天气信息
|
|||
// eslint-disable-next-line import/prefer-default-export
|
|||
export const getWeather = () => |
|||
http.get('https://devapi.qweather.com/v7/weather/now?key=9764d65c999349a9b42c42a8f1052a81&location=112.48699,37.94036&lang =zh'); |
After Width: | Height: | Size: 573 B |
After Width: | Height: | Size: 1.3 MiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 73 KiB |
After Width: | Height: | Size: 95 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 9.3 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 7.7 KiB |
After Width: | Height: | Size: 8.2 KiB |
After Width: | Height: | Size: 7.8 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 75 KiB |
After Width: | Height: | Size: 832 B |
After Width: | Height: | Size: 737 B |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 841 B |
After Width: | Height: | Size: 6.7 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 927 B |
After Width: | Height: | Size: 95 KiB |
@ -0,0 +1,8 @@ |
|||
import { createApp } from 'vue'; |
|||
import App from './App.vue'; |
|||
import router from './routers/index'; |
|||
import store from './store/index'; |
|||
|
|||
const app = createApp(App); |
|||
|
|||
app.use(router).use(store).mount('#app'); |
@ -0,0 +1,20 @@ |
|||
import { createRouter, createWebHistory } from 'vue-router'; |
|||
// 还有 createWebHashHistory 和 createMemoryHistory
|
|||
|
|||
export const routes = [ |
|||
{ path: '/kangfu/game/start', name: 'Start', component: () => import('views/Index.vue') }, |
|||
{ path: '/kangfu/game/start/train', name: 'Train', component: () => import('views/TrainSiteList.vue') }, |
|||
{ path: '/kangfu/game/start/game', name: 'Game', component: () => import('views/GameList.vue') }, |
|||
]; |
|||
|
|||
const router = createRouter({ |
|||
history: createWebHistory(), |
|||
routes: [ |
|||
{ |
|||
path: '/', |
|||
redirect: '/kangfu/game/start', |
|||
}, |
|||
].concat(routes), |
|||
}); |
|||
|
|||
export default router; |
@ -0,0 +1,21 @@ |
|||
import { createStore } from 'vuex'; |
|||
|
|||
export default createStore({ |
|||
state: { modal: false, monitor: true }, |
|||
getters: {}, |
|||
mutations: { |
|||
/** |
|||
* 设置modal是否显示 |
|||
* @param state |
|||
* @param {Boolean} display |
|||
*/ |
|||
setModal(state, display) { |
|||
state.modal = display; |
|||
}, |
|||
|
|||
setMonitor(state, display) { |
|||
state.monitor = display; |
|||
}, |
|||
}, |
|||
actions: {}, |
|||
}); |
@ -0,0 +1,25 @@ |
|||
import Axios from 'axios'; |
|||
|
|||
const instance = Axios.create({ timeout: 20000 }); |
|||
|
|||
// request
|
|||
instance.interceptors.request.use( |
|||
config => { |
|||
return config; |
|||
}, |
|||
error => { |
|||
return Promise.reject(error); |
|||
}, |
|||
); |
|||
|
|||
// response
|
|||
instance.interceptors.response.use( |
|||
response => { |
|||
return response.data; |
|||
}, |
|||
error => { |
|||
return Promise.reject(error); |
|||
}, |
|||
); |
|||
|
|||
export default instance; |
@ -0,0 +1,6 @@ |
|||
import dayjs from 'dayjs'; |
|||
// require('dayjs/esm/locale/zh-cn');
|
|||
|
|||
dayjs.locale('zh-cn'); |
|||
|
|||
export default dayjs; |
@ -0,0 +1,11 @@ |
|||
<template> |
|||
游戏列表选择 |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
name: 'GameList', |
|||
}; |
|||
</script> |
|||
|
|||
<style scoped></style> |
@ -0,0 +1,11 @@ |
|||
<template> |
|||
入口页 |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
name: 'Index', |
|||
}; |
|||
</script> |
|||
|
|||
<style scoped></style> |
@ -0,0 +1,11 @@ |
|||
<template> |
|||
训练部位选择 |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
name: 'TrainSite', |
|||
}; |
|||
</script> |
|||
|
|||
<style scoped></style> |
@ -0,0 +1,37 @@ |
|||
import { defineConfig } from 'vite'; |
|||
import path from 'path'; |
|||
import vue from '@vitejs/plugin-vue'; |
|||
import viteCompression from 'vite-plugin-compression'; |
|||
import { VitePWA } from 'vite-plugin-pwa'; |
|||
|
|||
const resolve = dir => path.join(__dirname, dir); |
|||
|
|||
// https://vitejs.dev/config/
|
|||
export default defineConfig({ |
|||
base: '/kangfu/game/start/', |
|||
plugins: [vue(), VitePWA(), viteCompression()], |
|||
resolve: { |
|||
alias: { |
|||
'~': __dirname, |
|||
'@': resolve('src'), |
|||
views: resolve('src/views'), |
|||
components: resolve('src/components'), |
|||
assets: resolve('src/assets'), |
|||
utils: resolve('src/utils'), |
|||
store: resolve('src/store'), |
|||
apis: resolve('src/apis'), |
|||
config: resolve('src/config'), |
|||
}, |
|||
}, |
|||
build: { |
|||
rollupOptions: { |
|||
output: { |
|||
manualChunks(id) { |
|||
if (id.includes('node_modules')) { |
|||
return id.toString().split('node_modules/')[1].split('/')[0].toString(); |
|||
} |
|||
}, |
|||
}, |
|||
}, |
|||
}, |
|||
}); |