注册相关内容

This commit is contained in:
王兴凯 2026-04-28 18:28:44 +08:00
parent 10c3c33ad0
commit 1963dbbba1
12 changed files with 2514 additions and 510 deletions

View File

@ -34,3 +34,113 @@ export function getCaptcha(): AxiosPromise<VerifyCode> {
method: 'get' method: 'get'
}); });
} }
/**
*
*/
export function registerUser(data: any): AxiosPromise<any> {
return request({
url: '/sms/register',
method: 'post',
data
});
}
/**
*
* @param companyId ID(),
*/
export function getBasinList(): AxiosPromise<any[]> {
return request({
url: '/env/hbrv/regDropdown',
method: 'get',
// params: baseid ? { baseid } : {}
});
}
/**
* (,)
*/
export function getGroupList(): AxiosPromise<any[]> {
return request({
url: '/env/hycd/regDropdown',
method: 'get',
params:{lx:1}
});
}
/**
*
*/
export function getCompanyList(): AxiosPromise<any[]> {
return request({
url: '/env/hycd/regDropdown',
method: 'get',
params: { lx:2 }
});
}
/**
*
*/
export function getStationList(params:any): AxiosPromise<any[]> {
return request({
url: '/env/engInfo/regDropdown',
method: 'post',
data: params
});
}
/**
*
* @param phone
* @param type 1- 2-
*/
export function sendSmsCode(phone: string, type: number = 1): AxiosPromise<any> {
return request({
url: '/sms/sendCode',
method: 'post',
data: { phone, type }
});
}
/**
*
* @param phone
* @param code
* @param type 1- 2-
*/
export function verifySmsCode(phone: string, code: string, type: number = 1): AxiosPromise<any> {
return request({
url: '/sms/verifyCode',
method: 'post',
data: { phone, code, type }
});
}
/**
*
* @param phone
* @param code
*/
export function smsLoginApi(phone: string, code: string): AxiosPromise<TokenResult> {
return request({
url: '/sms/login',
method: 'post',
data: { phone, code }
});
}
/**
*
* @param phone
* @param code
* @param password
*/
export function resetPassword(phone: string, code: string, password: string): AxiosPromise<any> {
return request({
url: '/sms/resetPassword',
method: 'post',
data: { phone, code, password }
});
}

View File

@ -17,6 +17,14 @@ export function gettableData(queryParams:any) {
params: queryParams params: queryParams
}); });
} }
// 审核用户列表
export function queryPendingAuditUsers(queryParams:any) {
return request({
url: '/system/user/queryPendingAuditUsers',
method: 'get',
params: queryParams
});
}
//用户-禁用,启用 //用户-禁用,启用
export function DataStatus (queryParams:any) { export function DataStatus (queryParams:any) {
return request({ return request({
@ -105,7 +113,7 @@ export function updatePassword (queryParams:any) {
//获取过鱼设施权限树 //获取过鱼设施权限树
export function getFishtree(queryParams:any) { export function getFishtree(queryParams:any) {
return request({ return request({
url: '/env/tree/rvcdEng', url: '/env/tree/hbrvEng',
method: 'get', method: 'get',
params: queryParams params: queryParams
}); });
@ -127,6 +135,15 @@ export function getuserdata(queryParams:any) {
}); });
} }
// 审计用户(审批通过/驳回)
export function auditUser(data: any) {
return request({
url: '/system/user/auditUser',
method: 'post',
data
});
}
/** /**
* *
*/ */

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 B

View File

@ -12,7 +12,7 @@ const routeKey = computed(() => router.path + Math.random());
<template> <template>
<section class="app-main"> <section class="app-main">
<GisView /> <!-- <GisView /> -->
<div class="gi-panels"> <div class="gi-panels">
<router-view v-slot="{ Component, route }" :key="routeKey"> <router-view v-slot="{ Component, route }" :key="routeKey">
<transition name="router-fade" mode="out-in"> <transition name="router-fade" mode="out-in">

View File

@ -9,7 +9,7 @@ NProgress.configure({ showSpinner: false });
const permissionStore = usePermissionStoreHook(); const permissionStore = usePermissionStoreHook();
// 白名单路由 // 白名单路由
const whiteList = ['/login']; //login const whiteList = ['/login','/register']; //login
// 查找第一个可用路由 // 查找第一个可用路由
function findFirstAvailableRoute(routes: any[]): string | undefined { function findFirstAvailableRoute(routes: any[]): string | undefined {

View File

@ -26,6 +26,11 @@ export const constantRoutes: RouteRecordRaw[] = [
component: () => import('@/views/login-sjtb/index.vue'), component: () => import('@/views/login-sjtb/index.vue'),
meta: { hidden: true } meta: { hidden: true }
}, },
{
path: '/register',
component: () => import('@/views/register/index.vue'),
meta: { hidden: true }
},
{ {
path: '/404', path: '/404',
component: () => import('@/views/error-page/404.vue'), component: () => import('@/views/error-page/404.vue'),

View File

@ -25,14 +25,9 @@
<!-- <h3 class="forgot-password-title">忘记密码</h3> --> <!-- <h3 class="forgot-password-title">忘记密码</h3> -->
</div> </div>
<a-form <a-form :model="forgotPasswordForm" :rules="forgotPasswordRules" layout="vertical" class="form-container">
:model="forgotPasswordForm"
:rules="forgotPasswordRules"
layout="vertical"
class="form-container"
>
<a-form-item label="" name="phone"> <a-form-item label="" name="phone">
<a-input placeholder="请输入手机号" size="large"> <a-input v-model:value="forgotPasswordForm.phone" placeholder="请输入手机号" size="large">
<template #prefix> <template #prefix>
<MobileOutlined /> <MobileOutlined />
</template> </template>
@ -41,23 +36,13 @@
<a-form-item label="" name="captcha"> <a-form-item label="" name="captcha">
<div class="captcha-row"> <div class="captcha-row">
<a-input <a-input v-model:value="forgotPasswordForm.captcha" placeholder="请输入验证码" size="large" class="captcha-input">
v-model="forgotPasswordForm.captcha"
placeholder="请输入验证码"
size="large"
class="captcha-input"
>
<template #prefix> <template #prefix>
<LockOutlined /> <LockOutlined />
</template> </template>
<template #suffix> <template #suffix>
<a-button <a-button type="text" size="small" @click="sendForgotPasswordSms" :disabled="smsButtonDisabled"
type="text" :loading="loading">
size="small"
@click="sendForgotPasswordSms"
:disabled="smsButtonDisabled"
:loading="loading"
>
{{ {{
smsCountdown > 0 ? `${smsCountdown}秒后重新获取` : "获取验证码" smsCountdown > 0 ? `${smsCountdown}秒后重新获取` : "获取验证码"
}} }}
@ -68,24 +53,22 @@
</a-form-item> </a-form-item>
<a-form-item label="" name="newPassword"> <a-form-item label="" name="newPassword">
<a-input-password <a-input-password v-model:value="forgotPasswordForm.newPassword" placeholder="请输入新密码" size="large">
v-model="forgotPasswordForm.newPassword"
placeholder="请输入新密码"
size="large"
>
<template #prefix> <template #prefix>
<LockOutlined /> <LockOutlined />
</template> </template>
</a-input-password> </a-input-password>
</a-form-item> </a-form-item>
<a-button <a-form-item label="" name="confirmPassword">
type="primary" <a-input-password v-model:value="forgotPasswordForm.confirmPassword" placeholder="请再次输入密码" size="large">
size="large" <template #prefix>
block <LockOutlined />
@click="handleResetPassword" </template>
:loading="loading" </a-input-password>
> </a-form-item>
<a-button type="primary" size="large" block @click="handleResetPassword" :loading="loading">
<span>提交</span> <span>提交</span>
</a-button> </a-button>
</a-form> </a-form>
@ -96,23 +79,12 @@
<!-- Tabs 切换账号登录 / 短信登录 --> <!-- Tabs 切换账号登录 / 短信登录 -->
<a-tabs v-model:activeKey="activeTab" class="login-tabs"> <a-tabs v-model:activeKey="activeTab" class="login-tabs">
<a-tab-pane key="account" tab="账号登录"> <a-tab-pane key="account" tab="账号登录">
<a-form <a-form :model="loginData" :rules="loginRules" layout="vertical" class="form-container"
:model="loginData" @finish="onFinish">
:rules="loginRules"
layout="vertical"
class="form-container"
@finish="onFinish"
>
<!-- 用户名/账号/手机号输入框 --> <!-- 用户名/账号/手机号输入框 -->
<a-form-item label="" name="username"> <a-form-item label="" name="username">
<a-input <a-input ref="username" v-model:value="loginData.username" clearable type="text"
ref="username" placeholder="请输入用户账号/身份证号/手机号" size="large">
v-model:value="loginData.username"
clearable
type="text"
placeholder="请输入用户账号/身份证号/手机号"
size="large"
>
<template #prefix> <template #prefix>
<UserOutlined /> <UserOutlined />
</template> </template>
@ -121,12 +93,7 @@
<!-- 密码输入框 --> <!-- 密码输入框 -->
<a-form-item label="" name="password"> <a-form-item label="" name="password">
<a-input-password <a-input-password type="password" v-model:value="loginData.password" placeholder="请输入密码" size="large">
type="password"
v-model:value="loginData.password"
placeholder="请输入密码"
size="large"
>
<template #prefix> <template #prefix>
<LockOutlined /> <LockOutlined />
</template> </template>
@ -136,65 +103,38 @@
<a-form-item label="" name="captcha"> <a-form-item label="" name="captcha">
<div class="captcha-row"> <div class="captcha-row">
<a-row :gutter="24" align="middle"> <a-row :gutter="24" align="middle">
<a-col :span="10" <a-col :span="10"><a-input v-model:value="loginData.code" placeholder="请输入验证码" size="large"
><a-input class="captcha-input" /></a-col>
v-model:value="loginData.code" <a-col :span="10"><img :src="codeUrl" alt="验证码" class="captcha-img" /></a-col>
placeholder="请输入验证码"
size="large"
class="captcha-input"
/></a-col>
<a-col :span="10"
><img :src="codeUrl" alt="验证码" class="captcha-img"
/></a-col>
<a-col :span="4"> <a @click="getCode">换一张</a></a-col> <a-col :span="4"> <a @click="getCode">换一张</a></a-col>
</a-row> </a-row>
</div> </div>
</a-form-item> </a-form-item>
<a-button <a-button type="primary" size="large" block htmlType="submit" :loading="loading">
type="primary"
size="large"
block
htmlType="submit"
:loading="loading"
>
<span>登录</span> <span>登录</span>
</a-button> </a-button>
<!-- <a-button <div style="width: 100%;display: flex;align-items: center;justify-content: space-between;">
type="link" <a-button type="link" size="mini" block @click="showForgotPasswordPage"
size="mini" :style="{ marginTop: '10px', border: 'none' }">
block 忘记密码
@click="showForgotPasswordPage" </a-button>
:style="{ marginTop: '10px', border: 'none' }" <a-button type="link" size="mini" block @click="goRegister"
> :style="{ marginTop: '10px', border: 'none' }">
忘记密码 注册
</a-button> --> </a-button>
<a-button </div>
type="link"
size="mini"
block
:style="{ marginTop: '10px', border: 'none' }"
>
注册
</a-button>
<!-- 忘记密码 --> <!-- 忘记密码 -->
</a-form> </a-form>
</a-tab-pane> </a-tab-pane>
<!-- 短信登录 Tab (占位) --> <!-- 短信登录 Tab (占位) -->
<!-- <a-tab-pane key="sms" tab="短信登录"> <a-tab-pane key="sms" tab="短信登录">
<a-form <a-form :model="loginData" :rules="state.smsLoginRules" layout="vertical" class="form-container"
:model="loginData" @finish="onSmsLogin">
:rules="loginRules"
layout="vertical"
class="form-container"
>
<a-form-item label="" name="username"> <a-form-item label="" name="username">
<a-input <a-input v-model:value="loginData.username" placeholder="请输入手机号" size="large">
v-model:value="loginData.username"
placeholder="请输入手机号"
size="large"
>
<template #prefix> <template #prefix>
<MobileOutlined /> <MobileOutlined />
</template> </template>
@ -202,23 +142,13 @@
</a-form-item> </a-form-item>
<a-form-item label="" name="captcha"> <a-form-item label="" name="captcha">
<div class="captcha-row"> <div class="captcha-row">
<a-input <a-input v-model:value="loginData.code" placeholder="请输入验证码" size="large" class="captcha-input">
v-model="loginData.code"
placeholder="请输入验证码"
size="large"
class="captcha-input"
>
<template #prefix> <template #prefix>
<LockOutlined /> <LockOutlined />
</template> </template>
<template #suffix> <template #suffix>
<a-button <a-button type="text" size="small" @click="sendSms" :disabled="smsButtonDisabled"
type="text" :loading="loading">
size="small"
@click="sendSms"
:disabled="smsButtonDisabled"
:loading="loading"
>
{{ {{
smsCountdown > 0 smsCountdown > 0
? `${smsCountdown}秒后重新获取` ? `${smsCountdown}秒后重新获取`
@ -229,17 +159,21 @@
</a-input> </a-input>
</div> </div>
</a-form-item> </a-form-item>
<a-button <a-button type="primary" size="large" block htmlType="submit" :loading="loading">
type="primary"
size="large"
block
htmlType="submit"
:loading="loading"
>
<span>登录</span> <span>登录</span>
</a-button> </a-button>
<div style="width: 100%;display: flex;align-items: center;justify-content: space-between;">
<a-button type="link" size="mini" block @click="showForgotPasswordPage"
:style="{ marginTop: '10px', border: 'none' }">
忘记密码
</a-button>
<a-button type="link" size="mini" block @click="goRegister"
:style="{ marginTop: '10px', border: 'none' }">
注册
</a-button>
</div>
</a-form> </a-form>
</a-tab-pane> --> </a-tab-pane>
</a-tabs> </a-tabs>
</div> </div>
</div> </div>
@ -251,7 +185,7 @@
import { onMounted, reactive, ref, toRefs, watch } from "vue"; import { onMounted, reactive, ref, toRefs, watch } from "vue";
import loginImg from "@/assets/images/logo.png"; import loginImg from "@/assets/images/logo.png";
import { UserOutlined, LockOutlined, MobileOutlined } from "@ant-design/icons-vue"; import { UserOutlined, LockOutlined, MobileOutlined } from "@ant-design/icons-vue";
import { getCaptcha } from "@/api/auth"; import { getCaptcha, sendSmsCode, smsLoginApi, resetPassword } from "@/api/auth";
import { message } from "ant-design-vue"; import { message } from "ant-design-vue";
import { setPath } from "@/utils/auth"; import { setPath } from "@/utils/auth";
// //
@ -285,6 +219,7 @@ const forgotPasswordForm = ref({
phone: "", phone: "",
captcha: "", captcha: "",
newPassword: "", newPassword: "",
confirmPassword: "",
}); });
// //
const showForgotPassword = ref(false); const showForgotPassword = ref(false);
@ -304,6 +239,10 @@ const state = reactive({
password: [{ required: true, trigger: "blur", message: t("login.rulesPassword") }], password: [{ required: true, trigger: "blur", message: t("login.rulesPassword") }],
code: [{ required: true, trigger: "blur", message: "请输入验证码" }], code: [{ required: true, trigger: "blur", message: "请输入验证码" }],
}, },
smsLoginRules: {
username: [{ required: true, trigger: "blur", message: "请输入手机号" }],
code: [{ required: true, trigger: "blur", message: "请输入验证码" }]
},
loginImg: loginImg[0], loginImg: loginImg[0],
loading: false, loading: false,
passwordType: "password", passwordType: "password",
@ -325,7 +264,67 @@ const forgotPasswordRules = ref({
captcha: [{ required: true, message: "验证码不能为空", trigger: "blur" }], captcha: [{ required: true, message: "验证码不能为空", trigger: "blur" }],
newPassword: [ newPassword: [
{ required: true, message: "新密码不能为空", trigger: "blur" }, { required: true, message: "新密码不能为空", trigger: "blur" },
{ min: 6, message: "密码长度不能少于6位", trigger: "blur" }, { min: 10, message: "密码长度不能少于10位", trigger: "blur" },
{
validator: (rule: any, value: string) => {
if (!value) return Promise.resolve();
//
const hasUpperCase = /[A-Z]/.test(value);
const hasLowerCase = /[a-z]/.test(value);
const hasNumber = /\d/.test(value);
const hasSpecialChar = /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(value);
const typeCount = [hasUpperCase, hasLowerCase, hasNumber, hasSpecialChar].filter(Boolean).length;
if (typeCount < 3) {
return Promise.reject(new Error('密码必须包含大写字母、小写字母、数字、特殊字符中的至少三种'));
}
//
if (/(.)\1{1,}/.test(value)) {
return Promise.reject(new Error('密码不能包含连续重复字符'));
}
// /
for (let i = 0; i < value.length - 1; i++) {
if (/\d/.test(value[i]) && /\d/.test(value[i + 1])) {
const diff = value.charCodeAt(i + 1) - value.charCodeAt(i);
if (Math.abs(diff) === 1) {
return Promise.reject(new Error('密码不能包含连续递增或递减的数字'));
}
}
}
// /
for (let i = 0; i < value.length - 1; i++) {
if (/[a-zA-Z]/.test(value[i]) && /[a-zA-Z]/.test(value[i + 1])) {
const diff = value.charCodeAt(i + 1) - value.charCodeAt(i);
if (Math.abs(diff) === 1) {
return Promise.reject(new Error('密码不能包含连续递增或递减的字母'));
}
}
}
return Promise.resolve();
},
trigger: "blur"
}
],
confirmPassword: [
{ required: true, message: "请再次输入密码", trigger: "blur" },
{
validator: (rule: any, value: string) => {
if (!value) {
return Promise.reject(new Error('请再次输入密码'));
}
if (value !== forgotPasswordForm.value.newPassword) {
return Promise.reject(new Error('两次输入的密码不一致'));
}
return Promise.resolve();
},
trigger: "blur"
}
], ],
}); });
@ -382,6 +381,50 @@ function onFinish() {
}); });
} }
/**
* 短信验证码登录
*/
const onSmsLogin = async () => {
//
try {
//
const phoneRegex = /^1[3-9]\d{9}$/;
if (!loginData.value.username || !phoneRegex.test(loginData.value.username)) {
message.error("请输入正确的手机号");
return;
}
//
if (!loginData.value.code || loginData.value.code.trim() === '') {
message.error("请输入验证码");
return;
}
// console.log()
// debugger
state.loading = true;
//
await smsLoginApi(
loginData.value.username, //
loginData.value.code //
);
//
const res: any = setPath("/login-sjtb");
if (res.code == 0) {
message.success("登录成功");
//
router.push({ path: "/" });
}
} catch (error: any) {
// console.error("", error);
// message.error(error.message || "");
} finally {
state.loading = false;
}
};
watch( watch(
route, route,
() => { () => {
@ -426,9 +469,9 @@ const startCountdown = () => {
}; };
// //
// const showForgotPasswordPage = () => { const showForgotPasswordPage = () => {
// showForgotPassword.value = true; showForgotPassword.value = true;
// }; };
// //
const goRegister = () => { const goRegister = () => {
router.push({ path: "/register" }); router.push({ path: "/register" });
@ -441,49 +484,53 @@ const backToLogin = () => {
phone: "", phone: "",
captcha: "", captcha: "",
newPassword: "", newPassword: "",
confirmPassword: "",
}; };
}; };
// //
// const sendSms = async () => { const sendSms = async () => {
// // //
// if (!loginData.value.username) { if (!loginData.value.username) {
// message.error(""); message.error("请输入手机号");
// return; return;
// } }
// // //
// const phoneRegex = /^1[3-9]\d{9}$/; const phoneRegex = /^1[3-9]\d{9}$/;
// if (!phoneRegex.test(loginData.value.username)) { if (!phoneRegex.test(loginData.value.username)) {
// message.error(""); message.error("请输入正确的手机号");
// return; return;
// } }
// // //
// if (smsCountdown.value > 0) { if (smsCountdown.value > 0) {
// return; return;
// } }
// loading.value = true; loading.value = true;
// smsButtonDisabled.value = true; smsButtonDisabled.value = true;
// try { try {
// // // type1
// // await axios.post('/sms/send', { phone: loginForm.value.username }) const res: any = await sendSmsCode(loginData.value.username, 3);
if (res.code == 1) {
message.success(res.msg);
return
}
//
message.success("验证码发送成功");
// // //
// message.success(""); startCountdown();
} catch (error) {
// // console.error("发送验证码失败", error);
// startCountdown(); message.error("验证码发送失败,请重试");
// } catch (error) { smsButtonDisabled.value = false;
// console.error("", error); } finally {
// message.error(""); loading.value = false;
// smsButtonDisabled.value = false; }
// } finally { };
// loading.value = false;
// }
// };
// //
const sendForgotPasswordSms = async () => { const sendForgotPasswordSms = async () => {
// //
@ -508,17 +555,23 @@ const sendForgotPasswordSms = async () => {
smsButtonDisabled.value = true; smsButtonDisabled.value = true;
try { try {
// // type=3
// await axios.post('/sms/forgot-password', { phone: forgotPasswordForm.value.phone }) const res: any = await sendSmsCode(forgotPasswordForm.value.phone, 2);
// if (res.code == 1) {
message.error(res.msg);
smsButtonDisabled.value = false;
return;
}
//
message.success("验证码发送成功"); message.success("验证码发送成功");
// //
startCountdown(); startCountdown();
} catch (error) { } catch (error: any) {
console.error("发送验证码失败", error); // console.error("", error);
message.error("验证码发送失败,请重试"); // message.error(error.message || "");
smsButtonDisabled.value = false; smsButtonDisabled.value = false;
} finally { } finally {
loading.value = false; loading.value = false;
@ -526,23 +579,111 @@ const sendForgotPasswordSms = async () => {
}; };
// //
const handleResetPassword = async () => { const handleResetPassword = async () => {
loading.value = true; //
try { try {
// 2. () //
// await axios.post('/user/reset-password', { const phoneRegex = /^1[3-9]\d{9}$/;
// phone: forgotPasswordForm.value.phone, if (!forgotPasswordForm.value.phone || !phoneRegex.test(forgotPasswordForm.value.phone)) {
// captcha: forgotPasswordForm.value.captcha, message.error("请输入正确的手机号");
// newPassword: forgotPasswordForm.value.newPassword return;
// }) }
// 3. if (!forgotPasswordForm.value.captcha) {
message.success("密码重置成功"); message.error("请输入验证码");
return;
}
if (!forgotPasswordForm.value.newPassword) {
message.error("请输入新密码");
return;
}
//
if (!forgotPasswordForm.value.confirmPassword) {
message.error("请再次输入密码");
return;
}
//
if (forgotPasswordForm.value.newPassword !== forgotPasswordForm.value.confirmPassword) {
message.error("两次输入的密码不一致");
return;
}
//
const password = forgotPasswordForm.value.newPassword;
if (password.length < 10) {
message.error("密码长度不能少于10位");
return;
}
const hasUpperCase = /[A-Z]/.test(password);
const hasLowerCase = /[a-z]/.test(password);
const hasNumber = /\d/.test(password);
const hasSpecialChar = /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(password);
const typeCount = [hasUpperCase, hasLowerCase, hasNumber, hasSpecialChar].filter(Boolean).length;
if (typeCount < 3) {
message.error('密码必须包含大写字母、小写字母、数字、特殊字符中的至少三种');
return;
}
//
if (/(.)\1{1,}/.test(password)) {
message.error('密码不能包含连续重复字符');
return;
}
// /
for (let i = 0; i < password.length - 1; i++) {
if (/\d/.test(password[i]) && /\d/.test(password[i + 1])) {
const diff = password.charCodeAt(i + 1) - password.charCodeAt(i);
if (Math.abs(diff) === 1) {
message.error('密码不能包含连续递增或递减的数字');
return;
}
}
}
// /
for (let i = 0; i < password.length - 1; i++) {
if (/[a-zA-Z]/.test(password[i]) && /[a-zA-Z]/.test(password[i + 1])) {
const diff = password.charCodeAt(i + 1) - password.charCodeAt(i);
if (Math.abs(diff) === 1) {
message.error('密码不能包含连续递增或递减的字母');
return;
}
}
}
// 4.
backToLogin();
} catch (error) { } catch (error) {
console.error("密码重置失败", error); console.error("表单验证失败", error);
message.error("密码重置失败,请重试"); return;
}
loading.value = true;
try {
// RSA
const encryptedPassword = encrypt(forgotPasswordForm.value.newPassword);
// 使
const res: any = await resetPassword(
forgotPasswordForm.value.phone,
forgotPasswordForm.value.captcha,
encryptedPassword
);
if (res.code == 0 ) {
message.success("密码重置成功");
//
backToLogin();
} else {
message.error(res.msg || "密码重置失败");
}
} catch (error: any) {
// console.error("", error);
// message.error(error.message || "");
} finally { } finally {
loading.value = false; loading.value = false;
} }
@ -632,7 +773,7 @@ onMounted(() => {
left: 74%; left: 74%;
top: 30%; top: 30%;
width: 20%; width: 20%;
max-height: 402px; max-height: 420px;
max-width: 400px; max-width: 400px;
min-height: 362px; min-height: 362px;
border-radius: 3px; border-radius: 3px;
@ -647,10 +788,12 @@ onMounted(() => {
/* 验证码布局 */ /* 验证码布局 */
.captcha-row { .captcha-row {
display: flex; display: flex;
.ant-row { .ant-row {
display: flex; display: flex;
align-items: start; align-items: start;
} }
/* gap: 12px; /* gap: 12px;
align-items: center; */ align-items: center; */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -282,57 +282,80 @@ const userId = ref('')
// ID // ID
const fishhui = ref<any[]>([]) const fishhui = ref<any[]>([])
const fishTreeDialog = ref(false) const fishTreeDialog = ref(false)
function openFishway(row: any) {
//
const isFishDataLoaded = ref(false)
async function openFishway(row: any) {
fishway.value = true fishway.value = true
userId.value = row.id userId.value = row.id
//
getFishTree() //
// watch
fishhui.value = [] fishhui.value = []
tableDatafish.value = [] tableDatafish.value = []
getuserdata({ userId: userId.value }).then((res: any) => { isFishDataLoaded.value = false
console.log(res)
if (res.code == 0) { try {
res.data.forEach((item: any) => { // 使 Promise.all
fishhui.value.push(item.orgId) await Promise.all([
tableDatafish.value.push({ getFishTree(), //
name: item.orgName, getuserdata({ userId: userId.value }).then((res: any) => {
type: item.orgType, // '' console.log('用户权限数据:', res)
id: item.orgId.toString(), // 使codeid if (res.code == 0) {
code: item.orgId, res.data.forEach((item: any) => {
path: item.path, fishhui.value.push(item.orgId)
userId: item.userId, tableDatafish.value.push({
parentId: item.parentId, name: item.orgName,
orgLevel: item.orgLevel, type: item.orgType,
permissionType: item.permissionType // id: item.orgId.toString(),
}) code: item.orgId,
path: item.path,
userId: item.userId,
parentId: item.parentId,
orgLevel: item.orgLevel,
permissionType: item.permissionType
})
})
}
}) })
])
} //
}) isFishDataLoaded.value = true
console.log('所有数据加载完成,准备回显')
} catch (error) {
console.error('加载数据失败:', error)
ElMessage.error('加载数据失败,请重试')
}
} }
// fishway, // fishway,
watch(fishway, (newVal) => { watch([fishway, isFishDataLoaded], ([newFishway, newDataLoaded]) => {
if (newVal) { if (newFishway && newDataLoaded) {
// dialog,tree //
setTimeout(() => { console.log('开始回显, fishTreeRef:', fishTreeRef.value);
console.log('开始回显, fishTreeRef:', fishTreeRef.value); console.log('回显ID:', fishhui.value);
console.log('回显ID:', fishhui.value); console.log('树数据:', fishData.value);
// 使 nextTick DOM
nextTick(() => {
if (fishTreeRef.value && fishhui.value.length > 0) { if (fishTreeRef.value && fishhui.value.length > 0) {
// //
fishTreeRef.value.setCheckedKeys([], false); fishTreeRef.value.setCheckedKeys([], false);
// , //
setTimeout(() => { setTimeout(() => {
fishTreeRef.value.setCheckedKeys(fishhui.value, false); fishTreeRef.value.setCheckedKeys(fishhui.value, false);
// //
const checkedKeys = fishTreeRef.value.getCheckedKeys(); const checkedKeys = fishTreeRef.value.getCheckedKeys();
const halfCheckedKeys = fishTreeRef.value.getHalfCheckedKeys(); const halfCheckedKeys = fishTreeRef.value.getHalfCheckedKeys();
console.log('回显完成 - 全选节点:', checkedKeys); console.log('回显完成 - 全选节点:', checkedKeys);
console.log('回显完成 - 半选节点:', halfCheckedKeys); console.log('回显完成 - 半选节点:', halfCheckedKeys);
//
fishTableData.value = tableDatafish.value
}, 100); }, 100);
} else if (fishTreeRef.value) { } else if (fishTreeRef.value) {
// fishhui.value // fishhui.value
@ -341,20 +364,12 @@ watch(fishway, (newVal) => {
fishTableData.value = []; fishTableData.value = [];
}, 100); }, 100);
} }
fishTableData.value = tableDatafish.value });
// if (fishhui.value.length > 0 && activeName.value == '1') { } else if (!newFishway) {
// isCompanyDisabled.value = true
// } else if (fishhui.value.length > 0 && activeName.value == '2') {
// isBaseDisabled.value = true
// } else {
// isCompanyDisabled.value = false
// isBaseDisabled.value = false
// }
}, 500);
} else {
// //
console.log('关闭对话框,清理数据'); console.log('关闭对话框,清理数据');
fishhui.value = []; fishhui.value = [];
isFishDataLoaded.value = false;
// tree // tree
setTimeout(() => { setTimeout(() => {
if (fishTreeRef.value) { if (fishTreeRef.value) {
@ -367,6 +382,7 @@ watch(fishway, (newVal) => {
function fishHandleClose() { function fishHandleClose() {
fishway.value = false fishway.value = false
isFishDataLoaded.value = false
fishTableData.value = [] fishTableData.value = []
fishData.value = [] fishData.value = []
} }
@ -406,19 +422,21 @@ const fishData: any = ref([])
// //
// const huixiandata = ref([]) // const huixiandata = ref([])
let tableDatafish: any = [] let tableDatafish: any = []
// Promise便
function getFishTree() { function getFishTree() {
fishTreeDialog.value = true fishTreeDialog.value = true
const params = { const params = {
// type:'1', // type:'1',
engName: treeInput.value engName: treeInput.value
} }
getFishtree(params).then((res: any) => { return getFishtree(params).then((res: any) => {
if (res.code == 0) { if (res.code == 0) {
fishData.value = res.data fishData.value = res.data
fishTreeDialog.value = false
} }
}).catch(() => {
fishTreeDialog.value = false
}) })
fishTreeDialog.value = false
} }
// - ID // - ID
@ -1000,7 +1018,7 @@ function handleClearSelection() {
<!-- 过鱼设施权限维护 --> <!-- 过鱼设施权限维护 -->
<el-dialog v-model="fishway" :close-on-click-modal="false" :before-close="fishHandleClose" title="过鱼设施权限维护" <el-dialog v-model="fishway" :close-on-click-modal="false" :before-close="fishHandleClose" title="过鱼设施权限维护"
append-to-body width="1600px" draggable> append-to-body width="1600px" draggable>
<el-scrollbar height="610px"> <!-- <el-scrollbar height="610px"> -->
<!-- <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick"> <!-- <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
<el-tab-pane label="基地" name="1" :disabled="isBaseDisabled"></el-tab-pane> <el-tab-pane label="基地" name="1" :disabled="isBaseDisabled"></el-tab-pane>
<el-tab-pane label="公司" name="2" :disabled="isCompanyDisabled"></el-tab-pane> <el-tab-pane label="公司" name="2" :disabled="isCompanyDisabled"></el-tab-pane>
@ -1021,9 +1039,9 @@ function handleClearSelection() {
</div> </div>
</div> </div>
<el-scrollbar height="460px"> <el-scrollbar height="450px" style="margin-top: 10px;">
<el-tree ref="fishTreeRef" style="max-width: 300px" :data="fishData" show-checkbox default-expand-all <el-tree ref="fishTreeRef" style="max-width: 300px" :data="fishData" show-checkbox default-expand-all
:v-loading="fishTreeDialog" node-key="code" highlight-current :props="fishProps" v-loading="fishTreeDialog" node-key="code" highlight-current :props="fishProps"
@check="handleFishCheckChange" /> @check="handleFishCheckChange" />
</el-scrollbar> </el-scrollbar>
</div> </div>
@ -1053,7 +1071,7 @@ function handleClearSelection() {
</el-table> </el-table>
</div> </div>
</div> </div>
</el-scrollbar> <!-- </el-scrollbar> -->
<span class="dialog-footer" <span class="dialog-footer"
style="display: flex;display: -webkit-flex; justify-content: flex-end;-webkit-justify-content: flex-end;margin-top: 20px;"> style="display: flex;display: -webkit-flex; justify-content: flex-end;-webkit-justify-content: flex-end;margin-top: 20px;">
<el-button @click="fishHandleClose"> </el-button> <el-button @click="fishHandleClose"> </el-button>