Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
f52bfe02
Commit
f52bfe02
authored
May 01, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
dd847763
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
107 additions
and
67 deletions
+107
-67
iview-admin/src/api/user.js
+24
-7
iview-admin/src/components/login-form/login-form.vue
+1
-1
iview-admin/src/components/phone-form/phone-form.vue
+37
-36
iview-admin/src/config/index.js
+1
-1
iview-admin/src/libs/api.request.js
+1
-1
iview-admin/src/libs/axios.js
+12
-3
iview-admin/src/libs/util.js
+3
-0
iview-admin/src/router/index.js
+2
-1
iview-admin/src/store/module/user.js
+3
-6
iview-admin/src/view/components/tables/biztables.vue
+2
-1
iview-admin/src/view/login/login.vue
+21
-10
No files found.
iview-admin/src/api/user.js
View file @
f52bfe02
import
axios
from
'@/libs/api.request'
export
const
login
=
({
userName
,
password
})
=>
{
const
data
=
{
userName
,
password
export
const
login
=
(
upobj
)
=>
{
let
url
=
"/web/auth/userCtl/pmlogin"
if
(
upobj
.
mobile
){
if
(
axios
.
confapp
.
regrole
==
"pr"
){
if
(
!
axios
.
confapp
.
companykey
){
console
.
log
(
"当第三方应用调转到注册页面时,如果是注册自由个体用户,那么需要提供公司key"
)
return
false
}
url
=
"/web/auth/userCtl/pmloginByVCodeForFreeUser"
//注册个人用户,请求头必须添加公司KEY,如果不添加需要报错
}
else
{
url
=
"/web/auth/userCtl/pmloginByVCode"
//注册租户
}
console
.
log
(
"==============================login"
)
}
else
{
url
=
"/web/auth/userCtl/pmlogin"
}
return
axios
.
request
({
url
:
'/web/auth/userCtl/pmlogin'
,
data
,
url
:
url
,
data
:
upobj
,
method
:
'post'
}).
catch
((
e
)
=>
{
console
.
log
(
e
)
...
...
@@ -21,6 +31,13 @@ export const getUserInfo = (token) => {
method
:
'post'
})
}
export
const
sendVCode
=
(
obj
)
=>
{
return
axios
.
request
({
url
:
'/web/auth/userCtl/pmSendVCode'
,
method
:
'post'
,
data
:
obj
})
}
export
const
logout
=
(
token
)
=>
{
return
axios
.
request
({
...
...
iview-admin/src/components/login-form/login-form.vue
View file @
f52bfe02
...
...
@@ -61,7 +61,7 @@ export default {
this
.
$refs
.
loginForm
.
validate
((
valid
)
=>
{
if
(
valid
)
{
this
.
$emit
(
'on-success-valid'
,
{
userName
:
this
.
form
.
userName
,
userName
:
this
.
form
.
userName
.
trim
()
,
password
:
this
.
form
.
password
})
}
...
...
iview-admin/src/components/phone-form/phone-form.vue
View file @
f52bfe02
...
...
@@ -8,13 +8,13 @@
</Input>
</FormItem>
<FormItem
prop=
"vcode"
>
<Input
v-model=
"form.vcode"
placeholder=
"请输入收到的验证码"
>
<Input
v-model=
"form.vcode"
placeholder=
"请输入收到的验证码"
>
<span
slot=
"prepend"
>
<Icon
:size=
"14"
type=
"md-lock"
></Icon>
</span>
<span
slot=
"append"
>
<Button
type=
"primary"
v-if=
"!isshowtime"
@
click=
"sendVCode"
>
发送验证码
</Button>
<span
v-if=
"isshowtime"
>
{{
leftseconds
}}
秒
</span>
<span
v-if=
"isshowtime"
>
{{
leftseconds
}}
秒
</span>
</span>
</Input>
</FormItem>
...
...
@@ -25,65 +25,66 @@
</
template
>
<
script
>
export
default
{
name
:
'PhoneForm'
,
name
:
"PhoneForm"
,
props
:
{
mobileRules
:
{
type
:
Array
,
default
:
()
=>
{
return
[
{
required
:
true
,
message
:
'电话号码不能为空'
,
trigger
:
'blur'
}
]
{
required
:
true
,
message
:
"电话号码不能为空"
,
trigger
:
"blur"
}
]
;
}
},
vcodeRules
:
{
type
:
Array
,
default
:
()
=>
{
return
[
{
required
:
true
,
message
:
'验证码不能为空'
,
trigger
:
'blur'
}
]
return
[{
required
:
true
,
message
:
"验证码不能为空"
,
trigger
:
"blur"
}];
}
}
},
data
()
{
data
()
{
return
{
form
:
{
mobile
:
''
,
vcode
:
''
mobile
:
""
,
vcode
:
""
},
isshowtime
:
false
,
leftseconds
:
60
}
isshowtime
:
false
,
leftseconds
:
60
}
;
},
computed
:
{
rules
()
{
rules
()
{
return
{
userNam
e
:
this
.
mobileRules
,
password
:
this
.
vcodeRules
}
mobil
e
:
this
.
mobileRules
,
vcode
:
this
.
vcodeRules
}
;
}
},
methods
:
{
sendVCode
(){
let
tmp
=
61
this
.
isshowtime
=
true
var
th
=
setInterval
(()
=>
{
this
.
leftseconds
=
tmp
--
if
(
tmp
==
0
){
clearInterval
(
th
)
this
.
isshowtime
=
false
}
},
1000
)
sendVCode
()
{
if
(
this
.
form
.
mobile
.
trim
()
!=
""
)
{
let
tmp
=
60
;
this
.
isshowtime
=
true
;
var
th
=
setInterval
(()
=>
{
this
.
leftseconds
=
tmp
--
;
if
(
tmp
==
0
)
{
clearInterval
(
th
);
this
.
isshowtime
=
false
;
}
},
1000
);
this
.
$emit
(
"onsendvcode"
,
{
mobile
:
this
.
form
.
mobile
});
}
},
handleSubmit
()
{
this
.
$refs
.
loginForm
.
validate
(
(
valid
)
=>
{
handleSubmit
()
{
this
.
$refs
.
loginForm
.
validate
(
valid
=>
{
if
(
valid
)
{
this
.
$emit
(
'on-success-valid'
,
{
userNam
e
:
this
.
form
.
mobile
,
password
:
this
.
form
.
vcode
})
this
.
$emit
(
"on-success-valid"
,
{
mobil
e
:
this
.
form
.
mobile
,
vcode
:
this
.
form
.
vcode
})
;
}
})
})
;
}
}
}
}
;
</
script
>
iview-admin/src/config/index.js
View file @
f52bfe02
...
...
@@ -3,7 +3,7 @@ export default {
* @description 配置显示在浏览器标签的title
*/
title
:
'智慧中台 '
,
appkey
:
'
860b4f4f-ac2f-4623-8b16-62764d154e91
'
,
appkey
:
'
109d8eb3-11ce-4886-b73b-4fdb15837d1b
'
,
/**
* @description token在Cookie中存储的天数,默认1天
*/
...
...
iview-admin/src/libs/api.request.js
View file @
f52bfe02
...
...
@@ -2,5 +2,5 @@ import HttpRequest from '@/libs/axios'
import
config
from
'@/config'
const
baseUrl
=
process
.
env
.
NODE_ENV
===
'development'
?
config
.
baseUrl
.
dev
:
config
.
baseUrl
.
pro
const
axios
=
new
HttpRequest
(
baseUrl
)
const
axios
=
new
HttpRequest
(
baseUrl
,
config
)
export
default
axios
iview-admin/src/libs/axios.js
View file @
f52bfe02
import
axios
from
'axios'
import
store
from
'@/store'
import
{
getToken
}
from
'./util'
import
configapp
from
'@/config'
// import { Spin } from 'iview'
const
addErrorLog
=
errorInfo
=>
{
const
{
statusText
,
status
,
request
:
{
responseURL
}
}
=
errorInfo
...
...
@@ -15,15 +14,22 @@ const addErrorLog = errorInfo => {
}
class
HttpRequest
{
constructor
(
baseUrl
=
baseURL
)
{
constructor
(
baseUrl
=
baseURL
,
confapp
)
{
this
.
baseUrl
=
baseUrl
this
.
queue
=
{}
this
.
confapp
=
confapp
}
getInsideConfig
()
{
let
appkey
=
null
let
companykey
=
null
let
regrole
=
null
try
{
let
params
=
new
URLSearchParams
(
location
.
search
)
appkey
=
params
.
get
(
"appkey"
)
companykey
=
params
.
get
(
"companykey"
)
regrole
=
params
.
get
(
"regrole"
)
this
.
confapp
.
regrole
=
regrole
this
.
confapp
.
companykey
=
companykey
}
catch
(
e
){
console
.
log
(
e
)
}
...
...
@@ -31,7 +37,10 @@ class HttpRequest {
baseURL
:
this
.
baseUrl
,
headers
:
{
Authorization
:
"Bearer "
+
getToken
(),
XAPPKEY
:
appkey
?
appkey
:
configapp
.
appkey
XAPPKEY
:
appkey
?
appkey
:
this
.
confapp
.
appkey
,
XCOMPANYKEY
:
companykey
,
XREGROLE
:
regrole
,
//专用于注册时,区分是否是非租户注册
XBIZPATH
:
this
.
confapp
.
bizpath
}
}
return
config
...
...
iview-admin/src/libs/util.js
View file @
f52bfe02
...
...
@@ -88,6 +88,9 @@ export const getMenuByRouter = (list, access) => {
export
const
getBreadCrumbList
=
(
route
,
homeRoute
)
=>
{
let
homeItem
=
{
...
homeRoute
,
icon
:
homeRoute
.
meta
.
icon
}
let
routeMetched
=
route
.
matched
console
.
log
(
">>>>>>>>>>>>>>>>>==================="
)
console
.
log
(
routeMetched
)
console
.
log
(
route
)
if
(
routeMetched
.
some
(
item
=>
item
.
name
===
homeRoute
.
name
))
return
[
homeItem
]
let
res
=
routeMetched
.
filter
(
item
=>
{
return
item
.
meta
===
undefined
||
!
item
.
meta
.
hideInBread
...
...
iview-admin/src/router/index.js
View file @
f52bfe02
...
...
@@ -24,7 +24,8 @@ const turnTo = (to, access, next) => {
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
iView
.
LoadingBar
.
start
()
const
token
=
getToken
()
console
.
log
(
token
,
to
.
name
)
//console.log(token,to.path)
config
.
bizpath
=
to
.
path
if
(
!
token
&&
to
.
name
!==
LOGIN_PAGE_NAME
)
{
// 未登录且要跳转的页面不是登录页
next
({
...
...
iview-admin/src/store/module/user.js
View file @
f52bfe02
...
...
@@ -74,13 +74,10 @@ export default {
},
actions
:
{
// 登录
handleLogin
({
commit
},
{
userName
,
password
}
)
{
userName
=
userName
.
trim
()
handleLogin
({
commit
},
upobj
)
{
//
userName = userName.trim()
return
new
Promise
((
resolve
,
reject
)
=>
{
login
({
userName
,
password
}).
then
(
res
=>
{
login
(
upobj
).
then
(
res
=>
{
const
rtn
=
res
.
data
console
.
log
(
rtn
)
if
(
rtn
.
status
==
0
){
...
...
iview-admin/src/view/components/tables/biztables.vue
View file @
f52bfe02
...
...
@@ -101,6 +101,7 @@ export default {
},
props
:
{
packageName
:
String
,
modelName
:
String
,
metaName
:
{
type
:
String
,
default
:
"user_info"
...
...
@@ -332,7 +333,7 @@ export default {
});
},
buildUrl
(
methodName
)
{
let
modelname
=
this
.
metaName
.
split
(
"_"
)[
0
];
let
modelname
=
this
.
m
odelName
?
this
.
modelName
:
this
.
m
etaName
.
split
(
"_"
)[
0
];
console
.
log
(
modelname
,
">>>>>>>>>>>>>>>>>>"
);
let
url
=
"/web/"
+
this
.
packageName
+
"/"
+
modelname
+
"Ctl/"
+
methodName
;
...
...
iview-admin/src/view/login/login.vue
View file @
f52bfe02
...
...
@@ -5,17 +5,19 @@
<
template
>
<div
class=
"login"
>
<div
class=
"login-con"
>
<Card
icon=
"log-in"
title=
"欢迎登录"
:bordered=
"false"
style=
"border-radius:0px"
>
<p
slot=
"title"
@
click
.
prevent=
"ispasslogin=true"
>
<a
href=
"#"
>
密码登录
</a>
</p>
<p
slot=
"extra"
@
click
.
prevent=
"ispasslogin=false"
>
<Card
icon=
"log-in"
:bordered=
"false"
style=
"border-radius:0px"
>
<p
slot=
"title"
@
click
.
prevent=
"ispasslogin=false"
>
<a
href=
"#"
>
验证码登录
</a>
</p>
<p
slot=
"extra"
@
click
.
prevent=
"ispasslogin=true"
>
<a
href=
"#"
>
密码登录
</a>
</p>
<div
class=
"form-con"
>
<MobileForm
v-if=
"!ispasslogin"
@
on-success-valid=
"handleSubmit"
@
onsendvcode=
"onsendvcode"
></MobileForm>
<login-form
v-if=
"ispasslogin"
@
on-success-valid=
"handleSubmit"
></login-form>
<MobileForm
v-if=
"!ispasslogin"
@
on-success-valid=
"handleSubmit"
></MobileForm>
<p
class=
"login-tip"
>
注册
</p>
<p
class=
"login-tip"
>
验证码登录,如果不存在就自动完成
注册
</p>
</div>
</Card>
</div>
...
...
@@ -23,13 +25,16 @@
</
template
>
<
script
>
import
{
sendVCode
,
}
from
"@/api/user"
;
import
LoginForm
from
'_c/login-form'
import
MobileForm
from
'_c/phone-form'
import
{
mapActions
}
from
'vuex'
export
default
{
data
(){
return
{
ispasslogin
:
tru
e
ispasslogin
:
fals
e
}
},
components
:
{
...
...
@@ -41,8 +46,14 @@ export default {
'handleLogin'
,
'getUserInfo'
]),
handleSubmit
({
userName
,
password
})
{
this
.
handleLogin
({
userName
,
password
}).
then
(
res
=>
{
onsendvcode
(
obj
){
sendVCode
(
obj
).
then
((
res
)
=>
{
let
ret
=
res
.
data
console
.
log
(
res
.
data
)
})
},
handleSubmit
(
upobj
)
{
this
.
handleLogin
(
upobj
).
then
(
res
=>
{
this
.
$router
.
push
({
name
:
this
.
$config
.
homeName
})
...
...
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