From 84444c72c8e3b0cd6d4eeb456d153cd0acbe50fa Mon Sep 17 00:00:00 2001 From: sunface Date: Thu, 16 Jan 2020 12:01:37 +0800 Subject: [PATCH] change some files from js to typescript --- ui/src/components/ConfigProvider/index.tsx | 2 +- ui/src/components/Languages/index.tsx | 1 - ui/src/layouts/Breadcrumb/index.tsx | 3 +-- ui/src/pages/App/index.tsx | 9 ++++----- ui/src/pages/Index/Dashboard/{index.jsx => index.tsx} | 0 ui/src/pages/Index/Demo/{A.jsx => A.tsx} | 0 ui/src/pages/Index/Demo/{B.jsx => B.tsx} | 0 .../pages/Index/Elements/{Accordion.js => Accordion.tsx} | 0 .../Index/Elements/{DatePickers.js => DatePickers.tsx} | 0 ui/src/pages/Index/Elements/{Icons.js => Icons.tsx} | 0 .../Index/Elements/{Paginations.js => Paginations.tsx} | 2 +- ui/src/pages/Index/index.tsx | 1 - ui/tsconfig.json | 1 - 13 files changed, 7 insertions(+), 12 deletions(-) rename ui/src/pages/Index/Dashboard/{index.jsx => index.tsx} (100%) rename ui/src/pages/Index/Demo/{A.jsx => A.tsx} (100%) rename ui/src/pages/Index/Demo/{B.jsx => B.tsx} (100%) rename ui/src/pages/Index/Elements/{Accordion.js => Accordion.tsx} (100%) rename ui/src/pages/Index/Elements/{DatePickers.js => DatePickers.tsx} (100%) rename ui/src/pages/Index/Elements/{Icons.js => Icons.tsx} (100%) rename ui/src/pages/Index/Elements/{Paginations.js => Paginations.tsx} (95%) diff --git a/ui/src/components/ConfigProvider/index.tsx b/ui/src/components/ConfigProvider/index.tsx index 36fbeccd..b410ddcb 100644 --- a/ui/src/components/ConfigProvider/index.tsx +++ b/ui/src/components/ConfigProvider/index.tsx @@ -8,7 +8,7 @@ const Config = inject('system')(observer((props:any) =>{ let {system} = props return ( <> - + {props.children} diff --git a/ui/src/components/Languages/index.tsx b/ui/src/components/Languages/index.tsx index 84e7abe8..5e073261 100644 --- a/ui/src/components/Languages/index.tsx +++ b/ui/src/components/Languages/index.tsx @@ -2,7 +2,6 @@ import React from 'react' import { Icon } from 'antd' import { inject, observer } from 'mobx-react' import style from './index.module.less' -import System from '../../store/system' const Languages = inject('system')(observer((props) =>{ let {system} = props diff --git a/ui/src/layouts/Breadcrumb/index.tsx b/ui/src/layouts/Breadcrumb/index.tsx index 73902108..8e91558e 100644 --- a/ui/src/layouts/Breadcrumb/index.tsx +++ b/ui/src/layouts/Breadcrumb/index.tsx @@ -5,8 +5,7 @@ import style from './index.module.less' import { inject, observer } from 'mobx-react' import { FormattedMessage as Message } from 'react-intl' -const BreadcrumbWrapper = inject('system')(observer((props) =>{ - let {system} = props +const BreadcrumbWrapper = inject('system')(observer((props) =>{ let location = useLocation() let pathname = location.pathname.split('/') return ( diff --git a/ui/src/pages/App/index.tsx b/ui/src/pages/App/index.tsx index 8dddefa9..80c9b747 100644 --- a/ui/src/pages/App/index.tsx +++ b/ui/src/pages/App/index.tsx @@ -1,6 +1,5 @@ import React, { useEffect } from 'react' import {Route, Switch, Redirect} from 'react-router-dom' -import { modifyVars } from '../../library/utils/modifyVars' import { inject, observer } from 'mobx-react' import '@/styles/main.less' import Home from '../../pages/Index' @@ -10,12 +9,12 @@ import Intl from '../../components/Intl' let App = inject('system')(observer((props:any) => { - let {system} = props //npm install --save rc-form-hooks - // https://www.jianshu.com/p/fc59cb61f7cc + // useEffect(() => { - console.log("modify vars") - modifyVars(system.dark, system.primary) + // console.log("modify vars") + // alert(1) + // modifyVars(system.dark, system.primary) return () => {} }) return ( diff --git a/ui/src/pages/Index/Dashboard/index.jsx b/ui/src/pages/Index/Dashboard/index.tsx similarity index 100% rename from ui/src/pages/Index/Dashboard/index.jsx rename to ui/src/pages/Index/Dashboard/index.tsx diff --git a/ui/src/pages/Index/Demo/A.jsx b/ui/src/pages/Index/Demo/A.tsx similarity index 100% rename from ui/src/pages/Index/Demo/A.jsx rename to ui/src/pages/Index/Demo/A.tsx diff --git a/ui/src/pages/Index/Demo/B.jsx b/ui/src/pages/Index/Demo/B.tsx similarity index 100% rename from ui/src/pages/Index/Demo/B.jsx rename to ui/src/pages/Index/Demo/B.tsx diff --git a/ui/src/pages/Index/Elements/Accordion.js b/ui/src/pages/Index/Elements/Accordion.tsx similarity index 100% rename from ui/src/pages/Index/Elements/Accordion.js rename to ui/src/pages/Index/Elements/Accordion.tsx diff --git a/ui/src/pages/Index/Elements/DatePickers.js b/ui/src/pages/Index/Elements/DatePickers.tsx similarity index 100% rename from ui/src/pages/Index/Elements/DatePickers.js rename to ui/src/pages/Index/Elements/DatePickers.tsx diff --git a/ui/src/pages/Index/Elements/Icons.js b/ui/src/pages/Index/Elements/Icons.tsx similarity index 100% rename from ui/src/pages/Index/Elements/Icons.js rename to ui/src/pages/Index/Elements/Icons.tsx diff --git a/ui/src/pages/Index/Elements/Paginations.js b/ui/src/pages/Index/Elements/Paginations.tsx similarity index 95% rename from ui/src/pages/Index/Elements/Paginations.js rename to ui/src/pages/Index/Elements/Paginations.tsx index 565402e4..cb4b8f1f 100644 --- a/ui/src/pages/Index/Elements/Paginations.js +++ b/ui/src/pages/Index/Elements/Paginations.tsx @@ -7,7 +7,7 @@ function Paginations() { setLoading(false) return () => {} }, []) - function onShowSizeChange(current, pageSize) { + function onShowSizeChange(current:number, pageSize:number) { console.log(current, pageSize) } return ( diff --git a/ui/src/pages/Index/index.tsx b/ui/src/pages/Index/index.tsx index e61b2d59..2ffa9dca 100644 --- a/ui/src/pages/Index/index.tsx +++ b/ui/src/pages/Index/index.tsx @@ -21,7 +21,6 @@ let Index = inject('system')(observer((props:any) => { // }) let history = useHistory() useEffect(() => { - alert(11) if(isEmpty(getToken())){ history.push('/login') } diff --git a/ui/tsconfig.json b/ui/tsconfig.json index dabf7791..90669ca9 100644 --- a/ui/tsconfig.json +++ b/ui/tsconfig.json @@ -18,7 +18,6 @@ "isolatedModules": true, "noEmit": true, "jsx": "react", - "experimentalDecorators": true }, "include": [