8c88334f60492fbe1ec53463a722970c.php 10.3 KB
<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:56:"./application/admin/view2/template\ajaxtemplateList.html";i:1538103644;}*/ ?>

<style type="text/css">
	.flexigrid .bDiv tr{display: block;}
	.bd-line{font-size: 0;}
	.flexigrid .bDiv td{border: 0;}
	.flexigrid div.bDiv tr:hover td{background-color: #F4FCFA;}
	.flexigrid div.bDiv tr.trSelected td{ background: #ffffdf none repeat scroll 0 0;}
	.flexigrid .bDiv a{color: #999;}
	.flexigrid .bDiv .active a,.flexigrid .bDiv span a:hover{color: #FFF;}
	.flexigrid .bDiv .row a:hover{text-decoration: none;color: #C4182E;background-color: #EEEEEE;text-decoration: underline;}
	.flexigrid .bDiv .row .active a:hover{text-decoration: none;color: #fff;background-color: #999;text-decoration: underline;}
	.ncsc-default-table thead {font-size: 0;}
	.ncsc-default-table thead th{font-size: 12px; vertical-align: middle;display: inline-block;*display: inline;*zoom: 1;}
	.w50{width: 5% !important;}
	.w60{width: 6% !important;}
	.w110{width: 11% !important;}
	.w140{width: 14% !important;}
	.w130{width: 13% !important;}
	.w150{width: 15% !important;}
	.w160{width: 16% !important;}
	.w180{width: 18% !important;}
	.w200{width: 20% !important;}
	.w320{width: 32% !important;}

	.dn{display: none;}
	.layermbox{text-align: center;}
	.layer_box{font-size: 0; background-color: #FFFFFF; text-align: center;position: absolute;left: 45%;border: 1px solid #D7D7D7;padding: 10px;z-index: 9999;}
	.contentTxt{width: 300px; height: 20px;line-height: 20px;resize: none;border: 1px solid #D7D7D7;background-color: #999;}
	.contentTxt:hover{border-color:#C4182E ;}
	.layer_box input{vertical-align: middle;}
	.copySuccess{font-size: 14px; width: 150px;padding: 10px; background-color: #FFFFFF;border: 1px solid #D7D7D7;margin: auto;}
	.js-copy{font-size: 14px;vertical-align: middle;display: inline-block;*display: inline;*zoom: 1;cursor: pointer;border: 1px solid #D7D7D7;border-left:0 ; height: 22px;padding:0 5px;}
	.js-copy:hover{background-color: #EEEEEE;}
</style>

<table class="ncsc-default-table">
	<thead>
		<tr>
			<!--<th class="w50">-->
				<!--<div>-->
					<!--<i class="ico-check"></i>-->
				<!--</div>-->
			<!--</th>-->
			<th class="w150">页面标题</th>
			<th class="w100">模板名称</th>
			<th class="w140">创建时间</th>
			<th class="w140">修改时间</th>
			<th class="w140">到期时间</th>
			<th class="w320">操作</th>
		</tr>
	</thead>
	<tbody>
		<?php if(empty($temList) || ($temList instanceof \think\Collection && $temList->isEmpty())): ?>
			<tr>
				<td colspan="20" class="norecord">
					<div class="warning-option"><i class="icon-warning-sign"></i><span>暂无符合条件的数据记录</span></div>
				</td>
			</tr>
			<?php else: if(is_array($temList) || $temList instanceof \think\Collection): $i = 0; $__LIST__ = $temList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$list): $mod = ($i % 2 );++$i;?>


				<tr class="bd-line">
					<!--<td>-->
						<!--<div>-->
							<!--<i class="ico-check"></i>-->
						<!--</div>-->
					<!--</td>-->
					<td class="w150"><span><?php echo $list['page_title']; ?></span></td>
					<td class="w100"><span><?php echo $list['page_title_type']; ?></span></td>
					<td class="w140"><span><?php echo date("Y-m-d H:i:s",$list['billdate']); ?></span></td>
					<td class="w140">
					  	<span>
							<?php if(!(empty($list['editdate']) || ($list['editdate'] instanceof \think\Collection && $list['editdate']->isEmpty()))): ?>
                             <?php echo date("Y-m-d H:i:s",$list['editdate']); endif; ?>
						</span>
					</td>
					<td class="w140">


						<span><?php if(!(empty($list['end_time']) || ($list['end_time'] instanceof \think\Collection && $list['end_time']->isEmpty()))): ?>
							<?php echo date("Y-m-d H:i:s",$list['end_time']); endif; ?></span></td>
					<td class="nscs-table-handle w320" style="text-align: center">
						<!--是否购买的模板-->

						<?php if($list['end_time']): ?>
							<!--购买的模板是否已经过期-->
							<a onclick="to_xufei(this)" tid="<?php echo $list['id']; ?>" class="btn blue"><i class="fa fa-money"></i>续费</a>
							<?php if($list['end_time'] > time() or $list['end_time'] == 0): ?>

								<a class="aClick btn green" art="<?php echo U('mobile/template/template',array('sn'=>$list['template_sn'],'stoid'=>$stoid)); ?>"><i class="fa fa-chain"></i>链接</a>
								<a class="btn green" target="_blank"   b_href="<?php echo U('mobile/template/template',array('sn'=>$list['template_sn'],'stoid'=>$stoid)); ?>" tid="<?php echo $list['id']; ?>" onclick="showhtml(this)"><i class="fa fa-search"></i>预览</a>
								<a href="<?php echo U('template/templatehandle',array('id'=>$list['id'])); ?>" class="btn blue"><i class="fa fa-pencil-square-o"></i>编辑</a>
								<?php if($list['isdefault'] != 1): ?>
								<a class="btn red"  href="javascript:void(0)" tid="<?php echo $list['id']; ?>" onClick="delfun(this)"><i class="fa fa-trash-o"></i>删除</a>
								<?php endif; if($list['isdefault'] == 1): ?>
								   <a class="btn" tid="<?php echo $list['id']; ?>" style="color:#f00" onClick="deldefweb(this)">
									   <i class="fa fa-home"></i>店铺首页</a>
								<?php else: ?>
									<a class="cClick btn" tid="<?php echo $list['id']; ?>" ><i class="fa fa-home"></i>设为首页</a>
								<?php endif; else: ?>
								<a class="btn green" target="_blank"   b_href="<?php echo U('mobile/template/template',array('sn'=>$list['template_sn'],'stoid'=>$stoid)); ?>" tid="<?php echo $list['id']; ?>" onclick="showhtml(this)"><i class="fa fa-search"></i>预览</a>

							<?php endif; else: ?>
							<a class="bClick btn" tid="<?php echo $list['id']; ?>" ><i class="fa fa-clipboard"></i>复制</a>
							<a class="aClick btn green" art="<?php echo U('mobile/template/template',array('sn'=>$list['template_sn'],'stoid'=>$stoid)); ?>"><i class="fa fa-chain"></i>链接</a>
							<a class="btn green" target="_blank"  b_href="<?php echo U('mobile/template/template',array('sn'=>$list['template_sn'],'stoid'=>$stoid)); ?>" tid="<?php echo $list['id']; ?>" onclick="showhtml(this)"><i class="fa fa-search"></i>预览</a>
							<a href="<?php echo U('template/templatehandle',array('id'=>$list['id'])); ?>" class="btn blue"><i class="fa fa-pencil-square-o"></i>编辑</a>
							<?php if($list['isdefault'] != 1): ?>
								<a class="btn red"  href="javascript:void(0)" tid="<?php echo $list['id']; ?>" onClick="delfun(this)"><i class="fa fa-trash-o"></i>删除</a>
							<?php endif; if($list['isdefault'] == 1): ?>
								<a class="btn" tid="<?php echo $list['id']; ?>" style="color:#f00" onClick="deldefweb(this)">
									<i class="fa fa-home"></i>店铺首页</a>
								<?php else: ?>
								<a class="cClick btn" tid="<?php echo $list['id']; ?>" ><i class="fa fa-home"></i>设为首页</a>
							<?php endif; endif; ?>
					</td>
				</tr>
			<?php endforeach; endif; else: echo "" ;endif; endif; ?>
	</tbody>
</table>
<!--分页位置--> <?php echo $page; ?>
<!---复制控件--->
<div class="layer_box dn">
	<input readonly="readonly" class="contentTxt" id="content" value="这里是需要复制的内容" />
	<div id="btn" class="js-copy" data-clipboard-target="#content"><span>复制</span></div>
</div>


<script>

    var btn = document.getElementById('btn');
    var clipboard = new Clipboard(btn);//实例化
    //复制成功执行的回调,可选
    clipboard.on('success', function(e) {
        layer.alert('复制成功', {
            closeBtn: 0
        }, function() {
            layer.closeAll();
            $(".layer_box").addClass("dn");
        });
    });

    //复制失败执行的回调,可选
    clipboard.on('error', function(e) {
        layer.alert('复制失败');
    });

    // 点击分页触发的事件
    $(".pagination  a").click(function(){
        cur_page = $(this).data('p');
        ajax_get_table('search-form2',cur_page);
    });

    $(document).ready(function(){
        // 表格行点击选中切换
        $('#flexigrid >table>tbody>tr').click(function(){
            $(this).toggleClass('trSelected');
        });
        $('#good_count').empty().html("<?php echo $pager->totalRows; ?>");
    });

    //连接单击事件
    $(".aClick").click(function(e) {
        var art = $(this).attr("art");
        var http ="";
        var ishttps = 'https:' == document.location.protocol ? true : false;
        if(ishttps) {http ="https://"; } else {http ="http://";}
        var host = window.location.host;
		/*--生成全地址--*/
        var url = http+host+art;
        $("#content").val(url);
        var t = $(this).parents("tr").index();
        $(".layer_box").css("top", (t + 1) * 40 + 15 ).removeClass('dn');
        e.stopPropagation();//阻止冒泡到body

    });
    $(" body").click(function(){
        $(".layer_box").addClass("dn");
    });

    //点击复制事件,复制一个模板
    $(".bClick").click(function() {
        var id = $(this).attr("tid");
        $.ajax({
            type: "POST",
            url: "/index.php?m=admin&c=template&a=copytemplate&id=" + id, //+tab,
			dataType:'json',
            success: function(data) {
                if(data.code==1) {
                    ajax_get_table('search-form2', 0);
                }else{
                    layer.msg("复制失败",{icon:2,time:2000});
				}
            }
        });
    });

    //点击设置为首页的按钮
	$(".cClick").click(function () {
        var id = $(this).attr("tid");
        $.ajax({
            type: "POST",
            url: "/index.php?m=admin&c=template&a=sethomepage&id=" + id, //+tab,
            dataType:'json',
            success: function(data) {
                if(data.code==1) {
                    ajax_get_table('search-form2',cur_page);
                }else{
                    layer.msg("设置失败",{icon:2,time:2000});
                }
            }
        });
    });


	function deldefweb(ob) {
       if(confirm("确定要取消首页吗?")){
           var id = $(ob).attr("tid");
           $.ajax({
               type: "POST",
               url: "/index.php?m=admin&c=template&a=canclehomepage&id=" + id, //+tab,
               dataType:'json',
               success: function(data) {
                   if(data.code==1) {
                       ajax_get_table('search-form2',cur_page);
                   }else{
                       layer.msg("设置失败",{icon:2,time:2000});
                   }
               }
           });
	   }
    }


</script>