WIDGET-LEAF-SYSTEM-NOTICE.lview 7.9 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 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
<?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="sys_notice_msg_url" url="${/request/@context_path}/modules/sys/SYS100/sys_notice_msg_html.lview"/>
        <a:link id="all_sys_notice_msg_url" url="${/request/@context_path}/modules/sys/SYS100/sys_notice_msg.lview"/>
        <style>
            html,body{
                background-color:#eee;
                width:241px;
                height:273px;
                margin: 0;
                padding: 0;
            }
            .widget_leaf_sys_msg{
                box-sizing:border-box;
                width:241px;
                height:273px;
                background-color:#fff;
                position:relative;
                border:1px solid #F0F0F3;
                cursor:default;
            }
            .widget_leaf_sys_msg .widget_label{
                position:absolute;
                width:40px;
                height:4px;
                top:0;
                left:16px;
                background-color: #5A7FFF;
            }
            .widget_leaf_sys_msg .header{
                position:relative;
                height:22px;
                padding:12px 12px 6px 16px;
                font-family: PingFangSC-Medium;
                font-size: 14px;
                color: #4B505A;
            }
            .widget_leaf_sys_msg .header{
                position:relative;
                height:22px;
                padding:24px 12px 6px 27px;
                font-family: PingFangSC-Medium;
                font-size: 14px;
                color: #4B505A;
                /*border-bottom:1px solid #F0F0F3;*/
            }
            .widget_leaf_sys_msg .header .more-notice-img{
                width: 8px;
                position: absolute;
                right: 18px;
                top: 25px;
                cursor: pointer;
            }
            .widget_leaf_sys_msg .header .title-line{
                width: 29px;
                height: 5px;
                background-color: #657efe;
                margin-top: 4px;
            }
            .widget_leaf_sys_msg .header .more-notice{
                width: 175px;
                margin-left: 33px;
            }
            .widget_leaf_sys_msg .header a{
                font-family: PingFangSC-Regular;
                font-size: 12px;
                color: rgba(93,97,103,0.70);
                float:right;
            }
            .widget_leaf_sys_msg .top_msg{
                margin: 11px 0 0 30px;
            }
            .widget_leaf_sys_msg .top_msg img{
                width:173px;

            }
            .widget_leaf_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_leaf_sys_msg .msg_list{
                position: relative;
                box-sizing: border-box;
                padding: 17px 20px 0 21px;
            }
            .widget_leaf_sys_msg .msg_list .msg_title{
                width:120px;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                display: inline-block;
            }
            .widget_leaf_sys_msg .msg_list .list_row{
                margin-bottom: 8px;
                cursor: pointer;
            }
            .widget_leaf_sys_msg .msg_start_date{
                font-family: PingFangSC-Regular;
                font-size: 13px;
                color: rgba(0,0,0,0.40);
                position: absolute;
                right: 20px;
            }
        </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("yyyy-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_title">【系统公告】' + title + '</span>';
                html += '<span class="msg_start_date">' + dateStr + '</span>';
                html += '</div>';
            });
            jQuery(".widget_leaf_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: $('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: $('all_sys_notice_msg_url').getUrl(),
                title: '全部系统公告',
                fullScreen: true
            });
        }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="leaf_sys_notice_msg_ds" autoQuery="true" pageSize="3" 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_leaf_sys_msg">
            <div class="header">
                <span class="title">系统公告</span>
                <div class="title-line"></div>
                <!--<a href="javascript:openWin_all_sys_msg()">查看更多></a>-->
                <img onclick="openWin_all_sys_msg()" class="more-notice-img" src="${/request/@context_path}/leafresource/images/widget/more-notice@2x.png"/>
            </div>
            <div class="top_msg">
                <img class="more-notice" src="${/request/@context_path}/leafresource/images/widget/system-notice@2x.png"/>
                <!--<div class="title">热烈庆祝公司移动端产品上线</div>-->
            </div>
            <div class="msg_list"> </div>
        </div>
        <a:screenBody style="display:none"> </a:screenBody>
    </a:view>
</a:screen>