Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
op-web-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bp
op-web-service
Commits
5908974b
Commit
5908974b
authored
May 31, 2021
by
lvweichao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: change login logic
parent
93092b65
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
250 additions
and
68 deletions
+250
-68
config.js
server/config.js
+3
-3
user.js
server/controllers/user.js
+4
-2
router.js
server/router.js
+1
-1
App.vue
src/App.vue
+17
-8
User.vue
src/components/PageHeader/User.vue
+48
-0
config.js
src/components/PageHeader/config.js
+22
-10
index.vue
src/components/PageHeader/index.vue
+13
-1
index.vue
src/pages/Life-no/index.vue
+39
-35
userDetail.vue
src/pages/User/userList/userDetail.vue
+65
-0
index.js
src/router/index.js
+10
-1
user.js
src/service/user.js
+2
-1
index.js
src/store/index.js
+25
-5
vue.config.js
vue.config.js
+1
-1
No files found.
server/config.js
View file @
5908974b
...
@@ -14,9 +14,9 @@ const PANDORA_URI = {
...
@@ -14,9 +14,9 @@ const PANDORA_URI = {
}
}
const
API_INTERNAL_URI
=
{
const
API_INTERNAL_URI
=
{
'development'
:
"
bp-test.ini.yidian-inc.com
"
,
'development'
:
"
http://bp-test.ini.yidian-inc.com
"
,
'test'
:
"
bp-test.ini.yidian-inc.com
"
,
'test'
:
"
http://bp-test.ini.yidian-inc.com
"
,
'production'
:
"
bp-test.go2yd.com
"
'production'
:
"
http://bp-test.go2yd.com
"
}
}
module
.
exports
=
{
module
.
exports
=
{
...
...
server/controllers/user.js
View file @
5908974b
...
@@ -5,12 +5,14 @@ var query = {
...
@@ -5,12 +5,14 @@ var query = {
async
get_permissions
(
ctx
,
next
)
{
async
get_permissions
(
ctx
,
next
)
{
// http://bp-test.ini.yidian-inc.com/merchant/authority/get_role_list?user_email=jianghaiming@126.com
// http://bp-test.ini.yidian-inc.com/merchant/authority/get_role_list?user_email=jianghaiming@126.com
const
url
=
`
${
API_INTERNAL_URI
}
/merchant/authority/get_role_list`
;
const
url
=
`
${
API_INTERNAL_URI
}
/merchant/authority/get_role_list`
;
console
.
log
(
44444
,
ctx
.
request
.
query
.
email
);
const
{
email
}
=
ctx
.
request
.
query
;
const
{
email
}
=
ctx
.
request
.
query
;
const
opts
=
{
const
opts
=
{
url
,
url
,
method
:
'GET'
,
method
:
'GET'
,
params
:
{
qs
:
{
email
user_email
:
'jianghaiming@126.com'
// user_email: email
}
}
}
}
ctx
.
body
=
await
req
(
ctx
,
opts
)
ctx
.
body
=
await
req
(
ctx
,
opts
)
...
...
server/router.js
View file @
5908974b
...
@@ -5,7 +5,7 @@ const user = require('./controllers/user')
...
@@ -5,7 +5,7 @@ const user = require('./controllers/user')
const
router
=
Router
();
const
router
=
Router
();
const
API_VERSION
=
"/api/v1"
;
const
API_VERSION
=
"/api/v1"
;
router
.
post
(
`
${
API_VERSION
}
/login`
,
system
.
login
);
//
router.post(`${API_VERSION}/login`, system.login);
router
.
get
(
`
${
API_VERSION
}
/fetch_user`
,
system
.
fetch_user
);
router
.
get
(
`
${
API_VERSION
}
/fetch_user`
,
system
.
fetch_user
);
router
.
get
(
`
${
API_VERSION
}
/user/:type`
,
user
.
query
)
router
.
get
(
`
${
API_VERSION
}
/user/:type`
,
user
.
query
)
...
...
src/App.vue
View file @
5908974b
<
template
>
<
template
>
<div
id=
"app"
>
<div>
<router-view
/>
<router-view
/>
<!--
<layout>
<!--
<layout>
</layout>
-->
</layout>
-->
...
@@ -11,10 +11,10 @@
...
@@ -11,10 +11,10 @@
// import Layout from '@/layouts';
// import Layout from '@/layouts';
import
{
fetchCurrentUser
}
from
'./service/user'
;
import
{
fetchCurrentUser
}
from
'./service/user'
;
async
function
isUserLogged
()
{
//
async function isUserLogged() {
const
res
=
await
fetchCurrentUser
()
//
const res = await fetchCurrentUser()
return
res
.
status
===
'success'
;
//
return res.status === 'success';
}
//
}
function
redirectToLogin
()
{
function
redirectToLogin
()
{
const
loginUrl
=
'//pandora.yidian-inc.com/tools/admin/login'
;
const
loginUrl
=
'//pandora.yidian-inc.com/tools/admin/login'
;
...
@@ -25,11 +25,20 @@ function redirectToLogin() {
...
@@ -25,11 +25,20 @@ function redirectToLogin() {
export
default
{
export
default
{
async
mounted
()
{
async
mounted
()
{
// http://dev.yidian-inc.com:8081/home
// http://dev.yidian-inc.com:8081/home
if
(
!
(
await
isUserLogged
()))
{
const
{
status
,
user
}
=
await
fetchCurrentUser
();
redirectToLogin
();
// {"status":"success","user":{"userid":"732473439","name":"吕伟朝","email":"lvweichao@yidian-inc.com","avatar":""}}
if
(
status
===
'success'
)
{
this
.
$store
.
dispatch
(
'updateUserPermission'
,
{
email
:
user
.
email
})
this
.
$store
.
commit
(
'updateUserInfo'
,
user
)
}
else
{
}
else
{
redirectToLogin
();
}
}
// if (!(await isUserLogged())) {
// redirectToLogin();
// } else {
// }
},
},
};
};
</
script
>
</
script
>
...
...
src/components/PageHeader/User.vue
0 → 100644
View file @
5908974b
<
template
>
<el-dropdown>
<div
class=
"user-info"
>
<el-avatar
:src=
"userInfo.avatar || DEFAULT_AVATAR"
size=
"small"
></el-avatar>
<span
class=
"user-name"
>
{{
userInfo
.
name
}}
</span>
</div>
<template
#
dropdown
>
<el-dropdown-menu>
<el-dropdown-item>
<i
class=
"el-icon-message"
></i>
{{
userInfo
.
email
}}
</el-dropdown-item>
<el-dropdown-item>
<span><a
class=
"link"
href=
"//pandora.yidian-inc.com/"
>
返回pandora工具平台
</a></span>
</el-dropdown-item>
</el-dropdown-menu>
</
template
>
</el-dropdown>
</template>
<
script
>
import
{
mapState
}
from
'vuex'
import
headerConfig
from
'./config'
;
export
default
{
computed
:
mapState
({
userInfo
:
state
=>
state
.
userInfo
,
}),
data
()
{
return
{
DEFAULT_AVATAR
:
headerConfig
.
miscellaneous
.
defaultAvatar
,
};
},
};
</
script
>
<
style
lang=
"less"
scoped
>
.user-info {
display: flex;
align-items: center;
}
.user-name {
margin-left: 12px;
color: #FFF;
}
</
style
>
src/components/PageHeader/config.js
View file @
5908974b
...
@@ -2,23 +2,35 @@ const headerConfig = {
...
@@ -2,23 +2,35 @@ const headerConfig = {
appName
:
'OP运营管理后台'
,
appName
:
'OP运营管理后台'
,
logo
:
'http://si1.go2yd.com/get-image/0ZAJxXeZ6iu'
,
logo
:
'http://si1.go2yd.com/get-image/0ZAJxXeZ6iu'
,
menuItems
:
[
menuItems
:
[
// {
// path: '/home',
// name: '首页',
// },
// {
// path: '/about',
// name: '关于'
// },
{
{
path
:
'/
home
'
,
path
:
'/
enterprise/certification
'
,
name
:
'
首页'
,
name
:
'
企业认证管理'
},
},
{
{
path
:
'/
about
'
,
path
:
'/
life-no/life
'
,
name
:
'
关于
'
name
:
'
生活号管理
'
},
},
{
{
path
:
'/enterprise/certification'
,
path
:
'/role'
,
name
:
'企业认证管理'
name
:
'角色管理'
},
{
path
:
'/user'
,
name
:
'用户管理'
}
}
],
],
//
miscellaneous: {
miscellaneous
:
{
//
// 配置当用户头像不存在时使用的fallback头像图URL
// 配置当用户头像不存在时使用的fallback头像图URL
//
defaultAvatar: '//s.go2yd.com/a/thead_meiguoduizhang.png',
defaultAvatar
:
'//s.go2yd.com/a/thead_meiguoduizhang.png'
,
//
},
},
};
};
export
default
headerConfig
;
export
default
headerConfig
;
\ No newline at end of file
src/components/PageHeader/index.vue
View file @
5908974b
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<div
id=
"pageheader"
>
<div
id=
"pageheader"
>
<div
class=
"line"
></div>
<div
class=
"line"
></div>
<el-menu
<el-menu
class=
"
el-menu-demo
"
class=
"
header-menu
"
mode=
"horizontal"
mode=
"horizontal"
:router=
"true"
:router=
"true"
background-color=
"#545c64"
background-color=
"#545c64"
...
@@ -17,16 +17,24 @@
...
@@ -17,16 +17,24 @@
>
>
{{
item
.
name
}}
{{
item
.
name
}}
</el-menu-item>
</el-menu-item>
<el-menu-item
key=
"usermenu"
class=
"user-menu"
>
<user></user>
</el-menu-item>
</el-menu>
</el-menu>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
headerConfig
from
"./config"
;
import
headerConfig
from
"./config"
;
import
User
from
'./User.vue'
;
const
{
menuItems
}
=
headerConfig
;
const
{
menuItems
}
=
headerConfig
;
export
default
{
export
default
{
name
:
"PageHeader"
,
name
:
"PageHeader"
,
components
:
{
User
,
},
data
()
{
data
()
{
return
{
return
{
menuItems
,
menuItems
,
...
@@ -48,4 +56,8 @@ export default {
...
@@ -48,4 +56,8 @@ export default {
line-height: 60px;
line-height: 60px;
width: 100%;
width: 100%;
}
}
.header-menu .user-menu {
float: right !important;
margin-right: 20px;
}
</
style
>
</
style
>
src/pages/Life-no/index.vue
View file @
5908974b
<
template
>
<
template
>
<div
class=
"life-no"
>
<layout>
<el-form
:inline=
"true"
:model=
"formInline"
class=
"demo-form-inline"
>
<div
class=
"life-no"
>
<el-form-item
label=
"生活号名称/企业名称"
>
<el-form
:inline=
"true"
:model=
"formInline"
class=
"demo-form-inline"
>
<el-input
<el-form-item
label=
"生活号名称/企业名称"
>
class=
"search_life"
<el-input
maxlength=
"15"
class=
"search_life"
v-model=
"formInline.user"
maxlength=
"15"
placeholder=
"生活号名称/企业名称"
v-model=
"formInline.user"
></el-input>
placeholder=
"生活号名称/企业名称"
</el-form-item>
></el-input>
<el-form-item
label=
"类型"
>
</el-form-item>
<el-select
v-model=
"formInline.region"
placeholder=
"类型"
>
<el-form-item
label=
"类型"
>
<el-option
value=
"shanghai"
></el-option>
<el-select
v-model=
"formInline.region"
placeholder=
"类型"
>
<el-option
value=
"beijing"
></el-option>
<el-option
value=
"shanghai"
></el-option>
</el-select>
<el-option
value=
"beijing"
></el-option>
</el-form-item>
</el-select>
<el-form-item>
</el-form-item>
<el-button
type=
"primary"
@
click=
"onSearchSubmit"
>
查询
</el-button>
<el-form-item>
<el-button
@
click=
"onReset"
>
重置
</el-button>
<el-button
type=
"primary"
@
click=
"onSearchSubmit"
>
查询
</el-button>
</el-form-item>
<el-button
@
click=
"onReset"
>
重置
</el-button>
</el-form>
</el-form-item>
<el-table
</el-form>
:data=
"tableData"
<el-table
border
:data=
"tableData"
style=
"width: 100%"
border
@
row-click=
"toLifeDetail"
style=
"width: 100%"
>
@
row-click=
"toLifeDetail"
<el-table-column
prop=
"id"
label=
"ID"
>
</el-table-column>
>
<el-table-column
prop=
"name"
label=
"生活号名称"
>
</el-table-column>
<el-table-column
prop=
"id"
label=
"ID"
>
</el-table-column>
<el-table-column
prop=
"address"
label=
"类型"
>
</el-table-column>
<el-table-column
prop=
"name"
label=
"生活号名称"
>
</el-table-column>
<el-table-column
prop=
"name"
label=
"状态"
>
</el-table-column>
<el-table-column
prop=
"address"
label=
"类型"
>
</el-table-column>
<el-table-column
prop=
"date"
label=
"创建时间"
>
</el-table-column>
<el-table-column
prop=
"name"
label=
"状态"
>
</el-table-column>
</el-table>
<el-table-column
prop=
"date"
label=
"创建时间"
>
</el-table-column>
<page
:totalNum=
"totalNum"
@
update=
"update"
/>
</el-table>
</div>
<page
:totalNum=
"totalNum"
@
update=
"update"
/>
</div>
</layout>
</
template
>
</
template
>
<
script
>
<
script
>
import
Layout
from
'@/layouts'
import
page
from
"./components/Pagination"
import
page
from
"./components/Pagination"
export
default
{
export
default
{
components
:
{
components
:
{
Layout
,
page
page
},
},
data
()
{
data
()
{
...
...
src/pages/User/userList/userDetail.vue
0 → 100644
View file @
5908974b
<
template
>
<div
class=
"user-detail"
>
<el-descriptions
class=
"margin-top"
:column=
"3"
:size=
"size"
border
>
<el-descriptions-item>
<template
#
label
>
用户姓名
</
template
>
kooriookami
</el-descriptions-item>
<el-descriptions-item>
<
template
#
label
>
手机号
</
template
>
18100000000
</el-descriptions-item>
<el-descriptions-item>
<
template
#
label
>
所属组织
</
template
>
研发部
</el-descriptions-item>
<el-descriptions-item>
<
template
#
label
>
添加人账号
</
template
>
XXXX
</el-descriptions-item>
<el-descriptions-item>
<
template
#
label
>
添加时间
</
template
>
2020-12-01
</el-descriptions-item>
<el-descriptions-item>
<
template
#
label
>
最后修改人账号
</
template
>
张三
</el-descriptions-item>
<el-descriptions-item>
<
template
#
label
>
最后修改时间
</
template
>
2021-05-21
</el-descriptions-item>
<el-descriptions-item>
<
template
#
label
>
已拥有角色池
</
template
>
角色池
</el-descriptions-item>
<el-descriptions-item>
<
template
#
label
>
角色名称
</
template
>
管理员
</el-descriptions-item>
<el-descriptions-item>
<
template
#
label
>
敏感词权限
</
template
>
敏感词权限
</el-descriptions-item>
<el-descriptions-item>
<
template
#
label
>
数据权限
</
template
>
数据权限
</el-descriptions-item>
</el-descriptions>
</div>
</template>
<
script
>
export
default
{
data
()
{
return
{
userInfoList
:
[{
}]
}
}
}
</
script
>
<
style
lang=
"less"
scoped
>
.user-detail {
margin: 50px;
}
</
style
>
\ No newline at end of file
src/router/index.js
View file @
5908974b
import
{
createRouter
,
createWebHistory
}
from
"vue-router"
;
import
{
createRouter
,
createWebHistory
}
from
"vue-router"
;
import
Home
from
"../pages/Home"
;
import
Home
from
"../pages/Home"
;
import
Login
from
"../pages/Login"
;
import
Login
from
"../pages/Login"
;
import
Certification
from
'@/pages/Enterprise/Certification'
;
import
LifeNo
from
'../pages/Life-no/index.vue'
import
LifeNo
from
'../pages/Life-no/index.vue'
import
LifeNoDetail
from
'../pages/Life-no/life-no-detail.vue'
import
LifeNoDetail
from
'../pages/Life-no/life-no-detail.vue'
import
UserDetail
from
'../pages/User/user-detail.vue'
import
UserDetail
from
'../pages/User/user-detail.vue'
...
@@ -23,10 +26,16 @@ const routes = [
...
@@ -23,10 +26,16 @@ const routes = [
name
:
"About"
,
name
:
"About"
,
component
:
()
=>
import
(
/* webpackChunkName: "about" */
"../pages/About"
),
component
:
()
=>
import
(
/* webpackChunkName: "about" */
"../pages/About"
),
},
},
{
path
:
"/"
,
name
:
"Home"
,
component
:
Certification
,
},
{
{
path
:
'/enterprise/certification'
,
path
:
'/enterprise/certification'
,
name
:
'Certification'
,
name
:
'Certification'
,
component
:
()
=>
import
(
/* webpackChunkName: "enterprise" */
'@/pages/Enterprise/Certification'
)
component
:
Certification
,
// component: () => import(/* webpackChunkName: "enterprise" */ '@/pages/Enterprise/Certification')
},
},
{
{
path
:
'/enterprise/audit'
,
path
:
'/enterprise/audit'
,
...
...
src/service/user.js
View file @
5908974b
...
@@ -12,5 +12,6 @@ export async function fetchCurrentUser() {
...
@@ -12,5 +12,6 @@ export async function fetchCurrentUser() {
}
}
export
async
function
getPermissions
(
email
)
{
export
async
function
getPermissions
(
email
)
{
return
await
axios
.
get
(
"api/v1/user/get_permissions"
,
{
email
});
console
.
log
(
"fe service, getPermissions:::"
,
email
)
return
await
axios
.
get
(
"api/v1/user/get_permissions"
,
{
params
:
{
email
}
});
}
}
\ No newline at end of file
src/store/index.js
View file @
5908974b
import
Vuex
from
"vuex"
;
import
{
createStore
}
from
"vuex"
;
import
{
getPermissions
}
from
'@/service/user'
;
export
default
Vuex
.
createStore
({
export
default
createStore
({
state
:
{},
state
:
{
mutations
:
{},
permissions
:
[],
actions
:
{},
userInfo
:
{},
},
mutations
:
{
updateUserPermission
(
state
,
payload
)
{
state
.
permissions
=
payload
;
},
updateUserInfo
(
state
,
payload
)
{
state
.
userInfo
=
payload
;
}
},
actions
:
{
async
updateUserPermission
({
commit
},
payload
)
{
const
permissions
=
await
getPermissions
(
payload
.
email
);
console
.
log
(
"VUEX action updateUserPermission::"
,
permissions
);
commit
(
'updateUserPermission'
,
permissions
)
}
},
modules
:
{},
modules
:
{},
getters
:
{
}
});
});
vue.config.js
View file @
5908974b
...
@@ -6,7 +6,7 @@ module.exports = {
...
@@ -6,7 +6,7 @@ module.exports = {
outputDir
:
isDev
outputDir
:
isDev
?
'./dist'
?
'./dist'
:
path
.
resolve
(
'../../../www/dist/'
),
:
path
.
resolve
(
'../../../www/dist/'
),
publicPath
:
isDev
?
'
'
:
'/dist/
'
,
publicPath
:
isDev
?
'
/'
:
'/dist
'
,
configureWebpack
:
{
configureWebpack
:
{
devServer
:
{
devServer
:
{
// proxy: {
// proxy: {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment