commit 0cdde20327aca893365a244d5384727d7afc8ee5 Author: xiaowen <372193233@qq.com> Date: Mon Nov 29 09:59:56 2021 +0800 cxw-010203 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..edf91b0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +.DS_Store +node_modules +/dist +yarn.lock + + +# local env files +.env.local +.env.*.local + +# Log files +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/README.md b/README.md new file mode 100644 index 0000000..b07d320 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# ansu-business + +## Project setup +``` +yarn install +``` + +### Compiles and hot-reloads for development +``` +yarn serve +``` + +### Compiles and minifies for production +``` +yarn build +``` + +### Lints and fixes files +``` +yarn lint +``` + +### Customize configuration +See [Configuration Reference](https://cli.vuejs.org/config/). diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 0000000..e955840 --- /dev/null +++ b/babel.config.js @@ -0,0 +1,5 @@ +module.exports = { + presets: [ + '@vue/cli-plugin-babel/preset' + ] +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..132ccda --- /dev/null +++ b/package.json @@ -0,0 +1,48 @@ +{ + "name": "little-bee", + "version": "0.1.0", + "scripts": { + "serve": "vue-cli-service serve", + "build": "vue-cli-service build", + "lint": "vue-cli-service lint" + }, + "dependencies": { + "ant-design-vue": "^1.7.8", + "axios": "^0.24.0", + "core-js": "^3.6.5", + "less": "^4.1.2", + "less-loader": "5.0.0", + "nprogress": "^0.2.0", + "vue": "^2.6.11", + "vue-router": "^3.5.3", + "vuex": "^3.6.2" + }, + "devDependencies": { + "@vue/cli-plugin-babel": "~4.5.0", + "@vue/cli-plugin-eslint": "~4.5.0", + "@vue/cli-service": "~4.5.0", + "babel-eslint": "^10.1.0", + "eslint": "^6.7.2", + "eslint-plugin-vue": "^6.2.2", + "vue-template-compiler": "^2.6.11" + }, + "eslintConfig": { + "root": true, + "env": { + "node": true + }, + "extends": [ + "plugin:vue/essential", + "eslint:recommended" + ], + "parserOptions": { + "parser": "babel-eslint" + }, + "rules": {} + }, + "browserslist": [ + "> 1%", + "last 2 versions", + "not dead" + ] +} diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..df36fcf Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..3e5a139 --- /dev/null +++ b/public/index.html @@ -0,0 +1,17 @@ + + + + + + + + <%= htmlWebpackPlugin.options.title %> + + + +
+ + + diff --git a/src/App.vue b/src/App.vue new file mode 100644 index 0000000..a530f12 --- /dev/null +++ b/src/App.vue @@ -0,0 +1,44 @@ + + + + + + diff --git a/src/assets/images/logo.png b/src/assets/images/logo.png new file mode 100644 index 0000000..ad01042 Binary files /dev/null and b/src/assets/images/logo.png differ diff --git a/src/assets/logo.png b/src/assets/logo.png new file mode 100644 index 0000000..f3d2503 Binary files /dev/null and b/src/assets/logo.png differ diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue new file mode 100644 index 0000000..879051a --- /dev/null +++ b/src/components/HelloWorld.vue @@ -0,0 +1,58 @@ + + + + + + diff --git a/src/main.js b/src/main.js new file mode 100644 index 0000000..52a96e4 --- /dev/null +++ b/src/main.js @@ -0,0 +1,25 @@ +/* + * @Author: your name + * @Date: 2021-11-18 17:15:53 + * @LastEditTime: 2021-11-22 15:40:15 + * @LastEditors: Please set LastEditors + * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + * @FilePath: /ansu-business/src/main.js + */ +import Vue from 'vue' +import App from './App.vue' +import './styles/index.less'; +import mixins from "@/mixins" +import Antd from 'ant-design-vue'; +import 'ant-design-vue/dist/antd.css'; +Vue.use(Antd); +Vue.use(mixins); +import store from "@/store"; +import router from "@/permission"; +Vue.config.productionTip = false + +new Vue({ + render: h => h(App), + router, + store +}).$mount('#app') diff --git a/src/mixins/index.js b/src/mixins/index.js new file mode 100644 index 0000000..1dec06b --- /dev/null +++ b/src/mixins/index.js @@ -0,0 +1,22 @@ +/* + * @Author: your name + * @Date: 2021-11-22 15:34:24 + * @LastEditTime: 2021-11-22 15:48:02 + * @LastEditors: Please set LastEditors + * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + * @FilePath: /ansu-business/src/mixins/index.js + */ +import { mapGetters, mapActions } from "vuex"; + +export default { + install(Vue) { + Vue.mixin({ + computed: { + ...mapGetters(['getSelectedKeys', 'getOpenKeys']) + }, + methods: { + ...mapActions(['setSelectedKeys', 'setOpenKeys']) + } + }) + } +} diff --git a/src/permission.js b/src/permission.js new file mode 100644 index 0000000..f83558e --- /dev/null +++ b/src/permission.js @@ -0,0 +1,22 @@ +/* + * @Author: your name + * @Date: 2021-11-18 17:34:50 + * @LastEditTime: 2021-11-18 17:37:15 + * @LastEditors: Please set LastEditors + * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + * @FilePath: /ansu-business/src/permission.js + */ +import NProgress from "nprogress" +import "nprogress/nprogress.css" +import router from "@/router" + +router.beforeEach((to, from, next) => { + NProgress.start() + next(); +}) + +router.afterEach(() => { + NProgress.done() +}) + +export default router \ No newline at end of file diff --git a/src/request/index.js b/src/request/index.js new file mode 100644 index 0000000..b3fbcf0 --- /dev/null +++ b/src/request/index.js @@ -0,0 +1,87 @@ +/* + * @Author: your name + * @Date: 2021-10-13 09:28:02 + * @LastEditTime: 2021-11-11 10:45:00 + * @LastEditors: Please set LastEditors + * @Description: In User Settings Edit + * @FilePath: /data-show/src/request/index.js + */ +import axios from 'axios'; +import qs from 'qs'; +import router from "@/permission" +import { message} from 'ant-design-vue' +function filterRequestData(obj) { + let o = {}; + for(let key in obj) { + let b1 = obj[key] === 0; + let b2 = obj[key] === false; + if(obj[key] || b1 || b2) { + o[key] = obj[key] + } + } + return o; +} +//创建axios的实例 +const httpService = axios.create({ + baseURL: 'http://cloud.sws010.com',// TODO:具体的配置可以根据项目情况而来 + timeout: 5000 +}) + +//axios的拦截--request +httpService.interceptors.request.use(config => { + // 请求成功处理 + // if(localStorage.getItem('token')){//判断浏览器中的cookie中是否存在项目的token + // config.headers.token = localStorage.getItem('token') + // } + const rqParams = filterRequestData(config.params); + const rqData = filterRequestData(config.data); + // post 'Content-Type' === 'application/x-www-form-urlencoded' + config.headers['Content-Type'] = 'application/x-www-form-urlencoded' + if(config.method === 'post') { + config.data = qs.stringify(rqData); + } else { + config.data = rqData; + config.params = rqParams; + } + return config; +},err => { + Promise.reject(err);// 请求错误处理 +}) + +//4、axios的拦截--response +httpService.interceptors.response.use(response => { + // TODO:具体的code对应的处理可继续添加修改 + let data = null; + let data1 = null; + let msg = ''; + let res = response.data; + let totalNum = 0; + if(res.Code == 1){ + data = res.Data || []; + data1 = res.Data1 || []; + msg = res.Msg || ""; + totalNum = res.totalNum || 0; + return {data,data1, msg, totalNum}; + } else { + msg = res.Msg || ""; + message.error(msg); + return Promise.reject(new Error(msg)) + } +},err => { + // TODO:具体的code对应的处理可继续添加修改 + if(err.response.Code === 301){ + //登录过期跳转登录页面,并将要浏览的页面fullPath传过去,登录成功后跳转需要访问的页面 ---主页(index) 或者 退出到登录前的浏览的页面 + //这样登录页面登录接口成功之后可以进行跳转 主页(index) 或者 退出到登录前的页面: let path = this.$route.query.redirect || '/index.js'; this.$router.push(path); + setTimeout(() => { + router.replace({ + path: '/login', + query: { + redirect: router.currentRoute.fullPath + } + }); + }, 1000); + } + return Promise.reject(err); +}) + +export default httpService \ No newline at end of file diff --git a/src/router/basic.js b/src/router/basic.js new file mode 100644 index 0000000..efdfb8e --- /dev/null +++ b/src/router/basic.js @@ -0,0 +1,20 @@ +/* + * @Author: your name + * @Date: 2021-11-24 14:45:04 + * @LastEditTime: 2021-11-29 09:54:17 + * @LastEditors: Please set LastEditors + * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + * @FilePath: /LittleBeeSaas/src/router/basic.js + */ +export default [ + { + path: '/Basic/Console', + name: "Console", + title: "控制台", + hide: false, + icon: 'container', + component: resolve => require(['@/views/Basic/Console'], resolve), + meta: {title: '控制台'} + } + +] \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js new file mode 100644 index 0000000..1168c54 --- /dev/null +++ b/src/router/index.js @@ -0,0 +1,41 @@ +/* + * @Author: your name + * @Date: 2021-11-18 17:30:38 + * @LastEditTime: 2021-11-29 09:52:34 + * @LastEditors: Please set LastEditors + * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + * @FilePath: /ansu-business/src/router/index.js + */ +import Vue from 'vue' +import Router from "vue-router" +const originalPush = Router.prototype.push + +Router.prototype.push = function push(location) { + return originalPush.call(this, location).catch(err => err) +} +Vue.use(Router); + +import Layout from "@/views/Layout" +import basic from "./basic" // 基础功能 + +const router = [ + { + path: "/", + name: "Layout", + title: "外框", + component: Layout, + redirect: '/Basic/Console', + meta: {title: '首页'}, + children: [...basic] + }, + { + path: "/login", + name: "Login", + title: "登录", + component: resolve => require(['@/views/Login'], resolve) + } +] + +export default new Router({ + routes: router +}) \ No newline at end of file diff --git a/src/store/actions.js b/src/store/actions.js new file mode 100644 index 0000000..50313d2 --- /dev/null +++ b/src/store/actions.js @@ -0,0 +1,18 @@ +/* + * @Author: your name + * @Date: 2021-11-18 17:22:21 + * @LastEditTime: 2021-11-22 15:45:24 + * @LastEditors: Please set LastEditors + * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + * @FilePath: /ansu-business/src/store/actions.js + */ +const actions = { + setSelectedKeys: ({commit}, log) => { + commit('setSelectedKeys', log) + }, + setOpenKeys: ({commit}, log) => { + commit('setOpenKeys', log) + }, +} + +export default actions \ No newline at end of file diff --git a/src/store/getters.js b/src/store/getters.js new file mode 100644 index 0000000..1418396 --- /dev/null +++ b/src/store/getters.js @@ -0,0 +1,18 @@ +/* + * @Author: your name + * @Date: 2021-11-18 17:23:13 + * @LastEditTime: 2021-11-22 15:46:49 + * @LastEditors: Please set LastEditors + * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + * @FilePath: /ansu-business/src/store/getters.js + */ +const getters = { + getSelectedKeys(state) { + return state.selectedKeys + }, + getOpenKeys(state) { + return state.openKeys + } +} + +export default getters \ No newline at end of file diff --git a/src/store/index.js b/src/store/index.js new file mode 100644 index 0000000..57af910 --- /dev/null +++ b/src/store/index.js @@ -0,0 +1,23 @@ +/* + * @Author: your name + * @Date: 2021-10-12 13:43:03 + * @LastEditTime: 2021-10-12 13:48:24 + * @LastEditors: Please set LastEditors + * @Description: In User Settings Edit + * @FilePath: /data-show/src/store/index.js + */ +import Vue from "vue"; +import Vuex from "vuex"; +Vue.use(Vuex); + +import actions from "./actions"; +import mutations from "./mutations"; +import getters from "./getters"; +import state from "./state"; + const store = new Vuex.Store({ + state, + actions, + mutations, + getters +}) +export default store diff --git a/src/store/mutations.js b/src/store/mutations.js new file mode 100644 index 0000000..39faf80 --- /dev/null +++ b/src/store/mutations.js @@ -0,0 +1,22 @@ +/* + * @Author: your name + * @Date: 2021-11-18 17:21:16 + * @LastEditTime: 2021-11-22 15:45:53 + * @LastEditors: Please set LastEditors + * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + * @FilePath: /ansu-business/src/store/mutations.js + */ +const mutations = { + setSelectedKeys: (state, log) => { + state.selectedKeys = log; + let str = JSON.stringify(log); + sessionStorage.setItem('selectedKeys', str); + }, + setOpenKeys: (state, log) => { + state.openKeys = log; + let str = JSON.stringify(log); + sessionStorage.setItem('openKeys', str); + }, +} + +export default mutations \ No newline at end of file diff --git a/src/store/state.js b/src/store/state.js new file mode 100644 index 0000000..c16ee50 --- /dev/null +++ b/src/store/state.js @@ -0,0 +1,13 @@ +/* + * @Author: your name + * @Date: 2021-11-18 17:21:01 + * @LastEditTime: 2021-11-22 15:44:58 + * @LastEditors: Please set LastEditors + * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + * @FilePath: /ansu-business/src/store/state.js + */ +const state = { + selectedKeys: JSON.parse(sessionStorage.getItem('selectedKeys')) || ['/'], + openKeys: JSON.parse(sessionStorage.getItem('openKeys')) || [] +} +export default state \ No newline at end of file diff --git a/src/styles/antd.less b/src/styles/antd.less new file mode 100644 index 0000000..b6cc3b9 --- /dev/null +++ b/src/styles/antd.less @@ -0,0 +1,61 @@ +.ant-layout { + width: 100% !important; + height: 100% !important; +} +.ant-layout-sider-children { + background-color: #2a334f; +} +.ant-layout-header { + display: flex !important; + justify-content: space-between !important; + line-height: 1 !important; +} +.ant-menu { + background: #2a334f !important; +} +.ant-menu-inline { + border-right: 1px solid transparent !important; +} +.ant-menu-inline-collapsed { + border-right: 1px solid transparent !important; +} +.ant-menu-inline > .ant-menu-item { + color: #fff; +} +.ant-menu:not(.ant-menu-horizontal) .ant-menu-item-selected { + color: #1990fe; +} +.ant-menu-inline > .ant-menu-submenu > .ant-menu-submenu-title { + color: #fff; +} +.ant-menu-submenu-inline > .ant-menu-submenu-title .ant-menu-submenu-arrow::before { + background-image: linear-gradient(to right, rgba(247, 249, 251, 1), rgba(247, 249, 251, 1)) !important; +} +.ant-menu-submenu-inline > .ant-menu-submenu-title .ant-menu-submenu-arrow::after { + background-image: linear-gradient(to right, rgba(247, 249, 251, 1), rgba(247, 249, 251, 1)) !important; +} +.ant-menu-inline-collapsed > .ant-menu-submenu > .ant-menu-submenu-title { + color: #fff !important; +} +.ant-menu:not(.ant-menu-horizontal) .ant-menu-item-selected .anticon { + color: #1990fe !important; +} +.ant-menu-inline-collapsed > .ant-menu-item { + color: #fff !important; +} +.ant-menu-inline-collapsed > .ant-menu-item .anticon { + color: #fff !important; +} +.ant-menu-inline-collapsed > .ant-menu-submenu-selected { + color: #1990fe !important; +} +.ant-menu-vertical > .ant-menu-item { + color: #fff !important; +} +.ant-menu:not(.ant-menu-horizontal) .ant-menu-item-selected { + color: #1990fe !important; +} + +.ant-menu-inline-collapsed .ant-menu-submenu-selected .ant-menu-submenu-title{ + color: #1990fe !important; +} \ No newline at end of file diff --git a/src/styles/index.less b/src/styles/index.less new file mode 100644 index 0000000..f543c71 --- /dev/null +++ b/src/styles/index.less @@ -0,0 +1 @@ +@import "./antd.less"; diff --git a/src/views/Basic/Console/index.vue b/src/views/Basic/Console/index.vue new file mode 100644 index 0000000..51caa14 --- /dev/null +++ b/src/views/Basic/Console/index.vue @@ -0,0 +1,23 @@ + + + + + + diff --git a/src/views/Layout/index.vue b/src/views/Layout/index.vue new file mode 100644 index 0000000..5c2729e --- /dev/null +++ b/src/views/Layout/index.vue @@ -0,0 +1,171 @@ + + + + \ No newline at end of file diff --git a/src/views/Layout/ost.js b/src/views/Layout/ost.js new file mode 100644 index 0000000..c610b3e --- /dev/null +++ b/src/views/Layout/ost.js @@ -0,0 +1,47 @@ +/* + * @Author: your name + * @Date: 2021-11-22 11:18:57 + * @LastEditTime: 2021-11-22 15:04:35 + * @LastEditors: Please set LastEditors + * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + * @FilePath: /ansu-business/src/views/Layout/ost.js + */ + +export default [ + { + key: '1', + title: '信息管理', + path: '/info', + }, + { + key: '2', + title: '用户管理', + path: '/user', + children: [ + { + key: '2.1', + title: '后台用户', + path: '/adminUser', + children: [ + { + key: '2.1.1', + title: '新增用户', + path: '/addAdminUser', + children: [ + { + key: '2.1.1。1', + title: '用户xx', + path: '/addAdminUserXX', + } + ] + } + ] + }, + { + key: '2.2', + title: '前台用户', + path: '/frontUser', + } + ] + }, +] diff --git a/src/views/Layout/yMenu/index.vue b/src/views/Layout/yMenu/index.vue new file mode 100644 index 0000000..fd227b1 --- /dev/null +++ b/src/views/Layout/yMenu/index.vue @@ -0,0 +1,153 @@ + + + + + + \ No newline at end of file diff --git a/src/views/Login/index.vue b/src/views/Login/index.vue new file mode 100644 index 0000000..0955f23 --- /dev/null +++ b/src/views/Login/index.vue @@ -0,0 +1,23 @@ + + + + + + diff --git a/vue.config.js b/vue.config.js new file mode 100644 index 0000000..5ae8391 --- /dev/null +++ b/vue.config.js @@ -0,0 +1,15 @@ +/* + * @Author: your name + * @Date: 2021-11-22 14:33:50 + * @LastEditTime: 2021-11-22 14:34:52 + * @LastEditors: Please set LastEditors + * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + * @FilePath: /ansu-business/vue.config.js + */ +module.exports = { + // ... + runtimeCompiler: true, + + + // ... + }; \ No newline at end of file