Commit c44ba96f68e441edcd793a3b261d5e12a73eeabd

Authored by Adam
1 parent 3e54280cad
Exists in master

auto commit the code by alias command

... ... @@ -3,7 +3,7 @@ ENV = 'development'
3 3  
4 4 # base api
5 5 VUE_APP_BASE_API = '/dev-api'
6   -
  6 +# VUE_APP_BASE_API = 'http://localhost/sys-glass/api/'
7 7 # vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
8 8 # to control whether the babel-plugin-dynamic-import-node plugin is enabled.
9 9 # It only does one thing by converting all import() to require().
... ...
1 1 import Mock from 'mockjs'
2 2  
3 3 const data = Mock.mock({
4   - 'items|30': [{
  4 + 'items|10': [{
5 5 id: '@id',
6   - title: '@sentence(10, 20)',
  6 + title: '@sentence(3, 10)',
7 7 'status|1': ['published', 'draft', 'deleted'],
8   - author: 'name',
  8 + author: 'name@integer(300, 5000)',
9 9 display_time: '@datetime',
10 10 pageviews: '@integer(300, 5000)'
11 11 }]
... ... @@ -13,7 +13,7 @@ const data = Mock.mock({
13 13  
14 14 export default [
15 15 {
16   - url: '/vue-admin-template/table/list',
  16 + url: '/yp/table/list',
17 17 type: 'get',
18 18 response: config => {
19 19 const items = data.items
... ...
... ... @@ -3,35 +3,52 @@ const tokens = {
3 3 admin: {
4 4 token: 'admin-token'
5 5 },
  6 + assistant: {
  7 + token: 'assistant-token'
  8 + },
6 9 editor: {
7 10 token: 'editor-token'
  11 + },
  12 + shoper: {
  13 + token: 'shoper-token'
8 14 }
9 15 }
10 16  
11 17 const users = {
12   - 'admin-token': {
  18 + 'admin-token': {//管理员
13 19 roles: ['admin'],
14 20 introduction: 'I am a super administrator',
15 21 avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
16 22 name: 'Super Admin'
17 23 },
18   - 'editor-token': {
  24 + 'assistant-token': {//管理员助理
  25 + roles: ['assistant'],
  26 + introduction: 'I am a assistant of administrator',
  27 + avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
  28 + name: 'Super Admin'
  29 + },
  30 + 'editor-token': {//运营人员
19 31 roles: ['editor'],
20 32 introduction: 'I am an editor',
21 33 avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
22 34 name: 'Normal Editor'
  35 + },
  36 + 'shoper-token': {//供应商
  37 + roles: ['shoper'],
  38 + introduction: 'I am an shoper',
  39 + avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
  40 + name: 'Normal Editor'
23 41 }
24 42 }
25 43  
26 44 export default [
27 45 // user login
28 46 {
29   - url: '/vue-admin-template/user/login',
  47 + url: '/yp/user/login',
30 48 type: 'post',
31 49 response: config => {
32 50 const { username } = config.body
33 51 const token = tokens[username]
34   -
35 52 // mock error
36 53 if (!token) {
37 54 return {
... ... @@ -49,7 +66,7 @@ export default [
49 66  
50 67 // get user info
51 68 {
52   - url: '/vue-admin-template/user/info\.*',
  69 + url: '/yp/user/info\.*',
53 70 type: 'get',
54 71 response: config => {
55 72 const { token } = config.query
... ... @@ -72,7 +89,7 @@ export default [
72 89  
73 90 // user logout
74 91 {
75   - url: '/vue-admin-template/user/logout',
  92 + url: '/yp/user/logout',
76 93 type: 'post',
77 94 response: _ => {
78 95 return {
... ...
... ... @@ -2,7 +2,7 @@
2 2 <div id="app">
3 3 <router-view />
4 4 </div>
5   -
  5 +
6 6 </template>
7 7  
8 8 <script>
... ...
... ... @@ -0,0 +1,27 @@
  1 +import request from '@/utils/request'
  2 +
  3 +export function login(data) {
  4 + console.log('login....', data)
  5 + return request({
  6 + url: '/yp/user/login',
  7 + method: 'post',
  8 + data
  9 + })
  10 +}
  11 +
  12 +export function getInfo(token) {
  13 + console.log('getInfo....', token)
  14 + return request({
  15 + url: '/yp/user/info',
  16 + method: 'get',
  17 + params: { token }
  18 + })
  19 +}
  20 +
  21 +export function logout() {
  22 + console.log('logout....')
  23 + return request({
  24 + url: '/yp/user/logout',
  25 + method: 'post'
  26 + })
  27 +}
... ...
... ... @@ -2,7 +2,7 @@ import request from &#39;@/utils/request&#39;
2 2  
3 3 export function getList(params) {
4 4 return request({
5   - url: '/vue-admin-template/table/list',
  5 + url: '/yp/table/list',
6 6 method: 'get',
7 7 params
8 8 })
... ...
... ... @@ -3,7 +3,7 @@ import request from &#39;@/utils/request&#39;
3 3 export function login(data) {
4 4 console.log('login....', data)
5 5 return request({
6   - url: '/vue-admin-template/user/login',
  6 + url: '/yp/user/login',
7 7 method: 'post',
8 8 data
9 9 })
... ... @@ -12,7 +12,16 @@ export function login(data) {
12 12 export function getInfo(token) {
13 13 console.log('getInfo....', token)
14 14 return request({
15   - url: '/vue-admin-template/user/info',
  15 + url: '/yp/user/info',
  16 + method: 'get',
  17 + params: { token }
  18 + })
  19 +}
  20 +
  21 +export function list(token) {
  22 + console.log('listUser....', token)
  23 + return request({
  24 + url: '/yp/user/list',
16 25 method: 'get',
17 26 params: { token }
18 27 })
... ... @@ -21,7 +30,7 @@ export function getInfo(token) {
21 30 export function logout() {
22 31 console.log('logout....')
23 32 return request({
24   - url: '/vue-admin-template/user/logout',
  33 + url: '/yp/user/logout',
25 34 method: 'post'
26 35 })
27 36 }
... ...
src/router/index.js
... ... @@ -51,16 +51,36 @@ export const constantRoutes = [
51 51 path: 'dashboard',
52 52 name: 'Dashboard',
53 53 component: () => import('@/views/dashboard/index'),
54   - meta: { title: '标题-------dashboard', icon: 'dashboard' }
  54 + meta: { title: '中控台', icon: 'dashboard' }
55 55 }]
56 56 },
57   -
  57 + {
  58 + path: '/user',
  59 + component: Layout,
  60 + redirect: '/user/list',
  61 + name: 'user',
  62 + meta: { title: '用户管理', icon: 'example' },
  63 + children: [
  64 + {
  65 + path: 'user',
  66 + name: 'User',
  67 + component: () => import('@/views/table/index'),
  68 + meta: { title: '用户列表', icon: 'table' }
  69 + },
  70 + {
  71 + path: 'tree',
  72 + name: 'Table',
  73 + component: () => import('@/views/tree/index'),
  74 + meta: { title: 'Tree', icon: 'tree' }
  75 + }
  76 + ]
  77 + },
58 78 {
59 79 path: '/example',
60 80 component: Layout,
61 81 redirect: '/example/table',
62 82 name: 'Example',
63   - meta: { title: 'Example', icon: 'example' },
  83 + meta: { title: 'E1111xample', icon: 'example' },
64 84 children: [
65 85 {
66 86 path: 'table',
... ...
... ... @@ -12,5 +12,5 @@ module.exports = {
12 12 * @type {boolean} true | false
13 13 * @description Whether show the logo in sidebar
14 14 */
15   - sidebarLogo:true
  15 + sidebarLogo: true
16 16 }
... ...
src/views/dashboard/index.vue
... ... @@ -5,11 +5,18 @@
5 5 </div>
6 6 </template>
7 7  
8   -
9   -
10 8 <script>
11 9 import { mapGetters } from 'vuex'
12   -import ElementUI from 'element-ui'
  10 +// import ElementUI from 'element-ui'
  11 +// 按需引入 引入 ECharts 主模块
  12 +// var echarts = require('echarts/lib/echarts')
  13 +// 引入柱状图
  14 +// require('echarts/lib/chart/bar')
  15 +// 引入提示框和标题组件
  16 +// require('echarts/lib/component/tooltip')
  17 +// require('echarts/lib/component/title')
  18 +// 全部引入
  19 +// var echarts = require('echarts')
13 20  
14 21 export default {
15 22 name: 'Dashboard',
... ...
src/views/table/index.vue
... ... @@ -70,6 +70,7 @@ export default {
70 70 fetchData() {
71 71 this.listLoading = true
72 72 getList().then(response => {
  73 + console.log('----getList---', response)
73 74 this.list = response.data.items
74 75 this.listLoading = false
75 76 })
... ...