This commit is contained in:
2025-12-17 10:03:00 +08:00
parent 66cd1dbf11
commit 2962689f2f
7 changed files with 1168 additions and 1149 deletions

View File

@@ -18,9 +18,8 @@
/>
<h4>{{ config.siteName }}</h4>
</div>
<div class="company-name" v-if="config?.loginTitle">{{
config?.loginTitle
}}
<div class="company-name" v-if="config?.loginTitle"
>{{ config?.loginTitle }}
</div>
<a-form
ref="formRef"
@@ -30,57 +29,61 @@
>
<div class="login-title flex justify-center items-center px-12">
<template v-if="loginType === 'scan'">
<h4
class="title-btn"
>扫码登录</h4
>
<h4 class="title-btn">扫码登录</h4>
</template>
<template v-else>
<h4
class="title-btn"
:class="loginType === 'sms' ? 'active' : ''"
@click="onLoginType('sms')"
>短信登录</h4
>手机号登录</h4
>
<a-divider type="vertical" style="height: 20px" />
<h4
class="title-btn"
:class="loginType === 'account' ? 'active' : ''"
@click="onLoginType('account')"
>密码登录</h4
>账号登录</h4
>
</template>
</div>
<div class="login-bar absolute top-0 z-50 right-0 cursor-pointer" @click="onScan">
<div
class="login-bar absolute top-0 z-50 right-0 cursor-pointer"
@click="onScan"
>
<div class="go-to-register cursor-pointer">
<img src="@/assets/O1CN01yz6fEl1MwaRtkJyvf_!!6000000001499-55-tps-70-70.svg"
alt=""/>
<img
src="@/assets/O1CN01yz6fEl1MwaRtkJyvf_!!6000000001499-55-tps-70-70.svg"
alt=""
/>
</div>
<div class="absolute top-2 right-2 text-lg text-white font-bold cursor-pointer">
<div
class="absolute top-2 right-2 text-lg text-white font-bold cursor-pointer"
>
<QrcodeOutlined v-if="loginType === 'sms'" />
<MobileOutlined v-else />
</div>
<!-- <span class="absolute top-3 right-1.5 text-sm text-white font-bold cursor-pointer">{{ '登录' }}</span>-->
</div>
<template v-if="loginType === 'account'">
<a-form-item name="tenantId">
<a-input
allow-clear
size="large"
v-model:value="form.tenantId"
:placeholder="`请输入租户ID`"
>
<template #prefix>
<UserOutlined/>
</template>
</a-input>
</a-form-item>
<!-- <a-form-item name="tenantId">-->
<!-- <a-input-->
<!-- allow-clear-->
<!-- size="large"-->
<!-- v-model:value="form.tenantId"-->
<!-- :placeholder="`请输入租户ID`"-->
<!-- >-->
<!-- <template #prefix>-->
<!-- <UserOutlined />-->
<!-- </template>-->
<!-- </a-input>-->
<!-- </a-form-item>-->
<a-form-item name="username">
<a-input
allow-clear
size="large"
v-model:value="form.username"
:placeholder="`请输入用户名`"
v-model:value="form.userId"
:placeholder="`用户ID`"
>
<template #prefix>
<UserOutlined />
@@ -91,7 +94,7 @@
<a-input-password
size="large"
v-model:value="form.password"
placeholder="请输入登录密码"
placeholder="登录密码"
@pressEnter="submit"
>
<template #prefix>
@@ -107,7 +110,7 @@
type="text"
:maxlength="5"
v-model:value="form.code"
placeholder="图形验证码"
placeholder="验证码"
@pressEnter="submit"
>
<template #prefix>
@@ -120,9 +123,14 @@
</div>
</a-form-item>
<a-form-item>
<div class="flex justify-between">
<a-checkbox v-model:checked="form.remember">
{{ t('login.remember') }}
</a-checkbox>
<a class="login-forget" @click="push('/forget')">
{{ t('login.forget') }}
</a>
</div>
</a-form-item>
<a-form-item>
<a-button
@@ -134,7 +142,9 @@
>
{{ loading ? t('login.loading') : t('login.login') }}
</a-button>
<!-- <div class="register text-center pt-5"><a @click="push('/register')">免费注册</a></div>-->
<div class="register text-center pt-5"
><a @click="push('/register')">前往注册</a></div
>
</a-form-item>
</template>
<template v-if="loginType === 'sms'">
@@ -179,7 +189,9 @@
>
{{ loading ? t('login.loading') : t('login.login') }}
</a-button>
<!-- <div class="register text-center pt-5"><a @click="push('/register')">免费注册</a></div>-->
<div class="register text-center pt-5"
><a @click="push('/register')">前往注册</a></div
>
</a-form-item>
</template>
<template v-if="loginType == 'scan'">
@@ -236,10 +248,11 @@
<div class="flex flex-col justify-start">
<a-list item-layout="horizontal" :data-source="admins">
<template #renderItem="{ item }">
<a-list-item class="cursor-pointer hover:border-gray-100" @click="onSelectUser(item)">
<a-list-item-meta
:description="`租户ID: ${item.tenantId}`"
<a-list-item
class="cursor-pointer hover:border-gray-100"
@click="onSelectUser(item)"
>
<a-list-item-meta :description="`租户ID: ${item.tenantId}`">
<template #title>
{{ item.tenantName }}
</template>
@@ -268,7 +281,8 @@ import {
UserOutlined,
QrcodeOutlined,
MobileOutlined,
SafetyCertificateOutlined
SafetyCertificateOutlined,
RightOutlined
} from '@ant-design/icons-vue';
import { goHomeRoute, cleanPageTabs } from '@/utils/page-tab-util';
import { login, loginBySms, getCaptcha } from '@/api/passport/login';
@@ -282,15 +296,21 @@ import {FormInstance} from 'ant-design-vue/es/form';
import { configWebsiteField } from '@/api/cms/cmsWebsiteField';
import { Config } from '@/api/cms/cmsWebsiteField/model';
import { phoneReg } from 'ele-admin-pro';
import router from "@/router";
import {listAdminsByPhoneAll} from "@/api/system/user";
import {QrCodeStatusResponse} from "@/api/passport/qrLogin";
import router from '@/router';
import { listAdminsByPhoneAll } from '@/api/system/user';
import { QrCodeStatusResponse } from '@/api/passport/qrLogin';
const useForm = Form.useForm;
const {currentRoute} = useRouter();
const routerInstance = useRouter();
const { currentRoute } = routerInstance;
const { t } = useI18n();
const { locale } = useI18n();
// 路由导航函数
const push = (path: string) => {
routerInstance.push(path);
};
// 登录框方向, 0 居中, 1 居右, 2 居左
const direction = ref(0);
// 加载状态
@@ -327,7 +347,7 @@ const countdownTime = ref(0);
// 验证码倒计时定时器
let countdownTimer: number | null = null;
// 多用户选择账号登录
const showSelectLoginUser = ref<boolean>(false)
const showSelectLoginUser = ref<boolean>(false);
const admins = ref<User[]>([]);
// const tenantId = getTenantId();
@@ -436,9 +456,12 @@ const onLoginBySms = () => {
.then((msg) => {
if (msg == '请选择登录用户') {
showSelectLoginUser.value = true;
listAdminsByPhoneAll({phone: form.phone, templateId: TEMPLATE_ID}).then(data => {
listAdminsByPhoneAll({
phone: form.phone,
templateId: TEMPLATE_ID
}).then((data) => {
admins.value = data;
})
});
return false;
} else {
message.success(msg);
@@ -453,14 +476,13 @@ const onLoginBySms = () => {
loading.value = false;
});
})
.catch(() => {
});
.catch(() => {});
};
const onSelectUser = (item: User) => {
form.tenantId = item.tenantId;
onLoginBySms();
}
};
/* 保存编辑 */
const submit = () => {
@@ -496,8 +518,7 @@ const submit = () => {
loading.value = false;
});
})
.catch(() => {
});
.catch(() => {});
};
// const doRegister = () => {
@@ -518,11 +539,11 @@ const onLoginType = (text) => {
const onScan = () => {
if (loginType.value == 'scan') {
loginType.value = 'sms'
loginType.value = 'sms';
} else {
loginType.value = 'scan'
}
loginType.value = 'scan';
}
};
/* 二维码登录成功处理 */
const onQrLoginSuccess = async (item: QrCodeStatusResponse) => {

View File

@@ -19,9 +19,8 @@
/>
<h4>{{ config.siteName }}</h4>
</div>
<div class="company-name" v-if="config?.loginTitle">{{
config?.loginTitle
}}
<div class="company-name" v-if="config?.loginTitle"
>{{ config?.loginTitle }}
</div>
<a-form
ref="formRef"
@@ -30,11 +29,37 @@
class="login-form ele-bg-white"
>
<div class="login-title flex justify-center items-center px-12">
<h4
class="title-btn"
>注册</h4
>
<h4 class="title-btn">创建应用</h4>
</div>
<a-form-item name="companyName">
<div class="flex">
<a-input
allow-clear
size="large"
placeholder="云应用名称"
v-model:value="form.companyName"
/>
<!-- <a-button-->
<!-- class="ele-btn-icon"-->
<!-- size="large"-->
<!-- style="margin-left: 10px; width: 137px"-->
<!-- @click="openMapPicker"-->
<!-- >-->
<!-- <AimOutlined />选取-->
<!-- </a-button>-->
</div>
</a-form-item>
<a-form-item name="category">
<industry-select
v-model:value="form.category"
valueField="label"
allow-clear
size="large"
placeholder="所属行业"
class="ele-fluid"
@change="onIndustry"
/>
</a-form-item>
<template v-if="loginType === 'account'">
<a-form-item name="phone">
<a-input
@@ -67,25 +92,6 @@
</a-button>
</div>
</a-form-item>
<a-form-item name="companyName">
<div class="flex">
<a-input
allow-clear
size="large"
placeholder="公众号|小程序名称"
v-model:value="form.companyName"
>
</a-input>
<a-button
class="ele-btn-icon"
size="large"
style="margin-left: 10px; width: 137px"
@click="openMapPicker"
>
<AimOutlined />选取
</a-button>
</div>
</a-form-item>
<!-- <a-form-item name="companyName">-->
<!-- <a-input-->
<!-- allow-clear-->
@@ -103,20 +109,12 @@
<!-- :placeholder="`(选填)请输入电子邮箱`"-->
<!-- />-->
<!-- </a-form-item>-->
<a-form-item name="category">
<industry-select
v-model:value="form.category"
valueField="label"
allow-clear
size="large"
placeholder="所属行业"
class="ele-fluid"
@change="onIndustry"
/>
</a-form-item>
<a-form-item>
<a-checkbox v-model:checked="form.remember">
同意 <a href="https://website.websoft.top/xieyi/01.html" target="_blank">服务协议及隐私政策</a>
同意
<a href="https://website.websoft.top/xieyi/01.html" target="_blank"
>服务协议及隐私政策</a
>
</a-checkbox>
</a-form-item>
<a-form-item>
@@ -130,7 +128,9 @@
>
注册
</a-button>
<div class="register text-center pt-5"><a @click="push('/login')">已有账号立即登录</a></div>
<div class="register text-center pt-5"
><a @click="push('/login')">已有账号立即登录</a></div
>
</a-form-item>
</template>
<template v-if="loginType === 'sms'">
@@ -245,10 +245,10 @@ import {FormInstance} from 'ant-design-vue/es/form';
import { configWebsiteField } from '@/api/cms/cmsWebsiteField';
import { Config } from '@/api/cms/cmsWebsiteField/model';
import { phoneReg } from 'ele-admin-pro';
import {push} from "@/utils/common";
import {useThemeStore} from "@/store/modules/theme";
import {CmsWebsite} from "@/api/cms/cmsWebsite/model";
import {createCmsWebSite} from "@/api/layout";
import { push } from '@/utils/common';
import { useThemeStore } from '@/store/modules/theme';
import { CmsWebsite } from '@/api/cms/cmsWebsite/model';
import { createCmsWebSite } from '@/api/layout';
const useForm = Form.useForm;
const { currentRoute } = useRouter();
@@ -364,7 +364,7 @@ const {form} = useFormData<CmsWebsite>({
// 是否管理员
isSuperAdmin: true,
// 企业名称
companyName: undefined,
companyName: undefined
});
// 验证码 base64 数据
@@ -392,7 +392,7 @@ const rules = reactive({
companyName: [
{
required: true,
message: '请输入店铺名称',
message: '请输入品牌名称',
type: 'string'
}
],
@@ -536,8 +536,7 @@ const onLoginBySms = () => {
loading.value = false;
});
})
.catch(() => {
});
.catch(() => {});
};
/* 保存编辑 */
@@ -560,15 +559,14 @@ const submit = () => {
resetFields();
cleanPageTabs();
goHome();
}, 2000)
}, 2000);
})
.catch(() => {
message.error('该手机号码已经被注册');
loading.value = false;
});
})
.catch(() => {
});
.catch(() => {});
};
/* 获取图形验证码 */