|
@@ -14,6 +14,7 @@ const Welcome: React.FC = () => {
|
|
|
const [activeCategory, setActiveCategory] = useState('all');
|
|
|
const [filteredSystems, setFilteredSystems] = useState<BusinessSystem[]>(SYSTEMS_DATA);
|
|
|
const [isLoading, setIsLoading] = useState(true);
|
|
|
+ const [windowList, setWindowList] = useState<{ [x: string]: Window }>({})
|
|
|
/***********************************************/
|
|
|
|
|
|
// 获取所有唯一的分类
|
|
@@ -49,11 +50,23 @@ const Welcome: React.FC = () => {
|
|
|
}, [searchQuery, activeCategory]);
|
|
|
|
|
|
// 处理系统访问
|
|
|
- const handleSystemAccess = (url: string) => {
|
|
|
+ const handleSystemAccess = (url: string, id: string) => {
|
|
|
// 在实际应用中,这里会跳转到对应的系统
|
|
|
// toast.info(`正在访问系统: ${url}`);
|
|
|
// 示例:打开新窗口
|
|
|
- window.open(url, '_blank');
|
|
|
+ if (windowList?.[id]) {
|
|
|
+ if (!windowList[id].closed) {
|
|
|
+ windowList[id].focus()
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ setWindowList(w => {
|
|
|
+ delete w.id;
|
|
|
+ return w
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const targetWindow = window.open(url, '_blank');
|
|
|
+ setWindowList(w => ({ ...w, [id]: targetWindow as Window }));
|
|
|
};
|
|
|
|
|
|
|
|
@@ -65,7 +78,7 @@ const Welcome: React.FC = () => {
|
|
|
<div className="flex items-center">
|
|
|
<div className="flex-shrink-0 flex items-center">
|
|
|
<div className="h-8 rounded-lg flex items-center justify-center text-white mr-2">
|
|
|
- <img src={logo} style={{height: '100%'}} alt="" />
|
|
|
+ <img src={logo} style={{ height: '100%' }} alt="" />
|
|
|
</div>
|
|
|
{/* <span className="font-semibold text-gray-900 dark:text-white" style={{ fontSize: 18 }}>趣程集团数智中台</span> */}
|
|
|
</div>
|
|
@@ -180,7 +193,7 @@ const Welcome: React.FC = () => {
|
|
|
<SystemCard
|
|
|
key={system.id}
|
|
|
system={system}
|
|
|
- onClick={handleSystemAccess}
|
|
|
+ onClick={(url: string) => handleSystemAccess(url, system.id)}
|
|
|
/>
|
|
|
))}
|
|
|
</div>
|