修改样式、功能完成,待测试
This commit is contained in:
+28
-155
@@ -11,6 +11,7 @@
|
||||
<script src="../utils/CommonUtil.js"></script>
|
||||
<link rel="stylesheet" href="../public/css/layui/css/layui.css" />
|
||||
<link rel="stylesheet" href="../public/css/public.css" />
|
||||
<link rel="stylesheet" href="../public/css/layout-fix.css" />
|
||||
<link rel="stylesheet" href="../public/css/cai.css" />
|
||||
</head>
|
||||
<body>
|
||||
@@ -83,6 +84,7 @@
|
||||
<div class="cxz-period-bar">
|
||||
<div class="cxz-period-title" id="tableTitle">预测列表</div>
|
||||
<div class="cxz-period-select">
|
||||
<button class="cxz-period-btn" data-size="5">近5期</button>
|
||||
<button class="cxz-period-btn active" data-size="10">近10期</button>
|
||||
<button class="cxz-period-btn" data-size="20">近20期</button>
|
||||
<button class="cxz-period-btn" data-size="50">近50期</button>
|
||||
@@ -92,6 +94,13 @@
|
||||
<!-- Article Table -->
|
||||
<div class="cxz-table-box">
|
||||
<table class="cxz-data-table">
|
||||
<colgroup>
|
||||
<col class="cxz-col-expert" />
|
||||
<col class="cxz-col-issue" />
|
||||
<col class="cxz-col-recommend" />
|
||||
<col class="cxz-col-rate" />
|
||||
<col class="cxz-col-action" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>专家</th>
|
||||
@@ -119,37 +128,6 @@
|
||||
<div class="cxz-pagination" id="pagination"></div>
|
||||
</div>
|
||||
|
||||
<!-- Expert Ranking -->
|
||||
<div class="cxz-ranking-box">
|
||||
<div class="cxz-ranking-header">
|
||||
<div class="cxz-ranking-title">专家排行榜</div>
|
||||
</div>
|
||||
<table class="cxz-rank-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>排名</th>
|
||||
<th>专家</th>
|
||||
<th>命中率</th>
|
||||
<th>方案数</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="rankBody">
|
||||
<tr>
|
||||
<td
|
||||
colspan="5"
|
||||
style="
|
||||
text-align: center;
|
||||
color: var(--text-muted);
|
||||
padding: 30px;
|
||||
"
|
||||
>
|
||||
加载中...
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- Footer -->
|
||||
@@ -284,7 +262,6 @@
|
||||
renderPlanFilter();
|
||||
renderTypeFilter();
|
||||
loadArticles();
|
||||
loadRanking();
|
||||
updateBreadcrumb();
|
||||
});
|
||||
$box.append(btn);
|
||||
@@ -361,7 +338,6 @@
|
||||
renderTypeFilter();
|
||||
syncCurrentUrl();
|
||||
loadArticles();
|
||||
loadRanking();
|
||||
});
|
||||
$box.append(btn);
|
||||
});
|
||||
@@ -416,7 +392,6 @@
|
||||
$(this).addClass("active");
|
||||
syncCurrentUrl();
|
||||
loadArticles();
|
||||
loadRanking();
|
||||
});
|
||||
$box.append(btn);
|
||||
});
|
||||
@@ -439,6 +414,10 @@
|
||||
return String(activeTypeId || currentTypeId || "");
|
||||
}
|
||||
|
||||
function getCurrentTypeName() {
|
||||
return $.trim($("#typeFilter .cxz-filter-btn.active").text() || "");
|
||||
}
|
||||
|
||||
function escapeText(value) {
|
||||
return CommonUtil.escapeHtml ? CommonUtil.escapeHtml(String(value || "")) : String(value || "");
|
||||
}
|
||||
@@ -467,11 +446,16 @@
|
||||
const issue = item.latestIssue || item.issue || item.expect || item.period || item.issueNo || "";
|
||||
if (!issue) return "--";
|
||||
const lotteryName = currentLottery ? currentLottery.name : item.lotteryName || item.menuName || "";
|
||||
return (lotteryName ? lotteryName + "-第" : "第") + issue + "期";
|
||||
return (lotteryName ? lotteryName + "-" : "") + issue + "期";
|
||||
}
|
||||
|
||||
function getRecommendTitle(item) {
|
||||
const currentName = getCurrentTypeName();
|
||||
return (
|
||||
currentName ||
|
||||
item.playName ||
|
||||
item.typeName ||
|
||||
item.menuName ||
|
||||
item.latestTitle ||
|
||||
item.title ||
|
||||
item.articleTitle ||
|
||||
@@ -518,26 +502,6 @@
|
||||
return "--";
|
||||
}
|
||||
|
||||
function getRatePercentText(item) {
|
||||
const raw =
|
||||
item.hitRate ??
|
||||
item.successRate ??
|
||||
item.correctRate ??
|
||||
item.winRate ??
|
||||
item.rate ??
|
||||
"";
|
||||
if (raw !== "" && raw !== null && raw !== undefined) {
|
||||
if (String(raw).indexOf("%") >= 0) return String(raw);
|
||||
const value = Number(raw);
|
||||
if (Number.isFinite(value)) {
|
||||
return (value > 0 && value <= 1 ? value * 100 : value).toFixed(2) + "%";
|
||||
}
|
||||
}
|
||||
const hit = Number(item.correctCount ?? item.hitCount ?? item.hit ?? 0);
|
||||
const total = Number(item.totalCount ?? item.total ?? item.articleCount ?? 0);
|
||||
return total > 0 ? ((hit / total) * 100).toFixed(2) + "%" : "0.00%";
|
||||
}
|
||||
|
||||
function buildCaiinfoUrl(item) {
|
||||
const params = new URLSearchParams();
|
||||
params.set("createBy", getExpertId(item));
|
||||
@@ -593,20 +557,25 @@
|
||||
const periodText = getIssueText(item);
|
||||
const predictHtml = getRecommendTitle(item);
|
||||
const avatarHtml = avatar
|
||||
? '<img src="' + escapeText(avatar) + '" class="table-img" />'
|
||||
: '<span class="cxz-expert-avatar">' +
|
||||
? '<img src="' + escapeText(avatar) + '" class="table-img" alt="' + escapeText(expertName) + '" />'
|
||||
: '<span class="cxz-table-avatar-placeholder">' +
|
||||
escapeText(expertName).charAt(0) +
|
||||
"</span>";
|
||||
const linkUrl = buildCaiinfoUrl(item);
|
||||
const rankNo = (currentPage - 1) * currentRowPageSize + i + 1;
|
||||
$body.append(
|
||||
"<tr>" +
|
||||
'<td><a href="' +
|
||||
escapeText(linkUrl) +
|
||||
'" class="cxz-expert-cell">' +
|
||||
'<span class="cxz-expert-rank">' +
|
||||
rankNo +
|
||||
"</span>" +
|
||||
avatarHtml +
|
||||
"<span>" +
|
||||
'<span class="cxz-expert-name">' +
|
||||
escapeText(expertName) +
|
||||
"</span></a></td>" +
|
||||
"</span>" +
|
||||
"</a></td>" +
|
||||
"<td>" +
|
||||
escapeText(periodText) +
|
||||
"</td>" +
|
||||
@@ -655,101 +624,6 @@
|
||||
});
|
||||
}
|
||||
|
||||
// Load expert ranking
|
||||
function loadRanking() {
|
||||
const typeId = getCurrentTypeId();
|
||||
if (!typeId) {
|
||||
$("#rankBody").html(
|
||||
'<tr><td colspan="5" style="text-align:center;color:var(--text-muted);padding:30px;">暂无数据</td></tr>',
|
||||
);
|
||||
return;
|
||||
}
|
||||
ApiClient.get(ApiClient.API.payArticleExpertRank, {
|
||||
menuId: typeId,
|
||||
issueCount: 50,
|
||||
pageNum: 1,
|
||||
pageSize: currentRowPageSize,
|
||||
}).then(function (res) {
|
||||
if (ApiClient.isSuccess(res) && ApiClient.pickData(res, null)) {
|
||||
const data = ApiClient.pickData(res, {}) || {};
|
||||
renderRanking(data.records || data.rows || ApiClient.asArray(data));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function renderRanking(list) {
|
||||
const $body = $("#rankBody");
|
||||
$body.empty();
|
||||
if (!list || list.length === 0) {
|
||||
$body.html(
|
||||
'<tr><td colspan="5" style="text-align:center;color:var(--text-muted);padding:30px;">暂无数据</td></tr>',
|
||||
);
|
||||
return;
|
||||
}
|
||||
const experts = list
|
||||
.map(function (item) {
|
||||
const total = Number(item.totalCount || item.total || 0);
|
||||
const hit = Number(item.correctCount || item.hit || 0);
|
||||
const rateText = getRatePercentText(item);
|
||||
const hitText = getCorrectDisplayText(item);
|
||||
const rateNum = rateText
|
||||
? parseFloat(String(rateText).replace("%", ""))
|
||||
: total > 0
|
||||
? (hit / total) * 100
|
||||
: 0;
|
||||
return {
|
||||
raw: item,
|
||||
name: getExpertName(item),
|
||||
createBy: getExpertId(item),
|
||||
total: total || item.articleCount || item.totalCount || 0,
|
||||
hit,
|
||||
hitText,
|
||||
rate: Number.isFinite(rateNum) ? rateNum : 0,
|
||||
rank: item.rank,
|
||||
accountType: item.accountType,
|
||||
};
|
||||
})
|
||||
.sort(function (a, b) {
|
||||
return (a.rank || 9999) - (b.rank || 9999) || b.rate - a.rate;
|
||||
})
|
||||
.slice(0, 10);
|
||||
|
||||
$.each(experts, function (i, exp) {
|
||||
const rate = exp.rate.toFixed(1);
|
||||
const badgeClass =
|
||||
i === 0
|
||||
? "cxz-rank-1"
|
||||
: i === 1
|
||||
? "cxz-rank-2"
|
||||
: i === 2
|
||||
? "cxz-rank-3"
|
||||
: "cxz-rank-n";
|
||||
$body.append(
|
||||
"<tr>" +
|
||||
'<td><span class="cxz-rank-badge ' +
|
||||
badgeClass +
|
||||
'">' +
|
||||
(i + 1) +
|
||||
"</span></td>" +
|
||||
'<td><a href="' +
|
||||
escapeText(buildCaiinfoUrl(exp.raw)) +
|
||||
'" class="cxz-expert-link">' +
|
||||
escapeText(exp.name) +
|
||||
"</a></td>" +
|
||||
'<td><span style="color:#de2103;font-weight:700;">' +
|
||||
escapeText(exp.hitText !== "--" ? exp.hitText : rate + "%") +
|
||||
"</span></td>" +
|
||||
"<td>" +
|
||||
exp.total +
|
||||
"</td>" +
|
||||
'<td><a href="' +
|
||||
escapeText(buildCaiinfoUrl(exp.raw)) +
|
||||
'" class="cxz-btn-buy">查看</a></td>' +
|
||||
"</tr>",
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// Period selector
|
||||
$(document).on("click", ".cxz-period-btn", function () {
|
||||
$(".cxz-period-btn").removeClass("active");
|
||||
@@ -765,7 +639,6 @@
|
||||
CommonUtil.loadPageConfig();
|
||||
setTimeout(function () {
|
||||
loadArticles();
|
||||
loadRanking();
|
||||
updateBreadcrumb();
|
||||
}, 300);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user