123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- <?php /*a:1:{s:74:"D:\project\gyx\gaoyixia\application\nutrition\view\series_manage\form.html";i:1699858976;}*/ ?>
- <style> .param_index{
- height: 50px !important;
- }
- .up_img{
- width: 60%;
- padding: 10px 0;
- }
- </style><div class="think-box-shadow"><form class="layui-form layui-card" action="<?php echo request()->url(); ?>" data-auto="true" method="post" autocomplete="off"><div class="layui-card-body"><div class="layui-form-item"><label class="layui-form-label label-required">标题</label><div class="layui-input-block"><input name="title" maxlength="60" value='<?php echo htmlentities((isset($vo['title']) && ($vo['title'] !== '')?$vo['title']:"")); ?>' placeholder="请输入标题" class="layui-input"></div></div><div class="layui-form-item"><label class="layui-form-label">视频期数</label><div class="layui-input-block"><input name="total_sequel" type="number" value='<?php echo htmlentities((isset($vo['total_sequel']) && ($vo['total_sequel'] !== '')?$vo['total_sequel']:"1")); ?>' placeholder="请输入视频期数" class="layui-input"></div></div><div class="layui-form-item"><label class="layui-form-label label-required">简介</label><div class="layui-input-block"><textarea placeholder="请输入简介" maxlength="100" class="layui-textarea" name="desc"><?php echo htmlentities((isset($vo['desc']) && ($vo['desc'] !== '')?$vo['desc']:'')); ?></textarea></div></div><div class="layui-form-item"><label class="layui-form-label label-required">系列封面</label><div class="layui-input-block"><input class="cover" name="cover" type="hidden" class="layui-input" value="<?php echo htmlentities((isset($vo['cover']) && ($vo['cover'] !== '')?$vo['cover']:'')); ?>"></div></div><div class="layui-form-item"><label class="layui-form-label label-required">分类</label><div class="layui-input-inline"><select name="first_classify" lay-filter ="first_classify"><option value="0">请选择</option><?php if(!empty($cate_tree)): foreach($cate_tree as $ck=>$cv): if(isset($vo['first_classify']) && $vo['first_classify'] == $cv['id']): ?><option selected data-cl_key="<?php echo htmlentities($ck); ?>" value="<?php echo htmlentities($cv['id']); ?>"><?php echo htmlentities($cv['title']); ?></option><?php else: ?><option data-cl_key="<?php echo htmlentities($ck); ?>" value="<?php echo htmlentities($cv['id']); ?>"><?php echo htmlentities($cv['title']); ?></option><?php endif; ?><?php endforeach; ?><?php endif; ?></select></div><div class="layui-input-inline"><select name="second_classify" lay-filter ="second_classify"><option value="0">请选择</option><?php if(!empty($cate_tree)): foreach($cate_tree as $ck=>$cv): if(isset($vo['first_classify']) && $vo['first_classify'] == $cv['id']): if(isset($cv['children'])): foreach($cv['children'] as $cln): if(isset($vo['second_classify']) && $vo['second_classify'] == $cln['id']): ?><option selected value="<?php echo htmlentities($cln['id']); ?>"><?php echo htmlentities($cln['title']); ?></option><?php else: ?><option value="<?php echo htmlentities($cln['id']); ?>"><?php echo htmlentities($cln['title']); ?></option><?php endif; ?><?php endforeach; ?><?php endif; ?><?php endif; ?><?php endforeach; ?><?php endif; ?></select></div></div><div class="layui-form-item"><label class="layui-form-label label-required">标签</label><div class="layui-input-block"><textarea placeholder="请输入标签" class="layui-textarea" name="label"><?php echo htmlentities((isset($vo['label']) && ($vo['label'] !== '')?$vo['label']:'')); ?></textarea><span class="margin-left-10 color-gray">多个半角逗号(,)隔开</span></div></div><input type="hidden" name="type" value="<?php echo htmlentities($type); ?>"><div class="layui-form-item"><label class="layui-form-label label-required">是否置顶</label><div class="layui-input-inline"><select name="is_top" lay-filter ="is_top"><?php foreach(['不置顶','置顶'] as $ck=>$cv): if(!empty($vo['is_top']) && $vo['is_top'] == $ck): ?><option selected data-cl_key="<?php echo htmlentities($ck); ?>" value="<?php echo htmlentities($ck); ?>"><?php echo htmlentities($cv); ?></option><?php else: ?><option data-cl_key="<?php echo htmlentities($ck); ?>" value="<?php echo htmlentities($ck); ?>"><?php echo htmlentities($cv); ?></option><?php endif; ?><?php endforeach; ?></select></div></div><div class="layui-form-item"><label class="layui-form-label label-required">是否VIP</label><div class="layui-input-block"><select class="layui-select" name="is_vip"><option value="0">否</option><option <?php if(!empty($vo['is_vip']) && $vo['is_vip'] == 1): ?>selected<?php endif; ?> value="1">是</option></select></div></div><div class="layui-form-item"><label class="layui-form-label label-required">是否完结</label><div class="layui-input-inline"><select name="is_over" lay-filter ="is_over"><?php foreach(['否','是'] as $ck=>$cv): if(!empty($vo['is_over']) && $vo['is_over'] == $ck): ?><option selected data-cl_key="<?php echo htmlentities($ck); ?>" value="<?php echo htmlentities($ck); ?>"><?php echo htmlentities($cv); ?></option><?php else: ?><option data-cl_key="<?php echo htmlentities($ck); ?>" value="<?php echo htmlentities($ck); ?>"><?php echo htmlentities($cv); ?></option><?php endif; ?><?php endforeach; ?></select></div></div><div class="layui-form-item"><label class="layui-form-label label-required">排序</label><div class="layui-input-block"><input type="number" name="sort" value='<?php echo htmlentities((isset($vo['sort']) && ($vo['sort'] !== '')?$vo['sort']:"")); ?>' placeholder="请输入排序号" class="layui-input"></div></div><?php if(!(empty($vo['id']) || (($vo['id'] instanceof \think\Collection || $vo['id'] instanceof \think\Paginator ) && $vo['id']->isEmpty()))): ?><input type='hidden' value='<?php echo htmlentities($vo['id']); ?>' name='id'><?php endif; if(!$r): ?><div class="layui-form-item text-center"><button class="layui-btn" type='submit'>保 存</button><button class="layui-btn layui-btn-danger" type='button' data-close>取消编辑</button></div><?php endif; ?></div></form><script> window.form.render();
- require(['ckeditor', 'angular'], function () {
- window.createEditor('[name="detail"]', {height: 500,width:1000});
- })
- $('[name="cover"]').uploadOneImage();
- $('[name="video_url"]').uploadOneVideo()
- // 分类选择监听
- form.on('select(first_classify)', function(data){
- var cl_html = '<option value="0">请选择</option>';
- if(data.value == 0) {
- $("select[name='second_classify']").html(cl_html);
- }else{
- var cl_key = data.elem[data.elem.selectedIndex].dataset.cl_key;
- var goods_spec = <?php echo json_encode($cate_tree); ?>;
- $.each(goods_spec[cl_key]['children'],function (ck,cv) {
- cl_html +='<option value="'+cv.id+'">'+cv.title+'</option>';
- })
- $("select[name='second_classify']").html(cl_html);
- }
- window.form.render();
- })
- function get_ht(k) {
- var html = '<tr class="param_index">\n' +
- ' <td class="padding-0" >\n' +
- ' <input class="layui-input border-0" name="item_title[]" value="">\n' +
- ' <input type="hidden" class="layui-input border-0" name="item_id[]" value="">\n' +
- ' </td>\n' +
- ' <td class="padding-0">\n' +
- "<input class ='item_url up_"+k+"' name='item_url[]' type='hidden' value=''>"+
- "<div id='v_"+k+"' class='up_img'><img class ='si_"+k+"' src='https://xiongwenwang.oss-cn-beijing.aliyuncs.com/5de36edffcba0acb/0ee73c034a351d83.jpg' alt='' style='width: 60px ;height: 40px'></div>"+
- '<input style="display: none" type="file" accept="mp4" name="file" onchange="upload_img(this,'+k+')">'+
- ' </td>\n' +
- ' <td class="padding-0">\n' +
- '<select style="border: 0px" class="layui-select border-0" name="item_is_vip[]">' +
- '<option value="0">否</option>'+
- '<option value="1">是</option>'+
- '</select>'+
- ' </td>\n' +
- ' <td class="padding-0" >\n' +
- ' <input class="layui-input border-0" name="item_sort[]" value="">\n' +
- ' </td>\n' +
- ' <td class="padding-0 text-center">\n' +
- ' <a class="layui-btn layui-btn-sm layui-btn-danger del" >删 除</a>\n' +
- ' <a class="layui-btn layui-btn-sm video_player" >预 览</a>\n' +
- ' </td>\n' +
- ' </tr>';
- return html;
- }
- function add_param() {
- var knum = $('.no_html tr').length;
- var no_html = get_ht(knum);
- $(".no_html").append(no_html);
- window.form.render();
- }
- $(document).on("click",'.up_img',function () {
- $(this).siblings('[name="file"]').click();
- });
- // 删除设置
- $(document).on('click',".del",function (){
- var index= $(".del").index(this);
- $(".param_index").eq(index).remove();
- window.form.render();
- })
- function upload_img(e,k) {
- var file = e.files[0]; //获取图片资源
- var fileTypes = ["mp4"];
- var bTypeMatch = false
- for (var i = 0; i < fileTypes.length; i++) {
- var start = file.name.lastIndexOf(".");
- var fileType = file.name.substring(start + 1);
- if (fileType.toLowerCase() == fileTypes[i]) {
- bTypeMatch = true;
- break;
- }
- }
- if (bTypeMatch) {
- if (file.size <= 1024 * 1024 * 500) {
- var farmData = new FormData();
- farmData.append("file", file)
- layer.loading();
- $.ajax("/api/Upload/upload", {
- data: farmData,
- processData: false,
- contentType: false,
- dataType: 'json',
- type: 'post', //HTTP请求类型
- headers: {
- 'zbtoken': localStorage.getItem("token"),
- 'enctype': 'multipart/form-data',
- },
- success: function (data) {
- layer.close();
- if(data.code == 1) {
- $("#v_"+k).empty();
- $("#v_"+k).html("<video class ='si_"+k+"' src='"+data.data+"' alt='66' style='width: 60px ;height: 40px'>");
- $(".up_"+k).val(data.data);
- window.form.render();
- }else{
- layer.msg(data.msg);
- }
- },
- error: function (xhr, type, errorThrown) {
- console.log(type);
- }
- });
- } else {
- alert('仅支持不超过500M的视频');
- return false;
- }
- } else {
- alert('仅限mp4格式的视频');
- return false;
- }
- }
- $(document).on("click",'.video_player',function () {
- vUrl = $(this).parents('.param_index').find(".item_url").val(); //获取到播放的url
- var loadstr = '<video width="100%" height="100%" controls="controls" autobuffer="autobuffer" autoplay="autoplay" loop="loop">' +
- '<source src='+vUrl+' type="video/mp4"></source></video>';
- layer.open({
- type: 1,
- title: false,
- area: ['730px', '500px'],
- shade: [0.8, 'rgb(14, 16, 22)'],
- skin: 'demo-class',
- content: loadstr
- });
- layer.render();
- });
- </script></div>
|