You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
72
hyhproject/admin/view/navs/edit.html
Executable file
72
hyhproject/admin/view/navs/edit.html
Executable file
@ -0,0 +1,72 @@
|
||||
|
||||
{extend name="base" /}
|
||||
{block name="js"}
|
||||
<script src="__ADMIN__/navs/navs.js?v={$v}" type="text/javascript"></script>
|
||||
{/block}
|
||||
{block name="main"}
|
||||
<form id="navForm">
|
||||
<table class='wst-form wst-box-top'>
|
||||
<tr>
|
||||
<th width='120'>导航位置<font color='red'> </font>:</th>
|
||||
<td>
|
||||
<select id="navType" class='ipt' maxLength='20'>
|
||||
<option value="0">顶部</option>
|
||||
<option value="1">底部</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>导航名称<font color='red'>*</font>:</th>
|
||||
<td>
|
||||
<input type="text" id="navTitle" name="navTitle" class="ipt" maxLength='50' style='width:300px;'/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>导航链接<font color='red'>*</font>:</th>
|
||||
<td>
|
||||
<input type='text' id='navUrl' name="navUrl" class='ipt' style='width:500px;'/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>是否显示<font color='red'> </font>:</th>
|
||||
<td class='layui-form'>
|
||||
<input type="checkbox" {if $data['isShow']==1}checked{/if} class="ipt" id="isShow" name="isShow" lay-skin="switch" lay-filter="isShow" value='1' lay-text="显示|隐藏">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>打开方式<font color='red'>*</font>:</th>
|
||||
<td class='layui-form'>
|
||||
|
||||
<lable>
|
||||
<input type="radio" name="isOpen" value="1" id="isOpen" class="ipt" <?=($data['isOpen']!==0)?'checked="checked"':'';?> title='新窗口打开'/>
|
||||
</lable>
|
||||
<lable>
|
||||
<input type="radio" name="isOpen" value="0" id="isOpen" class="ipt" <?=($data['isOpen']===0)?'checked="checked"':'';?> title='页面跳转'/>
|
||||
</lable>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>导航排序号<font color='red'>*</font>:</th>
|
||||
<td>
|
||||
<input type="text" id="navSort" class="ipt" maxLength="20" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan='2' align='center' class='wst-bottombar'>
|
||||
<input type="hidden" id="id" value="{$data['id']+0}" />
|
||||
<button type="submit" class="btn btn-primary btn-mright"><i class="fa fa-check"></i>提交</button>
|
||||
<button type="button" class="btn" onclick="javascript:history.go(-1)"><i class="fa fa-angle-double-left"></i>返回</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
WST.setValues(<?=json_encode($data)?>);
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
|
31
hyhproject/admin/view/navs/list.html
Executable file
31
hyhproject/admin/view/navs/list.html
Executable file
@ -0,0 +1,31 @@
|
||||
{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__/navs/navs.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>
|
||||
{if WSTGrant('DHGL_01')}
|
||||
<div class="wst-toolbar">
|
||||
<button class="btn btn-success f-right" onclick="javascript:location.href='<?=url("admin/Navs/toEdit")?>'"><i class='fa fa-plus'></i>新增</button>
|
||||
<div style="clear:both"></div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class='wst-grid'>
|
||||
<div id="mmg" class="mmg"></div>
|
||||
<div id="pg" style="text-align: right;"></div>
|
||||
</div>
|
||||
<script>
|
||||
$(function(){initGrid()});
|
||||
</script>
|
||||
|
||||
{/block}
|
114
hyhproject/admin/view/navs/navs.js
Executable file
114
hyhproject/admin/view/navs/navs.js
Executable file
@ -0,0 +1,114 @@
|
||||
var mmg;
|
||||
function initGrid(){
|
||||
var h = WST.pageHeight();
|
||||
var cols = [
|
||||
{title:'导航类型', name:'navType', width: 30, renderer: function(val,item,rowIndex){
|
||||
return (val==0)?'顶部':'底部';
|
||||
}},
|
||||
{title:'导航名称', name:'navTitle',width:30 },
|
||||
{title:'导航链接', name:'navUrl' ,width:120},
|
||||
{title:'是否显示', name:'isShow',width:20, renderer: function(val,item,rowIndex){
|
||||
return '<span class="layui-form"><input type="checkbox" '+ ((item.isShow==1)?"checked":"" )+' class="ipt" id="isShow" name="isShow" lay-skin="switch" lay-filter="isShow" data="'+item['id']+'" lay-text="显示|隐藏"></span>';
|
||||
}},
|
||||
{title:'打开方式', name:'isOpen',width:30,renderer: function(val,item,rowIndex){
|
||||
return (val==1)?'<span style="cursor:pointer" onclick="isShowtoggle(\'isOpen\','+item['id']+', 0)">新窗口打开</span>':'<span style="cursor:pointer" onclick="isShowtoggle(\'isOpen\','+item['id']+', 1)">页面跳转</span>';
|
||||
}},
|
||||
{title:'排序号', name:'navSort',width:10},
|
||||
{title:'操作', name:'op' ,width:80, align:'center', renderer: function(val,item,rowIndex){
|
||||
var h = "";
|
||||
if(WST.GRANT.DHGL_02)h += "<a class='btn btn-blue' href='"+WST.U('admin/Navs/toEdit','id='+item['id'])+"'><i class='fa fa-pencil'></i>修改</a> ";
|
||||
if(WST.GRANT.DHGL_03)h += "<a class='btn btn-red' href='javascript:toDel(" + item['id'] + ")'><i class='fa fa-trash-o'></i>删除</a> ";
|
||||
return h;
|
||||
}}
|
||||
];
|
||||
|
||||
mmg = $('.mmg').mmGrid({height: (h-158),indexCol: true, cols: cols,method:'POST',nowrap: true,
|
||||
url: WST.U('admin/Navs/pageQuery'), fullWidthRows: true, autoLoad: true,
|
||||
plugins: [
|
||||
$('#pg').mmPaginator({})
|
||||
]
|
||||
});
|
||||
mmg.on('loadSuccess',function(){
|
||||
layui.form.render();
|
||||
layui.form.on('switch(isShow)', function(data){
|
||||
var id = $(this).attr("data");
|
||||
if(this.checked){
|
||||
isShowtoggle('isShow',id, 1);
|
||||
}else{
|
||||
isShowtoggle('isShow',id, 0);
|
||||
}
|
||||
});
|
||||
})
|
||||
$('#headTip').WSTTips({width:90,height:35,callback:function(v){
|
||||
var diff = v?155:128;
|
||||
mmg.resize({height:h-diff})
|
||||
}});
|
||||
}
|
||||
function toDel(id){
|
||||
var box = WST.confirm({content:"您确定要删除该记录吗?",yes:function(){
|
||||
var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
|
||||
$.post(WST.U('admin/Navs/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);
|
||||
mmg.load();
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}});
|
||||
}
|
||||
function edit(id){
|
||||
//获取所有参数
|
||||
var params = WST.getParams('.ipt');
|
||||
params.id = id;
|
||||
var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
|
||||
$.post(WST.U('admin/Navs/'+((id==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/Navs/index');
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}
|
||||
function isShowtoggle(field, id, val){
|
||||
if(!WST.GRANT.DHGL_02)return;
|
||||
$.post(WST.U('admin/Navs/editiIsShow'), {'field':field, 'id':id, 'val':val}, function(data, textStatus){
|
||||
var json = WST.toAdminJson(data);
|
||||
if(json.status=='1'){
|
||||
WST.msg("操作成功",{icon:1});
|
||||
mmg.load();
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
})
|
||||
}
|
||||
/*表单验证*/
|
||||
$('#navForm').validator({
|
||||
fields:{
|
||||
navTitle:{rule:'required',msg:{required:"请输入导航名称"},tip:"请输入导航名称",ok:"",},
|
||||
navUrl: {rule:"required;",msg:{required:"请输入导航链接"},tip:"请输入导航链接",ok:"",},
|
||||
},
|
||||
valid:function(form){
|
||||
edit($('#id').val());
|
||||
}
|
||||
});
|
||||
|
||||
function changeFlink(obj){
|
||||
var flink = $(obj).val();
|
||||
if(flink==1)
|
||||
$("#articles").hide();
|
||||
else
|
||||
$("#articles").show();
|
||||
|
||||
}
|
||||
function changeArticles(obj){
|
||||
var url = $(obj).val();
|
||||
|
||||
$("#navUrl").val(url);
|
||||
}
|
Reference in New Issue
Block a user