diff --git a/components/article-vote/article-vote.vue b/components/article-vote/article-vote.vue index 607e703..e6d97e3 100644 --- a/components/article-vote/article-vote.vue +++ b/components/article-vote/article-vote.vue @@ -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 diff --git a/components/vote-card/vote-card.vue b/components/vote-card/vote-card.vue index e389731..2afd328 100644 --- a/components/vote-card/vote-card.vue +++ b/components/vote-card/vote-card.vue @@ -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{ diff --git a/pagesA/article-detail/article-detail.vue b/pagesA/article-detail/article-detail.vue index 9aa07d7..313bd14 100644 --- a/pagesA/article-detail/article-detail.vue +++ b/pagesA/article-detail/article-detail.vue @@ -106,24 +106,32 @@ - - - + + + 提示区域已收起,点击显示 + @@ -325,11 +333,12 @@ import RestrictReadSkeleton from "@/components/restrict-read-skeleton/restrict-read-skeleton.vue"; import TmImages from "@/tm-vuetify/components/tm-images/tm-images.vue"; import TmInput from "@/tm-vuetify/components/tm-input/tm-input.vue"; - import pluginAvailable from "@/common/mixins/pluginAvailable.js" + import pluginAvailableMixin from "@/common/mixins/pluginAvailable.js" + import PluginUnavailable from '@/components/plugin-unavailable/plugin-unavailable.vue' let videoAd = null; export default { - mixins:[pluginAvailable], + mixins: [pluginAvailableMixin], components: { TmInput, TmImages, @@ -347,7 +356,8 @@ rCanvas, barrage, commentModal, - ArticleVote + ArticleVote, + PluginUnavailable }, data() { return { @@ -454,7 +464,7 @@ this.setPluginId(this.NeedPluginIds.PluginVote) this.setPluginError("阿偶,检测到当前插件没有安装或者启用,无法使用投票功能,请联系管理员") await this.checkPluginAvailable() - + this.fnSetPageTitle('文章加载中...'); this.queryParams.name = e.name; this.fnGetData(); @@ -1444,18 +1454,19 @@ .vote-opra { font-size: 24rpx; font-weight: normal; - color:#999; + color: #999; } - .vote-tip{ - margin-top:12rpx; - padding:50rpx 24rpx; - background:#F1F5F9; - color:#666; - font-size:24rpx; - border-radius:12rpx; + + .vote-tip { + margin-top: 12rpx; + padding: 50rpx 24rpx; + background: #F1F5F9; + color: #666; + font-size: 24rpx; + border-radius: 12rpx; text-align: center; } - + .markdown-wrap { overflow: hidden; border-radius: 12rpx; diff --git a/pagesA/vote-detail/vote-detail.vue b/pagesA/vote-detail/vote-detail.vue index 3e558a2..517398b 100644 --- a/pagesA/vote-detail/vote-detail.vue +++ b/pagesA/vote-detail/vote-detail.vue @@ -11,11 +11,9 @@ - + 投票信息 - - + 投票类型:单选 @@ -34,9 +32,6 @@ model="fill">匿名 不匿名 - - 投票说明:{{ vote.spec.remark||"暂无说明" }} - 截止时间:{{ {d: vote.spec.endDate, f: 'yyyy-MM-dd HH:mm'} | formatTime }} @@ -49,29 +44,14 @@ {{ vote.spec.title }} + + {{ vote.spec.remark }} + - + 投票选项 (最多选择 {{ vote.spec.maxVotes }} 项) - - - - - - - @@ -181,6 +122,7 @@ {{ vote.stats.voteCount }} 人已参与 + 已投票 @@ -191,6 +133,8 @@ :block="true" @click="handleSubmit()">不允许匿名投票 您已参与投票 + 提交投票(请选择选项) 提交投票 @@ -203,10 +147,6 @@ import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue'; import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue'; import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue'; - import tmGroupradio from '@/tm-vuetify/components/tm-groupradio/tm-groupradio.vue'; - import tmRadio from '@/tm-vuetify/components/tm-radio/tm-radio.vue'; - import tmGroupcheckbox from '@/tm-vuetify/components/tm-groupcheckbox/tm-groupcheckbox.vue'; - import tmCheckbox from '@/tm-vuetify/components/tm-checkbox/tm-checkbox.vue'; import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue'; import { @@ -224,10 +164,6 @@ tmSkeleton, tmEmpty, tmButton, - tmGroupradio, - tmRadio, - tmGroupcheckbox, - tmCheckbox, tmTags, }, data() { @@ -241,11 +177,6 @@ vote: null, submitForm: { voteData: [] - }, - votedSelected: { - checkbox: [], - radio: [], - pk: [] } }; }, @@ -350,6 +281,12 @@ formatJsonStr(jsonStr) { return jsonStr ? JSON.parse(jsonStr) : {} }, + handleSubmitTip(){ + uni.showToast({ + icon: "none", + title: "请选择选项后继续" + }) + }, handleSubmit() { if (!this.vote.spec.canAnonymously) { uni.showModal({ @@ -372,9 +309,6 @@ title: "正在保存..." }) - // 使用简单版 - this.submitForm.voteData = this.vote.spec.options.filter(x => x.checked).map(item => item.id) - this.$httpApi.v2 .submitVote(this.name, this.submitForm, this.vote.spec.canAnonymously) .then(res => { @@ -410,15 +344,30 @@ item.checked = false } }) + + this.submitForm.voteData = this.vote.spec.options.filter(x => x.checked).map(item => item.id) }, 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 } }) + + this.submitForm.voteData = this.vote.spec.options.filter(x => x.checked).map(item => item.id) } } }; @@ -469,6 +418,17 @@ margin-bottom: 24rpx; } + .vote-info-card { + .vote-card-body { + font-size: 28rpx; + gap: 12rpx 0; + background: #F3F4F6; + color: #3F3F3F; + padding: 24rpx; + border-radius: 12rpx; + } + } + .vote-card-head { margin-bottom: 12rpx; display: flex; @@ -620,20 +580,26 @@ } .sub-content { + margin-bottom: 12rpx; + padding: 12rpx 0; font-weight: bold; color: #2B2F33; - padding: 12rpx 0; - font-size: 32rpx; - margin-bottom: 12rpx; + font-size: 30rpx; } + .sub-remark { + margin-bottom: 36rpx; + padding-top: 12rpx; + color: #3F3F3F; + font-size: 28rpx; + } .sub-title { box-sizing: border-box; position: relative; margin-bottom: 12rpx; padding-left: 24rpx; - font-weight: bold; + // font-weight: bold; font-size: 30rpx; &:before {