Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsk-cr20g
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
dsk-cr20g
Commits
c95537b5
Commit
c95537b5
authored
Sep 05, 2023
by
huangjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*
parent
f2895543
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
180 additions
and
22 deletions
+180
-22
login.js
dsk-operate-ui/src/api/login.js
+30
-2
index.vue
dsk-operate-ui/src/views/enterpriseManagement/index.vue
+7
-5
login.vue
dsk-operate-ui/src/views/login.vue
+141
-13
vue.config.js
dsk-operate-ui/vue.config.js
+2
-2
No files found.
dsk-operate-ui/src/api/login.js
View file @
c95537b5
...
...
@@ -82,7 +82,7 @@ export function changeTenants(data) {
})
}
//发送短信验证码
//发送短信验证码
(删除组织使用)
export
function
captchaSms
()
{
return
request
({
url
:
'/getTempSmsCode'
,
...
...
@@ -90,7 +90,7 @@ export function captchaSms() {
})
}
//验证短信验证码
//验证短信验证码
(删除组织使用)
export
function
checkSmsCode
(
data
)
{
return
request
({
url
:
'/checkSmsCode'
,
...
...
@@ -99,3 +99,31 @@ export function checkSmsCode(data) {
})
}
//根据用户账号获取用户绑定的租户列表
export
function
userTenantList
(
data
)
{
return
request
({
url
:
'/user/tenant/list'
,
method
:
'POST'
,
params
:
data
})
}
//登录获取验证码
export
function
logincaptchaSms
(
data
)
{
return
request
({
url
:
'/captchaSms'
,
method
:
'get'
,
params
:
data
})
}
//短信登录
export
function
smsLogin
(
data
)
{
return
request
({
url
:
'/smsLogin'
,
method
:
'post'
,
data
:
data
})
}
dsk-operate-ui/src/views/enterpriseManagement/index.vue
View file @
c95537b5
...
...
@@ -154,11 +154,10 @@
v-model=
"form.dateRange"
style=
"width: 240px"
value-format=
"yyyy-MM-dd HH:mm:ss"
type=
"daterange"
type=
"date
time
range"
range-separator=
"-"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
:default-time=
"['00:00:00', '23:59:59']"
></el-date-picker>
</el-form-item>
</el-col>
...
...
@@ -295,7 +294,6 @@
},
created
()
{
this
.
getList
();
this
.
getpack
()
},
methods
:
{
//获取企业方案列表
...
...
@@ -305,9 +303,9 @@
this
.
packageList
=
res
.
data
this
.
packageList
.
forEach
(
item
=>
{
if
(
item
.
status
==
'0'
){
item
.
disabled
=
true
}
else
{
item
.
disabled
=
false
}
else
{
item
.
disabled
=
true
}
})
}
...
...
@@ -366,12 +364,14 @@
this
.
reset
();
this
.
open
=
true
;
this
.
title
=
"添加企业"
;
this
.
getpack
()
},
/** 修改按钮操作 */
handleUpdate
(
row
)
{
this
.
disabled
=
false
this
.
reset
();
const
id
=
row
.
id
this
.
getpack
()
getTenant
(
id
).
then
(
response
=>
{
this
.
form
=
response
.
data
;
this
.
form
.
dateRange
=
[
response
.
data
.
startTime
,
response
.
data
.
expireTime
]
...
...
@@ -383,6 +383,7 @@
handleLook
(
row
){
this
.
handleUpdate
(
row
)
this
.
disabled
=
true
this
.
getpack
()
},
/** 提交按钮 */
submitForm
:
function
()
{
...
...
@@ -421,6 +422,7 @@
}
}).
catch
(
response
=>
{
this
.
$modal
.
msgError
(
response
.
msg
)
loading
.
close
();
});
}
}
...
...
dsk-operate-ui/src/views/login.vue
View file @
c95537b5
...
...
@@ -5,7 +5,7 @@
<img
class=
"logo"
src=
"../assets/images/logo1.png"
/>
<img
class=
"img"
src=
"../assets/images/login/img.png"
/>
</div>
<el-form
v-if=
"!islog"
ref=
"loginForm"
:model=
"loginForm"
:rules=
"loginRules"
class=
"login-form"
>
<el-form
v-if=
"!islog
&& !islang
"
ref=
"loginForm"
:model=
"loginForm"
:rules=
"loginRules"
class=
"login-form"
>
<h3
class=
"title"
><img
src=
"../assets/images/title_icon.png"
/>
欢迎登录系统
</h3>
<el-form-item
prop=
"username"
>
<el-input
...
...
@@ -54,10 +54,54 @@
<span
v-if=
"!loading"
>
登 录
</span>
<span
v-else
>
登 录 中...
</span>
</el-button>
<div
style=
"float: right;"
v-if=
"register"
>
<router-link
class=
"link-type"
:to=
"'/register'"
>
立即注册
</router-link>
<!--
<div
style=
"float: right;"
v-if=
"register"
>
-->
<!--
<router-link
class=
"link-type"
:to=
"'/register'"
>
立即注册
</router-link>
-->
<!--
</div>
-->
</el-form-item>
</el-form>
<el-form
v-if=
"!islog && islang"
ref=
"dxform"
:model=
"dxform"
:rules=
"dxRules"
class=
"login-form"
>
<h3
class=
"title"
><img
src=
"../assets/images/title_icon.png"
/>
欢迎登录系统
</h3>
<h4>
安全验证
</h4>
<el-form-item
prop=
"phonenumber"
>
<el-input
v-model=
"dxform.phonenumber"
type=
"text"
auto-complete=
"off"
placeholder=
"请输入登录账号"
>
<img
class=
"img"
slot=
"prefix"
src=
"../assets/images/user.png"
/>
</el-input>
</el-form-item>
<el-form-item
prop=
"captchaCode"
v-if=
"captchaEnabled && showcode"
>
<el-input
v-model=
"dxform.captchaCode"
auto-complete=
"off"
placeholder=
"请输入验证码"
style=
"width: 56%;float: left;"
>
<img
class=
"img"
slot=
"prefix"
src=
"../assets/images/validCode.png"
/>
</el-input>
<div
class=
"login-code"
>
<img
:src=
"codeUrl"
@
click=
"getCode"
class=
"login-code-img"
/>
</div>
</el-form-item>
<el-form-item
prop=
"captchaCode"
>
<div
style=
"margin-top: 15px;"
>
<el-input
placeholder=
"请输入短信验证码"
v-model=
"dxform.smsCode"
@
keyup
.
enter
.
native=
"dxLogin"
>
<template
slot=
"append"
><div
@
click=
"getsms"
>
{{
smstitle
}}
</div></
template
>
</el-input>
</div>
</el-form-item>
<el-form-item
style=
"width:100%;"
>
<el-button
size=
"medium"
type=
"primary"
style=
"width:100%;height: 48px;border-radius: 4px;font-size: 16px;"
@
click
.
native
.
prevent=
"dxLogin"
>
<span>
确 定
</span>
</el-button>
</el-form-item>
</el-form>
<div
v-if=
"islog"
class=
"login-form choose-form"
>
<h3
class=
"title i"
><img
src=
"../assets/images/login/title_choose.png"
/>
请选择你想要登录的企业
</h3>
...
...
@@ -72,7 +116,7 @@
<
script
>
import
store
from
'@/store'
import
{
changeTenants
,
defaultTenantid
,
getCodeImg
,
getTenants
}
from
'@/api/login'
import
{
changeTenants
,
defaultTenantid
,
getCodeImg
,
getTenants
,
userTenantList
,
logincaptchaSms
,
smsLogin
}
from
'@/api/login'
import
Cookies
from
'js-cookie'
import
{
decrypt
,
encrypt
}
from
'@/utils/jsencrypt'
import
{
Base64
}
from
'js-base64'
...
...
@@ -109,6 +153,26 @@
redirect
:
undefined
,
tenanlist
:[],
defalutId
:
''
,
//默认租户id
//短信登录(安全验证)
dxform
:{
phonenumber
:
''
,
uid
:
''
,
smsCode
:
''
,
captchaCode
:
''
,
templateId
:
'SMS_170345261'
,
},
dxRules
:
{
phonenumber
:
[{
required
:
true
,
trigger
:
"blur"
,
message
:
"请输入您的账号"
}],
captchaCode
:
[{
required
:
true
,
trigger
:
"blur"
,
message
:
"请输入图形验证码"
}],
smsCode
:
[{
required
:
true
,
trigger
:
"blur"
,
message
:
"请输入验证码"
}]
},
//安全验证
islang
:
false
,
getuid
:
false
,
timers
:
null
,
smstime
:
60
,
smstitle
:
'获取验证码'
,
showcode
:
false
,
//是否展示验证码
};
},
watch
:
{
...
...
@@ -130,6 +194,7 @@
if
(
this
.
captchaEnabled
)
{
this
.
codeUrl
=
"data:image/gif;base64,"
+
res
.
data
.
img
;
this
.
loginForm
.
uuid
=
res
.
data
.
uuid
;
this
.
dxform
.
uid
=
res
.
data
.
uuid
;
}
});
},
...
...
@@ -144,6 +209,29 @@
rememberMe
:
rememberMe
===
undefined
?
false
:
Boolean
(
rememberMe
)
};
},
getsms
(){
logincaptchaSms
(
this
.
dxform
).
then
(
res
=>
{
console
.
log
(
res
)
if
(
res
.
code
==
200
){
this
.
$message
.
success
(
'已发送短信!'
)
let
_this
=
this
this
.
timers
=
setInterval
(()
=>
{
_this
.
smstitle
=
'剩余'
+
_this
.
smstime
+
'S'
_this
.
smstime
--
;
if
(
_this
.
smstime
<=
0
){
_this
.
smstitle
=
'发送验证码'
clearInterval
(
_this
.
timers
)
}
},
1000
)
}
else
{
this
.
$message
.
error
(
'短信发送失败!'
)
this
.
getCode
()
this
.
showcode
=
true
}
}).
catch
(
res
=>
{
this
.
$message
.
error
(
res
.
msg
)
})
},
handleLogin
()
{
this
.
$refs
.
loginForm
.
validate
(
valid
=>
{
if
(
valid
)
{
...
...
@@ -160,23 +248,63 @@
}
let
froms
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
loginForm
))
froms
.
password
=
Base64
.
encode
(
this
.
loginForm
.
password
)
this
.
$store
.
dispatch
(
"Login"
,
froms
).
then
(()
=>
{
localStorage
.
setItem
(
'userphone'
,
this
.
loginForm
.
username
)
//密码登录时根据手机号获取是否有多个租户
userTenantList
({
phone
:
this
.
loginForm
.
username
}).
then
(
res
=>
{
if
(
res
.
data
.
length
>
1
){
//需要安全验证(短信登录)
this
.
islang
=
true
this
.
dxform
.
phonenumber
=
this
.
loginForm
.
username
this
.
dxform
.
captchaCode
=
this
.
loginForm
.
code
this
.
showcode
=
false
}
else
{
//无租户列表和一个租户直接登录
this
.
$store
.
dispatch
(
"Login"
,
froms
).
then
(()
=>
{
this
.
loading
=
false
;
this
.
$router
.
push
({
path
:
this
.
redirect
||
"/"
}).
catch
(()
=>
{});
}).
catch
(()
=>
{
this
.
loading
=
false
;
if
(
this
.
captchaEnabled
)
{
this
.
getCode
();
}
});
}
})
// this.$store.dispatch("Login", froms).then(() => {
// defaultTenantid().then(res=>{
// if(res.data.tenantId == "" || res.data.tenantId == null){//无默认企业id
// this.goin()
// }else{
// this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
// }
// })
// }).catch(() => {
// this.loading = false;
// if (this.captchaEnabled) {
// this.getCode();
// }
// });
}
});
},
//短信登录
dxLogin
(){
this
.
$refs
.
dxform
.
validate
(
valid
=>
{
if
(
valid
)
{
let
froms
=
{}
froms
.
phonenumber
=
this
.
dxform
.
phonenumber
froms
.
smsCode
=
this
.
dxform
.
smsCode
smsLogin
(
JSON
.
stringify
(
froms
)).
then
(
res
=>
{
defaultTenantid
().
then
(
res
=>
{
if
(
res
.
data
.
tenantId
==
""
||
res
.
data
.
tenantId
==
null
){
//无默认企业id
this
.
goin
()
}
else
{
setToken
(
res
.
data
.
accessToken
)
store
.
commit
(
'SET_TOKEN'
,
res
.
data
.
accessToken
)
setTenantid
(
res
.
data
.
tenantId
)
this
.
$router
.
push
({
path
:
this
.
redirect
||
"/"
}).
catch
(()
=>
{});
}
})
}).
catch
(()
=>
{
this
.
loading
=
false
;
if
(
this
.
captchaEnabled
)
{
this
.
getCode
();
}
});
})
}
})
;
})
},
goin
(){
this
.
tenantId
=
-
1
...
...
dsk-operate-ui/vue.config.js
View file @
c95537b5
...
...
@@ -36,8 +36,8 @@ module.exports = {
[
process
.
env
.
VUE_APP_BASE_API
]:
{
// target: `http://47.104.91.229:9099/prod-api`,
// target: `http://192.168.0.165:9098`,//施
target
:
`http://192.168.60.6:9098`
,
//谭
// target: `http://139.9.157.49:9099
`,//测试
//
target: `http://192.168.60.6:9098`,//谭
target
:
`http://139.9.157.49:9099/prod-api
`
,
//测试
changeOrigin
:
true
,
pathRewrite
:
{
[
'^'
+
process
.
env
.
VUE_APP_BASE_API
]:
''
...
...
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