chengkun
2025-05-12 b6bc92ec11e1e280185ce7682d17589cb45c20f3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<link rel="stylesheet" href="{yun:}$wap_style{/yun}/hb/reset.css?v={yun:}$config.cachecode{/yun}" type="text/css"/>
<section class='zhongxin'>
    <div>
        <ul class="poster-list-a pdb10 overflow ">
            {yun:}foreach from=$comHb item=v{/yun}
            <li class="">
                <div class="hb_listbox">
                    <div class="poster_pic"><img src="{yun:}$v.pic_n{/yun}"></div>
                    <div class="hb_listbox_name" style="background:#fff;">
                        <div class="hb_cz">
                            <a href="javascript:;" onclick="showWhb('{yun:}$comid{/yun}', '{yun:}$v.style{/yun}');">预览</a>
                            <a href="javascript:;" onclick="downWhb('{yun:}$comid{/yun}', '{yun:}$v.style{/yun}');">下载</a>
                        </div>
                    </div>
                </div>
            </li>
            {yun:}/foreach{/yun}
        </ul>
    </div>
</section>
 
<div style="display: none;" id="imgDiv">
    <img id="showImg" class="important" />
</div>
 
<script type="text/javascript" src="{yun:}$config.sy_weburl{/yun}/js/jquery-1.8.1.min.js?v={yun:}$config.cachecode{/yun}"></script>
<link href="{yun:}$config.sy_weburl{/yun}/js/layui/css/layui.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css"/>
<script src="{yun:}$config.sy_weburl{/yun}/js/layui/layui.js?v={yun:}$config.cachecode{/yun}"></script>
<script src="{yun:}$config.sy_weburl{/yun}/js/layui/custom_layer.js?v={yun:}$config.cachecode{/yun}"></script>
 
<script>
 
    var weburl = '{yun:}$config.sy_weburl{/yun}';
 
    function showWhb(id, style) {
 
        const url   =   weburl + '/index.php?m=ajax&c=getComHb&uid=' + id + '&style=' + style
 
        const loading = parent.layer.load();
 
        setTimeout(function () {
 
            parent.layer.closeAll();
 
            layer.open({
                type: 1,
                title: false,
                content: '<div><img src="' + url + '" style="max-width: 100%;"></div>',
                area: ['360px', 'auto'],
                offset: '55px',
                closeBtn: 0,
                shadeClose: true
            });
        }, 1000);
    }
 
    function downWhb(id, style) {
        const url   =   weburl + '/index.php?m=ajax&c=getComHb&uid=' + id + '&style=' + style
        setTimeout(function () {
            var a = document.createElement('a');          // 创建一个a节点插入的document
            var event = new MouseEvent('click')           // 模拟鼠标click点击事件
            a.download = 'whb' + style;                      // 设置a节点的download属性值
            a.href = url;                                 // 将图片的src赋值给a节点的href
            a.dispatchEvent(event);
        }, 1000);
    }
 
</script>
</html>