2025-02-28 09:56:01 +08:00
|
|
|
<script setup>
|
2025-04-19 15:28:32 +08:00
|
|
|
import {reactive, ref} from 'vue';
|
2025-02-28 09:56:01 +08:00
|
|
|
import {toPath} from "../../utils/index.js";
|
|
|
|
|
import VerificationCode from '../../components/VerificationCode/index.vue';
|
2025-03-10 19:01:21 +08:00
|
|
|
import {useUserStore} from "../../pinia/UserStore/index.js";
|
2025-06-04 08:55:14 +08:00
|
|
|
import {Message} from "@arco-design/web-vue";
|
2025-07-17 17:17:34 +08:00
|
|
|
import {useSystemStore} from "../../pinia/SystemStore/index.js";
|
|
|
|
|
import Api from "../../api/index.js";
|
2025-03-10 19:01:21 +08:00
|
|
|
|
|
|
|
|
const {login} = useUserStore();
|
2025-07-17 17:17:34 +08:00
|
|
|
const {BUILD_MODE} = useSystemStore();
|
2025-02-28 09:56:01 +08:00
|
|
|
|
|
|
|
|
const MODE = {
|
|
|
|
|
PHONE: 'PHONE',
|
|
|
|
|
PASSWORD: 'PASSWORD'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const from = reactive({
|
2025-07-28 18:07:57 +08:00
|
|
|
mobile: null,
|
2025-04-19 15:28:32 +08:00
|
|
|
code: null,
|
2025-07-28 18:07:57 +08:00
|
|
|
password: null,
|
2025-02-28 09:56:01 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const mode = ref(MODE.PHONE);
|
2025-06-04 08:55:14 +08:00
|
|
|
|
|
|
|
|
const loginSYS = (isRoot, form) => {
|
|
|
|
|
if (!from.mobile || from.mobile === '') {
|
|
|
|
|
Message.warning('手机号不能为空');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (mode.value === MODE.PHONE) {
|
|
|
|
|
if (!from.code || from.code === '') {
|
|
|
|
|
Message.warning('验证码不能为空');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (!from.password || from.password === '') {
|
|
|
|
|
Message.warning('密码不能为空');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
login(isRoot, form);
|
|
|
|
|
}
|
2025-02-28 09:56:01 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div class="p-[50px] rounded-[12px] bg-white w-[460px] min-h-[540px] box-border card">
|
|
|
|
|
<div class="text-[24px] text-center text2">欢迎登录系统</div>
|
|
|
|
|
<div class="mt-[57px] flex gap-[32px]">
|
|
|
|
|
<div @click="mode = MODE.PHONE" :class="['text1', mode===MODE.PHONE?'text1-cur':null]">手机号登陆</div>
|
|
|
|
|
<div @click="mode = MODE.PASSWORD" :class="['text1', mode===MODE.PASSWORD?'text1-cur':null]">账号密码登陆
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mt-[38px] flex flex-col gap-[20px]">
|
2025-04-19 15:28:32 +08:00
|
|
|
<a-input v-model:model-value="from.mobile" placeholder="手机号"></a-input>
|
2025-02-28 09:56:01 +08:00
|
|
|
<VerificationCode
|
2025-04-30 16:43:52 +08:00
|
|
|
:type="2"
|
2025-07-17 17:17:34 +08:00
|
|
|
:api="BUILD_MODE==='merchant'?Api.merchant.sendSms:Api.admin.sendSms"
|
2025-02-28 09:56:01 +08:00
|
|
|
v-if="mode === MODE.PHONE"
|
2025-04-19 15:28:32 +08:00
|
|
|
:mobile="from.mobile"
|
|
|
|
|
v-model:verification-code="from.code">
|
2025-02-28 09:56:01 +08:00
|
|
|
</VerificationCode>
|
2025-07-15 11:11:24 +08:00
|
|
|
<a-input v-else v-model:model-value="from.password" placeholder="密码" type="password">
|
2025-02-28 09:56:01 +08:00
|
|
|
<template #append>
|
|
|
|
|
<a-link @click="toPath('/loginSYS/forgot')" :hoverable="false">忘记密码?</a-link>
|
|
|
|
|
</template>
|
|
|
|
|
</a-input>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="flex flex-col mt-[50px] gap-[32px]">
|
2025-07-17 17:17:34 +08:00
|
|
|
<a-button v-if="BUILD_MODE==='merchant'" @click="loginSYS(false, from)" type="primary">
|
|
|
|
|
登陆商户端
|
|
|
|
|
</a-button>
|
|
|
|
|
<a-button v-if="BUILD_MODE==='admin'" @click="loginSYS(true, from)" type="primary">
|
|
|
|
|
登陆管理端
|
|
|
|
|
</a-button>
|
2025-02-28 09:56:01 +08:00
|
|
|
<a-button
|
|
|
|
|
@click="toPath('/loginSYS/register')"
|
|
|
|
|
type="text">
|
|
|
|
|
去注册
|
|
|
|
|
<icon-arrow-right class="ml-[5px]"/>
|
|
|
|
|
</a-button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.card {
|
|
|
|
|
box-shadow: 0 8px 20px 0 rgba(0, 0, 0, 0.1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.text2 {
|
|
|
|
|
color: rgb(29, 33, 41);
|
|
|
|
|
font-size: 24px;
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
line-height: 32px;
|
|
|
|
|
letter-spacing: 0;
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.text1 {
|
|
|
|
|
/* 14/CN-Regular */
|
|
|
|
|
color: rgb(78, 89, 105);
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
line-height: 22px;
|
|
|
|
|
letter-spacing: 0;
|
|
|
|
|
text-align: left;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
transition: 500ms;
|
|
|
|
|
|
|
|
|
|
&::after {
|
|
|
|
|
content: '';
|
|
|
|
|
display: block;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 2px;
|
|
|
|
|
background-color: rgb(22, 93, 255);
|
|
|
|
|
margin-top: 12px;
|
|
|
|
|
opacity: 0;
|
|
|
|
|
transition: 500ms;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.text1-cur {
|
|
|
|
|
color: rgb(22, 93, 255);
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
line-height: 22px;
|
|
|
|
|
letter-spacing: 0;
|
|
|
|
|
text-align: left;
|
|
|
|
|
|
|
|
|
|
&::after {
|
|
|
|
|
opacity: 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|