增加新模块
This commit is contained in:
+37
-8
@@ -8,18 +8,39 @@ const _sfc_main = {
|
||||
lightImages: ["/static/turntable/bg_bs.png", "/static/turntable/bg_hs.png"],
|
||||
prizesObj: {},
|
||||
prizes: [],
|
||||
lotteryList: []
|
||||
lotteryList: [],
|
||||
// 中奖的列表ID
|
||||
styleOpt: {
|
||||
prizeBgColors: ["#fff0a3", "#fffce6", "#fdba64"]
|
||||
},
|
||||
isRun: false,
|
||||
// 是否正在抽奖
|
||||
backPath: null
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
onLoad(option) {
|
||||
const backPath = option.backPath;
|
||||
common_vendor.index.__f__("log", "at pages/turntable/turntable.vue:76", "option backPath", backPath);
|
||||
if (backPath && backPath !== "null") {
|
||||
this.backPath = backPath;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getActivityList();
|
||||
},
|
||||
methods: {
|
||||
jumpMine() {
|
||||
common_vendor.index.switchTab({
|
||||
url: "/pages/mine/mine"
|
||||
});
|
||||
const backPath = this.backPath;
|
||||
common_vendor.index.__f__("log", "at pages/turntable/turntable.vue:87", "backPath", backPath);
|
||||
if (backPath) {
|
||||
common_vendor.index.switchTab({
|
||||
url: "/pages/home/home"
|
||||
});
|
||||
} else {
|
||||
common_vendor.index.switchTab({
|
||||
url: "/pages/mine/mine"
|
||||
});
|
||||
}
|
||||
},
|
||||
// 查询活动详情
|
||||
async getActivityList() {
|
||||
@@ -27,6 +48,9 @@ const _sfc_main = {
|
||||
if (resp && resp.bizcode === 100) {
|
||||
this.prizesObj = resp.data;
|
||||
this.prizes = resp.data.prizes || [];
|
||||
if (this.prizes.length % 2 === 0) {
|
||||
this.styleOpt.prizeBgColors = ["#fff0a3", "#fdba64"];
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
@@ -39,6 +63,9 @@ const _sfc_main = {
|
||||
},
|
||||
// 用户点击开始,需要请求后台,去算出抽奖的选中的哪个
|
||||
async startClick(num) {
|
||||
if (this.isRun) {
|
||||
return;
|
||||
}
|
||||
const count = this.prizesObj.times;
|
||||
if (!count || count === 0) {
|
||||
common_vendor.index.showToast({
|
||||
@@ -50,6 +77,7 @@ const _sfc_main = {
|
||||
if (count < num) {
|
||||
return;
|
||||
}
|
||||
this.isRun = true;
|
||||
const params = {
|
||||
id: this.prizesObj.id,
|
||||
times: num
|
||||
@@ -64,7 +92,6 @@ const _sfc_main = {
|
||||
const prizes = this.prizes;
|
||||
const lastData = data[data.length - 1];
|
||||
for (let i = 0; i < prizes.length; i++) {
|
||||
common_vendor.index.__f__("log", "at pages/turntable/turntable.vue:123", "prizes[i]", prizes[i]);
|
||||
if (prizes[i].id === lastData.prizeId) {
|
||||
runCount = i;
|
||||
break;
|
||||
@@ -97,6 +124,7 @@ const _sfc_main = {
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
this.isRun = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -123,7 +151,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
d: common_assets._imports_0,
|
||||
e: common_assets._imports_1,
|
||||
f: common_vendor.o(($event) => $options.startClick(1)),
|
||||
g: common_vendor.sr("luckyWheel", "573c7e2f-1"),
|
||||
g: common_vendor.sr("luckyWheel", "42dcd262-1"),
|
||||
h: common_vendor.o(($event) => $options.startClick(1)),
|
||||
i: common_vendor.o($options.Done),
|
||||
j: common_vendor.p({
|
||||
@@ -131,7 +159,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
size: 626,
|
||||
duration: 5e3,
|
||||
lightImgs: $data.lightImages,
|
||||
customStyle: "borderRadius: 50%;"
|
||||
customStyle: "borderRadius: 50%;",
|
||||
styleOpt: $data.styleOpt
|
||||
}),
|
||||
k: common_vendor.t($data.prizesObj.times || 0),
|
||||
l: common_vendor.n($data.prizesObj.times < 1 ? "draws_item_warp draws_item_warp_no" : "draws_item_warp"),
|
||||
|
||||
Reference in New Issue
Block a user