Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
campSite
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨梦雪
campSite
Commits
0bc147e1
Commit
0bc147e1
authored
Jun 26, 2025
by
杨梦11
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改验证码登录
parent
3ebb17cb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
374 additions
and
357 deletions
+374
-357
src/views/index/login/Login.vue
src/views/index/login/Login.vue
+374
-357
No files found.
src/views/index/login/Login.vue
View file @
0bc147e1
...
@@ -3,7 +3,9 @@
...
@@ -3,7 +3,9 @@
<div
class=
"title_Login"
>
<div
class=
"title_Login"
>
<div
v-if=
"changeLogin == 1"
>
<div
v-if=
"changeLogin == 1"
>
<div
@
click=
"toCodeLogin"
class=
"title title_top"
>
<div
@
click=
"toCodeLogin"
class=
"title title_top"
>
<div
:class=
"changeLogin == 2 ? 'change_login normal' : 'normal'"
>
验证码登录
</div>
<div
:class=
"changeLogin == 2 ? 'change_login normal' : 'normal'"
>
验证码登录
</div>
</div>
</div>
<div
@
click=
"toLogin"
class=
"title"
>
<div
@
click=
"toLogin"
class=
"title"
>
<div
:class=
"changeLogin == 1 ? 'change_login' : ''"
>
<div
:class=
"changeLogin == 1 ? 'change_login' : ''"
>
...
@@ -79,7 +81,7 @@
...
@@ -79,7 +81,7 @@
ref=
"code"
ref=
"code"
v-else-if=
"changeLogin == 2"
v-else-if=
"changeLogin == 2"
>
>
<img
alt=
""
class=
"img_l"
src=
"@/assets/img/reset/code.png"
/>
<img
alt=
""
class=
"img_l"
src=
"@/assets/img/reset/code.png"
/>
<el-input
<el-input
maxlength=
"20"
maxlength=
"20"
placeholder=
"请输入短信验证码"
placeholder=
"请输入短信验证码"
...
@@ -110,12 +112,12 @@
...
@@ -110,12 +112,12 @@
</
template
>
</
template
>
<
script
>
<
script
>
/* eslint-disable */
/* eslint-disable */
import
{
login
,
loginCode
}
from
"
r/index/login
"
;
import
{
login
,
loginCode
}
from
"
r/index/login
"
;
import
{
mobileCheck
}
from
"
@/common/utils.js
"
;
import
{
mobileCheck
}
from
"
@/common/utils.js
"
;
import
{
intervalTime
}
from
"
store/time
"
;
import
{
intervalTime
}
from
"
store/time
"
;
export
default
{
export
default
{
name
:
"
index-login
"
,
name
:
"
index-login
"
,
data
()
{
data
()
{
return
{
return
{
...
@@ -134,7 +136,7 @@
...
@@ -134,7 +136,7 @@
loginFormRules
:
{
loginFormRules
:
{
// 对手机号进行校验
// 对手机号进行校验
phone
:
[
phone
:
[
{
required
:
true
,
message
:
"
请输入手机号
"
,
trigger
:
"
blur
"
},
{
required
:
true
,
message
:
"
请输入手机号
"
,
trigger
:
"
blur
"
},
{
{
validator
:
function
(
rule
,
value
,
callback
)
{
validator
:
function
(
rule
,
value
,
callback
)
{
if
(
mobileCheck
(
value
)
===
false
)
{
if
(
mobileCheck
(
value
)
===
false
)
{
...
@@ -181,8 +183,8 @@
...
@@ -181,8 +183,8 @@
],
],
// 对验证码进行校验
// 对验证码进行校验
code
:
[
code
:
[
{
required
:
true
,
message
:
"
请输入验证码
"
,
trigger
:
"
blur
"
},
{
required
:
true
,
message
:
"
请输入验证码
"
,
trigger
:
"
blur
"
},
{
min
:
6
,
max
:
20
,
message
:
"
请输入正确的验证码
"
,
trigger
:
"
blur
"
},
{
min
:
6
,
max
:
20
,
message
:
"
请输入正确的验证码
"
,
trigger
:
"
blur
"
},
],
],
},
},
changeLogin
:
1
,
changeLogin
:
1
,
...
@@ -196,7 +198,7 @@
...
@@ -196,7 +198,7 @@
this
.
loginForm
.
phone
=
phone
;
this
.
loginForm
.
phone
=
phone
;
this
.
intervalHandleNew
(
endTime
);
this
.
intervalHandleNew
(
endTime
);
}
}
this
.
commonApi
(
31
)
this
.
commonApi
(
31
);
},
},
methods
:
{
methods
:
{
// 定时器倒计时
// 定时器倒计时
...
@@ -240,6 +242,10 @@
...
@@ -240,6 +242,10 @@
if
(
!
this
.
loginForm
.
phone
)
{
if
(
!
this
.
loginForm
.
phone
)
{
return
this
.
$message
.
error
(
"
请输入手机号
"
);
return
this
.
$message
.
error
(
"
请输入手机号
"
);
}
}
this
.
$alert
(
"
若未及时收到验证码,可用手机号后六位当做验证码登录
"
,
""
,
{
confirmButtonText
:
"
确定
"
,
callback
:
(
action
)
=>
{
// 接口获得验证码
// 接口获得验证码
loginCode
({
loginCode
({
phone
:
this
.
loginForm
.
phone
,
phone
:
this
.
loginForm
.
phone
,
...
@@ -250,11 +256,19 @@
...
@@ -250,11 +256,19 @@
}
}
this
.
$message
.
success
(
res
.
data
.
msg
);
this
.
$message
.
success
(
res
.
data
.
msg
);
this
.
codeTime
=
res
.
data
.
expire_time
;
this
.
codeTime
=
res
.
data
.
expire_time
;
window
.
localStorage
.
setItem
(
"
login_code_time
"
,
res
.
data
.
expire_time
);
window
.
localStorage
.
setItem
(
window
.
localStorage
.
setItem
(
"
login_code_phone
"
,
this
.
loginForm
.
phone
);
"
login_code_time
"
,
res
.
data
.
expire_time
);
window
.
localStorage
.
setItem
(
"
login_code_phone
"
,
this
.
loginForm
.
phone
);
this
.
intervalHandleNew
(
res
.
data
.
expire_time
);
this
.
intervalHandleNew
(
res
.
data
.
expire_time
);
});
});
},
},
});
},
// 忘记账号/密码
// 忘记账号/密码
forgetPwd
()
{
forgetPwd
()
{
let
code
=
this
.
$store
.
state
.
indexIdentity
;
let
code
=
this
.
$store
.
state
.
indexIdentity
;
...
@@ -262,8 +276,8 @@
...
@@ -262,8 +276,8 @@
path
:
"
/reset
"
,
path
:
"
/reset
"
,
query
:
{
query
:
{
...
this
.
$store
.
state
.
query
,
...
this
.
$store
.
state
.
query
,
code
:
code
code
:
code
,
}
},
});
});
},
},
...
@@ -274,8 +288,8 @@
...
@@ -274,8 +288,8 @@
path
:
"
/register
"
,
path
:
"
/register
"
,
query
:
{
query
:
{
...
this
.
$store
.
state
.
query
,
...
this
.
$store
.
state
.
query
,
code
:
code
code
:
code
,
}
},
});
});
},
},
// 改变密码显示状态
// 改变密码显示状态
...
@@ -318,20 +332,23 @@
...
@@ -318,20 +332,23 @@
// 跳转到报名
// 跳转到报名
const
code
=
this
.
$store
.
state
.
indexIdentity
;
const
code
=
this
.
$store
.
state
.
indexIdentity
;
// token存储
// token存储
this
.
$store
.
commit
(
'
login
'
,
res
.
data
.
token
);
this
.
$store
.
commit
(
"
login
"
,
res
.
data
.
token
);
window
.
localStorage
.
setItem
(
"
index-phone-all
"
,
this
.
loginForm
.
phone
);
window
.
localStorage
.
setItem
(
"
index-phone-all
"
,
this
.
loginForm
.
phone
);
window
.
localStorage
.
setItem
(
"
index-email-all
"
,
res
.
data
.
email
);
window
.
localStorage
.
setItem
(
"
index-email-all
"
,
res
.
data
.
email
);
// 报名信息
// 报名信息
window
.
localStorage
.
setItem
(
"
camp_name
"
+
code
,
res
.
data
.
cam
.
name
);
window
.
localStorage
.
setItem
(
"
camp_name
"
+
code
,
res
.
data
.
cam
.
name
);
//获取主题色
//获取主题色
window
.
localStorage
.
setItem
(
"
system_color
"
+
code
,
res
.
data
.
cam
.
system_color
);
window
.
localStorage
.
setItem
(
"
system_color
"
+
code
,
res
.
data
.
cam
.
system_color
);
// 跳转到报名
// 跳转到报名
this
.
$router
.
replace
({
this
.
$router
.
replace
({
path
:
"
/signUp/undefined
"
,
path
:
"
/signUp/undefined
"
,
query
:
{
query
:
{
...
this
.
$store
.
state
.
query
,
...
this
.
$store
.
state
.
query
,
code
:
code
code
:
code
,
}
},
});
});
});
});
});
});
...
@@ -339,18 +356,18 @@
...
@@ -339,18 +356,18 @@
},
},
destroyed
()
{
destroyed
()
{
this
.
timer
&&
clearInterval
(
this
.
timer
);
this
.
timer
&&
clearInterval
(
this
.
timer
);
localStorage
.
removeItem
(
'
login_code_time
'
);
localStorage
.
removeItem
(
"
login_code_time
"
);
localStorage
.
removeItem
(
'
login_code_phone
'
);
localStorage
.
removeItem
(
"
login_code_phone
"
);
}
},
};
};
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.flex
{
.flex
{
display
:
flex
;
display
:
flex
;
}
}
.container
{
.container
{
height
:
440px
;
height
:
440px
;
background
:
#ffffff
;
background
:
#ffffff
;
box-shadow
:
0px
1px
18px
0px
rgba
(
0
,
0
,
0
,
0
.06
);
box-shadow
:
0px
1px
18px
0px
rgba
(
0
,
0
,
0
,
0
.06
);
...
@@ -377,7 +394,7 @@
...
@@ -377,7 +394,7 @@
justify-content
:
flex-end
;
justify-content
:
flex-end
;
.normal
{
.normal
{
cursor
:
pointer
cursor
:
pointer
;
}
}
}
}
}
}
...
@@ -516,5 +533,5 @@
...
@@ -516,5 +533,5 @@
}
}
}
}
}
}
}
}
</
style
>
</
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