diff --git a/code/web/.babelrc b/code/web/.babelrc new file mode 100644 index 0000000..6c96eb8 --- /dev/null +++ b/code/web/.babelrc @@ -0,0 +1,17 @@ +{ + "presets": [ + "@babel/preset-react", + "@babel/preset-env" + ], + "plugins": [ + "@babel/plugin-proposal-class-properties", + "@babel/plugin-proposal-object-rest-spread", + // ["import", { + // // "libraryName": "antd", + // "libraryDirectory": "es" + // }] + ], + "env": { + "development": {} + } +} diff --git a/code/web/.vscode/launch.json b/code/web/.vscode/launch.json new file mode 100644 index 0000000..745316e --- /dev/null +++ b/code/web/.vscode/launch.json @@ -0,0 +1,18 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Server", + "type": "node", + "request": "launch", + "program": "${workspaceRoot}/server.js", + "args": [ + "-u http://127.0.0.1:4200" + ], + "outputCapture": "std", + "env": { + "NODE_ENV": "development" + } + } + ] +} \ No newline at end of file diff --git a/code/web/Dockerfile b/code/web/Dockerfile new file mode 100644 index 0000000..02c9375 --- /dev/null +++ b/code/web/Dockerfile @@ -0,0 +1,12 @@ + +FROM repository.anxinyun.cn/base-images/nodejs12:20.10.12.2 + +COPY . /var/app + +WORKDIR /var/app + +EXPOSE 8080 + +CMD ["-u", "http://localhost:8088"] + +ENTRYPOINT [ "node", "server.js" ] \ No newline at end of file diff --git a/code/web/client/assets/images/avatar/1.png b/code/web/client/assets/images/avatar/1.png new file mode 100644 index 0000000..52dbdb8 Binary files /dev/null and b/code/web/client/assets/images/avatar/1.png differ diff --git a/code/web/client/assets/images/avatar/10.png b/code/web/client/assets/images/avatar/10.png new file mode 100644 index 0000000..a543c2a Binary files /dev/null and b/code/web/client/assets/images/avatar/10.png differ diff --git a/code/web/client/assets/images/avatar/11.png b/code/web/client/assets/images/avatar/11.png new file mode 100644 index 0000000..f569e09 Binary files /dev/null and b/code/web/client/assets/images/avatar/11.png differ diff --git a/code/web/client/assets/images/avatar/12.png b/code/web/client/assets/images/avatar/12.png new file mode 100644 index 0000000..7265983 Binary files /dev/null and b/code/web/client/assets/images/avatar/12.png differ diff --git a/code/web/client/assets/images/avatar/2.png b/code/web/client/assets/images/avatar/2.png new file mode 100644 index 0000000..708e41d Binary files /dev/null and b/code/web/client/assets/images/avatar/2.png differ diff --git a/code/web/client/assets/images/avatar/3.png b/code/web/client/assets/images/avatar/3.png new file mode 100644 index 0000000..933b3f1 Binary files /dev/null and b/code/web/client/assets/images/avatar/3.png differ diff --git a/code/web/client/assets/images/avatar/4.png b/code/web/client/assets/images/avatar/4.png new file mode 100644 index 0000000..793baca Binary files /dev/null and b/code/web/client/assets/images/avatar/4.png differ diff --git a/code/web/client/assets/images/avatar/5.png b/code/web/client/assets/images/avatar/5.png new file mode 100644 index 0000000..c66ec46 Binary files /dev/null and b/code/web/client/assets/images/avatar/5.png differ diff --git a/code/web/client/assets/images/avatar/6.png b/code/web/client/assets/images/avatar/6.png new file mode 100644 index 0000000..157f56a Binary files /dev/null and b/code/web/client/assets/images/avatar/6.png differ diff --git a/code/web/client/assets/images/avatar/7.png b/code/web/client/assets/images/avatar/7.png new file mode 100644 index 0000000..ddd4f3d Binary files /dev/null and b/code/web/client/assets/images/avatar/7.png differ diff --git a/code/web/client/assets/images/avatar/8.png b/code/web/client/assets/images/avatar/8.png new file mode 100644 index 0000000..3a01c87 Binary files /dev/null and b/code/web/client/assets/images/avatar/8.png differ diff --git a/code/web/client/assets/images/avatar/9.png b/code/web/client/assets/images/avatar/9.png new file mode 100644 index 0000000..0a952d4 Binary files /dev/null and b/code/web/client/assets/images/avatar/9.png differ diff --git a/code/web/client/assets/images/avatar/avatar.jpg b/code/web/client/assets/images/avatar/avatar.jpg new file mode 100644 index 0000000..dd6739f Binary files /dev/null and b/code/web/client/assets/images/avatar/avatar.jpg differ diff --git a/code/web/client/assets/images/background/building.jpg b/code/web/client/assets/images/background/building.jpg new file mode 100644 index 0000000..57a7282 Binary files /dev/null and b/code/web/client/assets/images/background/building.jpg differ diff --git a/code/web/client/assets/images/background/header.png b/code/web/client/assets/images/background/header.png new file mode 100644 index 0000000..59900ca Binary files /dev/null and b/code/web/client/assets/images/background/header.png differ diff --git a/code/web/client/assets/images/background/loginBackground.png b/code/web/client/assets/images/background/loginBackground.png new file mode 100644 index 0000000..39946d7 Binary files /dev/null and b/code/web/client/assets/images/background/loginBackground.png differ diff --git a/code/web/client/assets/images/background/loginbg.png b/code/web/client/assets/images/background/loginbg.png new file mode 100644 index 0000000..4713d09 Binary files /dev/null and b/code/web/client/assets/images/background/loginbg.png differ diff --git a/code/web/client/assets/images/background/logo.png b/code/web/client/assets/images/background/logo.png new file mode 100644 index 0000000..a81edce Binary files /dev/null and b/code/web/client/assets/images/background/logo.png differ diff --git a/code/web/client/assets/images/background/notice.png b/code/web/client/assets/images/background/notice.png new file mode 100644 index 0000000..e00a54f Binary files /dev/null and b/code/web/client/assets/images/background/notice.png differ diff --git a/code/web/client/assets/images/background/password.png b/code/web/client/assets/images/background/password.png new file mode 100644 index 0000000..9b3d8a8 Binary files /dev/null and b/code/web/client/assets/images/background/password.png differ diff --git a/code/web/client/assets/images/background/user_login.png b/code/web/client/assets/images/background/user_login.png new file mode 100644 index 0000000..151e68e Binary files /dev/null and b/code/web/client/assets/images/background/user_login.png differ diff --git a/code/web/client/assets/images/background/username.png b/code/web/client/assets/images/background/username.png new file mode 100644 index 0000000..d29c1c2 Binary files /dev/null and b/code/web/client/assets/images/background/username.png differ diff --git a/code/web/client/index.ejs b/code/web/client/index.ejs new file mode 100644 index 0000000..be3ad78 --- /dev/null +++ b/code/web/client/index.ejs @@ -0,0 +1,14 @@ + + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/code/web/client/index.html b/code/web/client/index.html new file mode 100644 index 0000000..053c990 --- /dev/null +++ b/code/web/client/index.html @@ -0,0 +1,45 @@ + + + + + + + + + + +
+ + + + + + + + + + + \ No newline at end of file diff --git a/code/web/client/index.js b/code/web/client/index.js new file mode 100644 index 0000000..734451c --- /dev/null +++ b/code/web/client/index.js @@ -0,0 +1,20 @@ +/** + * User: liuxinyi/liu.xinyi@free-sun.com.cn + * Date: 2016/2/22 + * Time: 15:29 + * + */ +'use strict'; + +const views = require('koa-view'); +const path = require('path'); + +module.exports = { + entry: function (app, router, opt) { + app.use(views(__dirname)); + + router.get('(.*)', async function (ctx) { + await ctx.render(path.join(__dirname, './index')); + }); + } +}; \ No newline at end of file diff --git a/code/web/client/src/app.jsx b/code/web/client/src/app.jsx new file mode 100644 index 0000000..5521b0c --- /dev/null +++ b/code/web/client/src/app.jsx @@ -0,0 +1,22 @@ +'use strict'; + +import React, { useEffect } from 'react'; +import Layout from './layout'; +import Auth from './sections/auth'; + +const App = props => { + const { projectName } = props + + useEffect(() => { + document.title = projectName; + }, []) + + return ( + + ) +} + +export default App; \ No newline at end of file diff --git a/code/web/client/src/components/coming.jsx b/code/web/client/src/components/coming.jsx new file mode 100644 index 0000000..e2f7d95 --- /dev/null +++ b/code/web/client/src/components/coming.jsx @@ -0,0 +1,22 @@ +import React from "react"; + +const Coming = () => { + return ( +
+ +
+ ) +} + +export default Coming \ No newline at end of file diff --git a/code/web/client/src/components/index.js b/code/web/client/src/components/index.js new file mode 100644 index 0000000..2d3a832 --- /dev/null +++ b/code/web/client/src/components/index.js @@ -0,0 +1,6 @@ +'use strict'; +import Coming from './coming' + +export { + Coming +}; diff --git a/code/web/client/src/index.jsx b/code/web/client/src/index.jsx new file mode 100644 index 0000000..9a2559a --- /dev/null +++ b/code/web/client/src/index.jsx @@ -0,0 +1,8 @@ +'use strict'; + +import React from 'react'; +import { render } from 'react-dom'; +import App from './app'; +import './index.less'; + +render((), document.getElementById('App')); \ No newline at end of file diff --git a/code/web/client/src/index.less b/code/web/client/src/index.less new file mode 100644 index 0000000..a4b488c --- /dev/null +++ b/code/web/client/src/index.less @@ -0,0 +1,38 @@ +// webpack (vite 用 alias 兼容了) +@import '~@douyinfe/semi-ui/dist/css/semi.min.css'; +@import '~perfect-scrollbar/css/perfect-scrollbar.css'; +@import '~nprogress/nprogress.css'; + + +*, +*::before, +*::after { + box-sizing: border-box; +} + +html, +body { + margin: 0; + height: 100%; + width: 100%; + + a:link { + text-decoration: none; + color: unset + } + + a:visited { + text-decoration: none; + color: unset + } + + a:hover { + text-decoration: none; + color: unset + } + + a:active { + text-decoration: none; + color: unset + } +} \ No newline at end of file diff --git a/code/web/client/src/layout/actions/global.js b/code/web/client/src/layout/actions/global.js new file mode 100644 index 0000000..0548a95 --- /dev/null +++ b/code/web/client/src/layout/actions/global.js @@ -0,0 +1,44 @@ +'use strict'; +import { RouteRequest } from '@peace/utils'; +import { RouteTable } from '$utils' + +export const INIT_LAYOUT = 'INIT_LAYOUT'; +export function initLayout (title, copyright, sections, actions) { + return { + type: INIT_LAYOUT, + payload: { + title, + copyright, + sections, + actions + } + }; +} + +export const RESIZE = 'RESIZE'; +export function resize (clientHeight, clientWidth) { + const headerHeight = 60 + const footerHeight = 0 + return { + type: RESIZE, + payload: { + clientHeight: clientHeight - headerHeight - footerHeight, + clientWidth: clientWidth + } + } +} + +export const INIT_API_ROOT = 'INIT_API_ROOT'; +export function initApiRoot () { + return dispatch => { + RouteRequest.get(RouteTable.apiRoot).then(res => { + localStorage.setItem('apiRoot', res.root); + dispatch({ + type: INIT_API_ROOT, + payload: { + apiRoot: res.root + } + }) + }); + } +} \ No newline at end of file diff --git a/code/web/client/src/layout/actions/index.js b/code/web/client/src/layout/actions/index.js new file mode 100644 index 0000000..4e98b4d --- /dev/null +++ b/code/web/client/src/layout/actions/index.js @@ -0,0 +1,9 @@ +'use strict'; + +import * as global from './global' +import * as socket from './webSocket'; + +export default { + ...global, + ...socket, +}; \ No newline at end of file diff --git a/code/web/client/src/layout/actions/webSocket.js b/code/web/client/src/layout/actions/webSocket.js new file mode 100644 index 0000000..fa1a321 --- /dev/null +++ b/code/web/client/src/layout/actions/webSocket.js @@ -0,0 +1,33 @@ +'use strict'; +import io from 'socket.io-client'; + +export const INIT_WEB_SOCKET = 'INIT_WEB_SOCKET' +export function initWebSocket ({ ioUrl, token }) { + if (!ioUrl) { + ioUrl = localStorage.getItem('apiRoot') + } + if (!token) { + const user = sessionStorage.getItem('user') + if (user) { + token = JSON.parse(user).token + } + } + if (!ioUrl || !token) { + return { + type: '', + } + } + return dispatch => { + const socket = io(ioUrl, { + query: { + token: token + }, + }); + dispatch({ + type: INIT_WEB_SOCKET, + payload: { + socket: socket + } + }) + } +} \ No newline at end of file diff --git a/code/web/client/src/layout/components/footer/index.jsx b/code/web/client/src/layout/components/footer/index.jsx new file mode 100644 index 0000000..307b319 --- /dev/null +++ b/code/web/client/src/layout/components/footer/index.jsx @@ -0,0 +1,15 @@ +'use strict'; +import React from 'react'; +import moment from 'moment' + +export default class Footer extends React.Component { + render () { + // const { } = this.props; + + return ( +
+ Copyright © {moment().year()} All Rights Reserved 版权所有· 江西飞尚科技有限公司 +
+ ); + } +}; \ No newline at end of file diff --git a/code/web/client/src/layout/components/header/index.jsx b/code/web/client/src/layout/components/header/index.jsx new file mode 100644 index 0000000..a630086 --- /dev/null +++ b/code/web/client/src/layout/components/header/index.jsx @@ -0,0 +1,85 @@ +"use strict"; +import React from "react"; +import { connect } from "react-redux"; +import { Nav, Avatar, Dropdown } from "@douyinfe/semi-ui"; + +const Header = (props) => { + const { dispatch, history, user, actions, socket } = props; + + return ( + <> +