测试验证完成

This commit is contained in:
rain
2026-06-20 11:20:45 +08:00
parent db8ed02602
commit b3e6f3e831
30 changed files with 110 additions and 135 deletions
+19 -10
View File
@@ -143,6 +143,12 @@
return { Authorization: "Bearer " + token };
}
function escapeJsString(value) {
return String(value == null ? "" : value)
.replace(/\\/g, "\\\\")
.replace(/'/g, "\\'");
}
// Load collection list
function loadCollections() {
const token = localStorage.getItem("token");
@@ -152,10 +158,11 @@
}
ApiClient.get(
"/api/user/collect/list?page=" +
currentPage +
"&pageSize=" +
pageSize,
ApiClient.API.mineFreeCollectList,
{
pageNum: currentPage,
pageSize: pageSize,
},
{ headers: authHeaders() },
).then(function (res) {
if (res.code === 0 && res.data) {
@@ -189,6 +196,8 @@
$grid.append(
'<div class="cxz-collect-card" data-collect-id="' +
(item.id || "") +
'" data-article-id="' +
articleId +
'">' +
'<div class="cxz-card-body">' +
'<div class="cxz-card-title"><a href="' +
@@ -200,9 +209,9 @@
"<span>" +
displayDate +
"</span>" +
'<button class="cxz-card-remove" onclick="removeCollect(this, ' +
(item.id || 0) +
')">取消收藏</button>' +
'<button class="cxz-card-remove" onclick="removeCollect(this, \'' +
escapeJsString(articleId) +
'\')">取消收藏</button>' +
"</div>" +
"</div>" +
"</div>",
@@ -210,15 +219,15 @@
});
}
function removeCollect(btn, collectId) {
function removeCollect(btn, articleId) {
layui.layer.confirm(
"确定要取消收藏吗?",
{ icon: 3, title: "提示" },
function (index) {
layui.layer.close(index);
ApiClient.post(
"/api/user/collect/delete",
{ id: collectId },
ApiClient.API.freeArticleCollect(articleId),
{},
{ headers: authHeaders() },
).then(function (res) {
if (res.code === 0) {