添加新文件
This commit is contained in:
@@ -0,0 +1,132 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const api_raffle = require("../../api/raffle.js");
|
||||
common_vendor.dayjs.extend(common_vendor.duration);
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return {
|
||||
timeData: {
|
||||
days: 0,
|
||||
hours: 0,
|
||||
minutes: 0,
|
||||
seconds: 0
|
||||
},
|
||||
sumTimes: 0,
|
||||
// 总加速次数
|
||||
quickenTimes: 0,
|
||||
// 剩余加速次数
|
||||
lockTimes: 0,
|
||||
// 冻结抽奖次数
|
||||
nextClearTime: null,
|
||||
// 下次清零时间
|
||||
timesValue: 0
|
||||
// 倒计时
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getQuickenTimes();
|
||||
},
|
||||
methods: {
|
||||
jumpMine() {
|
||||
common_vendor.index.switchTab({
|
||||
// 首页
|
||||
url: "/pages/mine/mine"
|
||||
});
|
||||
},
|
||||
async getQuickenTimes() {
|
||||
const resp = await api_raffle.getQuickenTimes();
|
||||
if (resp && resp.bizcode === 100) {
|
||||
const data = resp.data || {};
|
||||
if (data && Object.keys(data).length !== 0) {
|
||||
this.sumTimes = data.sumTimes;
|
||||
this.lockTimes = data.lockTimes;
|
||||
this.quickenTimes = data.quickenTimes;
|
||||
this.nextClearTime = common_vendor.dayjs(data.nextClearTime).format("YYYY-MM-DD HH:mm:ss");
|
||||
if (data.nextReleaseTime) {
|
||||
let oldTime = new Date(data.nextReleaseTime).getTime();
|
||||
let nowTime = (/* @__PURE__ */ new Date()).getTime();
|
||||
let Time = oldTime - nowTime;
|
||||
let day = Math.floor(Time / (1e3 * 60 * 60 * 24));
|
||||
let hour = Math.floor(Time / (1e3 * 60 * 60) % 24);
|
||||
let minute = Math.floor(Time / (1e3 * 60) % 60);
|
||||
let second = Math.floor(Time / 1e3 % 60);
|
||||
this.timeData = {
|
||||
days: day,
|
||||
hours: hour,
|
||||
minutes: minute,
|
||||
seconds: second
|
||||
};
|
||||
const millisecond = Number(day * 24 * 3600 * 1e3) + Number(hour * 3600 * 1e3) + Number(minute * 60 * 1e3) + Number(second * 1e3);
|
||||
this.timesValue = millisecond;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// 定义 onChange 方法
|
||||
onChange(e) {
|
||||
this.timeData = e;
|
||||
},
|
||||
// 截取字符串的第一位数字
|
||||
getFirstDigit(str) {
|
||||
if (str) {
|
||||
return Math.floor(str / 10) % 10;
|
||||
}
|
||||
return 0;
|
||||
},
|
||||
// 截取字符串的最后一位数字
|
||||
getLastDigit(str) {
|
||||
if (str) {
|
||||
return str % 10;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_up_image2 = common_vendor.resolveComponent("up-image");
|
||||
const _easycom_up_count_down2 = common_vendor.resolveComponent("up-count-down");
|
||||
(_easycom_up_image2 + _easycom_up_count_down2)();
|
||||
}
|
||||
const _easycom_up_image = () => "../../uni_modules/uview-plus/components/u-image/u-image.js";
|
||||
const _easycom_up_count_down = () => "../../uni_modules/uview-plus/components/u-count-down/u-count-down.js";
|
||||
if (!Math) {
|
||||
(_easycom_up_image + _easycom_up_count_down)();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.o($options.jumpMine),
|
||||
b: common_vendor.p({
|
||||
src: "/static/common/left_b.png",
|
||||
width: "18",
|
||||
height: "18",
|
||||
bgColor: "#f1f6ff00"
|
||||
}),
|
||||
c: common_vendor.t($data.timeData.days > 10 ? $options.getFirstDigit($data.timeData.days) : 0),
|
||||
d: common_vendor.t($data.timeData.days > 10 ? $options.getLastDigit($data.timeData.days) : $data.timeData.days),
|
||||
e: common_vendor.t($data.timeData.hours > 10 ? $options.getFirstDigit($data.timeData.hours) : 0),
|
||||
f: common_vendor.t($data.timeData.hours > 10 ? $options.getLastDigit($data.timeData.hours) : $data.timeData.hours),
|
||||
g: common_vendor.t($data.timeData.minutes > 10 ? $options.getFirstDigit($data.timeData.minutes) : 0),
|
||||
h: common_vendor.t($data.timeData.minutes > 10 ? $options.getLastDigit($data.timeData.minutes) : $data.timeData.minutes),
|
||||
i: common_vendor.t($data.timeData.seconds > 10 ? $options.getFirstDigit($data.timeData.seconds) : 0),
|
||||
j: common_vendor.t($data.timeData.seconds > 10 ? $options.getLastDigit($data.timeData.seconds) : $data.timeData.seconds),
|
||||
k: common_vendor.o($options.onChange),
|
||||
l: common_vendor.p({
|
||||
time: $data.timesValue,
|
||||
format: "DD:HH:mm:ss",
|
||||
autoStart: true,
|
||||
millisecond: true
|
||||
}),
|
||||
m: common_vendor.t($data.sumTimes),
|
||||
n: common_vendor.t($data.quickenTimes),
|
||||
o: $data.nextClearTime
|
||||
}, $data.nextClearTime ? {} : {}, {
|
||||
p: $data.nextClearTime
|
||||
}, $data.nextClearTime ? {
|
||||
q: common_vendor.t($data.nextClearTime)
|
||||
} : {}, {
|
||||
r: common_vendor.t($data.lockTimes)
|
||||
});
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-b4339e76"]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/accelerate/accelerate.js.map
|
||||
Reference in New Issue
Block a user