Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
client
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f8389862
authored
Jul 29, 2025
by
lijinqi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录修改
parent
0ecae0aa
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
24 additions
and
97 deletions
+24
-97
.env.development
+1
-1
src/api/login.js
+4
-17
src/router/index.js
+1
-1
src/store/modules/user.js
+7
-5
src/utils/request.js
+3
-2
src/views/index.vue
+0
-0
src/views/index_old.vue
+0
-0
src/views/login.vue
+8
-39
src/views/register.vue
+0
-32
No files found.
.env.development
View file @
f8389862
...
@@ -5,4 +5,4 @@ VITE_APP_TITLE = 先进计算普惠算力公共服务平台
...
@@ -5,4 +5,4 @@ VITE_APP_TITLE = 先进计算普惠算力公共服务平台
VITE_APP_ENV = 'development'
VITE_APP_ENV = 'development'
# 先进计算普惠算力公共服务平台/开发环境
# 先进计算普惠算力公共服务平台/开发环境
VITE_APP_BASE_API = 'http://localhost:
8086
'
VITE_APP_BASE_API = 'http://localhost:
48080/app-api/
'
src/api/login.js
View file @
f8389862
import
request
from
'@/utils/request'
import
request
from
'@/utils/request'
// 登录方法
// 登录方法
export
function
login
(
usernam
e
,
password
,
code
,
uuid
)
{
export
function
login
(
mobil
e
,
password
,
code
,
uuid
)
{
const
data
=
{
const
data
=
{
usernam
e
,
mobil
e
,
password
,
password
,
code
,
code
,
uuid
uuid
}
}
return
request
({
return
request
({
url
:
'/login'
,
url
:
'/
member/auth/
login'
,
headers
:
{
headers
:
{
isToken
:
false
,
isToken
:
false
,
repeatSubmit
:
false
repeatSubmit
:
false
...
@@ -42,19 +42,7 @@ export function getInfo() {
...
@@ -42,19 +42,7 @@ export function getInfo() {
// 退出方法
// 退出方法
export
function
logout
()
{
export
function
logout
()
{
return
request
({
return
request
({
url
:
'/logout'
,
url
:
'/
member/auth/
logout'
,
method
:
'post'
method
:
'post'
})
})
}
}
// 获取验证码
export
function
getCodeImg
()
{
return
request
({
url
:
'/captchaImage'
,
headers
:
{
isToken
:
false
},
method
:
'get'
,
timeout
:
20000
})
}
\ No newline at end of file
src/router/index.js
View file @
f8389862
...
@@ -67,7 +67,7 @@ export const constantRoutes = [
...
@@ -67,7 +67,7 @@ export const constantRoutes = [
children
:
[
children
:
[
{
{
path
:
'/index'
,
path
:
'/index'
,
component
:
()
=>
import
(
'@/views/index
-copy
.vue'
),
component
:
()
=>
import
(
'@/views/index.vue'
),
name
:
'Index'
,
name
:
'Index'
,
meta
:
{
title
:
'首页'
,
icon
:
'dashboard'
,
affix
:
true
}
meta
:
{
title
:
'首页'
,
icon
:
'dashboard'
,
affix
:
true
}
}
}
...
...
src/store/modules/user.js
View file @
f8389862
...
@@ -16,14 +16,16 @@ const useUserStore = defineStore(
...
@@ -16,14 +16,16 @@ const useUserStore = defineStore(
actions
:
{
actions
:
{
// 登录
// 登录
login
(
userInfo
)
{
login
(
userInfo
)
{
const
username
=
userInfo
.
usernam
e
.
trim
()
const
mobile
=
userInfo
.
mobil
e
.
trim
()
const
password
=
userInfo
.
password
const
password
=
userInfo
.
password
const
code
=
userInfo
.
code
const
code
=
userInfo
.
code
const
uuid
=
userInfo
.
uuid
const
uuid
=
userInfo
.
uuid
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
login
(
usernam
e
,
password
,
code
,
uuid
).
then
(
res
=>
{
login
(
mobil
e
,
password
,
code
,
uuid
).
then
(
res
=>
{
setToken
(
res
.
t
oken
)
setToken
(
res
.
data
.
accessT
oken
)
this
.
token
=
res
.
token
this
.
token
=
res
.
data
.
token
resolve
()
resolve
()
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
reject
(
error
)
reject
(
error
)
...
@@ -44,7 +46,7 @@ const useUserStore = defineStore(
...
@@ -44,7 +46,7 @@ const useUserStore = defineStore(
this
.
roles
=
[
'ROLE_DEFAULT'
]
this
.
roles
=
[
'ROLE_DEFAULT'
]
}
}
this
.
id
=
user
.
userId
this
.
id
=
user
.
userId
this
.
name
=
user
.
userNam
e
this
.
name
=
user
.
mobil
e
this
.
avatar
=
avatar
this
.
avatar
=
avatar
resolve
(
res
)
resolve
(
res
)
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
...
...
src/utils/request.js
View file @
f8389862
...
@@ -10,8 +10,9 @@ import useUserStore from '@/store/modules/user'
...
@@ -10,8 +10,9 @@ import useUserStore from '@/store/modules/user'
let
downloadLoadingInstance
;
let
downloadLoadingInstance
;
// 是否显示重新登录
// 是否显示重新登录
export
let
isRelogin
=
{
show
:
false
};
export
let
isRelogin
=
{
show
:
false
};
axios
.
defaults
.
headers
[
'Content-Type'
]
=
'application/json;charset=utf-8'
axios
.
defaults
.
headers
[
'Content-Type'
]
=
'application/json;charset=utf-8'
axios
.
defaults
.
headers
[
'tenant-id'
]
=
'1'
;
// 创建axios实例
// 创建axios实例
const
service
=
axios
.
create
({
const
service
=
axios
.
create
({
// axios中请求配置有baseURL选项,表示请求URL公共部分
// axios中请求配置有baseURL选项,表示请求URL公共部分
...
@@ -127,7 +128,7 @@ export function download(url, params, filename, config) {
...
@@ -127,7 +128,7 @@ export function download(url, params, filename, config) {
downloadLoadingInstance
=
ElLoading
.
service
({
text
:
"正在下载数据,请稍候"
,
background
:
"rgba(0, 0, 0, 0.7)"
,
})
downloadLoadingInstance
=
ElLoading
.
service
({
text
:
"正在下载数据,请稍候"
,
background
:
"rgba(0, 0, 0, 0.7)"
,
})
return
service
.
post
(
url
,
params
,
{
return
service
.
post
(
url
,
params
,
{
transformRequest
:
[(
params
)
=>
{
return
tansParams
(
params
)
}],
transformRequest
:
[(
params
)
=>
{
return
tansParams
(
params
)
}],
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded'
},
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded'
},
responseType
:
'blob'
,
responseType
:
'blob'
,
...
config
...
config
}).
then
(
async
(
data
)
=>
{
}).
then
(
async
(
data
)
=>
{
...
...
src/views/index.vue
View file @
f8389862
This diff is collapsed.
Click to expand it.
src/views/index
-copy
.vue
→
src/views/index
_old
.vue
View file @
f8389862
This diff is collapsed.
Click to expand it.
src/views/login.vue
View file @
f8389862
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
<div
class=
"login"
>
<div
class=
"login"
>
<el-form
ref=
"loginRef"
:model=
"loginForm"
:rules=
"loginRules"
class=
"login-form"
>
<el-form
ref=
"loginRef"
:model=
"loginForm"
:rules=
"loginRules"
class=
"login-form"
>
<h3
class=
"title"
>
先进计算普惠算力公共服务平台
</h3>
<h3
class=
"title"
>
先进计算普惠算力公共服务平台
</h3>
<el-form-item
prop=
"
usernam
e"
>
<el-form-item
prop=
"
mobil
e"
>
<el-input
<el-input
v-model=
"loginForm.
usernam
e"
v-model=
"loginForm.
mobil
e"
type=
"text"
type=
"text"
size=
"large"
size=
"large"
auto-complete=
"off"
auto-complete=
"off"
...
@@ -27,22 +27,6 @@
...
@@ -27,22 +27,6 @@
</
template
>
</
template
>
</el-input>
</el-input>
</el-form-item>
</el-form-item>
<el-form-item
prop=
"code"
v-if=
"captchaEnabled"
>
<el-input
v-model=
"loginForm.code"
size=
"large"
auto-complete=
"off"
placeholder=
"验证码"
style=
"width: 64%"
@
keyup
.
enter=
"handleLogin"
>
<
template
#
prefix
>
<svg-icon
icon-class=
"validCode"
class=
"el-input__icon input-icon"
/>
</
template
>
</el-input>
<div
class=
"login-code"
>
<img
:src=
"codeUrl"
@
click=
"getCode"
class=
"login-code-img"
/>
</div>
</el-form-item>
<div
class=
"flex-align-center flex-space-between mb20"
>
<div
class=
"flex-align-center flex-space-between mb20"
>
<el-checkbox
v-model=
"loginForm.rememberMe"
>
记住密码
</el-checkbox>
<el-checkbox
v-model=
"loginForm.rememberMe"
>
记住密码
</el-checkbox>
...
@@ -72,7 +56,6 @@
...
@@ -72,7 +56,6 @@
</template>
</template>
<
script
setup
>
<
script
setup
>
import
{
getCodeImg
}
from
'@/api/login'
import
Cookies
from
'js-cookie'
import
Cookies
from
'js-cookie'
import
{
encrypt
,
decrypt
}
from
'@/utils/jsencrypt'
import
{
encrypt
,
decrypt
}
from
'@/utils/jsencrypt'
import
useUserStore
from
'@/store/modules/user'
import
useUserStore
from
'@/store/modules/user'
...
@@ -84,7 +67,7 @@ const router = useRouter()
...
@@ -84,7 +67,7 @@ const router = useRouter()
const
{
proxy
}
=
getCurrentInstance
()
const
{
proxy
}
=
getCurrentInstance
()
const
loginForm
=
ref
({
const
loginForm
=
ref
({
usernam
e
:
''
,
mobil
e
:
''
,
password
:
''
,
password
:
''
,
rememberMe
:
false
,
rememberMe
:
false
,
code
:
''
,
code
:
''
,
...
@@ -92,7 +75,7 @@ const loginForm = ref({
...
@@ -92,7 +75,7 @@ const loginForm = ref({
})
})
const
loginRules
=
{
const
loginRules
=
{
username
:
[{
required
:
true
,
trigger
:
'blur'
,
message
:
'请输入您的账
号'
}],
mobile
:
[{
required
:
true
,
trigger
:
'blur'
,
message
:
'请输入您的手机
号'
}],
password
:
[{
required
:
true
,
trigger
:
'blur'
,
message
:
'请输入您的密码'
}],
password
:
[{
required
:
true
,
trigger
:
'blur'
,
message
:
'请输入您的密码'
}],
code
:
[{
required
:
true
,
trigger
:
'change'
,
message
:
'请输入验证码'
}]
code
:
[{
required
:
true
,
trigger
:
'change'
,
message
:
'请输入验证码'
}]
}
}
...
@@ -115,12 +98,12 @@ function handleLogin () {
...
@@ -115,12 +98,12 @@ function handleLogin () {
loading
.
value
=
true
loading
.
value
=
true
// 勾选了需要记住密码设置在 cookie 中设置记住用户名和密码
// 勾选了需要记住密码设置在 cookie 中设置记住用户名和密码
if
(
loginForm
.
value
.
rememberMe
)
{
if
(
loginForm
.
value
.
rememberMe
)
{
Cookies
.
set
(
'
username'
,
loginForm
.
value
.
usernam
e
,
{
expires
:
30
})
Cookies
.
set
(
'
mobile'
,
loginForm
.
value
.
mobil
e
,
{
expires
:
30
})
Cookies
.
set
(
'password'
,
encrypt
(
loginForm
.
value
.
password
),
{
expires
:
30
})
Cookies
.
set
(
'password'
,
encrypt
(
loginForm
.
value
.
password
),
{
expires
:
30
})
Cookies
.
set
(
'rememberMe'
,
loginForm
.
value
.
rememberMe
,
{
expires
:
30
})
Cookies
.
set
(
'rememberMe'
,
loginForm
.
value
.
rememberMe
,
{
expires
:
30
})
}
else
{
}
else
{
// 否则移除
// 否则移除
Cookies
.
remove
(
'
usernam
e'
)
Cookies
.
remove
(
'
mobil
e'
)
Cookies
.
remove
(
'password'
)
Cookies
.
remove
(
'password'
)
Cookies
.
remove
(
'rememberMe'
)
Cookies
.
remove
(
'rememberMe'
)
}
}
...
@@ -136,37 +119,23 @@ function handleLogin () {
...
@@ -136,37 +119,23 @@ function handleLogin () {
router
.
push
({
path
:
redirect
.
value
||
'/'
,
query
:
otherQueryParams
})
router
.
push
({
path
:
redirect
.
value
||
'/'
,
query
:
otherQueryParams
})
}).
catch
(()
=>
{
}).
catch
(()
=>
{
loading
.
value
=
false
loading
.
value
=
false
// 重新获取验证码
if
(
captchaEnabled
.
value
)
{
getCode
()
}
})
})
}
}
})
})
}
}
function
getCode
()
{
getCodeImg
().
then
(
res
=>
{
captchaEnabled
.
value
=
res
.
captchaEnabled
===
undefined
?
true
:
res
.
captchaEnabled
if
(
captchaEnabled
.
value
)
{
codeUrl
.
value
=
'data:image/gif;base64,'
+
res
.
img
loginForm
.
value
.
uuid
=
res
.
uuid
}
})
}
function
getCookie
()
{
function
getCookie
()
{
const
username
=
Cookies
.
get
(
'usernam
e'
)
const
mobile
=
Cookies
.
get
(
'mobil
e'
)
const
password
=
Cookies
.
get
(
'password'
)
const
password
=
Cookies
.
get
(
'password'
)
const
rememberMe
=
Cookies
.
get
(
'rememberMe'
)
const
rememberMe
=
Cookies
.
get
(
'rememberMe'
)
loginForm
.
value
=
{
loginForm
.
value
=
{
username
:
username
===
undefined
?
loginForm
.
value
.
username
:
usernam
e
,
mobile
:
mobile
===
undefined
?
loginForm
.
value
.
mobile
:
mobil
e
,
password
:
password
===
undefined
?
loginForm
.
value
.
password
:
decrypt
(
password
),
password
:
password
===
undefined
?
loginForm
.
value
.
password
:
decrypt
(
password
),
rememberMe
:
rememberMe
===
undefined
?
false
:
Boolean
(
rememberMe
)
rememberMe
:
rememberMe
===
undefined
?
false
:
Boolean
(
rememberMe
)
}
}
}
}
getCode
()
getCookie
()
getCookie
()
</
script
>
</
script
>
...
...
src/views/register.vue
View file @
f8389862
...
@@ -40,22 +40,6 @@
...
@@ -40,22 +40,6 @@
</
template
>
</
template
>
</el-input>
</el-input>
</el-form-item>
</el-form-item>
<el-form-item
prop=
"code"
v-if=
"captchaEnabled"
>
<el-input
size=
"large"
v-model=
"registerForm.code"
auto-complete=
"off"
placeholder=
"验证码"
style=
"width: 64%"
@
keyup
.
enter=
"handleRegister"
>
<
template
#
prefix
>
<svg-icon
icon-class=
"validCode"
class=
"el-input__icon input-icon"
/>
</
template
>
</el-input>
<div
class=
"register-code"
>
<img
:src=
"codeUrl"
@
click=
"getCode"
class=
"register-code-img"
/>
</div>
</el-form-item>
<div
class=
"flex-justify-end mb20"
>
<div
class=
"flex-justify-end mb20"
>
<router-link
class=
"link-type"
:to=
"'/login'"
>
使用已有账户登录
</router-link>
<router-link
class=
"link-type"
:to=
"'/login'"
>
使用已有账户登录
</router-link>
</div>
</div>
...
@@ -82,7 +66,6 @@
...
@@ -82,7 +66,6 @@
<
script
setup
>
<
script
setup
>
import
{
ElMessageBox
}
from
'element-plus'
import
{
ElMessageBox
}
from
'element-plus'
import
{
getCodeImg
,
register
}
from
'@/api/login'
const
router
=
useRouter
()
const
router
=
useRouter
()
const
{
proxy
}
=
getCurrentInstance
()
const
{
proxy
}
=
getCurrentInstance
()
...
@@ -122,7 +105,6 @@ const registerRules = {
...
@@ -122,7 +105,6 @@ const registerRules = {
const
codeUrl
=
ref
(
''
)
const
codeUrl
=
ref
(
''
)
const
loading
=
ref
(
false
)
const
loading
=
ref
(
false
)
const
captchaEnabled
=
ref
(
true
)
function
handleRegister
()
{
function
handleRegister
()
{
proxy
.
$refs
.
registerRef
.
validate
(
valid
=>
{
proxy
.
$refs
.
registerRef
.
validate
(
valid
=>
{
...
@@ -139,25 +121,11 @@ function handleRegister () {
...
@@ -139,25 +121,11 @@ function handleRegister () {
})
})
}).
catch
(()
=>
{
}).
catch
(()
=>
{
loading
.
value
=
false
loading
.
value
=
false
if
(
captchaEnabled
)
{
getCode
()
}
})
})
}
}
})
})
}
}
function
getCode
()
{
getCodeImg
().
then
(
res
=>
{
captchaEnabled
.
value
=
res
.
captchaEnabled
===
undefined
?
true
:
res
.
captchaEnabled
if
(
captchaEnabled
.
value
)
{
codeUrl
.
value
=
'data:image/gif;base64,'
+
res
.
img
registerForm
.
value
.
uuid
=
res
.
uuid
}
})
}
getCode
()
</
script
>
</
script
>
<
style
lang=
'scss'
scoped
>
<
style
lang=
'scss'
scoped
>
...
...
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