mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-08 19:12:48 +08:00
完善js的url拼装;增加data-request的参数设置
This commit is contained in:
@@ -79,8 +79,15 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick
|
|||||||
},
|
},
|
||||||
url: function (url) {
|
url: function (url) {
|
||||||
|
|
||||||
if (url.indexOf('/') === 0) {
|
var urlPrefixCheck = ['/', 'http://', 'https://'];
|
||||||
return url;
|
|
||||||
|
for (const index in urlPrefixCheck) {
|
||||||
|
if (Object.hasOwnProperty.call(urlPrefixCheck, index)) {
|
||||||
|
const prefix = urlPrefixCheck[index];
|
||||||
|
if (url.indexOf(prefix) === 0) {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return '/' + CONFIG.ADMIN + '/' + url;
|
return '/' + CONFIG.ADMIN + '/' + url;
|
||||||
@@ -1676,7 +1683,8 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick
|
|||||||
tableId = $(this).attr('data-table'),
|
tableId = $(this).attr('data-table'),
|
||||||
checkbox = $(this).attr('data-checkbox'),
|
checkbox = $(this).attr('data-checkbox'),
|
||||||
direct = $(this).attr('data-direct'),
|
direct = $(this).attr('data-direct'),
|
||||||
field = $(this).attr('data-field') || 'id';
|
field = $(this).attr('data-field') || 'id',
|
||||||
|
endMethod = $(this).attr('data-end-method') || 'reload-table';
|
||||||
|
|
||||||
title = title || '确定进行该操作?';
|
title = title || '确定进行该操作?';
|
||||||
|
|
||||||
@@ -1703,18 +1711,19 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick
|
|||||||
postData[field] = ids;
|
postData[field] = ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
url = admin.url(url);
|
url = admin.url(url);
|
||||||
|
|
||||||
tableId = tableId || init.table_render_id;
|
|
||||||
admin.msg.confirm(title, function () {
|
admin.msg.confirm(title, function () {
|
||||||
admin.request.post({
|
admin.request.post({
|
||||||
url: url,
|
url: url,
|
||||||
data: postData,
|
data: postData,
|
||||||
}, function (res) {
|
}, function (res) {
|
||||||
admin.msg.success(res.msg, function () {
|
if (endMethod == 'reload-table') {
|
||||||
table.reloadData(tableId);
|
tableId = tableId || init.table_render_id;
|
||||||
});
|
table.reload(tableId);
|
||||||
|
} else if (endMethod == 'refresh-page') {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user