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 @@
+
+
+
+
+
+
+
+
+
+
{{ row.nickname || '未知用户' }}
+
{{ row.id }}
+
+
+
+
+
+
+
+
+
+
+
+
+
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 @@
+
+
+
+
+ {{ targetName }}
+
+
+
+
+
+
+ {{ item.nickname || '未知用户' }}
+
+
+
+
+
+
+
+
+
+
+
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)
+ },
},
}