mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-23 20:00:27 +08:00
修正课时发布switch开关问题
This commit is contained in:
parent
dd0c26d6ad
commit
6c33dbc724
@ -31,50 +31,4 @@
|
||||
{{ partial('chapter/lessons_offline') }}
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block inline_js %}
|
||||
|
||||
<script>
|
||||
|
||||
layui.use(['jquery', 'layer', 'form'], function () {
|
||||
|
||||
var $ = layui.jquery;
|
||||
var layer = layui.layer;
|
||||
var form = layui.form;
|
||||
|
||||
form.on('switch(free)', function (data) {
|
||||
var checked = $(this).is(':checked');
|
||||
var free = checked ? 1 : 0;
|
||||
var url = $(this).data('url');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: url,
|
||||
data: {free: free},
|
||||
success: function (res) {
|
||||
layer.msg(res.msg, {icon: 1});
|
||||
},
|
||||
error: function (xhr) {
|
||||
var json = JSON.parse(xhr.responseText);
|
||||
layer.msg(json.msg, {icon: 2});
|
||||
data.elem.checked = !checked;
|
||||
form.render();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.kg-comment').on('click', function () {
|
||||
var url = $(this).data('url');
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '评论管理',
|
||||
area: ['1000px', '600px'],
|
||||
content: url
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
@ -62,8 +62,8 @@
|
||||
<td>{{ live_time_info(item.attrs) }}</td>
|
||||
<td>{{ live_status_info(item.attrs['stream']['status']) }}</td>
|
||||
<td><input class="layui-input kg-priority" type="text" name="priority" title="数值越小排序越靠前" value="{{ item.priority }}" data-url="{{ update_url }}"></td>
|
||||
<td><input type="checkbox" name="free" value="1" lay-skin="switch" lay-text="是|否" lay-filter="free" data-url="{{ update_url }}" {% if item.free == 1 %}checked="checked"{% endif %}></td>
|
||||
<td><input type="checkbox" name="published" value="1" lay-skin="switch" lay-text="是|否" lay-filter="published" data-url="{{ update_url }}" {% if item.published == 1 %}checked="checked"{% endif %}></td>
|
||||
<td><input type="checkbox" name="free" value="1" lay-skin="switch" lay-text="是|否" lay-filter="go" data-url="{{ update_url }}" {% if item.free == 1 %}checked="checked"{% endif %}></td>
|
||||
<td><input type="checkbox" name="published" value="1" lay-skin="switch" lay-text="是|否" lay-filter="go" data-url="{{ update_url }}" {% if item.published == 1 %}checked="checked"{% endif %}></td>
|
||||
<td class="center">
|
||||
<div class="kg-dropdown">
|
||||
<button class="layui-btn layui-btn-sm">操作 <i class="layui-icon layui-icon-triangle-d"></i></button>
|
||||
|
@ -42,8 +42,8 @@
|
||||
</td>
|
||||
<td>{{ offline_time_info(item.attrs) }}</td>
|
||||
<td><input class="layui-input kg-priority" type="text" name="priority" title="数值越小排序越靠前" value="{{ item.priority }}" data-url="{{ update_url }}"></td>
|
||||
<td><input type="checkbox" name="free" value="1" lay-skin="switch" lay-text="是|否" lay-filter="free" data-url="{{ update_url }}" {% if item.free == 1 %}checked="checked"{% endif %}></td>
|
||||
<td><input type="checkbox" name="published" value="1" lay-skin="switch" lay-text="是|否" lay-filter="published" data-url="{{ update_url }}" {% if item.published == 1 %}checked="checked"{% endif %}></td>
|
||||
<td><input type="checkbox" name="free" value="1" lay-skin="switch" lay-text="是|否" lay-filter="go" data-url="{{ update_url }}" {% if item.free == 1 %}checked="checked"{% endif %}></td>
|
||||
<td><input type="checkbox" name="published" value="1" lay-skin="switch" lay-text="是|否" lay-filter="go" data-url="{{ update_url }}" {% if item.published == 1 %}checked="checked"{% endif %}></td>
|
||||
<td class="center">
|
||||
<div class="kg-dropdown">
|
||||
<button class="layui-btn layui-btn-sm">操作 <i class="layui-icon layui-icon-triangle-d"></i></button>
|
||||
|
@ -30,7 +30,7 @@
|
||||
{% set update_url = url({'for':'admin.chapter.update','id':item.id}) %}
|
||||
{% set delete_url = url({'for':'admin.chapter.delete','id':item.id}) %}
|
||||
{% set restore_url = url({'for':'admin.chapter.restore','id':item.id}) %}
|
||||
{% set comment_url = url({'for':'admin.comment.list'},{'item_id':item.id,'item_type':1}) %}
|
||||
{% set comments_url = url({'for':'admin.comment.list'},{'item_id':item.id,'item_type':1}) %}
|
||||
<tr>
|
||||
<td>{{ item.id }}</td>
|
||||
<td>
|
||||
@ -43,8 +43,8 @@
|
||||
<td>{{ item.like_count }}</td>
|
||||
<td>{{ item.comment_count }}</td>
|
||||
<td><input class="layui-input kg-priority" type="text" name="priority" title="数值越小排序越靠前" value="{{ item.priority }}" data-url="{{ update_url }}"></td>
|
||||
<td><input type="checkbox" name="free" value="1" lay-skin="switch" lay-text="是|否" lay-filter="free" data-url="{{ update_url }}" {% if item.free == 1 %}checked="checked"{% endif %}></td>
|
||||
<td><input type="checkbox" name="published" value="1" lay-skin="switch" lay-text="是|否" lay-filter="published" data-url="{{ update_url }}" {% if item.published == 1 %}checked="checked"{% endif %}></td>
|
||||
<td><input type="checkbox" name="free" value="1" lay-skin="switch" lay-text="是|否" lay-filter="go" data-url="{{ update_url }}" {% if item.free == 1 %}checked="checked"{% endif %}></td>
|
||||
<td><input type="checkbox" name="published" value="1" lay-skin="switch" lay-text="是|否" lay-filter="go" data-url="{{ update_url }}" {% if item.published == 1 %}checked="checked"{% endif %}></td>
|
||||
<td class="center">
|
||||
<div class="kg-dropdown">
|
||||
<button class="layui-btn layui-btn-sm">操作 <i class="layui-icon layui-icon-triangle-d"></i></button>
|
||||
@ -59,7 +59,7 @@
|
||||
<li><a href="javascript:" class="kg-restore" data-url="{{ restore_url }}">还原</a></li>
|
||||
{% endif %}
|
||||
<hr>
|
||||
<li><a href="javascript:" class="kg-comment" data-url="{{ comment_url }}">评论管理</a></li>
|
||||
<li><a href="{{ comments_url }}">评论管理</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
|
@ -44,7 +44,7 @@
|
||||
{% set update_url = url({'for':'admin.chapter.update','id':item.id}) %}
|
||||
{% set delete_url = url({'for':'admin.chapter.delete','id':item.id}) %}
|
||||
{% set restore_url = url({'for':'admin.chapter.restore','id':item.id}) %}
|
||||
{% set comment_url = url({'for':'admin.comment.list'},{'item_id':item.id,'item_type':1}) %}
|
||||
{% set comments_url = url({'for':'admin.comment.list'},{'item_id':item.id,'item_type':1}) %}
|
||||
<tr>
|
||||
<td>{{ item.id }}</td>
|
||||
<td>
|
||||
@ -61,8 +61,8 @@
|
||||
<td>{{ item.like_count }}</td>
|
||||
<td>{{ item.comment_count }}</td>
|
||||
<td><input class="layui-input kg-priority" type="text" name="priority" title="数值越小排序越靠前" value="{{ item.priority }}" data-url="{{ update_url }}"></td>
|
||||
<td><input type="checkbox" name="free" value="1" lay-skin="switch" lay-text="是|否" lay-filter="free" data-url="{{ update_url }}" {% if item.free == 1 %}checked="checked"{% endif %}></td>
|
||||
<td><input type="checkbox" name="published" value="1" lay-skin="switch" lay-text="是|否" lay-filter="published" data-url="{{ update_url }}" {% if item.published == 1 %}checked="checked"{% endif %}></td>
|
||||
<td><input type="checkbox" name="free" value="1" lay-skin="switch" lay-text="是|否" lay-filter="go" data-url="{{ update_url }}" {% if item.free == 1 %}checked="checked"{% endif %}></td>
|
||||
<td><input type="checkbox" name="published" value="1" lay-skin="switch" lay-text="是|否" lay-filter="go" data-url="{{ update_url }}" {% if item.published == 1 %}checked="checked"{% endif %}></td>
|
||||
<td class="center">
|
||||
<div class="kg-dropdown">
|
||||
<button class="layui-btn layui-btn-sm">操作 <i class="layui-icon layui-icon-triangle-d"></i></button>
|
||||
@ -77,7 +77,7 @@
|
||||
<li><a href="javascript:" class="kg-restore" data-url="{{ restore_url }}">还原</a></li>
|
||||
{% endif %}
|
||||
<hr>
|
||||
<li><a href="javascript:" class="kg-comment" data-url="{{ comment_url }}">评论管理</a></li>
|
||||
<li><a href="{{ comments_url }}">评论管理</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
|
Loading…
x
Reference in New Issue
Block a user