/** layuiAdmin-v1.0.0-beta6 LPPL License By http://www.layui.com/admin/ */
;
layui.define(["laytpl", "layer"],
function(e) {
var t = layui.jquery,
a = layui.laytpl,
n = layui.layer,
r = layui.setter,
o = (layui.device(), layui.hint()),
i = function(e) {
return new d(e);
},
s = "LAY_app_body",
d = function(e) {
this.id = e,
this.container = t("#" + (e || s));
};
i.loading = function(e) {
e.append(this
.elemLoad =
t(''))
},
i.removeLoad = function() {
this.elemLoad && this.elemLoad.remove()
},
i.exit = function() {
layui.data(r.tableName,
{
key: r.request.tokenName,
remove: !0
}),
location.hash = "/user/login"
},
i.req = function(e) {
var a = e.success,
n = (e.error, r.request),
o = r.response,
s = function() {
return r.debug ? "
URL:" + e.url : ""
};
return e.data = e.data || {},
e.headers = e.headers || {},
n.tokenName &&
(e.data[n.tokenName] = n
.tokenName in
e.data
? e.data[n.tokenName]
: layui.data(r.tableName)[n.tokenName] || "", e.headers[n
.tokenName] = n.tokenName in e.headers ? e.headers[n.tokenName] : layui.data(r.tableName)[n.tokenName] || ""),
delete e.success,
delete e.error,
t.ajax(t.extend({
type: "get",
dataType: "json",
success: function(t) {
var n = o.statusCode;
if (t[o.statusName] == n.ok) "function" == typeof e.done && e.done(t);
else if (t[o.statusName] == n.logout) i.exit();
else {
var r = ["Error: " + (t[o.msgName] || "返回状态码异常"), s()].join("");
i.error(r)
}
"function" == typeof a && a(t)
},
error: function(e, t) {
var a = ["请求异常,请重试
错误信息:" + t, s()].join("");
i.error(a),
"function" == typeof a && a(res)
}
},
e))
},
i.popup = function(e) {
var a = e.success,
r = e.skin;
delete e.success,
delete e.skin,
n.open(t.extend({
type: 1,
title: "提示",
content: "",
id: "LAY-system-view-popup",
skin: "layui-layer-admin" + (r ? " " + r : ""),
shadeClose: !0,
closeBtn: !1,
success: function(e, r) {
var o = t('ဆ');
e.append(o),
o.on("click",
function() {
n.close(r)
}),
"function" == typeof a && a.apply(this, arguments)
}
},
e))
},
i.error = function(e, a) {
return i.popup(t.extend({
content: e,
maxWidth: 300,
offset: "t",
anim: 6,
id: "LAY_adminError"
},
a))
},
d.prototype.render = function(e, a) {
var n = this;
layui.router();
return e = r.views + e + r.engine,
t("#" + s).children(".layadmin-loading").remove(),
i.loading(n.container),
t.ajax({
url: e,
type: "get",
dataType: "html",
data: {
v: layui.cache.version
},
success: function(e) {
e = "