diff --git a/.env.development b/.env.development index 6e7b816..2463cb9 100644 --- a/.env.development +++ b/.env.development @@ -2,7 +2,8 @@ ENV = 'development' # base api -VUE_APP_BASE_API = '/dev-api' + VUE_APP_BASE_API = '/dev-api' +# VUE_APP_BASE_API = 'http://localhost:8087/' # VUE_APP_BASE_API = 'http://localhost/sys-glass/api/' # vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable, # to control whether the babel-plugin-dynamic-import-node plugin is enabled. diff --git a/mock/prod/list.js b/mock/prod/list.js new file mode 100644 index 0000000..7ff9407 --- /dev/null +++ b/mock/prod/list.js @@ -0,0 +1,135 @@ +import Mock from 'mockjs' +// import logoPath from "~@/assets/img/yp_logo.jpeg" + +const List = [] +const count = 20 + +const baseContent = '
I am testing data, I am testing data.
' +// const image_uri = logoPath +const image_uri = 'https://wpimg.wallstcn.com/360e4842-4db5-42d0-b078-f9a84a825546.gif' + +for (let i = 0; i < count; i++) { + List.push(Mock.mock({ + pid: '@increment', + pname: '@title(5,10)', + 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)', //鼻宽 + prod_info_window_pic: [], //鼻宽 + image_uri: image_uri + })) +} + +export default [{ + url: '/yp/prod/list', + type: 'post', + response: config => { + const { + importance, + type, + title, + page = 1, + limit = 20, + 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 + // return true + // }) + + if (sort === '-id') { + mockList = mockList.reverse() + } + + const pageList = mockList.filter((item, index) => index < limit * page && index >= limit * (page - 1)) + + return { + code: 20000, + data: { + total: mockList.length, + items: pageList + } + } + } + }, + + // { + // url: '/yp/prod/detail', + // type: 'get', + // response: config => { + // const { + // id + // } = config.query + // for (const article of List) { + // if (article.id === +id) { + // return { + // code: 20000, + // data: article + // } + // } + // } + // } + // }, + + // { + // url: '/yp/article/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/article/create', + // type: 'post', + // response: _ => { + // return { + // code: 20000, + // data: 'success' + // } + // } + // }, + + // { + // url: '/yp/article/update', + // type: 'post', + // response: _ => { + // return { + // code: 20000, + // data: 'success' + // } + // } + // } +] diff --git a/src/api/prod.js b/src/api/prod.js index e69de29..8a7984b 100644 --- a/src/api/prod.js +++ b/src/api/prod.js @@ -0,0 +1,64 @@ +import request from '@/utils/request' +import { + Notification +} from 'element-ui' +// export const getPersonInfo = data => { +// return service({ +// url: '/person_pay/getpersoninfo', +// method: 'post', +// data +// }) +// } + +export function fetchList(query) { + // console.log('api/prod/list/ ==fetchList=== query', query); + const options = { + type: 'error', + message: query, + title: '==query value ===', + showClose: true, + duration: 4000 + } + Notification(options) + return request({ + url: '/yp/prod/list', + method: 'post', + params: query + }) +} + +// export function fetchArticle(id) { +// return request({ +// url: '/yp/article/detail', +// method: 'get', +// params: { +// id +// } +// }) +// } + +// export function fetchPv(pv) { +// return request({ +// url: '/yp/article/pv', +// method: 'get', +// params: { +// pv +// } +// }) +// } + +// export function createArticle(data) { +// return request({ +// url: '/yp/article/create', +// method: 'post', +// data +// }) +// } + +// export function updateArticle(data) { +// return request({ +// url: '/yp/article/update', +// method: 'post', +// data +// }) +// } diff --git a/src/api/user.js b/src/api/user.js index 3dc8a73..22bc285 100755 --- a/src/api/user.js +++ b/src/api/user.js @@ -16,7 +16,9 @@ export function getInfo(token) { return request({ url: '/yp/user/info', method: 'get', - params: { token } + params: { + token + } }) } diff --git a/src/lang/zh.js b/src/lang/zh.js index 0a179b4..03e490d 100755 --- a/src/lang/zh.js +++ b/src/lang/zh.js @@ -74,7 +74,10 @@ export default { admin: '超级管理员' }, shopers: '厂商', - prods: '产品', + prods: { + prod_menu: '产品', + prodlist: '产品列表' + }, orders: '订单', sites: '站点', metas: { diff --git a/src/router/index.js b/src/router/index.js index 2a8419c..32479fd 100755 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,7 +7,7 @@ Vue.use(Router) import Layout from '@/layout' /* Router Modules */ -// import componentsRouter from './modules/components' +import componentsRouter from './modules/components' // import chartsRouter from './modules/charts' // import tableRouter from './modules/table' // import nestedRouter from './modules/nested' @@ -189,57 +189,67 @@ export const asyncRoutes = [ prodRouter, orderRouter, sitesRouter, - - // { - // path: '/icon', - // component: Layout, - // children: [ - // { - // path: 'index', - // component: () => import('@/views/icons/index'), - // name: 'Icons', - // meta: { title: 'icons', icon: 'icon', noCache: true } - // } - // ] - // }, systemRouter, - /** when your routing map is too long, you can split it into small modules **/ - // componentsRouter, + componentsRouter, // chartsRouter, // nestedRouter, // tableRouter, + { + path: '/icon', + component: Layout, + children: [{ + path: 'index', + component: () => import('@/views/icons/index'), + name: 'Icons', + meta: { + title: 'icons', + icon: 'icon', + noCache: true + } + }] + }, + /** when your routing map is too long, you can split it into small modules **/ - // { - // path: '/example', - // component: Layout, - // redirect: '/example/list', - // name: 'Example', - // meta: { - // title: 'example', - // icon: 'example' - // }, - // children: [ - // { - // path: 'create', - // component: () => import('@/views/example/create'), - // name: 'CreateArticle', - // meta: { title: 'createArticle', icon: 'edit' } - // }, - // { - // path: 'edit/:id(\\d+)', - // component: () => import('@/views/example/edit'), - // name: 'EditArticle', - // meta: { title: 'editArticle', noCache: true, activeMenu: '/example/list' }, - // hidden: true - // }, - // { - // path: 'list', - // component: () => import('@/views/example/list'), - // name: 'ArticleList', - // meta: { title: 'articleList', icon: 'list' } - // } - // ] - // }, + { + path: '/example', + component: Layout, + redirect: '/example/list', + name: 'Example', + meta: { + title: 'example', + icon: 'example' + }, + children: [{ + path: 'create', + component: () => import('@/views/example/create'), + name: 'CreateArticle', + meta: { + title: 'createArticle', + icon: 'edit' + } + }, + { + path: 'edit/:id(\\d+)', + component: () => import('@/views/example/edit'), + name: 'EditArticle', + meta: { + title: 'editArticle', + noCache: true, + activeMenu: '/example/list' + }, + hidden: true + }, + { + path: 'list', + component: () => import('@/views/example/list'), + name: 'ArticleList', + meta: { + title: 'articleList', + icon: 'list' + } + } + ] + }, // { // path: '/tab', diff --git a/src/router/modules/meta.js b/src/router/modules/meta.js index 57b7cd8..85746d4 100644 --- a/src/router/modules/meta.js +++ b/src/router/modules/meta.js @@ -12,7 +12,7 @@ const metaRouter = { roles: ['admin', 'assistant'] // you can set roles in root nav }, children: [{ - path: 'page', + path: 'metapage', component: () => import('@/views/meta/tree'), name: 'MetaList', meta: { diff --git a/src/router/modules/order.js b/src/router/modules/order.js index d28741e..48b0527 100644 --- a/src/router/modules/order.js +++ b/src/router/modules/order.js @@ -14,11 +14,11 @@ const orderRouter = { roles: ['admin', 'assistant', 'runner', 'shoper'] // you can set roles in root nav }, children: [{ - path: 'page', + path: 'orderpage', component: () => import('@/views/order/list'), - name: 'OrderList', + name: 'list', meta: { - title: 'OrderList', + title: 'orders', roles: ['admin', 'assistant', 'runner', 'shoper'] // or you can only set roles in sub nav } }] diff --git a/src/router/modules/prod.js b/src/router/modules/prod.js index c06f1e0..5bda2a8 100644 --- a/src/router/modules/prod.js +++ b/src/router/modules/prod.js @@ -3,42 +3,44 @@ import Layout from '@/layout' const prodRouter = { - path: '/prods', + path: '/prod', component: Layout, redirect: '/prod/page', alwaysShow: true, // will always show the root menu name: 'Prod', meta: { - title: 'prods', // 会自动被i18n替换 + title: 'prods.prod_menu', // 会自动被i18n替换 icon: 'star', roles: ['admin', 'assistant', 'runner', 'shoper'] // you can set roles in root nav }, - children: [{ - path: 'page', - component: () => import('@/views/permission/page'), - name: 'ProdList', - meta: { - title: 'ProdList', - roles: ['admin', 'assistant', 'runner', 'shoper'] + children: [ + // { + // path: 'page', + // component: () => import('@/views/permission/page'), + // name: 'ProdList', + // meta: { + // title: 'ProdList', + // roles: ['admin', 'assistant', 'runner', 'shoper'] + // } + // }, + // { + // path: 'defined', + // component: () => import('@/views/permission/directive'), + // name: 'ProdDefiend', + // meta: { + // title: 'ProdDefiend', + // roles: ['admin', 'assistant', 'shoper'] + // } + // }, + { + path: 'list', + component: () => import('@/views/prod/list'), + name: 'prodList', + meta: { + title: 'prods.prodlist', + roles: ['admin', 'assistant', 'shoper', 'runner'] + } } - }, - { - path: 'defined', - component: () => import('@/views/permission/directive'), - name: 'ProdDefiend', - meta: { - title: 'ProdDefiend', - roles: ['admin', 'assistant', 'shoper'] - } - }, { - path: 'defined2', - component: () => import('@/views/prod/list'), - name: 'prod...', - meta: { - title: '产品列表', - roles: ['admin', 'assistant', 'shoper'] - } - } ] } diff --git a/src/router/modules/sites.js b/src/router/modules/sites.js index 6ce6943..962cce0 100644 --- a/src/router/modules/sites.js +++ b/src/router/modules/sites.js @@ -12,7 +12,7 @@ const sitesRouter = { roles: ['admin', 'assistant', 'runner'] // you can set roles in root nav }, children: [{ - path: 'page', + path: 'sitepage', component: () => import('@/views/site/list'), name: 'SiteList', meta: { diff --git a/src/router/modules/system.js b/src/router/modules/system.js index 31e917d..73b3eee 100644 --- a/src/router/modules/system.js +++ b/src/router/modules/system.js @@ -12,36 +12,36 @@ const systemRouter = { roles: ['admin', 'assistant'] // you can set roles in root nav }, children: [{ - path: 'page', + path: 'systempage2', component: () => import('@/views/example/list'), - name: 'SystemList', + name: 'SystemList1', meta: { title: 'systems.sites', roles: ['admin', 'assistant'] // or you can only set roles in sub nav } }, { - path: 'page', + path: 'sytempage2', component: () => import('@/views/example/list'), - name: 'SystemList', + name: 'SystemList2', meta: { title: 'systems.money', roles: ['admin', 'assistant'] // or you can only set roles in sub nav } }, { - path: 'page', + path: 'systempage3', component: () => import('@/views/example/list'), - name: 'SystemList', + name: 'SystemList3', meta: { title: 'systems.industry', roles: ['admin', 'assistant'] // or you can only set roles in sub nav } }, { - path: 'page', + path: 'systempage4', component: () => import('@/views/example/list'), - name: 'SystemList', + name: 'SystemList4', meta: { title: 'systems.template', roles: ['admin', 'assistant'] // or you can only set roles in sub nav diff --git a/src/store/modules/prod.js b/src/store/modules/prod.js new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/src/store/modules/prod.js @@ -0,0 +1 @@ + diff --git a/src/utils/request.js b/src/utils/request.js index b1a9bb8..b231657 100755 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -12,7 +12,9 @@ import { } from '@/utils/auth' // const baseUrl = 'http://localhost/sys-glass/api'; -const baseUrl = process.env.VUE_APP_BASE_API // url = base url + request url +// const baseUrl = 'http://localhost:8087'; +const baseUrl = '/dev-api' +// const baseUrl = process.env.VUE_APP_BASE_API // url = base url + request url // create an axios instance const service = axios.create({ // baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url diff --git a/src/views/prod/list.vue b/src/views/prod/list.vue index 02cb401..5e89737 100755 --- a/src/views/prod/list.vue +++ b/src/views/prod/list.vue @@ -13,7 +13,7 @@ >