fix(web): 修复 .soon/模板加载、旧文件兼容与另存为离开提示

- 删除 design1 ui 遗留代码,修复加载竞态与新建不弹保存提示
- cloud-files 归一化旧版 .soon,IndexedDB 写入完成后再跳转设计页
- 模板/本地 .soon 首次保存须另存为,离开前统一确认
- 发版缓存 bust(version.js、soon-cache.js)及宝塔 Nginx 配置文档

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
24kycj
2026-06-29 00:30:20 +08:00
parent efeb3bcc41
commit ce76bb8018
27 changed files with 648 additions and 254 deletions
+53
View File
@@ -0,0 +1,53 @@
(function () {
'use strict';
var v = window.SOON_APP_VERSION || '';
window.soonWithVersion = function (url) {
if (!url || /^https?:\/\//i.test(url) || /^data:/i.test(url)) return url;
if (!v) return url;
var s = String(url);
var hashIdx = s.indexOf('#');
var hash = hashIdx >= 0 ? s.slice(hashIdx) : '';
var noHash = hashIdx >= 0 ? s.slice(0, hashIdx) : s;
return noHash.split('?')[0] + '?v=' + encodeURIComponent(v) + hash;
};
window.soonPatchForward = function (fromEl) {
var fn = window.soonWithVersion;
if (typeof fn !== 'function') return;
var el = fromEl && fromEl.nextElementSibling;
while (el) {
if (el.tagName === 'SCRIPT') {
var src = el.getAttribute('src');
if (src && src.indexOf('version.js') < 0 && src.indexOf('soon-cache.js') < 0) {
el.src = fn(src);
}
} else if (el.tagName === 'LINK' && el.rel === 'stylesheet') {
var href = el.getAttribute('href');
if (href) el.href = fn(href);
}
el = el.nextElementSibling;
}
};
if (v) {
var KEY = 'soondesign_app_version';
try {
var prev = localStorage.getItem(KEY);
if (prev && prev !== v) {
localStorage.setItem(KEY, v);
var url = new URL(window.location.href);
if (url.searchParams.get('_sv') !== v) {
url.searchParams.set('_sv', v);
window.location.replace(url.toString());
return;
}
}
localStorage.setItem(KEY, v);
} catch (e) { /* ignore */ }
}
if (document.currentScript) {
window.soonPatchForward(document.currentScript);
}
})();