commit 1a1c3bce4aa952a0146f1a20223d4d00ceca4535 Author: wxc <191104855@qq.com> Date: Wed Jan 17 14:44:51 2024 +0800 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1debbff --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +# 编辑器 +.vscode +.idea + +.history + +node_modules + +*.mjs \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..7f7e2a2 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# 局长信箱 +## 技术栈 +- [Vite](https://www.vitejs.net/) + [Vue 3](https://cn.vuejs.org/guide/quick-start.html) + [Element-plus](https://element-plus.org/zh-CN/) +- sass +- [pinia](https://pinia.vuejs.org/zh/introduction.html) 状态管理库 +- + diff --git a/index.html b/index.html new file mode 100644 index 0000000..afd1ddf --- /dev/null +++ b/index.html @@ -0,0 +1,13 @@ + + + + + + + 局长信箱 即接即办 + + +
+ + + diff --git a/package.json b/package.json new file mode 100644 index 0000000..bccd2c9 --- /dev/null +++ b/package.json @@ -0,0 +1,25 @@ +{ + "name": "mailbox-vue", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview" + }, + "dependencies": { + "element-plus": "^2.5.1", + "pinia": "^2.1.7", + "vue": "^3.3.11", + "vue-router": "^4.2.5" + }, + "devDependencies": { + "@vitejs/plugin-vue": "^4.5.2", + "sass": "^1.69.7", + "unplugin-auto-import": "^0.17.3", + "unplugin-vue-components": "^0.26.0", + "vite": "^5.0.8", + "vite-svg-loader": "^5.1.0" + } +} diff --git a/public/imgs/bg.png b/public/imgs/bg.png new file mode 100644 index 0000000..f1a82cf Binary files /dev/null and b/public/imgs/bg.png differ diff --git a/public/vite.svg b/public/vite.svg new file mode 100644 index 0000000..e7b8dfb --- /dev/null +++ b/public/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/App.vue b/src/App.vue new file mode 100644 index 0000000..98240ae --- /dev/null +++ b/src/App.vue @@ -0,0 +1,3 @@ + diff --git a/src/assets/style/element.scss b/src/assets/style/element.scss new file mode 100644 index 0000000..9dc003e --- /dev/null +++ b/src/assets/style/element.scss @@ -0,0 +1,8 @@ +// @/styles/element/index.scss +@forward "element-plus/theme-chalk/src/common/var.scss" with ( + $colors: ( + "primary": ( + "base": #162582, + ) + ) +); \ No newline at end of file diff --git a/src/assets/style/style.scss b/src/assets/style/style.scss new file mode 100644 index 0000000..6f7692f --- /dev/null +++ b/src/assets/style/style.scss @@ -0,0 +1,211 @@ +:root:root { + --primary-color: #184DCF; + --van-blue: var(--primary-color); + --van-tabs-bottom-bar-width: 60px; + --background-color: #ededed; +} + +body { + font-size: 14px; + font-family: PingFang-SC-Heavy; + margin: 0; + --header-height: 8.377vh; +} + +#app { + margin: auto; +} + +p { + margin: 0.5em 0; +} + +svg { + width: 1em; +} + +svg+span { + margin-left: .5em; +} + +.none { + display: none; +} + +.flex { + display: flex; +} + +.flex-inline { + display: inline-flex; +} + +.flex.v-center, +.flex-inline.v-center { + align-items: center; +} + +.flex.center, +.flex-inline.center { + justify-content: center; +} + +.flex.between, +.flex-inline.between { + justify-content: space-between; +} + +.flex.end, +.flex-inline.end { + justify-content: flex-end; +} + +.flex.wrap, +.flex-inline.wrap { + flex-wrap: wrap; +} + +.flex.max-content, +.flex-inline.max-content { + width: max-content; +} + +.flex.gap, +.flex-inline.gap { + gap: 0 8px; +} + +.flex.gap-10 { + gap: 0 10px; +} + +.flex.gap-16 { + gap: 0 16px; +} + +.text-center { + text-align: center; +} + +.text-nowrap { + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} + +.text-wrap { + white-space: pre-wrap; +} + +.container { + padding: 18px 36px; +} + +.pointer:hover { + cursor: pointer; +} + +.relative { + position: relative; +} + +.ml-4 { + margin-left: 4px; +} + +.ml-8 { + margin-left: 8px; +} + +.ml-10 { + margin-left: 10px; +} + +.mr-4 { + margin-right: 4px; +} + +.mr-8 { + margin-right: 8px; +} + +.mr-10 { + margin-right: 10px; +} + +.mr-20 { + margin-right: 20px; +} + +.mt-8 { + margin-top: 8px; +} + +.mt-10 { + margin-top: 10px; +} + +.mt-20 { + margin-top: 20px; +} + +.mb-8 { + margin-bottom: 8px; +} + +.mb-10 { + margin-bottom: 10px; +} + +.mb-20 { + margin-bottom: 20px; +} + +.mb-40 { + margin-bottom: 40px; +} + + +.card { + background-color: #fff; + margin-bottom: 10px; + padding-top: 6px; + + h2 { + color: #666; + font-size: 12px; + font-weight: normal; + margin: var(--van-cell-group-inset-padding); + padding: var(--van-cell-vertical-padding) 0; + } + + header { + margin: var(--van-cell-group-inset-padding); + margin-top: 16px; + font-size: 17px; + font-weight: bold; + } + + .content { + box-shadow: inset 0px -1px 0px 0px rgba(227, 227, 227, 1); + color: #666; + margin-top: 10px; + padding: var(--van-cell-group-inset-padding); + padding-bottom: 30px; + font-size: 12px; + font-weight: 400; + } + + footer { + box-shadow: inset 0px -1px 0px 0px rgba(227, 227, 227, 1); + padding: var(--van-cell-group-inset-padding); + padding-top: 16px; + padding-bottom: 16px; + } +} + +.wrapper { + height: 100vh; + background-color: var(--background-color); + overflow: auto; +} \ No newline at end of file diff --git a/src/components/Icon.vue b/src/components/Icon.vue new file mode 100644 index 0000000..07f42e8 --- /dev/null +++ b/src/components/Icon.vue @@ -0,0 +1,29 @@ + + + \ No newline at end of file diff --git a/src/layout/Index.vue b/src/layout/Index.vue new file mode 100644 index 0000000..34be444 --- /dev/null +++ b/src/layout/Index.vue @@ -0,0 +1,90 @@ + + + \ No newline at end of file diff --git a/src/main.js b/src/main.js new file mode 100644 index 0000000..2a20798 --- /dev/null +++ b/src/main.js @@ -0,0 +1,14 @@ +import { createApp } from 'vue' +import router from './router/index' +import { createPinia } from 'pinia' + +import App from './App.vue' +import IconComponent from '@/components/Icon.vue' + +import './assets/style/style.scss' + +createApp(App) + .use(router) + .use(createPinia()) + .component('Icon', IconComponent) + .mount('#app') diff --git a/src/router/index.js b/src/router/index.js new file mode 100644 index 0000000..d74a82e --- /dev/null +++ b/src/router/index.js @@ -0,0 +1,37 @@ +import { createRouter, createWebHashHistory } from 'vue-router' + +import Home from '@/views/Home.vue' + +import Layout from '@/layout/Index.vue' + +import NotFound from '@/views/error/404.vue' + +const constantRoutes = [ + { + path: '/layout', + component: Layout, + redirect: to => { + return '/' + }, + children: [ + { + path: '/', + component: Home + } + ] + }, + { + path: '/:catchAll(.*)', + component: NotFound, + meta: { + title: '404' + } + } +]; + +const router = createRouter({ + history: createWebHashHistory(), + routes: constantRoutes +}); + +export default router; diff --git a/src/views/Home.vue b/src/views/Home.vue new file mode 100644 index 0000000..91eac47 --- /dev/null +++ b/src/views/Home.vue @@ -0,0 +1,54 @@ + + + \ No newline at end of file diff --git a/src/views/error/404.vue b/src/views/error/404.vue new file mode 100644 index 0000000..e6c7b6a --- /dev/null +++ b/src/views/error/404.vue @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 0000000..bad8d25 --- /dev/null +++ b/vite.config.js @@ -0,0 +1,54 @@ +import { defineConfig } from 'vite' +import vue from '@vitejs/plugin-vue' +import path from 'path' + +import AutoImport from 'unplugin-auto-import/vite' +import Components from 'unplugin-vue-components/vite' +import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' + +import svgLoader from 'vite-svg-loader' +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [ + vue(), + svgLoader(), + AutoImport({ + imports: [ + 'vue' + ], + resolvers: [ElementPlusResolver()], + }), + Components({ + resolvers: [ElementPlusResolver({ + importStyle: "sass" + })], + }), + ], + resolve: { + // https://cn.vitejs.dev/config/#resolve-alias + alias: { + // 设置别名 + '~/': `${path.resolve(__dirname, 'src')}/`, + '@': path.resolve(__dirname, './src/') + }, + // https://cn.vitejs.dev/config/#resolve-extensions + extensions: ['.js'] + }, + css: { + preprocessorOptions: { + scss: { + additionalData: `@use "src/assets/style/element.scss" as *;` + }, + }, + }, + server: { + host: '0.0.0.0', + proxy: { + '/api': { + target: 'http://127.0.0.1:8081', + changeOrigin: true, + rewrite: (p) => p.replace(/^\/api/, '') + } + } + } +})