@@ -11,8 +11,16 @@ import {
1111 Space ,
1212 Typography ,
1313} from "@arco-design/web-react" ;
14- import { RefInputType } from "@arco-design/web-react/es/Input/interface" ;
15- import { IconDesktop , IconDown , IconLink , IconMoonFill , IconSunFill } from "@arco-design/web-react/icon" ;
14+ import { RefTextAreaType } from "@arco-design/web-react/es/Input" ;
15+ import {
16+ IconCheckCircle ,
17+ IconCloseCircle ,
18+ IconDesktop ,
19+ IconDown ,
20+ IconLink ,
21+ IconMoonFill ,
22+ IconSunFill ,
23+ } from "@arco-design/web-react/icon" ;
1624import React , { ReactNode , useRef , useState } from "react" ;
1725import { useTranslation } from "react-i18next" ;
1826import "./index.css" ;
@@ -28,7 +36,7 @@ const MainLayout: React.FC<{
2836} > = ( { children, className, pageName } ) => {
2937 const lightMode = useAppSelector ( selectThemeMode ) ;
3038 const dispatch = useAppDispatch ( ) ;
31- const importRef = useRef < RefInputType > ( null ) ;
39+ const importRef = useRef < RefTextAreaType > ( null ) ;
3240 const [ importVisible , setImportVisible ] = useState ( false ) ;
3341 const { t } = useTranslation ( ) ;
3442
@@ -50,8 +58,32 @@ const MainLayout: React.FC<{
5058 title = { t ( "import_link" ) }
5159 visible = { importVisible }
5260 onOk = { async ( ) => {
61+ const urls = importRef . current ! . dom . value . split ( "\n" ) . filter ( ( v ) => v ) ;
5362 try {
54- await scriptClient . importByUrl ( importRef . current ! . dom . value ) ;
63+ const stat = await scriptClient . importByUrls ( urls ) ;
64+ stat &&
65+ Modal . info ( {
66+ title : "链接导入结果" ,
67+ content : (
68+ < Space direction = "vertical" style = { { width : "100%" } } >
69+ < div style = { { textAlign : "center" } } >
70+ < Space size = "small" style = { { fontSize : 18 } } >
71+ < IconCheckCircle style = { { color : "green" } } />
72+ { stat . success }
73+ { "" }
74+ < IconCloseCircle style = { { color : "red" } } />
75+ { stat . fail }
76+ </ Space >
77+ </ div >
78+ { stat . msg . length > 0 && (
79+ < >
80+ < b > 失败信息:</ b >
81+ { stat . msg }
82+ </ >
83+ ) }
84+ </ Space >
85+ ) ,
86+ } ) ;
5587 setImportVisible ( false ) ;
5688 } catch ( e ) {
5789 Message . error ( `${ t ( "import_link_failure" ) } : ${ e } ` ) ;
@@ -61,7 +93,12 @@ const MainLayout: React.FC<{
6193 setImportVisible ( false ) ;
6294 } }
6395 >
64- < Input ref = { importRef } defaultValue = "" />
96+ < Input . TextArea
97+ ref = { importRef }
98+ rows = { 8 }
99+ placeholder = { `支持输入.user.js结尾的脚本绝对链接 或 脚本猫安装页链接\n可多行填写,每行一条\n示例:\nhttps://example.com/test.user.js \nhttps://scriptcat.org/zh-CN/script-show-page/1234` }
100+ defaultValue = ""
101+ />
65102 </ Modal >
66103 < div className = "flex row items-center" >
67104 < img style = { { height : "40px" } } src = "/assets/logo.png" alt = "ScriptCat" />
0 commit comments