重构:JS框架内部变量 admin 统一重命名为 ua,移除无用的 window.ulAdmin

This commit is contained in:
augushong
2026-06-01 21:13:22 +08:00
parent c4bb851fbb
commit 5941a61b80
6 changed files with 206 additions and 206 deletions

View File

@@ -80,7 +80,7 @@
init.uploadExts += allExtGroup.join('|');
init.extGroup = extGroup;
var admin = {
var ua = {
init: init,
config: {
shade: [0.02, '#000'],
@@ -122,10 +122,10 @@
},
request: {
post: function (option, ok, no, ex, complete) {
return admin.request.ajax('post', option, ok, no, ex, complete);
return ua.request.ajax('post', option, ok, no, ex, complete);
},
get: function (option, ok, no, ex, complete) {
return admin.request.ajax('get', option, ok, no, ex, complete);
return ua.request.ajax('get', option, ok, no, ex, complete);
},
ajax: function (type, option, ok, no, ex, complete) {
type = type || 'get';
@@ -153,7 +153,7 @@
} else {
no = function (res) {
var msg = res.msg == undefined ? '返回数据格式有误' : res.msg;
admin.msg.error(msg);
ua.msg.error(msg);
complete();
return false;
};
@@ -171,11 +171,11 @@
};
}
if (option.url == '') {
admin.msg.error('请求地址不能为空');
ua.msg.error('请求地址不能为空');
return false;
}
if (option.prefix == true) {
option.url = admin.url(option.url);
option.url = ua.url(option.url);
}
loading.show();
$.ajax({
@@ -183,7 +183,7 @@
type: type,
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
dataType: "json",
headers: admin.headers(),
headers: ua.headers(),
data: option.data,
timeout: 60000,
success: function (res) {
@@ -200,7 +200,7 @@
errorMsg = xhr.responseJSON.message;
}
loading.hide();
admin.msg.error('Status:' + xhr.status + '' + xhr.statusText + ',请稍后再试!<br/>' + errorMsg, function () {
ua.msg.error('Status:' + xhr.status + '' + xhr.statusText + ',请稍后再试!<br/>' + errorMsg, function () {
ex(this);
});
return false;
@@ -215,7 +215,7 @@
if (key === 0) {
val = val.split('.');
$.each(val, function (i, v) {
val[i] = admin.common.humpToLine(v.replace(v[0], v[0].toLowerCase()));
val[i] = ua.common.humpToLine(v.replace(v[0], v[0].toLowerCase()));
});
val = val.join(".");
array[key] = val;
@@ -240,7 +240,7 @@
callback = function () {
};
}
var index = layer.msg(msg, { icon: 1, shade: admin.config.shade, scrollbar: false, time: 800, shadeClose: true }, callback);
var index = layer.msg(msg, { icon: 1, shade: ua.config.shade, scrollbar: false, time: 800, shadeClose: true }, callback);
return index;
},
// 失败消息
@@ -249,7 +249,7 @@
callback = function () {
};
}
var index = layer.msg(msg, { icon: 2, shade: admin.config.shade, scrollbar: false, time: -1, shadeClose: true }, callback);
var index = layer.msg(msg, { icon: 2, shade: ua.config.shade, scrollbar: false, time: -1, shadeClose: true }, callback);
return index;
},
// 警告消息框
@@ -285,5 +285,5 @@
window.UA_CORE = { form: form, layer: layer, laydate: laydate, upload: upload, element: element, laytpl: laytpl, util: util, table: table };
window.UA_SHARED = { init: init, extGroup: extGroup };
window.UA_ADMIN = admin;
window.UA_ADMIN = ua;
})();