├── .browserslistrc
├── .gitattributes
├── .gitignore
├── README.md
├── babel.config.js
├── package-lock.json
├── package.json
├── public
├── favicon.ico
└── index.html
└── src
├── App.vue
├── assets
├── avatar.jpg
├── css
│ └── global.css
└── logo.png
├── components
├── Home.vue
├── Login.vue
├── Welcome.vue
├── goods
│ ├── Add.vue
│ ├── Cate.vue
│ ├── Edit.vue
│ ├── List.vue
│ └── Params.vue
├── order
│ ├── Order.vue
│ └── citydata.js
├── power
│ ├── Rights.vue
│ └── Roles.vue
├── report
│ └── Report.vue
└── user
│ └── Users.vue
├── main.js
├── plugins
├── axios.js
└── element.js
└── router
└── index.js
/.browserslistrc:
--------------------------------------------------------------------------------
1 | > 1%
2 | last 2 versions
3 | not dead
4 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.js linguist-language=vue
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 | # local env files
6 | .env.local
7 | .env.*.local
8 |
9 | # Log files
10 | npm-debug.log*
11 | yarn-debug.log*
12 | yarn-error.log*
13 | pnpm-debug.log*
14 |
15 | # Editor directories and files
16 | .idea
17 | .vscode
18 | *.suo
19 | *.ntvs*
20 | *.njsproj
21 | *.sln
22 | *.sw?
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # vue-shop
2 |
3 | ## Blog
4 |
5 | https://naccl.top/blog/15
6 |
7 | ## Project setup
8 |
9 | ```
10 | npm install
11 | ```
12 |
13 | ### Compiles and hot-reloads for development
14 | ```
15 | npm run serve
16 | ```
17 |
18 | ### Compiles and minifies for production
19 | ```
20 | npm run build
21 | ```
22 |
23 | ### Customize configuration
24 | See [Configuration Reference](https://cli.vuejs.org/config/).
25 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | //项目发布阶段使用的babel插件
2 | const prodPlugins = []
3 | if (process.env.NODE_ENV === 'production') {
4 | prodPlugins.push('transform-remove-console')
5 | }
6 |
7 | module.exports = {
8 | "presets": [
9 | "@vue/cli-plugin-babel/preset"
10 | ],
11 | 'plugins': [
12 | ...prodPlugins
13 | ]
14 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-shop",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "serve": "vue-cli-service serve",
7 | "build": "vue-cli-service build"
8 | },
9 | "dependencies": {
10 | "core-js": "^3.6.5",
11 | "echarts": "^4.8.0",
12 | "element-ui": "^2.4.5",
13 | "lodash": "^4.17.19",
14 | "moment": "^2.27.0",
15 | "nprogress": "^0.2.0",
16 | "vue": "^2.6.11",
17 | "vue-quill-editor": "^3.0.6",
18 | "vue-router": "^3.2.0"
19 | },
20 | "devDependencies": {
21 | "@vue/cli-plugin-babel": "~4.4.0",
22 | "@vue/cli-plugin-router": "~4.4.0",
23 | "@vue/cli-plugin-vuex": "~4.4.0",
24 | "@vue/cli-service": "~4.4.0",
25 | "axios": "^0.18.0",
26 | "babel-plugin-transform-remove-console": "^6.9.4",
27 | "less-loader": "^6.2.0",
28 | "vue-cli-plugin-axios": "0.0.4",
29 | "vue-cli-plugin-element": "^1.0.1",
30 | "vue-template-compiler": "^2.6.11"
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Naccl/vue-shop/eed28f5ad4e75ac6abf306b9569248e41a7f64e1/public/favicon.ico
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | <%= htmlWebpackPlugin.options.title %>
9 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
13 |
14 |
17 |
--------------------------------------------------------------------------------
/src/assets/avatar.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Naccl/vue-shop/eed28f5ad4e75ac6abf306b9569248e41a7f64e1/src/assets/avatar.jpg
--------------------------------------------------------------------------------
/src/assets/css/global.css:
--------------------------------------------------------------------------------
1 | html,
2 | body,
3 | #app {
4 | height: 100%;
5 | margin: 0;
6 | padding: 0;
7 | min-width: 1366px;
8 | }
9 |
10 | .el-breadcrumb {
11 | margin-bottom: 15px;
12 | }
13 |
14 | .el-card {
15 | box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15) !important;
16 | }
17 |
18 | .el-table {
19 | margin-top: 15px;
20 | margin-bottom: 15px;
21 | }
22 |
23 | .el-steps {
24 | margin: 20px 0;
25 | }
26 |
27 | .el-step__title {
28 | font-size: 14px;
29 | }
30 |
31 | .ql-editor {
32 | min-height: 300px;
33 | }
--------------------------------------------------------------------------------
/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Naccl/vue-shop/eed28f5ad4e75ac6abf306b9569248e41a7f64e1/src/assets/logo.png
--------------------------------------------------------------------------------
/src/components/Home.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |

7 |
电商后台管理系统
8 |
9 | 退出
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
20 |
21 |
22 |
23 |
24 |
25 | {{ item.authName }}
26 |
27 |
28 |
29 |
30 |
31 | {{ subItem.authName }}
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
99 |
100 |
--------------------------------------------------------------------------------
/src/components/Login.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |

7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | 登录
18 | 重置
19 |
20 |
21 |
22 |
23 |
24 |
25 |
69 |
70 |
--------------------------------------------------------------------------------
/src/components/Welcome.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Welcome
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/src/components/goods/Add.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 首页
6 | 商品管理
7 | 添加商品
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
57 | 点击上传
58 |
59 |
60 |
61 |
62 | 添加商品
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
264 |
265 |
--------------------------------------------------------------------------------
/src/components/goods/Cate.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 首页
6 | 商品管理
7 | 商品分类
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | 添加分类
16 |
17 |
18 |
19 |
20 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | 一级
55 | 二级
56 | 三级
57 |
58 |
59 |
60 |
61 | 编辑
62 |
63 | 删除
64 |
65 |
66 |
67 |
68 |
69 |
70 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 | 取 消
92 | 确 定
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | 取 消
107 | 确 定
108 |
109 |
110 |
111 |
112 |
113 |
330 |
331 |
--------------------------------------------------------------------------------
/src/components/goods/Edit.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 首页
6 | 商品管理
7 | 编辑商品
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
57 | 点击上传
58 |
59 |
60 |
61 |
62 | 编辑商品
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
273 |
274 |
--------------------------------------------------------------------------------
/src/components/goods/List.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 首页
6 | 商品管理
7 | 商品列表
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | 添加商品
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | {{ scope.row.add_time | dateFormat}}
31 |
32 |
33 |
34 | 编辑
35 |
36 | 删除
37 |
38 |
39 |
40 |
41 |
42 |
43 |
46 |
47 |
48 |
49 |
50 |
51 |
115 |
116 |
--------------------------------------------------------------------------------
/src/components/goods/Params.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 首页
6 | 商品管理
7 | 分类参数
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | 选择商品分类:
17 |
18 |
19 |
20 |
21 |
22 |
23 | 添加参数
24 |
25 |
26 |
27 |
28 | {{ item }}
29 |
30 |
32 | + New Tag
33 |
34 |
35 |
36 |
37 |
38 |
39 | 编辑
40 |
41 | 删除
42 |
43 |
44 |
45 |
46 |
47 |
48 | 添加属性
49 |
50 |
51 |
52 |
53 | {{ item }}
54 |
55 |
57 | + New Tag
58 |
59 |
60 |
61 |
62 |
63 |
64 | 编辑
65 |
66 | 删除
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 | 取 消
86 | 确 定
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 | 取 消
101 | 确 定
102 |
103 |
104 |
105 |
106 |
107 |
332 |
333 |
--------------------------------------------------------------------------------
/src/components/order/Order.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 首页
6 | 订单管理
7 | 订单列表
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | 已付款
27 | 未付款
28 |
29 |
30 |
31 |
32 | {{ scope.row.create_time | dateFormat}}
33 |
34 |
35 |
36 | 编辑
37 | 物流
38 |
39 |
40 |
41 |
42 |
43 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | 取 消
63 | 确 定
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 | {{activity.context}}
73 |
74 |
75 |
76 |
77 |
78 |
79 |
160 |
161 |
--------------------------------------------------------------------------------
/src/components/power/Rights.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 首页
6 | 权限管理
7 | 权限列表
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | 一级
20 | 二级
21 | 三级
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
58 |
59 |
--------------------------------------------------------------------------------
/src/components/power/Roles.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 首页
6 | 权限管理
7 | 角色列表
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | 添加角色
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | {{ item1.authName }}
27 |
28 |
29 |
30 |
31 |
32 |
33 | {{ item2.authName }}
34 |
35 |
36 |
37 |
38 | {{ item3.authName }}
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | 编辑
52 | 删除
53 | 分配权限
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 | 取 消
73 | 确 定
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 | 取 消
91 | 确 定
92 |
93 |
94 |
95 |
96 |
97 |
98 |
100 |
101 |
102 | 取 消
103 | 确 定
104 |
105 |
106 |
107 |
108 |
109 |
335 |
336 |
--------------------------------------------------------------------------------
/src/components/report/Report.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 首页
6 | 数据统计
7 | 数据报表
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
75 |
76 |
--------------------------------------------------------------------------------
/src/components/user/Users.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 首页
6 | 用户管理
7 | 用户列表
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 添加用户
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 | 取 消
78 | 确 定
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 | 取 消
99 | 确 定
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
当前的用户:{{ userInfo.username }}
108 |
当前的角色:{{ userInfo.role_name }}
109 |
分配新角色:
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 | 取 消
118 | 确 定
119 |
120 |
121 |
122 |
123 |
124 |
370 |
371 |
--------------------------------------------------------------------------------
/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App.vue'
3 | import router from './router'
4 | import './plugins/axios'
5 | import './plugins/element.js'
6 | import moment from "moment";
7 | import './assets/css/global.css'
8 | //富文本编辑器
9 | import VueQuillEditor from 'vue-quill-editor'
10 | import 'quill/dist/quill.core.css' // import styles
11 | import 'quill/dist/quill.snow.css' // for snow theme
12 | import 'quill/dist/quill.bubble.css' // for bubble theme
13 |
14 | //进度条
15 | import NProgress from 'nprogress'
16 | import 'nprogress/nprogress.css'
17 |
18 | axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'
19 | axios.interceptors.request.use(config => {
20 | NProgress.start()
21 | config.headers.Authorization = window.sessionStorage.getItem('token')
22 | return config
23 | })
24 | axios.interceptors.response.use(config => {
25 | NProgress.done()
26 | return config
27 | })
28 |
29 |
30 | Vue.filter('dateFormat', function (value, format = 'YYYY-MM-DD HH:mm:ss') {
31 | return moment(value).format(format)
32 | })
33 |
34 |
35 | Vue.use(VueQuillEditor)
36 |
37 |
38 | Vue.config.productionTip = false
39 |
40 | new Vue({
41 | router,
42 | render: h => h(App)
43 | }).$mount('#app')
44 |
--------------------------------------------------------------------------------
/src/plugins/axios.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | import Vue from 'vue';
4 | import axios from "axios";
5 |
6 | // Full config: https://github.com/axios/axios#request-config
7 | // axios.defaults.baseURL = process.env.baseURL || process.env.apiUrl || '';
8 | // axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
9 | // axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
10 |
11 | let config = {
12 | // baseURL: process.env.baseURL || process.env.apiUrl || ""
13 | // timeout: 60 * 1000, // Timeout
14 | // withCredentials: true, // Check cross-site Access-Control
15 | };
16 |
17 | const _axios = axios.create(config);
18 |
19 | _axios.interceptors.request.use(
20 | function(config) {
21 | // Do something before request is sent
22 | return config;
23 | },
24 | function(error) {
25 | // Do something with request error
26 | return Promise.reject(error);
27 | }
28 | );
29 |
30 | // Add a response interceptor
31 | _axios.interceptors.response.use(
32 | function(response) {
33 | // Do something with response data
34 | return response;
35 | },
36 | function(error) {
37 | // Do something with response error
38 | return Promise.reject(error);
39 | }
40 | );
41 |
42 | Plugin.install = function(Vue, options) {
43 | Vue.axios = _axios;
44 | window.axios = _axios;
45 | Object.defineProperties(Vue.prototype, {
46 | axios: {
47 | get() {
48 | return _axios;
49 | }
50 | },
51 | $axios: {
52 | get() {
53 | return _axios;
54 | }
55 | },
56 | });
57 | };
58 |
59 | Vue.use(Plugin)
60 |
61 | export default Plugin;
62 |
--------------------------------------------------------------------------------
/src/plugins/element.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Element from 'element-ui'
3 | import 'element-ui/lib/theme-chalk/index.css'
4 |
5 | Vue.use(Element)
--------------------------------------------------------------------------------
/src/router/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import VueRouter from 'vue-router'
3 | import Login from "../components/Login";
4 | import Home from "../components/Home";
5 | import Welcome from "../components/Welcome";
6 | import Users from "../components/user/Users";
7 | import Rights from "../components/power/Rights";
8 | import Roles from "../components/power/Roles";
9 | import Cate from "../components/goods/Cate";
10 | import Params from "../components/goods/Params";
11 | import GoodsList from "../components/goods/List";
12 | import GoodsAdd from "../components/goods/Add";
13 | import GoodsEdit from "../components/goods/Edit";
14 | import Order from "../components/order/Order";
15 | import Report from "../components/report/Report";
16 |
17 | Vue.use(VueRouter)
18 |
19 | const routes = [
20 | {
21 | path: '/',
22 | redirect: '/login'
23 | },
24 | {
25 | path: '/login',
26 | component: Login
27 | },
28 | {
29 | path: '/home',
30 | component: Home,
31 | redirect: '/welcome',
32 | children: [
33 | {
34 | path: '/welcome',
35 | component: Welcome
36 | },
37 | {
38 | path: '/users',
39 | component: Users
40 | },
41 | {
42 | path: '/rights',
43 | component: Rights
44 | },
45 | {
46 | path: '/roles',
47 | component: Roles
48 | },
49 | {
50 | path: '/categories',
51 | component: Cate
52 | },
53 | {
54 | path: '/params',
55 | component: Params
56 | },
57 | {
58 | path: '/goods',
59 | component: GoodsList
60 | },
61 | {
62 | path: '/goods/add',
63 | component: GoodsAdd
64 | },
65 | {
66 | path: '/goods/edit/:id',
67 | component: GoodsEdit
68 | },
69 | {
70 | path: '/orders',
71 | component: Order
72 | },
73 | {
74 | path: '/reports',
75 | component: Report
76 | }
77 | ]
78 | }
79 | // {
80 | // path: '/about',
81 | // name: 'About',
82 | // // route level code-splitting
83 | // // this generates a separate chunk (about.[hash].js) for this route
84 | // // which is lazy-loaded when the route is visited.
85 | // component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
86 | // }
87 | ]
88 |
89 | const router = new VueRouter({
90 | mode: 'history',
91 | base: process.env.BASE_URL,
92 | routes
93 | })
94 |
95 | const originalPush = VueRouter.prototype.push;
96 | VueRouter.prototype.push = function(location) {
97 | return originalPush.call(this, location).catch(err => err)
98 | }
99 |
100 | //挂载路由导航守卫
101 | router.beforeEach((to, from, next) => {
102 | // to将要访问的路径
103 | // from代表从哪个路径跳转而来
104 | // next是一个函数,表示放行
105 | // next()放行 next('/login')强制跳转
106 | if (to.path === '/login') return next()
107 | //获取token
108 | const tokenStr = window.sessionStorage.getItem('token')
109 | if (!tokenStr) return next("/login")
110 | next()
111 | })
112 |
113 |
114 | export default router
115 |
--------------------------------------------------------------------------------