You've already forked qlg.tsgz.moe
							
							Init Repo
This commit is contained in:
		
							
								
								
									
										124
									
								
								hyhproject/admin/view/adpositions/adpositions.js
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										124
									
								
								hyhproject/admin/view/adpositions/adpositions.js
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,124 @@
 | 
			
		||||
var mmg;
 | 
			
		||||
function initGrid(){
 | 
			
		||||
    var h = WST.pageHeight();
 | 
			
		||||
    var cols = [
 | 
			
		||||
            {title:'位置名称', name:'positionName', width: 230},
 | 
			
		||||
            {title:'宽度', name:'positionWidth' ,width:30},
 | 
			
		||||
            {title:'高度', name:'positionHeight' ,width:30},
 | 
			
		||||
            {title:'位置类型', name:'' ,width:30, align:'center', renderer: function(val,item,rowIndex){
 | 
			
		||||
               var pName;
 | 
			
		||||
               switch(item['positionType']){
 | 
			
		||||
                  case 2:
 | 
			
		||||
                    pName='微信版';
 | 
			
		||||
                    break;
 | 
			
		||||
                  case 3:
 | 
			
		||||
                    pName='手机版';
 | 
			
		||||
                    break;
 | 
			
		||||
                  case 4:
 | 
			
		||||
                    pName='APP版';
 | 
			
		||||
                    break;
 | 
			
		||||
                  default:
 | 
			
		||||
                    pName='PC版';
 | 
			
		||||
                    break;
 | 
			
		||||
               }
 | 
			
		||||
               return pName;
 | 
			
		||||
            }},
 | 
			
		||||
            {title:'位置代码', name:'positionCode' ,width:40},
 | 
			
		||||
            {title:'操作', name:'' ,width:60, align:'center', renderer: function(val,item,rowIndex){
 | 
			
		||||
                var h = "";
 | 
			
		||||
                if(WST.GRANT.GGWZ_02)h += "<a  class='btn btn-blue' href='javascript:toEdit("+item['positionId']+")'><i class='fa fa-pencil'></i>修改</a> ";
 | 
			
		||||
                if(WST.GRANT.GGWZ_03)h += "<a  class='btn btn-red' href='javascript:toDel(" + item['positionId'] + ")'><i class='fa fa-trash-o'></i>删除</a> "; 
 | 
			
		||||
                return h;
 | 
			
		||||
            }}
 | 
			
		||||
            ];
 | 
			
		||||
 
 | 
			
		||||
    mmg = $('.mmg').mmGrid({height: h-175,indexCol: true, cols: cols,method:'POST',
 | 
			
		||||
        url: WST.U('admin/Adpositions/pageQuery'), fullWidthRows: true, autoLoad: true,
 | 
			
		||||
        plugins: [
 | 
			
		||||
            $('#pg').mmPaginator({})
 | 
			
		||||
        ]
 | 
			
		||||
    }); 
 | 
			
		||||
    $('#headTip').WSTTips({width:90,height:35,callback:function(v){
 | 
			
		||||
         if(v){
 | 
			
		||||
             mmg.resize({height:h-175});
 | 
			
		||||
         }else{
 | 
			
		||||
             mmg.resize({height:h-130});
 | 
			
		||||
         }
 | 
			
		||||
    }});
 | 
			
		||||
}
 | 
			
		||||
function toEdit(id){
 | 
			
		||||
  location.href = WST.U('admin/Adpositions/toedit','id='+id);
 | 
			
		||||
}
 | 
			
		||||
function loadQuery(){
 | 
			
		||||
    var query = WST.getParams('.query');
 | 
			
		||||
    query.page = 1;
 | 
			
		||||
    mmg.load(query);
 | 
			
		||||
}
 | 
			
		||||
function toDel(id){
 | 
			
		||||
	var box = WST.confirm({content:"您确定要删除该记录吗?",yes:function(){
 | 
			
		||||
	           var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
 | 
			
		||||
	           	$.post(WST.U('admin/AdPositions/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);
 | 
			
		||||
	           		        loadQuery();
 | 
			
		||||
	           			  }else{
 | 
			
		||||
	           			    	WST.msg(json.msg,{icon:2});
 | 
			
		||||
	           			  }
 | 
			
		||||
	           		});
 | 
			
		||||
	            }});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
function editInit(){
 | 
			
		||||
	 /* 表单验证 */
 | 
			
		||||
    $('#adPositionsForm').validator({
 | 
			
		||||
            fields: {
 | 
			
		||||
                positionType: {
 | 
			
		||||
                  rule:"required",
 | 
			
		||||
                  msg:{required:"请选择位置类型"},
 | 
			
		||||
                  tip:"请选择位置类型",
 | 
			
		||||
                  ok:"",
 | 
			
		||||
                },
 | 
			
		||||
                positionName: {
 | 
			
		||||
                  rule:"required;",
 | 
			
		||||
                  msg:{required:"请输入位置名称"},
 | 
			
		||||
                  tip:"请输入位置名称",
 | 
			
		||||
                  ok:"",
 | 
			
		||||
                },
 | 
			
		||||
                positionCode: {
 | 
			
		||||
                    rule:"required;",
 | 
			
		||||
                    msg:{required:"请输入位置代码"},
 | 
			
		||||
                    tip:"请输入位置代码",
 | 
			
		||||
                    ok:"",
 | 
			
		||||
                  },
 | 
			
		||||
                positionWidth: {
 | 
			
		||||
                  rule:"required;",
 | 
			
		||||
                  msg:{required:"请输入建议宽度"},
 | 
			
		||||
                  ok:"",
 | 
			
		||||
                },
 | 
			
		||||
                positionHeight: {
 | 
			
		||||
                  rule:"required",
 | 
			
		||||
                  msg:{required:"请输入建议高度"},
 | 
			
		||||
                  ok:"",
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
          valid: function(form){
 | 
			
		||||
            var params = WST.getParams('.ipt');
 | 
			
		||||
            var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
 | 
			
		||||
            $.post(WST.U('admin/Adpositions/'+((params.positionId==0)?"add":"edit")),params,function(data,textStatus){
 | 
			
		||||
              layer.close(loading);
 | 
			
		||||
              var json = WST.toAdminJson(data);
 | 
			
		||||
              if(json.status=='1'){
 | 
			
		||||
                  WST.msg("操作成功",{icon:1});
 | 
			
		||||
                  location.href=WST.U('Admin/Adpositions/index');
 | 
			
		||||
              }else{
 | 
			
		||||
                    WST.msg(json.msg,{icon:2});
 | 
			
		||||
              }
 | 
			
		||||
            });
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										67
									
								
								hyhproject/admin/view/adpositions/edit.html
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										67
									
								
								hyhproject/admin/view/adpositions/edit.html
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,67 @@
 | 
			
		||||
{extend name="base" /}
 | 
			
		||||
{block name="css"}
 | 
			
		||||
<link rel="stylesheet" type="text/css" href="__STATIC__/plugins/webuploader/webuploader.css?v={$v}" />
 | 
			
		||||
{/block}
 | 
			
		||||
{block name="js"}
 | 
			
		||||
<script type='text/javascript' src='__STATIC__/plugins/webuploader/webuploader.js?v={$v}'></script>
 | 
			
		||||
<script src="__ADMIN__/adpositions/adpositions.js?v={$v}" type="text/javascript"></script>
 | 
			
		||||
{/block}
 | 
			
		||||
{block name="main"}
 | 
			
		||||
<form id="adPositionsForm" autocomplete="off">
 | 
			
		||||
<table class='wst-form wst-box-top'>
 | 
			
		||||
  <tr>
 | 
			
		||||
      <th width='150'>位置类型<font color='red'>*</font>:</th>
 | 
			
		||||
          <td>
 | 
			
		||||
            <select id="positionType" name="positionType" class='ipt' maxLength='20'>
 | 
			
		||||
              <option value="">-请选择-</option>
 | 
			
		||||
              {volist name=":WSTDatas('ADS_TYPE')" id='vo'}
 | 
			
		||||
              <option <?=($data['positionType']==$vo['dataVal'])?'selected':'';?> value="{$vo['dataVal']}">{$vo['dataName']}</option>
 | 
			
		||||
              {/volist}
 | 
			
		||||
            </select>
 | 
			
		||||
          </td>
 | 
			
		||||
       </tr>
 | 
			
		||||
       <tr>
 | 
			
		||||
          <th>位置名称<font color='red'>*</font>:</th>
 | 
			
		||||
          <td>
 | 
			
		||||
            <input type="text" id="positionName" name="positionName" value='{$data['positionName']}' class="ipt" />
 | 
			
		||||
          </td>
 | 
			
		||||
       </tr>
 | 
			
		||||
       <tr>
 | 
			
		||||
          <th>位置代码<font color='red'>*</font>:</th>
 | 
			
		||||
          <td>
 | 
			
		||||
            <input type="text" id="positionCode" name="positionCode" value='{$data['positionCode']}' class="ipt" />
 | 
			
		||||
          </td>
 | 
			
		||||
       </tr>
 | 
			
		||||
       <tr>
 | 
			
		||||
          <th>建议宽度<font color='red'>*</font>:</th>
 | 
			
		||||
          <td>
 | 
			
		||||
            <input type="text" id="positionWidth" name="positionWidth" value='{$data['positionWidth']}' class="ipt" maxLength='4' />
 | 
			
		||||
          </td>
 | 
			
		||||
       </tr>
 | 
			
		||||
       <tr>
 | 
			
		||||
          <th>建议高度<font color='red'>*</font>:</th>
 | 
			
		||||
          <td>
 | 
			
		||||
            <input type='text' id='positionHeight' name="positionHeight" value='{$data['positionHeight']}' class='ipt' maxLength='4'/>
 | 
			
		||||
          </td>
 | 
			
		||||
       </tr>
 | 
			
		||||
       <tr>
 | 
			
		||||
          <th>排序号<font color='red'> </font>:</th>
 | 
			
		||||
          <td>
 | 
			
		||||
            <input type='text' id='apSort' name="apSort" value='{$data['apSort']}' class='ipt' maxLength='10'/>
 | 
			
		||||
          </td>
 | 
			
		||||
       </tr>
 | 
			
		||||
  
 | 
			
		||||
  <tr>
 | 
			
		||||
     <td colspan='2' align='center' class='wst-bottombar'>
 | 
			
		||||
       <input type="hidden" name="id" id="positionId" class="ipt" value="{$data['positionId']+0}" />
 | 
			
		||||
       <button type="submit" class='btn btn-primary btn-mright'><i class="fa fa-check"></i>提交</button>
 | 
			
		||||
       <button type="button" onclick="javascript:history.go(-1)" class='btn'><i class="fa fa-angle-double-left"></i>返回</button>
 | 
			
		||||
     </td>
 | 
			
		||||
  </tr>
 | 
			
		||||
</table>
 | 
			
		||||
</form>
 | 
			
		||||
<script>
 | 
			
		||||
$(function(){editInit()});
 | 
			
		||||
</script>
 | 
			
		||||
{/block}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										40
									
								
								hyhproject/admin/view/adpositions/list.html
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										40
									
								
								hyhproject/admin/view/adpositions/list.html
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,40 @@
 | 
			
		||||
{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__/adpositions/adpositions.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>
 | 
			
		||||
    <li>该功能为开发者功能,普通使用者请勿随意修改,以免影响系统使用。</li>
 | 
			
		||||
  </ul>
 | 
			
		||||
</div>
 | 
			
		||||
<form autocomplete="off" >
 | 
			
		||||
{if WSTGrant('GGWZ_01')}
 | 
			
		||||
<div class="wst-toolbar">
 | 
			
		||||
      <select name="positionType" id="positionType" class="query">
 | 
			
		||||
        <option value="">请选择广告位置类型</option>
 | 
			
		||||
            {volist name=":WSTDatas('ADS_TYPE')" id='vo'}
 | 
			
		||||
            <option value="{$vo['dataVal']}">{$vo['dataName']}</option>
 | 
			
		||||
            {/volist}
 | 
			
		||||
      </select>
 | 
			
		||||
   <input type='text' id='key' class="query" placeholder='位置代码'/>
 | 
			
		||||
   <button type="button" class="btn btn-primary" onclick="javascript:loadQuery()"><i class='fa fa-search'></i>查询</button>
 | 
			
		||||
   <button class="btn btn-success f-right" type='button' onclick="javascript:location.href='<?=url("admin/Adpositions/toEdit")?>'"><i class='fa fa-plus'></i>新增</button>
 | 
			
		||||
   <div style="clear:both"></div>
 | 
			
		||||
</div>
 | 
			
		||||
{/if}
 | 
			
		||||
</form>
 | 
			
		||||
<div class='wst-grid'>
 | 
			
		||||
<div id="mmg" class="mmg"></div>
 | 
			
		||||
<div id="pg" style="text-align: right;"></div>
 | 
			
		||||
</div>
 | 
			
		||||
<script>
 | 
			
		||||
  $(function(){initGrid()});
 | 
			
		||||
</script>
 | 
			
		||||
{/block}
 | 
			
		||||
		Reference in New Issue
	
	Block a user