重构代码:移除ajax请求的最后一个/字符

This commit is contained in:
Argo-MacBookPro 2018-09-13 16:58:59 +08:00
parent 0fdbaa0dbb
commit efc0106f39
5 changed files with 18 additions and 17 deletions

View File

@ -91,7 +91,7 @@
<span class="fa fa-user-plus"></span>
</div>
</div>
<input type="text" id="userName" autocomplete="off" class="form-control" placeholder="登陆账号不可为空" minlength="4" maxlength="50" remote="api/Register/" data-remote-msg="此用户已存在" data-valid="true" />
<input type="text" id="userName" autocomplete="off" class="form-control" placeholder="登陆账号不可为空" minlength="4" maxlength="50" remote="api/Register" data-remote-msg="此用户已存在" data-valid="true" />
</div>
</div>
<div class="form-group">

View File

@ -50,7 +50,7 @@
<div class="form-row">
<div class="form-group col-sm-6">
<label class="control-label" for="userName">登陆名称</label>
<input type="text" class="form-control" id="userName" placeholder="不可为空50字以内" minlength="4" maxlength="50" remote="api/Register/" data-remote-msg="此用户已存在" data-valid="true" />
<input type="text" class="form-control" id="userName" placeholder="不可为空50字以内" minlength="4" maxlength="50" remote="api/Register" data-remote-msg="此用户已存在" data-valid="true" />
</div>
<div class="form-group col-sm-6">
<label class="control-label" for="displayName">显示名称</label>

View File

@ -14,7 +14,7 @@
$('#btnSubmit').on('click', function () {
$.bc({
url: "api/New/",
url: "api/New",
data: { UserName: $('#userName').val(), Password: $('#password').val(), DisplayName: $('#displayName').val(), Description: $('#description').val() },
modal: '#dialogNew',
method: "post",

View File

@ -143,8 +143,9 @@
var data = options.method === 'get' ? options.data : JSON.stringify(options.data);
var url = options.id !== '' ? $.formatUrl(options.url) + '/' + options.id : $.formatUrl(options.url);
var ajaxSettings = {
url: $.formatUrl(options.url) + options.id,
url: url,
data: data,
method: options.method,
contentType: options.contentType,
@ -307,7 +308,7 @@
},
msgHandler: function (options) {
var settings = {
url: 'api/WS/',
url: 'api/WS',
interval: 10000,
sendMessage: '',
timerHandler: null,
@ -396,62 +397,62 @@
// Roles
Role = {
url: 'api/Roles/',
url: 'api/Roles',
title: "分配角色"
};
// Users
User = {
url: 'api/Users/',
url: 'api/Users',
title: "分配用户"
};
// Groups
Group = {
url: 'api/Groups/',
url: 'api/Groups',
title: "分配部门"
};
// Menus
Menu = {
url: 'api/Menus/',
url: 'api/Menus',
iconView: 'Admin/IconView',
title: "分配菜单"
};
// Exceptions
Exceptions = {
url: 'api/Exceptions/',
url: 'api/Exceptions',
title: "程序异常日志"
};
// Dicts
Dicts = {
url: 'api/Dicts/'
url: 'api/Dicts'
};
// Profiles
Profiles = {
url: 'api/Profiles/'
url: 'api/Profiles'
};
// Settings
Settings = {
url: 'api/Settings/'
url: 'api/Settings'
};
// Messages
Messages = {
url: 'api/Messages/'
url: 'api/Messages'
};
// Tasks
Tasks = {
url: 'api/Tasks/'
url: 'api/Tasks'
};
// Notifications
Notifications = {
url: 'api/Notifications/'
url: 'api/Notifications'
};
})(jQuery);

View File

@ -1,7 +1,7 @@
$(function () {
$('.site-footer').footer();
var apiUrl = "api/New/";
var apiUrl = "api/New";
var $table = $('table').smartTable({
url: apiUrl,
sidePagination: "client",