Commit b58b17e1ee81c077e69948655f50c7e74b68c56b

Authored by Adam
1 parent 5cb3759400
Exists in master

auto commit the code by alias command

... ... @@ -2,7 +2,8 @@
2 2 ENV = 'development'
3 3  
4 4 # base api
5   -VUE_APP_BASE_API = '/dev-api'
  5 + VUE_APP_BASE_API = '/dev-api'
  6 +# VUE_APP_BASE_API = 'http://localhost:8087/'
6 7 # VUE_APP_BASE_API = 'http://localhost/sys-glass/api/'
7 8 # vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
8 9 # to control whether the babel-plugin-dynamic-import-node plugin is enabled.
... ...
mock/prod/list.js
... ... @@ -0,0 +1,135 @@
  1 +import Mock from 'mockjs'
  2 +// import logoPath from "~@/assets/img/yp_logo.jpeg"
  3 +
  4 +const List = []
  5 +const count = 20
  6 +
  7 +const baseContent = '<p>I am testing data, I am testing data.</p><p></p>'
  8 +// const image_uri = logoPath
  9 +const image_uri = 'https://wpimg.wallstcn.com/360e4842-4db5-42d0-b078-f9a84a825546.gif'
  10 +
  11 +for (let i = 0; i < count; i++) {
  12 + List.push(Mock.mock({
  13 + pid: '@increment',
  14 + pname: '@title(5,10)',
  15 + timestamp: +Mock.Random.date('T'),
  16 + shoper: '@first', //所属工厂
  17 + salescount: '@first', //购买次数
  18 + importance: '@integer(1, 3)', //排序权重
  19 + prod_info_weight: '@integer(1, 3)', //重量
  20 + prod_info_leg_long: '@integer(1, 3)', //腿长
  21 + prod_info_glass_width: '@integer(1, 3)', //镜宽
  22 + prod_info_glass_height: '@integer(1, 3)', //镜高
  23 + prod_info_frame_width: '@integer(1, 3)', //框宽
  24 + prod_info_frame_height: '@integer(1, 3)', //框高
  25 + prod_info_norse_width: '@integer(1, 3)', //鼻宽
  26 + prod_info_window_pic: [], //鼻宽
  27 + image_uri: image_uri
  28 + }))
  29 +}
  30 +
  31 +export default [{
  32 + url: '/yp/prod/list',
  33 + type: 'post',
  34 + response: config => {
  35 + const {
  36 + importance,
  37 + type,
  38 + title,
  39 + page = 1,
  40 + limit = 20,
  41 + sort
  42 + } = config.query
  43 +
  44 + // let mockList = List.filter(item => {
  45 + // if (importance && item.importance !== +importance) return false
  46 + // if (type && item.type !== type) return false
  47 + // if (title && item.title.indexOf(title) < 0) return false
  48 + // return true
  49 + // })
  50 +
  51 + if (sort === '-id') {
  52 + mockList = mockList.reverse()
  53 + }
  54 +
  55 + const pageList = mockList.filter((item, index) => index < limit * page && index >= limit * (page - 1))
  56 +
  57 + return {
  58 + code: 20000,
  59 + data: {
  60 + total: mockList.length,
  61 + items: pageList
  62 + }
  63 + }
  64 + }
  65 + },
  66 +
  67 + // {
  68 + // url: '/yp/prod/detail',
  69 + // type: 'get',
  70 + // response: config => {
  71 + // const {
  72 + // id
  73 + // } = config.query
  74 + // for (const article of List) {
  75 + // if (article.id === +id) {
  76 + // return {
  77 + // code: 20000,
  78 + // data: article
  79 + // }
  80 + // }
  81 + // }
  82 + // }
  83 + // },
  84 +
  85 + // {
  86 + // url: '/yp/article/pv',
  87 + // type: 'get',
  88 + // response: _ => {
  89 + // return {
  90 + // code: 20000,
  91 + // data: {
  92 + // pvData: [{
  93 + // key: 'PC',
  94 + // pv: 1024
  95 + // },
  96 + // {
  97 + // key: 'mobile',
  98 + // pv: 1024
  99 + // },
  100 + // {
  101 + // key: 'ios',
  102 + // pv: 1024
  103 + // },
  104 + // {
  105 + // key: 'android',
  106 + // pv: 1024
  107 + // }
  108 + // ]
  109 + // }
  110 + // }
  111 + // }
  112 + // },
  113 +
  114 + // {
  115 + // url: '/yp/article/create',
  116 + // type: 'post',
  117 + // response: _ => {
  118 + // return {
  119 + // code: 20000,
  120 + // data: 'success'
  121 + // }
  122 + // }
  123 + // },
  124 +
  125 + // {
  126 + // url: '/yp/article/update',
  127 + // type: 'post',
  128 + // response: _ => {
  129 + // return {
  130 + // code: 20000,
  131 + // data: 'success'
  132 + // }
  133 + // }
  134 + // }
  135 +]
... ...
... ... @@ -0,0 +1,64 @@
  1 +import request from '@/utils/request'
  2 +import {
  3 + Notification
  4 +} from 'element-ui'
  5 +// export const getPersonInfo = data => {
  6 +// return service({
  7 +// url: '/person_pay/getpersoninfo',
  8 +// method: 'post',
  9 +// data
  10 +// })
  11 +// }
  12 +
  13 +export function fetchList(query) {
  14 + // console.log('api/prod/list/ ==fetchList=== query', query);
  15 + const options = {
  16 + type: 'error',
  17 + message: query,
  18 + title: '==query value ===',
  19 + showClose: true,
  20 + duration: 4000
  21 + }
  22 + Notification(options)
  23 + return request({
  24 + url: '/yp/prod/list',
  25 + method: 'post',
  26 + params: query
  27 + })
  28 +}
  29 +
  30 +// export function fetchArticle(id) {
  31 +// return request({
  32 +// url: '/yp/article/detail',
  33 +// method: 'get',
  34 +// params: {
  35 +// id
  36 +// }
  37 +// })
  38 +// }
  39 +
  40 +// export function fetchPv(pv) {
  41 +// return request({
  42 +// url: '/yp/article/pv',
  43 +// method: 'get',
  44 +// params: {
  45 +// pv
  46 +// }
  47 +// })
  48 +// }
  49 +
  50 +// export function createArticle(data) {
  51 +// return request({
  52 +// url: '/yp/article/create',
  53 +// method: 'post',
  54 +// data
  55 +// })
  56 +// }
  57 +
  58 +// export function updateArticle(data) {
  59 +// return request({
  60 +// url: '/yp/article/update',
  61 +// method: 'post',
  62 +// data
  63 +// })
  64 +// }
... ...
... ... @@ -16,7 +16,9 @@ export function getInfo(token) {
16 16 return request({
17 17 url: '/yp/user/info',
18 18 method: 'get',
19   - params: { token }
  19 + params: {
  20 + token
  21 + }
20 22 })
21 23 }
22 24  
... ...
... ... @@ -74,7 +74,10 @@ export default {
74 74 admin: '超级管理员'
75 75 },
76 76 shopers: '厂商',
77   - prods: '产品',
  77 + prods: {
  78 + prod_menu: '产品',
  79 + prodlist: '产品列表'
  80 + },
78 81 orders: '订单',
79 82 sites: '站点',
80 83 metas: {
... ...
src/router/index.js
... ... @@ -7,7 +7,7 @@ Vue.use(Router)
7 7 import Layout from '@/layout'
8 8  
9 9 /* Router Modules */
10   -// import componentsRouter from './modules/components'
  10 +import componentsRouter from './modules/components'
11 11 // import chartsRouter from './modules/charts'
12 12 // import tableRouter from './modules/table'
13 13 // import nestedRouter from './modules/nested'
... ... @@ -189,57 +189,67 @@ export const asyncRoutes = [
189 189 prodRouter,
190 190 orderRouter,
191 191 sitesRouter,
192   -
193   - // {
194   - // path: '/icon',
195   - // component: Layout,
196   - // children: [
197   - // {
198   - // path: 'index',
199   - // component: () => import('@/views/icons/index'),
200   - // name: 'Icons',
201   - // meta: { title: 'icons', icon: 'icon', noCache: true }
202   - // }
203   - // ]
204   - // },
205 192 systemRouter,
206   - /** when your routing map is too long, you can split it into small modules **/
207   - // componentsRouter,
  193 + componentsRouter,
208 194 // chartsRouter,
209 195 // nestedRouter,
210 196 // tableRouter,
  197 + {
  198 + path: '/icon',
  199 + component: Layout,
  200 + children: [{
  201 + path: 'index',
  202 + component: () => import('@/views/icons/index'),
  203 + name: 'Icons',
  204 + meta: {
  205 + title: 'icons',
  206 + icon: 'icon',
  207 + noCache: true
  208 + }
  209 + }]
  210 + },
  211 + /** when your routing map is too long, you can split it into small modules **/
211 212  
212   - // {
213   - // path: '/example',
214   - // component: Layout,
215   - // redirect: '/example/list',
216   - // name: 'Example',
217   - // meta: {
218   - // title: 'example',
219   - // icon: 'example'
220   - // },
221   - // children: [
222   - // {
223   - // path: 'create',
224   - // component: () => import('@/views/example/create'),
225   - // name: 'CreateArticle',
226   - // meta: { title: 'createArticle', icon: 'edit' }
227   - // },
228   - // {
229   - // path: 'edit/:id(\\d+)',
230   - // component: () => import('@/views/example/edit'),
231   - // name: 'EditArticle',
232   - // meta: { title: 'editArticle', noCache: true, activeMenu: '/example/list' },
233   - // hidden: true
234   - // },
235   - // {
236   - // path: 'list',
237   - // component: () => import('@/views/example/list'),
238   - // name: 'ArticleList',
239   - // meta: { title: 'articleList', icon: 'list' }
240   - // }
241   - // ]
242   - // },
  213 + {
  214 + path: '/example',
  215 + component: Layout,
  216 + redirect: '/example/list',
  217 + name: 'Example',
  218 + meta: {
  219 + title: 'example',
  220 + icon: 'example'
  221 + },
  222 + children: [{
  223 + path: 'create',
  224 + component: () => import('@/views/example/create'),
  225 + name: 'CreateArticle',
  226 + meta: {
  227 + title: 'createArticle',
  228 + icon: 'edit'
  229 + }
  230 + },
  231 + {
  232 + path: 'edit/:id(\\d+)',
  233 + component: () => import('@/views/example/edit'),
  234 + name: 'EditArticle',
  235 + meta: {
  236 + title: 'editArticle',
  237 + noCache: true,
  238 + activeMenu: '/example/list'
  239 + },
  240 + hidden: true
  241 + },
  242 + {
  243 + path: 'list',
  244 + component: () => import('@/views/example/list'),
  245 + name: 'ArticleList',
  246 + meta: {
  247 + title: 'articleList',
  248 + icon: 'list'
  249 + }
  250 + }
  251 + ]
  252 + },
243 253  
244 254 // {
245 255 // path: '/tab',
... ...
src/router/modules/meta.js
... ... @@ -12,7 +12,7 @@ const metaRouter = {
12 12 roles: ['admin', 'assistant'] // you can set roles in root nav
13 13 },
14 14 children: [{
15   - path: 'page',
  15 + path: 'metapage',
16 16 component: () => import('@/views/meta/tree'),
17 17 name: 'MetaList',
18 18 meta: {
... ...
src/router/modules/order.js
... ... @@ -14,11 +14,11 @@ const orderRouter = {
14 14 roles: ['admin', 'assistant', 'runner', 'shoper'] // you can set roles in root nav
15 15 },
16 16 children: [{
17   - path: 'page',
  17 + path: 'orderpage',
18 18 component: () => import('@/views/order/list'),
19   - name: 'OrderList',
  19 + name: 'list',
20 20 meta: {
21   - title: 'OrderList',
  21 + title: 'orders',
22 22 roles: ['admin', 'assistant', 'runner', 'shoper'] // or you can only set roles in sub nav
23 23 }
24 24 }]
... ...
src/router/modules/prod.js
... ... @@ -3,42 +3,44 @@
3 3 import Layout from '@/layout'
4 4  
5 5 const prodRouter = {
6   - path: '/prods',
  6 + path: '/prod',
7 7 component: Layout,
8 8 redirect: '/prod/page',
9 9 alwaysShow: true, // will always show the root menu
10 10 name: 'Prod',
11 11 meta: {
12   - title: 'prods', // 会自动被i18n替换
  12 + title: 'prods.prod_menu', // 会自动被i18n替换
13 13 icon: 'star',
14 14 roles: ['admin', 'assistant', 'runner', 'shoper'] // you can set roles in root nav
15 15 },
16   - children: [{
17   - path: 'page',
18   - component: () => import('@/views/permission/page'),
19   - name: 'ProdList',
20   - meta: {
21   - title: 'ProdList',
22   - roles: ['admin', 'assistant', 'runner', 'shoper']
  16 + children: [
  17 + // {
  18 + // path: 'page',
  19 + // component: () => import('@/views/permission/page'),
  20 + // name: 'ProdList',
  21 + // meta: {
  22 + // title: 'ProdList',
  23 + // roles: ['admin', 'assistant', 'runner', 'shoper']
  24 + // }
  25 + // },
  26 + // {
  27 + // path: 'defined',
  28 + // component: () => import('@/views/permission/directive'),
  29 + // name: 'ProdDefiend',
  30 + // meta: {
  31 + // title: 'ProdDefiend',
  32 + // roles: ['admin', 'assistant', 'shoper']
  33 + // }
  34 + // },
  35 + {
  36 + path: 'list',
  37 + component: () => import('@/views/prod/list'),
  38 + name: 'prodList',
  39 + meta: {
  40 + title: 'prods.prodlist',
  41 + roles: ['admin', 'assistant', 'shoper', 'runner']
  42 + }
23 43 }
24   - },
25   - {
26   - path: 'defined',
27   - component: () => import('@/views/permission/directive'),
28   - name: 'ProdDefiend',
29   - meta: {
30   - title: 'ProdDefiend',
31   - roles: ['admin', 'assistant', 'shoper']
32   - }
33   - }, {
34   - path: 'defined2',
35   - component: () => import('@/views/prod/list'),
36   - name: 'prod...',
37   - meta: {
38   - title: '产品列表',
39   - roles: ['admin', 'assistant', 'shoper']
40   - }
41   - }
42 44 ]
43 45 }
44 46  
... ...
src/router/modules/sites.js
... ... @@ -12,7 +12,7 @@ const sitesRouter = {
12 12 roles: ['admin', 'assistant', 'runner'] // you can set roles in root nav
13 13 },
14 14 children: [{
15   - path: 'page',
  15 + path: 'sitepage',
16 16 component: () => import('@/views/site/list'),
17 17 name: 'SiteList',
18 18 meta: {
... ...
src/router/modules/system.js
... ... @@ -12,36 +12,36 @@ const systemRouter = {
12 12 roles: ['admin', 'assistant'] // you can set roles in root nav
13 13 },
14 14 children: [{
15   - path: 'page',
  15 + path: 'systempage2',
16 16 component: () => import('@/views/example/list'),
17   - name: 'SystemList',
  17 + name: 'SystemList1',
18 18 meta: {
19 19 title: 'systems.sites',
20 20 roles: ['admin', 'assistant'] // or you can only set roles in sub nav
21 21 }
22 22 },
23 23 {
24   - path: 'page',
  24 + path: 'sytempage2',
25 25 component: () => import('@/views/example/list'),
26   - name: 'SystemList',
  26 + name: 'SystemList2',
27 27 meta: {
28 28 title: 'systems.money',
29 29 roles: ['admin', 'assistant'] // or you can only set roles in sub nav
30 30 }
31 31 },
32 32 {
33   - path: 'page',
  33 + path: 'systempage3',
34 34 component: () => import('@/views/example/list'),
35   - name: 'SystemList',
  35 + name: 'SystemList3',
36 36 meta: {
37 37 title: 'systems.industry',
38 38 roles: ['admin', 'assistant'] // or you can only set roles in sub nav
39 39 }
40 40 },
41 41 {
42   - path: 'page',
  42 + path: 'systempage4',
43 43 component: () => import('@/views/example/list'),
44   - name: 'SystemList',
  44 + name: 'SystemList4',
45 45 meta: {
46 46 title: 'systems.template',
47 47 roles: ['admin', 'assistant'] // or you can only set roles in sub nav
... ...
src/store/modules/prod.js
No preview for this file type
src/utils/request.js
... ... @@ -12,7 +12,9 @@ import {
12 12 } from '@/utils/auth'
13 13  
14 14 // const baseUrl = 'http://localhost/sys-glass/api';
15   -const baseUrl = process.env.VUE_APP_BASE_API // url = base url + request url
  15 +// const baseUrl = 'http://localhost:8087';
  16 +const baseUrl = '/dev-api'
  17 +// const baseUrl = process.env.VUE_APP_BASE_API // url = base url + request url
16 18 // create an axios instance
17 19 const service = axios.create({
18 20 // baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
... ...
src/views/prod/list.vue
... ... @@ -13,7 +13,7 @@
13 13 >
14 14 <el-table-column
15 15 align="center"
16   - label="ID"
  16 + label="PID"
17 17 width="65"
18 18 >
19 19 <template slot-scope="{row}">
... ... @@ -24,7 +24,7 @@
24 24 <el-table-column
25 25 width="180px"
26 26 align="center"
27   - label="Date"
  27 + label="Date2"
28 28 >
29 29 <template slot-scope="{row}">
30 30 <span>{{ row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
... ... @@ -110,8 +110,17 @@
110 110 </template>
111 111  
112 112 <script>
113   -import { fetchList } from '@/api/article'
  113 +import {
  114 + fetchList
  115 + // fetchPv
  116 + // createUser,
  117 + // updateUser,
  118 + // delUser
  119 +} from '@/api/prod'
114 120 import Sortable from 'sortablejs'
  121 +// import waves from '@/directive/waves' // waves directive
  122 +// import { parseTime } from "@/utils";
  123 +// import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
115 124  
116 125 export default {
117 126 name: 'DragTable',
... ... @@ -144,16 +153,18 @@ export default {
144 153 },
145 154 methods: {
146 155 async getList() {
  156 + console.log('test======>', 'prod ..... -----getList')
147 157 this.listLoading = true
148 158 const { data } = await fetchList(this.listQuery)
  159 + console.log('data===========getList=======', data)
149 160 this.list = data.items
150 161 this.total = data.total
151   - this.listLoading = false
152   - this.oldList = this.list.map(v => v.id)
153   - this.newList = this.oldList.slice()
154   - this.$nextTick(() => {
155   - this.setSort()
156   - })
  162 + // this.listLoading = false;
  163 + // this.oldList = this.list.map(v => v.id);
  164 + // this.newList = this.oldList.slice();
  165 + // this.$nextTick(() => {
  166 + // this.setSort();
  167 + // });
157 168 },
158 169 setSort() {
159 170 const el = this.$refs.dragTable.$el.querySelectorAll(
... ...