From 97f2e6a17c203ae94191e1e8059a7b60307f89bc Mon Sep 17 00:00:00 2001 From: zzc <1761997216@qq.com> Date: Mon, 15 Jun 2026 22:28:39 +0800 Subject: [PATCH] fix: pk comment --- src/api/rating/pk.js | 14 +- .../pk/list/components/PkParticipantList.vue | 133 +++++++++++++++++ .../rating/pk/list/components/PkVoteEdit.vue | 138 ++++++++++++++++++ src/views/rating/pk/list/index.vue | 34 ++++- 4 files changed, 315 insertions(+), 4 deletions(-) create mode 100644 src/views/rating/pk/list/components/PkParticipantList.vue create mode 100644 src/views/rating/pk/list/components/PkVoteEdit.vue diff --git a/src/api/rating/pk.js b/src/api/rating/pk.js index c20f9e0..7ebd506 100644 --- a/src/api/rating/pk.js +++ b/src/api/rating/pk.js @@ -18,12 +18,24 @@ export function getList(data) { */ export function getParticipantList(data) { return request({ - url: 'management/api/rating/pk/participant', + url: 'management/api/rating/pk/participants', method: 'get', params: data, }) } +/** + * pk 投票 + * @param { pkId: string, itemId: string, userId: string } data + */ +export function vote(data) { + return request({ + url: 'management/api/rating/pk/vote', + method: 'post', + data, + }) +} + /** * 生成PK赛 * @param {topicId: string, leftItemId: string, rightItemId: string} data diff --git a/src/views/rating/pk/list/components/PkParticipantList.vue b/src/views/rating/pk/list/components/PkParticipantList.vue new file mode 100644 index 0000000..826f8fa --- /dev/null +++ b/src/views/rating/pk/list/components/PkParticipantList.vue @@ -0,0 +1,133 @@ + + + + + diff --git a/src/views/rating/pk/list/components/PkVoteEdit.vue b/src/views/rating/pk/list/components/PkVoteEdit.vue new file mode 100644 index 0000000..dd363c5 --- /dev/null +++ b/src/views/rating/pk/list/components/PkVoteEdit.vue @@ -0,0 +1,138 @@ + + + diff --git a/src/views/rating/pk/list/index.vue b/src/views/rating/pk/list/index.vue index 374bc30..1904bac 100644 --- a/src/views/rating/pk/list/index.vue +++ b/src/views/rating/pk/list/index.vue @@ -51,9 +51,18 @@ {{ row.leftItemName ? row.leftItemName : '-' }}
- {{ row.leftVoteCount || 0 }} 票 + + {{ row.leftVoteCount || 0 }} 票 + ({{ calculateRate(row.leftVoteCount, row.voteCount) }})
+
+ 支持 +
VS
@@ -63,9 +72,18 @@ {{ row.rightItemName ? row.rightItemName : '-' }}
- {{ row.rightVoteCount || 0 }} 票 + + {{ row.rightVoteCount || 0 }} 票 + ({{ calculateRate(row.rightVoteCount, row.voteCount) }})
+
+ 支持 +
@@ -89,6 +107,8 @@ /> + + @@ -99,10 +119,12 @@ import { formatTime } from '@/utils' import { getThumbUrl } from '@/utils/blessing' import PkGenerate from './components/PkGenerate' + import PkParticipantList from './components/PkParticipantList' + import PkVoteEdit from './components/PkVoteEdit' export default { name: 'RatingPkListIndex', - components: { PkGenerate }, + components: { PkGenerate, PkParticipantList, PkVoteEdit }, directives: { loadmore: { bind(el, binding) { @@ -253,6 +275,12 @@ const rate = ((count || 0) / total) * 100 return `${rate.toFixed(1)}%` }, + handleViewParticipants(pkId, chooseItemId, itemName) { + this.$refs['participantList'].show(pkId, chooseItemId, itemName) + }, + handleVote(pkId, itemId, itemName) { + this.$refs['voteEdit'].showEdit(pkId, itemId, itemName) + }, }, }