diff --git a/.gitignore b/.gitignore index 63acb2d..aec8ced 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,4 @@ app/* npm-debug.log .idea/ *.iml - +package-lock.json diff --git a/package.json b/package.json index ce6852d..fe5c341 100644 --- a/package.json +++ b/package.json @@ -51,11 +51,11 @@ }, "license": "MIT", "dependencies": { - "antd": "^3.3.3", + "antd": "^3.4.1", "axios": "^0.18.0", "mirrorx": "^0.2.10", - "react": "^16.3.0", - "react-dom": "^16.3.0" + "react": "^16.3.1", + "react-dom": "^16.3.1" }, "devDependencies": { "ansi-html": "0.0.7", @@ -63,7 +63,7 @@ "babel-core": "^6.26.0", "babel-loader": "^7.1.4", "babel-minify-webpack-plugin": "^0.3.0", - "babel-plugin-import": "^1.6.7", + "babel-plugin-import": "^1.7.0", "babel-plugin-transform-runtime": "^6.23.0", "babel-polyfill": "^6.26.0", "babel-preset-env": "^1.6.1", @@ -84,7 +84,7 @@ "file-loader": "^1.1.11", "fix-path": "^2.1.0", "fs-extra": "^5.0.0", - "html-webpack-plugin": "^3.0.6", + "html-webpack-plugin": "^3.2.0", "install": "^0.10.4", "less": "^3.0.1", "less-loader": "^4.1.0", diff --git a/src/renderer/App.jsx b/src/renderer/App.jsx index f9f0703..cbfb80f 100644 --- a/src/renderer/App.jsx +++ b/src/renderer/App.jsx @@ -7,8 +7,7 @@ import { Route, Router, NavLink } from 'mirrorx'; import { Layout, Menu, Icon } from 'antd'; import { ipcRenderer } from 'electron'; import pkg from '../../package.json'; -import CloseButton from 'components/CloseButton'; -import SiderLeft from 'components/SiderLeft'; +// import CloseButton from 'components/CloseButton'; import Routes from './routes'; import './App.less'; const { Header, Content, Footer, Sider } = Layout; diff --git a/src/renderer/App.less b/src/renderer/App.less index 117cf74..72ca09a 100644 --- a/src/renderer/App.less +++ b/src/renderer/App.less @@ -19,7 +19,10 @@ button { -webkit-app-region: no-drag; } - +.ant-layout-header{ + background: #fff; + padding:0; +} .ant-layout { background-color: #fff; } diff --git a/src/renderer/components/EmptyHome/index.jsx b/src/renderer/components/EmptyHome/index.jsx deleted file mode 100644 index 8278236..0000000 --- a/src/renderer/components/EmptyHome/index.jsx +++ /dev/null @@ -1,75 +0,0 @@ -import React, { Component } from 'react'; -import { actions } from 'mirrorx'; -import { Button, notification, message } from 'antd'; -import { ipcRenderer } from 'electron'; -import './index.less'; - - - -const ipc = ipcRenderer; - -ipc.on('uba::import::success', (event, data) => { - console.log(data); - actions.my.setWorkSpace(data); -}); -ipc.on('uba::import::error', (event, msg) => { - message.error(msg); -}); -ipc.on('uba::server::start', (event, msg) => { - message.error(msg); -}); - -/** - * 接收服务端当前运行npm镜像检测 - */ -ipc.on('uba::checkNpm::success', (event, msg) => { - if (msg) { - actions.init.changeYonyouNpm(); - } -}); - - -/** - * 接收服务端切换工作区的通知 - */ -ipc.on('uba::view::project', (event, workSpace) => { - console.log('接收到切换工作区通知 uba::view::project ', workSpace); - actions.my.setWorkSpace(workSpace); - if (workSpace.length !== 0) { - actions.routing.push('/my'); - } -}); - - -class EmptyHome extends Component { - openHomePage = () => { - ipc.send('uba::openUrl', 'http://tinper.org'); - } - importExisProject = () => { - // console.log('import') - ipc.send('uba::import'); - // ipc.send('uba::server'); - - } - openMessage = () => { - // notification.open({ - // message: 'Notification Title', - // description: 'This is the content of the notification. This is the content of the notification. This is the content of the notification.', - // }); - message.success('开始导入工程'); - } - render() { - return ( -
-
-
欢迎使用前端uba开发工具,请选择您的操作
-
- - -
-
- ); - } -} - -export default EmptyHome; diff --git a/src/renderer/components/EmptyHome/index.less b/src/renderer/components/EmptyHome/index.less deleted file mode 100644 index 5eda899..0000000 --- a/src/renderer/components/EmptyHome/index.less +++ /dev/null @@ -1,30 +0,0 @@ -.uba-empty-home { - -webkit-user-select: none; - text-align: center; - .empty-icon { - height: 130px; - width: 130px; - display: inline-block; - background: url(../../../../static/uba.png) no-repeat center center; - text-align: center; - line-height: 130px; - color: #1890ff; - font-size: 12px; - margin-top: 100px; - margin-bottom: 40px; - background-size: 130px; - cursor: pointer; - } - .version { - text-align: center; - color: #8c8c8c; - cursor: default; - } - .op { - text-align: center; - padding: 50px 0; - .btn { - margin: 20px 6px; - } - } -} \ No newline at end of file diff --git a/src/renderer/components/Init/ProjectCard.jsx b/src/renderer/components/Init/ProjectCard.jsx deleted file mode 100644 index 463082b..0000000 --- a/src/renderer/components/Init/ProjectCard.jsx +++ /dev/null @@ -1,45 +0,0 @@ -import React, { Component } from 'react'; -import { Card, Avatar } from 'antd'; -import { actions } from 'mirrorx'; -import './ProjectCard.less'; -import ut from 'static/ut.png'; - -const { Meta } = Card; - -const gridStyle = { - width: '100%', - textAlign: 'left' -}; - - -class ProjectCard extends Component { - cardClick = (index,item) => { - let obj = { - selectId : item.id, - selectName : item.name - } - actions.init.selectTemplate(obj); - } - render() { - let { data } = this.props; - return (
- - { - data.map((item, index) => ( - - - } - title={item.name} - description={item.description} - /> - - - )) - } -
- ); - } -} - -export default ProjectCard; diff --git a/src/renderer/components/Init/ProjectCard.less b/src/renderer/components/Init/ProjectCard.less deleted file mode 100644 index 33f5b48..0000000 --- a/src/renderer/components/Init/ProjectCard.less +++ /dev/null @@ -1,4 +0,0 @@ -.project-card{ - height: 280px; - overflow: auto; -} \ No newline at end of file diff --git a/src/renderer/components/Init/index.jsx b/src/renderer/components/Init/index.jsx deleted file mode 100644 index 339ea84..0000000 --- a/src/renderer/components/Init/index.jsx +++ /dev/null @@ -1,212 +0,0 @@ -import React, { Component } from 'react'; -import { actions } from 'mirrorx'; -import { Button, Row, Col, Steps, Icon, Card, Form, Input,Select } from 'antd'; -import { ipcRenderer } from 'electron'; -import ProjectCard from './ProjectCard'; -import Waiting from 'components/Waiting'; -import './index.less'; - -const ipc = ipcRenderer; -const Step = Steps.Step; -const FormItem = Form.Item; -const Option = Select.Option; - -let myfrm; -let installTimer,countTimer = 0; - -ipc.on('uba::openProject::success', (event, path) => { - // actions.init.setUpload(path); - myfrm.setFieldsValue({ - upload: path - }); -}); - -//Npm Install -// ipc.on('uba::install::data', (event, chunk) => { -// console.log(chunk); -// }); -ipc.on('uba::init::success', (event,workSpace) => { - console.log('init::success'); - console.log(workSpace) - //TODO : 更新状态项目列表 - actions.init.install(); - clearInterval(installTimer); - countTimer = 100; - installTimer = setInterval(()=>{ - countTimer++; - if (countTimer > 95) { - clearInterval(installTimer); - } - actions.init.changeInstallState({ - isFinish:false, - percent:countTimer, - processMsg:"最佳实践项目初始化完毕", - }); - },1000); -}); -ipc.on('uba::install::start',(event)=>{ - clearInterval(installTimer); - countTimer = 0; - installTimer = setInterval(()=>{ - countTimer++; - if (countTimer > 95) { - clearInterval(installTimer); - } - actions.init.changeInstallState({ - isFinish:false, - percent:countTimer, - processMsg:"安装项目所需要的依赖包", - }); - },1000); -}); -ipc.on('uba::install::success', (event) => { - console.log('uba::install::success'); - clearInterval(installTimer); - countTimer = 100; - installTimer = setInterval(()=>{ - countTimer++; - if (countTimer > 95) { - clearInterval(installTimer); - } - actions.init.changeInstallState({ - isFinish:true, - percent:countTimer, - processMsg:"最佳实践项目以及依赖包全部安装完毕", - }); - },1000); -}); -// ipc.on('uba::install::close', (event,code) => { -// console.log('close',code); -// }); -// ipc.on('uba::install::error', (event,err) => { -// console.log('error',err); -// }); - - - -class Init extends Component { - checkForm = (e) => { - this.props.form.validateFields((err, values) => { - if (!err) { - actions.init.setSetting(values); - actions.init.downGit(); - countTimer = 0; - installTimer = setInterval(()=>{ - countTimer++; - if (countTimer > 95) { - clearInterval(installTimer); - } - actions.init.changeInstallState({ - isFinish:false, - percent:countTimer, - processMsg:"正在下载最佳实践", - }); - },1000); - } - }); - } - handlerUpload = () => { - ipc.send('uba::openProject'); - } - returnHomeHandler = () => { - actions.init.resetInit(); - actions.routing.push({ - pathname: '/' - }); - } - render() { - - const { getFieldDecorator } = this.props.form; - myfrm = this.props.form; - let { defaultNpmPath,currStep, repoData, selectName,upload,isFinish,percent,processMsg } = this.props; - return ( -
- - - 创建新项目 - - - - -
- - - - - -
- -
- - - {currStep == 0 &&
- {repoData.length != 0 && } - {repoData.length == 0 && } -
} - { - currStep == 1 &&
- - {getFieldDecorator('project', { - rules: [{ required: true, message: '项目名称不能为空' }], - })( - } /> - )} - - - {getFieldDecorator('upload', { - values:upload, - rules: [{ required: true, message: '请选择本地开发目录' }], - })( - } prefix={} /> - )} - - - {getFieldDecorator('registry', { - initialValue : defaultNpmPath, - rules: [{ required: true, message: '请选择npm加速镜像' }], - })( - - )} - -
- } - { - currStep == 2 &&
- -
- } - -
- - -
- {currStep == 0 && } - {currStep == 0 && } - {currStep == 1 && } - {currStep == 1 && } - {currStep == 2 && } -
- -
-
- ); - } -} - -export default Form.create()(Init); diff --git a/src/renderer/components/Init/index.less b/src/renderer/components/Init/index.less deleted file mode 100644 index d83f82d..0000000 --- a/src/renderer/components/Init/index.less +++ /dev/null @@ -1,26 +0,0 @@ -.uba-init { - -webkit-user-select: none; - text-align: left; - padding: 10px 30px 0; - .ant-row{ - // margin:20px 0; - } - .step-process{ - margin-top: 30px; - } - .new-project{ - font-size:20px; - } - .select-card{ - text-align: left; - height: 260px; - padding-top: 24px; - } - .op { - text-align: center; - margin-top: 70px; - .btn { - margin: 0px 6px; - } - } -} \ No newline at end of file diff --git a/src/renderer/components/Logo/index.less b/src/renderer/components/Logo/index.less index f4cbb19..19da152 100644 --- a/src/renderer/components/Logo/index.less +++ b/src/renderer/components/Logo/index.less @@ -1,12 +1,13 @@ .logo { height: 72px; + width:130px; + display: inline-block; background: url(../../../../static/uba-logo.png) no-repeat center center; text-align: center; line-height: 72px; color: #1890ff; font-size: 16px; - margin-top: 60px; margin-bottom: 0; - background-size: 50px; + background-size: 70px; cursor: pointer; } \ No newline at end of file diff --git a/src/renderer/components/MainPanel/Gift.jsx b/src/renderer/components/MainPanel/Gift.jsx new file mode 100644 index 0000000..26bace4 --- /dev/null +++ b/src/renderer/components/MainPanel/Gift.jsx @@ -0,0 +1,29 @@ +import React, { Component } from 'react'; +import { Row, Col } from 'antd'; +import giftPng from 'static/gift.png'; + +import './Gift.less'; + +class Gift extends Component { + render() { + return ( + + + + + +

在这里尽情拼搏你的才华

+ + +

让时光不在一行行代码中流逝

+ + +

uba-gui 只为让你离梦想更近一步

+ + +
+ ); + } +} + +export default Gift; diff --git a/src/renderer/components/MainPanel/Gift.less b/src/renderer/components/MainPanel/Gift.less new file mode 100644 index 0000000..86dcbb1 --- /dev/null +++ b/src/renderer/components/MainPanel/Gift.less @@ -0,0 +1,4 @@ +.main-gift-wrap{ + margin-top:15%; + text-align: center; +} \ No newline at end of file diff --git a/src/renderer/components/MainPanel/index.jsx b/src/renderer/components/MainPanel/index.jsx index 598debd..287cc05 100644 --- a/src/renderer/components/MainPanel/index.jsx +++ b/src/renderer/components/MainPanel/index.jsx @@ -1,11 +1,67 @@ import React, { Component } from 'react'; +import { Row, Col, Layout, Menu, Icon } from 'antd'; +import { actions, Switch, Route } from 'mirrorx'; +import Logo from '../Logo'; +import Gift from './Gift'; +const { Header, Footer, Sider, Content } = Layout; +import './index.less'; + + +window.addEventListener('resize', () => { + let innerHeight = 0; + innerHeight = window.innerHeight - 64; + actions.main.save({ toolbarHeight: innerHeight }); +}); class MainPanel extends Component { + componentDidMount() { + let innerHeight = 0; + innerHeight = window.innerHeight - 64; + actions.main.save({ toolbarHeight: innerHeight }); + } render() { + let { match, toolbarHeight } = this.props; return ( -
- MainPanel -
+ +
+ + + + + + 14 + + + 4 + + +
+ + + + + + 项目管理 + + + + 应用设计 + + + + 资源维护 + + + + Mock数据 + + + + + + + +
); } } diff --git a/src/renderer/components/MainPanel/index.less b/src/renderer/components/MainPanel/index.less index e69de29..6bdf16a 100644 --- a/src/renderer/components/MainPanel/index.less +++ b/src/renderer/components/MainPanel/index.less @@ -0,0 +1,9 @@ + +.main-wrap{ + .main-head{ + + } + .ant-menu-dark, .ant-menu-dark .ant-menu-sub{ + background: #333; + } +} \ No newline at end of file diff --git a/src/renderer/components/MySpace/index.jsx b/src/renderer/components/MySpace/index.jsx deleted file mode 100644 index b2050f4..0000000 --- a/src/renderer/components/MySpace/index.jsx +++ /dev/null @@ -1,126 +0,0 @@ -import React, { Component } from 'react'; -import { actions } from 'mirrorx'; -import { Button, notification, message, Layout, List, Avatar, Menu, Icon } from 'antd'; -import { ipcRenderer } from 'electron'; -import ut from 'static/ut.png'; -import ansiHTML from 'ansi-html'; - -import './index.less'; -const { Header, Content, Footer, Sider } = Layout; - - -const ipc = ipcRenderer; - - -//测试用记得删除 -ipc.on('uba::view::project2', (event, workSpace) => { - actions.my.setWorkSpace(workSpace); -}); - - -let prt, ele; -/** - * 接收构建on消息 - */ -ipc.on('uba::run::build::on', (event, log) => { - // console.log(log) - actions.my.setCmdLog(ansiHTML(log.toString().replace(/\n/g, '
'))); - if (ele.offsetHeight > prt.clientHeight) { - prt.scrollTop = ele.clientHeight - prt.clientHeight; - } -}); - -/** - * 接收构建end消息 - */ -ipc.on('uba::run::build::end', (event, log, msg) => { - message.success(msg); -}); -/** - * 接收调试on消息 - */ -ipc.on('uba::run::dev::on', (event, log) => { - // console.log(log) - actions.my.setCmdLog(ansiHTML(log.toString().replace(/\n/g, '
'))); - if (ele.offsetHeight > prt.clientHeight) { - prt.scrollTop = ele.clientHeight - prt.clientHeight; - } -}); - -ipc.on('uba::log', (event, log) => { - console.log(log) -}); - -/** - * 接收构建end消息 - */ -ipc.on('uba::run::dev::end', (event, log, code) => { - // console.log(log,code); - message.success(log); -}); - - -class MySpace extends Component { - /** - * 执行调试 - */ - npmRun = (item) => () => { - console.log('发送启动调试消息 uba::run::dev', item.path); - ipc.send('uba::run::dev', item); - } - /** - * 执行构建 - */ - npmBuild = (item) => () => { - console.log('发送构建消息 uba::run::build', item.path); - ipc.send('uba::run::build', item); - } - - npmStop = (item) => () => { - ipc.send('uba::run::stop', item); - } - - /** - * 打开本地工程 - */ - openLocalFolder = (item) => () => { - console.log('发送打开本地文件夹消息 uba::open::folder', item.path); - ipc.send('uba::open::folder', item.path); - } - - render() { - let { workSpace, cmdLine } = this.props; - return ( -
- - - ( - 运行, - , - - ]}> - } - title={{item.title}} - description={`Path:${item.path}`} - /> - - )} - /> -
{ prt = item }}> -
{ ele = item }} dangerouslySetInnerHTML={{ __html: cmdLine }} >
-
-
-
-
- ); - } -} - -export default MySpace; diff --git a/src/renderer/components/MySpace/index.less b/src/renderer/components/MySpace/index.less deleted file mode 100644 index 88f22c5..0000000 --- a/src/renderer/components/MySpace/index.less +++ /dev/null @@ -1,21 +0,0 @@ -.uba-my-space { - -webkit-user-select: none; - padding: 0px; - .uba-project-list { - // margin:10px; - overflow: auto; - height: 293px; - } - .uba-cmd { - width: 100%; - background: rgba(0, 0, 0, 0.58); - height: 195px; - margin-top: 13px; - border-radius: 4px; - border: 1px solid #e1e4e2; - padding: 10px; - overflow: auto; - color: #fafbfa; - font-size: 12px; - } -} \ No newline at end of file diff --git a/src/renderer/components/SiderLeft/index.jsx b/src/renderer/components/SiderLeft/index.jsx deleted file mode 100644 index d6443c3..0000000 --- a/src/renderer/components/SiderLeft/index.jsx +++ /dev/null @@ -1,67 +0,0 @@ -import React, { Component } from 'react'; -import { Layout, Menu, Icon } from 'antd'; -import { actions } from 'mirrorx'; -import { remote, ipcRenderer } from 'electron'; - -import './index.less'; - -const { Header, Content, Footer, Sider } = Layout; -const win = remote.getGlobal('win'); -const ipc = ipcRenderer; - -const closeHandler = () => { - win.hide(); -} -const minHandler = () => { - win.minimize(); -} -const maxHandler = () => { - win.maximize(); -} - -const openGithub = () => { - ipc.send('uba::openUrl', 'https://github.com/tinper-uba/uba-gui/issues'); -} - -class SiderLeft extends Component { - render() { - return ( - -
- - - -
- - - { actions.routing.push('init') }} type="plus-circle-o" /> - 新建项目 - - - { ipc.send('uba::import') }} type="upload" /> - 导入项目 - - {/* - - 设置 - */} - - - 反馈 - - -
- ); - } -} - -export default SiderLeft; diff --git a/src/renderer/components/SiderLeft/index.less b/src/renderer/components/SiderLeft/index.less deleted file mode 100644 index bb1a884..0000000 --- a/src/renderer/components/SiderLeft/index.less +++ /dev/null @@ -1,10 +0,0 @@ -.silder-left { - margin-right: 3px; - height: 550px; - .silder-left-menu { - position: absolute; - bottom: 0; - background-color: #2c2c2c; - color: #fff - } -} \ No newline at end of file diff --git a/src/renderer/components/Welcome/HistoryProject.jsx b/src/renderer/components/Welcome/HistoryProject.jsx index 1ab579a..b9b0de3 100644 --- a/src/renderer/components/Welcome/HistoryProject.jsx +++ b/src/renderer/components/Welcome/HistoryProject.jsx @@ -35,6 +35,7 @@ class HistoryProject extends Component { organization : item.organization, registry : item.registry }); + actions.welcome.finish(); } renderHistoryProject = (historyArr) => { //https://img.alicdn.com/tfs/TB1tnAWdHSYBuNjSspiXXXNzpXa-1920-1080.png diff --git a/src/renderer/models/MainPanel.js b/src/renderer/models/MainPanel.js index c58b31e..88eb987 100644 --- a/src/renderer/models/MainPanel.js +++ b/src/renderer/models/MainPanel.js @@ -8,7 +8,7 @@ import * as api from 'services/MainPanel'; export default { name: "main", initialState: { - + toolbarHeight : 0 }, reducers: { save(state, data) { diff --git a/src/renderer/routes/index.jsx b/src/renderer/routes/index.jsx index 27d2b56..d2bd069 100644 --- a/src/renderer/routes/index.jsx +++ b/src/renderer/routes/index.jsx @@ -13,7 +13,7 @@ class Routes extends Component { return ( - + ); } diff --git a/src/renderer/services/Welcome.js b/src/renderer/services/Welcome.js index 491b216..b61cbf9 100644 --- a/src/renderer/services/Welcome.js +++ b/src/renderer/services/Welcome.js @@ -4,7 +4,7 @@ import axios from 'axios'; -const remoteUrl = 'https://raw.githubusercontent.com/tinper-uba/uba-gui/develop/project.json'; +const remoteUrl = 'http://design.yonyoucloud.com/static/uba/project.json'; export function getProjectTemplates(){ return axios.get(remoteUrl); diff --git a/static/gift.png b/static/gift.png new file mode 100644 index 0000000..1b15145 Binary files /dev/null and b/static/gift.png differ