网页端:平台桥与部署修复(宝塔/Nginx)
- lib/platform:网页 Electron 统一 bridge/web/electron,子目录 API 基路径、返回首页跳站点根、路径末尾斜杠兼容 - index/design*.web.html:网页入口,web.js 加缓存参数避免旧脚本缓存 - api:PHP 读写 soon;文档说明目录权限与 Nginx - lib/design*、lib/index:与 platformBridge 对接及网页侧逻辑 - 公共资源 JsBarcode/jr-qrcode;文档与 package/README/.gitignore 等同步更新 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+47
-21
@@ -81,25 +81,31 @@ canvas2.preserveObjectStacking = true;
|
||||
|
||||
|
||||
var front_list = [];
|
||||
ipcRenderer.on('font-list', (event, data) => {
|
||||
const newFontList = [];
|
||||
data.map(item => {
|
||||
function applyFontList(data) {
|
||||
var newFontList = [];
|
||||
(data || []).map(function(item) {
|
||||
if (item.indexOf('"') === 0) {
|
||||
newFontList.push(item.replace(/^"|"$/g, ''));
|
||||
} else {
|
||||
newFontList.push(item);
|
||||
}
|
||||
})
|
||||
});
|
||||
front_list = newFontList;
|
||||
for (let item of front_list) {
|
||||
for (var i = 0; i < front_list.length; i++) {
|
||||
var item = front_list[i];
|
||||
$("#text_font_family").append("<option value='" + item + "'>" + item + "</option>");
|
||||
$("#circle_text_font_family").append("<option value='" + item + "'>" + item + "</option>");
|
||||
$("#out_text_font_family").append("<option value='" + item + "'>" + item + "</option>");
|
||||
$("#barcode_font_family").append("<option value='" + item + "'>" + item + "</option>");
|
||||
$("#count_font_family").append("<option value='" + item + "'>" + item + "</option>");
|
||||
}
|
||||
});
|
||||
ipcRenderer.on('sys-lan', (event, data) => {
|
||||
}
|
||||
if (typeof ipcRenderer !== 'undefined' && ipcRenderer) {
|
||||
ipcRenderer.on('font-list', function(event, data) { applyFontList(data); });
|
||||
} else if (typeof window !== 'undefined' && window.platformBridge && window.platformBridge.getSystemFonts) {
|
||||
window.platformBridge.getSystemFonts().then(applyFontList);
|
||||
}
|
||||
function applySysLan(data) {
|
||||
let lang = localStorage.getItem("lang");
|
||||
if (lang) {
|
||||
s_lan = lang;
|
||||
@@ -246,23 +252,33 @@ ipcRenderer.on('sys-lan', (event, data) => {
|
||||
localStorage.setItem("lang", "en");
|
||||
break;
|
||||
}
|
||||
});
|
||||
ipcRenderer.on('close', (event, message) => {
|
||||
layer.confirm('<font style="color:black">' + language_str("whetherSave") + '</font>', {//是否保存当前文件?
|
||||
btn: [language_str("save"), language_str("noSave"), language_str("cancel")] //['保存', '不保存', '取消']
|
||||
, btn3: function (index, layero) {
|
||||
|
||||
}
|
||||
}
|
||||
if (typeof ipcRenderer !== 'undefined' && ipcRenderer) {
|
||||
ipcRenderer.on('sys-lan', function(event, data) { applySysLan(data); });
|
||||
} else if (typeof window !== 'undefined' && window.platformBridge && window.platformBridge.getLocale) {
|
||||
applySysLan(window.platformBridge.getLocale());
|
||||
}
|
||||
function onCloseConfirm() {
|
||||
layer.confirm('<font style="color:black">' + language_str("whetherSave") + '</font>', {
|
||||
btn: [language_str("save"), language_str("noSave"), language_str("cancel")]
|
||||
, btn3: function (index, layero) {}
|
||||
}, function (index, layero) {
|
||||
|
||||
if (typeof window.output === 'function') {
|
||||
window.output(() => ipcRenderer.send('run-close'));
|
||||
window.output(function() {
|
||||
if (ipcRenderer) ipcRenderer.send('run-close');
|
||||
else if (window.platformBridge && window.platformBridge.runClose) window.platformBridge.runClose();
|
||||
});
|
||||
}
|
||||
}, function (index) {
|
||||
ipcRenderer.send('run-close');
|
||||
if (ipcRenderer) ipcRenderer.send('run-close');
|
||||
else if (window.platformBridge && window.platformBridge.runClose) window.platformBridge.runClose();
|
||||
});
|
||||
|
||||
})
|
||||
}
|
||||
if (typeof ipcRenderer !== 'undefined' && ipcRenderer) {
|
||||
ipcRenderer.on('close', function(event, message) { onCloseConfirm(); });
|
||||
} else if (typeof window !== 'undefined' && window.platformBridge && window.platformBridge.onClose) {
|
||||
window.platformBridge.onClose(onCloseConfirm);
|
||||
}
|
||||
addBackground();//添加背景 白色卡片
|
||||
initAligningGuidelines(canvas1);
|
||||
initAligningGuidelines(canvas2);
|
||||
@@ -402,9 +418,19 @@ function addBackground() {
|
||||
recordObjs2.push(JSON.stringify(objs2));
|
||||
recordJson2.push(canvas2.toJSON(TO_JSON_PROPERTIES));
|
||||
|
||||
let file = GetFile().get('file')
|
||||
let file = GetFile().get('file');
|
||||
if (!file && typeof sessionStorage !== 'undefined') {
|
||||
try {
|
||||
file = sessionStorage.getItem('soondesign_open_file');
|
||||
if (file) {
|
||||
sessionStorage.removeItem('soondesign_open_file');
|
||||
sessionStorage.removeItem('soondesign_open_type');
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
if (file && file != 'empty') {
|
||||
window.openFile(file)
|
||||
var p = window.openFile(file)
|
||||
if (p && p.then) p.then(function() {}, function() {})
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user