批量修复问题

This commit is contained in:
扫地僧 2026-04-02 00:05:00 +08:00
parent c4b24bfc05
commit 76f90f50c0
4 changed files with 78 additions and 97 deletions

View File

@ -3,7 +3,7 @@ import request from "@/utils/request";
// 获取所有菜单
export function getAllMenus() {
return request({
url: `/admin/allmenu`,
url: `/backend/allmenu`,
method: "get",
});
}
@ -11,7 +11,7 @@ export function getAllMenus() {
//获取用户菜单
export function getMenus(id){
return request({
url: `/admin/menu/${parseInt(id)}`,
url: `/backend/menu/${parseInt(id)}`,
method: "get",
});
}
@ -19,7 +19,7 @@ export function getMenus(id){
// 更新菜单状态
export function updateMenuStatus(menuId, status) {
return request({
url: `/admin/menu/status/${menuId}`,
url: `/backend/menu/status/${menuId}`,
method: "patch",
data: { status },
});
@ -28,7 +28,7 @@ export function updateMenuStatus(menuId, status) {
// 创建菜单
export function createMenu(menuData) {
return request({
url: `/admin/createmenu`,
url: `/backend/createmenu`,
method: "post",
data: menuData,
});
@ -37,7 +37,7 @@ export function createMenu(menuData) {
// 更新菜单
export function updateMenu(menuId, menuData) {
return request({
url: `/admin/updatemenu/${menuId}`,
url: `/backend/updatemenu/${menuId}`,
method: "put",
data: menuData,
});
@ -46,7 +46,7 @@ export function updateMenu(menuId, menuData) {
// 删除菜单
export function deleteMenu(menuId) {
return request({
url: `/admin/deletemenu/${menuId}`,
url: `/backend/deletemenu/${menuId}`,
method: "delete",
});
}

View File

@ -2,28 +2,28 @@ import request from '@/utils/request';
export function getModulesList() {
return request({
url: '/admin/modules/list',
url: '/backend/modules/list',
method: 'get',
});
}
export function getTenantList() {
return request({
url: '/admin/modules/getTenantList',
url: '/backend/modules/getTenantList',
method: 'get',
});
}
export function getModuleDetail(id) {
return request({
url: `/admin/modules/${id}`,
url: `/backend/modules/${id}`,
method: 'get',
});
}
export function addModule(data) {
return request({
url: '/admin/modules',
url: '/backend/modules',
method: 'post',
data,
});
@ -31,7 +31,7 @@ export function addModule(data) {
export function editModule(id, data) {
return request({
url: `/admin/modules/${id}`,
url: `/backend/modules/${id}`,
method: 'put',
data,
});
@ -39,14 +39,14 @@ export function editModule(id, data) {
export function deleteModule(id) {
return request({
url: `/admin/modules/${id}`,
url: `/backend/modules/${id}`,
method: 'delete',
});
}
export function batchDeleteModules(ids) {
return request({
url: '/admin/modules/batchDelete',
url: '/backend/modules/batchDelete',
method: 'post',
data: { ids },
});
@ -54,7 +54,7 @@ export function batchDeleteModules(ids) {
export function changeModuleStatus(id, status) {
return request({
url: '/admin/modules/status',
url: '/backend/modules/status',
method: 'post',
data: { id, status },
});
@ -62,7 +62,7 @@ export function changeModuleStatus(id, status) {
export function getModulesSelectList() {
return request({
url: '/admin/modules/select/list',
url: '/backend/modules/select/list',
method: 'get',
});
}

View File

@ -7,6 +7,7 @@ const defaultUser = {
account: '',
name: '',
group_id: '',
type: 'backend',
avatar: ''
}
@ -40,6 +41,7 @@ export const useAuthStore = defineStore('auth', () => {
account: userInfo.account || '',
name: userInfo.name || '',
group_id: userInfo.group_id || '',
type: 'backend',
tid: userInfo.tid || '',
avatar: userInfo.avatar || ''
}

View File

@ -18,12 +18,8 @@
<div class="copyright">© 2026 Yunzer 管理系统</div>
</div>
<div class="login-panel">
<h2 class="login-title">欢迎登录</h2>
<h2 class="login-title">欢迎登录租户端</h2>
<div class="login-desc">请填写您的账号信息</div>
<div class="mode-switch">
<button class="mode-btn" :class="{ active: loginMode === 'password' }" @click="switchMode('password')">账号密码登录</button>
<button class="mode-btn" :class="{ active: loginMode === 'sms' }" @click="switchMode('sms')">手机号验证码登录</button>
</div>
<div class="form-group icon-input-group">
<span class="input-icon">
<i class="fa-solid fa-building-columns"></i>
@ -31,13 +27,13 @@
<input v-model="tenant_name" type="text" placeholder="租户名称" autocomplete="tenant_name"
class="input input-with-icon" />
</div>
<div v-if="loginMode === 'password'" class="form-group icon-input-group">
<div class="form-group icon-input-group">
<span class="input-icon">
<i class="fa-solid fa-user"></i>
</span>
<input v-model="account" type="text" placeholder="用户名" autocomplete="account" class="input input-with-icon" />
</div>
<div v-if="loginMode === 'password'" class="form-group icon-input-group">
<div class="form-group icon-input-group">
<span class="input-icon">
<i class="fa-solid fa-lock"></i>
</span>
@ -49,13 +45,11 @@
<i v-else class="fa-solid fa-eye-slash"></i>
</span>
</div>
<div v-if="loginMode === 'sms'" class="form-group icon-input-group">
<span class="input-icon">
<i class="fa-solid fa-mobile-screen-button"></i>
</span>
<input v-model="phone" type="text" placeholder="手机号" autocomplete="tel" class="input input-with-icon" />
<div v-if="openVerifyEnabled && verifyType === 'captcha'" class="form-group code-row">
<input v-model="captchaInput" type="text" placeholder="请输入4位验证码" class="input code-input" />
<button class="code-btn" type="button" @click="generateCaptcha">{{ captchaText }}</button>
</div>
<div v-if="loginMode === 'sms'" class="form-group code-row">
<div v-if="openVerifyEnabled && (verifyType === 'sms' || verifyType === 'email')" class="form-group code-row">
<input v-model="smsCode" type="text" placeholder="短信验证码" class="input code-input" />
<button class="code-btn" :disabled="codeLoading || countdown > 0" @click="handleSendLoginCode">
{{ countdown > 0 ? `${countdown}s` : (codeLoading ? "发送中..." : "发送验证码") }}
@ -64,14 +58,13 @@
<!-- 极验验证码容器 -->
<div style="display: none;" v-if="showCaptchaContainer" class="geetest-container" ref="captchaContainer"></div>
<div style="display: none;" v-if="openVerifyEnabled && verifyType === 'geetest' && showCaptchaContainer" class="geetest-container" ref="captchaContainer"></div>
<div class="remember-me-row">
<label v-if="loginMode === 'password'" class="remember-me-label">
<label class="remember-me-label">
<input type="checkbox" v-model="rememberMe" class="remember-me-checkbox" @change="handleRememberMeChange" />
<span>记住我</span>
</label>
<span v-else></span>
<div class="action-links">
<a class="register-link" @click.prevent="goRegister">注册账号</a>
<span class="divider">|</span>
@ -96,7 +89,7 @@
import { ref, onMounted, nextTick, onUnmounted } from "vue";
import { useRouter } from "vue-router";
import { useAuthStore } from "@/stores/auth";
import { login, getOpenVerify, getGeetest4Infos, sendLoginCode, loginBySms } from "@/api/login";
import { login, getOpenVerify, getGeetest4Infos, sendLoginCode } from "@/api/login";
import "@/assets/js/gt4.js";
import { ElMessageBox, ElMessage } from "element-plus";
@ -105,11 +98,13 @@ const authStore = useAuthStore();
// --- ---
const tenant_name = ref("");
const loginMode = ref<"password" | "sms">("password");
const openVerifyEnabled = ref(true);
const verifyType = ref<"captcha" | "sms" | "geetest" | "email">("captcha");
const account = ref("");
const password = ref("");
const phone = ref("");
const smsCode = ref("");
const captchaInput = ref("");
const captchaText = ref("");
const passwordVisible = ref(false);
const rememberMe = ref(false);
const loading = ref(false);
@ -150,29 +145,11 @@ const cleanCaptchaInstance = () => {
// --- ---
const performLoginRequest = async () => {
if (loginMode.value === "sms") {
const res = await loginBySms({
tenant_name: tenant_name.value,
phone: phone.value,
sms_code: smsCode.value,
});
if (res && res.code === 200) {
authStore.setLoginInfo(res.data);
const { useTabsStore } = await import("@/stores");
const tabsStore = useTabsStore();
tabsStore.resetTabs();
router.push({ path: "/home" });
ElMessage.success("登录成功!");
return true;
}
errorMsg.value = res.msg || "登录失败";
return false;
}
const res = await login({
tenant_name: tenant_name.value,
account: account.value,
password: password.value
password: password.value,
code: smsCode.value
});
if (res && res.code === 200) {
@ -205,9 +182,8 @@ const performLoginRequest = async () => {
}
};
const switchMode = (mode: "password" | "sms") => {
loginMode.value = mode;
errorMsg.value = "";
const generateCaptcha = () => {
captchaText.value = `${Math.floor(1000 + Math.random() * 9000)}`;
};
const startCountdown = () => {
@ -228,8 +204,8 @@ const handleSendLoginCode = async () => {
errorMsg.value = "请输入租户名称";
return;
}
if (!phone.value.trim()) {
errorMsg.value = "请输入手机号";
if (!account.value.trim()) {
errorMsg.value = "请输入用户名";
return;
}
codeLoading.value = true;
@ -237,7 +213,8 @@ const handleSendLoginCode = async () => {
try {
const res = await sendLoginCode({
tenant_name: tenant_name.value,
phone: phone.value,
account: account.value,
channel: verifyType.value,
});
if (res && res.code === 200) {
ElMessage.success("验证码已发送");
@ -366,7 +343,6 @@ const handleLogin = async () => {
errorMsg.value = "请输入租户名称";
return;
}
if (loginMode.value === "password") {
if (!account.value.trim()) {
errorMsg.value = "请输入用户名";
return;
@ -375,43 +351,45 @@ const handleLogin = async () => {
errorMsg.value = "请输入密码";
return;
}
} else {
if (!phone.value.trim()) {
errorMsg.value = "请输入手机号";
return;
}
if (!smsCode.value.trim()) {
errorMsg.value = "请输入短信验证码";
return;
}
}
if (loading.value) return;
loading.value = true;
try {
if (loginMode.value === "password") {
//
const verifyRes = await getOpenVerify();
let openVerify = "0";
let verifyTypeVal = "captcha";
if (verifyRes && verifyRes.code === 200 && Array.isArray(verifyRes.data)) {
verifyRes.data.forEach((item: any) => {
if (item.label === "openVerify") {
openVerify = item.value || "0";
}
if (item.label === "verifyType") {
verifyTypeVal = item.value || "captcha";
}
});
}
openVerifyEnabled.value = openVerify === "1";
verifyType.value = verifyTypeVal as any;
// 使4.0
if (openVerify === "1") {
if (openVerifyEnabled.value && verifyType.value === "captcha") {
if (!captchaInput.value.trim()) {
errorMsg.value = "请输入验证码";
return;
}
if (captchaInput.value.trim() !== captchaText.value) {
errorMsg.value = "验证码错误";
generateCaptcha();
return;
}
}
if (openVerifyEnabled.value && (verifyType.value === "sms" || verifyType.value === "email") && !smsCode.value.trim()) {
errorMsg.value = "请输入验证码";
return;
}
if (openVerifyEnabled.value && verifyType.value === "geetest") {
await startGeetest4();
} else {
//
await performLoginRequest();
}
} else {
//
await performLoginRequest();
}
} catch (err: any) {
@ -451,6 +429,7 @@ onMounted(() => {
password.value = localStorage.getItem("loginPassword") || "";
rememberMe.value = true;
}
generateCaptcha();
});
onUnmounted(() => {