diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e687ee9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,123 @@ +# ---> Node +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test +.env.production + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +*yarn.lock +*package-lock.json +*log/ 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..9e05d4b --- /dev/null +++ b/code/web/Dockerfile @@ -0,0 +1,24 @@ +FROM repository.anxinyun.cn/devops/node:12-dev as builder + +COPY . /var/app + +WORKDIR /var/app + +EXPOSE 8080 + +RUN npm config set registry=http://10.8.30.22:7000 +RUN echo "{\"time\":\"$BUILD_TIMESTAMP\",\"build\": \"$BUILD_NUMBER\",\"revision\": \"$SVN_REVISION_1\",\"URL\":\"$SVN_URL_1\"}" > version.json +RUN npm cache clean -f +RUN npm install --registry http://10.8.30.22:7000 +RUN npm run build +RUN rm -rf client/src +RUN rm -rf node_modules +RUN npm install --production --registry http://10.8.30.22:7000 + +FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node-16:7.22-06-20 + +COPY --from=builder --chown=node /var/app /home/node/app + +WORKDIR /home/node/app + +CMD ["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/assets/videos/cross_loading.mp4 b/code/web/client/assets/videos/cross_loading.mp4 new file mode 100644 index 0000000..aa6b925 Binary files /dev/null and b/code/web/client/assets/videos/cross_loading.mp4 differ diff --git a/code/web/client/index.ejs b/code/web/client/index.ejs new file mode 100644 index 0000000..46a6482 --- /dev/null +++ b/code/web/client/index.ejs @@ -0,0 +1,15 @@ + + + + + + + + + + + +
+ + + \ 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..6da38f0 --- /dev/null +++ b/code/web/client/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + + +
+ + + + + + + + + + \ 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..131f2f6 --- /dev/null +++ b/code/web/client/src/app.jsx @@ -0,0 +1,28 @@ +'use strict'; + +import React, { useEffect } from 'react'; +import Layout from './layout'; +import Auth from './sections/auth'; +import Edition from './sections/edition'; +import MicroApp from './sections/microApp' + +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..07461c5 --- /dev/null +++ b/code/web/client/src/index.jsx @@ -0,0 +1,12 @@ +'use strict'; + +import './public-path' +import React from 'react'; +import { render } from 'react-dom'; +import App from './app'; +import './index.less'; +import microApp from '@micro-zoe/micro-app' + +microApp.start() + +render((), document.getElementById('IotAuthApp')); \ 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..7a07a92 --- /dev/null +++ b/code/web/client/src/layout/components/header/index.jsx @@ -0,0 +1,88 @@ +"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 ( + <> +