mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-03-03 16:24:28 +08:00
优化自动跳转功能
This commit is contained in:
@@ -29,6 +29,49 @@
|
||||
<div class="info">
|
||||
<span>{$post->publish_time_text}</span>
|
||||
</div>
|
||||
<div class="desc">
|
||||
{$post.desc_html}
|
||||
</div>
|
||||
{if !empty($post.desc) && $post.jump_to_url_status != 0}
|
||||
<div class="jump-container">
|
||||
<a href="{$post.jump_to_url}" class="layui-btn jump-btn" target="_blank">{$post.jump_to_btn_title|default='立即跳转'}</a>
|
||||
</div>
|
||||
{if $post.jump_to_url_status == 2 }
|
||||
<script>
|
||||
window.layuiInitSuccess.push(function () {
|
||||
var isJumped = false;
|
||||
var countDownNum = 5;
|
||||
var closeJump = false;
|
||||
var jumpUrl = '{$post.jump_to_url}'
|
||||
window.layerJump = layer.confirm('即将自动打开新页面(倒计时<span class="jump-count-dowm">5</span>秒)', {
|
||||
btn: ['立即跳转', '取消'],
|
||||
offset:['20%']
|
||||
}
|
||||
, function (index, layero) {
|
||||
//按钮【按钮一】的回调
|
||||
window.open(jumpUrl)
|
||||
isJumped = true
|
||||
layer.close(index)
|
||||
}, function (index) {
|
||||
//按钮【按钮二】的回调
|
||||
closeJump = true
|
||||
})
|
||||
|
||||
window.timerJump = setInterval(() => {
|
||||
countDownNum--
|
||||
$('.jump-count-dowm').text(countDownNum)
|
||||
if (countDownNum <= 0) {
|
||||
clearInterval(window.timerJump)
|
||||
layer.close(window.layerJump)
|
||||
if (!closeJump && !isJumped) {
|
||||
window.open(jumpUrl)
|
||||
}
|
||||
}
|
||||
}, 1000);
|
||||
})
|
||||
</script>
|
||||
{/if}
|
||||
{/if}
|
||||
<div class="ql-snow">
|
||||
<div class="ql-editor">{$post->content_html|raw}</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user