commit 8c9532125bf9b9666a7cb33b8ffd1fd77d5d4e10 Author: zhang zhuo Date: Mon May 26 18:08:25 2025 +0800 init diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..2d7a8a1 --- /dev/null +++ b/.env.development @@ -0,0 +1,8 @@ +# 页面标题 +VITE_APP_TITLE=里派基础框架 + +# 开发环境配置 +VITE_APP_ENV='development' + +# 开发环境 +VITE_APP_BASE_API='/dev-api' \ No newline at end of file diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..3761888 --- /dev/null +++ b/.env.production @@ -0,0 +1,11 @@ +# 页面标题 +VITE_APP_TITLE=里派基础框架 + +# 生产环境配置 +VITE_APP_ENV='production' + +# 生产环境 +VITE_APP_BASE_API='/prod-api' + +# 是否在打包时开启压缩,支持 gzip 和 brotli +VITE_BUILD_COMPRESS=gzip \ No newline at end of file diff --git a/.env.staging b/.env.staging new file mode 100644 index 0000000..a2c5eba --- /dev/null +++ b/.env.staging @@ -0,0 +1,11 @@ +# 页面标题 +VITE_APP_TITLE=里派基础框架 + +# 生产环境配置 +VITE_APP_ENV='staging' + +# 生产环境 +VITE_APP_BASE_API='/staging-api' + +# 是否在打包时开启压缩,支持 gzip 和 brotli +VITE_BUILD_COMPRESS=gzip \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..deae0fd --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +.DS_Store +node_modules/ +dist/ +src/views/system/menu/test +npm-debug.log* +yarn-debug.log* +yarn-error.log* +**/*.log + +tests/**/coverage/ +tests/e2e/reports +selenium-debug.log + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.hbuilder + +package-lock.json +yarn.lock +vite.config.js.* \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ab19ca3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 leapy + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/index.html b/index.html new file mode 100644 index 0000000..850150a --- /dev/null +++ b/index.html @@ -0,0 +1,174 @@ + + + + + + + + %VITE_APP_TITLE% + + + + + +
+
+ +
+
%VITE_APP_TITLE%
+
+ +
+ + + + + + diff --git a/package.json b/package.json new file mode 100644 index 0000000..b81de03 --- /dev/null +++ b/package.json @@ -0,0 +1,34 @@ +{ + "name": "admin", + "version": "1.0.0", + "description": "one basic framework", + "author": "cfn", + "type": "module", + "scripts": { + "dev": "vite", + "build:prod": "vite build", + "build:stage": "vite build --mode staging", + "preview": "vite preview" + }, + "dependencies": { + "@element-plus/icons-vue": "^2.3.1", + "axios": "^1.9.0", + "crypto-js": "^4.2.0", + "element-plus": "^2.9.10", + "nprogress": "^0.2.0", + "sortablejs": "^1.15.6", + "vue": "^3.5.14", + "vue-i18n": "^12.0.0-alpha.2", + "vue-router": "^4.5.1", + "vuedraggable": "^2.24.3", + "vuex": "^4.1.0" + }, + "devDependencies": { + "@types/node": "^22.15.21", + "@vitejs/plugin-vue": "^5.2.4", + "eslint": "^9.27.0", + "sass": "^1.89.0", + "vite": "^6.3.5" + }, + "license": "MIT" +} diff --git a/public/config.ts b/public/config.ts new file mode 100644 index 0000000..e69de29 diff --git a/public/images/logo.png b/public/images/logo.png new file mode 100644 index 0000000..773d879 Binary files /dev/null and b/public/images/logo.png differ diff --git a/src/App.vue b/src/App.vue new file mode 100644 index 0000000..4d33adf --- /dev/null +++ b/src/App.vue @@ -0,0 +1,24 @@ + + + diff --git a/src/api/index.ts b/src/api/index.ts new file mode 100644 index 0000000..fc4edcb --- /dev/null +++ b/src/api/index.ts @@ -0,0 +1,8 @@ +const modules = import.meta.glob('./model/**/*.ts') // 异步加载 + +// 使用示例 +const loadModel = async (modelName: string) => { + const path = `./model/${modelName}.ts` + const module = await modules[path]() + return module.default +} \ No newline at end of file diff --git a/src/config/index.ts b/src/config/index.ts new file mode 100644 index 0000000..c7fc925 --- /dev/null +++ b/src/config/index.ts @@ -0,0 +1,4 @@ +export default { + //语言 + LANG: 'zh-cn', +} \ No newline at end of file diff --git a/src/locales/index.ts b/src/locales/index.ts new file mode 100644 index 0000000..ac597a9 --- /dev/null +++ b/src/locales/index.ts @@ -0,0 +1,29 @@ +import { createI18n } from 'vue-i18n' +import el_zh_cn from 'element-plus/dist/locale/zh-cn' +import el_en from 'element-plus/dist/locale/en' + +import config from "@/config" +import tools from '@/utils/tools' +import zh_cn from './lang/zh-cn.js' +import en from './lang/en.js' + +const messages = { + 'zh-cn': { + el: el_zh_cn, + ...zh_cn + }, + 'en': { + el: el_en, + ...en + } +} + +const i18n = createI18n({ + legacy: false, + fallbackLocale: 'zh-cn', + locale: tools.data.get("APP_LANG") || config.LANG, + globalInjection: true, + messages, +}) + +export default i18n; diff --git a/src/locales/lang/en.ts b/src/locales/lang/en.ts new file mode 100644 index 0000000..85e211a --- /dev/null +++ b/src/locales/lang/en.ts @@ -0,0 +1,6 @@ +export default { + system: { + webTitleDev: 'Property Management System (Testing)', + webTitle: 'Property Management System', + } +} \ No newline at end of file diff --git a/src/locales/lang/zh-cn.ts b/src/locales/lang/zh-cn.ts new file mode 100644 index 0000000..3a38335 --- /dev/null +++ b/src/locales/lang/zh-cn.ts @@ -0,0 +1,6 @@ +export default { + system: { + webTitleDev: '物业管理系统(测试)', + webTitle: '物业管理系统', + } +} diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 0000000..8377398 --- /dev/null +++ b/src/main.ts @@ -0,0 +1,21 @@ +import { createApp } from 'vue' +import ElementPlus from 'element-plus' +import 'element-plus/dist/index.css' +import 'element-plus/theme-chalk/display.css' +import i18n from './locales' + +// import leapy from './leapy' +// import router from './router' +// import store from './store' +import App from './App.vue' + +const app = createApp(App); + +// app.use(store); +// app.use(router); +app.use(ElementPlus); +app.use(i18n); +// app.use(leapy); + +//挂载app +app.mount('#app'); \ No newline at end of file diff --git a/src/utils/tools.ts b/src/utils/tools.ts new file mode 100644 index 0000000..d11969a --- /dev/null +++ b/src/utils/tools.ts @@ -0,0 +1,45 @@ +import CryptoJS from 'crypto-js'; + +const tools = { + data: { + set(cacheKey, data, expireIn = 0) { + let cacheValue = { + content: data, + expireIn: expireIn === 0 ? 0 : new Date().getTime() + expireIn * 1000 + } + return localStorage.setItem(cacheKey, tools.base64.encrypt(JSON.stringify(cacheValue))) + }, + get(cacheKey) { + try { + const cacheValue = JSON.parse(tools.base64.decrypt(localStorage.getItem(cacheKey))) + if (cacheValue) { + let nowTime = new Date().getTime() + if (nowTime > cacheValue.expireIn && cacheValue.expireIn !== 0) { + localStorage.removeItem(cacheKey) + return null; + } + return cacheValue.content + } + return null + } catch (err) { + return null + } + }, + remove(cacheKey) { + return localStorage.removeItem(cacheKey) + }, + clear() { + return localStorage.clear() + } + }, + base64: { + encrypt(data){ + return CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(data)) + }, + decrypt(cipher){ + return CryptoJS.enc.Base64.parse(cipher).toString(CryptoJS.enc.Utf8) + } + } +} + +export default tools \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..7ae935f --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "module": "ESNext", + "moduleResolution": "node", + "types": ["node"], + "baseUrl": "./", + "paths": { + "@/*": ["src/*"] + }, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true + } +} \ No newline at end of file diff --git a/vite-env.d.ts b/vite-env.d.ts new file mode 100644 index 0000000..ebb3c5e --- /dev/null +++ b/vite-env.d.ts @@ -0,0 +1,5 @@ +declare module "*.vue" { + import { DefineComponent } from "vue"; + const component: DefineComponent<{}, {}, any>; + export default component; +} \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..cf21991 --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,57 @@ +import {defineConfig, loadEnv} from 'vite' +import vue from '@vitejs/plugin-vue' +import * as path from 'path' + +export default defineConfig(({mode, command}) => { + const env = loadEnv(mode, process.cwd()) + const {VITE_APP_ENV} = env + return { + resolve: { + alias: { + // 设置路径 + '~': path.resolve(__dirname, './'), + // 设置别名 + '@': path.resolve(__dirname, './src'), + // 资源地址 + '@assets': path.resolve(__dirname, './src/assets') + }, + extensions: ['.ts', '.json', '.vue', '.js'] + }, + base: '/', + // vite 相关配置 + server: { + port: 8611, + host: true, + // open: true, + proxy: { + '/api': { + target: 'http://dev.api.eswhyf.cn', + changeOrigin: true, + rewrite: (p) => p.replace(/^\/api/, '') + } + } + }, + build: { + outDir: 'dist', + assetsDir: 'static', + sourcemap: true, + rollupOptions: { + output: { + manualChunks(id) { + if (id.includes('node_modules')) { + return 'vendor' + } + } + } + } + }, + plugins: [vue()], + css: { + preprocessorOptions: { + scss: { + additionalData: `@use "@/styles/variables.scss" as *;` + } + } + } + } +}) \ No newline at end of file