From a86b16bba66bd2283ef0acc24ff86ac1ef8adb67 Mon Sep 17 00:00:00 2001 From: "Adam.Gong" Date: Wed, 13 May 2020 02:14:54 +0800 Subject: [PATCH] auto commit the code by alias command --- .env.production | 4 +- mock/index.js | 18 +- mock/prod.js | 106 ++++--- src/api/prod.js | 6 +- src/components/Pagination/index.vue | 5 +- src/lang/zh.js | 5 +- src/router/modules/prod.js | 22 +- src/router/modules/sites.js | 4 +- src/store/modules/settings.js | 18 +- src/utils/request.js | 25 +- src/views/example/list.vue | 75 ++++- src/views/prod/components/Dropdown/Comment.vue | 41 +++ src/views/prod/components/Dropdown/Platform.vue | 46 +++ src/views/prod/components/Dropdown/SourceUrl.vue | 38 +++ src/views/prod/components/Dropdown/index.js | 3 + src/views/prod/components/ProdDetail.vue | 388 +++++++++++++++++++++++ src/views/prod/components/Warning.vue | 10 + src/views/prod/create.vue | 16 + src/views/prod/edit.vue | 13 + src/views/prod/list.vue | 94 +++--- 20 files changed, 799 insertions(+), 138 deletions(-) create mode 100755 src/views/prod/components/Dropdown/Comment.vue create mode 100755 src/views/prod/components/Dropdown/Platform.vue create mode 100755 src/views/prod/components/Dropdown/SourceUrl.vue create mode 100755 src/views/prod/components/Dropdown/index.js create mode 100755 src/views/prod/components/ProdDetail.vue create mode 100755 src/views/prod/components/Warning.vue create mode 100755 src/views/prod/create.vue create mode 100644 src/views/prod/edit.vue diff --git a/.env.production b/.env.production index 80c8103..8858c7b 100644 --- a/.env.production +++ b/.env.production @@ -2,5 +2,5 @@ ENV = 'production' # base api -VUE_APP_BASE_API = '/prod-api' - +#VUE_APP_BASE_API = '/prod-api' +VUE_APP_BASE_API = 'https://api.glass.xiuyetang.com/' diff --git a/mock/index.js b/mock/index.js index 217ee3d..77def8e 100755 --- a/mock/index.js +++ b/mock/index.js @@ -1,15 +1,19 @@ import Mock from 'mockjs' -import { param2Obj } from '../src/utils' +import { + param2Obj +} from '../src/utils' import user from './user' import role from './role' +import prod from './prod' import article from './article' import search from './remote-search' - +//因为没有Mock上,所以会请求不到数据。报404 const mocks = [ ...user, ...role, ...article, + ...prod, ...search ] @@ -20,7 +24,7 @@ export function mockXHR() { // mock patch // https://github.com/nuysoft/Mock/issues/300 Mock.XHR.prototype.proxy_send = Mock.XHR.prototype.send - Mock.XHR.prototype.send = function() { + Mock.XHR.prototype.send = function () { if (this.custom.xhr) { this.custom.xhr.withCredentials = this.withCredentials || false @@ -32,10 +36,14 @@ export function mockXHR() { } function XHR2ExpressReqWrap(respond) { - return function(options) { + return function (options) { let result = null if (respond instanceof Function) { - const { body, type, url } = options + const { + body, + type, + url + } = options // https://expressjs.com/en/4x/api.html#req result = respond({ method: type, diff --git a/mock/prod.js b/mock/prod.js index 7e98179..7cd2792 100644 --- a/mock/prod.js +++ b/mock/prod.js @@ -10,21 +10,29 @@ const image_uri = 'https://wpimg.wallstcn.com/360e4842-4db5-42d0-b078-f9a84a8255 for (let i = 0; i < count; i++) { List.push(Mock.mock({ - pid: '@increment', - pname: '@title(5,10)', - timestamp: +Mock.Random.date('T'), + pid: '@increment', //产品id + pname: '01-8701志平防蓝光-防辐射电脑网课眼镜,TR90弹性漆,近视镜,青春潮流', //产品名移交 + timestamp: +Mock.Random.date('T'), //产品时间 shoper: '@first', //所属工厂 salescount: '@first', //购买次数 - importance: '@integer(1, 3)', //排序权重 - prod_info_weight: '@integer(1, 3)', //重量 - prod_info_leg_long: '@integer(1, 3)', //腿长 - prod_info_glass_width: '@integer(1, 3)', //镜宽 - prod_info_glass_height: '@integer(1, 3)', //镜高 - prod_info_frame_width: '@integer(1, 3)', //框宽 - prod_info_frame_height: '@integer(1, 3)', //框高 - prod_info_norse_width: '@integer(1, 3)', //鼻宽 + importance: '@integer(1, 3)', //排序-权重 + prod_info_weight: '@integer(1, 3)', //参数--->重量 + prod_info_leg_long: '@integer(1, 3)', //参数--->腿长 + prod_info_glass_width: '@integer(1, 3)', //参数--->镜宽 + prod_info_glass_height: '@integer(1, 3)', //参数--->镜高 + prod_info_frame_width: '@integer(1, 3)', //参数--->框宽 + prod_info_frame_height: '@integer(1, 3)', //参数--->框高 + prod_info_norse_width: '@integer(1, 3)', //参数--->鼻宽 prod_info_window_pic: [], //鼻宽 - image_uri: image_uri + image_uri: image_uri, + prod_memo: '', + // 'type|1': ['CN', 'US', 'JP', 'EU'], + // 'status|1': ['published', 'draft'], + 'type|1': ['CN', 'US', 'JP', 'EU'], //本产品销售区域 + 'prod_status|1': ['published', 'draft'], //状态,上线-下线 + judge_list: [], //评论管理 + sku_list: [], //sku清单 + sku_attr: [], //sku属性 })) } @@ -35,23 +43,22 @@ export default [{ const { importance, type, - title, + pname, page = 1, limit = 20, - sort + // sort } = config.query let mockList = List.filter(item => { if (importance && item.importance !== +importance) return false if (type && item.type !== type) return false - if (title && item.title.indexOf(title) < 0) return false + if (pname && item.pname.indexOf(pname) < 0) return false return true }) - if (sort === '-id') { - mockList = mockList.reverse() - } - + // if (sort === '-pid') { + // mockList = mockList.reverse() + // } const pageList = mockList.filter((item, index) => index < limit * page && index >= limit * (page - 1)) return { @@ -63,16 +70,15 @@ export default [{ } } }, - { url: '/yp/prod/detail', type: 'get', response: config => { const { - id + pid } = config.query for (const prod of List) { - if (prod.id === +id) { + if (prod.pid === +pid) { return { code: 20000, data: prod @@ -82,34 +88,34 @@ export default [{ } }, - { - url: '/yp/prod/pv', - type: 'get', - response: _ => { - return { - code: 20000, - data: { - pvData: [{ - key: 'PC', - pv: 1024 - }, - { - key: 'mobile', - pv: 1024 - }, - { - key: 'ios', - pv: 1024 - }, - { - key: 'android', - pv: 1024 - } - ] - } - } - } - }, + // { + // url: '/yp/prod/pv', + // type: 'get', + // response: _ => { + // return { + // code: 20000, + // data: { + // pvData: [{ + // key: 'PC', + // pv: 1024 + // }, + // { + // key: 'mobile', + // pv: 1024 + // }, + // { + // key: 'ios', + // pv: 1024 + // }, + // { + // key: 'android', + // pv: 1024 + // } + // ] + // } + // } + // } + // }, { url: '/yp/prod/create', diff --git a/src/api/prod.js b/src/api/prod.js index 61a6e06..abf406c 100644 --- a/src/api/prod.js +++ b/src/api/prod.js @@ -12,16 +12,16 @@ export function fetchList(query) { return request({ url: '/yp/prod/list', method: 'post', - params: query + data: query }) } -export function fetchArticle(id) { +export function fetchProd(pid) { return request({ url: '/yp/prod/detail', method: 'get', params: { - id + pid } }) } diff --git a/src/components/Pagination/index.vue b/src/components/Pagination/index.vue index c815e13..4d3518b 100755 --- a/src/components/Pagination/index.vue +++ b/src/components/Pagination/index.vue @@ -1,5 +1,8 @@