mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-06-11 12:49:30 +08:00
fix: 修复投票多选BUG
This commit is contained in:
@@ -151,6 +151,10 @@
|
||||
index: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
article: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -236,6 +240,12 @@
|
||||
formatJsonStr(jsonStr) {
|
||||
return jsonStr ? JSON.parse(jsonStr) : {}
|
||||
},
|
||||
handleSubmitTip() {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "请选择选项后继续"
|
||||
})
|
||||
},
|
||||
handleSubmit() {
|
||||
if (!this.vote.spec.canAnonymously) {
|
||||
uni.showModal({
|
||||
@@ -247,7 +257,8 @@
|
||||
confirmText: "复制地址",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.$utils.copyText(this.$baseApiUrl, "复制成功")
|
||||
const articleUrl = this.$baseApiUrl + (this.article?.status?.permalink ?? "")
|
||||
this.$utils.copyText(articleUrl, "原文地址复制成功")
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -296,6 +307,17 @@
|
||||
|
||||
handleSelectCheckboxOption(option) {
|
||||
if (this.vote.spec.disabled) return
|
||||
|
||||
const checkedList = this.vote.spec.options.filter(x => x.checked && x.id != option.id)
|
||||
|
||||
if (this.vote.spec.type === 'multiple' && checkedList.length >= this.vote.spec.maxVotes) {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: `最多选择 ${this.vote.spec.maxVotes} 项`
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
this.vote.spec.options.map(item => {
|
||||
if (option.id == item.id) {
|
||||
item.checked = !item.checked
|
||||
|
||||
@@ -173,7 +173,7 @@
|
||||
padding: 24rpx;
|
||||
border-radius: 12rpx;
|
||||
background-color: #ffff;
|
||||
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.075);
|
||||
box-shadow: 0rpx 2rpx 12rpx rgba(0, 0, 0, 0.035);
|
||||
overflow: hidden;
|
||||
margin-bottom: 24rpx;
|
||||
// border: 1px solid #eee;
|
||||
@@ -207,7 +207,7 @@
|
||||
box-sizing: border-box;
|
||||
padding-top: 6px;
|
||||
margin-top: 6px;
|
||||
border-top: 2rpx solid #eee;
|
||||
border-top: 2rpx solid #F7F7F7;
|
||||
|
||||
.left{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user