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

View File

@@ -19,9 +19,8 @@
/> />
<h4>{{ config.siteName }}</h4> <h4>{{ config.siteName }}</h4>
</div> </div>
<div class="company-name" v-if="config?.loginTitle">{{ <div class="company-name" v-if="config?.loginTitle"
config?.loginTitle >{{ config?.loginTitle }}
}}
</div> </div>
<a-form <a-form
ref="formRef" ref="formRef"
@@ -30,11 +29,37 @@
class="login-form ele-bg-white" class="login-form ele-bg-white"
> >
<div class="login-title flex justify-center items-center px-12"> <div class="login-title flex justify-center items-center px-12">
<h4 <h4 class="title-btn">创建应用</h4>
class="title-btn"
>注册</h4
>
</div> </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'"> <template v-if="loginType === 'account'">
<a-form-item name="phone"> <a-form-item name="phone">
<a-input <a-input
@@ -67,25 +92,6 @@
</a-button> </a-button>
</div> </div>
</a-form-item> </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-form-item name="companyName">-->
<!-- <a-input--> <!-- <a-input-->
<!-- allow-clear--> <!-- allow-clear-->
@@ -103,20 +109,12 @@
<!-- :placeholder="`(选填)请输入电子邮箱`"--> <!-- :placeholder="`(选填)请输入电子邮箱`"-->
<!-- />--> <!-- />-->
<!-- </a-form-item>--> <!-- </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-form-item>
<a-checkbox v-model:checked="form.remember"> <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-checkbox>
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
@@ -130,7 +128,9 @@
> >
注册 注册
</a-button> </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> </a-form-item>
</template> </template>
<template v-if="loginType === 'sms'"> <template v-if="loginType === 'sms'">
@@ -245,10 +245,10 @@ import {FormInstance} from 'ant-design-vue/es/form';
import { configWebsiteField } from '@/api/cms/cmsWebsiteField'; import { configWebsiteField } from '@/api/cms/cmsWebsiteField';
import { Config } from '@/api/cms/cmsWebsiteField/model'; import { Config } from '@/api/cms/cmsWebsiteField/model';
import { phoneReg } from 'ele-admin-pro'; import { phoneReg } from 'ele-admin-pro';
import {push} from "@/utils/common"; import { push } from '@/utils/common';
import {useThemeStore} from "@/store/modules/theme"; import { useThemeStore } from '@/store/modules/theme';
import {CmsWebsite} from "@/api/cms/cmsWebsite/model"; import { CmsWebsite } from '@/api/cms/cmsWebsite/model';
import {createCmsWebSite} from "@/api/layout"; import { createCmsWebSite } from '@/api/layout';
const useForm = Form.useForm; const useForm = Form.useForm;
const { currentRoute } = useRouter(); const { currentRoute } = useRouter();
@@ -364,7 +364,7 @@ const {form} = useFormData<CmsWebsite>({
// 是否管理员 // 是否管理员
isSuperAdmin: true, isSuperAdmin: true,
// 企业名称 // 企业名称
companyName: undefined, companyName: undefined
}); });
// 验证码 base64 数据 // 验证码 base64 数据
@@ -392,7 +392,7 @@ const rules = reactive({
companyName: [ companyName: [
{ {
required: true, required: true,
message: '请输入店铺名称', message: '请输入品牌名称',
type: 'string' type: 'string'
} }
], ],
@@ -536,8 +536,7 @@ const onLoginBySms = () => {
loading.value = false; loading.value = false;
}); });
}) })
.catch(() => { .catch(() => {});
});
}; };
/* 保存编辑 */ /* 保存编辑 */
@@ -560,15 +559,14 @@ const submit = () => {
resetFields(); resetFields();
cleanPageTabs(); cleanPageTabs();
goHome(); goHome();
}, 2000) }, 2000);
}) })
.catch(() => { .catch(() => {
message.error('该手机号码已经被注册'); message.error('该手机号码已经被注册');
loading.value = false; loading.value = false;
}); });
}) })
.catch(() => { .catch(() => {});
});
}; };
/* 获取图形验证码 */ /* 获取图形验证码 */