Init Repo

This commit is contained in:
root
2019-09-06 23:53:10 +08:00
commit f0ef89dfbb
7905 changed files with 914138 additions and 0 deletions

View File

@@ -0,0 +1,88 @@
var mmg;
function initGrid(){
var h = WST.pageHeight();
var cols = [
{title:'品牌名称', name:'brandName', width: 100},
{title:'品牌介绍', name:'brandDesc', width: 100,renderer: function(val,item,rowIndex){
return "<span ><p class='wst-nowrap'>"+item['brandDesc']+"</p></span>";
}},
{title:'商铺', name:'shopName', width: 100,renderer: function(val,item,rowIndex){
return "<span ><p class='wst-nowrap'>"+item['shopName']+"</p></span>";
}},
{title:'主营分类', name:'catName', width: 100,renderer: function(val,item,rowIndex){
return "<span ><p class='wst-nowrap'>"+item['catName']+"</p></span>";
}},
{title:'品牌图标', name:'img', width: 100, renderer: function(val,item,rowIndex){
return "<span class='weixin'><img id='img' onmouseout='toolTip()' onmouseover='toolTip()' style='height:40px;width:40px;' src='"+WST.conf.IMGURL+"/"+item['brandImg']
+"'><span class='imged' style='left:45px;' ><img style='height:150px;width:150px;' src='"+WST.conf.IMGURL+"/"+item['brandImg']+"'></span></span>";
}},
{title:'操作', name:'' ,width:70, align:'center', renderer: function(val,item,rowIndex){
var h = "";
if(WST.GRANT.PPGL_02)h += "<a class='btn btn-blue' href='javascript:toEdit("+item["brandId"]+")'><i class='fa fa-pencil'></i>修改</a> ";
if(WST.GRANT.PPGL_03)h += "<a class='btn btn-red' href='javascript:toDel("+item["brandId"]+")'><i class='fa fa-trash-o'></i>删除</a> ";
return h;
}}
];
mmg = $('.mmg').mmGrid({height: h-85,indexCol: true,indexColWidth:50, cols: cols,method:'POST',
url: WST.U('admin/brands/pageQuery'), fullWidthRows: true, autoLoad: true,
plugins: [
$('#pg').mmPaginator({})
]
});
}
function loadGrid(){
mmg.load({page:1,key:$('#key').val(),id:$('#catId').val()});
}
function toEdit(id){
location.href=WST.U('admin/brands/toEdit','id='+id);
}
function toEdits(id){
var params = WST.getParams('.ipt');
params.id = id;
var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
$.post(WST.U('admin/brands/'+((id>0)?"edit":"add")),params,function(data,textStatus){
layer.close(loading);
var json = WST.toAdminJson(data);
if(json.status=='1'){
WST.msg(json.msg,{icon:1});
setTimeout(function(){
location.href=WST.U('admin/brands/index');
},1000);
}else{
WST.msg(json.msg,{icon:2});
}
});
}
function toDel(id){
var box = WST.confirm({content:"您确定要删除该品牌吗?",yes:function(){
var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
$.post(WST.U('admin/brands/del'),{id:id},function(data,textStatus){
layer.close(loading);
var json = WST.toAdminJson(data);
if(json.status=='1'){
WST.msg(json.msg,{icon:1});
layer.close(box);
loadGrid();
}else{
WST.msg(json.msg,{icon:2});
}
});
}});
}
function toolTip(){
$('body').mousemove(function(e){
var windowH = $(window).height();
if(e.pageY >= windowH*0.8){
var top = windowH*0.233;
$('.imged').css('margin-top',-top);
}else{
var top = windowH*0.06;
$('.imged').css('margin-top',-top);
}
});
}

View File

@@ -0,0 +1,142 @@
{extend name="base" /}
{block name="css"}
<link rel="stylesheet" type="text/css" href="__STATIC__/plugins/webuploader/webuploader.css?v={$v}" />
<style>
.goodsCat{display:inline-block;width:150px}
</style>
{/block}
{block name="js"}
<script src="__STATIC__/plugins/webuploader/webuploader.js?v={$v}" type="text/javascript" ></script>
<script src="__STATIC__/plugins//kindeditor/kindeditor.js?v={$v}" type="text/javascript" ></script>
<script src="__ADMIN__/brands/brands.js?v={$v}" type="text/javascript"></script>
<script>
$(function () {
{if condition="$object['brandId'] !=0"}
WST.setValues({$object});
{/if}
$('#brandForm').validator({
fields: {
brandName: {
tip: "请输入品牌名称",
rule: '品牌名称:required;length[~50];'
},
shopId: {
tip: "请输入店铺ID",
rule: '品牌名称:required;'
},
catId: {
tip: "请选择分类",
rule: 'checked(1~);length[~16];'
},
brandDesc: {
tip: "请输入品牌介绍",
rule: '品牌介绍:required;'
}
},
valid: function(form){
var brandId = $('#brandId').val();
toEdits(brandId);
}
})
});
</script>
{/block}
{block name="main"}
<input type='hidden' id='brandId' value='{$object["brandId"]}'/>
<div class="l-loading" style="display: block" id="wst-loading"></div>
<form id="brandForm" autocomplete="off">
<table class='wst-form wst-box-top'>
<tr>
<th width='150'>品牌名称<font color='red'>*</font></th>
<td><input type="text" id='brandName' name='brandName' maxLength='20' style='width:300px;' class='ipt'/></td>
</tr>
<tr>
<th width='150' align='right'>店铺ID<font color='red'>*</font></th>
<td><input type="text" id='shopId' name='shopId' maxLength='20' style='width:300px;' class='ipt'/></td>
</tr>
<tr>
<th width='150' align='right'>所属分类<font color='red'>*</font></th>
<td>
{volist name="gcatList" id="vo"}
<label class='goodsCat'>
<input type='checkbox' id='catId' name='catId' class="ipt" value='{$vo["catId"]}'
{if condition="$object['brandId'] !=0 "}
{if in_array($vo["catId"],$object['catIds'])==1}checked{/if}
{/if}
>&nbsp;{$vo["catName"]}&nbsp;
</label>
{/volist}
</td>
</tr>
<tr width='150'>
<th align='right'>品牌图标<font color='red'>*</font></th>
<td>
<div>
<div id="filePicker" style='margin-left:0px;float:left; width: 100px'>上传图片</div>
<div style='margin-left:5px;float:left'>图片大小:400 x 200 (px),格式为 gif, jpg, jpeg,bmp, png</div>
<input id="brandImg" name="brandImg" class="text ipt" autocomplete="off" type="hidden" value="{$object.brandImg}"/>
<div style="clear:both;"></div>
</div>
</td>
</tr>
<tr >
<th align='right' height='152'>预览图:</th>
<td >
<div id="preview" >
{if $object['brandId']!=0}
<img src="__IMGURL__/{$object['brandImg']}" class="ipt" height='152'/>
{/if}
</div>
</td>
</tr>
<tr>
<th width='150'>品牌介绍<font color='red'>*</font></th>
<td>
<textarea id='brandDesc' name='brandDesc' class="form-control ipt" style='width:80%;height:400px'></textarea>
</td>
</tr>
<tr>
<td colspan='2' align='center'>
<button type="submit" class="btn btn-primary btn-mright"><i class="fa fa-check"></i>&nbsp;</button>
<button type="button" class="btn" onclick="javascript:history.go(-1)"><i class="fa fa-angle-double-left"></i>&nbsp;</button>
</td>
</tr>
</table>
</form>
<script>
$(function(){
//文件上传
WST.upload({
pick:'#filePicker',
formData: {dir:'brands',mWidth:500,mHeight:250},
accept: {extensions: 'gif,jpg,jpeg,png',mimeTypes: 'image/jpg,image/jpeg,image/png,image/gif'},
callback:function(f){
var json = WST.toAdminJson(f);
if(json.status==1){
$('#preview').html('<img src="'+WST.conf.IMGURL+"/"+json.savePath+json.thumb+'" height="200" />');
$('#brandImg').val(json.savePath+json.name);
}
}
});
//编辑器
KindEditor.ready(function(K) {
editor1 = K.create('textarea[name="brandDesc"]', {
height:'350px',
uploadJson : WST.conf.ROOT+'/admin/brands/editorUpload',
allowFileManager : false,
allowImageUpload : true,
items:[
'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste',
'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|','image','table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
'anchor', 'link', 'unlink', '|', 'about'
],
afterBlur: function(){ this.sync(); }
});
});
});
</script>
{/block}

View 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__/js/mmgrid/mmGrid.js?v={$v}" type="text/javascript"></script>
<script src="__ADMIN__/brands/brands.js?v={$v}" type="text/javascript"></script>
<script>
$(function(){initGrid();})
</script>
{/block}
{block name="main"}
<div class="wst-toolbar">
<select id='catId'>
<option value='0'>所属商品分类</option>
{volist name="gcatList" id="vo"}
<option value='{$vo['catId']}'>{$vo['catName']}</option>
{/volist}
</select>
<input type='text' id='key' placeholder='品牌名称'/>
<button class="btn btn-primary" onclick='javascript:loadGrid(0)'><i class='fa fa-search'></i>查询</button>
{if WSTGrant('PPGL_01')}
<button class="btn btn-success f-right" onclick='javascript:toEdit(0)'><i class='fa fa-plus'></i>新增</button>
{/if}
<div style='clear:both'></div>
</div>
<div class='wst-grid'>
<div id="mmg" class="mmg"></div>
<div id="pg" style="text-align: right;"></div>
</div>
{/block}