Commit 93bb1ab7 authored by antoor's avatar antoor

优化UI组建自适应显示

优化UI组建自适应,在调整窗口大小的时候不刷新就能调整UI尺寸
parent 596e261a
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
## 2016/03 ## 2016/03
### /21
1. 优化UI组建自适应,在调整窗口大小的时候不刷新就能调整UI尺寸
### /15 ### /15
1. 修复了部分XSS遗留问题(主要在语言模板以及文件管理上还有虚拟终端等,其他地方可能还存在 1. 修复了部分XSS遗留问题(主要在语言模板以及文件管理上还有虚拟终端等,其他地方可能还存在
......
...@@ -29,26 +29,12 @@ app ...@@ -29,26 +29,12 @@ app
}); });
mainWindow.loadURL(`file:\/\/${__dirname}/views/index.html`); mainWindow.loadURL(`file:\/\/${__dirname}/views/index.html`);
// 是否重新加载刷新UI // 调整部分UI
// 获取初始化窗口大小
let winSize = mainWindow.getSize();
const reloadUI = () => { const reloadUI = () => {
// 判断调整大小是否已经超过界限
// 判断标准:取调整后的长(宽)与之前的长(宽)绝对值,>= 10就提示调整,最后保存调整后的长宽值
let _winSize = mainWindow.getSize();
if (Math.abs(_winSize[0] - winSize[0]) < 10 && Math.abs(_winSize[1] - winSize[1]) < 10) {
return;
};
winSize = _winSize;
mainWindow.webContents.executeJavaScript(` mainWindow.webContents.executeJavaScript(`
layer.confirm( setTimeout(() => {
'窗口已经调整,是否重启应用刷新UI?', antSword.modules.shellmanager.category.cell.setWidth(222);
{ }, 500);
title: '重启应用',
btn: ['好的','不必']
},
location.reload.bind(location)
);
`); `);
} }
mainWindow mainWindow
......
...@@ -17,7 +17,8 @@ import CacheManager from './base/cachemanager'; ...@@ -17,7 +17,8 @@ import CacheManager from './base/cachemanager';
const antSword = window.antSword = { const antSword = window.antSword = {
noxss: (html) => { noxss: (html) => {
return String(html).replace(/&/g, "&amp;").replace(/>/g, "&gt;").replace(/</g, "&lt;").replace(/"/g, "&quot;"); return String(html).replace(/&/g, "&amp;").replace(/>/g, "&gt;").replace(/</g, "&lt;").replace(/"/g, "&quot;");
} },
modules: {}
}; };
// 加载模板代码 // 加载模板代码
...@@ -36,14 +37,16 @@ antSword['CacheManager'] = CacheManager; ...@@ -36,14 +37,16 @@ antSword['CacheManager'] = CacheManager;
antSword['menubar'] = new Menubar(); antSword['menubar'] = new Menubar();
// 加载模块列表 // 加载模块列表
antSword['tabbar'] = new dhtmlXTabBar(document.getElementById('container')); // antSword['tabbar'] = new dhtmlXTabBar(document.getElementById('container'));
// 更新:使用document.body作为容器,可自动适应UI
antSword['tabbar'] = new dhtmlXTabBar(document.body);
[ [
'shellmanager', 'shellmanager',
'settings', 'settings',
'plugin' 'plugin'
].map((_) => { ].map((_) => {
let _module = require(`./modules/${_}/index`); let _module = require(`./modules/${_}/index`);
new _module.default(); antSword['modules'][_] = new _module.default();
}); });
// 移除加载界面&&设置标题 // 移除加载界面&&设置标题
$('#loading').remove(); $('#loading').remove();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment