commit 8a0801b2ab3a50bfcc884df1e8cff3c625c27adc Author: aaron <> Date: Sat Mar 8 20:28:16 2025 +0800 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2a867d2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,73 @@ +# 依赖包 +/node_modules +/.pnp +.pnp.js + +# 构建输出 +/dist +/build + +# 测试覆盖率 +/coverage + +# 本地环境文件 +.env.local +.env.*.local + +# 日志文件 +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +logs +*.log + +# 编辑器目录和文件 +.idea +.vscode/* +!.vscode/extensions.json +!.vscode/settings.json +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? +.DS_Store +Thumbs.db + +# 缓存文件 +.cache +.npm +.eslintcache +.stylelintcache +.temp +.cache-loader + +# 临时文件 +.tmp +temp +tmp + +# 打包文件 +*.tgz +*.tar.gz +*.zip + +# 自动生成的文件 +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +desktop.ini + +# 本地配置文件 +.env +.env.development +.env.test +.env.production + +# 其他 +.history +.sass-cache \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..368cd4c --- /dev/null +++ b/README.md @@ -0,0 +1,69 @@ +# 蜂快·运营商平台 + +基于Vue 3和Ant Design Vue的蜂快·运营商平台。 + +## 功能特点 + +- 基于Vue 3、Vuex 4和Vue Router 4 +- 使用Ant Design Vue 3作为UI组件库 +- 响应式布局,适配不同屏幕尺寸 +- 包含常见的后台功能模块: + - 用户管理 + - 系统设置 + - 仪表盘数据展示 + +## 开发环境 + +- Node.js >= 18.0.0 +- npm >= 8.6.0 + +## 安装与运行 + +1. 安装依赖 + +```bash +npm install +``` + +2. 开发模式运行 + +```bash +npm run dev +``` + +3. 构建生产版本 + +```bash +npm run build +``` + +## 项目结构 + +``` +├── public/ # 静态资源 +├── src/ # 源代码 +│ ├── assets/ # 资源文件 +│ ├── components/ # 公共组件 +│ ├── layouts/ # 布局组件 +│ ├── router/ # 路由配置 +│ ├── store/ # Vuex存储 +│ ├── utils/ # 工具函数 +│ ├── views/ # 页面组件 +│ ├── App.vue # 根组件 +│ └── main.js # 入口文件 +├── .babelrc # Babel配置 +├── package.json # 项目依赖 +├── webpack.config.js # Webpack配置 +└── README.md # 项目说明 +``` + +## 登录信息 + +默认用户名和密码: + +- 用户名:admin +- 密码:admin123 + +## 许可证 + +ISC \ No newline at end of file diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 0000000..cdefadf --- /dev/null +++ b/babel.config.js @@ -0,0 +1,5 @@ +module.exports = { + presets: [ + '@babel/preset-env' + ] +}; \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..00ccda2 --- /dev/null +++ b/package.json @@ -0,0 +1,39 @@ +{ + "name": "partner-admin", + "version": "1.0.0", + "description": "基于Ant Design Vue的蜂快·运营商平台", + "main": "index.js", + "scripts": { + "dev": "webpack serve --mode development", + "build": "webpack --mode production", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [ + "vue", + "ant-design-vue", + "admin", + "dashboard" + ], + "author": "", + "license": "ISC", + "dependencies": { + "ant-design-vue": "^3.0.0", + "axios": "^1.6.0", + "vue": "^3.0.0", + "vue-router": "^4.0.0", + "vuex": "^4.0.0" + }, + "devDependencies": { + "@babel/core": "^7.0.0", + "@babel/preset-env": "^7.0.0", + "@vue/compiler-sfc": "^3.0.0", + "babel-loader": "^10.0.0", + "css-loader": "^7.1.2", + "html-webpack-plugin": "^5.0.0", + "style-loader": "^4.0.0", + "vue-loader": "^17.0.0", + "webpack": "^5.0.0", + "webpack-cli": "^6.0.1", + "webpack-dev-server": "^5.2.0" + } +} diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..a5da4fa --- /dev/null +++ b/public/index.html @@ -0,0 +1,12 @@ + + + + + + 蜂快·运营商平台 + + + +
+ + \ No newline at end of file diff --git a/src/App.vue b/src/App.vue new file mode 100644 index 0000000..6b82631 --- /dev/null +++ b/src/App.vue @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/src/assets/logo.png b/src/assets/logo.png new file mode 100644 index 0000000..d77e852 Binary files /dev/null and b/src/assets/logo.png differ diff --git a/src/assets/sub_logo.png b/src/assets/sub_logo.png new file mode 100644 index 0000000..ca7f4df Binary files /dev/null and b/src/assets/sub_logo.png differ diff --git a/src/layouts/AdminLayout.vue b/src/layouts/AdminLayout.vue new file mode 100644 index 0000000..af96641 --- /dev/null +++ b/src/layouts/AdminLayout.vue @@ -0,0 +1,141 @@ + + + + + \ No newline at end of file diff --git a/src/main.js b/src/main.js new file mode 100644 index 0000000..b80cb2d --- /dev/null +++ b/src/main.js @@ -0,0 +1,14 @@ +import { createApp } from 'vue'; +import Antd from 'ant-design-vue'; +import App from './App.vue'; +import router from './router'; +import store from './store'; +import 'ant-design-vue/dist/antd.css'; + +const app = createApp(App); + +app.use(Antd); +app.use(router); +app.use(store); + +app.mount('#app'); \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js new file mode 100644 index 0000000..8c75e87 --- /dev/null +++ b/src/router/index.js @@ -0,0 +1,54 @@ +import { createRouter, createWebHistory } from 'vue-router'; +import AdminLayout from '../layouts/AdminLayout.vue'; + +const routes = [ + { + path: '/', + component: AdminLayout, + redirect: '/dashboard', + children: [ + { + path: 'dashboard', + name: 'Dashboard', + component: () => import('../views/Dashboard.vue'), + meta: { title: '仪表盘', icon: 'dashboard' } + }, + { + path: 'user', + name: 'User', + component: () => import('../views/User.vue'), + meta: { title: '用户管理', icon: 'user' } + }, + { + path: 'settings', + name: 'Settings', + component: () => import('../views/Settings.vue'), + meta: { title: '系统设置', icon: 'setting' } + } + ] + }, + { + path: '/login', + name: 'Login', + component: () => import('../views/Login.vue') + }, + { + path: '/:pathMatch(.*)*', + name: 'NotFound', + component: () => import('../views/NotFound.vue') + } +]; + +const router = createRouter({ + history: createWebHistory(), + routes +}); + +// 路由守卫 +router.beforeEach((to, from, next) => { + // 这里可以添加身份验证逻辑 + document.title = to.meta.title ? `${to.meta.title} - 蜂快·运营商平台` : '蜂快·运营商平台'; + next(); +}); + +export default router; \ No newline at end of file diff --git a/src/store/index.js b/src/store/index.js new file mode 100644 index 0000000..e39807c --- /dev/null +++ b/src/store/index.js @@ -0,0 +1,52 @@ +import { createStore } from 'vuex'; + +export default createStore({ + state: { + user: null, + token: localStorage.getItem('token') || '', + sidebar: { + collapsed: false + } + }, + mutations: { + SET_TOKEN(state, token) { + state.token = token; + localStorage.setItem('token', token); + }, + CLEAR_TOKEN(state) { + state.token = ''; + localStorage.removeItem('token'); + }, + SET_USER(state, user) { + state.user = user; + }, + TOGGLE_SIDEBAR(state) { + state.sidebar.collapsed = !state.sidebar.collapsed; + } + }, + actions: { + login({ commit }, userInfo) { + // 这里应该有实际的登录API调用 + return new Promise((resolve) => { + // 模拟登录成功 + const token = 'mock-token-' + Date.now(); + commit('SET_TOKEN', token); + commit('SET_USER', { + name: userInfo.username, + avatar: 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png', + roles: ['admin'] + }); + resolve(); + }); + }, + logout({ commit }) { + commit('CLEAR_TOKEN'); + commit('SET_USER', null); + } + }, + getters: { + isAuthenticated: state => !!state.token, + userInfo: state => state.user, + sidebarCollapsed: state => state.sidebar.collapsed + } +}); \ No newline at end of file diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue new file mode 100644 index 0000000..2e13454 --- /dev/null +++ b/src/views/Dashboard.vue @@ -0,0 +1,145 @@ + + + + + \ No newline at end of file diff --git a/src/views/Login.vue b/src/views/Login.vue new file mode 100644 index 0000000..649a9ab --- /dev/null +++ b/src/views/Login.vue @@ -0,0 +1,280 @@ + + + + + \ No newline at end of file diff --git a/src/views/NotFound.vue b/src/views/NotFound.vue new file mode 100644 index 0000000..9f01718 --- /dev/null +++ b/src/views/NotFound.vue @@ -0,0 +1,31 @@ + + + + + \ No newline at end of file diff --git a/src/views/Settings.vue b/src/views/Settings.vue new file mode 100644 index 0000000..f0082df --- /dev/null +++ b/src/views/Settings.vue @@ -0,0 +1,253 @@ + + + + + \ No newline at end of file diff --git a/src/views/User.vue b/src/views/User.vue new file mode 100644 index 0000000..d0e5a90 --- /dev/null +++ b/src/views/User.vue @@ -0,0 +1,383 @@ + + + + + \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..86f96f3 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,54 @@ +const path = require('path'); +const { VueLoaderPlugin } = require('vue-loader'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); + +module.exports = { + mode: 'development', + entry: './src/main.js', + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'bundle.js', + publicPath: '/' + }, + module: { + rules: [ + { + test: /\.vue$/, + loader: 'vue-loader' + }, + { + test: /\.js$/, + loader: 'babel-loader', + exclude: /node_modules/ + }, + { + test: /\.css$/, + use: ['style-loader', 'css-loader'] + }, + { + test: /\.(png|jpg|gif|svg)$/, + type: 'asset/resource' + } + ] + }, + plugins: [ + new VueLoaderPlugin(), + new HtmlWebpackPlugin({ + template: './public/index.html' + }) + ], + resolve: { + extensions: ['.js', '.vue', '.json'], + alias: { + '@': path.resolve(__dirname, 'src') + } + }, + devServer: { + static: { + directory: path.join(__dirname, 'public'), + }, + historyApiFallback: true, + port: 8080, + hot: true + } +}; \ No newline at end of file