作者 654550265

BUG修改

@@ -195,185 +195,190 @@ @@ -195,185 +195,190 @@
195 } 195 }
196 196
197 $(function () { 197 $(function () {
198 - var obj = {  
199 - teach_id: $('#teacher').val(),  
200 - day: $('#time').val(),  
201 - }; 198 + $(function () {
  199 + var obj = {
  200 + teach_id: $('#teacher').val(),
  201 + day: $('#time').val(),
  202 + };
202 203
203 - function find_seting(obj) {  
204 - if (obj) {  
205 - $.ajax({  
206 - url: "{:url('find_seting')}",  
207 - data: {  
208 - uid: obj.teach_id,  
209 - day: obj.day.replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2-$3")  
210 - },  
211 - success: function (res) {  
212 - console.log(res);  
213 - if (res.code == '1') {  
214 - var time_list = JSON.parse(res.data);  
215 - for (var i = 0; i < time_list.length; i++) {  
216 - if (time_list[i] == 'yes') {  
217 - $('.time-box span')[i].setAttribute('class', 'acv');  
218 - } else {  
219 - $('.time-box span')[i].setAttribute('class', ''); 204 + function find_seting(obj) {
  205 + if (obj) {
  206 + $.ajax({
  207 + url: "{:url('find_seting')}",
  208 + data: {
  209 + uid: obj.teach_id,
  210 + day: obj.day.replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2-$3")
  211 + },
  212 + success: function (res) {
  213 + console.log(res);
  214 + if (res.code == '1') {
  215 + var time_list = JSON.parse(res.data);
  216 + for (var i = 0; i < time_list[0].length; i++) {
  217 + if (time_list[i] == 'yes') {
  218 + $('.time-box span')[i].setAttribute('class', 'acv');
  219 + $('.time-box span')[i].setAttribute('data-sec', time_list[1][i]);
  220 + } else {
  221 + $('.time-box span')[i].setAttribute('class', '');
  222 + $('.time-box span')[i].setAttribute('data-sec', time_list[1][i]);
  223 + }
220 } 224 }
221 } 225 }
222 } 226 }
  227 + });
  228 + } else {
  229 + var list = $('.time-box span');
  230 + for (var i = 0; i < list.length; i++) {
  231 + list[i].setAttribute('class', '');
223 } 232 }
224 - });  
225 - } else {  
226 - var list = $('.time-box span');  
227 - for (var i = 0; i < list.length; i++) {  
228 - list[i].setAttribute('class', '');  
229 } 233 }
230 } 234 }
231 - }  
232 235
233 - find_seting();  
234 - $('#teacher').change(function () {  
235 - obj.teach_id = $(this).val();  
236 - if (obj.day != -1) {  
237 - find_seting(obj);  
238 - } else {  
239 - layer.msg('请选择时间');  
240 - }  
241 - });  
242 - $('#time').change(function () {  
243 - obj.day = $(this).val().split('-').join('');  
244 - if (obj.teach_id != -1) {  
245 - find_seting(obj);  
246 - } else {  
247 - layer.msg('请选择教练');  
248 - }  
249 - });  
250 - $('.time-box').on('click', '.acv', function () {  
251 - for (var i = 0; i < $(".time-box .acv").length; i++) {  
252 - $(".time-box .acv")[i].setAttribute("class", "acv");  
253 - }  
254 - $(this).attr("class", "acv bg-colo"); 236 + find_seting();
  237 + $('#teacher').change(function () {
  238 + obj.teach_id = $(this).val();
  239 + if (obj.day != -1) {
  240 + find_seting(obj);
  241 + } else {
  242 + layer.msg('请选择时间');
  243 + }
  244 + });
  245 + $('#time').change(function () {
  246 + obj.day = $(this).val().split('-').join('');
  247 + if (obj.teach_id != -1) {
  248 + find_seting(obj);
  249 + } else {
  250 + layer.msg('请选择教练');
  251 + }
  252 + });
  253 + $('.time-box').on('click', '.acv', function () {
  254 + for (var i = 0; i < $(".time-box .acv").length; i++) {
  255 + $(".time-box .acv")[i].setAttribute("class", "acv");
  256 + }
  257 + $(this).attr("class", "acv bg-colo");
255 // if ($(this).attr('class') == 'acv bg-colo') { 258 // if ($(this).attr('class') == 'acv bg-colo') {
256 // $(this).attr('class', 'acv'); 259 // $(this).attr('class', 'acv');
257 // } else { 260 // } else {
258 // $(this).attr('class', 'acv bg-colo'); 261 // $(this).attr('class', 'acv bg-colo');
259 // } 262 // }
260 - });  
261 - $('.save').click(function () {  
262 - var list = $('.bg-colo');  
263 - var put_list = [];  
264 - for (var i = 0; i < list.length; i++) {  
265 - put_list.push(list[i]);  
266 - }  
267 - if (put_list.length != 1) {  
268 - alert('时间段不能多选');  
269 - } else if (put_list.length == 0) {  
270 - alert('请选择时间段');  
271 - } else {  
272 - var teacher_id = $('#teacher').val();  
273 - var time_id = $('#time').val().split('-').join('');  
274 - $.ajax({  
275 - url: "{:url('seting_do')}",  
276 - data: {  
277 - teach_id: teacher_id,  
278 - day: time_id.replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2-$3"),  
279 - begin: parseInt(put_list[0].innerHTML.split("-")[0]),  
280 - end: parseInt(put_list[0].innerHTML.split("-")[1])  
281 - },  
282 - success: function (res) {  
283 - console.log(res);  
284 - if (res.code == "1") {  
285 - layer.msg(res.msg);  
286 - window.location.reload(); 263 + });
  264 + $('.save').click(function () {
  265 + var list = $('.bg-colo');
  266 + var put_list = [];
  267 + for (var i = 0; i < list.length; i++) {
  268 + put_list.push(list[i]);
  269 + }
  270 + if (put_list.length != 1) {
  271 + alert('时间段不能多选');
  272 + } else if (put_list.length == 0) {
  273 + alert('请选择时间段');
  274 + } else {
  275 + var teacher_id = $('#teacher').val();
  276 + var time_id = $('#time').val().split('-').join('');
  277 + $.ajax({
  278 + url: "{:url('seting_do')}",
  279 + data: {
  280 + teach_id: teacher_id,
  281 + day: time_id.replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2-$3"),
  282 + begin: parseInt(put_list[0].innerHTML.split("-")[0]),
  283 + end: parseInt(put_list[0].innerHTML.split("-")[1])
  284 + },
  285 + success: function (res) {
  286 + console.log(res);
  287 + if (res.code == "1") {
  288 + layer.msg(res.msg);
  289 + window.location.reload();
  290 + }
287 } 291 }
288 - }  
289 - });  
290 - }  
291 - });  
292 - setCookie("refersh_time", 0);  
293 - Wind.use('ajaxForm', 'artDialog', 'iframeTools', function () {  
294 - //批量复制  
295 - $('.js-articles-copy').click(function (e) {  
296 - var ids = [];  
297 - $("input[name='ids[]']").each(function () {  
298 - if ($(this).is(':checked')) {  
299 - ids.push($(this).val());  
300 - }  
301 - });  
302 -  
303 - if (ids.length == 0) {  
304 - art.dialog.through({  
305 - id: 'error',  
306 - icon: 'error',  
307 - content: '您没有勾选信息,无法进行操作!',  
308 - cancelVal: '关闭',  
309 - cancel: true  
310 }); 292 });
311 - return false;  
312 } 293 }
  294 + });
  295 + setCookie("refersh_time", 0);
  296 + Wind.use('ajaxForm', 'artDialog', 'iframeTools', function () {
  297 + //批量复制
  298 + $('.js-articles-copy').click(function (e) {
  299 + var ids = [];
  300 + $("input[name='ids[]']").each(function () {
  301 + if ($(this).is(':checked')) {
  302 + ids.push($(this).val());
  303 + }
  304 + });
  305 +
  306 + if (ids.length == 0) {
  307 + art.dialog.through({
  308 + id: 'error',
  309 + icon: 'error',
  310 + content: '您没有勾选信息,无法进行操作!',
  311 + cancelVal: '关闭',
  312 + cancel: true
  313 + });
  314 + return false;
  315 + }
313 316
314 - ids = ids.join(',');  
315 - art.dialog.open("__ROOT__/index.php?g=portal&m=AdminArticle&a=copy&ids=" + ids, {  
316 - title: "批量复制",  
317 - width: "300px" 317 + ids = ids.join(',');
  318 + art.dialog.open("__ROOT__/index.php?g=portal&m=AdminArticle&a=copy&ids=" + ids, {
  319 + title: "批量复制",
  320 + width: "300px"
  321 + });
318 }); 322 });
319 - });  
320 - $('.time-box span').click(function () {  
321 - if ($(this).attr("class") == "") {  
322 - var teacher_id = $('#teacher').val();  
323 - var time_id = $('#time').val().split('-').join('');  
324 - if (teacher_id == "") {  
325 - layer.msg("请选择教练")  
326 - } else if (time_id == 1) {  
327 - layer.msg("请选择日期")  
328 - } else {  
329 - var _this = $(this);  
330 - $.ajax({  
331 - url: "{:url('seting_do')}",  
332 - data: {  
333 - teach_id: teacher_id,  
334 - day: time_id.replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2-$3"),  
335 - begin: parseInt($(this)[0].innerHTML.split("-")[0]),  
336 - end: parseInt($(this)[0].innerHTML.split("-")[1])  
337 - },  
338 - success: function (res) {  
339 - if (res.code == 1) {  
340 - console.log($(this));  
341 - _this.attr("class", "acv");  
342 - layer.msg(res.msg); 323 + $('.time-box span').click(function () {
  324 + if ($(this).attr("class") == "") {
  325 + var teacher_id = $('#teacher').val();
  326 + var time_id = $('#time').val().split('-').join('');
  327 + if (teacher_id == "") {
  328 + layer.msg("请选择教练")
  329 + } else if (time_id == 1) {
  330 + layer.msg("请选择日期")
  331 + } else if ($(this).attr("data-sec") == "no") {
  332 + layer.msg("学生预约不可操作");
  333 + } else {
  334 + var _this = $(this);
  335 + $.ajax({
  336 + url: "{:url('seting_do')}",
  337 + data: {
  338 + teach_id: teacher_id,
  339 + day: time_id.replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2-$3"),
  340 + begin: parseInt($(this)[0].innerHTML.split("-")[0]),
  341 + end: parseInt($(this)[0].innerHTML.split("-")[1])
  342 + },
  343 + success: function (res) {
  344 + if (res.code == 1) {
  345 + console.log($(this));
  346 + _this.attr("class", "acv");
  347 + layer.msg(res.msg);
  348 + }
343 } 349 }
344 - }  
345 - }); 350 + });
  351 + }
346 } 352 }
347 - } 353 + });
  354 + //批量移动
  355 + // $('.js-articles-move').click(function (e) {
  356 + // var ids = [];
  357 + // $("input[name='ids[]']").each(function () {
  358 + // if ($(this).is(':checked')) {
  359 + // ids.push($(this).val());
  360 + // }
  361 + // });
  362 + //
  363 + // if (ids.length == 0) {
  364 + // art.dialog.through({
  365 + // id: 'error',
  366 + // icon: 'error',
  367 + // content: '您没有勾选信息,无法进行操作!',
  368 + // cancelVal: '关闭',
  369 + // cancel: true
  370 + // });
  371 + // return false;
  372 + // }
  373 + //
  374 + // ids = ids.join(',');
  375 + // art.dialog.open("__ROOT__/index.php?g=portal&m=AdminArticle&a=move&old_term_id={$term.term_id|default=0}&ids=" + ids, {
  376 + // title: "批量移动",
  377 + // width: "300px"
  378 + // });
  379 + // });
348 }); 380 });
349 - //批量移动  
350 - // $('.js-articles-move').click(function (e) {  
351 - // var ids = [];  
352 - // $("input[name='ids[]']").each(function () {  
353 - // if ($(this).is(':checked')) {  
354 - // ids.push($(this).val());  
355 - // }  
356 - // });  
357 - //  
358 - // if (ids.length == 0) {  
359 - // art.dialog.through({  
360 - // id: 'error',  
361 - // icon: 'error',  
362 - // content: '您没有勾选信息,无法进行操作!',  
363 - // cancelVal: '关闭',  
364 - // cancel: true  
365 - // });  
366 - // return false;  
367 - // }  
368 - //  
369 - // ids = ids.join(',');  
370 - // art.dialog.open("__ROOT__/index.php?g=portal&m=AdminArticle&a=move&old_term_id={$term.term_id|default=0}&ids=" + ids, {  
371 - // title: "批量移动",  
372 - // width: "300px"  
373 - // });  
374 - // });  
375 }); 381 });
376 - });  
377 </script> 382 </script>
378 <script src="http://www.jq22.com/jquery/1.11.1/jquery.min.js"></script> 383 <script src="http://www.jq22.com/jquery/1.11.1/jquery.min.js"></script>
379 <script src="/static/src/zoomify/zoomify.js"></script> 384 <script src="/static/src/zoomify/zoomify.js"></script>