feat(小程序): 资讯详情点赞/分享落库 + 微信式评论区(回复嵌套/评论点赞/折叠) + 动作条图标数字弱化恒显0 + 富文本媒体限宽 + 修hooks越界(#310)
This commit is contained in:
@@ -31,8 +31,26 @@ export async function getComments(id) {
|
||||
return Array.isArray(r?.items) ? r.items : [];
|
||||
}
|
||||
|
||||
/** 发表留言(需登录) */
|
||||
export async function addComment(id, content) {
|
||||
const r = await request('POST', `/opc/content/${id}/comments`, { content }, true);
|
||||
/** 发表留言/回复(需登录);replyTo 为父评论 id(空=顶层留言) */
|
||||
export async function addComment(id, content, replyTo = '') {
|
||||
const r = await request('POST', `/opc/content/${id}/comments`, { content, reply_to: replyTo }, true);
|
||||
return r?.comment || null;
|
||||
}
|
||||
|
||||
/** 评论点赞/取消(登录,一人一赞);返回 {liked, like_count} */
|
||||
export async function toggleCommentLike(commentId) {
|
||||
const r = await request('POST', `/opc/comments/${commentId}/like`, {}, true);
|
||||
return r && r.liked !== undefined ? r : (r && r.data) || r;
|
||||
}
|
||||
|
||||
/** 点赞/取消点赞(登录);返回 {liked, like_count} */
|
||||
export async function toggleLike(id) {
|
||||
const r = await request('POST', `/opc/content/${id}/like`, {}, true);
|
||||
return r && r.liked !== undefined ? r : (r && r.data) || r;
|
||||
}
|
||||
|
||||
/** 分享计数 +1(公开,可重复分享);返回 {share_count} */
|
||||
export async function reportShare(id) {
|
||||
const r = await request('POST', `/opc/content/${id}/share`, {}, false).catch(() => null);
|
||||
return r || null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user