Commit cd9aad92 authored by Van's avatar Van

🚧 #12256

parent 62d7a0c7
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* @description index for admin * @description index for admin
* *
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 1.0.3.2, Sep 2, 2013 * @version 1.1.3.2, Mar 31, 2017
*/ */
var Admin = function () { var Admin = function () {
this.register = {}; this.register = {};
......
...@@ -28,10 +28,6 @@ admin.categoryList = { ...@@ -28,10 +28,6 @@ admin.categoryList = {
pageCount: 1, pageCount: 1,
currentPage: 1 currentPage: 1
}, },
categoryInfo: {
'oId': "",
"categoryRole": ""
},
/* /*
* 初始化 table, pagination * 初始化 table, pagination
*/ */
...@@ -125,7 +121,7 @@ admin.categoryList = { ...@@ -125,7 +121,7 @@ admin.categoryList = {
categoryData[i].expendRow = "<a href='javascript:void(0)' onclick=\"admin.categoryList.get('" + categoryData[i].expendRow = "<a href='javascript:void(0)' onclick=\"admin.categoryList.get('" +
categories[i].oId + "')\">" + Label.updateLabel + "</a>\ categories[i].oId + "')\">" + Label.updateLabel + "</a>\
<a href='javascript:void(0)' onclick=\"admin.categoryList.del('" + categories[i].oId + "', '" + <a href='javascript:void(0)' onclick=\"admin.categoryList.del('" + categories[i].oId + "', '" +
categories[i].categoryName + "')\">" + Label.removeLabel + "</a> "; categories[i].categoryTitle + "')\">" + Label.removeLabel + "</a> ";
that.tablePagination.updateTablePagination(categoryData, pageNum, result.pagination); that.tablePagination.updateTablePagination(categoryData, pageNum, result.pagination);
...@@ -182,10 +178,10 @@ admin.categoryList = { ...@@ -182,10 +178,10 @@ admin.categoryList = {
} }
}, },
/* /*
* 获取用户 * 获取单个分类
* @id 用户 id * @id 用户 id
*/ */
get: function(id, categoryRole) { get: function(id) {
$("#loadMsg").text(Label.loadingLabel); $("#loadMsg").text(Label.loadingLabel);
$("#tipMsg").text(""); $("#tipMsg").text("");
$("#categoryUpdate").dialog("open"); $("#categoryUpdate").dialog("open");
...@@ -201,43 +197,29 @@ admin.categoryList = { ...@@ -201,43 +197,29 @@ admin.categoryList = {
return; return;
} }
var $categoryEmailUpdate = $("#categoryEmailUpdate"); $("#categoryNameUpdate").val(result.category.categoryTitle).data("oId", id);
$("#categoryNameUpdate").val(result.category.categoryName).data("categoryInfo", { $("#categoryURIUpdate").val(result.category.categoryURI);
'oId': id, $("#categoryDescUpdate").val(result.category.categoryDesc);
"categoryRole": categoryRole $("#categoryTagsUpdate").val(result.category.categoryTags);
});
$categoryEmailUpdate.val(result.category.categoryEmail);
if ("adminRole" === categoryRole) {
$categoryEmailUpdate.attr("disabled", "disabled");
} else {
$categoryEmailUpdate.removeAttr("disabled");
}
$("#categoryURLUpdate").val(result.category.categoryURL);
$("#categoryPasswordUpdate").val(result.category.categoryPassword);
$("#categoryAvatarUpdate").val(result.category.categoryAvatar);
$("#loadMsg").text(""); $("#loadMsg").text("");
} }
}); });
}, },
/* /*
* 更新用户 * 更新分类
*/ */
update: function() { update: function() {
if (this.validate("Update")) { if (this.validate("Update")) {
$("#loadMsg").text(Label.loadingLabel); $("#loadMsg").text(Label.loadingLabel);
$("#tipMsg").text(""); $("#tipMsg").text("");
var categoryInfo = $("#categoryNameUpdate").data("categoryInfo");
var requestJSONObject = { var requestJSONObject = {
"categoryName": $("#categoryNameUpdate").val(), "categoryTitle": $("#categoryNameUpdate").val(),
"oId": categoryInfo.oId, "oId": $("#categoryNameUpdate").data("oId"),
"categoryEmail": $("#categoryEmailUpdate").val(), "categoryTags": $("#categoryTagsUpdate").val(),
"categoryURL": $("#categoryURLUpdate").val(), "categoryURI": $("#categoryURIUpdate").val(),
"categoryRole": categoryInfo.categoryRole, "categoryDesc": $("#categoryDescUpdate").val()
"categoryPassword": $("#categoryPasswordUpdate").val(),
"categoryAvatar": $("#categoryAvatarUpdate").val()
}; };
$.ajax({ $.ajax({
...@@ -261,9 +243,9 @@ admin.categoryList = { ...@@ -261,9 +243,9 @@ admin.categoryList = {
} }
}, },
/* /*
* 删除用户 * 删除分类
* @id 用户 id * @id 分类 id
* @categoryName 用户名称 * @categoryName 分类名称
*/ */
del: function(id, categoryName) { del: function(id, categoryName) {
var isDelete = confirm(Label.confirmRemoveLabel + Label.categoryLabel + '"' + categoryName + '"?'); var isDelete = confirm(Label.confirmRemoveLabel + Label.categoryLabel + '"' + categoryName + '"?');
...@@ -299,39 +281,6 @@ admin.categoryList = { ...@@ -299,39 +281,6 @@ admin.categoryList = {
}); });
} }
}, },
/**
* 修改角色
* @param id
*/
changeRole: function(id) {
$("#tipMsg").text("");
$.ajax({
url: latkeConfig.servePath + "/console/changeRole/" + id,
type: "GET",
cache: false,
success: function(result, textStatus) {
$("#tipMsg").text(result.msg);
if (!result.sc) {
$("#loadMsg").text("");
return;
}
var pageNum = admin.categoryList.pageInfo.currentPage;
if (admin.categoryList.pageInfo.currentCount === 1 && admin.categoryList.pageInfo.pageCount !== 1 &&
admin.categoryList.pageInfo.currentPage === admin.categoryList.pageInfo.pageCount) {
admin.categoryList.pageInfo.pageCount--;
pageNum = admin.categoryList.pageInfo.pageCount;
}
var hashList = window.location.hash.split("/");
if (pageNum !== parseInt(hashList[hashList.length - 1])) {
admin.setHashByPage(pageNum);
}
admin.categoryList.getList(pageNum);
$("#loadMsg").text("");
}
});
},
/* /*
* 验证字段 * 验证字段
* @status 更新或者添加时进行验证 * @status 更新或者添加时进行验证
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment