From a6e5763ffc610bd2af4caa2bd31fe6ac5497dc6a Mon Sep 17 00:00:00 2001 From: H1d3rOne Date: Sun, 8 Mar 2026 05:25:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E7=9C=8B=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E5=BE=97=E9=87=91=E5=B8=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 每日可观看5次视频,- 每次观看获得3金币 - 显示今日剩余观看次数 - 记录观看历史到金币记录 --- xuan-deduct-uniapp/src/pages/mine/coins.vue | 61 ++++++++++++++++++++- xuan-deduct-uniapp/src/pages/mine/mine.vue | 9 ++- 2 files changed, 66 insertions(+), 4 deletions(-) diff --git a/xuan-deduct-uniapp/src/pages/mine/coins.vue b/xuan-deduct-uniapp/src/pages/mine/coins.vue index 24f730f..3984e83 100644 --- a/xuan-deduct-uniapp/src/pages/mine/coins.vue +++ b/xuan-deduct-uniapp/src/pages/mine/coins.vue @@ -39,6 +39,21 @@ 其他任务 + + + + 🎬 + + + 看视频得金币 + +3金币/次 (今日剩余{{ videoCount }}次) + + + + {{ videoCount > 0 ? '观看' : '已用完' }} + + + @@ -92,7 +107,8 @@ export default { signedToday: false, streakDays: 0, weekDays: [], - records: [] + records: [], + videoCount: 5 } }, computed: { @@ -104,6 +120,7 @@ export default { this.loadCoins() this.initWeekProgress() this.loadRecords() + this.loadVideoCount() }, onShareAppMessage() { return { @@ -211,6 +228,44 @@ export default { menus: ['shareAppMessage'] }) }, + loadVideoCount() { + const today = this.formatDate(new Date()) + const lastVideoDate = uni.getStorageSync('lastVideoDate') + if (lastVideoDate === today) { + this.videoCount = uni.getStorageSync('videoCount') || 0 + } else { + this.videoCount = 5 + uni.setStorageSync('lastVideoDate', today) + uni.setStorageSync('videoCount', 5) + } + }, + watchVideo() { + if (this.videoCount <= 0) { + uni.showToast({ title: '今日观看次数已用完', icon: 'none' }) + return + } + + uni.showLoading({ title: '加载视频中...' }) + + setTimeout(() => { + uni.hideLoading() + + this.videoCount-- + this.coins += 3 + + uni.setStorageSync('userCoins', this.coins) + uni.setStorageSync('videoCount', this.videoCount) + + this.records.unshift({ + name: '观看视频', + amount: 3, + time: this.formatTime(new Date()) + }) + this.saveRecords() + + uni.showToast({ title: '+3金币', icon: 'success' }) + }, 2000) + }, formatDate(date) { const y = date.getFullYear() const m = String(date.getMonth() + 1).padStart(2, '0') @@ -467,6 +522,10 @@ page { border-radius: 32rpx; } +.task-btn.disabled { + background: #D1D5DB; +} + .task-btn-text { font-size: 26rpx; color: #ffffff; diff --git a/xuan-deduct-uniapp/src/pages/mine/mine.vue b/xuan-deduct-uniapp/src/pages/mine/mine.vue index b12cf5a..f71ae4e 100644 --- a/xuan-deduct-uniapp/src/pages/mine/mine.vue +++ b/xuan-deduct-uniapp/src/pages/mine/mine.vue @@ -173,13 +173,15 @@ page { font-size: 36rpx; font-weight: 700; color: #ffffff; - line-height: 1.2; } .vip-tag { margin-left: 8rpx; - padding: 2rpx 10rpx; + padding: 0 8rpx; border-radius: 12rpx; + height: 28rpx; + display: inline-flex; + align-items: flex-start; } .vip-tag.normal { @@ -203,9 +205,10 @@ page { } .vip-tag-text { - font-size: 18rpx; + font-size: 16rpx; font-weight: 500; color: #ffffff; + line-height: 28rpx; } .user-coins {