-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
113 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,116 @@ | ||
/** | ||
* Created by livi on 16/4/20. | ||
*/ | ||
$(function(){ | ||
|
||
$('.delete').bind('click', function () { | ||
var delId = $(this).attr("del-id"); | ||
var delids=[]; | ||
delids.push(delId); | ||
var r = confirm("确定删除?"); | ||
if (r) { | ||
$(function() { | ||
|
||
$("#savetag").click(function() { | ||
var newData = { | ||
id: $("#tid").val(), | ||
domain: $(".domain").val(), | ||
link: $(".link").val(), | ||
logo: $(".logo").val(), | ||
qq: $(".qq").val(), | ||
flag: $("#tagselect").val(), | ||
orders: $(".orders").val(), | ||
__CSRF__: G_csrf | ||
} | ||
$.ajax({ | ||
url: '/admin/links/delsome', | ||
data: {delarr:delids,__CSRF__: G_csrf}, | ||
url: '/admin/links/save', | ||
data: newData, | ||
type: 'POST', | ||
success: function (json) { | ||
success: function(json) { | ||
if (json.errno === 0) { | ||
alert("删除成功!"); | ||
window.location.href = "/admin/links"; | ||
}else{ | ||
alert("保存成功!"); | ||
window.location.href = "/admin/links/list" | ||
} else { | ||
alert(json.errmsg) | ||
} | ||
} | ||
}) | ||
} else { | ||
} | ||
}) | ||
}) | ||
|
||
//批量删除 | ||
var delsome=function(){ | ||
var delids=[]; | ||
$.each($('input[type="checkbox"]','tbody'),function(i,item){ | ||
if($(item).is(':checked')){ | ||
delids.push($(this).val()); | ||
} | ||
}) | ||
var r = confirm("确定删除?"); | ||
if (r) { | ||
// 删除/批量删除接口 | ||
$('.delete').bind('click', function() { | ||
var delId = $(this).attr("del-id"); | ||
var delids = []; | ||
delids.push(delId); | ||
var r = confirm("确定删除?"); | ||
if (r) { | ||
$.ajax({ | ||
url: '/admin/links/delsome', | ||
data: { delarr: delids, __CSRF__: G_csrf }, | ||
type: 'POST', | ||
success: function(json) { | ||
if (json.errno === 0) { | ||
alert("删除成功!"); | ||
window.location.href = "/admin/links"; | ||
} else { | ||
alert(json.errmsg) | ||
} | ||
} | ||
}) | ||
} else {} | ||
}) | ||
// 显示该友情链接 | ||
$(".toshow").on('click', function() { | ||
var tid = $(this).attr("tid"); | ||
$.ajax({ | ||
url: '/admin/links/delsome', | ||
data: {delarr:delids,__CSRF__: G_csrf}, | ||
url: '/admin/links/upstatus', | ||
data: { id: tid, flag: 1, __CSRF__: G_csrf }, | ||
type: 'POST', | ||
success: function (json) { | ||
success: function(json) { | ||
if (json.errno === 0) { | ||
alert("删除成功!"); | ||
alert("更新成功!"); | ||
window.location.href = "/admin/links"; | ||
}else{ | ||
} else { | ||
alert(json.errmsg) | ||
} | ||
} | ||
}) | ||
} else { | ||
return false | ||
}) | ||
// 隐藏该友情链接 | ||
$(".tohide").on('click', function() { | ||
var tid = $(this).attr("tid"); | ||
$.ajax({ | ||
url: '/admin/links/upstatus', | ||
data: { id: tid, flag: 0, __CSRF__: G_csrf }, | ||
type: 'POST', | ||
success: function(json) { | ||
if (json.errno === 0) { | ||
alert("更新成功!"); | ||
window.location.href = "/admin/links/list"; | ||
} else { | ||
alert(json.errmsg) | ||
} | ||
} | ||
}) | ||
}) | ||
}) | ||
|
||
//批量删除 | ||
var delsome = function() { | ||
var delids = []; | ||
$.each($('input[type="checkbox"]', 'tbody'), function(i, item) { | ||
if ($(item).is(':checked')) { | ||
delids.push($(this).val()); | ||
} | ||
}) | ||
var r = confirm("确定删除?"); | ||
if (r) { | ||
$.ajax({ | ||
url: '/admin/links/delsome', | ||
data: { delarr: delids, __CSRF__: G_csrf }, | ||
type: 'POST', | ||
success: function(json) { | ||
if (json.errno === 0) { | ||
alert("删除成功!"); | ||
window.location.href = "/admin/links"; | ||
} else { | ||
alert(json.errmsg) | ||
} | ||
} | ||
}) | ||
} else { | ||
return false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,27 @@ | ||
$(function(){ | ||
$("#savetag").click(function(){ | ||
var newData={ | ||
sitename:$(".sitename").val(), | ||
url:$(".url").val(), | ||
keywords:$(".keywords").val(), | ||
description:$(".description").val(), | ||
author:$(".author").val(), | ||
copyright:$(".copyright").val(), | ||
links:$(".links").val(), | ||
theme:$(".theme").val(), | ||
tongji:$(".tongji").val(), | ||
__CSRF__:G_csrf | ||
$(function() { | ||
$("#savetag").click(function() { | ||
var newData = { | ||
sitename: $(".sitename").val(), | ||
url: $(".url").val(), | ||
keywords: $(".keywords").val(), | ||
description: $(".description").val(), | ||
author: $(".author").val(), | ||
copyright: $(".copyright").val(), | ||
theme: $(".theme").val(), | ||
tongji: $(".tongji").val(), | ||
__CSRF__: G_csrf | ||
} | ||
$.ajax({ | ||
url:'/admin/system/edit', | ||
data:newData, | ||
type:'POST', | ||
success:function(json){ | ||
if(json.errno===0){ | ||
url: '/admin/system/edit', | ||
data: newData, | ||
type: 'POST', | ||
success: function(json) { | ||
if (json.errno === 0) { | ||
alert("保存成功!"); | ||
window.location.href="/admin/system" | ||
window.location.href = "/admin/system" | ||
} | ||
} | ||
}) | ||
}) | ||
|
||
}) | ||
}) |