wwt-platform 1.1.9 → 1.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/platform.html +32 -16
- package/tools.json +1 -1
package/package.json
CHANGED
package/platform.html
CHANGED
|
@@ -1357,7 +1357,7 @@ function doAddMod(){
|
|
|
1357
1357
|
// ═══════════════════════════════════════════════════════════
|
|
1358
1358
|
// 平台更新(方案B:平台 + 内置工具统一检查)
|
|
1359
1359
|
// ═══════════════════════════════════════════════════════════
|
|
1360
|
-
const PLATFORM_VER = '1.1.
|
|
1360
|
+
const PLATFORM_VER = '1.1.11';
|
|
1361
1361
|
const NPM_PKG = 'wwt-platform'; // NPM 包名(主力分发源)
|
|
1362
1362
|
const GITEE_TOKEN_KEY = 'wwt_gitee_token';
|
|
1363
1363
|
const GITEE_TOKEN_DEF = 'e45883b9c89b8d9689746ce42bbc2b0b';
|
|
@@ -1382,7 +1382,7 @@ const SOURCES = [
|
|
|
1382
1382
|
// 更新清单:每个条目 = 一个可更新对象(平台或工具)
|
|
1383
1383
|
// 这是「离线兜底种子」——联网时会与远程 tools.json 合并,远程为准
|
|
1384
1384
|
const UPD_REG_DEF = [
|
|
1385
|
-
{key:'platform', name:'WWT 工作平台', cur:'1.1.
|
|
1385
|
+
{key:'platform', name:'WWT 工作平台', cur:'1.1.11', repo:GITEE_PLATFORM_REPO, verFile:'version.js', appFile:'app.js', pat:'__WWT_PLATFORM_VER', kind:'platform'},
|
|
1386
1386
|
{key:'erp-recon', name:'ERP 对账工具', cur:'V1.0.2',repo:'wwtmrhu/erp-recon', verFile:'version.js', appFile:'app.js', pat:'__ERP_LATEST_VER'},
|
|
1387
1387
|
{key:'erp-tool', name:'ERP 对账单生成匹配', cur:'1.0.0', repo:'wwtmrhu/erp-tool', verFile:'version.js', appFile:'app.js', pat:'__ERP_LATEST_VER'},
|
|
1388
1388
|
{key:'voucher', name:'WWT 凭证工具', cur:'P1.2.12',repo:'wwtmrhu/certificate-generation', verFile:'dist/version.json', appFile:'', pat:'ver', appUrl:true}
|
|
@@ -1553,18 +1553,16 @@ let _manifestSrc = null; // 来源标签
|
|
|
1553
1553
|
let _newTools = []; // 清单里有、本平台还没装的工具
|
|
1554
1554
|
|
|
1555
1555
|
async function fetchManifest() {
|
|
1556
|
-
//
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
order = SOURCES.slice().sort((a, b) => verCmp(vers[b.id] || '0', vers[a.id] || '0'));
|
|
1562
|
-
} catch(e) { /* 取不到版本就按默认顺序试 */ }
|
|
1556
|
+
// 统一用「各源中的最高版本」去取清单。
|
|
1557
|
+
// 镜像的 /latest 常滞后,但它按版本号取文件是准的——所以不能用各源自己的版本号,
|
|
1558
|
+
// 否则会从镜像拉到旧清单。
|
|
1559
|
+
let target = null;
|
|
1560
|
+
try { target = (await bestVersion()).ver; } catch(e) { /* 取不到就逐源自查 */ }
|
|
1563
1561
|
|
|
1564
1562
|
const errs = [];
|
|
1565
|
-
for (const s of
|
|
1563
|
+
for (const s of SOURCES) {
|
|
1566
1564
|
try {
|
|
1567
|
-
const ver =
|
|
1565
|
+
const ver = target || (await sourceVersion(s));
|
|
1568
1566
|
const txt = await sourceFile(s, ver, 'tools.json');
|
|
1569
1567
|
const m = JSON.parse(txt);
|
|
1570
1568
|
if (!m || !Array.isArray(m.tools)) throw new Error('清单格式错误');
|
|
@@ -1618,12 +1616,20 @@ function mergeManifest(m) {
|
|
|
1618
1616
|
|
|
1619
1617
|
// 找出「清单里有、平台界面里还没装」的工具
|
|
1620
1618
|
function refreshNewTools() {
|
|
1619
|
+
const mods = ST.modules || [];
|
|
1620
|
+
// 模块 id 不存在时回退到第一个模块,避免清单里模块名写错导致工具被静默忽略
|
|
1621
|
+
const resolveMod = (id) => mods.find(x => x.id === id) || mods[0] || null;
|
|
1622
|
+
|
|
1621
1623
|
_newTools = UPD_REG.filter(it => {
|
|
1622
1624
|
if (it.key === 'platform' || it.removed) return false;
|
|
1623
|
-
const m = (
|
|
1625
|
+
const m = resolveMod(it.module || 'fin');
|
|
1624
1626
|
if (!m) return false;
|
|
1625
1627
|
return !(m.tools || []).some(t => t.mkey === it.key);
|
|
1626
|
-
}).map(it =>
|
|
1628
|
+
}).map(it => {
|
|
1629
|
+
const m = resolveMod(it.module || 'fin');
|
|
1630
|
+
return { key: it.key, name: it.name, desc: it.desc, module: m.id, ver: it.cur,
|
|
1631
|
+
moduleFixed: it.module && it.module !== m.id };
|
|
1632
|
+
});
|
|
1627
1633
|
return _newTools;
|
|
1628
1634
|
}
|
|
1629
1635
|
|
|
@@ -1792,6 +1798,12 @@ async function openUpdateModal() {
|
|
|
1792
1798
|
}
|
|
1793
1799
|
}
|
|
1794
1800
|
|
|
1801
|
+
// 模块 id → 显示名
|
|
1802
|
+
function modName(id) {
|
|
1803
|
+
const m = (ST.modules || []).find(x => x.id === id);
|
|
1804
|
+
return m ? m.name + '模块' : (id || '财务') + '模块';
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1795
1807
|
function renderUpdList() {
|
|
1796
1808
|
const body = $id('upd-body');
|
|
1797
1809
|
|
|
@@ -1803,7 +1815,8 @@ function renderUpdList() {
|
|
|
1803
1815
|
+ _newTools.map(t =>
|
|
1804
1816
|
'<div style="display:flex;align-items:center;justify-content:space-between;padding:8px 0;border-top:1px solid #dbeafe">'
|
|
1805
1817
|
+ '<div><div style="font-weight:600;font-size:13.5px">' + esc(t.name) + '</div>'
|
|
1806
|
-
+ '<div style="font-size:12px;color:var(--text-3)">' + esc(t.desc || '') + ' · v' + esc(t.ver || '')
|
|
1818
|
+
+ '<div style="font-size:12px;color:var(--text-3)">' + esc(t.desc || '') + ' · v' + esc(t.ver || '')
|
|
1819
|
+
+ ' 安装到:' + esc(modName(t.module)) + '</div></div>'
|
|
1807
1820
|
+ '<button class="btn sm prim" onclick="installTool(\'' + t.key + '\')">⬇ 安装</button></div>').join('')
|
|
1808
1821
|
+ '</div>';
|
|
1809
1822
|
}
|
|
@@ -1995,17 +2008,20 @@ async function doUpdateOne(key) {
|
|
|
1995
2008
|
let bytes, srcLabel = '';
|
|
1996
2009
|
if (it.key === 'platform') {
|
|
1997
2010
|
// 平台本体:NPM 上直接是 platform.html(明文),Gitee 上是 base64 的 app.js
|
|
2011
|
+
// 用「各源中的最高版本」下载,避免镜像滞后导致下到旧版
|
|
2012
|
+
let target = null;
|
|
2013
|
+
try { target = (await bestVersion()).ver; } catch(e) {}
|
|
1998
2014
|
const res = await trySources(async (s) => {
|
|
1999
2015
|
if (s.id === 'gitee') {
|
|
2000
2016
|
const appJs = await fetchGiteeFile(GITEE_PLATFORM_REPO, 'app.js');
|
|
2001
2017
|
return { bytes: b64ToBytes(b64FromApiJson(appJs)) };
|
|
2002
2018
|
}
|
|
2003
|
-
const ver = await sourceVersion(s);
|
|
2019
|
+
const ver = target || (await sourceVersion(s));
|
|
2004
2020
|
const html = await sourceFile(s, ver, 'platform.html');
|
|
2005
2021
|
return { bytes: new TextEncoder().encode(html) };
|
|
2006
2022
|
});
|
|
2007
2023
|
bytes = res.val.bytes;
|
|
2008
|
-
srcLabel = res.label;
|
|
2024
|
+
srcLabel = res.label + (target ? ' v' + target : '');
|
|
2009
2025
|
} else if (it.appUrl) {
|
|
2010
2026
|
// version.json 里直接带最新版文件 API 地址,按 url 字段下载
|
|
2011
2027
|
const vc = await fetchGiteeFile(it.repo, it.verFile);
|