Authored by 姜敏

Merge branch 'feature/feature_v4.6_20160525' of http://git.yoho.cn/fe/yohobuy-po…

…rtal-fe into feature/feature_v4.6_20160525
... ... @@ -4,79 +4,50 @@
var $ = require('jquery');
common = require('../common/common');
var ENUM = {
HotEnum: {
'1': '是',
'0': '否',
'0': '否'
},
StatusEnum: {
0:'关闭',
1:'开启',
},
1:'开启'
}
}
//下拉框
new common.dropDown({
el: "#articleGender"
el: "#sort",
ajax: 'guangGetTagCategoryByStatus'
});
new common.dropDown({
el: "#maxSortId",
ajax: 'guangGetTagCategoryByStatus',
});
var g = new common.grid({
el: '#basicTable',
size: 10,
parms: function () {
return {
tagName: common.util.__input('articleTitle'),
classifyId: common.util.__input('maxSortId'),
isHot: common.util.__input('articleGender'),
status: common.util.__input('status'),
classifyId: common.util.__input('sort'),
isHot: common.util.__input('isArticleHot'),
status: common.util.__input('status')
};
},
columns: [
{
display: 'ID',
name: "id"
},
{
display: '标签名称',
name: "tagName"
}, {
display: '标签分类',
name: "classifyName"
}, {
display: '是否热门',
render: function (item) {
return "<p>" + ENUM.HotEnum[item.isHot] + "</p>";
}
}, {
display: '状态',
render: function (item) {
return "<p>" + ENUM.StatusEnum[item.status] + "</p>";
}
}, {
display: '操作',
//}
name: "status",
render: function (items) {
var HtmArr = [];
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-primary btn-xs info-modify">编辑</a>');
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs info-del">删除</a>');
return HtmArr.join('');
}
}]
{display: 'ID', name: "id"},
{display: '标签名称', name: "tagName"},
{display: '标签分类', name: "classifyName"},
{display: '是否热门', render: function (item) {
return "<p>" + ENUM.HotEnum[item.isHot] + "</p>";
}},
{display: '状态', render: function (item) {
return "<p>" + ENUM.StatusEnum[item.status] + "</p>";
}},
{display: '操作', name: "status", render: function (items) {
var HtmArr = [];
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-primary btn-xs info-modify">编辑</a>');
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs info-del">删除</a>');
return HtmArr.join('');
}}
]
});
g.init('/guang/tags/getList');
... ... @@ -89,7 +60,6 @@ $("#filter-btn").click(function() {
//添加
$(document).on('click', '#add-btn', function() {
articleCategoryOP("新增", '/guang/tags/addTag', {});
});
//编辑
... ... @@ -101,12 +71,11 @@ $(document).on('click', '.info-modify', function() {
//删除
$(document).on('click', '.info-del', function() {
var item = g.rows[$(this).data("index")];
common.dialog.confirm("温馨提示","确定要删除该标签?" , function() {
common.util.__ajax({
url: '/guang/tags/delTag',
data: {
id: item.id,
id: item.id
}
}, function(res) {
if (res.code == 200) {
... ... @@ -118,15 +87,11 @@ $(document).on('click', '.info-del', function() {
function articleCategoryOP(prefix, url, item) {
var a =new common.edit(".confirm");
common.dialog.confirm(prefix+'标签', common.util.__template2($("#template").html(), item), function () {
//
var a = new common.edit(".tagInfo", {bucket:"articleTags"});
common.dialog.confirm(prefix + '标签', common.util.__template2($("#template").html(), item), function () {
return a.submit(url,function(option){
option.success=function(res){
res=res.data;
option.success = function(res){
res = res.data;
if(res.code=="200"){
a.$tip("提交成功", function() {
g.reload();
... ... @@ -136,24 +101,19 @@ function articleCategoryOP(prefix, url, item) {
}
return false;
},
option.error=function(res){
a.$tip(res.message);
}
});
});
a.init();
new common.dropDown({
el: "#classifyId",
ajax: 'guangGetTagCategoryByStatus',
params:function(){
return {status:1};
option.error = function(res){
a.$tip(res.message);
}
});
});
a.init();
new common.dropDown({
el: "#classifyId",
ajax: 'guangGetTagCategoryByStatus',
params:function(){
return {status:1};
}
});
}
\ No newline at end of file
... ...
... ... @@ -21,32 +21,30 @@
<div class="contentpanel">
<div class="panel panel-default" style="margin-bottom:10px;">
<div class="panel-body">
<a id="add-btn" href="javascript:;" class="btn btn-info">添加</a>
<div class="panel-body" style="padding-bottom: 0">
<a id="add-btn" href="javascript:;" class="btn btn-info"><i class="fa fa-plus"></i> 添加</a>
</div>
<div class="panel-body">
<div class="row">
<div class="panel-col">
<input type="text" id="articleTitle" class="form-control" placeholder="输入标签名称" style="height: 39px;"/>
<input type="text" id="articleTitle" class="form-control" placeholder="输入标签名称" />
</div>
<div class="panel-col">
<select id="maxSortId" class="form-control" >
<select id="sort" class="form-control" >
<option value="-1">请选择分类</option>
</select>
</div>
<div class="panel-col">
<select id="articleGender" class="form-control">
<select id="isArticleHot" class="form-control">
<option value="-1">是否热门</option>
<option value="1"></option>
<option value="0"></option>
</select>
</div>
<div class="panel-col">
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
<a id="all-btn" href="" class="btn btn-info">全部</a>
... ... @@ -68,39 +66,55 @@
<script type="text/template" id="template">
<div class="form-group">
<label for="tagName" class="col-sm-2 control-label">标签名称:</label>
<div class="col-sm-10">
<input type="text" value="[[tagName]]" name="content" id="tagName" placeholder="标签名称" required="required" class="form-control">
<div class="form-horizontal tagInfo">
<input type="hidden" value="[[id]]" id="id" class="form-control">
<div class="form-group">
<label for="tagName" class="col-sm-2 control-label">标签名称:</label>
<div class="col-sm-offset-1 col-sm-5">
<input type="text" value="[[tagName]]" id="tagName" placeholder="标签名称" required="required" class="form-control">
</div>
</div>
</div>
<div class="form-group" id="maxsord">
<label for="classifyId" class="col-sm-2 control-label">标签分类:</label>
<div class="col-sm-10">
<input type="hidden" name="" value="[[id]]" id="id" class="form-control" pattern="" title="">
<select id="classifyId" value="[[classifyId]]" required="required" class="form-control">
<!--<option value="-1">请选择分类</option>-->
<option value="[[classifyId||-1]]">[[classifyName||"请选择分类"]]</option>
</select>
<div class="form-group" id="maxsord">
<label for="classifyId" class="col-sm-2 control-label">标签分类:</label>
<div class="col-sm-offset-1 col-sm-5">
<select id="classifyId" value="[[classifyId]]" required="required" class="form-control">
<option value="[[classifyId || -1]]">[[classifyName || "请选择分类"]]</option>
</select>
</div>
</div>
</div>
<div class="form-group">
<label for="isHot" class="col-sm-2 control-label">是否热门:</label>
<div class="radio">
<label><input type="radio" value="1" name="isHot" kl_vkbd_parsed="true"></label>
<label><input type="radio" value="0" name="isHot" kl_vkbd_parsed="true" checked></label>
<div class="form-group">
<label for="orderBy" class="col-sm-2 control-label">排序:</label>
<div class="col-sm-offset-1 col-sm-5">
<input type="number" value="[[orderBy || 0]]" id="orderBy" placeholder="排序" required="required" class="form-control">
</div>
</div>
<input id="isHot" type="hidden" value="[[isHot]]" for="radio" kl_vkbd_parsed="true">
</div>
<div class="form-group">
<label for="status" class="col-sm-2 control-label">是否启用:</label>
<div class="radio">
<label><input type="radio" value="1" name="status" kl_vkbd_parsed="true"></label>
<label><input type="radio" value="0" name="status" kl_vkbd_parsed="true" checked></label>
<div class="form-group">
<label for="isHot" class="col-sm-2 control-label">是否热门:</label>
<div class="col-sm-offset-1 col-sm-5">
<label class="radio-inline"><input type="radio" value="1" name="isHot" kl_vkbd_parsed="true"></label>
<label class="radio-inline"><input type="radio" value="0" name="isHot" kl_vkbd_parsed="true" checked></label>
</div>
<input id="isHot" type="hidden" value="[[isHot]]" for="radio" kl_vkbd_parsed="true">
</div>
<input id="status" type="hidden" value="[[status]]" for="radio" kl_vkbd_parsed="true">
</div>
<div class="form-group">
<label for="status" class="col-sm-2 control-label">是否启用:</label>
<div class="col-sm-offset-1 col-sm-5">
<label class="radio-inline"><input type="radio" value="1" name="status" kl_vkbd_parsed="true"></label>
<label class="radio-inline"><input type="radio" value="0" name="status" kl_vkbd_parsed="true" checked></label>
</div>
<input id="status" type="hidden" value="[[status]]" for="radio" kl_vkbd_parsed="true">
</div>
<div class="form-group">
<label class="col-sm-2 control-label">上传图片:</label>
<div class="col-sm-offset-1 col-sm-5">
<input type="file" name="cover" value="[[cover || '']]" id="cover">
</div>
</div>
</div>
</script>
... ...