diff --git a/src/app.ts b/src/app.ts index bfea198..58a7a58 100644 --- a/src/app.ts +++ b/src/app.ts @@ -87,7 +87,7 @@ export const request: RequestConfig = { }; -export async function getInitialState() { +export async function getInitialState(): Promise<{ isLogin: boolean, fetchUserInfo: () => any, currentUser?: any }> { async function fetchUserInfo() { const res = await queryCurrent(); handleRequest(res) @@ -98,17 +98,19 @@ export async function getInitialState() { } // 如果是登录页面,不执行 - if (history.location.pathname !== '/login') { + if (history.location.pathname !== '/login' && history.location.pathname !== '/~docs') { const currentUser = await fetchUserInfo(); if(!currentUser) { logout(); } return { fetchUserInfo, + isLogin: !!currentUser, currentUser, }; } return { + isLogin: false, fetchUserInfo, }; } \ No newline at end of file diff --git a/src/pages/index.less b/src/pages/index.less deleted file mode 100644 index 586302b..0000000 --- a/src/pages/index.less +++ /dev/null @@ -1,3 +0,0 @@ -.title { - background: rgb(121, 242, 157); -} diff --git a/src/pages/index.tsx b/src/pages/index.tsx index ebdd169..21ebdba 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,9 +1,8 @@ import styles from './index.less'; +import { Redirect } from 'react-router'; export default function IndexPage() { return ( -
-

Page index

-
+ ); } diff --git a/src/pages/sync/assets/sync.error.png b/src/pages/sync/assets/sync.error.png new file mode 100644 index 0000000..545254e Binary files /dev/null and b/src/pages/sync/assets/sync.error.png differ diff --git a/src/pages/sync/assets/sync.success.png b/src/pages/sync/assets/sync.success.png new file mode 100644 index 0000000..fb21d40 Binary files /dev/null and b/src/pages/sync/assets/sync.success.png differ diff --git a/src/pages/sync/assets/syncing.png b/src/pages/sync/assets/syncing.png new file mode 100644 index 0000000..4dd15c8 Binary files /dev/null and b/src/pages/sync/assets/syncing.png differ diff --git a/src/pages/sync/index.tsx b/src/pages/sync/index.tsx index 2afb7d5..13b31ac 100644 --- a/src/pages/sync/index.tsx +++ b/src/pages/sync/index.tsx @@ -1,9 +1,43 @@ -import React from 'react' +import React from 'react'; +import { useState } from 'react'; +import styles from './sync.less'; +import syncingImg from './assets/syncing.png'; +import syncSuccessImg from './assets/sync.success.png'; +import syncErrorImg from './assets/sync.error.png'; +import classNames from 'classnames'; + +enum SyncType { + Syncing, + SyncSuccess, + SyncError, +} + +const syncTypeList = [ + { type: SyncType.Syncing, label: '同步中', icon: syncingImg }, + { type: SyncType.SyncSuccess, label: '同步成功', icon: syncSuccessImg }, + { type: SyncType.SyncError, label: '同步异常', icon: syncErrorImg }, +]; export default function SyncView() { + const [type, setType] = useState(SyncType.Syncing); return ( -
- 同步任务界面 +
+
+

同步任务

+ { + syncTypeList.map(({ type: iType, label, icon }) => ( +
setType(iType)}> + + {label} + 99+ +
+ )) + } +
+
+ 同步任务界面 +
+
) } \ No newline at end of file diff --git a/src/pages/sync/sync.less b/src/pages/sync/sync.less new file mode 100644 index 0000000..1f45335 --- /dev/null +++ b/src/pages/sync/sync.less @@ -0,0 +1,42 @@ +.sync { + display: flex; + flex-direction: row; + height: 100%; + .left { + flex: none; + width: 120px; + background-color: #fff; + h4 { + display: flex; + font-size: 12px; + color: rgba(0, 0, 0, 0.6); + padding-left: 12px; + line-height: 32px; + margin-bottom: 0; + span { display: block; transform: scale(0.83); } + } + .tab { + position: relative; + display: flex; + flex-direction: row; + align-items: center; + height: 40px; + padding: 0 4px 0 12px; + cursor: pointer; + opacity: 0.4; + border-right: 2px solid transparent; + &.active { + opacity: 1; + border-right-color: @primary-color; + background: rgba(120, 80, 255, 0.04); + } + .icon { flex: none; } + .label { flex: 0 0 48px; margin: 0 8px; font-size: 12px; color: rgba(#000, 0.85); } + .count { flex: 1; font-size: 12px; color: #8E909F; transform: scale(0.83); } + } + } + .right { + flex: 1; + overflow: auto; + } +} \ No newline at end of file