function gotoLogin() {
|
window.location.href = "login.html";
|
}
|
|
function getQueryString(name) {
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
var r = window.location.search.substr(1).match(reg);
|
if(r != null) return unescape(r[2]);
|
return null;
|
}
|
|
function doResponse(data, successEvent) {
|
if(data.code == 0)
|
successEvent;
|
else if(data.code == 2)
|
gotoLogin();
|
else
|
layer.msg(data.msg);
|
}
|
|
function getCommonTime(timestamp) {
|
var newDate = new Date();
|
newDate.setTime(timestamp);
|
return newDate.getFullYear() + "-" + (newDate.getMonth() + 1) + "-" + (newDate.getDay() + 1) + " " + newDate.getHours() + ":" + newDate.getMinutes();
|
}
|
|
function bindCheck() {
|
$(".check-all").bind("change", function() {
|
if($(this).is(':checked')) {
|
$(".check-item").prop("checked", true);
|
} else {
|
$(".check-item").prop("checked", false);
|
}
|
});
|
}
|
|
$(function() {
|
bindCheck();
|
|
function getVideoType(pid, $parentselectitem) {
|
console.log("开始获取分类");
|
$.post('../new/api/class/getnextclass', {
|
"pid": pid
|
}, function(data) {
|
console.log("返回结果:" + JSON.stringify(data));
|
if(data.data.length > 0) {
|
if($parentselectitem == undefined) { //第一级
|
$(".videotypes .roottype").empty();
|
$(".videotypes .roottype").append("<option value='0'>全部</option>");
|
for(var i = 0; i < data.data.length; i++) {
|
$(".videotypes .roottype").append("<option value='" + data.data[i].id + "'>" + data.data[i].name + "</option>");
|
}
|
$(".videotypes .roottype").bind("change", function() {
|
getVideoType($(this).val(), $(this));
|
});
|
|
} else { //下面几级
|
$parentselectitem.nextAll().remove();
|
if(pid > 0) {
|
|
var html = "";
|
|
html += "<select class='form-control search'>";
|
html += "<option value='" + pid + "'>全部</option>";
|
for(var i = 0; i < data.data.length; i++) {
|
html += "<option value='" + data.data[i].id + "'>" + data.data[i].name + "</option>";
|
}
|
html += "</select>";
|
$parentselectitem.parent().append(html);
|
$parentselectitem.next().bind("change", function() {
|
getVideoType($(this).val(), $(this));
|
});
|
}
|
}
|
}
|
|
}, 'json');
|
}
|
if($(".videotypes .roottype"))
|
getVideoType(0, undefined);
|
|
if($(".select-detailsystem"))
|
$.post('../new/api/common/detailsystemlist', function(data) {
|
if(data.code == 0) {
|
$(".select-detailsystem").empty();
|
$(".select-detailsystem").append("<option value='0'>" + '全部' + "</option>>");
|
for(var i = 0; i < data.data.length; i++) {
|
$(".select-detailsystem").append("<option value='" + data.data[i].id + "'>" + data.data[i].name + "</option>>");
|
}
|
}
|
}, 'json');
|
});
|