Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pptist
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
viitto
pptist
Commits
3e1fdcae
Commit
3e1fdcae
authored
May 27, 2024
by
罗超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支持邮件直接跳转
parent
f0f1015b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
7 deletions
+40
-7
App.vue
src/App.vue
+4
-4
router.ts
src/router/router.ts
+7
-0
Forgot.vue
src/views/Auth/Forgot.vue
+29
-3
No files found.
src/App.vue
View file @
3e1fdcae
...
...
@@ -55,13 +55,13 @@ onMounted(() => {
const
rules
=
[
'/editor/'
,
'/team_editor/'
,
'/manager_template/'
,
'/create_template/'
]
window
.
onbeforeunload
=
function
(
event
)
{
const
currentUrl
=
window
.
location
.
pathname
;
console
.
log
(
currentUrl
)
const
shouldShowWarning
=
rules
.
some
(
rule
=>
currentUrl
.
includes
(
rule
));
console
.
log
(
shouldShowWarning
)
if
(
shouldShowWarning
)
{
event
.
preventDefault
();
const
confirmationMessage
=
"你确定要离开这个页面吗?离开前注意检查是否已经保存"
;
event
.
returnValue
=
confirmationMessage
;
return
confirmationMessag
e
;
//
const confirmationMessage = "你确定要离开这个页面吗?离开前注意检查是否已经保存";
//
event.returnValue = confirmationMessage;
return
fals
e
;
}
return
null
;
}
...
...
src/router/router.ts
View file @
3e1fdcae
...
...
@@ -60,6 +60,13 @@ const routes: RouteRecordRaw[] = [
title
:
'忘记密码 Travel Design'
}
},
{
path
:
'/newpass/:code(
\\
d+)/:token'
,
component
:
()
=>
import
(
'@/views/Auth/Forgot.vue'
),
meta
:{
title
:
'忘记密码 Travel Design'
}
},
{
path
:
'/notfound'
,
component
:
()
=>
import
(
'@/views/ErrorNotFound.vue'
),
...
...
src/views/Auth/Forgot.vue
View file @
3e1fdcae
...
...
@@ -6,7 +6,7 @@
<img
src=
"https://imgfile.oytour.com/static/pptdefault1.png"
style=
"height: 25px;width: auto;"
>
</div>
<div
class=
"col column items-center flex-center full-width"
>
<div
class=
"text-center full-width"
v-if=
"!resetToken"
>
<div
class=
"text-center full-width"
v-if=
"!resetToken
&& !validateFaild
"
>
<div
class=
"text-weight-bold text-dark"
style=
"font-size: 23px;"
>
忘记密码?
</div>
<div
class=
"text-info q-mt-md q-mb-xl"
style=
"font-size: 14px; font-weight: 500;"
>
输入你的注册邮箱,重置你的密码。
</div>
<el-input
v-model=
"email"
placeholder=
"邮箱"
size=
"large"
clearable
class=
"pingfangr full-width"
:readonly=
"isSend"
style=
"height:50px !important;"
>
...
...
@@ -25,7 +25,7 @@
<el-button
type=
"primary"
size=
"large"
class=
"q-mt-lg ppt-button"
:disabled=
"!mailRegex.test(email)"
@
click=
"sendVerifyCode"
:loading=
"sending"
v-if=
"!isSend"
>
发送验证码
</el-button>
<el-button
type=
"primary"
size=
"large"
class=
"q-mt-lg ppt-button"
:disabled=
"code.length!=6"
:loading=
"sending"
v-if=
"isSend && !sending"
@
click=
"verifyHandler"
>
提交验证码
</el-button>
</div>
<div
class=
"full-width"
v-if=
"resetToken"
>
<div
class=
"full-width"
v-if=
"resetToken
&& !validateFaild
"
>
<div
class=
"text-weight-bold text-dark"
style=
"font-size: 16px;"
>
重新设置你的密码
</div>
<div
class=
"text-weight-bold text-dark q-mt-md"
style=
"font-size: 24px;"
>
{{ resetToken.mail }}
</div>
<div
class=
"text-info q-mt-md q-mb-xl"
style=
"font-size: 14px; font-weight: 500;"
>
我们建议你的密码包含大写+小写+数字+特殊字符进行组合
</div>
...
...
@@ -35,6 +35,13 @@
<el-button
type=
"primary"
size=
"large"
class=
"q-mt-lg ppt-button"
@
click=
"resetPassword"
:loading=
"loading"
>
确认密码
</el-button>
</div>
</div>
<div
class=
"full-width"
v-if=
"validateFaild"
>
<div
class=
"text-weight-bold text-dark"
style=
"font-size: 16px;"
>
你的请求未通过验证
</div>
<div
class=
"text-info q-mt-md q-mb-xl"
style=
"font-size: 14px; font-weight: 500;"
>
我们无法通过你的请求,可能是由于你的链接已经失效,点击下方按钮重新发起申请。
</div>
<div>
<el-button
type=
"primary"
size=
"large"
class=
"q-mt-lg ppt-button"
@
click=
"refereHandler"
>
重新申请修改密码
</el-button>
</div>
</div>
</div>
<div>
<el-button
link
icon=
"Back"
size=
"large"
class=
"ppt-button text-weight-bolder"
@
click=
"forwardHandler('/login')"
>
返回登录
</el-button>
...
...
@@ -50,7 +57,7 @@
<
script
lang=
"ts"
setup
>
import
{
ApiResult
}
from
"@/configs/axios"
;
import
UserServices
from
"@/services/UserService"
;
import
{
ElMessage
}
from
"element-plus"
;
import
{
El
Loading
,
El
Message
}
from
"element-plus"
;
import
{
reactive
,
ref
}
from
"vue"
;
import
VerifyCode
from
"@/views/components/element/Verify/VerifyCode.vue"
;
import
{
useRouter
}
from
"vue-router"
;
...
...
@@ -63,6 +70,7 @@ const isSend = ref(false)
const
isCountdown
=
ref
(
false
)
const
countValue
=
ref
<
number
>
(
0
)
const
resetToken
=
ref
<
any
>
()
const
validateFaild
=
ref
(
false
)
const
resetModel
=
reactive
({
newPassword
:
''
,
confirmPassword
:
''
...
...
@@ -95,6 +103,8 @@ const verifyHandler = async ()=>{
}
loading
.
value
=
false
}
const
resetPassword
=
async
()
=>
{
if
(
resetModel
.
newPassword
.
length
<
6
||
resetModel
.
newPassword
.
length
>
20
){
ElMessage
.
error
({
message
:
'新密码长度应为6-20位'
})
...
...
@@ -121,6 +131,22 @@ const resetPassword = async()=>{
const
forwardHandler
=
(
path
:
string
)
=>
{
router
.
push
({
path
})
}
const
checkQuickValidate
=
async
()
=>
{
const
params
=
router
.
currentRoute
.
value
.
params
if
(
router
.
currentRoute
.
value
.
fullPath
.
includes
(
'/newpass/'
)
&&
params
.
code
&&
params
.
token
)
{
const
validLoading
=
ElLoading
.
service
({
text
:
'正在加载中...'
,
lock
:
true
})
const
response
=
await
UserServices
.
VerifyResetPassCodeAsync
(
''
,
params
.
code
.
toString
(),
params
.
token
.
toString
())
if
(
response
.
data
.
resultCode
==
ApiResult
.
SUCCESS
){
resetToken
.
value
=
response
.
data
.
data
ElMessage
.
success
({
message
:
'验证成功,请重新设置你的密码'
})
}
else
validateFaild
.
value
=
true
validLoading
.
close
()
}
}
const
refereHandler
=
()
=>
{
location
.
href
=
'/forgot'
}
checkQuickValidate
()
</
script
>
<
style
>
...
...
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