...
|
...
|
@@ -45,6 +45,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin |
|
|
if (value === 'new') {
|
|
|
color = 'green';
|
|
|
}
|
|
|
if (value === 'cancel') {
|
|
|
color = 'black';
|
|
|
}
|
|
|
return '<span style="color:' + color + '">' + __(value) + '</span>';
|
|
|
}},
|
|
|
{
|
...
|
...
|
@@ -64,12 +67,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin |
|
|
],
|
|
|
events: Table.api.events.operate, formatter: function (value, row, index) {
|
|
|
var that = $.extend({}, this);
|
|
|
that.buttons[0].extend = 'data-publish-id="' + row.id + '"';
|
|
|
that.buttons[0].extend = 'data-publish-id="' + row.id + '" data-publish-status="' + row.status + '"';
|
|
|
that.buttons[1].url = 'course_sign/index?ids=' + row.id;
|
|
|
var table = $(that.table).clone(true);
|
|
|
if (row.status === 'confirmed') {
|
|
|
$(table).data("operate-edit", null);
|
|
|
$(table).data("operate-del", null);
|
|
|
that.buttons[0].text = '取消';
|
|
|
}
|
|
|
if (row.status === 'cancel') {
|
|
|
$(table).data("operate-edit", null);
|
|
|
$(table).data("operate-del", null);
|
|
|
$(table).data("operate-publish", null);
|
|
|
}
|
|
|
if (row.status === 'new') {
|
...
|
...
|
@@ -89,33 +97,60 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin |
|
|
//发布
|
|
|
$(document).on("click",".btn-publish",function (e) {
|
|
|
var id = $(this).data('publish-id');
|
|
|
var status = $(this).data('publish-status');
|
|
|
e.stopPropagation();
|
|
|
e.preventDefault();
//事件冒泡阻止
|
|
|
var that = this;
|
|
|
var table = $(that).closest('table');
|
|
|
var options = table.bootstrapTable('getOptions');
|
|
|
Layer.open({title: '发布', content: '是否发布此课程', btn: '确定',yes:function (row) {
|
|
|
$.ajax({
|
|
|
type : "POST",
|
|
|
url : "course_store/publish",
|
|
|
data : {
|
|
|
id : id
|
|
|
},
|
|
|
dataType: "json",
|
|
|
success : function (data) {
|
|
|
// console.log(data);
|
|
|
if (data.code === 1) {
|
|
|
Layer.msg('发布成功')
|
|
|
Layer.closeAll()
|
|
|
$('.btn-refresh').trigger('click')
|
|
|
} else {
|
|
|
Layer.msg('发布失败')
|
|
|
Layer.closeAll()
|
|
|
}
|
|
|
if(status === 'confirmed'){
|
|
|
Layer.open({title: '取消', content: '是否取消此课程', btn: '确定',yes:function (row) {
|
|
|
$.ajax({
|
|
|
type : "POST",
|
|
|
url : "course_store/publish",
|
|
|
data : {
|
|
|
id : id
|
|
|
},
|
|
|
dataType: "json",
|
|
|
success : function (data) {
|
|
|
// console.log(data);
|
|
|
if (data.code === 1) {
|
|
|
Layer.msg('取消成功');
|
|
|
Layer.closeAll();
|
|
|
$('.btn-refresh').trigger('click')
|
|
|
} else {
|
|
|
Layer.msg('取消失败');
|
|
|
Layer.closeAll()
|
|
|
}
|
|
|
|
|
|
}
|
|
|
})
|
|
|
}})
|
|
|
}
|
|
|
})
|
|
|
}})
|
|
|
}
|
|
|
if(status === 'new'){
|
|
|
Layer.open({title: '发布', content: '是否发布此课程', btn: '确定',yes:function (row) {
|
|
|
$.ajax({
|
|
|
type : "POST",
|
|
|
url : "course_store/publish",
|
|
|
data : {
|
|
|
id : id
|
|
|
},
|
|
|
dataType: "json",
|
|
|
success : function (data) {
|
|
|
// console.log(data);
|
|
|
if (data.code === 1) {
|
|
|
Layer.msg('发布成功');
|
|
|
Layer.closeAll();
|
|
|
$('.btn-refresh').trigger('click')
|
|
|
} else {
|
|
|
Layer.msg('发布失败');
|
|
|
Layer.closeAll()
|
|
|
}
|
|
|
|
|
|
}
|
|
|
})
|
|
|
}})
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
add: function () {
|
...
|
...
|
|