重构代码:移除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> <span class="fa fa-user-plus"></span>
</div> </div>
</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> </div>
<div class="form-group"> <div class="form-group">

View File

@ -50,7 +50,7 @@
<div class="form-row"> <div class="form-row">
<div class="form-group col-sm-6"> <div class="form-group col-sm-6">
<label class="control-label" for="userName">登陆名称</label> <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>
<div class="form-group col-sm-6"> <div class="form-group col-sm-6">
<label class="control-label" for="displayName">显示名称</label> <label class="control-label" for="displayName">显示名称</label>

View File

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

View File

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

View File

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