feat: 品种下拉统一展示推荐列表,与下方品种推荐表一致。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-25 13:01:20 +08:00
parent d127a53870
commit fc425c0e9f
5 changed files with 100 additions and 7 deletions
+14 -4
View File
@@ -1,8 +1,12 @@
(function () {
function formatSub(item) {
return '同花顺 ' + item.ths_code +
var sub = '同花顺 ' + item.ths_code +
(item.market_code ? ' · ' + item.market_code : '') +
' · ' + (item.exchange || '');
if (item.max_lots != null && item.max_lots > 0) {
sub += ' · 最大 ' + item.max_lots + ' 手';
}
return sub;
}
function formatInputLabel(item) {
@@ -132,17 +136,23 @@
return;
}
if (mainsLoading) {
dropdown.innerHTML = '<div class="symbol-option">正在识别主力合约…</div>';
dropdown.innerHTML = '<div class="symbol-option">正在加载推荐品种…</div>';
dropdown.classList.add('show');
return;
}
mainsLoading = true;
dropdown.innerHTML = '<div class="symbol-option">正在识别主力合约…</div>';
dropdown.innerHTML = '<div class="symbol-option">正在加载推荐品种…</div>';
dropdown.classList.add('show');
fetch('/api/symbols/mains')
fetch('/api/symbols/recommended')
.then(function (r) { return r.json(); })
.then(function (groups) {
mainsCache = groups;
if (!groups.length) {
dropdown.innerHTML =
'<div class="symbol-option">当前资金下暂无推荐品种,可输入合约代码搜索</div>';
dropdown.classList.add('show');
return;
}
showMarketMains(filterQ, onEmpty);
})
.catch(function () {