作者 654550265

BUG修改

... ... @@ -195,185 +195,190 @@
}
$(function () {
var obj = {
teach_id: $('#teacher').val(),
day: $('#time').val(),
};
$(function () {
var obj = {
teach_id: $('#teacher').val(),
day: $('#time').val(),
};
function find_seting(obj) {
if (obj) {
$.ajax({
url: "{:url('find_seting')}",
data: {
uid: obj.teach_id,
day: obj.day.replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2-$3")
},
success: function (res) {
console.log(res);
if (res.code == '1') {
var time_list = JSON.parse(res.data);
for (var i = 0; i < time_list.length; i++) {
if (time_list[i] == 'yes') {
$('.time-box span')[i].setAttribute('class', 'acv');
} else {
$('.time-box span')[i].setAttribute('class', '');
function find_seting(obj) {
if (obj) {
$.ajax({
url: "{:url('find_seting')}",
data: {
uid: obj.teach_id,
day: obj.day.replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2-$3")
},
success: function (res) {
console.log(res);
if (res.code == '1') {
var time_list = JSON.parse(res.data);
for (var i = 0; i < time_list[0].length; i++) {
if (time_list[i] == 'yes') {
$('.time-box span')[i].setAttribute('class', 'acv');
$('.time-box span')[i].setAttribute('data-sec', time_list[1][i]);
} else {
$('.time-box span')[i].setAttribute('class', '');
$('.time-box span')[i].setAttribute('data-sec', time_list[1][i]);
}
}
}
}
});
} else {
var list = $('.time-box span');
for (var i = 0; i < list.length; i++) {
list[i].setAttribute('class', '');
}
});
} else {
var list = $('.time-box span');
for (var i = 0; i < list.length; i++) {
list[i].setAttribute('class', '');
}
}
}
find_seting();
$('#teacher').change(function () {
obj.teach_id = $(this).val();
if (obj.day != -1) {
find_seting(obj);
} else {
layer.msg('请选择时间');
}
});
$('#time').change(function () {
obj.day = $(this).val().split('-').join('');
if (obj.teach_id != -1) {
find_seting(obj);
} else {
layer.msg('请选择教练');
}
});
$('.time-box').on('click', '.acv', function () {
for (var i = 0; i < $(".time-box .acv").length; i++) {
$(".time-box .acv")[i].setAttribute("class", "acv");
}
$(this).attr("class", "acv bg-colo");
find_seting();
$('#teacher').change(function () {
obj.teach_id = $(this).val();
if (obj.day != -1) {
find_seting(obj);
} else {
layer.msg('请选择时间');
}
});
$('#time').change(function () {
obj.day = $(this).val().split('-').join('');
if (obj.teach_id != -1) {
find_seting(obj);
} else {
layer.msg('请选择教练');
}
});
$('.time-box').on('click', '.acv', function () {
for (var i = 0; i < $(".time-box .acv").length; i++) {
$(".time-box .acv")[i].setAttribute("class", "acv");
}
$(this).attr("class", "acv bg-colo");
// if ($(this).attr('class') == 'acv bg-colo') {
// $(this).attr('class', 'acv');
// } else {
// $(this).attr('class', 'acv bg-colo');
// }
});
$('.save').click(function () {
var list = $('.bg-colo');
var put_list = [];
for (var i = 0; i < list.length; i++) {
put_list.push(list[i]);
}
if (put_list.length != 1) {
alert('时间段不能多选');
} else if (put_list.length == 0) {
alert('请选择时间段');
} else {
var teacher_id = $('#teacher').val();
var time_id = $('#time').val().split('-').join('');
$.ajax({
url: "{:url('seting_do')}",
data: {
teach_id: teacher_id,
day: time_id.replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2-$3"),
begin: parseInt(put_list[0].innerHTML.split("-")[0]),
end: parseInt(put_list[0].innerHTML.split("-")[1])
},
success: function (res) {
console.log(res);
if (res.code == "1") {
layer.msg(res.msg);
window.location.reload();
});
$('.save').click(function () {
var list = $('.bg-colo');
var put_list = [];
for (var i = 0; i < list.length; i++) {
put_list.push(list[i]);
}
if (put_list.length != 1) {
alert('时间段不能多选');
} else if (put_list.length == 0) {
alert('请选择时间段');
} else {
var teacher_id = $('#teacher').val();
var time_id = $('#time').val().split('-').join('');
$.ajax({
url: "{:url('seting_do')}",
data: {
teach_id: teacher_id,
day: time_id.replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2-$3"),
begin: parseInt(put_list[0].innerHTML.split("-")[0]),
end: parseInt(put_list[0].innerHTML.split("-")[1])
},
success: function (res) {
console.log(res);
if (res.code == "1") {
layer.msg(res.msg);
window.location.reload();
}
}
}
});
}
});
setCookie("refersh_time", 0);
Wind.use('ajaxForm', 'artDialog', 'iframeTools', function () {
//批量复制
$('.js-articles-copy').click(function (e) {
var ids = [];
$("input[name='ids[]']").each(function () {
if ($(this).is(':checked')) {
ids.push($(this).val());
}
});
if (ids.length == 0) {
art.dialog.through({
id: 'error',
icon: 'error',
content: '您没有勾选信息,无法进行操作!',
cancelVal: '关闭',
cancel: true
});
return false;
}
});
setCookie("refersh_time", 0);
Wind.use('ajaxForm', 'artDialog', 'iframeTools', function () {
//批量复制
$('.js-articles-copy').click(function (e) {
var ids = [];
$("input[name='ids[]']").each(function () {
if ($(this).is(':checked')) {
ids.push($(this).val());
}
});
if (ids.length == 0) {
art.dialog.through({
id: 'error',
icon: 'error',
content: '您没有勾选信息,无法进行操作!',
cancelVal: '关闭',
cancel: true
});
return false;
}
ids = ids.join(',');
art.dialog.open("__ROOT__/index.php?g=portal&m=AdminArticle&a=copy&ids=" + ids, {
title: "批量复制",
width: "300px"
ids = ids.join(',');
art.dialog.open("__ROOT__/index.php?g=portal&m=AdminArticle&a=copy&ids=" + ids, {
title: "批量复制",
width: "300px"
});
});
});
$('.time-box span').click(function () {
if ($(this).attr("class") == "") {
var teacher_id = $('#teacher').val();
var time_id = $('#time').val().split('-').join('');
if (teacher_id == "") {
layer.msg("请选择教练")
} else if (time_id == 1) {
layer.msg("请选择日期")
} else {
var _this = $(this);
$.ajax({
url: "{:url('seting_do')}",
data: {
teach_id: teacher_id,
day: time_id.replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2-$3"),
begin: parseInt($(this)[0].innerHTML.split("-")[0]),
end: parseInt($(this)[0].innerHTML.split("-")[1])
},
success: function (res) {
if (res.code == 1) {
console.log($(this));
_this.attr("class", "acv");
layer.msg(res.msg);
$('.time-box span').click(function () {
if ($(this).attr("class") == "") {
var teacher_id = $('#teacher').val();
var time_id = $('#time').val().split('-').join('');
if (teacher_id == "") {
layer.msg("请选择教练")
} else if (time_id == 1) {
layer.msg("请选择日期")
} else if ($(this).attr("data-sec") == "no") {
layer.msg("学生预约不可操作");
} else {
var _this = $(this);
$.ajax({
url: "{:url('seting_do')}",
data: {
teach_id: teacher_id,
day: time_id.replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2-$3"),
begin: parseInt($(this)[0].innerHTML.split("-")[0]),
end: parseInt($(this)[0].innerHTML.split("-")[1])
},
success: function (res) {
if (res.code == 1) {
console.log($(this));
_this.attr("class", "acv");
layer.msg(res.msg);
}
}
}
});
});
}
}
}
});
//批量移动
// $('.js-articles-move').click(function (e) {
// var ids = [];
// $("input[name='ids[]']").each(function () {
// if ($(this).is(':checked')) {
// ids.push($(this).val());
// }
// });
//
// if (ids.length == 0) {
// art.dialog.through({
// id: 'error',
// icon: 'error',
// content: '您没有勾选信息,无法进行操作!',
// cancelVal: '关闭',
// cancel: true
// });
// return false;
// }
//
// ids = ids.join(',');
// art.dialog.open("__ROOT__/index.php?g=portal&m=AdminArticle&a=move&old_term_id={$term.term_id|default=0}&ids=" + ids, {
// title: "批量移动",
// width: "300px"
// });
// });
});
//批量移动
// $('.js-articles-move').click(function (e) {
// var ids = [];
// $("input[name='ids[]']").each(function () {
// if ($(this).is(':checked')) {
// ids.push($(this).val());
// }
// });
//
// if (ids.length == 0) {
// art.dialog.through({
// id: 'error',
// icon: 'error',
// content: '您没有勾选信息,无法进行操作!',
// cancelVal: '关闭',
// cancel: true
// });
// return false;
// }
//
// ids = ids.join(',');
// art.dialog.open("__ROOT__/index.php?g=portal&m=AdminArticle&a=move&old_term_id={$term.term_id|default=0}&ids=" + ids, {
// title: "批量移动",
// width: "300px"
// });
// });
});
});
</script>
<script src="http://www.jq22.com/jquery/1.11.1/jquery.min.js"></script>
<script src="/static/src/zoomify/zoomify.js"></script>
... ...