Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-shop-manage
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
陈峰
8 years ago
Commit
f45f0aa7db7880d0e729ef5761d45e2240b4f108
1 parent
e2a6db57
路由规则
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
94 additions
and
39 deletions
app/app.js
app/build/webpack.base.conf.js
app/components/global/layout/user-info.vue
app/config/config.js
app/pages/home/overview/index.js
app/pages/shop/decoration-iframe/index.js
app/pages/shop/decoration-iframe/shops.vue
app/plugins/yoho-plugin-auth.js
app/plugins/yoho-plugin-core.js
app/plugins/yoho-plugin-router.js
app/services/_purview-mock.js
app/plugins/rsa.js → app/util/rsa.js
server/controllers/user-controller.js
app/app.js
View file @
f45f0aa
import
Vue
from
'vue'
;
import
Promise
from
'promise-polyfill'
;
import
App
from
'./pages/app'
;
import
yohoPluginCore
from
'./plugins/yoho-plugin-core'
;
import
yohoPluginRouter
from
'./plugins/yoho-plugin-router'
;
...
...
@@ -9,22 +8,7 @@ import './directives';
import
'iview/dist/styles/iview.css'
;
import
'font-awesome/css/font-awesome.css'
;
// 兼容IE的Function没有name属性为题,为了修复iView的bug
if
(
!
(
function
f
()
{}).
name
)
{
Object
.
defineProperty
(
Function
.
prototype
,
'name'
,
{
//eslint-disable-line
get
:
function
()
{
let
name
=
(
this
.
toString
().
match
(
/^function
\s
*
([^\s
(
]
+
)
/
)
||
[])[
1
];
Object
.
defineProperty
(
this
,
'name'
,
{
value
:
name
});
return
name
;
}
});
}
// 使用了webpack code spliting IE下需要promise ployfill
if
(
!
window
.
Promise
)
{
window
.
Promise
=
Promise
;
}
Vue
.
use
(
yohoPluginCore
);
...
...
app/build/webpack.base.conf.js
View file @
f45f0aa
...
...
@@ -26,6 +26,7 @@ module.exports = {
util
.
resolve
(
'scss'
),
util
.
resolve
(
'config'
),
util
.
resolve
(
'services'
),
util
.
resolve
(
'util'
),
'node_modules'
]
},
...
...
app/components/global/layout/user-info.vue
View file @
f45f0aa
...
...
@@ -30,16 +30,16 @@ export default {
userInfo: this.$user
};
},
created() {
},
methods: {
logout() {
Vue.logout();
},
switchShop(id) {
this.userInfo.currentShop = this.userInfo.shops.find(shop => shop.id === id);
Vue.switchShop(id);
this.$emit('shop-change', this.userInfo.currentShop);
if (this.userInfo.currentShop.id !== id) {
this.userInfo.currentShop = this.userInfo.shops.find(shop => shop.id === id);
Vue.switchShop(id);
this.$emit('shop-change', this.userInfo.currentShop);
}
}
}
};
...
...
app/config/config.js
View file @
f45f0aa
...
...
@@ -3,6 +3,7 @@ export default {
historyMode
:
'history'
,
axiosBaseUrl
:
'/Api'
,
axiosResponseType
:
'json'
,
homePage
:
'home.overview'
,
storeKeys
:
{
user
:
'_user'
,
}
...
...
app/pages/home/overview/index.js
View file @
f45f0aa
const
page
=
r
=>
require
.
ensure
([],
()
=>
r
(
require
(
'./overview'
)),
'home.overview'
);
export
default
{
path
:
''
,
path
:
'
/overview.html
'
,
name
:
'overview'
,
component
:
page
};
...
...
app/pages/shop/decoration-iframe/index.js
View file @
f45f0aa
const
decoration
=
r
=>
require
.
ensure
([],
()
=>
r
(
require
(
'./decoration'
)),
'shop.decoration'
);
const
shops
=
r
=>
require
.
ensure
([],
()
=>
r
(
require
(
'./
decoration
'
)),
'shop.shops'
);
const
shops
=
r
=>
require
.
ensure
([],
()
=>
r
(
require
(
'./
shops
'
)),
'shop.shops'
);
export
default
[
...
...
@@ -12,8 +12,8 @@ export default [
}
},
{
path
:
'/decoration.html'
,
name
:
'decoration'
,
path
:
'/decor.html'
,
name
:
'decor'
,
component
:
decoration
,
meta
:
{
pageName
:
'店铺装修'
...
...
app/pages/shop/decoration-iframe/shops.vue
View file @
f45f0aa
<template>
<LayoutBody>
<LayoutList>
<Table border :context="self" :data="data" :columns="columns"></Table>
</LayoutList>
</LayoutBody>
</template>
<script>
export default {
data() {
return {
self: this,
data: [],
columns: [{
title: '店铺ID',
key: 'shopName',
}, {
title: '店铺名称',
key: 'shopName',
}, {
title: '品牌',
key: 'shopName',
}, {
title: '发布时间',
key: 'shopName',
}, {
title: '状态',
key: 'shopName',
}, {
title: '操作',
render() {
return `
<i-button type="primary" size="small" >尺码维护</i-button>
<i-button type="primary" size="small">内容编辑</i-button>
`;
}
}]
};
}
}
</script>
...
...
app/plugins/yoho-plugin-auth.js
View file @
f45f0aa
...
...
@@ -6,7 +6,7 @@ import config from 'config';
import
axios
from
'axios'
;
import
userService
from
'user-service'
;
import
iView
from
'iview'
;
import
Rsa
from
'
./
rsa'
;
import
Rsa
from
'rsa'
;
const
plugin
=
{
updateUser
(
Vue
,
user
,
purviews
)
{
...
...
@@ -35,7 +35,7 @@ const plugin = {
});
},
install
(
Vue
)
{
Vue
.
beforeRender
.
push
((
next
)
=>
{
Vue
.
beforeRender
((
next
)
=>
{
let
user
=
Vue
.
$store
.
get
(
config
.
storeKeys
.
user
);
let
isLogin
=
Vue
.
$cookie
.
get
(
'_isLogin'
);
...
...
app/plugins/yoho-plugin-core.js
View file @
f45f0aa
...
...
@@ -2,6 +2,7 @@
* 插件
*/
import
Router
from
'vue-router'
;
import
Promise
from
'promise-polyfill'
;
import
iView
from
'iview'
;
import
store
from
'yoho-store'
;
import
cookie
from
'yoho-cookie'
;
...
...
@@ -20,15 +21,18 @@ const plugin = {
Vue
.
prop
=
(
key
,
value
)
=>
{
Vue
[
`
$$
{
key
}
`
]
=
Vue
.
prototype
[
`
$$
{
key
}
`
]
=
value
;
};
Vue
.
beforeRender
=
[];
Vue
.
beforeRenderHooks
=
[];
Vue
.
beforeRender
=
(
fn
)
=>
{
Vue
.
beforeRenderHooks
.
push
(
fn
);
};
Vue
.
render
=
opts
=>
{
return
new
Promise
(
resolve
=>
{
if
(
Vue
.
beforeRender
.
length
)
{
if
(
Vue
.
beforeRender
Hooks
.
length
)
{
let
step
=
index
=>
{
if
(
index
>=
Vue
.
beforeRender
.
length
)
{
if
(
index
>=
Vue
.
beforeRender
Hooks
.
length
)
{
resolve
();
}
else
{
Vue
.
beforeRender
[
index
](()
=>
{
Vue
.
beforeRender
Hooks
[
index
](()
=>
{
step
(
index
+
1
);
});
}
...
...
@@ -45,6 +49,24 @@ const plugin = {
});
};
},
compatible
()
{
// 兼容IE的Function没有name属性为题,为了修复iView的bug
if
(
!
(
function
f
()
{}).
name
)
{
Object
.
defineProperty
(
Function
.
prototype
,
'name'
,
{
//eslint-disable-line
get
:
function
()
{
let
name
=
(
this
.
toString
().
match
(
/^function
\s
*
([^\s
(
]
+
)
/
)
||
[])[
1
];
Object
.
defineProperty
(
this
,
'name'
,
{
value
:
name
});
return
name
;
}
});
}
// 使用了webpack code spliting IE下需要promise ployfill
if
(
!
window
.
Promise
)
{
window
.
Promise
=
Promise
;
}
},
install
(
Vue
)
{
// 定义Vue全局属性
this
.
defineVueProp
(
Vue
);
...
...
app/plugins/yoho-plugin-router.js
View file @
f45f0aa
import
Router
from
'vue-router'
;
import
config
from
'config'
;
import
pageRoutes
from
'../pages'
;
import
layout
from
'../pages/layout'
;
import
common
from
'../pages/common'
;
...
...
@@ -27,7 +26,7 @@ const plugin = {
}
if
(
rous
.
length
)
{
return
_
.
map
(
rous
,
r
=>
{
return
this
.
loadRouters
(
r
,
[
paths
]);
return
this
.
loadRouters
(
r
,
[
paths
,
r
.
name
]);
});
}
else
{
return
_
.
map
(
rous
,
(
rou
,
k
)
=>
{
...
...
@@ -36,18 +35,24 @@ const plugin = {
}
},
install
(
Vue
)
{
let
childRouters
=
this
.
loadRouters
(
pageRoutes
);
let
childRouters
=
_
.
flattenDeep
(
this
.
loadRouters
(
pageRoutes
));
if
(
Vue
.
$config
.
homePage
)
{
let
homePage
=
_
.
find
(
childRouters
,
router
=>
router
.
name
===
Vue
.
$config
.
homePage
);
homePage
&&
(
homePage
.
path
=
'/'
);
}
let
routes
=
[{
path
:
'/'
,
component
:
layout
,
children
:
_
.
flattenDeep
(
childRouters
)
children
:
childRouters
}];
routes
=
routes
.
concat
(
common
);
Vue
.
$router
=
new
Router
({
routes
:
routes
,
mode
:
config
.
historyMode
mode
:
Vue
.
$
config
.
historyMode
});
}
};
...
...
app/services/_purview-mock.js
View file @
f45f0aa
...
...
@@ -63,7 +63,7 @@ export default [
},
{
menu_name
:
'店铺装修'
,
menu_url
:
'/shop/decoration.html'
,
menu_url
:
'/shop/decoration
/shops
.html'
,
menu_id
:
'shop.decoration'
,
status
:
1
,
id
:
22
...
...
app/
plugins
/rsa.js → app/
util
/rsa.js
View file @
f45f0aa
server/controllers/user-controller.js
View file @
f45f0aa
...
...
@@ -29,7 +29,7 @@ class UserController extends Context {
shops
:
result
.
data
,
currentShop
:
currentShop
}),
sess
);
console
.
log
(
result
.
data
)
return
res
.
json
({
code
:
200
,
data
:
{
...
...
Please
register
or
login
to post a comment