feat:代码分支初始化

This commit is contained in:
陈昱达
2025-02-27 15:43:42 +08:00
parent 75d2f4160a
commit 159d3dfac5
54 changed files with 458 additions and 8059 deletions

View File

@@ -1,9 +0,0 @@
[*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue}]
charset = utf-8
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf
max_line_length = 100

2
.env.development Normal file
View File

@@ -0,0 +1,2 @@
VITE_APP_BASE_URL = '/'
VITE_APP_ENV = 'development'

2
.env.production Normal file
View File

@@ -0,0 +1,2 @@
VITE_APP_BASE_URL = 'https://xx.digitalyili.com'
VITE_APP_ENV = 'prod'

2
.env.sit Normal file
View File

@@ -0,0 +1,2 @@
VITE_APP_BASE_URL = 'https://sit.xx.digitalyili.com'
VITE_APP_ENV = 'sit'

2
.env.uat Normal file
View File

@@ -0,0 +1,2 @@
VITE_APP_BASE_URL = 'https://uat.xx.digitalyili.com'
VITE_APP_ENV = 'uat'

1
.gitattributes vendored
View File

@@ -1 +0,0 @@
* text=auto eol=lf

2
.gitignore vendored
View File

@@ -18,8 +18,6 @@ coverage
/cypress/screenshots/ /cypress/screenshots/
# Editor directories and files # Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea .idea
*.suo *.suo
*.ntvs* *.ntvs*

2
.husky/pre-commit Normal file
View File

@@ -0,0 +1,2 @@
npm run stylelint
npm run lint

2
.npmrc Normal file
View File

@@ -0,0 +1,2 @@
@yl:registry=https://yldc-npm.pkg.coding.yili.com/pubrepo/npm/

View File

@@ -1,7 +0,0 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"semi": false,
"singleQuote": true,
"printWidth": 100
}

3
.vscode/extensions.json vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar"],
}

68
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,68 @@
{
"explorer.confirmDelete": false,
"editor.fontSize": 18,
"workbench.editorAssociations": {
"*.ipynb": "jupyter.notebook.ipynb"
},
"window.zoomLevel": 1,
"workbench.iconTheme": "vscode-icons",
"prettier.enable": true,
"editor.formatOnSave": false,
"javascript.format.insertSpaceBeforeFunctionParenthesis": true,
"typescript.format.insertSpaceBeforeFunctionParenthesis": true,
"prettier.singleQuote": true,
"emmet.syntaxProfiles": {
"vue-html": "html",
"vue": "html"
},
"files.associations": {
"*.html": "html",
"*.vue": "vue",
"*.ejs": "html",
"*.js": "javascript"
},
"vsicons.dontShowNewVersionMessage": true,
"autoimport.showNotifications": true,
"path-intellisense.mappings": {
"@": "${workspaceRoot}/src",
"/": "${workspaceRoot}/"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[vue]": {
"editor.defaultFormatter": "octref.vetur",
"editor.formatOnSave": true
},
"css.validate": false, //用来校验CSS文件中的语法错误和潜在的问题
"less.validate": false, //用来校验LESS文件中的语法错误和潜在的问题
"scss.validate": false, //用来校验SCSS文件中的语法错误和潜在的问题
"editor.codeActionsOnSave": { // 用于在保存文件时自动执行代码操作
"source.fixAll.eslint": "explicit", // 自动执行ESlint
"source.fixAll.stylelint": "explicit" // 自动执行stylelint
},
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"html",
"markdown",
"yaml",
"toml",
"xml",
"gql",
"graphql",
"astro",
],
"eslint.nodePath": "./node_modules/@yl/yili-fe-lint-config/node_modules", // 指定ESLint可执行文件路径
"eslint.options": { // 用于配置
"overrideConfigFile": "./node_modules/@yl/yili-fe-lint-config/eslintrc.vue3.js" //该选项指定了 ESLint 应使用的配置文件路径。此项设置会覆盖所有其他位置查找的 ESLint 配置文件。
},
"stylelint.configBasedir": "./node_modules/@yl/yili-fe-lint-config/", //该选项用于定义 Stylelint 配置文件所基于的基础目录。当您的配置文件中使用 extends、plugins 或其他引用时,这个基础目录将作为解析路径的起点
"stylelint.configFile": "./node_modules/@yl/yili-fe-lint-config/stylelintrc.js", // 该选项指定了 stylelint 应使用的配置文件路径。此项设置会覆盖所有其他位置查找的 stylelint 配置文件
"stylelint.customSyntax": "postcss-scss", // 配置stylelint使用的预处理器
"stylelint.stylelintPath": "./node_modules/@yl/yili-fe-lint-config/node_modules/stylelint", // 指定stylelint安装路径
"stylelint.validate": ["html", "css", "scss", "less", "vue"]
}

View File

@@ -1,4 +1,4 @@
#ylst-survey-h5 # vue3-template
This template should help get you started developing with Vue 3 in Vite. This template should help get you started developing with Vue 3 in Vite.
@@ -6,9 +6,13 @@ This template should help get you started developing with Vue 3 in Vite.
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur). [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
## Type Support for `.vue` Imports in TS
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.
## Customize configuration ## Customize configuration
See [Vite Configuration Reference](https://vite.dev/config/). See [Vite Configuration Reference](https://vitejs.dev/config/).
## Project Setup ## Project Setup
@@ -22,14 +26,8 @@ npm install
npm run dev npm run dev
``` ```
### Compile and Minify for Production ### Type-Check, Compile and Minify for Production
```sh ```sh
npm run build npm run build
``` ```
### Lint with [ESLint](https://eslint.org/)
```sh
npm run lint
```

9
auto-imports.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
export {}
declare global {
}

25
components.d.ts vendored Normal file
View File

@@ -0,0 +1,25 @@
/* eslint-disable */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
export {}
/* prettier-ignore */
declare module 'vue' {
export interface GlobalComponents {
ElButton: typeof import('element-plus/es')['ElButton']
ElContainer: typeof import('element-plus/es')['ElContainer']
ElHeader: typeof import('element-plus/es')['ElHeader']
ElMain: typeof import('element-plus/es')['ElMain']
HelloWorld: typeof import('./src/components/HelloWorld.vue')['default']
IconCommunity: typeof import('./src/components/icons/IconCommunity.vue')['default']
IconDocumentation: typeof import('./src/components/icons/IconDocumentation.vue')['default']
IconEcosystem: typeof import('./src/components/icons/IconEcosystem.vue')['default']
IconSupport: typeof import('./src/components/icons/IconSupport.vue')['default']
IconTooling: typeof import('./src/components/icons/IconTooling.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
TheWelcome: typeof import('./src/components/TheWelcome.vue')['default']
WelcomeItem: typeof import('./src/components/WelcomeItem.vue')['default']
}
}

19
docker/Dockerfile Normal file
View File

@@ -0,0 +1,19 @@
FROM yldc-docker.pkg.coding.yili.com/pubrepo/pubdocker/nginx:latest
# ---------------------只改此处,其它不动--------------------------
# 定义构建物目录 当前目录 ./ 为代码根目录
# ARG DIST_DIR=./dist
ARG DIST_DIR=./dist
# 定义目标相对目录访问url即为: /${URL_DIR}/index.html
ARG URL_DIR=
# ----------------------------------------------------------------
COPY ${DIST_DIR} /var/www/html/${URL_DIR}
# VUE history路由模式释放此行(无需更改内容)以更改nginx conf 的 try_files路径
RUN sed -i "s/\ \/index.html/\ \/${URL_DIR}\/index.html/g" /etc/nginx/conf.d/default.conf
# 默认不建议使用自定义nginx配置如必须使用请提前沟通
# COPY ./nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80

1
env.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
/// <reference types="vite/client" />

View File

@@ -1,19 +0,0 @@
import js from '@eslint/js'
import pluginVue from 'eslint-plugin-vue'
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'
export default [
{
name: 'app/files-to-lint',
files: ['**/*.{js,mjs,jsx,vue}'],
},
{
name: 'app/files-to-ignore',
ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**'],
},
js.configs.recommended,
...pluginVue.configs['flat/essential'],
skipFormatting,
]

View File

@@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="ch"> <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">
@@ -8,6 +8,6 @@
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
<script type="module" src="/src/main.js"></script> <script type="module" src="/src/main.ts"></script>
</body> </body>
</html> </html>

View File

@@ -1,8 +0,0 @@
{
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
}
},
"exclude": ["node_modules", "dist"]
}

7490
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,34 +1,39 @@
{ {
"name": "yl-h5", "name": "vue3-template",
"version": "0.0.0", "version": "0.0.0",
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "vite build", "build": "run-p type-check \"build-only {@}\" --",
"preview": "vite preview", "preview": "vite preview",
"lint": "eslint . --fix", "build-only": "vite build",
"format": "prettier --write src/" "prepare": "husky",
"lint": "npx eslint -c ./node_modules/@yl/yili-fe-lint-config/eslintrc.vue3.js \"src/**/*.{js,ts,tsx,vue,html}\" --fix",
"stylelint": "npx stylelint -c ./node_modules/@yl/yili-fe-lint-config/stylelintrc.js \"**/*.{css,scss,sass,less,vue,html}\" --fix"
}, },
"dependencies": { "dependencies": {
"axios": "^1.8.1", "@element-plus/icons-vue": "^2.3.1",
"vant": "^4.9.17", "element-plus": "^2.7.8",
"vue": "^3.5.13", "lodash": "^4.17.21",
"vue-router": "^4.5.0" "pinia": "^2.1.7",
"sass": "^1.77.8",
"vue": "^3.4.29",
"vue-router": "^4.3.3"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.20.0", "@tsconfig/node20": "^20.1.4",
"@vant/auto-import-resolver": "^1.3.0", "@types/node": "^20.14.5",
"@vitejs/plugin-vue": "^5.2.1", "@vitejs/plugin-vue": "^5.0.5",
"@vue/eslint-config-prettier": "^10.2.0", "@vitejs/plugin-vue-jsx": "^4.0.0",
"amfe-flexible": "^2.2.1", "@vue/tsconfig": "^0.5.1",
"eslint": "^9.20.1", "@yl/yili-fe-lint-config": "^1.0.0",
"eslint-plugin-vue": "^9.32.0", "husky": "^9.1.5",
"postcss-pxtorem": "^6.1.0", "npm-run-all2": "^6.2.0",
"prettier": "^3.5.1", "typescript": "~5.4.0",
"unplugin-auto-import": "^19.1.1", "unplugin-auto-import": "^0.18.2",
"unplugin-vue-components": "^28.4.1", "unplugin-vue-components": "^0.27.3",
"vite": "^6.1.0", "vite": "^5.3.1",
"vite-plugin-vue-devtools": "^7.7.2" "vue-tsc": "^2.0.21"
} }
} }

View File

@@ -1,11 +1,9 @@
<script setup> <script setup lang="ts">
import { RouterLink, RouterView } from 'vue-router' import Layouts from './layouts/index.vue';
</script> </script>
<template> <template>
<RouterView /> <div>
<Layouts />
</div>
</template> </template>
<style scoped>
</style>

View File

@@ -1,20 +1,16 @@
/* color palette from <https://github.com/vuejs/theme> */ /* color palette from <https://github.com/vuejs/theme> */
:root { :root {
--vt-c-white: #ffffff; --vt-c-white: #fff;
--vt-c-white-soft: #f8f8f8; --vt-c-white-soft: #f8f8f8;
--vt-c-white-mute: #f2f2f2; --vt-c-white-mute: #f2f2f2;
--vt-c-black: #181818; --vt-c-black: #181818;
--vt-c-black-soft: #222222; --vt-c-black-soft: #222;
--vt-c-black-mute: #282828; --vt-c-black-mute: #282828;
--vt-c-indigo: #2c3e50; --vt-c-indigo: #2c3e50;
--vt-c-divider-light-1: rgba(60, 60, 60, 0.29); --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-light-2: rgba(60, 60, 60, 0.12);
--vt-c-divider-dark-1: rgba(84, 84, 84, 0.65); --vt-c-divider-dark-1: rgba(84, 84, 84, 0.65);
--vt-c-divider-dark-2: rgba(84, 84, 84, 0.48); --vt-c-divider-dark-2: rgba(84, 84, 84, 0.48);
--vt-c-text-light-1: var(--vt-c-indigo); --vt-c-text-light-1: var(--vt-c-indigo);
--vt-c-text-light-2: rgba(60, 60, 60, 0.66); --vt-c-text-light-2: rgba(60, 60, 60, 0.66);
--vt-c-text-dark-1: var(--vt-c-white); --vt-c-text-dark-1: var(--vt-c-white);
@@ -26,13 +22,10 @@
--color-background: var(--vt-c-white); --color-background: var(--vt-c-white);
--color-background-soft: var(--vt-c-white-soft); --color-background-soft: var(--vt-c-white-soft);
--color-background-mute: var(--vt-c-white-mute); --color-background-mute: var(--vt-c-white-mute);
--color-border: var(--vt-c-divider-light-2); --color-border: var(--vt-c-divider-light-2);
--color-border-hover: var(--vt-c-divider-light-1); --color-border-hover: var(--vt-c-divider-light-1);
--color-heading: var(--vt-c-text-light-1); --color-heading: var(--vt-c-text-light-1);
--color-text: var(--vt-c-text-light-1); --color-text: var(--vt-c-text-light-1);
--section-gap: 160px; --section-gap: 160px;
} }
@@ -41,10 +34,8 @@
--color-background: var(--vt-c-black); --color-background: var(--vt-c-black);
--color-background-soft: var(--vt-c-black-soft); --color-background-soft: var(--vt-c-black-soft);
--color-background-mute: var(--vt-c-black-mute); --color-background-mute: var(--vt-c-black-mute);
--color-border: var(--vt-c-divider-dark-2); --color-border: var(--vt-c-divider-dark-2);
--color-border-hover: var(--vt-c-divider-dark-1); --color-border-hover: var(--vt-c-divider-dark-1);
--color-heading: var(--vt-c-text-dark-1); --color-heading: var(--vt-c-text-dark-1);
--color-text: var(--vt-c-text-dark-2); --color-text: var(--vt-c-text-dark-2);
} }
@@ -60,12 +51,9 @@
body { body {
min-height: 100vh; min-height: 100vh;
color: var(--color-text);
background: var(--color-background); background: var(--color-background);
transition: color: var(--color-text);
color 0.5s, font-size: 15px;
background-color 0.5s;
line-height: 1.6;
font-family: font-family:
Inter, Inter,
-apple-system, -apple-system,
@@ -79,7 +67,11 @@ body {
'Droid Sans', 'Droid Sans',
'Helvetica Neue', 'Helvetica Neue',
sans-serif; sans-serif;
text-rendering: optimizeLegibility; line-height: 1.6;
transition:
color 0.5s,
background-color 0.5s;
text-rendering: optimizelegibility;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }

View File

@@ -1,7 +0,0 @@
@import './base.css';
#app {
font-size: 3vw;
margin: 0 auto;
font-weight: normal;
}

View File

Before

Width:  |  Height:  |  Size: 276 B

After

Width:  |  Height:  |  Size: 276 B

15
src/assets/main.css Normal file
View File

@@ -0,0 +1,15 @@
@import './base.css';
a,
.green {
padding: 3px;
color: hsla(160deg, 100%, 37%, 1);
text-decoration: none;
transition: 0.4s;
}
@media (hover: hover) {
a:hover {
background-color: hsla(160deg, 100%, 37%, 0.2);
}
}

View File

@@ -1,37 +0,0 @@
<script setup>
defineProps({
msg: {
type: String,
required: true,
},
})
</script>
<template>
<van-button>123</van-button>
</template>
<style scoped>
h1 {
font-weight: 500;
font-size: 14px;
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>

View File

@@ -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>
Vues
<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/johnsoncodehk/volar" target="_blank" rel="noopener">Volar</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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -1,11 +0,0 @@
module.exports = {
proxyUrl: process.env.VUE_APP_BASEURL,
proxyUrlDelivery: process.env.VUE_APP_DELiVERY_BASEURL,
proxyUrlMessageCenter: process.env.VUE_APP_MESSAGE_CENTER,
baseOss: process.env.VUE_APP_BASEOSS,
loginUrl: process.env.VUE_APP_LOGIN,
socketUrl: process.env.VUE_APP_SOCKETURL,
jsonpUrl: process.env.VUE_APP_JSONPURL,
jqrUrl: process.env.VUE_APP_YQRURL,
currentMode: process.env.VUE_APP_CURRENTMODE
};

39
src/layouts/index.vue Normal file
View File

@@ -0,0 +1,39 @@
<template>
<div class="common-layout">
<el-container>
<el-header>
<nav>
<RouterLink to="/">Home</RouterLink>
<RouterLink to="/about">About</RouterLink>
</nav>
</el-header>
<el-main>
<RouterView />
</el-main>
</el-container>
</div>
</template>
<script setup>
import { RouterLink, RouterView } from 'vue-router';
</script>
<style scoped lang="scss">
.el-header, .el-footer {
background-color: #B3C0D1;
color: #333;
line-height: 60px;
text-align: center;
}
.el-main {
height: calc(100vh - 60px);
background-color: #E9EEF3;
color: #333;
text-align: center;
}
body > .el-container {
margin-bottom: 40px;
}
</style>

View File

@@ -1,11 +0,0 @@
import './assets/css/main.css'
import 'amfe-flexible'
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
const app = createApp(App)
app.use(router)
app.mount('#app')

16
src/main.ts Normal file
View File

@@ -0,0 +1,16 @@
import './assets/main.css';
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
import { createApp } from 'vue';
import { createPinia } from 'pinia';
import App from './App.vue';
import router from './router';
const app = createApp(App);
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component);
}
app.use(createPinia());
app.use(router);
app.mount('#app');

7
src/request/api/index.js Normal file
View File

@@ -0,0 +1,7 @@
import Common from './modules/common';
// 示例
const list = {
...Common
};
export default list;

View File

@@ -0,0 +1,5 @@
// 示例
export default {
// 用户登录
login: '/api/login'
};

68
src/request/index.js Normal file
View File

@@ -0,0 +1,68 @@
import axios from 'axios';
import { merge } from 'lodash-es';
import { Message } from 'element-ui';
// 正常返回
export const CODE_200 = '0';
const instance = axios.create();
const DEFAULT_OPTIONS = {
baseURL: import.meta.env.VITE_APP_BASE_URL
};
const pendingRequests = {};
const getPendingRequestsKey = (config) => {
const params = config.method === 'post' ? config.data : config.params;
const paramsString = params ? `-${JSON.stringify(params)}` : '';
return `${config.method}-${config.url}${paramsString}`;
};
instance.interceptors.request.use(
(config) => {
const key = getPendingRequestsKey(config);
if (pendingRequests[key]) {
// 如果请求已经存在,取消当前请求
return Promise.reject(new axios.Cancel('Duplicate request canceled'));
}
// 存储当前请求
pendingRequests[key] = true;
return config;
},
(error) => {
return Promise.reject(error);
}
);
instance.interceptors.response.use(
(res) => {
const key = getPendingRequestsKey(res.config);
// 请求完成,移除记录
delete pendingRequests[key];
if (res.status === 200 || res.status === 201) {
if (res.data.code === CODE_200) {
return Promise.resolve(res.data);
} else if (res.data.msg) {
Message.error(res.data.msg);
}
return Promise.reject(res.data);
} else {
return Promise.reject(res);
}
},
(err) => {
return Promise.reject(err);
}
);
export default function apiAxios(options) {
/**
* Content-Type
* form: application/x-www-form-urlencoded;charset=UTF-8
* json: application/json;charset=utf-8
* multipart: multipart/form-data
* default: application/json;charset=utf-8
*/
const axiosOptions = merge({}, DEFAULT_OPTIONS, options);
return instance(axiosOptions);
}

View File

@@ -1,15 +0,0 @@
import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
name: 'home',
component: HomeView,
},
],
})
export default router

23
src/router/index.ts Normal file
View File

@@ -0,0 +1,23 @@
import { createRouter, createWebHistory } from 'vue-router';
import HomeView from '../views/HomeView.vue';
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
name: 'home',
component: HomeView
},
{
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')
}
]
});
export default router;

View File

@@ -1,38 +0,0 @@
export const A_COMMON_GET_QUESTIONINFO = 'A_COMMON_GET_QUESTIONINFO';
export const A_COMMON_SET_QUESTIONINFO = 'A_COMMON_SET_QUESTIONINFO';
export const A_COMMON_GET_QUESSAVEPARAM = 'A_COMMON_GET_QUESSAVEPARAM';
export const A_COMMON_SET_QUESSAVEPARAM = 'A_COMMON_SET_QUESSAVEPARAM';
export const A_COMMON_GET_ACTIVEQUESTION = 'A_COMMON_GET_ACTIVEQUESTION';
export const A_COMMON_SET_ACTIVEQUESTION = 'A_COMMON_SET_ACTIVEQUESTION';
export const A_COMMON_SET_BANK_LIST = 'A_COMMON_SET_BANK_LIST';
export const A_COMMON_GET_BANK_LIST = 'A_COMMON_GET_BANK_LIST';
export const A_COMMON_GET_WEBSOCKET = 'A_COMMON_GET_WEBSOCKET';
export const A_COMMON_SET_WEBSOCKET = 'A_COMMON_SET_WEBSOCKET';
export const A_COMMON_GET_TOKEN = 'A_COMMON_GET_TOKEN';
export const A_COMMON_CLEAR_TOKEN = 'A_COMMON_CLEAR_TOKEN';
export const M_COMMON_SET_TOKEN = 'M_COMMON_SET_TOKEN';
export const M_COMMON_GET_USERINFO = 'M_COMMON_GET_USERINFO';
export const M_COMMON_SET_USERINFO = 'M_COMMON_SET_USERINFO';
export const M_COMMON_SET_SURVEY_INFO = 'M_COMMON_SET_SURVEY_INFO';
export const M_COMMON_SET_SURVEY_STATUS = 'M_COMMON_SET_SURVEY_STATUS';
export const M_COMMON_SET_SURVEY_SCENEID = 'M_COMMON_SET_SURVEY_SCENEID';
export const M_COMMON_SET_SURVEY_SCENEPARENTID = 'M_COMMON_SET_SURVEY_SCENEPARENTID';
export const M_COMMON_SET_SURVEY_NAME = 'M_COMMON_SET_SURVEY_NAME';
export const M_COMMON_SET_TOKEN_UNAUTHORIZED = 'M_COMMON_SET_TOKEN_UNAUTHORIZED';
export const GET_FILE_TYPE = 'GET_FILE_TYPE';
export const M_COMMON_SET_THEME_INFO = 'M_COMMON_SET_THEME_INFO';
export const HEADER_IMG_INFO = 'HEADER_IMG_INFO';
export const DELETET_HEME_INFO_HEADIMGURL = 'DELETET_HEME_INFO_HEADIMGURL';
export const GUIDE_SELECT_NEED = 'GUIDE_SELECT_NEED';
export const GUIDE_OTHER_NEED = 'GUIDE_OTHER_NEED';
export const ANSWER_SESSION_ID = 'ANSWER_SESSION_ID';

View File

@@ -1,20 +0,0 @@
import { createStore } from 'vuex';
// https://webpack.js.org/guides/dependency-management/#requirecontext
const modulesFiles = require.context('./modules', true, /\.js$/);
// you do not need `import app from './modules/app'`
// it will auto require all vuex module from modules file
// eslint-disable-next-line no-shadow
const modules = modulesFiles.keys().reduce((modules, modulePath) => {
// set './app.js' => 'app'
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1');
const value = modulesFiles(modulePath);
modules[moduleName] = value.default;
return modules;
}, {});
console.log('modules', modules);
export default createStore({
namespaced: true,
modules
});

12
src/stores/counter.ts Normal file
View File

@@ -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 += 1;
}
return { count, doubleCount, increment };
});

View File

@@ -1,84 +0,0 @@
import axios from 'axios';
import store from '@/store';
import router from '@/router/index';
// import { message, Modal } from 'ant-design-vue';
// import { A_COMMON_CLEAR_TOKEN } from '@store/constance/constance.common';
const { proxyUrl } = require('@/config');
const baseURL = process.env.NODE_ENV === 'production' ? proxyUrl : '/api';
// axios.defaults.withCredentials = true;
// create an axios instance
const service = axios.create({
baseURL: `${baseURL}`, // url = base url + request url
withCredentials: true, // send cookies when cross-domain requests
timeout: 30000 // request timeout
});
// request interceptor
service.interceptors.request.use(
(config) => {
if (!config.headers) {
config.headers.Accept = 'application/json';
}
config.headers.Authorization = `${localStorage.getItem('plantToken')}`;
if (!config.headers.remoteIp) {
config.baseURL += '/api';
}
config.headers.remoteIp = localStorage.getItem('plantIp') || '127.0.0.1';
// if (store.state.common.token) {
// config.headers['Login-Type'] = 'pc';
// config.headers.Authorization = `Bearer ${store.state.common.token}`;
// }
return config;
},
(error) => Promise.reject(error)
);
// response interceptor
service.interceptors.response.use(
(response) => {
if (response.status === 200 || response.status === 201 || response.status === 202 || response.status === 204) {
if (response.config.method === 'put') {
// message.success('保存中...');
}
return Promise.resolve(response.data);
}
return Promise.reject(new Error(response.message || 'Error'));
},
(error) => {
// for debug
if (error.response.status === 401) {
const query = router.currentRoute.value.query;
//关闭已弹出的所有弹框,防止弹框重叠
// Modal.destroyAll();
// store.dispatch(A_COMMON_CLEAR_TOKEN);
window.parent.postMessage(
{
code: '301',
params: {}
},
'*'
);
store.commit('common/M_COMMON_SET_TOKEN_UNAUTHORIZED', false);
} else if (error.response.status === 403) {
router.push({
path: '/error/403'
});
} else if (error.response.status === 404) {
router.push({
path: '/error/404'
});
} else if (error.response.status === 500) {
router.push({
path: '/error/500'
});
} else {
// message.error(error.response.data?.message || '服务器错误');
}
return Promise.reject(error.response);
}
);
export default service;

15
src/views/AboutView.vue Normal file
View File

@@ -0,0 +1,15 @@
<template>
<main>
<div>About</div>
<div>count: {{ count }}</div>
<div>doubleCount: {{ doubleCount }}</div>
</main>
</template>
<script setup lang="ts">
import { useCounterStore } from '@/stores/counter';
import { storeToRefs } from 'pinia';
const useCounter = useCounterStore();
const { count, doubleCount } = storeToRefs(useCounter);
</script>

View File

@@ -1,6 +1,16 @@
<script setup> <script setup lang="ts">
import { useCounterStore } from '@/stores/counter';
import { storeToRefs } from 'pinia';
const useCounter = useCounterStore();
const { count, doubleCount } = storeToRefs(useCounter);
</script> </script>
<template> <template>
<van-cell>123</van-cell> <main>
<div>Home</div>
<div>count: {{ count }}</div>
<div>doubleCount: {{ doubleCount }}</div>
<el-button @click="useCounter.increment()">累加</el-button>
</main>
</template> </template>

14
tsconfig.app.json Normal file
View File

@@ -0,0 +1,14 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
"exclude": ["src/**/__tests__/*"],
"compilerOptions": {
"composite": true,
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}

14
tsconfig.json Normal file
View File

@@ -0,0 +1,14 @@
{
"files": [],
"references": [
{
"path": "./tsconfig.node.json"
},
{
"path": "./tsconfig.app.json"
}
],
"compilerOptions": {
"types": ["element-plus/global"]
}
}

19
tsconfig.node.json Normal file
View File

@@ -0,0 +1,19 @@
{
"extends": "@tsconfig/node20/tsconfig.json",
"include": [
"vite.config.*",
"vitest.config.*",
"cypress.config.*",
"nightwatch.conf.*",
"playwright.config.*"
],
"compilerOptions": {
"composite": true,
"noEmit": true,
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"module": "ESNext",
"moduleResolution": "Bundler",
"types": ["node"]
}
}

View File

@@ -1,34 +1,32 @@
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import AutoImport from 'unplugin-auto-import/vite' import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite' import Components from 'unplugin-vue-components/vite'
import { VantResolver } from '@vant/auto-import-resolver' import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import { fileURLToPath, URL } from 'node:url'
import postCssPxToRem from 'postcss-pxtorem' // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
css: {
preprocessorOptions: {
scss: {}
}
},
plugins: [ plugins: [
vue(), vue(),
vueJsx(),
AutoImport({ AutoImport({
resolvers: [VantResolver()], resolvers: [ElementPlusResolver()],
}), }),
Components({ Components({
resolvers: [VantResolver()], resolvers: [ElementPlusResolver()],
}), }),
], ],
resolve: { resolve: {
alias: { alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)) '@': fileURLToPath(new URL('./src', import.meta.url))
} }
},
css:{
postcss:{
plugins:[
postCssPxToRem({
rootValue:37.5,
propList:['*'],
})
]
}
} }
}) })