1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-28 13:21:37 +08:00

优化倒计时

This commit is contained in:
xiaochong0302 2025-04-17 13:30:41 +08:00
parent 4d2deaa203
commit e529a96cf8
2 changed files with 9 additions and 6 deletions

View File

@ -1370,15 +1370,15 @@
} }
.live-preview .tips { .live-preview .tips {
font-size: 16px; color: #999;
margin: 20px 0; margin: 20px 0;
} }
.countdown .timer { .countdown .timer .label {
font-size: 32px; font-size: 32px;
} }
.countdown .timer span { .countdown .timer .value {
color: green; color: green;
font-size: 36px; font-size: 36px;
padding: 10px; padding: 10px;

View File

@ -7,7 +7,7 @@ layui.use(['jquery', 'util'], function () {
var serverTime = $('input[name="countdown.server_time"]').val(); var serverTime = $('input[name="countdown.server_time"]').val();
var liveStatusUrl = $('input[name="live.status_url"]').val(); var liveStatusUrl = $('input[name="live.status_url"]').val();
util.countdown(1000 * parseInt(endTime), 1000 * parseInt(serverTime), function (date, serverTime, timer) { util.countdown(1000 * parseInt(endTime), 1000 * parseInt(serverTime), function (date) {
var items = [ var items = [
{date: date[0], label: '天'}, {date: date[0], label: '天'},
{date: date[1], label: '时'}, {date: date[1], label: '时'},
@ -16,7 +16,10 @@ layui.use(['jquery', 'util'], function () {
]; ];
var html = ''; var html = '';
layui.each(items, function (index, item) { layui.each(items, function (index, item) {
html += '<span>' + item.date + '</span>' + item.label; if (item.date > 0) {
html += '<span class="value">' + item.date + '</span>';
html += '<span class="label">' + item.label + '</span>';
}
}); });
$('.countdown > .timer').html(html); $('.countdown > .timer').html(html);
}); });