Browse Source

代码上传

guhongwei324 2 months ago
commit
d41021e650
27 changed files with 3732 additions and 0 deletions
  1. 6 0
      .editorconfig
  2. 4 0
      .env.dev
  3. 5 0
      .env.prod
  4. 30 0
      .gitignore
  5. 7 0
      .prettierrc.json
  6. 8 0
      .vscode/extensions.json
  7. 39 0
      README.md
  8. 1 0
      env.d.ts
  9. 19 0
      eslint.config.js
  10. 13 0
      index.html
  11. 43 0
      package.json
  12. 3222 0
      pnpm-lock.yaml
  13. BIN
      public/favicon.ico
  14. BIN
      public/test/bg2.gif
  15. 26 0
      src/App.vue
  16. 84 0
      src/assets/base.css
  17. BIN
      src/assets/home.png
  18. 1 0
      src/assets/main.css
  19. 23 0
      src/main.ts
  20. 5 0
      src/permission.ts
  21. 15 0
      src/router/index.ts
  22. 12 0
      src/stores/counter.ts
  23. 42 0
      src/views/honmeIndex.vue
  24. 13 0
      tsconfig.app.json
  25. 11 0
      tsconfig.json
  26. 19 0
      tsconfig.node.json
  27. 84 0
      vite.config.ts

+ 6 - 0
.editorconfig

@@ -0,0 +1,6 @@
+[*.{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

+ 4 - 0
.env.dev

@@ -0,0 +1,4 @@
+# 开发环境
+NODE_ENV=production
+# 请求路径
+VITE_BASE_URL='http://localhost:9000'

+ 5 - 0
.env.prod

@@ -0,0 +1,5 @@
+# 生产环境:只在打包时使用
+NODE_ENV=production
+
+# 请求路径
+VITE_BASE_URL='http://localhost:9000'

+ 30 - 0
.gitignore

@@ -0,0 +1,30 @@
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+lerna-debug.log*
+
+node_modules
+.DS_Store
+dist
+dist-ssr
+coverage
+*.local
+
+/cypress/videos/
+/cypress/screenshots/
+
+# Editor directories and files
+.vscode/*
+!.vscode/extensions.json
+.idea
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw?
+
+*.tsbuildinfo

+ 7 - 0
.prettierrc.json

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

+ 8 - 0
.vscode/extensions.json

@@ -0,0 +1,8 @@
+{
+  "recommendations": [
+    "Vue.volar",
+    "dbaeumer.vscode-eslint",
+    "EditorConfig.EditorConfig",
+    "esbenp.prettier-vscode"
+  ]
+}

+ 39 - 0
README.md

@@ -0,0 +1,39 @@
+# vue3Template
+
+This template should help get you started developing with Vue 3 in Vite.
+
+## Recommended IDE Setup
+
+[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
+
+## 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
+
+See [Vite Configuration Reference](https://vite.dev/config/).
+
+## Project Setup
+
+```sh
+npm install
+```
+
+### Compile and Hot-Reload for Development
+
+```sh
+npm run dev
+```
+
+### Type-Check, Compile and Minify for Production
+
+```sh
+npm run build
+```
+
+### Lint with [ESLint](https://eslint.org/)
+
+```sh
+npm run lint
+```

+ 1 - 0
env.d.ts

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

+ 19 - 0
eslint.config.js

@@ -0,0 +1,19 @@
+import pluginVue from 'eslint-plugin-vue'
+import vueTsEslintConfig from '@vue/eslint-config-typescript'
+import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'
+
+export default [
+  {
+    name: 'app/files-to-lint',
+    files: ['**/*.{ts,mts,tsx,vue}'],
+  },
+
+  {
+    name: 'app/files-to-ignore',
+    ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**'],
+  },
+
+  ...pluginVue.configs['flat/essential'],
+  ...vueTsEslintConfig(),
+  skipFormatting,
+]

+ 13 - 0
index.html

@@ -0,0 +1,13 @@
+<!doctype html>
+<html lang="">
+  <head>
+    <meta charset="UTF-8" />
+    <link rel="icon" href="/favicon.ico" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <title>加载中...</title>
+  </head>
+  <body>
+    <div id="app"></div>
+    <script type="module" src="/src/main.ts"></script>
+  </body>
+</html>

+ 43 - 0
package.json

@@ -0,0 +1,43 @@
+{
+  "name": "vue3template",
+  "version": "0.0.0",
+  "private": true,
+  "type": "module",
+  "scripts": {
+    "dev": "vite --host --open",
+    "build": "run-p type-check \"build-only {@}\" --",
+    "preview": "vite preview",
+    "build-only": "vite build",
+    "type-check": "vue-tsc --build",
+    "lint": "eslint . --fix",
+    "format": "prettier --write src/"
+  },
+  "dependencies": {
+    "animate.css": "^4.1.1",
+    "axios": "^1.7.9",
+    "dayjs": "^1.11.13",
+    "element-plus": "^2.9.0",
+    "lodash-es": "^4.17.21",
+    "pinia": "^2.2.6",
+    "sass": "^1.83.0",
+    "vue": "^3.5.13",
+    "vue-router": "^4.4.5",
+    "vxe-table": "^4.6.25"
+  },
+  "devDependencies": {
+    "@tsconfig/node22": "^22.0.0",
+    "@types/node": "^22.9.3",
+    "@vitejs/plugin-vue": "^5.2.1",
+    "@vue/eslint-config-prettier": "^10.1.0",
+    "@vue/eslint-config-typescript": "^14.1.3",
+    "@vue/tsconfig": "^0.7.0",
+    "eslint": "^9.14.0",
+    "eslint-plugin-vue": "^9.30.0",
+    "npm-run-all2": "^7.0.1",
+    "prettier": "^3.3.3",
+    "typescript": "~5.6.3",
+    "vite": "^6.0.1",
+    "vite-plugin-vue-devtools": "^7.6.5",
+    "vue-tsc": "^2.1.10"
+  }
+}

File diff suppressed because it is too large
+ 3222 - 0
pnpm-lock.yaml


BIN
public/favicon.ico


BIN
public/test/bg2.gif


+ 26 - 0
src/App.vue

@@ -0,0 +1,26 @@
+<script setup lang="ts">
+import { onMounted, computed } from 'vue'
+onMounted(() => {
+  console.log(window.outerWidth);
+
+  // const userAgent = navigator.userAgent;
+  // console.log(userAgent);
+  // let deviceType = 'unknown';
+  // if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent)) {
+  //   deviceType = 'mobile';
+  // } else {
+  //   deviceType = 'desktop';
+  // }
+  // console.log('当前设备类型:', deviceType);
+})
+const width = computed(() => {
+  return window.outerWidth
+});
+</script>
+
+<template>
+  {{ width }}
+  <RouterView />
+</template>
+
+<style scoped></style>

+ 84 - 0
src/assets/base.css

@@ -0,0 +1,84 @@
+/* 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;
+  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;
+}

BIN
src/assets/home.png


+ 1 - 0
src/assets/main.css

@@ -0,0 +1 @@
+@import './base.css';

+ 23 - 0
src/main.ts

@@ -0,0 +1,23 @@
+import { createApp } from 'vue'
+import { createPinia } from 'pinia'
+
+import App from './App.vue'
+import router from './router'
+
+import './permission'
+
+import './assets/main.css'
+
+import ElementPlus from 'element-plus'
+import 'element-plus/dist/index.css'
+
+import 'animate.css'
+
+const app = createApp(App)
+
+app.use(createPinia())
+
+app.use(router)
+
+app.use(ElementPlus)
+app.mount('#app')

+ 5 - 0
src/permission.ts

@@ -0,0 +1,5 @@
+import router from './router'
+router.beforeEach(async (to, from, next) => {
+  document.title = String(to.meta.title)
+  next()
+})

+ 15 - 0
src/router/index.ts

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

+ 12 - 0
src/stores/counter.ts

@@ -0,0 +1,12 @@
+import { ref, computed } from 'vue'
+import { defineStore } from 'pinia'
+
+export const useCounterStore = defineStore('counter', () => {
+  const count = ref(0)
+  const doubleCount = computed(() => count.value * 2)
+  function increment() {
+    count.value++
+  }
+
+  return { count, doubleCount, increment }
+})

+ 42 - 0
src/views/honmeIndex.vue

@@ -0,0 +1,42 @@
+<template>
+  <div id="honmeIndex">
+    <el-row>
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
+        <el-col :span="24" class="one">
+          系统首页
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script setup lang="ts">
+defineOptions({ name: 'honmeIndex' })
+// 基础
+import type { Ref } from 'vue';
+// reactive,
+import { onMounted, ref } from 'vue';
+// 接口
+//import { TestStore } from '@common/src/stores/test';
+//import type { IQueryResult } from '@/util/types.util';
+//const testAxios = TestStore();
+// 加载中
+const loading: Ref<boolean> = ref(false);
+// 分页数据
+//  const skip = 0;
+//  const limit = 10
+
+
+// 请求
+onMounted(async () => {
+  loading.value = true;
+  //  await search({ skip, limit });
+  loading.value = false;
+});
+//const search = async (e: { skip: number; limit: number }) => {
+//  const info = { skip: e.skip, limit: e.limit, ...searchInfo.value  };
+//  const res: IQueryResult = await testAxios.query(info);
+//  console.log(res);
+//};
+</script>
+<style scoped lang="scss"></style>

+ 13 - 0
tsconfig.app.json

@@ -0,0 +1,13 @@
+{
+  "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",
+
+    "paths": {
+      "@/*": ["./src/*"]
+    }
+  }
+}

+ 11 - 0
tsconfig.json

@@ -0,0 +1,11 @@
+{
+  "files": [],
+  "references": [
+    {
+      "path": "./tsconfig.node.json"
+    },
+    {
+      "path": "./tsconfig.app.json"
+    }
+  ]
+}

+ 19 - 0
tsconfig.node.json

@@ -0,0 +1,19 @@
+{
+  "extends": "@tsconfig/node22/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"]
+  }
+}

+ 84 - 0
vite.config.ts

@@ -0,0 +1,84 @@
+import { fileURLToPath, URL } from 'node:url'
+
+import { defineConfig, loadEnv } from 'vite'
+import vue from '@vitejs/plugin-vue'
+
+// https://vite.dev/config/
+export default defineConfig(({ command, mode }) => {
+  console.log(command, mode)
+  const env = loadEnv(mode, process.cwd(), '')
+  console.log(env.NODE_ENV)
+  return {
+    /* 共享 */
+    // 根目录
+    // root:''
+    // 基础
+    // base:'',
+    // 模式 development,production
+    // mode:'',
+    // 定义全局常量
+    // define:{},
+    // 插件
+    plugins: [vue()],
+    // 普通静态资产,此目录中的文件在dev期间提供,并在build中复制到根目录,并且时钟按原样提供或复制,不进行转换  string,false
+    // publicDir: false,
+    //保存缓存文件,
+    // cacheDir: '',
+    /* 服务器 */
+    server: {
+      // 服务器主机,侦听ip地址
+      host: '0.0.0.0',
+      // 服务器端口
+      port: 8001,
+      // 端口已在使用中,設置為exit,不尝试下一个可用端口
+      // strictPort:false,
+      // 启用安全证书,@vitejs/plugin-basic-ssl ,可以自己创建并缓存签名证书,可以创建自己的证书
+      // https:{},
+      // 在服务器启动时自动在浏览器中打开应用程序。当值为字符串时,它将用作 URL 的路径名。如果你想在你喜欢的特定浏览器中打开服务器
+      // open:''
+      // 服务器
+      // proxy: {
+      // ['/api']: {
+      // target: 'http',
+      // ws: false,
+      // changeOrigin: true,
+      // rewrite: (path) => path.replace(new RegExp(`^/api`), ''),
+      // },
+      // },
+      // 为开发服务器配置 CORS。默认情况下,此选项处于启用状态,并允许任何源。
+      // cors:false,
+      // 指定服务器响应标头
+      // headers:'',
+    },
+    /* 构建选项 */
+    build: {
+      // 最终捆绑包的浏览器兼容性目标。默认值是 Vite 特殊值
+      // target:'',
+      // 预加载
+      // module:'',
+      // 是否自动注入模块预加载polyfill
+      // polyfillModule:false,
+      // 指定输出目录
+      // outDir:'',
+      // 指定要将生产厂的资产签到在
+      // assets: '',
+      // 小于此阈值的导入或引用的资源将被内联为 base64 URL,以避免额外的 http 请求。设置为 可完全禁用内联。
+      // assetsInlineLimit:0,
+      // 启用/禁用 CSS 代码拆分。启用后,在异步 JS 块中导入的 CSS 将保留为块,并在提取块时一起提取。
+      // cssCodeSplit:false,
+      // 此选项允许用户为 CSS 缩小设置与用于 JavaScript 转译的目标不同的浏览器目标
+      // cssTarget:'',
+      // 此选项允许用户专门覆盖 CSS 缩小,而不是默认为 ,因此您可以分别为 JS 和 CSS 配置缩小
+      // cssMinify:false,
+      // 生成生产源映射。如果 ,将创建一个单独的 sourcemap 文件。如果 ,则 sourcemap 将作为数据 URI 附加到生成的输出文件中。 除了捆绑文件中相应的 SourceMap 注释被禁止显示之外,其工作方式与此类似
+      // source:false,
+      // 直接自定义底层 Rollup bundle。这与可以从 Rollup 配置文件导出的选项相同,并且将与 Vite 的内部 Rollup 选项合并
+      // rollup:{},
+    },
+    resolve: {
+      alias: {
+        '@': fileURLToPath(new URL('./src', import.meta.url)),
+      },
+    },
+  }
+})