2024-12-19 13:47:55 +08:00
< template >
< div ref = "register" > < / div >
< a-modal
class = "register generalModel"
: get - container = "() => $refs.register"
v - model : visible = "registerModel"
: footer = "null"
: width = "pageWidth"
2025-01-13 11:27:04 +08:00
: height = "bindType == 'Modify'?'60rem':'70rem'"
2024-12-19 13:47:55 +08:00
: maskClosable = "false"
: centered = "true"
: closable = "false"
: mask = "registerModelMask"
: keyboard = "false"
: destroyOnClose = "true"
>
2025-01-02 11:47:09 +08:00
< div class = "generalModel_btn" v-if = "bindType == 'Modify'" >
2024-12-23 16:23:18 +08:00
< div class = "generalModel_closeIcon" @click.stop ="cancelDsign()" >
<!-- < i class = "fi fi-rr-cross-small" > < / i > -- >
< svg width = "46" height = "46" viewBox = "0 0 46 46" fill = "none" xmlns = "http://www.w3.org/2000/svg" >
2025-01-07 17:15:28 +08:00
< circle cx = "23" cy = "23" r = "23" fill = "white" fill -opacity = " 0.3 " / >
< rect x = "32.5063" y = "12" width = "3" height = "29" rx = "1.5" transform = "rotate(45 32.5063 12)" fill = "white" / >
< rect x = "34.6274" y = "32.5059" width = "3" height = "29" rx = "1.5" transform = "rotate(135 34.6274 32.5059)" fill = "white" / >
< / svg >
2024-12-23 16:23:18 +08:00
< / div >
< / div >
2024-12-19 13:47:55 +08:00
< div class = "login_page" >
< div class = "page_content" >
<!-- 账号密码和邮箱登录 start -- >
< div class = "login_content" >
< div class = "login_content_left" >
< div class = "login_type_list" >
< div
: class = " [
'login_type_item' , 'username_login_item' ,
'login_active' ,
] "
>
2025-01-02 11:47:09 +08:00
< span v-if = "bindType == 'Modify'" > Modify Email < / span >
2025-01-13 11:27:04 +08:00
< span v-else > Bind personal information < / span >
2024-12-19 13:47:55 +08:00
< / div >
< / div >
<!-- 账号密码登录 start -- >
2025-01-02 11:47:09 +08:00
<!-- v - show = "login$props.Type == 'username'" -- >
2024-12-19 13:47:55 +08:00
< div >
< div class = "login_form_content" :state = "emailStap" >
< div class = "login_form_title marign_top30" > Email < / div >
< input
class = "login_form_input"
2025-01-14 11:02:02 +08:00
: class = "{active:!!email && bindType != 'Modify'}"
2024-12-19 13:47:55 +08:00
placeholder = "Enter your email address"
v - model = "email"
2025-01-16 09:47:28 +08:00
: disabled = "!!userDetail.email && bindType != 'Modify'"
2024-12-19 13:47:55 +08:00
@ keydown . enter = "submitPerLogin()"
/ >
2025-01-14 11:02:02 +08:00
< div v-if = "bindType != 'Modify'" >
< div class = "login_form_title marign_top30" > { { $t ( 'account.Country' ) } } : < / div >
< div class = "login_form_select" >
< a-select
class = "gallerySelect"
v - model : value = "Country"
: disabled = "!!userDetail.country"
size = "large"
optionFilterProp = "label"
style = "width: 100%;"
: options = "countryList"
placeholder = "Please select"
allowClear
show - search
> < / a-select >
< / div >
< div class = "login_form_title marign_top30" > { { $t ( 'account.CompanyName' ) } } : < / div >
< input class = "login_form_input" :class = "{active:!!CompanyName}" :disabled = "!!userDetail.country" type = "text" placeholder = "Please enter occupation" v-model = "CompanyName" >
2024-12-19 13:47:55 +08:00
2025-01-14 11:02:02 +08:00
< / div >
2024-12-19 13:47:55 +08:00
<!-- 邮箱登录 start -- >
< div class = "login_form_email" :class = "{active:emailStap===2}" >
2025-01-13 11:27:04 +08:00
< div v-show = "emailStap === 2" class="email_last_step" >
< div class = "email_last_step_block" >
< span class = "email_last_step_content"
> Verify with one - time verification code < / s p a n
>
< i class = "fi fi-br-cross email_last_step_block_icon" @click ="emailLastStepFun()" > < / i >
< / div >
< div class = "email_last_step_bottom" >
< div class = "email_last_step_des" >
< div class = "sent_email_content" >
Sent to { { email } }
< / div >
< div class = "tip_content" >
< span v-show = "time" > {{ time }} s < / span >
< span v-show = "!time" @click="emailNextStepFun()"
> Resend < / s p a n
>
< / div >
< / div >
< VerificationCodeInput
: ct = "emailCode"
@ sendCaptcha = "submitEmailLogin($event)"
> < / VerificationCodeInput >
2024-12-19 13:47:55 +08:00
2025-01-13 11:27:04 +08:00
< div class = "email_last_step_des" >
< div class = "sent_email_content email_tip_content" >
Please check the junk box if you haven ' t received verification code
< / div >
< / div >
2024-12-19 13:47:55 +08:00
< / div >
< / div >
< / div >
< / div >
< div
class = "login_submit_button marign_top40"
style = "width: 100%;"
: state = "emailStap"
@ click = "submitPerLogin()"
>
2025-01-02 11:47:09 +08:00
< span v-if = "bindType == 'Modify'" > Modify Email < / span >
2025-01-13 11:27:04 +08:00
< span v-else > Submit < / span >
2024-12-19 13:47:55 +08:00
< / div >
< / div >
<!-- 账号密码登录 end -- >
< / div >
<!-- 邮箱登录 end -- >
< / div >
< / div >
< / div >
< / a-modal >
< / template >
< script lang = "ts" >
2025-01-13 11:27:04 +08:00
import { defineComponent , ref , reactive , toRefs , computed , onMounted } from "vue" ;
2024-12-19 13:47:55 +08:00
import { Https } from "@/tool/https" ;
import { isEmail } from "@/tool/util" ;
import { setCookie , WriteCookie } from "@/tool/cookie" ;
import { message } from "ant-design-vue" ;
import VerificationCodeInput from "@/component/LoginPage/verificationCodeInput.vue" ;
import { useStore } from "vuex" ;
import { useI18n } from "vue-i18n" ;
import { setLang } from "@/tool/guide" ;
2025-01-13 11:27:04 +08:00
import { country } from "@/tool/country" ;
2024-12-19 13:47:55 +08:00
export default defineComponent ( {
components : {
VerificationCodeInput ,
} ,
2025-01-02 11:47:09 +08:00
setup ( prop , { emit } ) {
const bindType = ''
2024-12-19 13:47:55 +08:00
let timer : any = 0 ;
const { locale } = useI18n ( )
const store = useStore ( ) ;
2025-01-13 11:27:04 +08:00
let userDetail : any = computed ( ( ) => {
return store . state . UserHabit . userDetail
} )
2024-12-19 13:47:55 +08:00
let register = reactive ( {
2024-12-31 11:40:40 +08:00
registerModel : computed ( ( ) => {
2025-01-02 11:47:09 +08:00
return store . state . UserHabit . bindEmail . isBindEmail
} ) ,
bindType : computed ( ( ) => {
return store . state . UserHabit . bindEmail . type
2024-12-31 11:40:40 +08:00
} ) ,
2024-12-19 13:47:55 +08:00
registerModelMask : true ,
2025-01-13 11:27:04 +08:00
pageWidth : '45%' ,
Country : '' ,
CompanyName : '' ,
countryList : country ,
email : '' ,
} )
onMounted ( ( ) => {
let country = userDetail . value . country
let CompanyName = userDetail . value . occupation
let email = userDetail . value . email
register . Country = country
register . CompanyName = CompanyName
register . email = email == '-------------' ? '' : email
2024-12-19 13:47:55 +08:00
} )
return {
store ,
timer ,
2025-01-13 11:27:04 +08:00
userDetail ,
2024-12-19 13:47:55 +08:00
... toRefs ( register ) ,
locale
}
2025-01-13 11:27:04 +08:00
2024-12-19 13:47:55 +08:00
} ,
data ( ) {
return {
checked : false ,
emailStap : 1 , // 邮箱登录步骤
emailCode : [ "" , "" , "" , "" , "" , "" ] , //邮箱验证码
emailNextStep : true ,
frogetPasswordStep : 1 , //忘记密码的步骤
forgetPasswordEmail : "" ,
forgetEmailCode : [ "" , "" , "" , "" , "" , "" ] , //忘记密码的邮箱验证码
forgetEmailValue : "" , //忘记密码的邮箱验证码保存值
newPassword : "" , //新密码
isCheckRobot : false ,
time : 60 , //60秒倒计时
passwordType : 'password' ,
userId : '' ,
loginTime : true
} ;
} ,
methods : {
2025-01-02 11:47:09 +08:00
init ( type : any ) {
let data = {
type ,
isBindEmail : true
}
this . store . commit ( 'setIsBindEmail' , data )
2024-12-19 13:47:55 +08:00
this . emailLastStepFun ( )
} ,
//邮箱登录的下一步
emailNextStepFun ( ) {
if ( ! isEmail ( this . email ) ) {
message . info ( "The email format is incorrect" ) ;
return ;
}
let data = {
email : this . email ,
operationType : "LOGIN" ,
} ;
Https . axiosPost ( Https . httpUrls . accountSendEmail , data ) . then (
( rv : any ) => {
if ( rv ) {
this . emailStap = 2 ;
this . time = 60 ;
this . emailCode = [ "" , "" , "" , "" , "" , "" ]
this . createTimer ( ) ;
}
}
) ;
} ,
//邮箱登录的上一步
emailLastStepFun ( ) {
this . emailStap = 1 ;
this . email = "" ;
this . checked = false ,
( this . emailCode = [ "" , "" , "" , "" , "" , "" ] ) , this . clearTimer ( ) ;
} ,
//改变勾选是否是机器人
checkRobot ( ) {
this . isCheckRobot = ! this . isCheckRobot ;
} ,
//提交账号密码预先登录
submitPerLogin ( ) {
//输入账号密码
if ( this . emailStap >= 2 ) {
return ;
} else {
//输入邮箱
if ( ! this . email ) {
message . info ( "Please enter your email address" ) ;
return ;
}
//判断邮箱格式是否正确
if ( ! isEmail ( this . email ) ) {
message . info ( "The email format is incorrect" ) ;
return ;
}
2025-01-14 11:02:02 +08:00
if ( ! this . CompanyName && this . bindType != 'Modify' ) {
2025-01-13 11:27:04 +08:00
message . info ( "Please enter occupation" ) ;
return ;
}
2025-01-14 11:02:02 +08:00
if ( ! this . Country && this . bindType != 'Modify' ) {
2025-01-13 11:27:04 +08:00
message . info ( "Please select a country" ) ;
return ;
}
let type = 'BIND_MAILBOX'
2025-01-14 11:02:02 +08:00
if ( this . email == this . userDetail . email && this . bindType != 'Modify' ) type = 'UPDATE_USERINFO'
2024-12-19 13:47:55 +08:00
let data = {
"email" : this . email ,
"ip" : "" ,
2025-01-13 11:27:04 +08:00
"operationType" : type ,
occupation : this . CompanyName ,
country : this . Country
2024-12-19 13:47:55 +08:00
} ;
if ( this . loginTime ) {
this . loginTime = false
Https . axiosPost ( Https . httpUrls . accountSendEmail , data ) . then (
( rv : any ) => {
2025-01-13 11:27:04 +08:00
if ( type == 'UPDATE_USERINFO' ) this . setSuccessLogin ( rv )
2024-12-19 13:47:55 +08:00
this . emailStap = 2 ;
if ( rv ) {
this . userId = rv . userId
this . time = 60 ;
this . emailCode = [ "" , "" , "" , "" , "" , "" ]
this . createTimer ( ) ;
}
}
) . catch ( res => {
this . emailStap = 1 ;
} ) ;
setTimeout ( ( ) => {
this . loginTime = true
} , 2000 ) ;
}
}
} ,
changePasswordType ( ) {
this . passwordType = this . passwordType === 'password' ? 'text' : 'password'
} ,
setSuccessLogin ( rv : any ) {
if ( rv ) {
let value = {
2025-01-13 11:27:04 +08:00
email : this . email ,
occupation : this . CompanyName ,
country : this . Country ,
2024-12-19 13:47:55 +08:00
}
this . store . commit ( "upUserDetail" , value )
window . location . reload ( ) ;
this . cancelDsign ( )
}
} ,
//邮箱登录提交
submitEmailLogin ( emailVerifyCode : any ) {
let data = {
2024-12-19 17:59:00 +08:00
userEmail : this . email ,
2024-12-19 13:47:55 +08:00
emailVerifyCode : emailVerifyCode ,
} ;
Https . axiosPost ( Https . httpUrls . accountBindEmail , data ) . then (
( rv : any ) => {
this . setSuccessLogin ( rv )
}
) . catch ( res => {
} ) ;
} ,
//创建定时器
createTimer ( ) {
this . timer = setInterval ( ( ) => {
this . time -- ;
if ( ! this . time ) {
clearInterval ( this . timer ) ;
}
} , 1000 ) ;
} ,
//清除定时器
clearTimer ( ) {
this . time = 60 ;
if ( this . timer ) {
clearInterval ( this . timer ) ;
}
} ,
cancelDsign ( ) {
2025-01-02 11:47:09 +08:00
this . store . commit ( 'setIsBindEmail' , false )
2024-12-19 13:47:55 +08:00
}
} ,
} ) ;
< / script >
< style lang = "less" scoped >
: deep ( . register ) {
@ media ( max - width : 768 px ) {
// box-shadow: none;
// height: 100%;
margin : 0 ;
max - width : 95 % ;
& . generalModel {
. ant - modal - content {
// height: 100%;
}
. ant - modal - body {
padding : 6 rem 4 rem ;
// height: 100%;
}
}
}
}
< / style >
< style lang = "less" scoped >
. login _page {
width : 100 % ;
height : 100 % ;
. page _content {
// position: relative;
. login _content {
position : absolute ;
top : 50 % ;
left : 50 % ;
transform : translate ( - 50 % , - 50 % ) ;
// width: 60rem;
width : 80 % ;
background : # FFFFFF ;
// box-shadow: -0.3rem 2rem 5.9rem 0px rgba(200,200,200,0.3);
border - radius : 1 rem ;
padding : 3 rem 6 rem 6.5 rem ;
box - sizing : border - box ;
display : flex ;
justify - content : space - between ;
align - items : center ;
@ media ( max - width : 768 px ) {
padding : 0 ;
}
. login _content _left {
width : 100 % ;
. login _form _email {
position : absolute ;
left : 0 ;
width : 100 % ;
height : 100 % ;
top : 0 ;
background : # fff ;
transform : scale ( 0 ) ;
transition : .3 s all ;
border : 2 px solid ;
border - radius : 20 px ;
. email _last _step {
width : 100 % ;
height : 100 % ;
# app {
height : auto ;
}
}
}
. active {
transform : scale ( 1 ) ;
}
}
. login _type _list {
width : 100 % ;
display : flex ;
. login _type _item {
text - align : center ;
font - size : 3.6 rem ;
font - weight : bold ;
color : # D7D7D7 ;
cursor : pointer ;
height : 4 rem ;
line - height : 4 rem ;
& . login _active {
color : # 030303 ;
}
}
}
. login _form _title {
font - size : 1.6 rem ;
// color: #666666;
font - weight : 900 ;
color : # 000 ;
display : flex ;
justify - content : space - between ;
box - sizing : border - box ;
label {
display : flex ;
span {
font - size : 1.6 rem ;
margin - left : 10 px ;
font - weight : normal ;
}
& . active {
pointer - events : none ;
input {
pointer - events : none ;
}
}
}
}
. login _form _content {
margin - top : 4 rem ;
position : relative ;
& [ state = "2" ] {
2024-12-19 17:59:00 +08:00
height : 30 rem ;
2024-12-19 13:47:55 +08:00
> * {
opacity : 0 ;
}
. login _form _email {
opacity : 1 ;
}
}
. password _input _block {
position : relative ;
. password _show _icon {
position : absolute ;
font - size : 2.4 rem ;
right : 2 rem ;
top : 1.7 rem ;
cursor : pointer ;
}
}
2025-01-13 11:27:04 +08:00
. gallerySelect {
margin - top : 1 rem ;
: deep ( . ant - select - selector ) {
height : 5 rem ;
border : 0.1 rem solid # dfdfdf ;
border - radius : 2.5 rem ;
}
: deep ( . ant - select - selector ) : hover {
border : 0.1 rem solid # 000 ;
}
}
2024-12-19 13:47:55 +08:00
. login _form _input {
width : 100 % ;
height : 5 rem ;
margin - top : 1 rem ;
border : 0.1 rem solid # dfdfdf ;
border - radius : 2.5 rem ;
padding - left : 2.1 rem ;
line - height : 5 rem ;
font - size : 1.4 rem ;
box - sizing : border - box ;
outline : none ;
transition : all .3 s ;
2025-01-13 17:10:41 +08:00
& . active {
color : # b8b8b8 ;
background : # f5f5f5 ;
}
2024-12-19 13:47:55 +08:00
& : hover {
border : 0.1 rem solid # 000 ;
}
& : : placeholder {
color : # a5b0c2 ;
}
}
}
. email _last _step {
// margin-top: 4rem;
. email _last _step _bottom {
padding : 0 40 px ;
}
. email _last _step _block {
padding : 10 px ;
border - bottom : 2 px solid ;
box - sizing : border - box ;
display : flex ;
align - items : center ;
justify - content : space - between ;
. email _last _step _content {
margin - left : 1 rem ;
font - size : 2.2 rem ;
font - weight : bold ;
color : # 030303 ;
}
. email _last _step _block _icon {
cursor : pointer ;
margin - right : 1 rem ;
height : 20 px ;
}
}
. fi - br - arrow - left {
font - size : 2.5 rem ;
font - weight : bold ;
color : # 030303 ;
transform : translateY ( 1 rem ) ;
display : inline - block ;
}
}
. login _submit _button {
height : 5 rem ;
background : # 000 ;
border - radius : 2.5 rem ;
line - height : 5 rem ;
text - align : center ;
font - size : 1.8 rem ;
font - weight : 500 ;
color : # ffffff ;
cursor : pointer ;
transition : all .3 s ;
& : hover {
background : # 3 C3C3C ;
}
& [ state = "2" ] {
cursor : not - allowed ;
}
}
. login _text {
font - size : 1.6 rem ;
margin - top : 4 rem ;
color : # 151515 ;
display : flex ;
justify - content : flex - end ;
. forget _password _text {
cursor : pointer ;
}
}
}
}
. marign _top20 {
margin - top : 2 rem ;
}
. marign _top22 {
margin - top : 2.2 rem ;
}
. marign _top30 {
margin - top : 3 rem ;
}
. marign _top40 {
margin - top : 4 rem ;
}
. thirdPartyLogin {
display : flex ;
justify - content : flex - start ;
> div {
margin - right : 1 rem ;
}
}
. tip _content {
font - size : 1.3 rem ;
font - weight : bold ;
color : # 343579 ;
cursor : pointer ;
}
. email _last _step _des {
display : flex ;
align - items : center ;
justify - content : space - between ;
margin - top : 4 rem ;
margin - bottom : 2 rem ;
. sent _email _content {
font - size : 1.8 rem ;
font - weight : bold ;
color : # a5b0c2 ;
}
. email _tip _content {
font - size : 1.4 rem ;
color : # 030303 ;
}
}
}
< / style >