Paste: aa

Author: aa
Mode: javascript
Date: Wed, 17 Nov 2021 17:26:43
Plain Text |
function getNotice() {
    $.ajax({
        url: 'notice!getNotice.action',
        dataType: "json",
        type: "GET",
        cache: false,
        success: function(ret) {
            var len = ret.length;
            if (len > 0) {
                $(".message .num").remove();
                var html = '<p id="notice" style="width:280px;overflow:auto;"><ol>';
                html += "<li>[<a href='javascript:;' onclick='readedAll(this);'>全部已读</a>]</li>";
                $.each(ret, function(index, item) {
                    if ($.inArray(item.xxid, readedNotice) == -1) {
                        if ($.inArray(item.xxid, noticeIds) == -1) {
                            noticeIds.push(item.xxid);
                            newNoticeIds.push(item.xxid);
                        }
                        if (item.type === "") {
                            html += "<li>" + item.msg + "&nbsp;&nbsp;&nbsp;&nbsp;[<a href='javascript:;' onclick='readedOne(this,\"" + item.xxid + "\");'>已读</a>]</li>";
                        } else if (item.type.endWith('sh')) {
                            var shData = $.parseJSON(item.msg);
                            html += "<li>" + shData.subject + "" + shData.status + ((typeof(shData.feedback) == 'undefined') ? "" : ",审核意见:" + shData.feedback) + "&nbsp;&nbsp;&nbsp;&nbsp;[<a href='javascript:;' onclick='readedOne(this,\"" + item.xxid + "\");'>已读</a>]</li>";
                        } else if (item.type.endWith('cjtz')) {
                            var shData = $.parseJSON(item.msg);
                            html += "<li><<" + shData.kcmc + ">> 的成绩出来了,总成绩:" + shData.zcj + ",绩点:" + shData.jd + " &nbsp;&nbsp;&nbsp;&nbsp;[<a href='javascript:;' onclick='readedOne(this,\"" + item.xxid + "\");'>已读</a>]</li>";
                        } else if (item.type.endWith('xkcl')) {
                            var shData = $.parseJSON(item.msg);
                            html += "<li>您一选未选中<<" + shData.kcmc + ">> ,请关注下一轮选课开放时间。 &nbsp;&nbsp;&nbsp;&nbsp;[<a href='javascript:;' onclick='readedOne(this,\"" + item.xxid + "\");'>已读</a>]</li>";
                        }
                    }
                });
                html += '<ol></p>';
                if (noticeIds.length > 0) {
                    $(".message").append('<span class="num">' + noticeIds.length + '</span>');
                    NoticeHtml = html;
                } else {
                    NoticeHtml = "无未读通知";
                }
                $(".message").poshytip('update', NoticeHtml);
                if (newNoticeIds.length > 0) {
                    inotify(newNoticeIds.length);
                    newNoticeIds = [];
                }
            }
        }
    });
}

New Annotation

Summary:
Author:
Mode:
Body: