74 lines
2.4 KiB
Cheetah
74 lines
2.4 KiB
Cheetah
{{template "header" .}}
|
|
<div class="container-fluid flex justify-content">
|
|
<div class="main">
|
|
<div class="title">
|
|
<h3>我的视频</h3>
|
|
<a href="/me/videos/update" class="btn btn-primary">添加</a>
|
|
</div>
|
|
<div class="video-list">
|
|
{{range .}}
|
|
<div class="card">
|
|
<img src="{{.Images}}" class="card-img-top" alt="{{.Title}}">
|
|
<div class="card-body">
|
|
<h5 class="card-title">{{.Title}}</h5>
|
|
<p class="card-text">{{.Description}}</p>
|
|
|
|
{{if not (eq .Status 1)}}
|
|
<a href="/me/videos/update/{{.ID}}" class="btn btn-warning">编辑</a>
|
|
<button id="del" data-id="{{.ID}}" class="btn btn-danger">删除</button>
|
|
{{end}}
|
|
|
|
{{if eq .Status 200}}
|
|
<a href="/play/{{.ID}}" class="btn btn-primary">播放</a>
|
|
{{end}}
|
|
|
|
<div>
|
|
{{if eq .Status 1}}
|
|
<p>等待队列处理...</p>
|
|
{{else if eq .Status 1}}
|
|
<p>转码中...</p>
|
|
{{else if eq .Status 2}}
|
|
<p>转码失败</p>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
<div class="hidden">
|
|
{{ csrfField }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{define "js"}}
|
|
<script>
|
|
$('#del').click(function () {
|
|
let that = $(this)
|
|
that.attr("disable", true).html('删除中...')
|
|
let id = that.attr("data-id")
|
|
let csrfToken = $('input[name="csrf_token"]').val()
|
|
$.ajax({
|
|
url: '/me/videos/delete',
|
|
type: 'post',
|
|
headers: {
|
|
"X-CSRF-Token": csrfToken
|
|
},
|
|
contentType: 'application/json',
|
|
dataType: 'json',
|
|
data: JSON.stringify({ "id": id }),
|
|
success: function (obj) {
|
|
if (obj.success) {
|
|
alert('删除成功');
|
|
window.location.reload();
|
|
} else {
|
|
alert('删除失败');
|
|
}
|
|
},
|
|
error: function (ex) {
|
|
console.log(ex)
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
{{end}}
|
|
{{template "footer" .}} |