From e74403f72a69fc89b2c698397063fe7d7919aa90 Mon Sep 17 00:00:00 2001 From: zpc Date: Sun, 8 Jun 2025 20:23:01 +0800 Subject: [PATCH 1/3] 4444 --- App.vue | 484 +- common/audio.js | 40 + common/config.js | 2 +- common/platform/AppPlatform.js | 35 +- common/platform/BasePlatform.js | 3 +- common/platform/H5Platform.js | 10 +- common/platform/MiniProgramPlatform.js | 7 +- common/platform/WebAppPlatform.js | 1 - components/detail-lucky/detail-bao-xiang.vue | 106 + .../detail-lucky/detail-grand-prize.vue | 15 +- .../detail-lucky/detail-lucky-canvas.vue | 23 +- components/detail-lucky/detail-lucky.vue | 27 +- components/detail-results/detail-results.vue | 341 ++ pages.json | 18 - pages/hegui/hegui.vue | 1 - pages/mall/goods_info.vue | 9 - pages/mall/index.vue | 15 +- pages/shouye/detail.vue | 64 +- pages/shouye/detail_wuxian.vue | 4029 ++++++++--------- pages/shouye/index.vue | 4 - pages/user/my_coupon copy.vue | 475 -- pages/user/sy_jl.vue | 223 - pages/user/tui-guang-old.vue | 539 --- pages/user/tui-guang.vue | 2 +- 24 files changed, 2788 insertions(+), 3685 deletions(-) create mode 100644 common/audio.js create mode 100644 components/detail-lucky/detail-bao-xiang.vue create mode 100644 components/detail-results/detail-results.vue delete mode 100644 pages/mall/goods_info.vue delete mode 100644 pages/user/my_coupon copy.vue delete mode 100644 pages/user/sy_jl.vue delete mode 100644 pages/user/tui-guang-old.vue diff --git a/App.vue b/App.vue index eb1fc67..5c197ab 100644 --- a/App.vue +++ b/App.vue @@ -1,264 +1,268 @@ \ No newline at end of file diff --git a/common/audio.js b/common/audio.js new file mode 100644 index 0000000..559feb7 --- /dev/null +++ b/common/audio.js @@ -0,0 +1,40 @@ +class AudioManager { + constructor(openBgm, slotBgm, csBgm, baoXiangBgm) { + this.openBgm = openBgm; + this.slotBgm = slotBgm; + this.csBgm = csBgm; + this.baoXiangBgm = baoXiangBgm; + } + stop() { + this.baoXiangBgm.stop(); + this.csBgm.stop(); + this.slotBgm.stop(); + this.openBgm.stop(); + } + + playOpenBgm() { + this.stop(); + this.openBgm.seek(0); + this.openBgm.play(); + } + + playSlotBgm() { + this.stop(); + this.slotBgm.seek(0); + this.slotBgm.play(); + } + + playCsBgm() { + this.stop(); + this.csBgm.seek(0); + this.csBgm.play(); + } + + playBaoXiangBgm() { + this.stop(); + this.baoXiangBgm.seek(0); + this.baoXiangBgm.play(); + } +} + +export default AudioManager; diff --git a/common/config.js b/common/config.js index 28313d7..54edf6a 100644 --- a/common/config.js +++ b/common/config.js @@ -8,7 +8,7 @@ import RequestManager from '@/common/request.js' let configData = null; let isLoading = false; let loadPromise = null; -const wx_version = "111"; +const wx_version = "113"; // 白名单页面(不需要登录即可访问) export const whiteList = [ diff --git a/common/platform/AppPlatform.js b/common/platform/AppPlatform.js index b8d0bff..5f2dd76 100644 --- a/common/platform/AppPlatform.js +++ b/common/platform/AppPlatform.js @@ -20,41 +20,9 @@ class AppPlatform extends BasePlatform { getPayData(url, data) { return data; } - // async getPlatformConfig() { - // console.log("开启动态获取数据。。。。。。。。"); - // const res = await getPlatform(); - // if (this.config != null) { - // if (this.config.isCheck != res.isCheck) { - // uni.setStorageSync('platformConfig', res); - // plus.runtime.restart(); - // } - // } - // this.config = res; - // uni.setStorageSync('platformConfig', res); - // } - // async getConfig() { - // // return new Promise((resolve, reject) => { - // if (this.config) { - // return this.config; - // } - // if (uni.getStorageSync('platformConfig')) { - // this.config = uni.getStorageSync('platformConfig'); - // this.getPlatformConfig(); - // return this.config; - // } - // this.config = { - // isCheck: true, - // isWebPay: false, - // version: '1.0.0', - // }; - // this.getPlatformConfig(); - // // const res = await getPlatform(); - // // this.config = res; - // return this.config; - // } AppLaunch(options) { console.log("AppLaunch", options); - // uni.hideTabBar({}) + this.getConfig().then(res => { console.log("AppLaunch", res); if (res.isCheck) { @@ -96,7 +64,6 @@ class AppPlatform extends BasePlatform { getOrderNo(event) { return new Promise((resolve, reject) => { - resolve(null); }); } diff --git a/common/platform/BasePlatform.js b/common/platform/BasePlatform.js index 0c8313a..0a4579c 100644 --- a/common/platform/BasePlatform.js +++ b/common/platform/BasePlatform.js @@ -19,7 +19,8 @@ class BasePlatform { } async getConfig() { // return new Promise((resolve, reject) => { - if (this.config) { + console.log("获取配置", this.config); + if (this.config != null) { return this.config; } const res = await getPlatform(); diff --git a/common/platform/H5Platform.js b/common/platform/H5Platform.js index 27e647c..7a87c7d 100644 --- a/common/platform/H5Platform.js +++ b/common/platform/H5Platform.js @@ -2,7 +2,7 @@ import BasePlatform from './BasePlatform'; import eruda from 'eruda'; import { parseQueryString } from '@/common/util'; - + class H5Platform extends BasePlatform { constructor() { @@ -14,6 +14,7 @@ class H5Platform extends BasePlatform { if (erudaInstance != null && erudaInstance != "") { this.startDeb(); } + // eruda.init(); } getPayData(url, data) { @@ -144,7 +145,6 @@ class H5Platform extends BasePlatform { if (query['version'] != null) { uni.setStorageSync('version', query['version']); } - // if(){} if (query['method'] != null && query['method'] == "alipay.trade.wap.pay.return" && query[ 'out_trade_no'] != null) { //支付宝跳转过来的 @@ -169,6 +169,12 @@ class H5Platform extends BasePlatform { window.location.href = url; } } + + if (window.location.pathname == "/" || window.location.pathname == "/pages/index/index") { + uni.switchTab({ + url: '/pages/shouye/index' + }); + } } getOrderNo(event) { return new Promise((resolve, reject) => { diff --git a/common/platform/MiniProgramPlatform.js b/common/platform/MiniProgramPlatform.js index ccd2ce2..c3df34c 100644 --- a/common/platform/MiniProgramPlatform.js +++ b/common/platform/MiniProgramPlatform.js @@ -15,7 +15,7 @@ class MiniProgramPlatform extends BasePlatform { super(); this.code = 'MP-WEIXIN'; this.env = 'miniProgram'; - + } getPayData(url, data) { @@ -212,6 +212,11 @@ class MiniProgramPlatform extends BasePlatform { updateManager.onUpdateFailed(function (res) { // 新的版本下载失败 }); + if (options != null && options.path == "pages/index/index") { + uni.switchTab({ + url: '/pages/shouye/index' + }); + } } async getOrderNo(event) { return new Promise(async (resolve, reject) => { diff --git a/common/platform/WebAppPlatform.js b/common/platform/WebAppPlatform.js index aae59e5..4e2b8ce 100644 --- a/common/platform/WebAppPlatform.js +++ b/common/platform/WebAppPlatform.js @@ -36,7 +36,6 @@ class WebAppPlatform extends H5Platform { // alert(`请手动分享:${url}`); } - downloadFile(url) { return new Promise((resolve, reject) => { try { diff --git a/components/detail-lucky/detail-bao-xiang.vue b/components/detail-lucky/detail-bao-xiang.vue new file mode 100644 index 0000000..96a9ed6 --- /dev/null +++ b/components/detail-lucky/detail-bao-xiang.vue @@ -0,0 +1,106 @@ + + + + + \ No newline at end of file diff --git a/components/detail-lucky/detail-grand-prize.vue b/components/detail-lucky/detail-grand-prize.vue index 50bf40f..5e89ab2 100644 --- a/components/detail-lucky/detail-grand-prize.vue +++ b/components/detail-lucky/detail-grand-prize.vue @@ -55,25 +55,14 @@ export default { this.isFadingOut = false; // 重置淡出状态 this.webpUrl = "https://image.zfunbox.cn/static/image/lucky/grand.webp?v=" + new Date().getTime(); - - if (this.bgmCtx && this.bgmCtx.csBgm) { - console.log('播放超神音乐'); - this.bgmCtx.slotBgm.stop(); - this.bgmCtx.csBgm.stop(); - this.bgmCtx.csBgm.seek(0); - this.bgmCtx.csBgm.play(); - } - + this.audioManager.playCsBgm(); // 设置动画结束后的淡出效果 setTimeout(() => { // 开始淡出动画 this.isFadingOut = true; - // 等待淡出动画完成后再隐藏组件 setTimeout(() => { - if (this.bgmCtx && this.bgmCtx.csBgm) { - this.bgmCtx.csBgm.pause(); - } + this.audioManager.stop(); this.isVisible = false; this.$emit("end"); }, 400); // 淡出动画持续800ms diff --git a/components/detail-lucky/detail-lucky-canvas.vue b/components/detail-lucky/detail-lucky-canvas.vue index b212858..030758c 100644 --- a/components/detail-lucky/detail-lucky-canvas.vue +++ b/components/detail-lucky/detail-lucky-canvas.vue @@ -7,24 +7,22 @@ - + 动画结果因设备差异可能会显示异常,获得赏品以(恭喜获得)结果为准 跳过动画 - - + + diff --git a/pages.json b/pages.json index df8391e..c727979 100644 --- a/pages.json +++ b/pages.json @@ -116,14 +116,6 @@ "navigationStyle": "custom" } }, - { - "path": "pages/user/bi_jl", - "style": { - "navigationStyle": "custom", - "navigationBarTitleText": "星钻记录", - "navigationBarTextStyle": "black" - } - }, { "path": "pages/user/jf_jl", "style": { @@ -132,16 +124,6 @@ "navigationBarTextStyle": "black" } }, - { - "path": "pages/user/sy_jl", - "style": { - "navigationBarBackgroundColor": "#222222", - "navigationBarTitleText": "奖励明细", - "navigationBarTextStyle": "black", - "navigationStyle": "custom" - } - }, - { "path": "pages/user/vip", "style": { diff --git a/pages/hegui/hegui.vue b/pages/hegui/hegui.vue index 603a9ce..b51d3f9 100644 --- a/pages/hegui/hegui.vue +++ b/pages/hegui/hegui.vue @@ -187,7 +187,6 @@ 发货确认单 - diff --git a/pages/mall/goods_info.vue b/pages/mall/goods_info.vue deleted file mode 100644 index 2b49cfd..0000000 --- a/pages/mall/goods_info.vue +++ /dev/null @@ -1,9 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/mall/index.vue b/pages/mall/index.vue index 79f7f94..5e3b4a2 100644 --- a/pages/mall/index.vue +++ b/pages/mall/index.vue @@ -69,7 +69,8 @@ - + 微信支付 @@ -79,7 +80,8 @@ - + {{ $config.getAppSetting('currency2_name') }} @@ -134,10 +136,6 @@ - - - - + + \ No newline at end of file diff --git a/pages/shouye/index.vue b/pages/shouye/index.vue index 3959fa5..4baf1e6 100644 --- a/pages/shouye/index.vue +++ b/pages/shouye/index.vue @@ -120,13 +120,9 @@ - - - - diff --git a/pages/user/my_coupon copy.vue b/pages/user/my_coupon copy.vue deleted file mode 100644 index 76e00c7..0000000 --- a/pages/user/my_coupon copy.vue +++ /dev/null @@ -1,475 +0,0 @@ - - - - - diff --git a/pages/user/sy_jl.vue b/pages/user/sy_jl.vue deleted file mode 100644 index ad9ad0c..0000000 --- a/pages/user/sy_jl.vue +++ /dev/null @@ -1,223 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/user/tui-guang-old.vue b/pages/user/tui-guang-old.vue deleted file mode 100644 index 4aba6a1..0000000 --- a/pages/user/tui-guang-old.vue +++ /dev/null @@ -1,539 +0,0 @@ - - - - - diff --git a/pages/user/tui-guang.vue b/pages/user/tui-guang.vue index 2481a9c..73ca99c 100644 --- a/pages/user/tui-guang.vue +++ b/pages/user/tui-guang.vue @@ -32,7 +32,7 @@ - + 奖励总额 {{ commission }} From e55ce53e045c4c20cd7112a55eee3ff8455c9c40 Mon Sep 17 00:00:00 2001 From: zpc Date: Sun, 8 Jun 2025 22:54:24 +0800 Subject: [PATCH 2/3] 4444 --- common/platform/MiniProgramPlatform.js | 15 +- .../detail-lucky/detail-lucky-canvas.vue | 382 +++--------------- components/detail-lucky/detail-lucky.vue | 2 +- pages/index/index.vue | 271 +++++++------ 4 files changed, 212 insertions(+), 458 deletions(-) diff --git a/common/platform/MiniProgramPlatform.js b/common/platform/MiniProgramPlatform.js index c3df34c..b1a884d 100644 --- a/common/platform/MiniProgramPlatform.js +++ b/common/platform/MiniProgramPlatform.js @@ -212,11 +212,16 @@ class MiniProgramPlatform extends BasePlatform { updateManager.onUpdateFailed(function (res) { // 新的版本下载失败 }); - if (options != null && options.path == "pages/index/index") { - uni.switchTab({ - url: '/pages/shouye/index' - }); - } + // setTimeout(() => { + // const currentPage = getCurrentPages().pop(); + // console.log('currentPagecurrentPagecurrentPage', currentPage); + // }, 300); + + // if (options != null && options.path == "pages/index/index") { + // uni.switchTab({ + // url: '/pages/shouye/index' + // }); + // } } async getOrderNo(event) { return new Promise(async (resolve, reject) => { diff --git a/components/detail-lucky/detail-lucky-canvas.vue b/components/detail-lucky/detail-lucky-canvas.vue index 030758c..04ab6b9 100644 --- a/components/detail-lucky/detail-lucky-canvas.vue +++ b/components/detail-lucky/detail-lucky-canvas.vue @@ -76,7 +76,7 @@ export default { batchResults: [], // 保存批次结果 batchCallback: null, // 批次模式回调 batchIndices: [], // 批次索引 - chaoShenIndex: -1, + prizeIndices: [], timers: { skipButton: null, // 控制跳过按钮渐显的定时器 firstBatch: null, // 第一批次抽奖的定时器,用于控制第一批次停止时间 @@ -333,166 +333,28 @@ export default { }, // 抽奖结束回调 - endCallBack(prize) { - try { - console.log("[批次抽奖] endCallBack 被调用,批次模式:", this.isBatchMode, "当前模式:", this.internalMode, "批次计数:", this - .batchCount); - if (this.isSkip) { - return; - } - // 准备中奖信息 - const prizeData = - this.prizes[this.currentPrizeIndex]?.data || this.prizes[0]?.data; - - if (!prizeData) { - console.error("无法获取奖品数据"); - return; - } - - // 获取所有中奖奖品 - let allPrizes = []; - - // 检查prize是否是数组,如果是则使用map,否则只使用当前prize - if (Array.isArray(prize)) { - allPrizes = prize - .map((item) => { - const index = typeof item.index === "number" ? item.index : 0; - return this.prizes[index]?.data || this.prizes[0]?.data; - }) - .filter((item) => !!item); - } else if (prize && typeof prize.index === "number") { - // 如果prize是单个对象 - const index = prize.index; - const itemData = this.prizes[index]?.data; - if (itemData) { - allPrizes.push(itemData); - } - } else { - // 都不符合则使用当前索引的奖品 - allPrizes.push(prizeData); - } - - // 准备返回结果 - const result = { - prize: prize, - prizeData: prizeData, // 主要奖品数据 - allPrizes: allPrizes, // 所有中奖奖品数据 - message: `恭喜您获得 ${prizeData.title}`, - prizeInfo: { - name: prizeData.title, - image: prizeData.imgurl, - description: `价值:${prizeData.price} 元`, - data: prizeData, - }, - }; - - // 批次模式处理 - if (this.isBatchMode && this.internalMode === 10) { - this.batchCount++; - - // 添加到批次结果 - this.batchResults.push(...allPrizes); - - console.log("[批次抽奖] 批次抽奖完成", this.batchCount, "共", this.batchResults.length, "个奖品"); - - if (this.batchCount < 2) { - // 第一批次完成,延时开始第二批次 - console.log("[批次抽奖] 第一批次完成,准备开始第二批次"); - this.timers.firstBatch = setTimeout(() => { - console.log("[批次抽奖] 即将调用startSecondBatch"); - this.startSecondBatch(); - }, 800); - return; - } else { - // 两批次都完成 - console.log("[批次抽奖] 两批次都完成,返回最终结果"); - const batchResult = { - prize: prize, - prizeData: prizeData, - allPrizes: this.batchResults, - message: `恭喜您获得 ${this.batchResults.length} 件奖品`, - prizeInfo: { - name: "批次抽奖", - image: prizeData.imgurl, - description: `共获得 ${this.batchResults.length} 件奖品`, - data: this.batchResults, - }, - }; - this.$emit("luckyStop", ""); - if (this.chaoShenIndex != -1) { - // 重置批次状态 - this.isBatchMode = false; - this.batchCount = 0; - this.batchResults = []; - // this.$refs.detailGrandPrize.init(); - // this.$refs.detailGrandPrize.show(); - return; - } - this.timers.drawResult = setTimeout(() => { - - // 发送中奖信息到父组件 - this.$emit("end", false); - - // 调用保存的批次回调 - if (this.batchCallback && typeof this.batchCallback === 'function') { - console.log("[批次抽奖] 调用批次回调函数"); - this.batchCallback(batchResult); - this.batchCallback = null; - } - - // 重置批次状态 - this.isBatchMode = false; - this.batchCount = 0; - this.batchResults = []; - }, 800); - - return; - } - } - this.$emit("luckyStop", ""); - - if (this.chaoShenIndex != -1) { - return; - } - - this.timers.drawResult = setTimeout(() => { - - // 发送中奖信息到父组件 - this.$emit("end", false); - - // 调用startDrawWithResult方法中保存的回调函数 - if (this.drawResultCallback && typeof this.drawResultCallback === 'function') { - this.drawResultCallback(result); - // 清除回调,避免重复调用 - this.drawResultCallback = null; - } - }, 800); - - } catch (error) { - console.error("[批次抽奖] 处理抽奖结果时出错:", error); - this.hide(); - - // 如果有回调,通知调用者处理出错 - if (this.drawResultCallback && typeof this.drawResultCallback === 'function') { - this.drawResultCallback({ - success: false, - error: error.message || "处理抽奖结果时出错" - }); - this.drawResultCallback = null; - } - - // 批次模式错误处理 - if (this.isBatchMode && this.batchCallback) { - this.batchCallback({ - success: false, - error: error.message || "批次抽奖出错" - }); - this.isBatchMode = false; - this.batchCount = 0; - this.batchResults = []; - this.batchCallback = null; - } + async endCallBack(prize) { + if (this.isSkip) { + return; } + // 准备中奖信息 + const prizeData = + this.prizes[this.currentPrizeIndex]?.data || this.prizes[0]?.data; + + if (!prizeData) { + console.error("无法获取奖品数据"); + return; + } + this.$emit("luckyStop", ""); + if (this.prizeIndices.length > 0) { + await sleep(800); + // this.$refs.myLucky.init(); + this.startDrawWithResult(this.prizeIndices); + return; + } + await sleep(800); + // 发送中奖信息到父组件 + this.$emit("end", false); }, // 强制结束抽奖 @@ -501,24 +363,9 @@ export default { console.error("抽奖特效尚未初始化,请先调用init方法"); return this; } - - this.$emit("luckyStop", ""); - console.log("[跳过动画] 批次模式:", this.isBatchMode, "当前模式:", this.internalMode, "批次计数:", this.batchCount); - this.hide(); - let stopIndex = 0; - if (this.internalMode > 1) { - stopIndex = []; - let maxIndex = this.internalMode; - if (maxIndex > 5) { - maxIndex = 5; - } - for (let i = 0; i < maxIndex; i++) { - stopIndex.push(0); - } - } // 调用stop方法停止旋转 - this.$refs.myLucky.stop(stopIndex); + this.$refs.myLucky.init(); // 发送事件到父组件 this.$emit("end", true); return this; // 返回this以支持链式调用 @@ -541,8 +388,7 @@ export default { // 停止抽奖并指定中奖索引 - stopDraw(prizeIndices) { - console.log("stopDraw", prizeIndices); + async stopDraw(prizeIndices) { // 检查是否已初始化 if (!this.isInitialized) { @@ -554,10 +400,13 @@ export default { console.error("抽奖特效组件未初始化"); return this; } - - // 如果是批次模式,添加日志 - if (this.isBatchMode && this.internalMode === 10) { - console.log("[批次抽奖] 停止抽奖,批次:", this.batchCount + 1, "索引:", prizeIndices); + let prizeIndices_l = []; + if (prizeIndices.length > 0 && prizeIndices.length > 5) { + prizeIndices_l = prizeIndices.slice(5); + prizeIndices = prizeIndices.slice(0, 5); + this.prizeIndices = prizeIndices_l; + } else { + this.prizeIndices = []; } // 如果没有传入奖品索引数组或传入的不是数组 @@ -622,7 +471,15 @@ export default { * @param {Function} callback 抽奖结束后的回调函数 * @return {Object} this 返回组件实例,支持链式调用 */ - async startDrawWithResult(resultIndices, callback, chaoShenIndex = -1) { + async startDrawWithResult(resultIndices) { + this.prizeIndices = resultIndices; + if (this.internalMode == 0) { + if (resultIndices.length > 5) { + this.internalMode = 5; + } else { + this.internalMode = this.prizeIndices.length; + } + } // 检查是否已初始化 if (!this.isInitialized) { console.error("抽奖特效尚未初始化,请先调用init方法"); @@ -638,151 +495,34 @@ export default { console.error("抽奖结果必须是数组"); return this; } - this.chaoShenIndex = chaoShenIndex; - // 模式10特殊处理(批次模式) - if (this.internalMode === 10) { - // 检查是否有足够的索引 - if (resultIndices.length < 10) { - console.error("模式10需要至少10个索引,当前只有", resultIndices.length); - // 自动补足到10个 - const originalLength = resultIndices.length; - for (let i = originalLength; i < 10; i++) { - resultIndices.push(Math.floor(Math.random() * this.prizes.length)); - } - console.log("[批次抽奖] 自动补足索引到10个:", resultIndices); - } - - console.log("[批次抽奖] 检测到模式10,启用批次模式,共", resultIndices.length, "个索引"); - - // 保存回调函数 - this.drawResultCallback = null; - this.batchCallback = typeof callback === 'function' ? callback : null; - - // 初始化批次模式 - this.isBatchMode = true; - this.batchCount = 0; - this.batchResults = []; - this.batchIndices = resultIndices; - - // 重置跳过按钮透明度 - // this.skipButtonOpacity = 0; - - // 显示抽奖特效 - this.show(); - let that = this; - setTimeout(() => { - // 确保DOM已渲染完成后再调用play方法 - this.$nextTick(() => { - // 检查组件是否已初始化 - if (this.$refs.myLucky) { - console.log("[批次抽奖] 开始第一批次抽奖"); - // 开始第一批次抽奖 - this.$refs.myLucky.play(); - this.$emit("luckyPlay", "") - // 渐显跳过按钮 - this.timers.skipButton = setTimeout(() => { - this.skipButtonOpacity = 1; - }, 1000); - - // 2秒后停止第一批次抽奖 - this.timers.firstBatch = setTimeout(() => { - // 使用前5个索引作为第一批次结果 - const firstBatchIndices = resultIndices.slice(0, 5); - console.log("[批次抽奖] 停止第一批次抽奖,使用索引:", firstBatchIndices); - this.stopDraw(firstBatchIndices); - }, 2000); - } else { - console.error("[批次抽奖] 抽奖特效组件未初始化"); - if (this.batchCallback) { - this.batchCallback({ - success: false, - error: "抽奖特效组件未初始化" - }); - this.batchCallback = null; - } - this.isBatchMode = false; - } - }); - }, 200); - - return this; // 返回this以支持链式调用 - } - - // 非批次模式的普通处理(原有逻辑) - // 保存回调函数 - this.drawResultCallback = typeof callback === 'function' ? callback : null; - // 重置跳过按钮透明度 this.skipButtonOpacity = 0; // 显示抽奖特效 this.show(); - try { - await sleep(500); - // 确保DOM已渲染完成后再调用play方法 - this.$nextTick(() => { - // 检查组件是否已初始化 - if (this.$refs.myLucky) { - // 开始旋转 - this.$refs.myLucky.play(); - this.$emit("luckyPlay", "") + await sleep(500); - // 渐显跳过按钮 - this.timers.skipButton = setTimeout(() => { - this.skipButtonOpacity = 1; - }, 1000); + // 确保DOM已渲染完成后再调用play方法 + this.$nextTick(async () => { + // 检查组件是否已初始化 + if (this.$refs.myLucky) { + await sleep(200); + // 开始旋转 + this.$refs.myLucky.play(); + this.$emit("luckyPlay", "") + console.log('开始抽奖开始抽奖开始抽奖开始抽奖开始抽奖开始抽奖开始抽奖开始抽奖'); + // 渐显跳过按钮 + this.timers.skipButton = setTimeout(() => { + this.skipButtonOpacity = 1; + }, 1000); - // 2秒后自动停止抽奖 - this.timers.drawResult = setTimeout(() => { - // 停止抽奖并显示结果 - this.stopDraw(resultIndices); - }, 2000); - } else { - console.error("抽奖特效组件未初始化"); - // 如果有回调,通知调用者初始化失败 - if (this.drawResultCallback) { - this.drawResultCallback({ - success: false, - error: "抽奖特效组件未初始化" - }); - this.drawResultCallback = null; - } - } - }); - - } catch (error) { - sleep(500); - // 确保DOM已渲染完成后再调用play方法 - this.$nextTick(() => { - // 检查组件是否已初始化 - if (this.$refs.myLucky) { - // 开始旋转 - this.$refs.myLucky.play(); - this.$emit("luckyPlay", "") - - // 渐显跳过按钮 - this.timers.skipButton = setTimeout(() => { - this.skipButtonOpacity = 1; - }, 1000); - - // 2秒后自动停止抽奖 - this.timers.drawResult = setTimeout(() => { - // 停止抽奖并显示结果 - this.stopDraw(resultIndices); - }, 2000); - } else { - console.error("抽奖特效组件未初始化"); - // 如果有回调,通知调用者初始化失败 - if (this.drawResultCallback) { - this.drawResultCallback({ - success: false, - error: "抽奖特效组件未初始化" - }); - this.drawResultCallback = null; - } - } - }); - } + // 2秒后自动停止抽奖 + this.timers.drawResult = setTimeout(() => { + // 停止抽奖并显示结果 + this.stopDraw(resultIndices); + }, 2000); + } + }); return this; // 返回this以支持链式调用 }, diff --git a/components/detail-lucky/detail-lucky.vue b/components/detail-lucky/detail-lucky.vue index bfca353..2cf7e89 100644 --- a/components/detail-lucky/detail-lucky.vue +++ b/components/detail-lucky/detail-lucky.vue @@ -97,7 +97,7 @@ export default { this.chaoShenIndex = chaoShenIndex; console.log('开始抽奖开始抽奖开始抽奖开始抽奖开始抽奖开始抽奖', this.prizeList, resultIndices,); //#ifdef H5 || MP - await this.$refs._detailLucky.startDrawWithResult(resultIndices, chaoShenIndex); + await this.$refs._detailLucky.startDrawWithResult(resultIndices); //#endif //#ifdef APP this.$refs._detailLucky.init(this.prizeList, page, resultIndices); diff --git a/pages/index/index.vue b/pages/index/index.vue index 3c51af4..9ee8dd9 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -10,155 +10,164 @@ \ No newline at end of file From 1540183101aea7e5805dbf422db90133233fda98 Mon Sep 17 00:00:00 2001 From: zpc Date: Mon, 9 Jun 2025 10:28:57 +0800 Subject: [PATCH 3/3] 333 --- common/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/config.js b/common/config.js index 54edf6a..6e2db42 100644 --- a/common/config.js +++ b/common/config.js @@ -8,7 +8,7 @@ import RequestManager from '@/common/request.js' let configData = null; let isLoading = false; let loadPromise = null; -const wx_version = "113"; +const wx_version = "114"; // 白名单页面(不需要登录即可访问) export const whiteList = [