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
3109bd7d
Commit
3109bd7d
authored
May 31, 2021
by
mengwenhao
Browse files
Options
Browse Files
Download
Plain Diff
update: 合并分支并解决冲突
parents
e913c4d0
5908974b
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
338 additions
and
146 deletions
+338
-146
config.js
server/config.js
+11
-4
system.js
server/controllers/system.js
+26
-13
user.js
server/controllers/user.js
+8
-4
router.js
server/router.js
+5
-3
App.vue
src/App.vue
+26
-16
User.vue
src/components/PageHeader/User.vue
+48
-0
config.js
src/components/PageHeader/config.js
+24
-8
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
+7
-2
index.js
src/store/index.js
+25
-5
request.js
src/utils/request.js
+27
-52
vue.config.js
vue.config.js
+4
-2
No files found.
server/config.js
View file @
3109bd7d
...
...
@@ -7,15 +7,22 @@ const LOGIN_URI = {
'production'
:
"http://web-rest.int.yidian-inc.com"
}
const
PANDORA_URI
=
{
'development'
:
"http://pandora.yidian-inc.com"
,
'test'
:
"http://pandora.yidian-inc.com"
,
'production'
:
"http://pandora.yidian-inc.com"
}
const
API_INTERNAL_URI
=
{
'development'
:
"
bp-test.ini.yidian-inc.com
"
,
'test'
:
"
bp-test.ini.yidian-inc.com
"
,
'production'
:
"
bp-test.go2yd.com
"
'development'
:
"
http://bp-test.ini.yidian-inc.com
"
,
'test'
:
"
http://bp-test.ini.yidian-inc.com
"
,
'production'
:
"
http://bp-test.go2yd.com
"
}
module
.
exports
=
{
env
:
env
,
port
:
port
,
LOGIN_URI
:
LOGIN_URI
[
env
],
API_INTERNAL_URI
:
API_INTERNAL_URI
[
env
]
API_INTERNAL_URI
:
API_INTERNAL_URI
[
env
],
PANDORA_URI
:
PANDORA_URI
[
env
]
};
server/controllers/system.js
View file @
3109bd7d
const
LOGIN_URI
=
require
(
'../config.js'
).
LOGIN_URI
const
req
=
require
(
'../utils/request'
).
httpReq
const
LOGIN_URI
=
require
(
"../config.js"
).
LOGIN_URI
;
const
PANDORA_URI
=
require
(
"../config.js"
).
PANDORA_URI
;
const
req
=
require
(
"../utils/request"
).
httpReq
;
// exports.login = async (ctx, next) => {
// const url = `${LOGIN_URI}/api/v1/pandora/auth`;
// const opts = {
// url: url,
// method: 'POST',
// json: true,
// body : ctx.request.body
// }
// console.log("koa login:::::", ctx.request)
// ctx.body = await req(ctx, opts)
// }
exports
.
login
=
async
(
ctx
)
=>
{
var
url
=
`
${
LOGIN_URI
}
/api/v1/pandora/auth`
;
var
opts
=
{
exports
.
fetch_user
=
async
(
ctx
,
next
)
=>
{
const
url
=
`
${
PANDORA_URI
}
/api/user/getuser`
;
const
cookie
=
ctx
.
request
.
header
.
cookie
;
const
opts
=
{
url
:
url
,
method
:
'POST'
,
json
:
true
,
timeout
:
8000
,
body
:
ctx
.
request
.
body
}
c
tx
.
body
=
await
req
(
ctx
,
opts
)
}
method
:
"GET"
,
headers
:
{
Cookie
:
ctx
.
request
.
header
.
cookie
}
}
;
c
onsole
.
log
(
"fetch_user:::::"
,
ctx
.
request
);
ctx
.
body
=
await
req
(
ctx
,
opts
);
};
server/controllers/user.js
View file @
3109bd7d
const
{
API_INTERNAL_URI
}
=
require
(
'../config.js'
)
const
API_INTERNAL_URI
=
require
(
'../config.js'
).
API_INTERNAL_URI
const
req
=
require
(
'../utils/request'
).
httpReq
var
query
=
{
async
get_permissions
(
ctx
,
next
)
{
// 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`
;
console
.
log
(
44444
,
ctx
.
request
.
query
.
email
);
const
{
email
}
=
ctx
.
request
.
query
;
const
opts
=
{
url
,
method
:
'GET'
,
params
:
{
email
qs
:
{
user_email
:
'jianghaiming@126.com'
// user_email: email
}
}
ctx
.
body
=
await
req
(
ctx
,
opts
)
...
...
@@ -18,12 +21,13 @@ var query = {
exports
.
query
=
async
(
ctx
,
next
)
=>
{
var
type
=
ctx
.
params
.
type
console
.
log
(
"koa user::::::"
,
type
)
if
(
query
[
type
])
{
try
{
ctx
.
set
(
'Content-Type'
,
'application/json; charset=utf-8'
)
await
query
[
type
](
ctx
,
next
)
}
catch
(
e
)
{
console
.
error
(
'/
home/q
error'
,
e
,
ctx
.
url
,
ctx
.
headers
[
'cookie'
])
console
.
error
(
'/
api/v1
error'
,
e
,
ctx
.
url
,
ctx
.
headers
[
'cookie'
])
ctx
.
body
=
{
status
:
'failed'
,
reason
:
'Internal Server Error'
}
}
}
else
{
...
...
server/router.js
View file @
3109bd7d
const
Router
=
require
(
"koa-router"
);
const
system
=
require
(
"./controllers/system"
);
//
const user = require("./controllers/user");
const
user
=
require
(
"./controllers/user"
);
const
enterprise
=
require
(
"./controllers/enterprise"
);
const
router
=
Router
();
const
API_VERSION
=
"/api/v1"
;
router
.
post
(
`
${
API_VERSION
}
/login`
,
system
.
login
);
// router.get(`${API_VERSION}/user/:type`, user.query);
router
.
get
(
`
${
API_VERSION
}
/fetch_user`
,
system
.
fetch_user
);
router
.
get
(
`
${
API_VERSION
}
/user/:type`
,
user
.
query
)
router
.
get
(
`
${
API_VERSION
}
/certification`
,
enterprise
.
entCheck
);
router
.
post
(
`
${
API_VERSION
}
/emterprise_commit`
,
enterprise
.
entCommit
)
router
.
post
(
`
${
API_VERSION
}
/emterprise_commit`
,
enterprise
.
entCommit
);
module
.
exports
=
router
;
src/App.vue
View file @
3109bd7d
<
template
>
<div
id=
"app"
>
<div>
<router-view
/>
<!--
<layout>
</layout>
-->
...
...
@@ -9,27 +9,37 @@
<
script
>
// Layout 为布局组件,控制页面基础布局,通过 slot 实现
// import Layout from '@/layouts';
// import { fetchCurrentUser } from './services
/user';
import
{
fetchCurrentUser
}
from
'./service
/user'
;
// async function isUserLogged() {
// return (await fetchCurrentUser()).status === 'success';
// const res = await fetchCurrentUser()
// return res.status === 'success';
// }
//
function redirectToLogin() {
//
const loginUrl = '//pandora.yidian-inc.com/tools/admin/login';
//
const cbUrl = location.href;
//
location.href = `${loginUrl}?callback=${cbUrl}`;
//
}
function
redirectToLogin
()
{
const
loginUrl
=
'//pandora.yidian-inc.com/tools/admin/login'
;
const
cbUrl
=
location
.
href
;
location
.
href
=
`
${
loginUrl
}
?callback=
${
cbUrl
}
`
;
}
export
default
{
// components: {
// Layout,
// },
// async mounted() {
// if (!(await isUserLogged())) {
// redirectToLogin();
// }
// },
async
mounted
()
{
// http://dev.yidian-inc.com:8081/home
const
{
status
,
user
}
=
await
fetchCurrentUser
();
// {"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
{
redirectToLogin
();
}
// if (!(await isUserLogged())) {
// redirectToLogin();
// } else {
// }
},
};
</
script
>
...
...
src/components/PageHeader/User.vue
0 → 100644
View file @
3109bd7d
<
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 @
3109bd7d
...
...
@@ -2,23 +2,39 @@ const headerConfig = {
appName
:
'OP运营管理后台'
,
logo
:
'http://si1.go2yd.com/get-image/0ZAJxXeZ6iu'
,
menuItems
:
[
// {
// path: '/home',
// name: '首页',
// },
// {
// path: '/about',
// name: '关于'
// },
{
path
:
'/
home
'
,
name
:
'
首页'
,
path
:
'/
enterprise/certification
'
,
name
:
'
企业认证管理'
},
{
path
:
'/
about
'
,
name
:
'
关于
'
path
:
'/
life-no/life
'
,
name
:
'
生活号管理
'
},
{
path
:
'/certification'
,
name
:
'企业认证管理'
},
{
path
:
'/role'
,
name
:
'角色管理'
},
{
path
:
'/user'
,
name
:
'用户管理'
}
],
//
miscellaneous: {
//
// 配置当用户头像不存在时使用的fallback头像图URL
//
defaultAvatar: '//s.go2yd.com/a/thead_meiguoduizhang.png',
//
},
miscellaneous
:
{
// 配置当用户头像不存在时使用的fallback头像图URL
defaultAvatar
:
'//s.go2yd.com/a/thead_meiguoduizhang.png'
,
},
};
export
default
headerConfig
;
\ No newline at end of file
src/components/PageHeader/index.vue
View file @
3109bd7d
...
...
@@ -2,7 +2,7 @@
<div
id=
"pageheader"
>
<div
class=
"line"
></div>
<el-menu
class=
"
el-menu-demo
"
class=
"
header-menu
"
mode=
"horizontal"
:router=
"true"
background-color=
"#545c64"
...
...
@@ -17,16 +17,24 @@
>
{{
item
.
name
}}
</el-menu-item>
<el-menu-item
key=
"usermenu"
class=
"user-menu"
>
<user></user>
</el-menu-item>
</el-menu>
</div>
</
template
>
<
script
>
import
headerConfig
from
"./config"
;
import
User
from
'./User.vue'
;
const
{
menuItems
}
=
headerConfig
;
export
default
{
name
:
"PageHeader"
,
components
:
{
User
,
},
data
()
{
return
{
menuItems
,
...
...
@@ -48,4 +56,8 @@ export default {
line-height: 60px;
width: 100%;
}
.header-menu .user-menu {
float: right !important;
margin-right: 20px;
}
</
style
>
src/pages/Life-no/index.vue
View file @
3109bd7d
<
template
>
<div
class=
"life-no"
>
<el-form
:inline=
"true"
:model=
"formInline"
class=
"demo-form-inline"
>
<el-form-item
label=
"生活号名称/企业名称"
>
<el-input
class=
"search_life"
maxlength=
"15"
v-model=
"formInline.user"
placeholder=
"生活号名称/企业名称"
></el-input>
</el-form-item>
<el-form-item
label=
"类型"
>
<el-select
v-model=
"formInline.region"
placeholder=
"类型"
>
<el-option
value=
"shanghai"
></el-option>
<el-option
value=
"beijing"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
@
click=
"onSearchSubmit"
>
查询
</el-button>
<el-button
@
click=
"onReset"
>
重置
</el-button>
</el-form-item>
</el-form>
<el-table
:data=
"tableData"
border
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=
"address"
label=
"类型"
>
</el-table-column>
<el-table-column
prop=
"name"
label=
"状态"
>
</el-table-column>
<el-table-column
prop=
"date"
label=
"创建时间"
>
</el-table-column>
</el-table>
<page
:totalNum=
"totalNum"
@
update=
"update"
/>
</div>
<layout>
<div
class=
"life-no"
>
<el-form
:inline=
"true"
:model=
"formInline"
class=
"demo-form-inline"
>
<el-form-item
label=
"生活号名称/企业名称"
>
<el-input
class=
"search_life"
maxlength=
"15"
v-model=
"formInline.user"
placeholder=
"生活号名称/企业名称"
></el-input>
</el-form-item>
<el-form-item
label=
"类型"
>
<el-select
v-model=
"formInline.region"
placeholder=
"类型"
>
<el-option
value=
"shanghai"
></el-option>
<el-option
value=
"beijing"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
@
click=
"onSearchSubmit"
>
查询
</el-button>
<el-button
@
click=
"onReset"
>
重置
</el-button>
</el-form-item>
</el-form>
<el-table
:data=
"tableData"
border
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=
"address"
label=
"类型"
>
</el-table-column>
<el-table-column
prop=
"name"
label=
"状态"
>
</el-table-column>
<el-table-column
prop=
"date"
label=
"创建时间"
>
</el-table-column>
</el-table>
<page
:totalNum=
"totalNum"
@
update=
"update"
/>
</div>
</layout>
</
template
>
<
script
>
import
Layout
from
'@/layouts'
import
page
from
"./components/Pagination"
export
default
{
components
:
{
Layout
,
page
},
data
()
{
...
...
src/pages/User/userList/userDetail.vue
0 → 100644
View file @
3109bd7d
<
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 @
3109bd7d
import
{
createRouter
,
createWebHistory
}
from
"vue-router"
;
import
Home
from
"../pages/Home"
;
import
Login
from
"../pages/Login"
;
import
Certification
from
'@/pages/Enterprise/Certification'
;
import
LifeNo
from
'../pages/Life-no/index.vue'
import
LifeNoDetail
from
'../pages/Life-no/life-no-detail.vue'
import
UserDetail
from
'../pages/User/user-detail.vue'
...
...
@@ -23,10 +26,16 @@ const routes = [
name
:
"About"
,
component
:
()
=>
import
(
/* webpackChunkName: "about" */
"../pages/About"
),
},
{
path
:
"/"
,
name
:
"Home"
,
component
:
Certification
,
},
{
path
:
'/enterprise/certification'
,
name
:
'Certification'
,
component
:
()
=>
import
(
/* webpackChunkName: "enterprise" */
'@/pages/Enterprise/Certification'
)
component
:
Certification
,
// component: () => import(/* webpackChunkName: "enterprise" */ '@/pages/Enterprise/Certification')
},
{
path
:
'/enterprise/audit'
,
...
...
src/service/user.js
View file @
3109bd7d
...
...
@@ -7,6 +7,11 @@ export async function login(email, password) {
return
res
.
data
;
}
export
async
function
getPermissions
()
{
return
await
axios
.
post
(
"api/home/user/get_permissions"
)
export
async
function
fetchCurrentUser
()
{
return
await
axios
.
get
(
"api/v1/fetch_user"
);
}
export
async
function
getPermissions
(
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 @
3109bd7d
import
Vuex
from
"vuex"
;
import
{
createStore
}
from
"vuex"
;
import
{
getPermissions
}
from
'@/service/user'
;
export
default
Vuex
.
createStore
({
state
:
{},
mutations
:
{},
actions
:
{},
export
default
createStore
({
state
:
{
permissions
:
[],
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
:
{},
getters
:
{
}
});
src/utils/request.js
View file @
3109bd7d
...
...
@@ -2,25 +2,26 @@
* axios封装
*/
import
axios
from
"axios"
;
import
{
ElMessage
}
from
"element-plus"
;
//
import { ElMessage } from "element-plus";
// import { APP_URI } from "../config/app.config";
/**
* show error tip
* @param mgs
*/
const
showErrorMessage
=
mgs
=>
{
ElMessage
({
message
:
mgs
,
type
:
"error"
,
showClose
:
true
});
};
//
const showErrorMessage = mgs => {
//
ElMessage({
//
message: mgs,
//
type: "error",
//
showClose: true
//
});
//
};
/**
* default axios config
*/
export
const
defaultConfig
=
{
// baseURL: APP_URI,
withCredentials
:
true
,
timeout
:
10000
};
...
...
@@ -71,52 +72,26 @@ instance.interceptors.request.use(
instance
.
interceptors
.
response
.
use
(
function
(
response
)
{
const
{
data
=
{}
}
=
response
;
const
code
=
data
.
code
??
-
1
;
if
(
code
!==
0
)
{
const
msg
=
data
.
reason
||
"未定义错误"
;
showErrorMessage
(
data
.
reason
);
return
Promise
.
reject
({
code
,
msg
});
}
if
(
data
.
message
)
{
ElMessage
({
message
:
data
.
reason
,
type
:
"info"
,
showClose
:
true
});
}
//
const code = data.code ?? -1;
//
if (code !== 0) {
//
const msg = data.reason || "未定义错误";
//
showErrorMessage(data.reason);
//
return Promise.reject({ code, msg });
//
}
//
if (data.message) {
//
ElMessage({
//
message: data.reason,
//
type: "info",
//
showClose: true
//
});
//
}
return
data
;
},
function
(
error
)
{
if
(
!
(
error
.
code
&&
error
.
code
===
-
1
))
error
.
message
=
"接口请求错误"
;
showErrorMessage
(
error
.
message
);
return
Promise
.
reject
(
error
);
}
//
function (error) {
//
if (!(error.code && error.code === -1)) error.message = "接口请求错误";
//
showErrorMessage(error.message);
//
return Promise.reject(error);
//
}
);
// /**
// * Get
// * @param {*} url
// * @param {*} params
// */
// export const get = ({url, params, headers}) => {
// return instance.request({
// url,
// method: "get",
// params
// });
// };
// /**
// * Post
// * @param {*} url
// * @param {*} params
// */
// export const post = ({url, data, headers}) => {
// return instance.request({
// url,
// method: "post",
// data
// });
// };
export
default
instance
;
vue.config.js
View file @
3109bd7d
...
...
@@ -6,7 +6,7 @@ module.exports = {
outputDir
:
isDev
?
'./dist'
:
path
.
resolve
(
'../../../www/dist/'
),
publicPath
:
isDev
?
'
'
:
'/dist/
'
,
publicPath
:
isDev
?
'
/'
:
'/dist
'
,
configureWebpack
:
{
devServer
:
{
// proxy: {
...
...
@@ -16,7 +16,9 @@ module.exports = {
// changeOrigin: true,
// },
// },
proxy
:
'http://localhost:8055'
proxy
:
'http://localhost:8055'
,
hot
:
true
,
disableHostCheck
:
true
,
},
},
chainWebpack
:
config
=>
{
...
...
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