Showing
43 changed files
with
262 additions
and
226 deletions
1 | import Vue from 'vue'; | 1 | import Vue from 'vue'; |
2 | -import Router from 'vue-router'; | ||
3 | import Promise from 'promise-polyfill'; | 2 | import Promise from 'promise-polyfill'; |
4 | import App from './pages/app'; | 3 | import App from './pages/app'; |
5 | -import Routers from './pages'; | ||
6 | import yohoPluginCore from './plugins/yoho-plugin-core'; | 4 | import yohoPluginCore from './plugins/yoho-plugin-core'; |
5 | +import yohoPluginRouter from './plugins/yoho-plugin-router'; | ||
7 | import yohoPluginAuth from './plugins/yoho-plugin-auth'; | 6 | import yohoPluginAuth from './plugins/yoho-plugin-auth'; |
8 | import './filters'; | 7 | import './filters'; |
9 | import './directives'; | 8 | import './directives'; |
@@ -27,17 +26,13 @@ if (!window.Promise) { | @@ -27,17 +26,13 @@ if (!window.Promise) { | ||
27 | window.Promise = Promise; | 26 | window.Promise = Promise; |
28 | } | 27 | } |
29 | 28 | ||
30 | -let router = new Router({ | ||
31 | - routes: Routers, | ||
32 | - mode: 'history' | ||
33 | -}); | ||
34 | 29 | ||
35 | -Vue.use(yohoPluginCore, {router}); | 30 | +Vue.use(yohoPluginCore); |
31 | +Vue.use(yohoPluginRouter); | ||
36 | Vue.use(yohoPluginAuth); | 32 | Vue.use(yohoPluginAuth); |
37 | 33 | ||
38 | Vue.render({ | 34 | Vue.render({ |
39 | el: '#app', | 35 | el: '#app', |
40 | - router, | ||
41 | template: '<App/>', | 36 | template: '<App/>', |
42 | components: {App} | 37 | components: {App} |
43 | }); | 38 | }); |
app/pages/auth/index.js
deleted
100644 → 0
app/pages/auth/login/index.js
deleted
100644 → 0
1 | -const page = r => require.ensure([], () => r(require('./error')), 'error'); | 1 | +const home = r => require.ensure([], () => r(require('./login')), 'login'); |
2 | +const error = r => require.ensure([], () => r(require('./error')), 'error'); | ||
2 | 3 | ||
3 | const router = [{ | 4 | const router = [{ |
5 | + path: '/login.html', | ||
6 | + name: 'login', | ||
7 | + component: home, | ||
8 | + meta: { | ||
9 | + authPass: true | ||
10 | + } | ||
11 | +}, { | ||
4 | path: '/401.html', | 12 | path: '/401.html', |
5 | name: 'error.401', | 13 | name: 'error.401', |
6 | - component: page, | 14 | + component: error, |
7 | meta: { | 15 | meta: { |
8 | authPass: true | 16 | authPass: true |
9 | } | 17 | } |
10 | }, { | 18 | }, { |
11 | path: '*', | 19 | path: '*', |
12 | name: 'error.404', | 20 | name: 'error.404', |
13 | - component: page, | 21 | + component: error, |
14 | meta: { | 22 | meta: { |
15 | authPass: true | 23 | authPass: true |
16 | } | 24 | } |
17 | }, { | 25 | }, { |
18 | path: '/500.html', | 26 | path: '/500.html', |
19 | name: 'error.500', | 27 | name: 'error.500', |
20 | - component: page, | 28 | + component: error, |
21 | meta: { | 29 | meta: { |
22 | authPass: true | 30 | authPass: true |
23 | } | 31 | } |
app/pages/finance/check/index.js
deleted
100644 → 0
app/pages/finance/clearing-iframe/index.js
0 → 100644
1 | -const page = r => require.ensure([], () => r(require('./balance')), 'finance.balance'); | 1 | +const page = r => require.ensure([], () => r(require('./clearing')), 'finance.clearing'); |
2 | 2 | ||
3 | export default { | 3 | export default { |
4 | - path: '/balance.html', | ||
5 | - name: 'balance', | 4 | + path: '/clearing.html', |
5 | + name: 'clearing', | ||
6 | component: page, | 6 | component: page, |
7 | meta: { | 7 | meta: { |
8 | pageName: '结算单' | 8 | pageName: '结算单' |
9 | } | 9 | } |
10 | }; | 10 | }; |
11 | - |
1 | -import balance from './balance'; | ||
2 | -import store from './store'; | 1 | +import clearing from './clearing-iframe'; |
2 | +import payment from './payment-iframe'; | ||
3 | 3 | ||
4 | -let routers = [balance, store]; | ||
5 | - | ||
6 | -routers.forEach(router => { | ||
7 | - router.path = `/finance${router.path}`; | ||
8 | - router.name = `finance.${router.name}`; | ||
9 | -}); | ||
10 | - | ||
11 | -export default routers; | 4 | +export default { |
5 | + clearing, | ||
6 | + payment | ||
7 | +}; |
1 | -const page = r => require.ensure([], () => r(require('./store')), 'finance.store'); | 1 | +const page = r => require.ensure([], () => r(require('./payment')), 'finance.payment'); |
2 | 2 | ||
3 | export default { | 3 | export default { |
4 | - path: '/store.html', | ||
5 | - name: 'store', | 4 | + path: '/payment.html', |
5 | + name: 'payment', | ||
6 | component: page, | 6 | component: page, |
7 | meta: { | 7 | meta: { |
8 | pageName: '结算单' | 8 | pageName: '结算单' |
app/pages/finance/payment-iframe/payment.vue
0 → 100644
1 | -const page = r => require.ensure([], () => r(require('./decoration')), 'shop.decoration'); | 1 | +const page = r => require.ensure([], () => r(require('./payment')), 'finance.payment'); |
2 | 2 | ||
3 | export default { | 3 | export default { |
4 | - path: '/decoration.html', | ||
5 | - name: 'decoration', | 4 | + path: '/payment.html', |
5 | + name: 'payment', | ||
6 | component: page, | 6 | component: page, |
7 | meta: { | 7 | meta: { |
8 | - pageName: '店铺装修' | 8 | + pageName: '结算单' |
9 | } | 9 | } |
10 | }; | 10 | }; |
11 | + |
1 | - | ||
2 | import home from './home'; | 1 | import home from './home'; |
3 | import product from './product'; | 2 | import product from './product'; |
4 | import shop from './shop'; | 3 | import shop from './shop'; |
@@ -6,19 +5,11 @@ import repository from './repository'; | @@ -6,19 +5,11 @@ import repository from './repository'; | ||
6 | import statistics from './statistics'; | 5 | import statistics from './statistics'; |
7 | import finance from './finance'; | 6 | import finance from './finance'; |
8 | 7 | ||
9 | -let routers = [product, home, shop, repository, statistics, finance]; | ||
10 | - | ||
11 | -let childrenRoutes = [].concat(...routers); | ||
12 | - | ||
13 | -import layout from './layout'; | ||
14 | -let routes = [{ | ||
15 | - path: '/', | ||
16 | - component: layout, | ||
17 | - children: childrenRoutes | ||
18 | -}]; | ||
19 | - | ||
20 | -import error from './error'; | ||
21 | -import auth from './auth'; | ||
22 | -routes = routes.concat(auth, error); | ||
23 | - | ||
24 | -export default routes; | 8 | +export default { |
9 | + product, | ||
10 | + home, | ||
11 | + shop, | ||
12 | + repository, | ||
13 | + statistics, | ||
14 | + finance | ||
15 | +}; |
@@ -8,21 +8,21 @@ const step3 = r => require.ensure([], () => r(require('./step3')), 'product.crea | @@ -8,21 +8,21 @@ const step3 = r => require.ensure([], () => r(require('./step3')), 'product.crea | ||
8 | 8 | ||
9 | export default [{ | 9 | export default [{ |
10 | path: 'step1.html', | 10 | path: 'step1.html', |
11 | - name: 'product.create.step1', | 11 | + name: 'step1', |
12 | component: step1, | 12 | component: step1, |
13 | meta: { | 13 | meta: { |
14 | pageName: '类目选择', | 14 | pageName: '类目选择', |
15 | } | 15 | } |
16 | }, { | 16 | }, { |
17 | path: 'step2.html', | 17 | path: 'step2.html', |
18 | - name: 'product.create.step2', | 18 | + name: 'step2', |
19 | component: step2, | 19 | component: step2, |
20 | meta: { | 20 | meta: { |
21 | pageName: '基础信息', | 21 | pageName: '基础信息', |
22 | } | 22 | } |
23 | }, { | 23 | }, { |
24 | path: 'step3.html', | 24 | path: 'step3.html', |
25 | - name: 'product.create.step3', | 25 | + name: 'step3', |
26 | component: step3, | 26 | component: step3, |
27 | meta: { | 27 | meta: { |
28 | pageName: '网销信息', | 28 | pageName: '网销信息', |
1 | import create from './create'; | 1 | import create from './create'; |
2 | import edit from './edit'; | 2 | import edit from './edit'; |
3 | -import show from './show'; | ||
4 | import onsale from './onsale'; | 3 | import onsale from './onsale'; |
5 | import offsale from './offsale'; | 4 | import offsale from './offsale'; |
6 | import output from './output'; | 5 | import output from './output'; |
7 | 6 | ||
8 | -let routers = [create, edit, show, onsale, offsale, output]; | ||
9 | - | ||
10 | -routers.forEach(router => { | ||
11 | - router.path = `/product${router.path}`; | ||
12 | - router.name = `product.${router.name}`; | ||
13 | -}); | ||
14 | - | ||
15 | -export default routers; | 7 | +export default { |
8 | + create, | ||
9 | + edit, | ||
10 | + onsale, | ||
11 | + offsale, | ||
12 | + output | ||
13 | +}; |
app/pages/product/show/index.js
deleted
100644 → 0
app/pages/repository/diff-iframe/diff.vue
0 → 100644
1 | /** | 1 | /** |
2 | + * 发货入库差异 | ||
2 | * Created by TaoHuang on 2017/5/4. | 3 | * Created by TaoHuang on 2017/5/4. |
3 | */ | 4 | */ |
4 | 5 | ||
5 | -const page = r => require.ensure([], () => r(require('./info')), 'statistics.info'); | 6 | +const page = r => require.ensure([], () => r(require('./diff')), 'repository.diff'); |
6 | 7 | ||
7 | export default { | 8 | export default { |
8 | - path: '/info.html', | ||
9 | - name: 'info', | 9 | + path: '/diff.html', |
10 | + name: 'diff', | ||
10 | component: page, | 11 | component: page, |
11 | meta: { | 12 | meta: { |
12 | - pageName: '经营总览' | 13 | + pageName: '差异库存' |
13 | } | 14 | } |
14 | }; | 15 | }; |
@@ -2,14 +2,10 @@ | @@ -2,14 +2,10 @@ | ||
2 | * Created by TaoHuang on 2017/5/4. | 2 | * Created by TaoHuang on 2017/5/4. |
3 | */ | 3 | */ |
4 | 4 | ||
5 | -import diff from './diff'; | 5 | +import diff from './diff-iframe'; |
6 | import jit from './jit'; | 6 | import jit from './jit'; |
7 | 7 | ||
8 | -let routers = [diff, jit]; | ||
9 | - | ||
10 | -routers.forEach(router => { | ||
11 | - router.path = `/repository${router.path}`; | ||
12 | - router.name = `repository.${router.name}`; | ||
13 | -}); | ||
14 | - | ||
15 | -export default routers; | 8 | +export default { |
9 | + diff, | ||
10 | + jit | ||
11 | +}; |
app/pages/shop/decoration-iframe/index.js
0 → 100644
1 | +const decoration = r => require.ensure([], () => r(require('./decoration')), 'shop.decoration'); | ||
2 | +const shops = r => require.ensure([], () => r(require('./decoration')), 'shop.shops'); | ||
3 | + | ||
4 | + | ||
5 | +export default [ | ||
6 | + { | ||
7 | + path: '/shops.html', | ||
8 | + name: 'shops', | ||
9 | + component: shops, | ||
10 | + meta: { | ||
11 | + pageName: '店铺列表' | ||
12 | + } | ||
13 | + }, | ||
14 | + { | ||
15 | + path: '/decoration.html', | ||
16 | + name: 'decoration', | ||
17 | + component: decoration, | ||
18 | + meta: { | ||
19 | + pageName: '店铺装修' | ||
20 | + } | ||
21 | + } | ||
22 | +]; |
app/pages/shop/decoration-iframe/shops.vue
0 → 100644
1 | -<template> | ||
2 | -<LayoutBody> | ||
3 | - <IFrame src="http://shops.yohobuy.com/supplier/shop/decorationDetail/792/1/editor/1576/"></IFrame> | ||
4 | -</LayoutBody> | ||
5 | -</template> | ||
6 | - | ||
7 | -<script> | ||
8 | - | ||
9 | -export default { | ||
10 | - created() { | ||
11 | - }, | ||
12 | - data() { | ||
13 | - return { | ||
14 | - }; | ||
15 | - }, | ||
16 | - methods: { | ||
17 | - } | ||
18 | -}; | ||
19 | -</script> | ||
20 | - | ||
21 | -<style lang="scss"> | ||
22 | -</style> |
1 | import info from './info'; | 1 | import info from './info'; |
2 | -import decoration from './decoration'; | 2 | +import decoration from './decoration-iframe'; |
3 | 3 | ||
4 | -let routers = [info, decoration]; | ||
5 | - | ||
6 | -routers.forEach(router => { | ||
7 | - router.path = `/shop${router.path}`; | ||
8 | - router.name = `shop.${router.name}`; | ||
9 | -}); | ||
10 | - | ||
11 | -export default routers; | 4 | +export default { |
5 | + info, | ||
6 | + decoration | ||
7 | +}; |
1 | -/** | ||
2 | - * Created by TaoHuang on 2017/5/4. | ||
3 | - */ | 1 | +import overview from './overview-iframe'; |
2 | +import sale from './sale'; | ||
4 | 3 | ||
5 | -import info from './info'; | ||
6 | - | ||
7 | -let routers = [info]; | ||
8 | - | ||
9 | -routers.forEach(router => { | ||
10 | - router.path = `/statistics${router.path}`; | ||
11 | - router.name = `statistics.${router.name}`; | ||
12 | -}); | ||
13 | - | ||
14 | -export default routers; | 4 | +export default { |
5 | + overview, | ||
6 | + sale | ||
7 | +}; |
app/pages/statistics/info/info.vue
deleted
100644 → 0
1 | -/** | ||
2 | - * Created by TaoHuang on 2017/5/4. | ||
3 | - */ | ||
4 | - | ||
5 | -<template> | ||
6 | - <LayoutBody> | ||
7 | - <IFrame src="http://shops.yohobuy.com/supplier/shop/decorationDetail/792/1/editor/1576/"></IFrame> | ||
8 | - </LayoutBody> | ||
9 | -</template> | ||
10 | - | ||
11 | -<script> | ||
12 | - | ||
13 | - export default { | ||
14 | - created() { | ||
15 | - }, | ||
16 | - data() { | ||
17 | - return { | ||
18 | - }; | ||
19 | - }, | ||
20 | - methods: { | ||
21 | - } | ||
22 | - }; | ||
23 | -</script> | ||
24 | - | ||
25 | -<style lang="scss"> | ||
26 | -</style> |
app/pages/statistics/sale/index.js
0 → 100644
app/pages/statistics/sale/sale.vue
0 → 100644
@@ -55,7 +55,7 @@ const plugin = { | @@ -55,7 +55,7 @@ const plugin = { | ||
55 | 55 | ||
56 | if (authPass) { | 56 | if (authPass) { |
57 | // 已登录跳转到首页 | 57 | // 已登录跳转到首页 |
58 | - if (to.name === 'auth.login' && Vue.$isLogin) { | 58 | + if (to.name === 'login' && Vue.$isLogin) { |
59 | return next('/'); | 59 | return next('/'); |
60 | } | 60 | } |
61 | return next(); | 61 | return next(); |
@@ -86,7 +86,7 @@ const plugin = { | @@ -86,7 +86,7 @@ const plugin = { | ||
86 | } | 86 | } |
87 | }; | 87 | }; |
88 | Vue.switchShop = shopsId => { | 88 | Vue.switchShop = shopsId => { |
89 | - Vue.$cookie.set('shopsId', shopsId, { | 89 | + Vue.$cookie.set('_sign', shopsId, { |
90 | path: '/' | 90 | path: '/' |
91 | }); | 91 | }); |
92 | }; | 92 | }; |
1 | /** | 1 | /** |
2 | * 插件 | 2 | * 插件 |
3 | */ | 3 | */ |
4 | -import iView from 'iview'; | ||
5 | import Router from 'vue-router'; | 4 | import Router from 'vue-router'; |
5 | +import iView from 'iview'; | ||
6 | import store from 'yoho-store'; | 6 | import store from 'yoho-store'; |
7 | import cookie from 'yoho-cookie'; | 7 | import cookie from 'yoho-cookie'; |
8 | import components from '../components/global'; | 8 | import components from '../components/global'; |
@@ -11,32 +11,15 @@ import config from 'config'; | @@ -11,32 +11,15 @@ import config from 'config'; | ||
11 | import _ from 'lodash'; | 11 | import _ from 'lodash'; |
12 | 12 | ||
13 | const plugin = { | 13 | const plugin = { |
14 | - install(Vue, options) { | ||
15 | - // 加载核心插件 | ||
16 | - Vue.use(iView); | ||
17 | - Vue.use(Router); | ||
18 | - | ||
19 | - | ||
20 | - Vue.prop = (key, value) => { | ||
21 | - Vue[`$${key}`] = Vue.prototype[`$${key}`] = value; | ||
22 | - }; | ||
23 | - | ||
24 | - // 附加Vue原型属性 | ||
25 | - if (config) { | ||
26 | - Vue.prop('config', config); | ||
27 | - } | ||
28 | - if (options && options.router) { | ||
29 | - Vue.$router = options.router; | ||
30 | - } | ||
31 | - Vue.prop('store', store); | ||
32 | - Vue.prop('cookie', cookie); | ||
33 | - | ||
34 | - | ||
35 | - // 加载核心组件 | 14 | + loadGlobalComponents(Vue) { |
36 | _.each(components, component => { | 15 | _.each(components, component => { |
37 | Vue.component(component.name, component); | 16 | Vue.component(component.name, component); |
38 | }); | 17 | }); |
39 | - | 18 | + }, |
19 | + defineVueProp(Vue) { | ||
20 | + Vue.prop = (key, value) => { | ||
21 | + Vue[`$${key}`] = Vue.prototype[`$${key}`] = value; | ||
22 | + }; | ||
40 | Vue.beforeRender = []; | 23 | Vue.beforeRender = []; |
41 | Vue.render = opts => { | 24 | Vue.render = opts => { |
42 | return new Promise(resolve => { | 25 | return new Promise(resolve => { |
@@ -56,13 +39,31 @@ const plugin = { | @@ -56,13 +39,31 @@ const plugin = { | ||
56 | resolve(); | 39 | resolve(); |
57 | } | 40 | } |
58 | }).then(() => { | 41 | }).then(() => { |
59 | - return new Vue(opts); | 42 | + return new Vue(Object.assign(opts, { |
43 | + router: Vue.$router | ||
44 | + })); | ||
60 | }); | 45 | }); |
61 | }; | 46 | }; |
47 | + }, | ||
48 | + install(Vue) { | ||
49 | + // 定义Vue全局属性 | ||
50 | + this.defineVueProp(Vue); | ||
51 | + | ||
52 | + // 加载核心组件 | ||
53 | + this.loadGlobalComponents(Vue); | ||
54 | + | ||
55 | + // 加载核心插件 | ||
56 | + Vue.use(iView); | ||
57 | + Vue.use(Router); | ||
58 | + | ||
59 | + // 附加Vue原型属性 | ||
60 | + Vue.prop('config', config); | ||
61 | + Vue.prop('store', store); | ||
62 | + Vue.prop('cookie', cookie); | ||
62 | 63 | ||
63 | // 设置axios默认参数 | 64 | // 设置axios默认参数 |
64 | - axios.defaults.baseURL = '/Api'; | ||
65 | - axios.defaults.responseType = 'json'; | 65 | + axios.defaults.baseURL = config.axiosBaseUrl; |
66 | + axios.defaults.responseType = config.axiosResponseType; | ||
66 | } | 67 | } |
67 | }; | 68 | }; |
68 | 69 |
app/plugins/yoho-plugin-router.js
0 → 100644
1 | +import Router from 'vue-router'; | ||
2 | +import config from 'config'; | ||
3 | +import pageRoutes from '../pages'; | ||
4 | +import layout from '../pages/layout'; | ||
5 | +import common from '../pages/common'; | ||
6 | +import _ from 'lodash'; | ||
7 | + | ||
8 | +const plugin = { | ||
9 | + loadRouters(rous, paths, children) { | ||
10 | + if (_.has(rous, 'path')) { | ||
11 | + let ps = _.flattenDeep(paths).filter(p => p); | ||
12 | + | ||
13 | + rous.name = _.join(ps, '.'); | ||
14 | + if (!children) { | ||
15 | + if (rous.path) { | ||
16 | + rous.path = _.join(_.dropRight(ps, 1), '/') + (rous.path[0] === '/' ? '' : '/') + rous.path; | ||
17 | + } else { | ||
18 | + rous.path = _.join(ps, '/') + '.html'; | ||
19 | + } | ||
20 | + } | ||
21 | + | ||
22 | + if (rous.children) { | ||
23 | + _.each(rous.children, child => this.loadRouters(child, [paths, child.name], true)); | ||
24 | + return [rous]; | ||
25 | + } | ||
26 | + return [rous]; | ||
27 | + } | ||
28 | + if (rous.length) { | ||
29 | + return _.map(rous, r => { | ||
30 | + return this.loadRouters(r, [paths]); | ||
31 | + }); | ||
32 | + } else { | ||
33 | + return _.map(rous, (rou, k) => { | ||
34 | + return this.loadRouters(rou, [paths, k]); | ||
35 | + }); | ||
36 | + } | ||
37 | + }, | ||
38 | + install(Vue) { | ||
39 | + let childRouters = this.loadRouters(pageRoutes); | ||
40 | + console.log(_.flattenDeep(childRouters)) | ||
41 | + let routes = [{ | ||
42 | + path: '/', | ||
43 | + component: layout, | ||
44 | + children: _.flattenDeep(childRouters) | ||
45 | + }]; | ||
46 | + | ||
47 | + routes = routes.concat(common); | ||
48 | + Vue.$router = new Router({ | ||
49 | + routes: routes, | ||
50 | + mode: config.historyMode | ||
51 | + }); | ||
52 | + } | ||
53 | +}; | ||
54 | + | ||
55 | +export default plugin; |
@@ -77,11 +77,18 @@ export default [ | @@ -77,11 +77,18 @@ export default [ | ||
77 | sub: [ | 77 | sub: [ |
78 | { | 78 | { |
79 | menu_name: '经营总览', | 79 | menu_name: '经营总览', |
80 | - menu_url: '/statistics/info.html', | ||
81 | - menu_id: 'statistics.info', | 80 | + menu_url: '/statistics/overview.html', |
81 | + menu_id: 'statistics.overview', | ||
82 | status: 1, | 82 | status: 1, |
83 | id: 41 | 83 | id: 41 |
84 | }, | 84 | }, |
85 | + { | ||
86 | + menu_name: '销售统计', | ||
87 | + menu_url: '/statistics/sale.html', | ||
88 | + menu_id: 'statistics.sale', | ||
89 | + status: 1, | ||
90 | + id: 42 | ||
91 | + }, | ||
85 | ], | 92 | ], |
86 | menu_name: '数据报表', | 93 | menu_name: '数据报表', |
87 | menu_id: 'statistics', | 94 | menu_id: 'statistics', |
@@ -91,16 +98,16 @@ export default [ | @@ -91,16 +98,16 @@ export default [ | ||
91 | { | 98 | { |
92 | sub: [ | 99 | sub: [ |
93 | { | 100 | { |
94 | - menu_name: '查看明细', | ||
95 | - menu_url: '/finance/balance.html', | ||
96 | - menu_id: 'finance.balance', | 101 | + menu_name: '对账单', |
102 | + menu_url: '/finance/clearing.html', | ||
103 | + menu_id: 'finance.clearing', | ||
97 | status: 1, | 104 | status: 1, |
98 | id: 51 | 105 | id: 51 |
99 | }, | 106 | }, |
100 | { | 107 | { |
101 | - menu_name: '库存', | ||
102 | - menu_url: '/finance/store.html', | ||
103 | - menu_id: 'finance.store', | 108 | + menu_name: '结算单', |
109 | + menu_url: '/finance/payment.html', | ||
110 | + menu_id: 'finance.payment', | ||
104 | status: 1, | 111 | status: 1, |
105 | id: 52 | 112 | id: 52 |
106 | } | 113 | } |
@@ -68,7 +68,7 @@ class UserController extends Context { | @@ -68,7 +68,7 @@ class UserController extends Context { | ||
68 | domain: '.yohobuy.com' | 68 | domain: '.yohobuy.com' |
69 | }); | 69 | }); |
70 | res.clearCookie('_isLogin'); | 70 | res.clearCookie('_isLogin'); |
71 | - res.clearCookie('shopsId'); | 71 | + res.clearCookie('_sign'); |
72 | res.clearCookie('yoho-shop'); | 72 | res.clearCookie('yoho-shop'); |
73 | res.clearCookie('yoho-shop.sig'); | 73 | res.clearCookie('yoho-shop.sig'); |
74 | return res.json({ | 74 | return res.json({ |
@@ -93,7 +93,7 @@ class UserController extends Context { | @@ -93,7 +93,7 @@ class UserController extends Context { | ||
93 | context.res.cookie('_isLogin', true, { | 93 | context.res.cookie('_isLogin', true, { |
94 | path: '/' | 94 | path: '/' |
95 | }); | 95 | }); |
96 | - context.res.cookie('shopsId', user.currentShop.id, { | 96 | + context.res.cookie('_sign', user.currentShop.id, { |
97 | path: '/' | 97 | path: '/' |
98 | }); | 98 | }); |
99 | } | 99 | } |
@@ -42,7 +42,7 @@ module.exports = (req, res, next) => { | @@ -42,7 +42,7 @@ module.exports = (req, res, next) => { | ||
42 | }); | 42 | }); |
43 | } | 43 | } |
44 | let userShops = req.user.shops; | 44 | let userShops = req.user.shops; |
45 | - let currentShop = _.find(userShops, shop => shop.id === req.cookies.shopsId); | 45 | + let currentShop = _.find(userShops, shop => shop.id === req.cookies._sign); |
46 | 46 | ||
47 | if (currentShop) { | 47 | if (currentShop) { |
48 | let channel = apiMap.split('.')[0]; | 48 | let channel = apiMap.split('.')[0]; |
-
Please register or login to post a comment