HEX
Server: nginx/1.28.1
System: Linux 10-41-63-61 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User: www (1001)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot//cs.wgegeghx.com/runtime/temp/53ee596215025873ed36c888a9c4fc3a.php
<?php /*a:3:{s:68:"/www/wwwroot/cs.wgegeghx.com/application/cms/view/cms/batch_add.html";i:1628388878;s:69:"/www/wwwroot/cs.wgegeghx.com/application/admin/view/index_layout.html";i:1617866432;s:62:"/www/wwwroot/cs.wgegeghx.com/application/admin/view/layui.html";i:1617354798;}*/ ?>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>后台管理系统</title>
    
    <link rel="stylesheet" href="/static/libs/layui/css/layui.css">
    <link rel="stylesheet" href="/static/admin/css/admin.css?v=<?php echo htmlentities(app('config')->get('version.yzncms_release')); ?>">
    <link rel="stylesheet" href="/static/common/font/iconfont.css?v=<?php echo htmlentities(app('config')->get('version.yzncms_release')); ?>">
    <script type="text/javascript">
    //全局变量
    var GV = {
        'site':<?php echo json_encode($site); ?>,
        'image_upload_url': '<?php echo !empty($image_upload_url) ? htmlentities($image_upload_url) :  url("attachment/upload/upload", ["dir" => "images", "module" => request()->module()]); ?>',
        'file_upload_url': '<?php echo !empty($file_upload_url) ? htmlentities($file_upload_url) :  url("attachment/upload/upload", ["dir" => "files", "module" => request()->module()]); ?>',
        'jcrop_upload_url': '<?php echo !empty($jcrop_upload_url) ? htmlentities($jcrop_upload_url) :  url("attachment/Attachments/cropper"); ?>',
        'ueditor_upload_url': '<?php echo !empty($ueditor_upload_url) ? htmlentities($ueditor_upload_url) :  url("attachment/upload/upload", ["dir" => "images","from"=>"ueditor", "module" => request()->module()]); ?>',
        'ueditor_grabimg_url': '<?php echo !empty($ueditor_upload_url) ? htmlentities($ueditor_upload_url) :  url("attachment/Attachments/geturlfile"); ?>',
        'image_select_url': '<?php echo !empty($image_select_url) ? htmlentities($image_select_url) :  url("attachment/Attachments/select"); ?>',
        'filter_word_url': '<?php echo !empty($filter_word_url) ? htmlentities($filter_word_url) :  url("admin/ajax/filterWord"); ?>',
    };
    </script>
</head>

<body class="childrenBody <?php echo defined('IS_DIALOG') && IS_DIALOG ? 'is-dialog' : ''; ?>">
    
<style>
  .layui-icon-delete{cursor:pointer;}
</style>

<form class="layui-form" method="post">
    
    <h2><?php echo htmlentities($title); ?> - 批量添加课程</h2>
    <div style='margin-top:20px;'>
       <a class="layui-btn layui-btn-sm layui-btn-normal" href="javascript:history.go(-1)"><i class="layui-icon layui-icon-return"></i>&nbsp;返回</a>
       <button type="button" class="layui-btn layui-btn-sm btn-repeat" style="margin-right:70px" onclick="parseTitle()">一键获取标题</button>
    </div>
    <table cellspacing="0" cellpadding="0" border="0" class="layui-table">
        <thead>
            <tr>
               <th>标题</th>
               <th>链接</th>
               <th>时长</th>
               <th>是否免费</th>
               <th>类别</th>
               <?php if(!$edit_rows): ?>
               <th>删除</th>
               <?php endif; ?>
            </tr>
        </thead>
        <tbody>
            <?php if($edit_rows): if(is_array($edit_rows) || $edit_rows instanceof \think\Collection || $edit_rows instanceof \think\Paginator): $i = 0; $__LIST__ = $edit_rows;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                <tr id="<?php echo htmlentities($v['id']); ?>">
                   <td><input class="layui-input title" value="<?php echo htmlentities($v['title']); ?>" name="title<?php echo htmlentities($v['id']); ?>" placeholder="请输入标题" lay-verify="required" /></td>
                   <td><input class="layui-input link"  value="<?php echo htmlentities($v['url']); ?>" name="link<?php echo htmlentities($v['id']); ?>" placeholder="请输入链接" lay-verify="required"/></td>
                   <td><input class="layui-input timer"  value="<?php echo htmlentities($v['length']); ?>" oninput="handleTime(this)" name="timer<?php echo htmlentities($v['id']); ?>" placeholder="请输入时长" /></td>
                   <td><input type="checkbox" class="is_free" <?php if($v['is_free'] == 0): ?>checked<?php endif; ?> name="switch" lay-skin="switch"></td>
                   <td> <input type="radio" class="type" <?php if($v['type'] == 1): ?>checked<?php endif; ?> name="type<?php echo htmlentities($v['id']); ?>" value="1" title="视频" checked><input type="radio" class="type" name="type<?php echo htmlentities($v['id']); ?>" value="2" title="音频" <?php if($v['type'] == 2): ?>checked<?php endif; ?>></td>
                </tr>
               <?php endforeach; endif; else: echo "" ;endif; else: ?>
            <script>
                for(var i=0;i<5;i++){
                    var html = '<tr id="'+i+'">\
                                   <td><input class="layui-input title" name="title'+i+'" placeholder="请输入标题" lay-verify="required" /></td>\
                                   <td><input class="layui-input link" name="link'+i+'" placeholder="请输入链接" lay-verify="required"/></td>\
                                   <td><input class="layui-input timer" oninput="handleTime(this)" name="timer'+i+'" placeholder="请输入时长" /></td>\
                                   <td><input type="checkbox" class="is_free" name="switch" lay-skin="switch"></td>\
                                   <td> <input type="radio" class="type" name="type'+i+'" value="1" title="视频" checked><input type="radio" class="type" name="type'+i+'" value="2" title="音频" ></td>\
                                   <td><i class="layui-icon layui-icon-delete" onclick="$(this).parent().parent().remove()"></i></td>\
                                </tr>';
                    document.write(html);
                }
            </script>
            <?php endif; ?>
        </tbody>
    </table>
    
    <?php if(!$edit_rows): ?>
    <div align=center>
        <button class="layui-btn layui-btn-sm"  id='moreBtn' type='button' style="background:#009688;color:white"><i class="layui-icon layui-icon-add-1"></i> 添加1行</button>
        
        <button class="layui-btn layui-btn-sm"  id='more5Btn' type='button' style="background:#009688;color:white"><i class="layui-icon layui-icon-add-1"></i> 添加5行</button>
    </div>
    <?php endif; ?>
    
    <div class="layui-form-item layer-footer">
        <div>
            <button class="layui-btn submitBtn" type='button'>立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

    <script src="/static/libs/layui/layui.js"></script>
    <script src="/static/libs/jquery/jquery.min.js"></script>
    
    <script type="text/javascript">
layui.config({
	version: '<?php echo htmlentities(app('config')->get('version.yzncms_release')); ?>',
	base: '/static/libs/layui_exts/'
}).extend({
	yzn: 'yzn/yzn',
	yznForm: 'yznForm/yznForm',
	yznTable: 'yznTable/yznTable',
	treeGrid: 'treeGrid/treeGrid',
	clipboard: 'clipboard/clipboard',
	notice: 'notice/notice',
	iconPicker: 'iconPicker/iconPicker',
	tableSelect: 'tableSelect/tableSelect',
	ztree: 'ztree/ztree',
	dragsort: 'dragsort/dragsort',
	tagsinput: 'tagsinput/tagsinput',
	xmSelect: 'xmSelect/xm-select',
	selectPage: 'selectPage/selectpage',
	echarts: 'echarts/echarts',
	echartsTheme: 'echarts/echartsTheme',
	citypicker: 'citypicker/city-picker',
	webuploader: 'webuploader/webuploader',
	ueditor: 'ueditor/ueditor.min',
}).use('yznForm');
</script>
    
    
<script type="text/javascript">
layui.use(['form','layer','yznForm'], function() {
    var form = layui.form,
    yznForm = layui.yznForm;
    form.render();
    
    $('#moreBtn').click(function(){
        addRow();
        form.render();
    })
    
    $('#more5Btn').click(function(){
        for(var i=0;i<5;i++){
           addRow();
        }
        form.render();
    })
    
    
    
    $('.submitBtn').click(function(){
        let len = $('tbody tr').length;
        var arr = [];
        for(var i=0;i<len;i++){
            var id = $('tbody tr').eq(i).attr('id');
            var title = $("tbody tr").eq(i).find(".title").val();
            var link = $("tbody tr").eq(i).find(".link").val();
            var timer = $("tbody tr").eq(i).find(".timer").val();
            var is_free = $("tbody tr").eq(i).find(".is_free").prop("checked");
            var type = $("tbody tr").eq(i).find(".type:checked").val();
           
            if(title==''||link==''||timer==''){
                layer.msg('请补充完整信息!');
                return false;
            }
            arr.push({'id':id, 'title':title,link:link,timer:timer,is_free:is_free?0:1,type:type});
        }
      
        $.post("", {list:JSON.stringify(arr),catid:<?php echo htmlentities($catid); ?>, 'courseid':<?php echo htmlentities($courseid); ?>, 'option':"<?php echo htmlentities($option); ?>"}, function(data){
                if(data == 1){
                    layer.msg('操作成功!');
                    setTimeout(function(){
                        history.go(-1);
                    }, 500);
                }else{
                    layer.msg('操作失败,请稍后重试!');
                }
        })
    })
    
})

function addRow(){
    var i = 1;
    if($('tbody tr').length){
        i = parseInt($('tbody tr:last').attr("id"))+1;
    }
    var html = '<tr id="'+i+'">\
                   <td><input class="layui-input title" name="title'+i+'" placeholder="请输入标题" lay-verify="required"/></td>\
                   <td><input class="layui-input link" name="link'+i+'" placeholder="请输入链接" lay-verify="required"/></td>\
                   <td><input class="layui-input timer" oninput="handleTime(this)" name="timer'+i+'" placeholder="请输入时长" /></td>\
                   <td><input type="checkbox"  class="is_free" name="switch" lay-skin="switch"></td>\
                   <td> <input type="radio" class="type" name="type'+i+'" value="1" title="视频" checked><input type="radio" name="type'+i+'" class="type" value="2" title="音频" ></td>\
                   <td><i class="layui-icon layui-icon-delete"  onclick="$(this).parent().parent().remove()"></i></td>\
                </tr>';
    $('tbody').append(html);
}

function parseTitle(){
    var count = $('tbody tr').length;
    for(var i=0;i<count;i++){
       var link = $("tbody tr").eq(i).find(".link").val();
       var title = parseUrl(link);
       $("tbody tr").eq(i).find(".title").val(title);
    }
}



function parseUrl(url){
     var str = url;
     if(str){
         var index = str.lastIndexOf("/");
         var tmp = str.substr(index+1);
         if(tmp.indexOf("=") > 0){
             var tmp_index = tmp.lastIndexOf("=");
             tmp = tmp.substr(tmp_index+1);
         }
         
         if(tmp){
             var index = tmp.lastIndexOf(".");
             var title = tmp.substr(0,index);
             return decodeURI(title);
         }
     }
  }


function handleTime(obj){
    var val = $(obj).val();
    val = val.replace(".",':').replace(":",':');
    val = val.replace("::", ":");
    $(obj).val(val);
}
</script>

</body>

</html>