@kamuira/stock-analyzer 1.3.0 → 1.3.1

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.
Files changed (2) hide show
  1. package/index.html +17 -0
  2. package/package.json +1 -1
package/index.html CHANGED
@@ -340,6 +340,17 @@
340
340
  rankListInput.addEventListener('input', updateRankHint);
341
341
  loadRankList();
342
342
 
343
+ // 保存上一次排名的渲染结果(仅前端内存,非接口缓存),用于点进个股后快速返回
344
+ let lastRankHTML = '';
345
+
346
+ function backToRank() {
347
+ if (!lastRankHTML) return;
348
+ errorDiv.classList.remove('active');
349
+ resultDiv.innerHTML = lastRankHTML;
350
+ resultDiv.classList.add('active');
351
+ window.scrollTo(0, 0);
352
+ }
353
+
343
354
  async function doRank() {
344
355
  const extra = parseRankInput(rankListInput.value);
345
356
  // 默认清单始终包含;额外的拼在后面(服务端按解析后的代码去重)
@@ -498,6 +509,7 @@
498
509
  点击任意一行可查看该股完整分析与回测。
499
510
  </div>`;
500
511
 
512
+ lastRankHTML = html; // 存起来,点进个股后可一键返回,无需重算
501
513
  resultDiv.innerHTML = html;
502
514
  resultDiv.classList.add('active');
503
515
  }
@@ -555,6 +567,11 @@
555
567
 
556
568
  let html = '';
557
569
 
570
+ // 若是从排名点进来的,显示一键返回(直接复用已渲染结果,不重新计算)
571
+ if (lastRankHTML) {
572
+ html += `<button onclick="backToRank()" style="margin-bottom:14px;padding:8px 16px;border:1px solid #5a3dbf;border-radius:8px;background:transparent;color:#b39dff;font-size:13px;cursor:pointer">← 返回排名</button>`;
573
+ }
574
+
558
575
  // 回测结果卡片
559
576
  if (backtestData && !backtestData.error) {
560
577
  const bt = backtestData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kamuira/stock-analyzer",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "preferGlobal": true,
5
5
  "description": "A股/台股综合分析工具 - 技术面+估值+基本面+消息面四维评分、批量排名、含成本回测、买卖建议",
6
6
  "main": "server.js",