trustbase-seller-backend 0.4.3 → 0.4.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trustbase-seller-backend",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "TrustBase Seller Backend (merchant edition) — 商品上链/订单/支付/质押 write API for TrustBase 保障链生态. 单卖家自托管形态: 签名 key 即卖家身份, 私钥不出门.",
5
5
  "main": "run-unified.js",
6
6
  "bin": {
@@ -458,6 +458,8 @@ h1{font-size:20px;margin-bottom:4px}
458
458
  .chips{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:16px}
459
459
  .chip{font-size:12px;border-radius:999px;padding:5px 12px;border:1px solid #EAE3D6;background:#FCFAF4;color:#8A857B}
460
460
  .chip.ok{background:#F0FDF4;border-color:#BBF7D0;color:#166534}
461
+ .hd{display:flex;justify-content:space-between;align-items:flex-start;gap:12px}
462
+ .hd .upbtn{margin-top:6px}
461
463
  .box{background:#FCFAF4;border:1px solid #EAE3D6;border-radius:14px;padding:18px;margin-bottom:14px}
462
464
  .box h3{font-size:15px;color:#C4633C;margin-bottom:10px}
463
465
  label{display:block;font-size:13px;color:#6B655B;margin:10px 0 4px}
@@ -490,8 +492,10 @@ input:focus,select:focus{outline:none;border-color:#C4633C;box-shadow:0 0 0 3px
490
492
  </head>
491
493
  <body>
492
494
  <div class="wrap">
495
+ <div class="hd"><div>
493
496
  <h1>服务商配置</h1>
494
497
  <div class="sub">TrustBase 服务商运营台 · 应用/名片/状态 一屏三件事</div>
498
+ </div><button class="upbtn" onclick="logout()" title="清除本机保存的管理密钥,下次进入需重新输入">退出登录</button></div>
495
499
 
496
500
  <div id="toast"></div>
497
501
 
@@ -562,6 +566,13 @@ function busy(btn,on,txtBusy){
562
566
  else{btn.disabled=false;btn.textContent=btn.dataset.txt||btn.textContent;}
563
567
  }
564
568
 
569
+ // 退出登录: 清掉本机 localStorage 里的 admin key, 刷新后重新输入 (2026-09-28 xiaomu 实测: 页面无退出入口)
570
+ function logout(){
571
+ localStorage.removeItem('spAdminKey');
572
+ showToast(true,'已退出,即将重新验证密钥');
573
+ setTimeout(function(){location.reload();},700);
574
+ }
575
+
565
576
  function render(){
566
577
  var c=CFG, comp=c.completeness;
567
578
  document.getElementById('chips').innerHTML=
@@ -579,6 +579,9 @@ test("配置页操作反馈: toast 组件 + 成功/失败文案 + 保存中禁
579
579
  assert.ok(html.includes("r.json.message"), "失败显示后端 message 原文");
580
580
  // 保存中禁用
581
581
  assert.ok(html.includes("busy(btn,true)") && html.includes("保存中…"), "保存中禁用+文案");
582
+ // 退出登录入口 (0.4.4): 清 localStorage 密钥 + 刷新
583
+ assert.ok(html.includes("退出登录") && html.includes("function logout()"), "退出登录按钮+函数");
584
+ assert.ok(html.includes("removeItem('spAdminKey')"), "logout 清密钥");
582
585
  // 所有 mutating 操作接入: 应用保存/设默认/删除/素材上传/名片保存
583
586
  for (const fn of ["saveApp", "setDefault", "delApp", "upFormAsset", "saveProfile"]) {
584
587
  assert.ok(html.includes(fn), fn + " 存在");