|
@@ -1,45 +1,33 @@
|
|
<template>
|
|
<template>
|
|
<LoginLayout>
|
|
<LoginLayout>
|
|
- <div class="outer-page 2xl:py-90px 2xl:px-130px lg:py-40px lg:px-60px pos-relative">
|
|
|
|
- <div class="tabs fs-24 flex c-999 select-none mb">
|
|
|
|
- <!-- <div :class="{ active: tabType === 'password' }" class="tab mr-60px cursor-pointer" @click="changeTab('password')">密码登录</div> -->
|
|
|
|
- <div :class="{ active: tabType === 'captcha' }" class="tab cursor-pointer" @click="changeTab('captcha')">验证码登录</div>
|
|
|
|
- </div>
|
|
|
|
- <!-- 注册form -->
|
|
|
|
- <a-form class="w-376px" ref="postFormRef" :model="postForm" :rules="postFormRules" :colon="false">
|
|
|
|
- <a-form-item class="mb-20 custom-form-item" ref="account" label="手机号/邮箱" name="account" placehplder="手机号码">
|
|
|
|
- <a-input v-model:value="postForm.account" placeholder="请输入注册手机号/邮箱" size="large" />
|
|
|
|
- </a-form-item>
|
|
|
|
- <a-form-item class="custom-form-item !mb-0" ref="password" label="密码" name="password" v-if="tabType === 'password'">
|
|
|
|
- <a-input-password v-model:value="postForm.password" placeholder="请输入密码" size="large" />
|
|
|
|
|
|
+ <div class="pos-relative w-500px">
|
|
|
|
+ <div class="text-36px fw-bold lh-50px text-#223354 mb-24px">Sign in</div>
|
|
|
|
+ <div class="lh-18px text-#767676 mb-20px w-350px">We will check if you have an account, and if not, we will help
|
|
|
|
+ you create one.</div>
|
|
|
|
+ <a-form ref="postFormRef" :model="postForm" :rules="postFormRules" :colon="false">
|
|
|
|
+ <a-form-item class="mb-20 w-full custom-form-item" ref="account" label="Email" name="account">
|
|
|
|
+ <a-input v-model:value="postForm.account" placeholder="Please enter your email" size="large" />
|
|
</a-form-item>
|
|
</a-form-item>
|
|
-
|
|
|
|
- <a-form-item class="custom-form-item mb-0" label="验证码" name="captcha" v-if="tabType === 'captcha'">
|
|
|
|
|
|
+ <a-form-item class="custom-form-item2 mb-0" label="Captcha" name="captcha">
|
|
<a-input-group class="w-full flex justify-between">
|
|
<a-input-group class="w-full flex justify-between">
|
|
- <a-input v-model:value="postForm.captcha" style="width: calc(100% - 134px)" placeholder="请输入验证码" :maxlength="6" size="large" />
|
|
|
|
- <a-button
|
|
|
|
- class="!w-120px !h-50px !text-14px !b-rd-6px !b-#8692a6"
|
|
|
|
- :disabled="seconds !== 0 || !postForm.account.length"
|
|
|
|
- @click="onSendCaptcha"
|
|
|
|
- size="large"
|
|
|
|
- >
|
|
|
|
- <span v-if="seconds === 0" class="c-666">获取验证码</span>
|
|
|
|
- <span v-else>{{ seconds }}s后重新发送</span>
|
|
|
|
|
|
+ <a-input v-model:value="postForm.captcha" placeholder="Please enter captcha" :maxlength="6" size="large" />
|
|
|
|
+ <a-button class="!h-68px !text-18px !b-transparent" :disabled="seconds !== 0 || !postForm.account.length"
|
|
|
|
+ @click="onSendCaptcha" size="large">
|
|
|
|
+ <span v-if="seconds === 0" class="c-666">Get code</span>
|
|
|
|
+ <span v-else>{{ seconds }}s later resend</span>
|
|
</a-button>
|
|
</a-button>
|
|
</a-input-group>
|
|
</a-input-group>
|
|
</a-form-item>
|
|
</a-form-item>
|
|
- <a-form-item class="custom-form-item error-form-item h-22px">
|
|
|
|
- <div class="flex justify-between mt-12px" v-if="tabType === 'password'">
|
|
|
|
- <!-- <a-checkbox class="custom-radio" v-model:checked="rememberPsw">记住密码</a-checkbox> -->
|
|
|
|
- <div class="flex items-center"><ToggleCircle class="mr-10px" v-model="rememberPsw" />记住密码</div>
|
|
|
|
- <router-link class="flex justify-end text-#0068FF underline" to="/forgetPwd">忘记密码?</router-link>
|
|
|
|
- </div></a-form-item
|
|
|
|
- >
|
|
|
|
- <a-form-item label="" class="mt-32px mb-22px">
|
|
|
|
- <a-button class="w-full !bg-#0068FF !b-rd-6px text-#fff !fw-700 !h-56px !hover:text-#fff" @click="onLogin" size="large">登录</a-button>
|
|
|
|
|
|
+ <a-form-item label="" class="my-20px">
|
|
|
|
+ <a-button type="primary" class="w-full !h-68px !b-rd-12px !text-20px text-#fff !fw-700 " @click="onLogin"
|
|
|
|
+ size="large">Sign in</a-button>
|
|
</a-form-item>
|
|
</a-form-item>
|
|
- <div class="text-center c-666">还没有账号, <router-link to="/register" class="text-#0068FF underline">前往注册</router-link></div>
|
|
|
|
</a-form>
|
|
</a-form>
|
|
|
|
+ <div class="text-14px text-#767676 lh-24px">
|
|
|
|
+ By continuing, you agree to EJET Partner shar
|
|
|
|
+ <a href="/" class="text-#1A1A1A decoration-none">Terms of Use</a>
|
|
|
|
+ . Read our <a href="/" class="text-#1A1A1A decoration-none">Privacy Policy.</a>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
</LoginLayout>
|
|
</LoginLayout>
|
|
</template>
|
|
</template>
|
|
@@ -51,44 +39,25 @@ import type { UnwrapRef } from 'vue'
|
|
import type { Rule } from 'ant-design-vue/es/form'
|
|
import type { Rule } from 'ant-design-vue/es/form'
|
|
import type { CaptchaData, LoginData } from 'Types/api'
|
|
import type { CaptchaData, LoginData } from 'Types/api'
|
|
import { apiSendCaptcha } from 'API/user'
|
|
import { apiSendCaptcha } from 'API/user'
|
|
-import { validatePhoneOrEmail, validatePassword, genValidateTrue } from 'Utils/validate'
|
|
|
|
|
|
+import { validatePhoneOrEmail, validateEmail, validatePassword, genValidateTrue } from 'Utils/validate'
|
|
|
|
|
|
const postFormRef = ref()
|
|
const postFormRef = ref()
|
|
-const rememberPsw = ref(false)
|
|
|
|
-// 当前注册阶段
|
|
|
|
let seconds = ref(0)
|
|
let seconds = ref(0)
|
|
-let tabType = ref('captcha')
|
|
|
|
|
|
|
|
interface IRegisterForm {
|
|
interface IRegisterForm {
|
|
account: string
|
|
account: string
|
|
- password: string
|
|
|
|
captcha: string
|
|
captcha: string
|
|
}
|
|
}
|
|
|
|
|
|
const postForm: UnwrapRef<IRegisterForm> = reactive({
|
|
const postForm: UnwrapRef<IRegisterForm> = reactive({
|
|
account: '',
|
|
account: '',
|
|
- password: '',
|
|
|
|
captcha: '',
|
|
captcha: '',
|
|
})
|
|
})
|
|
const postFormRules: Record<string, Rule[]> = {
|
|
const postFormRules: Record<string, Rule[]> = {
|
|
- account: [{ required: true, validator: validatePhoneOrEmail, trigger: 'change' }],
|
|
|
|
- password: [{ required: true, validator: validatePassword, trigger: 'change' }],
|
|
|
|
- captcha: [{ required: true, message: '验证码未输入', trigger: 'change' }],
|
|
|
|
|
|
+ account: [{ required: true, validator: validateEmail, trigger: 'change' }],
|
|
|
|
+ captcha: [{ required: true, message: 'captcha is required', trigger: 'change' }],
|
|
}
|
|
}
|
|
|
|
|
|
-const changeTab = (type: string) => {
|
|
|
|
- tabType.value = type
|
|
|
|
- if (type === 'password') {
|
|
|
|
- const savedUser = localStorage.getItem('rememberedUser')
|
|
|
|
- let psw = ''
|
|
|
|
- if (savedUser) {
|
|
|
|
- const { password: savedPassword } = JSON.parse(savedUser)
|
|
|
|
- psw = savedPassword
|
|
|
|
- }
|
|
|
|
- postForm.password = psw || ''
|
|
|
|
- }
|
|
|
|
- postForm.captcha = ''
|
|
|
|
-}
|
|
|
|
const onSendCaptcha = () => {
|
|
const onSendCaptcha = () => {
|
|
postFormRef.value
|
|
postFormRef.value
|
|
.validateFields(['account'])
|
|
.validateFields(['account'])
|
|
@@ -119,124 +88,111 @@ const countSeconds = () => {
|
|
const onLogin = async () => {
|
|
const onLogin = async () => {
|
|
postFormRef.value.validate().then(async () => {
|
|
postFormRef.value.validate().then(async () => {
|
|
const params: Partial<typeof postForm> = toRaw(postForm)
|
|
const params: Partial<typeof postForm> = toRaw(postForm)
|
|
- if (tabType.value === 'password') {
|
|
|
|
- delete params.captcha
|
|
|
|
- } else {
|
|
|
|
- delete params.password
|
|
|
|
- }
|
|
|
|
const userStore = useUserStore()
|
|
const userStore = useUserStore()
|
|
await userStore.login(params as LoginData)
|
|
await userStore.login(params as LoginData)
|
|
- if (rememberPsw.value) {
|
|
|
|
- localStorage.setItem(
|
|
|
|
- 'rememberedUser',
|
|
|
|
- JSON.stringify({
|
|
|
|
- account: postForm.account,
|
|
|
|
- password: postForm.password,
|
|
|
|
- rememberPsw: true,
|
|
|
|
- })
|
|
|
|
- )
|
|
|
|
- } else {
|
|
|
|
- localStorage.removeItem('rememberedUser')
|
|
|
|
- }
|
|
|
|
})
|
|
})
|
|
}
|
|
}
|
|
-
|
|
|
|
-// 检查是否有保存的用户信息
|
|
|
|
-const checkSavedUser = () => {
|
|
|
|
- const savedUser = localStorage.getItem('rememberedUser')
|
|
|
|
- if (savedUser) {
|
|
|
|
- const { account: savedUsername, password: savedPassword, rememberPsw: savedRememberMe } = JSON.parse(savedUser)
|
|
|
|
- postForm.account = savedUsername
|
|
|
|
- postForm.password = savedPassword
|
|
|
|
- rememberPsw.value = savedRememberMe
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// 在组件挂载时检查保存的用户信息
|
|
|
|
-checkSavedUser()
|
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style scoped lang="less">
|
|
<style scoped lang="less">
|
|
@import '@/assets/styles/variables.less';
|
|
@import '@/assets/styles/variables.less';
|
|
-.page {
|
|
|
|
- .tabs {
|
|
|
|
- display: flex;
|
|
|
|
- justify-content: center;
|
|
|
|
- margin-bottom: 70px;
|
|
|
|
- .tab {
|
|
|
|
- padding-bottom: 10px;
|
|
|
|
- border-bottom: 4px solid transparent;
|
|
|
|
- transition: 0.3s;
|
|
|
|
- &.active {
|
|
|
|
- border-bottom: 4px solid @color-new-primary;
|
|
|
|
- color: @color-new-primary;
|
|
|
|
- font-weight: 700;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
|
|
- .outer-page {
|
|
|
|
- background-color: #fff;
|
|
|
|
- border-radius: 18px;
|
|
|
|
- }
|
|
|
|
|
|
+.page {
|
|
::v-deep(.ant-form) {
|
|
::v-deep(.ant-form) {
|
|
.ant-form-item {
|
|
.ant-form-item {
|
|
&.custom-form-item {
|
|
&.custom-form-item {
|
|
.ant-form-item-row {
|
|
.ant-form-item-row {
|
|
display: block !important;
|
|
display: block !important;
|
|
- width: 376px !important;
|
|
|
|
|
|
+ width: 500px !important;
|
|
|
|
|
|
.ant-form-item-label {
|
|
.ant-form-item-label {
|
|
color: #000000;
|
|
color: #000000;
|
|
- margin-bottom: 10px;
|
|
|
|
|
|
+ margin-bottom: 10px !important;
|
|
|
|
+ font-weight: normal;
|
|
|
|
+
|
|
|
|
+ label {
|
|
|
|
+ font-size: 24px;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
.ant-form-item-control {
|
|
.ant-form-item-control {
|
|
.ant-input-affix-wrapper {
|
|
.ant-input-affix-wrapper {
|
|
border-radius: 6px;
|
|
border-radius: 6px;
|
|
- width: 376px;
|
|
|
|
- border-color: #8692a6;
|
|
|
|
|
|
+ width: 500px;
|
|
|
|
+ border-color: none !important;
|
|
|
|
+
|
|
input {
|
|
input {
|
|
height: 34px;
|
|
height: 34px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
input {
|
|
input {
|
|
- width: 376px;
|
|
|
|
- border-radius: 6px;
|
|
|
|
- border-color: #8692a6;
|
|
|
|
- height: 50px;
|
|
|
|
- line-height: 50px;
|
|
|
|
- font-size: 16px !important;
|
|
|
|
|
|
+ width: 500px;
|
|
|
|
+ border-radius: 12px;
|
|
|
|
+ border-color: transparent !important;
|
|
|
|
+ background-color: #F1F1F1;
|
|
|
|
+ height: 68px;
|
|
|
|
+ line-height: 68px;
|
|
|
|
+ font-size: 18px !important;
|
|
|
|
+
|
|
&.ant-input-status-error {
|
|
&.ant-input-status-error {
|
|
border-color: #ff4d4f;
|
|
border-color: #ff4d4f;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
.ant-form-item-explain-error {
|
|
.ant-form-item-explain-error {
|
|
text-align: right;
|
|
text-align: right;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- &.error-form-item {
|
|
|
|
- .ant-form-item-explain-error {
|
|
|
|
- padding-right: 140px;
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ .ant-form-item-explain-error {
|
|
|
|
+ text-align: right;
|
|
|
|
+ margin-top: 10px;
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
- .custom-radio {
|
|
|
|
- .ant-checkbox {
|
|
|
|
- margin-right: 10px;
|
|
|
|
- &.ant-checkbox-checked {
|
|
|
|
- .ant-checkbox-inner {
|
|
|
|
- background-color: #0068ff;
|
|
|
|
- border-color: #0068ff;
|
|
|
|
- }
|
|
|
|
- &:after {
|
|
|
|
- border: 1px solid #0068ff;
|
|
|
|
|
|
+
|
|
|
|
+ &.custom-form-item2 {
|
|
|
|
+ .ant-form-item-row {
|
|
|
|
+ display: block !important;
|
|
|
|
+ width: 500px !important;
|
|
|
|
+
|
|
|
|
+ .ant-form-item-label {
|
|
|
|
+ color: #000000;
|
|
|
|
+ margin-bottom: 10px !important;
|
|
|
|
+ font-weight: normal;
|
|
|
|
+
|
|
|
|
+ label {
|
|
|
|
+ font-size: 24px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- .ant-checkbox-inner {
|
|
|
|
- &:hover {
|
|
|
|
- border-color: #0068ff !important;
|
|
|
|
|
|
+
|
|
|
|
+ .ant-form-item-control {
|
|
|
|
+ input {
|
|
|
|
+ border-radius: 12px;
|
|
|
|
+ border-color: transparent !important;
|
|
|
|
+ background-color: #F1F1F1;
|
|
|
|
+ height: 68px;
|
|
|
|
+ line-height: 68px;
|
|
|
|
+ font-size: 18px !important;
|
|
|
|
+
|
|
|
|
+ &.ant-input-status-error {
|
|
|
|
+ border-color: #ff4d4f;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .ant-btn {
|
|
|
|
+ background-color: #F1F1F1;
|
|
|
|
+ border-radius: 12px;
|
|
|
|
+ width: 200px;
|
|
|
|
+ margin-left: 20px;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .ant-form-item-explain-error {
|
|
|
|
+ margin-top: 10px;
|
|
|
|
+ text-align: right;
|
|
|
|
+ padding-right: 170px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|