You've already forked qlg.tsgz.moe
							
							Init Repo
This commit is contained in:
		
							
								
								
									
										103
									
								
								hyhproject/admin/view/images/images.js
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										103
									
								
								hyhproject/admin/view/images/images.js
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,103 @@
 | 
			
		||||
function initSummary(){
 | 
			
		||||
	 var loading = WST.msg('正在获取数据,请稍后...', {icon: 16,time:60000});
 | 
			
		||||
	 $.post(WST.U('admin/images/summary'),{rnd:Math.random()},function(data,textStatus){
 | 
			
		||||
	       layer.close(loading);
 | 
			
		||||
	       var json = WST.toAdminJson(data);
 | 
			
		||||
	       if(json.status==1){
 | 
			
		||||
	    	   json = json.data;
 | 
			
		||||
	    	   var html = [],tmp,i=1,divLen = 0;
 | 
			
		||||
	    	   for(var key in json){
 | 
			
		||||
	    		   if(key=='_WSTSummary_')continue;
 | 
			
		||||
	    		   tmp = json[key];
 | 
			
		||||
	    		   html.push('<tr class="mmg-body wst-grid-tree-row" height="28" align="center">'
 | 
			
		||||
	    				     ,'<td class="wst-grid-tree-row-cell" style="width:26px;">'+(i++)+'</td>'
 | 
			
		||||
	    				     ,'<td class="wst-grid-tree-row-cell">'+WST.blank(tmp.directory,'未知目录')+'('+key+')'+'</td>'
 | 
			
		||||
	    				     ,'<td class="wst-grid-tree-row-cell" align="left">'+getCharts(json['_WSTSummary_'],tmp.data['1'],tmp.data['0'])+'</td>'
 | 
			
		||||
	    				     ,'<td class="wst-grid-tree-row-cell" nowrap>'+tmp.data['1']+'/'+tmp.data['0']+'</td>'
 | 
			
		||||
	    				     ,'<td class="wst-grid-tree-row-cell"><a class="btn btn-blue" href="'+WST.U('admin/images/lists','keyword='+key)+'"><i class="fa fa-search"></i>查看详情</a></td>');
 | 
			
		||||
	    	   }
 | 
			
		||||
	    	   $('#list').html(html.join(''));
 | 
			
		||||
	       }else{
 | 
			
		||||
	           WST.msg(json.msg,{icon:2});
 | 
			
		||||
	       }
 | 
			
		||||
	 });
 | 
			
		||||
	 $('#headTip').WSTTips({width:90,height:35,callback:function(v){}});  
 | 
			
		||||
}
 | 
			
		||||
function getCharts(maxSize,size1,size2){
 | 
			
		||||
	var w = WST.pageWidth()-400;
 | 
			
		||||
	var tlen = (parseFloat(size1,10)+parseFloat(size2,10))*w/maxSize+1;
 | 
			
		||||
	var s1len = parseFloat(size1,10)*w/maxSize;
 | 
			
		||||
	var s2len = parseFloat(size2,10)*w/maxSize;
 | 
			
		||||
	return ['<div style="width:'+tlen+'px"><div style="height:20px;float:left;width:'+s1len+'px;background:#5cb85c;"></div><div style="height:20px;float:left;width:'+s2len+'px;background:#ddd;"></div></div>'];
 | 
			
		||||
}
 | 
			
		||||
var mmg;
 | 
			
		||||
function initGrid(){
 | 
			
		||||
   var h = WST.pageHeight();
 | 
			
		||||
   var cols = [
 | 
			
		||||
            {title:'图片', name:'imgPath', width: 50, renderer: function(val,item,rowIndex){
 | 
			
		||||
              
 | 
			
		||||
            	// return "<span class='weixin'><img id='img' onmouseout='toolTip()' onmouseover='toolTip()' style='height:60px;width:60px;' src='"+WST.conf.ROOT+"/"+item['imgPath']
 | 
			
		||||
            	// +"'><span class='imged' ><img  style='height:180px;width:180px;' src='"+WST.conf.ROOT+"/"+item['imgPath']+"'></span></span>";
 | 
			
		||||
            	// 修改为oss 地址 mark 20180609 
 | 
			
		||||
            	 return "<span class='weixin'><img id='img' onmouseout='toolTip()' onmouseover='toolTip()' style='height:60px;width:60px;' src='"+WST.conf.IMGURL+"/"+item['imgPath']+"'><span class='imged' ><img  style='height:180px;width:180px;' src='"+WST.conf.IMGURL+"/"+item['imgPath']+"'></span></span>";
 | 
			
		||||
            }},
 | 
			
		||||
            {title:'上传者', name:'userName' ,width:250, renderer: function(val,item,rowIndex){
 | 
			
		||||
               if(item['fromType']==1){
 | 
			
		||||
	        		return "【职员】"+item['loginName'];
 | 
			
		||||
	        	}else{
 | 
			
		||||
	        		if(WST.blank(item['userType'])==''){
 | 
			
		||||
	        			return '游客';
 | 
			
		||||
	        		}else{
 | 
			
		||||
	        			if(item['userType']==1){
 | 
			
		||||
	        				return "【商家:"+item['shopName']+"】"+item['loginName'];
 | 
			
		||||
	        			}else{
 | 
			
		||||
	        				return item['loginName'];
 | 
			
		||||
	        			}
 | 
			
		||||
	        		}
 | 
			
		||||
	        	}
 | 
			
		||||
            }},
 | 
			
		||||
            {title:'文件大小(M)', name:'imgSize' ,width:30},
 | 
			
		||||
            {title:'状态', name:'isUse' ,width:30, renderer: function(val,item,rowIndex){
 | 
			
		||||
               return (val==1)?"<span class='statu-yes'><i class='fa fa-check-circle'></i> 有效</span>":"<span class='statu-no'><i class='fa fa-ban'></i> 无效</span>";
 | 
			
		||||
            }},
 | 
			
		||||
            {title:'上传时间', name:'createTime' ,width:120},
 | 
			
		||||
            {title:'操作', name:'' ,width:80, align:'center', renderer: function(val,item,rowIndex){
 | 
			
		||||
                var h = '<a class="btn btn-blue btn-mright" href="javascript:toView('+item['imgId']+',\''+item['imgPath']+'\')"><i class="fa fa-search"></i>查看</a>';
 | 
			
		||||
	        	if(WST.GRANT.TPKJ_04)h += "<button  class='btn btn-red' onclick='javascript:toDel(" + item['imgId'] + ")'><i class='fa fa-trash-o'></i>删除</button> ";
 | 
			
		||||
                return h;
 | 
			
		||||
            }}
 | 
			
		||||
            ];
 | 
			
		||||
 
 | 
			
		||||
    mmg = $('.mmg').mmGrid({height: h-85,indexCol: true,indexColWidth:50, cols: cols,method:'POST',
 | 
			
		||||
        url: WST.U('admin/images/pageQuery'), fullWidthRows: true, autoLoad: false,
 | 
			
		||||
        plugins: [
 | 
			
		||||
            $('#pg').mmPaginator()
 | 
			
		||||
        ]
 | 
			
		||||
    }); 
 | 
			
		||||
    loadGrid();
 | 
			
		||||
}
 | 
			
		||||
function loadGrid(){
 | 
			
		||||
	mmg.load({page:1,keyword:$('#key').val(),isUse:$('#isUse').val()});
 | 
			
		||||
}
 | 
			
		||||
function toView(id,img){
 | 
			
		||||
    parent.showBox({title:'图片详情',type:2,content:WST.U('admin/images/checkImages','imgPath='+img),area: ['700px', '510px'],btn:['关闭']});
 | 
			
		||||
}
 | 
			
		||||
function toDel(id){
 | 
			
		||||
	var box = WST.confirm({content:"您确定要删除该图片吗?<br/>注意:删除该图片后将不可找回!",yes:function(){
 | 
			
		||||
		var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
 | 
			
		||||
		$.post(WST.U('admin/images/del'),{id:id},function(data,textStatus){
 | 
			
		||||
			layer.close(loading);
 | 
			
		||||
			var json = WST.toAdminJson(data);
 | 
			
		||||
			if(json.status=='1'){
 | 
			
		||||
				WST.msg("操作成功",{icon:1});
 | 
			
		||||
				layer.close(box);
 | 
			
		||||
				loadGrid();
 | 
			
		||||
			}else{
 | 
			
		||||
				WST.msg(json.msg,{icon:2});
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
	}});
 | 
			
		||||
}
 | 
			
		||||
function toolTip(){
 | 
			
		||||
    WST.toolTip();
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										32
									
								
								hyhproject/admin/view/images/index.html
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										32
									
								
								hyhproject/admin/view/images/index.html
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
{extend name="base" /}
 | 
			
		||||
{block name="css"}
 | 
			
		||||
<link rel="stylesheet" type="text/css" href="__ADMIN__/js/mmgrid/mmGrid.css?v={$v}" />
 | 
			
		||||
{/block}
 | 
			
		||||
{block name="js"}
 | 
			
		||||
<script src="__ADMIN__/images/images.js?v={$v}" type="text/javascript"></script>
 | 
			
		||||
{/block}
 | 
			
		||||
{block name="main"}
 | 
			
		||||
<div id='alertTips' class='alert alert-success alert-tips fade in'>
 | 
			
		||||
  <div id='headTip' class='head'><i class='fa fa-lightbulb-o'></i>操作说明</div>
 | 
			
		||||
  <ul class='body'>
 | 
			
		||||
    <li>该功能主要用于查看系统图片空间占用情况。绿色为有效图片,灰色为无效,可删除图片。</li>
 | 
			
		||||
  </ul>
 | 
			
		||||
</div>
 | 
			
		||||
<div id="main" class='mmGrid wst-grid'>
 | 
			
		||||
<table class='mmg-head wst-grid-tree' width='100%' cellspacing='0' cellpadding='0'>
 | 
			
		||||
   <thead class='mmg-headWrapper'>
 | 
			
		||||
   <tr class='l-grid-hd-row wst-grid-tree-hd'>
 | 
			
		||||
       <td width='30' class='wst-grid-tree-hd-cel' height='28' style="width:26px;text-align:center;font-weight:bold;">#</td>
 | 
			
		||||
       <td width='150' class='wst-grid-tree-hd-cell' height='28' style='text-align:center;font-weight:bold;'>目录</td>
 | 
			
		||||
       <td class='wst-grid-tree-hd-cell'height='28' style='text-align:left;font-weight:bold;'>有效图片/无效图片</td>
 | 
			
		||||
       <td width='80' class='wst-grid-tree-hd-cell' height='28' style='text-align:center;font-weight:bold;'>M</td>
 | 
			
		||||
       <td width='80' class='wst-grid-tree-hd-cell' height='28' style='text-align:center;font-weight:bold;'>操作</td>
 | 
			
		||||
   </tr>
 | 
			
		||||
   </thead>
 | 
			
		||||
   <tbody id='list'></tbody>
 | 
			
		||||
</table>
 | 
			
		||||
</div>
 | 
			
		||||
<script>
 | 
			
		||||
$(function(){initSummary();});
 | 
			
		||||
</script>
 | 
			
		||||
{/block}
 | 
			
		||||
							
								
								
									
										36
									
								
								hyhproject/admin/view/images/list.html
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										36
									
								
								hyhproject/admin/view/images/list.html
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
{extend name="base" /}
 | 
			
		||||
{block name="css"}
 | 
			
		||||
<link rel="stylesheet" type="text/css" href="__ADMIN__/js/mmgrid/mmGrid.css?v={$v}" />
 | 
			
		||||
{/block}
 | 
			
		||||
{block name="js"}
 | 
			
		||||
<script src="__ADMIN__/js/mmgrid/mmGrid.js?v={$v}" type="text/javascript"></script>
 | 
			
		||||
<script src="__ADMIN__/images/images.js?v={$v}" type="text/javascript"></script>
 | 
			
		||||
{/block}
 | 
			
		||||
{block name="main"}
 | 
			
		||||
<form>
 | 
			
		||||
<div class="wst-toolbar">
 | 
			
		||||
<select id='key' class='ipt'>
 | 
			
		||||
    <option value=''>所有目录</option>
 | 
			
		||||
    {volist name="$datas" key="i" id='vo'}
 | 
			
		||||
    <option value="{$vo['dataVal']}" {if $keyword==$vo['dataVal']}selected{/if}>{$vo['dataName']}</option>
 | 
			
		||||
    {/volist}
 | 
			
		||||
</select>
 | 
			
		||||
<select id='isUse' class='ipt'>
 | 
			
		||||
    <option value='-1'>全部</option>
 | 
			
		||||
    <option value='1'>有效</option>
 | 
			
		||||
    <option value='0'>失效</option>
 | 
			
		||||
</select>
 | 
			
		||||
</form>
 | 
			
		||||
<button class="btn btn-primary" type='button' onclick='javascript:loadGrid(0)'><i class='fa fa-search'></i>查询</button> 
 | 
			
		||||
<button class="btn f-right" type='button' onclick="javascript:history.go(-1)"><i class="fa fa-angle-double-left"></i>返回</button> 
 | 
			
		||||
</div>
 | 
			
		||||
<table id="mmg" class="mmg">
 | 
			
		||||
   <tr>
 | 
			
		||||
      <th rowspan="" colspan=""></th>
 | 
			
		||||
   </tr>
 | 
			
		||||
</table>
 | 
			
		||||
<div id="pg" style="text-align: right;"></div>
 | 
			
		||||
<script>
 | 
			
		||||
$(function(){initGrid();})
 | 
			
		||||
</script>
 | 
			
		||||
{/block}
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								hyhproject/admin/view/images/loading.gif
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								hyhproject/admin/view/images/loading.gif
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 457 B  | 
							
								
								
									
										
											BIN
										
									
								
								hyhproject/admin/view/images/validator_default.png
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								hyhproject/admin/view/images/validator_default.png
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 423 B  | 
							
								
								
									
										
											BIN
										
									
								
								hyhproject/admin/view/images/validator_simple.png
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								hyhproject/admin/view/images/validator_simple.png
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 1.4 KiB  | 
							
								
								
									
										76
									
								
								hyhproject/admin/view/images/view.html
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										76
									
								
								hyhproject/admin/view/images/view.html
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,76 @@
 | 
			
		||||
{extend name="base" /}
 | 
			
		||||
{block name="js"}
 | 
			
		||||
<script src="__ADMIN__/images/images.js?v={$v}" type="text/javascript"></script>
 | 
			
		||||
{/block}
 | 
			
		||||
{block name="main"}
 | 
			
		||||
<style type="text/css"> 
 | 
			
		||||
*{ margin:0; padding:0; list-style:none;} 
 | 
			
		||||
img{ border:none;} 
 | 
			
		||||
.imgbox{ width:400px; height:400px; margin:0px auto;text-align:center;vertical-align:middle;display:block;position:relative;padding:5px;} 
 | 
			
		||||
.imgbox a{display:table-cell;vertical-align:middle;width:400px; height:400px; } 
 | 
			
		||||
.imgbox a img{max-width:400px;max-height:400px; }
 | 
			
		||||
.imgthumbbox{ width:100px; height:100px;text-align:center;vertical-align:middle;display:block;position:relative;border:1px solid #ddd;margin-bottom:10px;} 
 | 
			
		||||
.imgthumbbox a{display:table-cell;vertical-align:middle;width:100px; height:100px; } 
 | 
			
		||||
.imgthumbbox a img{max-width:100px;max-height:100px; }
 | 
			
		||||
.mimgbox{ width:100px; height:100px; text-align:center;vertical-align:middle;display:block;position:relative;border:1px solid #ddd;margin-bottom:10px;} 
 | 
			
		||||
.mimgbox a{display:table-cell;vertical-align:middle;width:100px; height:100px; } 
 | 
			
		||||
.mimgbox a img{max-width:100px;max-height:100px; }
 | 
			
		||||
.mimgthumbbox{ width:100px; height:100px; text-align:center;vertical-align:middle;display:block;position:relative;border:1px solid #ddd} 
 | 
			
		||||
.mimgthumbbox a{display:table-cell;vertical-align:middle;width:100px; height:100px; } 
 | 
			
		||||
.mimgthumbbox a img{max-width:100px;max-height:100px; }
 | 
			
		||||
.head{line-height:25px;height:25px;}    
 | 
			
		||||
</style> 
 | 
			
		||||
</head> 
 | 
			
		||||
<body> 
 | 
			
		||||
<table width='100%'>
 | 
			
		||||
  <tr>
 | 
			
		||||
    <td>
 | 
			
		||||
	  <div class='imgbox'>
 | 
			
		||||
	    {if $img}
 | 
			
		||||
	    <a href='__ROOT__/{$imgpath}' target="_blank">
 | 
			
		||||
	    <img id='img' src='__ROOT__/{$imgpath}'/>
 | 
			
		||||
	    </a>
 | 
			
		||||
	    {elseif $img_oss}
 | 
			
		||||
	    <a href='__IMGURL__/{$imgpath}' target="_blank">
 | 
			
		||||
	    <img id='img' src='__IMGURL__/{$imgpath}'/>
 | 
			
		||||
	    </a>
 | 
			
		||||
	    {else}
 | 
			
		||||
	     图片不存在!
 | 
			
		||||
	    }
 | 
			
		||||
	    {/if}
 | 
			
		||||
	  </div>
 | 
			
		||||
	</td>
 | 
			
		||||
    <td width='150'>
 | 
			
		||||
    {if $thumb}
 | 
			
		||||
    <div><div class='head'>缩略图:</div>
 | 
			
		||||
	    <div class='imgthumbbox'>
 | 
			
		||||
	      <a href='__ROOT__/{$thumbpath}' target="_blank">
 | 
			
		||||
		    <img src='__ROOT__/{$thumbpath}'/>
 | 
			
		||||
		  </a>
 | 
			
		||||
	    </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    {/if}
 | 
			
		||||
    <!-- {if $mimgpath !=''} -->
 | 
			
		||||
    {if $mimg }
 | 
			
		||||
    <div><div class='head'>移动端图片:</div>
 | 
			
		||||
	    <div class='mimgbox'>
 | 
			
		||||
	      <a href='__ROOT__/{$mimgpath}' target="_blank">
 | 
			
		||||
		    <img src='__ROOT__/{$mimgpath}'/>
 | 
			
		||||
		  </a>
 | 
			
		||||
	    </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    {/if}
 | 
			
		||||
    <!-- {if $mthumbpath !=''} -->
 | 
			
		||||
    {if $mthumb }
 | 
			
		||||
    <div><div class='head'>移动端缩略图:</div>
 | 
			
		||||
	    <div class='mimgthumbbox'>
 | 
			
		||||
	      <a href='__ROOT__/{$mthumbpath}' target="_blank">
 | 
			
		||||
		    <img src='__ROOT__/{$mthumbpath}'/>
 | 
			
		||||
		  </a>
 | 
			
		||||
	    </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    {/if}
 | 
			
		||||
  </td>
 | 
			
		||||
  </tr>
 | 
			
		||||
</table>
 | 
			
		||||
{/block}
 | 
			
		||||
		Reference in New Issue
	
	Block a user