Authored by dongjunjie

标签修改

@@ -4,79 +4,50 @@ @@ -4,79 +4,50 @@
4 var $ = require('jquery'); 4 var $ = require('jquery');
5 common = require('../common/common'); 5 common = require('../common/common');
6 6
7 -  
8 var ENUM = { 7 var ENUM = {
9 HotEnum: { 8 HotEnum: {
10 '1': '是', 9 '1': '是',
11 - '0': '否', 10 + '0': '否'
12 }, 11 },
13 -  
14 StatusEnum: { 12 StatusEnum: {
15 0:'关闭', 13 0:'关闭',
16 - 1:'开启',  
17 - },  
18 - 14 + 1:'开启'
  15 + }
19 } 16 }
20 17
21 -//下拉框  
22 new common.dropDown({ 18 new common.dropDown({
23 - el: "#articleGender" 19 + el: "#sort",
  20 + ajax: 'guangGetTagCategoryByStatus'
24 }); 21 });
25 22
26 -new common.dropDown({  
27 - el: "#maxSortId",  
28 - ajax: 'guangGetTagCategoryByStatus',  
29 -  
30 -});  
31 -  
32 -  
33 var g = new common.grid({ 23 var g = new common.grid({
34 el: '#basicTable', 24 el: '#basicTable',
35 size: 10, 25 size: 10,
36 parms: function () { 26 parms: function () {
37 -  
38 return { 27 return {
39 tagName: common.util.__input('articleTitle'), 28 tagName: common.util.__input('articleTitle'),
40 - classifyId: common.util.__input('maxSortId'),  
41 - isHot: common.util.__input('articleGender'),  
42 - status: common.util.__input('status'), 29 + classifyId: common.util.__input('sort'),
  30 + isHot: common.util.__input('isArticleHot'),
  31 + status: common.util.__input('status')
43 }; 32 };
44 }, 33 },
45 columns: [ 34 columns: [
46 - {  
47 - display: 'ID',  
48 - name: "id"  
49 - },  
50 -  
51 - {  
52 - display: '标签名称',  
53 - name: "tagName"  
54 - }, {  
55 - display: '标签分类',  
56 - name: "classifyName"  
57 - }, {  
58 - display: '是否热门',  
59 - render: function (item) {  
60 - return "<p>" + ENUM.HotEnum[item.isHot] + "</p>";  
61 - }  
62 - }, {  
63 - display: '状态',  
64 - render: function (item) {  
65 - return "<p>" + ENUM.StatusEnum[item.status] + "</p>";  
66 - }  
67 - }, {  
68 - display: '操作',  
69 - //}  
70 - name: "status",  
71 - render: function (items) {  
72 - var HtmArr = [];  
73 -  
74 - HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-primary btn-xs info-modify">编辑</a>');  
75 - HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs info-del">删除</a>');  
76 -  
77 - return HtmArr.join('');  
78 - }  
79 - }] 35 + {display: 'ID', name: "id"},
  36 + {display: '标签名称', name: "tagName"},
  37 + {display: '标签分类', name: "classifyName"},
  38 + {display: '是否热门', render: function (item) {
  39 + return "<p>" + ENUM.HotEnum[item.isHot] + "</p>";
  40 + }},
  41 + {display: '状态', render: function (item) {
  42 + return "<p>" + ENUM.StatusEnum[item.status] + "</p>";
  43 + }},
  44 + {display: '操作', name: "status", render: function (items) {
  45 + var HtmArr = [];
  46 + HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-primary btn-xs info-modify">编辑</a>');
  47 + HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs info-del">删除</a>');
  48 + return HtmArr.join('');
  49 + }}
  50 + ]
80 }); 51 });
81 g.init('/guang/tags/getList'); 52 g.init('/guang/tags/getList');
82 53
@@ -89,7 +60,6 @@ $("#filter-btn").click(function() { @@ -89,7 +60,6 @@ $("#filter-btn").click(function() {
89 //添加 60 //添加
90 $(document).on('click', '#add-btn', function() { 61 $(document).on('click', '#add-btn', function() {
91 articleCategoryOP("新增", '/guang/tags/addTag', {}); 62 articleCategoryOP("新增", '/guang/tags/addTag', {});
92 -  
93 }); 63 });
94 64
95 //编辑 65 //编辑
@@ -101,12 +71,11 @@ $(document).on('click', '.info-modify', function() { @@ -101,12 +71,11 @@ $(document).on('click', '.info-modify', function() {
101 //删除 71 //删除
102 $(document).on('click', '.info-del', function() { 72 $(document).on('click', '.info-del', function() {
103 var item = g.rows[$(this).data("index")]; 73 var item = g.rows[$(this).data("index")];
104 -  
105 common.dialog.confirm("温馨提示","确定要删除该标签?" , function() { 74 common.dialog.confirm("温馨提示","确定要删除该标签?" , function() {
106 common.util.__ajax({ 75 common.util.__ajax({
107 url: '/guang/tags/delTag', 76 url: '/guang/tags/delTag',
108 data: { 77 data: {
109 - id: item.id, 78 + id: item.id
110 } 79 }
111 }, function(res) { 80 }, function(res) {
112 if (res.code == 200) { 81 if (res.code == 200) {
@@ -118,15 +87,11 @@ $(document).on('click', '.info-del', function() { @@ -118,15 +87,11 @@ $(document).on('click', '.info-del', function() {
118 87
119 88
120 function articleCategoryOP(prefix, url, item) { 89 function articleCategoryOP(prefix, url, item) {
121 -  
122 - var a =new common.edit(".confirm");  
123 -  
124 - common.dialog.confirm(prefix+'标签', common.util.__template2($("#template").html(), item), function () {  
125 -  
126 - // 90 + var a = new common.edit(".tagInfo", {bucket:"articleTags"});
  91 + common.dialog.confirm(prefix + '标签', common.util.__template2($("#template").html(), item), function () {
127 return a.submit(url,function(option){ 92 return a.submit(url,function(option){
128 - option.success=function(res){  
129 - res=res.data; 93 + option.success = function(res){
  94 + res = res.data;
130 if(res.code=="200"){ 95 if(res.code=="200"){
131 a.$tip("提交成功", function() { 96 a.$tip("提交成功", function() {
132 g.reload(); 97 g.reload();
@@ -136,24 +101,26 @@ function articleCategoryOP(prefix, url, item) { @@ -136,24 +101,26 @@ function articleCategoryOP(prefix, url, item) {
136 } 101 }
137 return false; 102 return false;
138 }, 103 },
139 - option.error=function(res){  
140 - a.$tip(res.message);  
141 - }  
142 - });  
143 -  
144 - });  
145 104
146 - a.init();  
147 -  
148 -  
149 - new common.dropDown({  
150 - el: "#classifyId",  
151 - ajax: 'guangGetTagCategoryByStatus',  
152 - params:function(){  
153 - return {status:1}; 105 + option.error = function(res){
  106 + a.$tip(res.message);
154 } 107 }
155 -  
156 }); 108 });
  109 + });
  110 + a.init();
157 111
  112 + e.on("callback",function(obj){
  113 + if(/^file_onComplete_shopBannerImage_/.test(obj.key)){
  114 + var _index = obj.key.replace(/^file_onComplete_shopBannerImage_/,'');
  115 + g.__rows[_index].shopSrc = obj.data;
  116 + }
  117 + });
158 118
  119 + new common.dropDown({
  120 + el: "#classifyId",
  121 + ajax: 'guangGetTagCategoryByStatus',
  122 + params:function(){
  123 + return {status:1};
  124 + }
  125 + });
159 } 126 }
@@ -21,32 +21,30 @@ @@ -21,32 +21,30 @@
21 21
22 <div class="contentpanel"> 22 <div class="contentpanel">
23 <div class="panel panel-default" style="margin-bottom:10px;"> 23 <div class="panel panel-default" style="margin-bottom:10px;">
24 - <div class="panel-body">  
25 - <a id="add-btn" href="javascript:;" class="btn btn-info">添加</a> 24 + <div class="panel-body" style="padding-bottom: 0">
  25 + <a id="add-btn" href="javascript:;" class="btn btn-info"><i class="fa fa-plus"></i> 添加</a>
26 </div> 26 </div>
27 <div class="panel-body"> 27 <div class="panel-body">
28 28
29 -  
30 <div class="row"> 29 <div class="row">
31 <div class="panel-col"> 30 <div class="panel-col">
32 - <input type="text" id="articleTitle" class="form-control" placeholder="输入标签名称" style="height: 39px;"/> 31 + <input type="text" id="articleTitle" class="form-control" placeholder="输入标签名称" />
33 </div> 32 </div>
34 33
35 <div class="panel-col"> 34 <div class="panel-col">
36 - <select id="maxSortId" class="form-control" > 35 + <select id="sort" class="form-control" >
37 <option value="-1">请选择分类</option> 36 <option value="-1">请选择分类</option>
38 </select> 37 </select>
39 </div> 38 </div>
40 39
41 <div class="panel-col"> 40 <div class="panel-col">
42 - <select id="articleGender" class="form-control"> 41 + <select id="isArticleHot" class="form-control">
43 <option value="-1">是否热门</option> 42 <option value="-1">是否热门</option>
44 <option value="1"></option> 43 <option value="1"></option>
45 <option value="0"></option> 44 <option value="0"></option>
46 </select> 45 </select>
47 </div> 46 </div>
48 47
49 -  
50 <div class="panel-col"> 48 <div class="panel-col">
51 <a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a> 49 <a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
52 <a id="all-btn" href="" class="btn btn-info">全部</a> 50 <a id="all-btn" href="" class="btn btn-info">全部</a>
@@ -68,39 +66,55 @@ @@ -68,39 +66,55 @@
68 66
69 67
70 <script type="text/template" id="template"> 68 <script type="text/template" id="template">
71 - <div class="form-group">  
72 - <label for="tagName" class="col-sm-2 control-label">标签名称:</label>  
73 - <div class="col-sm-10">  
74 - <input type="text" value="[[tagName]]" name="content" id="tagName" placeholder="标签名称" required="required" class="form-control"> 69 + <div class="form-horizontal tagInfo">
  70 + <input type="hidden" value="[[id]]" id="id" class="form-control">
  71 +
  72 + <div class="form-group">
  73 + <label for="tagName" class="col-sm-2 control-label">标签名称:</label>
  74 + <div class="col-sm-offset-1 col-sm-5">
  75 + <input type="text" value="[[tagName]]" id="tagName" placeholder="标签名称" required="required" class="form-control">
  76 + </div>
75 </div> 77 </div>
76 - </div>  
77 - <div class="form-group" id="maxsord">  
78 - <label for="classifyId" class="col-sm-2 control-label">标签分类:</label>  
79 - <div class="col-sm-10">  
80 - <input type="hidden" name="" value="[[id]]" id="id" class="form-control" pattern="" title="">  
81 - <select id="classifyId" value="[[classifyId]]" required="required" class="form-control">  
82 - <!--<option value="-1">请选择分类</option>-->  
83 - <option value="[[classifyId||-1]]">[[classifyName||"请选择分类"]]</option>  
84 - </select> 78 +
  79 + <div class="form-group" id="maxsord">
  80 + <label for="classifyId" class="col-sm-2 control-label">标签分类:</label>
  81 + <div class="col-sm-offset-1 col-sm-5">
  82 + <select id="classifyId" value="[[classifyId]]" required="required" class="form-control">
  83 + <option value="[[classifyId || -1]]">[[classifyName || "请选择分类"]]</option>
  84 + </select>
  85 + </div>
85 </div> 86 </div>
86 - </div>  
87 87
88 - <div class="form-group">  
89 - <label for="isHot" class="col-sm-2 control-label">是否热门:</label>  
90 - <div class="radio">  
91 - <label><input type="radio" value="1" name="isHot" kl_vkbd_parsed="true"></label>  
92 - <label><input type="radio" value="0" name="isHot" kl_vkbd_parsed="true" checked></label> 88 + <div class="form-group">
  89 + <label for="orderBy" class="col-sm-2 control-label">排序:</label>
  90 + <div class="col-sm-offset-1 col-sm-5">
  91 + <input type="number" value="[[orderBy || 0]]" id="orderBy" placeholder="排序" required="required" class="form-control">
  92 + </div>
93 </div> 93 </div>
94 - <input id="isHot" type="hidden" value="[[isHot]]" for="radio" kl_vkbd_parsed="true">  
95 - </div>  
96 94
97 - <div class="form-group">  
98 - <label for="status" class="col-sm-2 control-label">是否启用:</label>  
99 - <div class="radio">  
100 - <label><input type="radio" value="1" name="status" kl_vkbd_parsed="true"></label>  
101 - <label><input type="radio" value="0" name="status" kl_vkbd_parsed="true" checked></label> 95 + <div class="form-group">
  96 + <label for="isHot" class="col-sm-2 control-label">是否热门:</label>
  97 + <div class="col-sm-offset-1 col-sm-5">
  98 + <label class="radio-inline"><input type="radio" value="1" name="isHot" kl_vkbd_parsed="true"></label>
  99 + <label class="radio-inline"><input type="radio" value="0" name="isHot" kl_vkbd_parsed="true" checked></label>
  100 + </div>
  101 + <input id="isHot" type="hidden" value="[[isHot]]" for="radio" kl_vkbd_parsed="true">
102 </div> 102 </div>
103 - <input id="status" type="hidden" value="[[status]]" for="radio" kl_vkbd_parsed="true">  
104 - </div>  
105 103
  104 + <div class="form-group">
  105 + <label for="status" class="col-sm-2 control-label">是否启用:</label>
  106 + <div class="col-sm-offset-1 col-sm-5">
  107 + <label class="radio-inline"><input type="radio" value="1" name="status" kl_vkbd_parsed="true"></label>
  108 + <label class="radio-inline"><input type="radio" value="0" name="status" kl_vkbd_parsed="true" checked></label>
  109 + </div>
  110 + <input id="status" type="hidden" value="[[status]]" for="radio" kl_vkbd_parsed="true">
  111 + </div>
  112 +
  113 + <div class="form-group">
  114 + <label class="col-sm-2 control-label">上传图片:</label>
  115 + <div class="col-sm-offset-1 col-sm-5">
  116 + <input type="file" value="[[cover || '']]" id="cover">
  117 + </div>
  118 + </div>
  119 + </div>
106 </script> 120 </script>