mirror of
https://github.com/yangjian102621/geekai.git
synced 2026-04-22 11:04:26 +08:00
merge Login page Register page
This commit is contained in:
@@ -398,7 +398,7 @@ const activeName = ref('')
|
||||
const wxImg = ref('/images/wx.png')
|
||||
const captchaRef = ref(null)
|
||||
// eslint-disable-next-line no-undef
|
||||
const emits = defineEmits(['hide', 'success'])
|
||||
const emits = defineEmits(['hide', 'success', 'changeActive'])
|
||||
const action = ref('login')
|
||||
const enableCaptcha = ref(false)
|
||||
const captchaType = ref('')
|
||||
@@ -411,6 +411,13 @@ const showPrivacy = ref(false)
|
||||
const agreementHtml = ref('')
|
||||
const privacyHtml = ref('')
|
||||
|
||||
watch(
|
||||
() => login.value,
|
||||
(newValue) => {
|
||||
emits('changeActive', newValue)
|
||||
}
|
||||
)
|
||||
|
||||
onMounted(() => {
|
||||
getSystemInfo()
|
||||
.then((res) => {
|
||||
@@ -649,7 +656,7 @@ const submitRegister = () => {
|
||||
if (!agreeChecked.value) {
|
||||
return ElMessage.error('请先阅读并同意《用户协议》和《隐私政策》')
|
||||
}
|
||||
if (enableCaptcha.value && activeName.value === 'username') {
|
||||
if (enableCaptcha.value) {
|
||||
captchaRef.value.loadCaptcha()
|
||||
action.value = 'register'
|
||||
} else {
|
||||
|
||||
@@ -4,15 +4,14 @@
|
||||
{{ btnText }}
|
||||
</el-button>
|
||||
|
||||
<captcha @success="doSendMsg" ref="captchaRef" />
|
||||
<captcha @success="doSendMsg" ref="captchaRef" :type="captchaType" />
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
// 发送短信验证码组件
|
||||
import Captcha from '@/components/Captcha.vue'
|
||||
import { getSystemInfo } from '@/store/cache'
|
||||
import { httpPost } from '@/utils/http'
|
||||
import { httpGet, httpPost } from '@/utils/http'
|
||||
import { validateEmail, validateMobile } from '@/utils/validate'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ref } from 'vue'
|
||||
@@ -29,10 +28,12 @@ const props = defineProps({
|
||||
const btnText = ref('发送验证码')
|
||||
const canSend = ref(true)
|
||||
const captchaRef = ref(null)
|
||||
const enableVerify = ref(false)
|
||||
const enableCaptcha = ref(false)
|
||||
const captchaType = ref('')
|
||||
|
||||
getSystemInfo().then((res) => {
|
||||
enableVerify.value = res.data['enabled_verify']
|
||||
httpGet('/api/captcha/config').then((res) => {
|
||||
enableCaptcha.value = res.data['enabled']
|
||||
captchaType.value = res.data['type']
|
||||
})
|
||||
|
||||
const sendMsg = () => {
|
||||
@@ -43,7 +44,7 @@ const sendMsg = () => {
|
||||
return ElMessage.error('请输入合法的邮箱地址')
|
||||
}
|
||||
|
||||
if (enableVerify.value) {
|
||||
if (enableCaptcha.value) {
|
||||
captchaRef.value.loadCaptcha()
|
||||
} else {
|
||||
doSendMsg({})
|
||||
|
||||
Reference in New Issue
Block a user