This commit is contained in:
lyp 2025-04-23 18:00:45 +08:00
parent 525d37c887
commit 9f62cc836e
4 changed files with 87 additions and 8 deletions

View File

@ -12,7 +12,8 @@ import {
// Spin, // Spin,
// Upload, // Upload,
UploadFile, UploadFile,
// UploadProps // UploadProps,
Modal
} from "antd"; } from "antd";
import { import {
// DevUserId, // DevUserId,
@ -20,6 +21,8 @@ import {
// uploadImageUrl // uploadImageUrl
} from "../../util/AjaxUtils.ts"; } from "../../util/AjaxUtils.ts";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { unbind } from '../../request/api.ts'
import { reMenuActive } from '../../util/cache';
// import locale from "antd/es/date-picker/locale/zh_CN"; // import locale from "antd/es/date-picker/locale/zh_CN";
// import dayjs, { Dayjs } from "dayjs"; // import dayjs, { Dayjs } from "dayjs";
@ -52,10 +55,11 @@ type FormDataType = {
export interface IUserEditProps { export interface IUserEditProps {
handleConfirm(data: FormDataType): void; handleConfirm(data: FormDataType): void;
isUnbindPhone: boolean;
} }
export default function UserEdit(props: IUserEditProps) { export default function UserEdit(props: IUserEditProps) {
const [tipShow, setTipShow] = useState(false); //解除绑定提示
const [messageApi, contextHolder] = message.useMessage(); const [messageApi, contextHolder] = message.useMessage();
const [form] = Form.useForm<FormDataType>(); const [form] = Form.useForm<FormDataType>();
const [userInfoType, setUserInfoType] = useState('PERSONAL'); const [userInfoType, setUserInfoType] = useState('PERSONAL');
@ -73,7 +77,7 @@ export default function UserEdit(props: IUserEditProps) {
// }; // };
useEffect(() => { useEffect(() => {
get<any>({ get<any>({
messageApi, messageApi,
url: 'api/user-info/get-self', url: 'api/user-info/get-self',
@ -316,7 +320,15 @@ export default function UserEdit(props: IUserEditProps) {
) : <></> ) : <></>
} }
<a style={{
// 下划线
textDecoration: 'underline',
display:props.isUnbindPhone? 'block' : 'none'
}}
onClick={() => {
setTipShow(true);
}}
></a>
{/* <Row gutter={15}> {/* <Row gutter={15}>
<Col span={12}> <Col span={12}>
@ -505,6 +517,44 @@ export default function UserEdit(props: IUserEditProps) {
</Flex> </Flex>
</Form.Item> </Form.Item>
</Form > </Form >
<Modal
title="解除绑定"
destroyOnClose={true}
open={tipShow}
// footer={null}
maskClosable={false} // 禁止通过点击蒙层关闭
onCancel={() => {
setTipShow(false)
}}
okText="解除"
cancelText="取消"
okButtonProps={{ style: { background: 'red', color: 'white' } }}
width={600}
centered
onOk={async () => {
// alert('解除')
try {
await unbind()
reMenuActive()
// 清除缓存
sessionStorage.clear()
window.location.href = '/copyright/logout'
} catch (error: any) {
// setLoading(false)
if (error.response) {
const data = error.response.data;
messageApi.open({
type: 'error',
content: data.msg ? data.msg : `${data.path}(${data.status})`,
});
}
}
}}
>
<div>
?使,
</div>
</Modal>
{/* <Spin tip="正在提交..." spinning={loading} fullscreen /> */} {/* <Spin tip="正在提交..." spinning={loading} fullscreen /> */}
{contextHolder} {contextHolder}
</> </>

View File

@ -8,7 +8,7 @@ import {
import { import {
// operatorBaseUrl, // operatorBaseUrl,
copyBaseUrl copyBaseUrl
} from '../../util/AjaxUtils.ts' } from '../../util/AjaxUtils.ts'
import { import {
getCode, getCode,
// checkPhone, // checkPhone,
@ -162,6 +162,8 @@ export default function Head() {
// lyp // lyp
const [form] = Form.useForm<any>(); const [form] = Form.useForm<any>();
const [isUpdateWxUsernamePhone, setIsUpdateWxUsernamePhone] = useState(false); // 绑定手机号号弹窗 const [isUpdateWxUsernamePhone, setIsUpdateWxUsernamePhone] = useState(false); // 绑定手机号号弹窗
// 解除绑定是否显示
const [isUnbindPhone, setIsUnbindPhone] = useState(false); // 解除绑定
// const [userId, setUserId] = useState(''); // 验证码ID // const [userId, setUserId] = useState(''); // 验证码ID
// const submit = async (phone: string, code: string) => { // const submit = async (phone: string, code: string) => {
// try { // try {
@ -1017,6 +1019,9 @@ export default function Head() {
val: true val: true
}) })
} }
if (data.isUpdateWxUsernamePhone != -1) {
setIsUnbindPhone(true);
}
//嘻嘻嘻 //嘻嘻嘻
// if(!data.hasUserInfo && data.isUpdateWxUsernamePhone != 1) { // if(!data.hasUserInfo && data.isUpdateWxUsernamePhone != 1) {
// setIsSelfModalOpen(true); // setIsSelfModalOpen(true);
@ -1034,6 +1039,9 @@ export default function Head() {
// if (!data.hasUserInfo) { // if (!data.hasUserInfo) {
// setIsSelfModalOpen(true); // setIsSelfModalOpen(true);
// } // }
// if (data.isUpdateWxUsernamePhone != -1) {
// setIsUnbindPhone(true);
// }
// // if (!data.hasUserInfo && !phoneModal) { // // if (!data.hasUserInfo && !phoneModal) {
// // setIsSelfModalOpen(true); // // setIsSelfModalOpen(true);
// // } // // }
@ -1121,6 +1129,22 @@ export default function Head() {
setIsSelfModalOpen(true); setIsSelfModalOpen(true);
} }
}, },
// ...(isUnbindPhone ? [
// {
// key: 'UnbindPhone',
// label: (
// <div className="dropdown-item">
// <UserOutlined />
// <span className="title">解除绑定</span>
// </div>
// ),
// onClick: () => {
// // setIsSelfModalOpen(true);
// }
// }
// ] : []),
{ {
key: 'changePass', key: 'changePass',
label: ( label: (
@ -1513,7 +1537,10 @@ export default function Head() {
}) })
} }
}); });
}} /> }}
isUnbindPhone={isUnbindPhone}
/>
</Modal> </Modal>
<Modal open={isPasswordModalOpen} <Modal open={isPasswordModalOpen}
centered centered

View File

@ -113,5 +113,7 @@ export const updatePhone = (params:any) => newRequest.post(`/operator/oauth/wx/u
// 更新绑定手机号 // 更新绑定手机号
export const updateBindPhone = (params:any) => phoneRequest.post(`/operator/api/user-wx-update-username/update-phone`, params) export const updateBindPhone = (params:any) => phoneRequest.post(`/operator/api/user-wx-update-username/update-phone`, params)
// 解绑
export const unbind = () => phoneRequest.get(`/operator/api/user-wx-update-username/unlock-phone`)
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -22,8 +22,8 @@ export const WebSocketBaseUrl: string = `ws://${host}:7025/copyright`;
axios.defaults.baseURL = `${copyBaseUrl}/copyright`; axios.defaults.baseURL = `${copyBaseUrl}/copyright`;
export const DevUserId: string = '80d3365e-0597-4988-979e-18ef1c3ec671'; // 18634604067 // export const DevUserId: string = '80d3365e-0597-4988-979e-18ef1c3ec671'; // 18634604067
// export const DevUserId: string = '2339d51f-f6cf-4f93-92dd-56c372dfbe36'; export const DevUserId: string = 'e3e40f95-7a3f-4b53-a1a0-51dd4e881d74';
// export const DevUserId: string = '6fb8e783-243c-4eec-8d98-c9b1c8aeaa00'; // 15042810561 密码123456 // export const DevUserId: string = '6fb8e783-243c-4eec-8d98-c9b1c8aeaa00'; // 15042810561 密码123456
// export const DevUserId: string = 'c2438eb8-2685-49a9-bf02-5111a5192d96'; // 18647109157 // export const DevUserId: string = 'c2438eb8-2685-49a9-bf02-5111a5192d96'; // 18647109157
// export const DevUserId: string = ''; // export const DevUserId: string = '';