{extend name="public/public"}
{block name="mains"}
<link rel="stylesheet" href="__STATIC__/layer/mobile/need/layer.css">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{:url('indexvideo/index')}">列表</a></li>
<li class="breadcrumb-item active" aria-current="page">添加视频</li>
</ol>
</nav>
<form method="post" action="{:url('indexvideo/add')}" onsubmit="return getstring()" enctype="multipart/form-data">
<div class="form-group">
<label for="title">标题</label>
<input type="text" class="form-control" id="title" name="title">
</div>
<div class="form-group">
<label for="order">排序</label>
<input type="number" value="10" class="form-control" id="order" name="order">
<small id="emailHelp" class="form-text text-muted">值越大排在越前面,可不填(默认排序)</small>
</div>
<div class="form-group">
<label for="exampleFormControlSelect1">标签</label>
<select class="form-control" id="exampleFormControlSelect1" name="label_id">
<option value="1">首页</option>
<option value="2">关于我们</option>
</select>
</div>
<div class="form-group">
<label>视频</label><br>
<input type="file" name="videos" onchange="fun1(this,1)" id="uploadb" style="display: none;">
<svg width="1em" height="1em" id="uploada" viewBox="0 0 16 16" class="bi bi-cloud-upload cursoryhj uploadyhj" fill="currentColor"
xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M4.406 1.342A5.53 5.53 0 0 1 8 0c2.69 0 4.923 2 5.166 4.579C14.758 4.804 16 6.137 16 7.773 16 9.569 14.502 11 12.687 11H10a.5.5 0 0 1 0-1h2.688C13.979 10 15 8.988 15 7.773c0-1.216-1.02-2.228-2.313-2.228h-.5v-.5C12.188 2.825 10.328 1 8 1a4.53 4.53 0 0 0-2.941 1.1c-.757.652-1.153 1.438-1.153 2.055v.448l-.445.049C2.064 4.805 1 5.952 1 7.318 1 8.785 2.23 10 3.781 10H6a.5.5 0 0 1 0 1H3.781C1.708 11 0 9.366 0 7.318c0-1.763 1.266-3.223 2.942-3.593.143-.863.698-1.723 1.464-2.383z" />
<path fill-rule="evenodd" d="M7.646 4.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8.5 5.707V14.5a.5.5 0 0 1-1 0V5.707L5.354 7.854a.5.5 0 1 1-.708-.708l3-3z" />
</svg>
<div style="color: green;" data="" id="up1"></div>
</div>
<div class="form-group">
<label for="order">状态</label><br>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="static" checked="checked" id="inlineRadio1" value="1">
<label class="form-check-label" for="inlineRadio1">正常</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="static" id="inlineRadio2" value="0">
<label class="form-check-label" for="inlineRadio2">禁用</label>
</div>
</div>
<button type="submit" class="btn btn-primary">提交</button>
</form>
<script src="__STATIC__/public/js/jquery.min.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script>
var submitsa=true;
function fun1(obj,index) {
var file=$(obj)[0].files[0]; //获取文件信息
var imgdata='';
console.log(file);
if(file)
{
var reader=new FileReader(); //调用FileReader
reader.readAsDataURL(file); //将文件读取为 DataURL(base64)
reader.onload=function(evt){ //读取操作完成时触发。
if(file.size>6773724){
submitsa=false;
$('#up'+index).html('视频过大,请压缩后上传');
}else{
submitsa=true;
$('#up'+index).html('添加成功');
$('#up'+index).attr('data',evt.target.result);
}
console.log(file.size);
};
}
else{
alert("上传失败");
}
}
function getstring(){
if($('#title').val()==''){
layer.msg('请先填写标题', {icon: 0});
return false;
}
if($('#up1').attr('data')==''){
layer.msg('请先上传视频', {icon: 0});
return false;
}
return submitsa;
}
</script>
{/block}
tp5显示视频添加状态,上传视频
最新推荐文章于 2024-01-21 08:00:00 发布