Commit 04e55fcfe10fc43f97ad53414df502369dbdba57

Authored by Adam
1 parent a1b48a4445
Exists in master

auto commit the code by alias command

mock/prod/list.js
... ... @@ -1,135 +0,0 @@
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   -]
mock/role/routes.js
1 1 // Just a mock data
2 2  
3   -export const constantRoutes = [
4   - {
  3 +export const constantRoutes = [{
5 4 path: '/redirect',
6 5 component: 'layout/Layout',
7 6 hidden: true,
8   - children: [
9   - {
10   - path: '/redirect/:path*',
11   - component: 'views/redirect/index'
12   - }
13   - ]
  7 + children: [{
  8 + path: '/redirect/:path*',
  9 + component: 'views/redirect/index'
  10 + }]
14 11 },
15 12 {
16 13 path: '/login',
... ... @@ -46,100 +43,106 @@ export const constantRoutes = [
46 43 path: '',
47 44 component: 'layout/Layout',
48 45 redirect: 'dashboard',
49   - children: [
50   - {
51   - path: 'dashboard',
52   - component: 'views/dashboard/index',
53   - name: 'Dashboard',
54   - meta: { title: 'dashboard', icon: 'dashboard', affix: true }
  46 + children: [{
  47 + path: 'dashboard',
  48 + component: 'views/dashboard/index',
  49 + name: 'Dashboard',
  50 + meta: {
  51 + title: 'dashboard',
  52 + icon: 'dashboard',
  53 + affix: true
55 54 }
56   - ]
  55 + }]
57 56 },
58 57 {
59 58 path: '/documentation',
60 59 component: 'layout/Layout',
61   - children: [
62   - {
63   - path: 'index',
64   - component: 'views/documentation/index',
65   - name: 'Documentation',
66   - meta: { title: 'documentation', icon: 'documentation', affix: true }
  60 + children: [{
  61 + path: 'index',
  62 + component: 'views/documentation/index',
  63 + name: 'Documentation',
  64 + meta: {
  65 + title: 'documentation',
  66 + icon: 'documentation',
  67 + affix: true
67 68 }
68   - ]
  69 + }]
69 70 },
70 71 {
71 72 path: '/guide',
72 73 component: 'layout/Layout',
73 74 redirect: '/guide/index',
74   - children: [
75   - {
76   - path: 'index',
77   - component: 'views/guide/index',
78   - name: 'Guide',
79   - meta: { title: 'guide', icon: 'guide', noCache: true }
  75 + children: [{
  76 + path: 'index',
  77 + component: 'views/guide/index',
  78 + name: 'Guide',
  79 + meta: {
  80 + title: 'guide',
  81 + icon: 'guide',
  82 + noCache: true
80 83 }
81   - ]
  84 + }]
82 85 }
83 86 ]
84 87  
85   -export const asyncRoutes = [
86   - // {
87   - // path: '/permission',
88   - // component: 'layout/Layout',
89   - // redirect: '/permission/index',
90   - // alwaysShow: true,
91   - // meta: {
92   - // title: 'permission',
93   - // icon: 'lock',
94   - // // roles: ['admin', 'assistant', 'runner', 'shoper']
95   - // },
96   - // children: [
97   - // {
98   - // path: 'page',
99   - // component: 'views/permission/page',
100   - // name: 'PagePermission',
101   - // meta: {
102   - // title: 'pagePermission',
103   - // roles: ['admin','assistant']
104   - // }
105   - // },
106   - // {
107   - // path: 'directive',
108   - // component: 'views/permission/directive',
109   - // name: 'DirectivePermission',
110   - // meta: {
111   - // title: 'directivePermission',
112   - // roles:['shoper']
113   - // }
114   - // },
115   - // {
116   - // path: 'role',
117   - // component: 'views/permission/role',
118   - // name: 'RolePermission',
119   - // meta: {
120   - // title: 'rolePermission',
121   - // roles: ['runner']
122   - // }
123   - // }
124   - // ]
125   - // },
  88 +export const asyncRoutes = [{
  89 + path: '/permission',
  90 + component: 'layout/Layout',
  91 + redirect: '/permission/index',
  92 + alwaysShow: true,
  93 + meta: {
  94 + title: 'permission',
  95 + icon: 'lock',
  96 + // roles: ['admin', 'assistant', 'runner', 'shoper']
  97 + },
  98 + children: [{
  99 + path: 'page',
  100 + component: 'views/permission/page',
  101 + name: 'PagePermission',
  102 + meta: {
  103 + title: 'pagePermission',
  104 + roles: ['admin', 'assistant']
  105 + }
  106 + },
  107 + {
  108 + path: 'directive',
  109 + component: 'views/permission/directive',
  110 + name: 'DirectivePermission',
  111 + meta: {
  112 + title: 'directivePermission',
  113 + roles: ['shoper']
  114 + }
  115 + },
  116 + {
  117 + path: 'role',
  118 + component: 'views/permission/role',
  119 + name: 'RolePermission',
  120 + meta: {
  121 + title: 'rolePermission',
  122 + roles: ['runner']
  123 + }
  124 + }
  125 + ]
  126 + },
126 127  
127 128 {
128 129 path: '/icon',
129 130 component: 'layout/Layout',
130 131 meta: {
131 132 title: 'ddddd',
132   - icon:'people',
  133 + icon: 'people',
133 134 roles: ['runner']
134 135 },
135   - children: [
136   - {
137   - path: 'index',
138   - component: 'views/icons/index',
139   - name: 'Icons',
140   - meta: { title: 'icons', icon: 'icon', noCache: true }
  136 + children: [{
  137 + path: 'index',
  138 + component: 'views/icons/index',
  139 + name: 'Icons',
  140 + meta: {
  141 + title: 'icons',
  142 + icon: 'icon',
  143 + noCache: true
141 144 }
142   - ]
  145 + }]
143 146 },
144 147  
145 148 {
... ... @@ -151,90 +154,117 @@ export const asyncRoutes = [
151 154 title: 'components',
152 155 icon: 'component'
153 156 },
154   - children: [
155   - {
  157 + children: [{
156 158 path: 'tinymce',
157 159 component: 'views/components-demo/tinymce',
158 160 name: 'TinymceDemo',
159   - meta: { title: 'tinymce' }
  161 + meta: {
  162 + title: 'tinymce'
  163 + }
160 164 },
161 165 {
162 166 path: 'markdown',
163 167 component: 'views/components-demo/markdown',
164 168 name: 'MarkdownDemo',
165   - meta: { title: 'markdown' }
  169 + meta: {
  170 + title: 'markdown'
  171 + }
166 172 },
167 173 {
168 174 path: 'json-editor',
169 175 component: 'views/components-demo/json-editor',
170 176 name: 'JsonEditorDemo',
171   - meta: { title: 'jsonEditor' }
  177 + meta: {
  178 + title: 'jsonEditor'
  179 + }
172 180 },
173 181 {
174 182 path: 'split-pane',
175 183 component: 'views/components-demo/split-pane',
176 184 name: 'SplitpaneDemo',
177   - meta: { title: 'splitPane' }
  185 + meta: {
  186 + title: 'splitPane'
  187 + }
178 188 },
179 189 {
180 190 path: 'avatar-upload',
181 191 component: 'views/components-demo/avatar-upload',
182 192 name: 'AvatarUploadDemo',
183   - meta: { title: 'avatarUpload' }
  193 + meta: {
  194 + title: 'avatarUpload'
  195 + }
184 196 },
185 197 {
186 198 path: 'dropzone',
187 199 component: 'views/components-demo/dropzone',
188 200 name: 'DropzoneDemo',
189   - meta: { title: 'dropzone' }
  201 + meta: {
  202 + title: 'dropzone'
  203 + }
190 204 },
191 205 {
192 206 path: 'sticky',
193 207 component: 'views/components-demo/sticky',
194 208 name: 'StickyDemo',
195   - meta: { title: 'sticky' }
  209 + meta: {
  210 + title: 'sticky'
  211 + }
196 212 },
197 213 {
198 214 path: 'count-to',
199 215 component: 'views/components-demo/count-to',
200 216 name: 'CountToDemo',
201   - meta: { title: 'countTo' }
  217 + meta: {
  218 + title: 'countTo'
  219 + }
202 220 },
203 221 {
204 222 path: 'mixin',
205 223 component: 'views/components-demo/mixin',
206 224 name: 'ComponentMixinDemo',
207   - meta: { title: 'componentMixin' }
  225 + meta: {
  226 + title: 'componentMixin'
  227 + }
208 228 },
209 229 {
210 230 path: 'back-to-top',
211 231 component: 'views/components-demo/back-to-top',
212 232 name: 'BackToTopDemo',
213   - meta: { title: 'backToTop' }
  233 + meta: {
  234 + title: 'backToTop'
  235 + }
214 236 },
215 237 {
216 238 path: 'drag-dialog',
217 239 component: 'views/components-demo/drag-dialog',
218 240 name: 'DragDialogDemo',
219   - meta: { title: 'dragDialog' }
  241 + meta: {
  242 + title: 'dragDialog'
  243 + }
220 244 },
221 245 {
222 246 path: 'drag-select',
223 247 component: 'views/components-demo/drag-select',
224 248 name: 'DragSelectDemo',
225   - meta: { title: 'dragSelect' }
  249 + meta: {
  250 + title: 'dragSelect'
  251 + }
226 252 },
227 253 {
228 254 path: 'dnd-list',
229 255 component: 'views/components-demo/dnd-list',
230 256 name: 'DndListDemo',
231   - meta: { title: 'dndList' }
  257 + meta: {
  258 + title: 'dndList'
  259 + }
232 260 },
233 261 {
234 262 path: 'drag-kanban',
235 263 component: 'views/components-demo/drag-kanban',
236 264 name: 'DragKanbanDemo',
237   - meta: { title: 'dragKanban' }
  265 + meta: {
  266 + title: 'dragKanban'
  267 + }
238 268 }
239 269 ]
240 270 },
... ... @@ -247,24 +277,32 @@ export const asyncRoutes = [
247 277 title: 'charts',
248 278 icon: 'chart'
249 279 },
250   - children: [
251   - {
  280 + children: [{
252 281 path: 'keyboard',
253 282 component: 'views/charts/keyboard',
254 283 name: 'KeyboardChart',
255   - meta: { title: 'keyboardChart', noCache: true }
  284 + meta: {
  285 + title: 'keyboardChart',
  286 + noCache: true
  287 + }
256 288 },
257 289 {
258 290 path: 'line',
259 291 component: 'views/charts/line',
260 292 name: 'LineChart',
261   - meta: { title: 'lineChart', noCache: true }
  293 + meta: {
  294 + title: 'lineChart',
  295 + noCache: true
  296 + }
262 297 },
263 298 {
264 299 path: 'mixchart',
265 300 component: 'views/charts/mixChart',
266 301 name: 'MixChart',
267   - meta: { title: 'mixChart', noCache: true }
  302 + meta: {
  303 + title: 'mixChart',
  304 + noCache: true
  305 + }
268 306 }
269 307 ]
270 308 },
... ... @@ -277,38 +315,45 @@ export const asyncRoutes = [
277 315 title: 'nested',
278 316 icon: 'nested'
279 317 },
280   - children: [
281   - {
  318 + children: [{
282 319 path: 'menu1',
283 320 component: 'views/nested/menu1/index',
284 321 name: 'Menu1',
285   - meta: { title: 'menu1' },
  322 + meta: {
  323 + title: 'menu1'
  324 + },
286 325 redirect: '/nested/menu1/menu1-1',
287   - children: [
288   - {
  326 + children: [{
289 327 path: 'menu1-1',
290 328 component: 'views/nested/menu1/menu1-1',
291 329 name: 'Menu1-1',
292   - meta: { title: 'menu1-1' }
  330 + meta: {
  331 + title: 'menu1-1'
  332 + }
293 333 },
294 334 {
295 335 path: 'menu1-2',
296 336 component: 'views/nested/menu1/menu1-2',
297 337 name: 'Menu1-2',
298 338 redirect: '/nested/menu1/menu1-2/menu1-2-1',
299   - meta: { title: 'menu1-2' },
300   - children: [
301   - {
  339 + meta: {
  340 + title: 'menu1-2'
  341 + },
  342 + children: [{
302 343 path: 'menu1-2-1',
303 344 component: 'views/nested/menu1/menu1-2/menu1-2-1',
304 345 name: 'Menu1-2-1',
305   - meta: { title: 'menu1-2-1' }
  346 + meta: {
  347 + title: 'menu1-2-1'
  348 + }
306 349 },
307 350 {
308 351 path: 'menu1-2-2',
309 352 component: 'views/nested/menu1/menu1-2/menu1-2-2',
310 353 name: 'Menu1-2-2',
311   - meta: { title: 'menu1-2-2' }
  354 + meta: {
  355 + title: 'menu1-2-2'
  356 + }
312 357 }
313 358 ]
314 359 },
... ... @@ -316,7 +361,9 @@ export const asyncRoutes = [
316 361 path: 'menu1-3',
317 362 component: 'views/nested/menu1/menu1-3',
318 363 name: 'Menu1-3',
319   - meta: { title: 'menu1-3' }
  364 + meta: {
  365 + title: 'menu1-3'
  366 + }
320 367 }
321 368 ]
322 369 },
... ... @@ -324,7 +371,9 @@ export const asyncRoutes = [
324 371 path: 'menu2',
325 372 name: 'Menu2',
326 373 component: 'views/nested/menu2/index',
327   - meta: { title: 'menu2' }
  374 + meta: {
  375 + title: 'menu2'
  376 + }
328 377 }
329 378 ]
330 379 },
... ... @@ -338,25 +387,33 @@ export const asyncRoutes = [
338 387 title: 'example',
339 388 icon: 'example'
340 389 },
341   - children: [
342   - {
  390 + children: [{
343 391 path: 'create',
344 392 component: 'views/example/create',
345 393 name: 'CreateArticle',
346   - meta: { title: 'createArticle', icon: 'edit' }
  394 + meta: {
  395 + title: 'createArticle',
  396 + icon: 'edit'
  397 + }
347 398 },
348 399 {
349 400 path: 'edit/:id(\\d+)',
350 401 component: 'views/example/edit',
351 402 name: 'EditArticle',
352   - meta: { title: 'editArticle', noCache: true },
  403 + meta: {
  404 + title: 'editArticle',
  405 + noCache: true
  406 + },
353 407 hidden: true
354 408 },
355 409 {
356 410 path: 'list',
357 411 component: 'views/example/list',
358 412 name: 'ArticleList',
359   - meta: { title: 'articleList', icon: 'list' }
  413 + meta: {
  414 + title: 'articleList',
  415 + icon: 'list'
  416 + }
360 417 }
361 418 ]
362 419 },
... ... @@ -364,14 +421,15 @@ export const asyncRoutes = [
364 421 {
365 422 path: '/tab',
366 423 component: 'layout/Layout',
367   - children: [
368   - {
369   - path: 'index',
370   - component: 'views/tab/index',
371   - name: 'Tab',
372   - meta: { title: 'tab', icon: 'tab' }
  424 + children: [{
  425 + path: 'index',
  426 + component: 'views/tab/index',
  427 + name: 'Tab',
  428 + meta: {
  429 + title: 'tab',
  430 + icon: 'tab'
373 431 }
374   - ]
  432 + }]
375 433 },
376 434  
377 435 {
... ... @@ -383,24 +441,32 @@ export const asyncRoutes = [
383 441 title: 'errorPages',
384 442 icon: '404'
385 443 },
386   - children: [
387   - {
  444 + children: [{
388 445 path: '401',
389 446 component: 'views/error-page/401',
390 447 name: 'Page401',
391   - meta: { title: 'page401', noCache: true }
  448 + meta: {
  449 + title: 'page401',
  450 + noCache: true
  451 + }
392 452 },
393 453 {
394 454 path: '404',
395 455 component: 'views/error-page/404',
396 456 name: 'Page404',
397   - meta: { title: 'page404', noCache: true }
  457 + meta: {
  458 + title: 'page404',
  459 + noCache: true
  460 + }
398 461 },
399 462 {
400 463 path: '500',
401 464 component: 'views/error-page/500',
402 465 name: 'Page500',
403   - meta: { title: 'page500', noCache: true }
  466 + meta: {
  467 + title: 'page500',
  468 + noCache: true
  469 + }
404 470 }
405 471 ]
406 472 },
... ... @@ -409,14 +475,15 @@ export const asyncRoutes = [
409 475 path: '/error-log',
410 476 component: 'layout/Layout',
411 477 redirect: 'noRedirect',
412   - children: [
413   - {
414   - path: 'log',
415   - component: 'views/error-log/index',
416   - name: 'ErrorLog',
417   - meta: { title: 'errorLog', icon: 'bug' }
  478 + children: [{
  479 + path: 'log',
  480 + component: 'views/error-log/index',
  481 + name: 'ErrorLog',
  482 + meta: {
  483 + title: 'errorLog',
  484 + icon: 'bug'
418 485 }
419   - ]
  486 + }]
420 487 },
421 488  
422 489 {
... ... @@ -428,30 +495,37 @@ export const asyncRoutes = [
428 495 title: 'excel',
429 496 icon: 'excel'
430 497 },
431   - children: [
432   - {
  498 + children: [{
433 499 path: 'export-excel',
434 500 component: 'views/excel/export-excel',
435 501 name: 'ExportExcel',
436   - meta: { title: 'exportExcel' }
  502 + meta: {
  503 + title: 'exportExcel'
  504 + }
437 505 },
438 506 {
439 507 path: 'export-selected-excel',
440 508 component: 'views/excel/select-excel',
441 509 name: 'SelectExcel',
442   - meta: { title: 'selectExcel' }
  510 + meta: {
  511 + title: 'selectExcel'
  512 + }
443 513 },
444 514 {
445 515 path: 'export-merge-header',
446 516 component: 'views/excel/merge-header',
447 517 name: 'MergeHeader',
448   - meta: { title: 'mergeHeader' }
  518 + meta: {
  519 + title: 'mergeHeader'
  520 + }
449 521 },
450 522 {
451 523 path: 'upload-excel',
452 524 component: 'views/excel/upload-excel',
453 525 name: 'UploadExcel',
454   - meta: { title: 'uploadExcel' }
  526 + meta: {
  527 + title: 'uploadExcel'
  528 + }
455 529 }
456 530 ]
457 531 },
... ... @@ -461,29 +535,33 @@ export const asyncRoutes = [
461 535 component: 'layout/Layout',
462 536 redirect: '/zip/download',
463 537 alwaysShow: true,
464   - meta: { title: 'zip', icon: 'zip' },
465   - children: [
466   - {
467   - path: 'download',
468   - component: 'views/zip/index',
469   - name: 'ExportZip',
470   - meta: { title: 'exportZip' }
  538 + meta: {
  539 + title: 'zip',
  540 + icon: 'zip'
  541 + },
  542 + children: [{
  543 + path: 'download',
  544 + component: 'views/zip/index',
  545 + name: 'ExportZip',
  546 + meta: {
  547 + title: 'exportZip'
471 548 }
472   - ]
  549 + }]
473 550 },
474 551  
475 552 {
476 553 path: '/pdf',
477 554 component: 'layout/Layout',
478 555 redirect: '/pdf/index',
479   - children: [
480   - {
481   - path: 'index',
482   - component: 'views/pdf/index',
483   - name: 'PDF',
484   - meta: { title: 'pdf', icon: 'pdf' }
  556 + children: [{
  557 + path: 'index',
  558 + component: 'views/pdf/index',
  559 + name: 'PDF',
  560 + meta: {
  561 + title: 'pdf',
  562 + icon: 'pdf'
485 563 }
486   - ]
  564 + }]
487 565 },
488 566 {
489 567 path: '/pdf/download',
... ... @@ -495,53 +573,61 @@ export const asyncRoutes = [
495 573 path: '/theme',
496 574 component: 'layout/Layout',
497 575 redirect: 'noRedirect',
498   - children: [
499   - {
500   - path: 'index',
501   - component: 'views/theme/index',
502   - name: 'Theme',
503   - meta: { title: 'theme', icon: 'theme' }
  576 + children: [{
  577 + path: 'index',
  578 + component: 'views/theme/index',
  579 + name: 'Theme',
  580 + meta: {
  581 + title: 'theme',
  582 + icon: 'theme'
504 583 }
505   - ]
  584 + }]
506 585 },
507 586  
508 587 {
509 588 path: '/clipboard',
510 589 component: 'layout/Layout',
511 590 redirect: 'noRedirect',
512   - children: [
513   - {
514   - path: 'index',
515   - component: 'views/clipboard/index',
516   - name: 'ClipboardDemo',
517   - meta: { title: 'clipboardDemo', icon: 'clipboard' }
  591 + children: [{
  592 + path: 'index',
  593 + component: 'views/clipboard/index',
  594 + name: 'ClipboardDemo',
  595 + meta: {
  596 + title: 'clipboardDemo',
  597 + icon: 'clipboard'
518 598 }
519   - ]
  599 + }]
520 600 },
521 601  
522 602 {
523 603 path: '/i18n',
524 604 component: 'layout/Layout',
525   - children: [
526   - {
527   - path: 'index',
528   - component: 'views/i18n-demo/index',
529   - name: 'I18n',
530   - meta: { title: 'i18n', icon: 'international' }
  605 + children: [{
  606 + path: 'index',
  607 + component: 'views/i18n-demo/index',
  608 + name: 'I18n',
  609 + meta: {
  610 + title: 'i18n',
  611 + icon: 'international'
531 612 }
532   - ]
  613 + }]
533 614 },
534 615  
535 616 {
536 617 path: 'external-link',
537 618 component: 'layout/Layout',
538   - children: [
539   - {
540   - path: 'https://github.com/PanJiaChen/vue-element-admin',
541   - meta: { title: 'externalLink', icon: 'link' }
  619 + children: [{
  620 + path: 'https://github.com/PanJiaChen/vue-element-admin',
  621 + meta: {
  622 + title: 'externalLink',
  623 + icon: 'link'
542 624 }
543   - ]
  625 + }]
544 626 },
545 627  
546   - { path: '*', redirect: '/404', hidden: true }
  628 + {
  629 + path: '*',
  630 + redirect: '/404',
  631 + hidden: true
  632 + }
547 633 ]
... ...
1 1 import request from '@/utils/request'
2   -import {
3   - Notification
4   -} from 'element-ui'
5 2  
6 3 // export const getPersonInfo = data => {
7 4 // return service({
... ... @@ -12,18 +9,45 @@ import {
12 9 // }
13 10  
14 11 export function fetchList(query) {
15   - // console.log('api/prod/list/ ==fetchList=== query', query);
16   - const options = {
17   - type: 'error',
18   - message: query,
19   - title: '==query value ===',
20   - showClose: true,
21   - duration: 4000
22   - }
23   - Notification(options)
24 12 return request({
25 13 url: '/yp/prod/list',
26 14 method: 'post',
27 15 params: query
28 16 })
29 17 }
  18 +
  19 +export function fetchArticle(id) {
  20 + return request({
  21 + url: '/yp/prod/detail',
  22 + method: 'get',
  23 + params: {
  24 + id
  25 + }
  26 + })
  27 +}
  28 +
  29 +export function fetchPv(pv) {
  30 + return request({
  31 + url: '/yp/prod/pv',
  32 + method: 'get',
  33 + params: {
  34 + pv
  35 + }
  36 + })
  37 +}
  38 +
  39 +export function createArticle(data) {
  40 + return request({
  41 + url: '/yp/prod/create',
  42 + method: 'post',
  43 + data
  44 + })
  45 +}
  46 +
  47 +export function updateArticle(data) {
  48 + return request({
  49 + url: '/yp/prod/update',
  50 + method: 'post',
  51 + data
  52 + })
  53 +}
... ...
src/store/modules/tagsView.js
... ... @@ -67,18 +67,27 @@ const mutations = {
67 67 }
68 68  
69 69 const actions = {
70   - addView({ dispatch }, view) {
  70 + addView({
  71 + dispatch
  72 + }, view) {
71 73 dispatch('addVisitedView', view)
72 74 dispatch('addCachedView', view)
73 75 },
74   - addVisitedView({ commit }, view) {
  76 + addVisitedView({
  77 + commit
  78 + }, view) {
75 79 commit('ADD_VISITED_VIEW', view)
76 80 },
77   - addCachedView({ commit }, view) {
  81 + addCachedView({
  82 + commit
  83 + }, view) {
78 84 commit('ADD_CACHED_VIEW', view)
79 85 },
80 86  
81   - delView({ dispatch, state }, view) {
  87 + delView({
  88 + dispatch,
  89 + state
  90 + }, view) {
82 91 return new Promise(resolve => {
83 92 dispatch('delVisitedView', view)
84 93 dispatch('delCachedView', view)
... ... @@ -88,20 +97,29 @@ const actions = {
88 97 })
89 98 })
90 99 },
91   - delVisitedView({ commit, state }, view) {
  100 + delVisitedView({
  101 + commit,
  102 + state
  103 + }, view) {
92 104 return new Promise(resolve => {
93 105 commit('DEL_VISITED_VIEW', view)
94 106 resolve([...state.visitedViews])
95 107 })
96 108 },
97   - delCachedView({ commit, state }, view) {
  109 + delCachedView({
  110 + commit,
  111 + state
  112 + }, view) {
98 113 return new Promise(resolve => {
99 114 commit('DEL_CACHED_VIEW', view)
100 115 resolve([...state.cachedViews])
101 116 })
102 117 },
103 118  
104   - delOthersViews({ dispatch, state }, view) {
  119 + delOthersViews({
  120 + dispatch,
  121 + state
  122 + }, view) {
105 123 return new Promise(resolve => {
106 124 dispatch('delOthersVisitedViews', view)
107 125 dispatch('delOthersCachedViews', view)
... ... @@ -111,20 +129,29 @@ const actions = {
111 129 })
112 130 })
113 131 },
114   - delOthersVisitedViews({ commit, state }, view) {
  132 + delOthersVisitedViews({
  133 + commit,
  134 + state
  135 + }, view) {
115 136 return new Promise(resolve => {
116 137 commit('DEL_OTHERS_VISITED_VIEWS', view)
117 138 resolve([...state.visitedViews])
118 139 })
119 140 },
120   - delOthersCachedViews({ commit, state }, view) {
  141 + delOthersCachedViews({
  142 + commit,
  143 + state
  144 + }, view) {
121 145 return new Promise(resolve => {
122 146 commit('DEL_OTHERS_CACHED_VIEWS', view)
123 147 resolve([...state.cachedViews])
124 148 })
125 149 },
126 150  
127   - delAllViews({ dispatch, state }, view) {
  151 + delAllViews({
  152 + dispatch,
  153 + state
  154 + }, view) {
128 155 return new Promise(resolve => {
129 156 dispatch('delAllVisitedViews', view)
130 157 dispatch('delAllCachedViews', view)
... ... @@ -134,20 +161,28 @@ const actions = {
134 161 })
135 162 })
136 163 },
137   - delAllVisitedViews({ commit, state }) {
  164 + delAllVisitedViews({
  165 + commit,
  166 + state
  167 + }) {
138 168 return new Promise(resolve => {
139 169 commit('DEL_ALL_VISITED_VIEWS')
140 170 resolve([...state.visitedViews])
141 171 })
142 172 },
143   - delAllCachedViews({ commit, state }) {
  173 + delAllCachedViews({
  174 + commit,
  175 + state
  176 + }) {
144 177 return new Promise(resolve => {
145 178 commit('DEL_ALL_CACHED_VIEWS')
146 179 resolve([...state.cachedViews])
147 180 })
148 181 },
149 182  
150   - updateVisitedView({ commit }, view) {
  183 + updateVisitedView({
  184 + commit
  185 + }, view) {
151 186 commit('UPDATE_VISITED_VIEW', view)
152 187 }
153 188 }
... ...
src/views/prod/list.vue
1 1 <template>
2 2 <div class="app-container">
3   - <!-- Note that row-key is necessary to get a correct row order. -->
4 3 <el-table
5   - ref="dragTable"
6 4 v-loading="listLoading"
7 5 :data="list"
8   - row-key="id"
9 6 border
10 7 fit
11 8 highlight-current-row
... ... @@ -13,40 +10,31 @@
13 10 >
14 11 <el-table-column
15 12 align="center"
16   - label="PID"
17   - width="65"
  13 + label="ID"
  14 + width="80"
18 15 >
19   - <template slot-scope="{row}">
20   - <span>{{ row.id }}</span>
  16 + <template slot-scope="scope">
  17 + <span>{{ scope.row.id }}</span>
21 18 </template>
22 19 </el-table-column>
23 20  
24 21 <el-table-column
25 22 width="180px"
26 23 align="center"
27   - label="Date2"
  24 + label="Date"
28 25 >
29   - <template slot-scope="{row}">
30   - <span>{{ row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
  26 + <template slot-scope="scope">
  27 + <span>{{ scope.row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
31 28 </template>
32 29 </el-table-column>
33 30  
34 31 <el-table-column
35   - min-width="300px"
36   - label="Title"
37   - >
38   - <template slot-scope="{row}">
39   - <span>{{ row.title }}</span>
40   - </template>
41   - </el-table-column>
42   -
43   - <el-table-column
44   - width="110px"
  32 + width="120px"
45 33 align="center"
46 34 label="Author"
47 35 >
48   - <template slot-scope="{row}">
49   - <span>{{ row.author }}</span>
  36 + <template slot-scope="scope">
  37 + <span>{{ scope.row.author }}</span>
50 38 </template>
51 39 </el-table-column>
52 40  
... ... @@ -54,27 +42,17 @@
54 42 width="100px"
55 43 label="Importance"
56 44 >
57   - <template slot-scope="{row}">
  45 + <template slot-scope="scope">
58 46 <svg-icon
59   - v-for="n in + row.importance"
  47 + v-for="n in +scope.row.importance"
60 48 :key="n"
61 49 icon-class="star"
62   - class="icon-star"
  50 + class="meta-item__icon"
63 51 />
64 52 </template>
65 53 </el-table-column>
66 54  
67 55 <el-table-column
68   - align="center"
69   - label="Readings"
70   - width="95"
71   - >
72   - <template slot-scope="{row}">
73   - <span>{{ row.pageviews }}</span>
74   - </template>
75   - </el-table-column>
76   -
77   - <el-table-column
78 56 class-name="status-col"
79 57 label="Status"
80 58 width="110"
... ... @@ -87,43 +65,55 @@
87 65 </el-table-column>
88 66  
89 67 <el-table-column
  68 + min-width="300px"
  69 + label="Title"
  70 + >
  71 + <template slot-scope="{row}">
  72 + <router-link
  73 + :to="'/example/edit/'+row.id"
  74 + class="link-type"
  75 + >
  76 + <span>{{ row.title }}</span>
  77 + </router-link>
  78 + </template>
  79 + </el-table-column>
  80 +
  81 + <el-table-column
90 82 align="center"
91   - label="Drag"
92   - width="80"
  83 + label="Actions"
  84 + width="120"
93 85 >
94   - <template slot-scope="{}">
95   - <svg-icon
96   - class="drag-handler"
97   - icon-class="drag"
98   - />
  86 + <template slot-scope="scope">
  87 + <router-link :to="'/example/edit/'+scope.row.id">
  88 + <el-button
  89 + type="primary"
  90 + size="small"
  91 + icon="el-icon-edit"
  92 + >
  93 + Edit
  94 + </el-button>
  95 + </router-link>
99 96 </template>
100 97 </el-table-column>
101 98 </el-table>
102   - <!-- $t is vue-i18n global function to translate lang (lang in @/lang) -->
103   - <div class="show-d">
104   - <el-tag style="margin-right:12px;">{{ $t('table.dragTips1') }} :</el-tag> {{ oldList }}
105   - </div>
106   - <div class="show-d">
107   - <el-tag>{{ $t('table.dragTips2') }} :</el-tag> {{ newList }}
108   - </div>
  99 +
  100 + <pagination
  101 + v-show="total>0"
  102 + :total="total"
  103 + :page.sync="listQuery.page"
  104 + :limit.sync="listQuery.limit"
  105 + @pagination="getList"
  106 + />
109 107 </div>
110 108 </template>
111 109  
112 110 <script>
113   -import {
114   - fetchList
115   - // fetchPv
116   - // createUser,
117   - // updateUser,
118   - // delUser
119   -} from '@/api/prod'
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
  111 +import { fetchList } from '@/api/article'
  112 +import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
124 113  
125 114 export default {
126   - name: 'DragTable',
  115 + name: 'ArticleList',
  116 + components: { Pagination },
127 117 filters: {
128 118 statusFilter(status) {
129 119 const statusMap = {
... ... @@ -137,78 +127,37 @@ export default {
137 127 data() {
138 128 return {
139 129 list: null,
140   - total: null,
  130 + total: 0,
141 131 listLoading: true,
142 132 listQuery: {
143 133 page: 1,
144   - limit: 10
145   - },
146   - sortable: null,
147   - oldList: [],
148   - newList: []
  134 + limit: 20
  135 + }
149 136 }
150 137 },
151 138 created() {
152 139 this.getList()
153 140 },
154 141 methods: {
155   - async getList() {
156   - console.log('test======>', 'prod ..... -----getList')
  142 + getList() {
157 143 this.listLoading = true
158   - const { data } = await fetchList(this.listQuery)
159   - console.log('data===========getList=======', data)
160   - this.list = data.items
161   - this.total = data.total
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   - // });
168   - },
169   - setSort() {
170   - const el = this.$refs.dragTable.$el.querySelectorAll(
171   - '.el-table__body-wrapper > table > tbody'
172   - )[0]
173   - this.sortable = Sortable.create(el, {
174   - ghostClass: 'sortable-ghost', // Class name for the drop placeholder,
175   - setData: function(dataTransfer) {
176   - // to avoid Firefox bug
177   - // Detail see : https://github.com/RubaXa/Sortable/issues/1012
178   - dataTransfer.setData('Text', '')
179   - },
180   - onEnd: evt => {
181   - const targetRow = this.list.splice(evt.oldIndex, 1)[0]
182   - this.list.splice(evt.newIndex, 0, targetRow)
183   -
184   - // for show the changes, you can delete in you code
185   - const tempIndex = this.newList.splice(evt.oldIndex, 1)[0]
186   - this.newList.splice(evt.newIndex, 0, tempIndex)
187   - }
  144 + fetchList(this.listQuery).then(response => {
  145 + this.list = response.data.items
  146 + this.total = response.data.total
  147 + this.listLoading = false
188 148 })
189 149 }
190 150 }
191 151 }
192 152 </script>
193 153  
194   -<style>
195   -.sortable-ghost {
196   - opacity: 0.8;
197   - color: #fff !important;
198   - background: #42b983 !important;
199   -}
200   -</style>
201   -
202 154 <style scoped>
203   -.icon-star {
204   - margin-right: 2px;
205   -}
206   -.drag-handler {
207   - width: 20px;
208   - height: 20px;
209   - cursor: pointer;
  155 +.edit-input {
  156 + padding-right: 100px;
210 157 }
211   -.show-d {
212   - margin-top: 15px;
  158 +.cancel-btn {
  159 + position: absolute;
  160 + right: 15px;
  161 + top: 10px;
213 162 }
214 163 </style>
... ...