import './head.css' import BalanceHead from '../../components/balance/BalanceHead.tsx'; import RechargeHead from '../../components/recharge/RechargeHead.tsx'; import { Dropdown, MenuProps, message, Modal, Space, Spin } from "antd"; import { DownOutlined, UserOutlined, KeyOutlined, LogoutOutlined, AccountBookOutlined, MenuFoldOutlined, UsergroupAddOutlined } from "@ant-design/icons"; import { useContext, useEffect, useState } from "react"; import { put } from "../../util/AjaxUtils.ts"; import { GlobalContext, GlobalDispatchContext, reloadUser } from "../../context/GlobalContext.ts"; import UserEdit from "../../components/user/UserEdit.tsx"; import PasswordChange from "../../components/password/PasswordChange.tsx"; // import headRightBg from '../../assets/head-right-bg.png'; import InvoiceList from "../../components/invoice/InvoiceList.tsx"; import logoImg from '../../static/head/logo.png' import userImg from '../../static/homeimg/userimg.png' import { reMenuActive } from '../../util/cache'; // import BelongPeople from '../../components/BelongPeople/BelongPeople.tsx' import BelongPeople from '../../components/BelongPeople/BelongPeople.tsx' import ContactPeople from '../../components/ContactPeople/ContactPeople.tsx' export default function Head() { const globalContext = useContext(GlobalContext); const globalDispatchContext = useContext(GlobalDispatchContext); const [messageApi, contextHolder] = message.useMessage(); const [modal, modalHolder] = Modal.useModal(); const [loading, setLoading] = useState(false); const [isSelfModalOpen, setIsSelfModalOpen] = useState(false); const [isPasswordModalOpen, setIsPasswordModalOpen] = useState(false); const [isInvoiceModalOpen, setIsInvoiceModalOpen] = useState(false); // 所属者弹窗 const [belongModal, setBelongModal] = useState(false) const [belongPeopleInfo, setBelongPeopleInfo] = useState({ authorName: '', authorType: '', authorIdCardType: '', authorIdCard: '', authorCrcAccount: '', authorId: '', authorProvinceCity: '' }) const setValue = () => { // console.log(value); } const setConcatValue = ()=> { } // 联系人弹窗 const [contactModal, setContactModal] = useState(false) const [concatPeopleInfo,setConcatPeopleInfo] = useState({ applyConcatId:'', applyContactCsaNo:'', applyContactEmail:'', applyContactName:'', applyContactPhone:'', applyContactCompany:'' }) useEffect(() => { reloadUser(messageApi, globalDispatchContext).then((data) => { if (!data.hasUserInfo) { setIsSelfModalOpen(true); } }); }, [globalContext.user]); const items: MenuProps['items'] = [ { key: 'userinfo', label: (
个人信息
), onClick: () => { setIsSelfModalOpen(true); } }, { key: 'changePass', label: (
修改密码
), onClick: () => { setIsPasswordModalOpen(true); } }, { key: 'invoice', label: (
发票管理
), onClick: () => { setIsInvoiceModalOpen(true); } }, { key: 'belong', label: (
产权所属者
), onClick: () => { setBelongModal(true) } }, { key: 'contact', label: (
产权联系人
), onClick: () => { setContactModal(true) } }, { key: 'logout', label: (
退出系统
), onClick: () => { reMenuActive() window.location.href = '/copyright/logout' } }, ] return ( <>
{/* AI引擎软著 软件著作权一站式服务平台 */}
{/*
*/}
{ window.open('https://www.aimzhu.com/operator/route/agreementportal/view?agreementId=c0c5683a-bef3-40c3-8395-900a362ea234&title=系统操作流程') }}> 系统操作流程
{/**/}
{/* 您好:{globalContext.user.nickname} */} 个人中心
{ if (!globalContext.user.hasUserInfo) { messageApi.info('请完善个人信息'); return; } setIsSelfModalOpen(false) }}> { modal.confirm({ title: '提示', content: '确定保存吗?', okText: '确认', cancelText: '取消', okButtonProps: { style: { backgroundColor: 'var(--color-primary)' } }, onOk: () => { setIsSelfModalOpen(false); put({ messageApi, url: '/api/user-info/update-self', body: data, onBefore() { setLoading(true); }, onSuccess() { messageApi.success('修改成功'); }, onFinally() { setLoading(false); } }) } }); }} /> { setIsPasswordModalOpen(false) }}> { modal.confirm({ title: '提示', content: '确定修改吗?', okText: '确认', cancelText: '取消', okButtonProps: { style: { backgroundColor: 'var(--color-primary)' } }, onOk: () => { put({ messageApi, url: '/api/user/update-password', body: data, onBefore() { setLoading(true); }, onSuccess() { setIsPasswordModalOpen(false); messageApi.success('修改成功,重新登录生效'); }, onFinally() { setLoading(false); } }) } }); }} /> setIsInvoiceModalOpen(false)} > { setBelongModal(false) }}> { setBelongModal(false) }} setBelongPeopleInfo={setBelongPeopleInfo} belongPeopleInfo={belongPeopleInfo} setValue={setValue} isShow={false} > { setContactModal(false) }}> {setContactModal(false)} } setConcatPeopleInfo={setConcatPeopleInfo} concatPeopleInfo={concatPeopleInfo} setConcatValue={setConcatValue}> {contextHolder} {modalHolder} ) }