layui.define(["table", "jquery", "element", "dropdown"], function (exports) { "use strict"; var MOD_NAME = "messageCenter", $ = layui.jquery, dropdown = layui.dropdown; var message = function (opt) { this.option = opt; }; message.prototype.render = function (opt) { var option = { elem: opt.elem, url: opt.url ? opt.url : false, height: opt.height, data: opt.data, }; if (option.url != false) { $.get(option.url, function (result) { const { code, success, data } = result; $(`${opt.elem}`).append(`
  • `); if (code == 200 || success) { option.data = data; dropdown.render({ elem: option.elem, align: "center", content: createHtml(option), }); } }); } return new message(option); }; message.prototype.click = function (callback) { $("*[notice-id]").click(function (event) { event.preventDefault(); var id = $(this).attr("notice-id"); var title = $(this).attr("notice-title"); var context = $(this).attr("notice-context"); var form = $(this).attr("notice-form"); callback(id, title, context, form); }); }; function createHtml(option) { var count = 0; var notice = '
    '; var noticeTitle = '"; noticeContent += "
    "; notice += noticeTitle; notice += noticeContent; notice += "
    "; return notice; } exports(MOD_NAME, new message()); });