WIDGET-SYS-MSG.lview 6.92 KB
Newer Older
niminmin's avatar
niminmin committed
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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
<?xml version="1.0" encoding="UTF-8"?>

<!--
    $Date: 2018/9/4
    微件-公告栏
    WIDGET-SYS-MSG
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view template="default" package="leaf.ui.std">
        <!--<meta name="_csrf" content="${/session/@_csrf.token}"/>-->
        <!--<meta name="_csrf_header" content="X-CSRF-TOKEN" />-->
        <a:link id="widget_sys_notice_msg_url" url="${/request/@context_path}/modules/sys/SYS100/sys_notice_msg_html.lview"/>
        <a:link id="widget_all_sys_notice_msg_url" url="${/request/@context_path}/modules/sys/SYS100/sys_notice_msg.lview"/>
        <style>
            html,body{
            background-color:#eee;
            width:264px;
            height:360px;
            margin: 0;
            padding: 0;
            }
            .widget_sys_msg{
            box-sizing:border-box;
            width:264px;
            height:360px;
            background-color:#fff;
            position:relative;
            border:1px solid #F0F0F3;
            cursor:default;
            }
            .widget_sys_msg .widget_label{
            position:absolute;
            width:40px;
            height:4px;
            top:0;
            left:16px;
            background-color: #5A7FFF;
            }
            .widget_sys_msg .header{
            position:relative;
            height:22px;
            padding:12px 12px 6px 16px;
            font-family: PingFangSC-Medium;
            font-size: 14px;
            color: #4B505A;
            }
            .widget_sys_msg .header{
            position:relative;
            height:22px;
            padding:12px 12px 6px 16px;
            font-family: PingFangSC-Medium;
            font-size: 14px;
            color: #4B505A;
            border-bottom:1px solid #F0F0F3;
            }
            .widget_sys_msg .header a{
            font-family: PingFangSC-Regular;
            font-size: 12px;
            color: rgba(93,97,103,0.70);
            float:right;
            }
            .widget_sys_msg .top_msg{
            padding:13px 12px 0 12px;
            width:240px;
            }
            .widget_sys_msg .top_msg img{
            width:240px;
            height:120px;
            }
            .widget_sys_msg .top_msg .title{
            width: 240px;
            height: 24px;
            box-sizing: border-box;
            font-family: PingFangSC-Regular;
            font-size: 12px;
            color: #FFFFFF;
            z-index: 10;
            background: rgba(41,66,97,0.7);
            line-height: 24px;
            padding-left: 8px;
            position: relative;
            top: -24px;
            }
            .widget_sys_msg .msg_list{
            position: relative;
            box-sizing: border-box;
            padding: 0 12px 9px 12px;
            top: -11px;
            }
            .widget_sys_msg .msg_list .list_row{
            width:100%;
            height:20px;
            line-height:20px;
            margin-bottom:12px;
            font-family: PingFangSC-Regular;
            font-size: 12px;
            color: rgba(0,0,0,0.56);
            cursor:pointer;
            }
            .widget_sys_msg .msg_start_date{
            font-family: PingFangSC-Regular;
            font-size: 13px;
            color: rgba(0,0,0,0.40);
            float:right;
            }
        </style>
        <script><![CDATA[
        function on_sys_notice_msg_ds_load(ds){
            var records = ds.data;
            var html='';
            records.forEach(function(record){
                var title = record.data["msg_title"] || '';
                var date = record.data["msg_start_date"] || new Date;
                var id = record.data["notice_msg_id"] || 0;
                var source_id = record.data["source_id"] || 0;
                var notice_type = record.data["notice_type"] || '';
                var url = record.data["notice_url"] || '';
                var dateStr = date.format("mm-dd");
                var clickJsStr = '';
                if (notice_type == 'URL') {
                    clickJsStr = 'openWin_sys_msg_detail_url(\'' + url + '\',' + source_id + ')';
                } else if (notice_type == 'HTML') {
                    clickJsStr = 'openWin_sys_msg_detail_html(' + record.get('notice_msg_id') + ')';
                } else {
                    clickJsStr = '';
                }
                html += '<div class="list_row" onclick="' + clickJsStr + '">';
                html += '<span class="msg_type">【系统公告】</span>';
                html += '<span class="msg_title">' + title + '</span>';
                html += '<span class="msg_start_date">' + dateStr + '</span>';
                html += '</div>';
            });
            jQuery(".widget_sys_msg .msg_list").html(html);
        };
        function openWin_sys_msg_detail_url(url,instance_id){
            new Leaf.Window({
                id: 'sys_notice_url',
                url: '${/request/@context_path}/modules/' + url,
                params: {
                    instance_id: instance_id
                },
                title: '明细',
                fullScreen: true
            });
        }
        function openWin_sys_msg_detail_html(notice_msg_id){
            new Leaf.Window({
                id: 'sys_notice_msg_html',
                url: $('widget_sys_notice_msg_url').getUrl(),
                params: {
                    notice_msg_id: notice_msg_id
                },
                title: '明细',
                fullScreen: true
            });
        }
        function openWin_all_sys_msg(){
            new Leaf.Window({
                id: 'all_sys_notice_msg',
                url: $('widget_all_sys_notice_msg_url').getUrl(),
                title: '全部系统公告',
                fullScreen: true
            });
        }
            ]]></script>
        <a:dataSets>
            <a:dataSet id="sys_notice_msg_ds" autoQuery="true" pageSize="5" model="sys.SYS8300.sys_notice_msg">
                <a:fields>
                    <a:field name="msg_title"/>
                    <a:field name="msg_start_date"/>
                    <a:field name="notice_msg_id"/>
                </a:fields>
                <a:events>
                    <a:event name="load" handler="on_sys_notice_msg_ds_load"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <div class="widget_sys_msg">
            <span class="widget_label"> </span>
            <div class="header">
                <span class="title">公告栏</span>
                <a href="javascript:openWin_all_sys_msg()">查看更多></a>
            </div>
            <div class="top_msg">
                <img src="${/request/@context_path}/leafresource/images/widget/top_msg_mask.png"/>
                <div class="title">热烈庆祝公司移动端产品上线</div>
            </div>
            <div class="msg_list"> </div>
        </div>
        <a:screenBody style="display:none"> </a:screenBody>
    </a:view>
</a:screen>