Showing
7 changed files
with
65 additions
and
445 deletions
@@ -23,6 +23,7 @@ module.exports = { | @@ -23,6 +23,7 @@ module.exports = { | ||
23 | {name: "platform", type: "Number"}, | 23 | {name: "platform", type: "Number"}, |
24 | {name: "appType", type: "Number"}, | 24 | {name: "appType", type: "Number"}, |
25 | {name: "templateName", type: "String"}, | 25 | {name: "templateName", type: "String"}, |
26 | + {name: "templateType", type: "String"}, | ||
26 | {name: "modules", type: "String"}, | 27 | {name: "modules", type: "String"}, |
27 | {name: "flag", type: "Number"} | 28 | {name: "flag", type: "Number"} |
28 | ] | 29 | ] |
@@ -30,6 +30,11 @@ | @@ -30,6 +30,11 @@ | ||
30 | <img src="/static/assets/images/decorator/app-product-list.png" alt="#"> | 30 | <img src="/static/assets/images/decorator/app-product-list.png" alt="#"> |
31 | </div> | 31 | </div> |
32 | [[/if]] | 32 | [[/if]] |
33 | + [[if item.moduleType == 'ProductListImg']] | ||
34 | + <div class="app-product-list" non-delete="true" non-added="true" data-type="ProductListImg" data-title="编辑商品列表模块" data-index="[[index]]"> | ||
35 | + <img src="/static/assets/images/decorator/app-product-list.png" alt="#"> | ||
36 | + </div> | ||
37 | + [[/if]] | ||
33 | [[/each]] | 38 | [[/each]] |
34 | 39 | ||
35 | <div id="app-dragable"> <!-- 可拖拽的模块区域 --> | 40 | <div id="app-dragable"> <!-- 可拖拽的模块区域 --> |
@@ -186,9 +191,11 @@ | @@ -186,9 +191,11 @@ | ||
186 | </div> | 191 | </div> |
187 | 192 | ||
188 | <!-- 增加模块区域 --> | 193 | <!-- 增加模块区域 --> |
194 | + [[if templateType == '2']] | ||
189 | <div class="btn add-modular-area" title="添加模块" style="[[data.length > 1 ? 'margin-top: -5px;': '']]"> | 195 | <div class="btn add-modular-area" title="添加模块" style="[[data.length > 1 ? 'margin-top: -5px;': '']]"> |
190 | <span class="glyphicon glyphicon-plus" style="top: -4px;"></span> | 196 | <span class="glyphicon glyphicon-plus" style="top: -4px;"></span> |
191 | </div> | 197 | </div> |
198 | + [[/if]] | ||
192 | </div> | 199 | </div> |
193 | </script> | 200 | </script> |
194 | 201 |
@@ -147,11 +147,18 @@ | @@ -147,11 +147,18 @@ | ||
147 | [[/if]] | 147 | [[/if]] |
148 | </div> | 148 | </div> |
149 | [[/if]] | 149 | [[/if]] |
150 | + [[if item.moduleType == 'ProductListImg']] | ||
151 | + <div class="recommend-product" non-delete="true" non-added="true" data-type="ProductListImg" data-title="编辑推荐商品模块" data-index="[[index]]"> | ||
152 | + <img src="/static/assets/images/decorator/pc-product-list.png" alt="#" class="logo"> | ||
153 | + </div> | ||
154 | + [[/if]] | ||
150 | [[/each]] | 155 | [[/each]] |
151 | </div> | 156 | </div> |
157 | + [[if templateType == '2']] | ||
152 | <div class="btn add-modular-area" title="添加模块" data-style-area="2"> | 158 | <div class="btn add-modular-area" title="添加模块" data-style-area="2"> |
153 | <span class="glyphicon glyphicon-plus" style="top: -4px;"></span> | 159 | <span class="glyphicon glyphicon-plus" style="top: -4px;"></span> |
154 | </div> | 160 | </div> |
161 | + [[/if]] | ||
155 | </div> | 162 | </div> |
156 | </div> | 163 | </div> |
157 | </script> | 164 | </script> |
1 | -/** | ||
2 | - * Created by wangqianjun on 16/3/22. | ||
3 | - */ | ||
4 | - | ||
5 | -'use strict'; | ||
6 | -var $ = require('jquery'), | ||
7 | - common = require('../../../common/common'); | ||
8 | - | ||
9 | - | ||
10 | -var g = new common.grid({ | ||
11 | - el: '#color-list', | ||
12 | - columns: [ | ||
13 | - | ||
14 | - {display: "ID", name: "uid"}, | ||
15 | - {display: "作者", name: "username"}, | ||
16 | - {display: "描述", name: "authorDesc"}, | ||
17 | - {display: "作者头像", name: "colorValue", render: function (item) { | ||
18 | - | ||
19 | - item.avatar = common.util.__template(item.avatar,{mode:2,width:100,height:100}); | ||
20 | - return '<img style="width:40px; height:40px" src="'+item.avatar+'"/>'; | ||
21 | - }}, | ||
22 | - | ||
23 | - {display: "名下文章", name: "articleCount"}, | ||
24 | - | ||
25 | - { | ||
26 | - display: '操作', | ||
27 | - //} | ||
28 | - name: "status", | ||
29 | - render: function (items) { | ||
30 | - var HtmArr = []; | ||
31 | - | ||
32 | - HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-primary btn-xs info-modify">编辑</a>'); | ||
33 | - HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs info-del">删除</a>'); | ||
34 | - | ||
35 | - return HtmArr.join(''); | ||
36 | - } | ||
37 | - } | ||
38 | - ] | ||
39 | - | ||
40 | -}); | ||
41 | - | ||
42 | -g.init('/guang/author/getList'); | ||
43 | - | ||
44 | -//==================== 按钮点击事件 =====================// | ||
45 | - | ||
46 | -//添加 | ||
47 | -$(document).on('click', '#add-btn', function() { | ||
48 | - articleCategoryOP("新增", '/guang/author/addAuthor', {}); | ||
49 | - | ||
50 | -}); | ||
51 | - | ||
52 | -//编辑 | ||
53 | -$(document).on('click', '.info-modify', function() { | ||
54 | - var item = g.rows[$(this).data("index")]; | ||
55 | - articleCategoryOP("修改", '/guang/author/updateAuthor', item); | ||
56 | -}); | ||
57 | - | ||
58 | -//删除 | ||
59 | -$(document).on('click', '.info-del', function() { | ||
60 | - var item = g.rows[$(this).data("index")]; | ||
61 | - | ||
62 | - common.dialog.confirm("温馨提示","确定要删除该作者?" , function() { | ||
63 | - common.util.__ajax({ | ||
64 | - url: '/guang/author/delAuthor', | ||
65 | - data: { | ||
66 | - uid: item.uid, | ||
67 | - } | ||
68 | - }, function(res) { | ||
69 | - if (res.code == 200) { | ||
70 | - g.reload(); | ||
71 | - } else { | ||
72 | - common.util.__tip(res.message); | ||
73 | - } | ||
74 | - }); | ||
75 | - }); | ||
76 | -}); | ||
77 | - | ||
78 | - | ||
79 | -function articleCategoryOP(prefix, url, item) { | ||
80 | - | ||
81 | - var a =new common.edit(".confirm", { | ||
82 | - "bucket" : "author" | ||
83 | - }); | ||
84 | - | ||
85 | - common.dialog.confirm(prefix+'作者', common.util.__template2($("#template").html(), item), function () { | ||
86 | - | ||
87 | - // | ||
88 | - return a.submit(url,function(option){ | ||
89 | - option.success=function(res){ | ||
90 | - if(res.code=="200"){ | ||
91 | - a.$tip("提交成功", function() { | ||
92 | - g.reload(); | ||
93 | - }, 'growl-success'); | ||
94 | - }else{ | ||
95 | - a.$tip(res.message); | ||
96 | - } | ||
97 | - return false; | ||
98 | - }, | ||
99 | - option.error=function(res){ | ||
100 | - a.$tip(res.message); | ||
101 | - } | ||
102 | - }); | ||
103 | - | ||
104 | - }); | ||
105 | - | ||
106 | - a.init(); | ||
107 | - | ||
108 | - | ||
109 | - | ||
110 | -} |
1 | -/** | ||
2 | - * Created by wangqianjun on 16/3/22. | ||
3 | - */ | ||
4 | -var $ = require('jquery'); | ||
5 | -common = require('../../../common/common'); | ||
6 | -datepicker = require('../../../common/util/datepicker'); | ||
7 | - | ||
8 | -var ENUM = { | ||
9 | - GenderEnum: { | ||
10 | - '1': '男', | ||
11 | - '2': '女', | ||
12 | - '3': '通用' | ||
13 | - }, | ||
14 | - | ||
15 | - StatusEnum: { | ||
16 | - '-1': '已关闭', | ||
17 | - 0: '未发布', | ||
18 | - 1: '已发布' | ||
19 | - }, | ||
20 | - | ||
21 | - BLKEnum: { | ||
22 | - 0: '否', | ||
23 | - 1: '是' | ||
24 | - } | ||
25 | - | ||
26 | -}; | ||
27 | - | ||
28 | -//下拉框 | ||
29 | -new common.dropDown({ | ||
30 | - el: "#articleGender" | ||
31 | -}); | ||
32 | - | ||
33 | -new common.dropDown({ | ||
34 | - el: "#authorId", | ||
35 | - ajax: 'guangGetAuthorList' | ||
36 | -}); | ||
37 | - | ||
38 | -new common.dropDown({ | ||
39 | - el: "#maxSortId", | ||
40 | - ajax: 'guangGetSortList' | ||
41 | -}); | ||
42 | - | ||
43 | -new common.dropDown({ | ||
44 | - el: "#status" | ||
45 | -}); | ||
46 | - | ||
47 | -new common.dropDown({ | ||
48 | - el: '#orderBy' | ||
49 | -}); | ||
50 | - | ||
51 | - | ||
52 | -//日期插件 | ||
53 | -$('.hasDatepicker').fdatepicker({ | ||
54 | - format: 'yyyy-mm-dd' | ||
55 | -}); | ||
56 | - | ||
57 | -var Timmer = { | ||
58 | - toast: function (content, fn) { | ||
59 | - common.dialog.confirm("定时发布", content, function () { | ||
60 | - //console.log("fn()",fn()); | ||
61 | - common.util.__ajax({ | ||
62 | - url: '/guang/article/timmer', | ||
63 | - data: fn() | ||
64 | - }, function (res) { | ||
65 | - if (res.code == '200') { | ||
66 | - g.reload(); | ||
67 | - } | ||
68 | - }); | ||
69 | - }); | ||
70 | - } | ||
71 | -}; | ||
72 | - | ||
73 | -var g = new common.grid({ | ||
74 | - el: '#basicTable', | ||
75 | - size: 10, | ||
76 | - parms: function () { | ||
77 | - return { | ||
78 | - articleTitle: common.util.__input('articleTitle'), | ||
79 | - articleGender: common.util.__input('articleGender'), | ||
80 | - authorId: common.util.__input('authorId'), | ||
81 | - maxSortId: common.util.__input('maxSortId'), | ||
82 | - status: $('#status').val(),//common.util.__input('status'), | ||
83 | - orderBy: common.util.__input('orderBy'), | ||
84 | - startTime: common.util.__input('starttime'), | ||
85 | - endTime: common.util.__input('endtime'), | ||
86 | - appType: common.util.__input('appType') | ||
87 | - }; | ||
88 | - }, | ||
89 | - columns: [{ | ||
90 | - display: 'ID', | ||
91 | - name: "id" | ||
92 | - }, { | ||
93 | - display: "缩略图", | ||
94 | - render: function (item) { | ||
95 | - | ||
96 | - item.coverImage = common.util.__template(item.coverImage, {mode: 2, width: 100, height: 100}); | ||
97 | - return '<img src="' + item.coverImage + '" width="100" />' | ||
98 | - } | ||
99 | - }, { | ||
100 | - display: '文章标题', | ||
101 | - //name: "articleTitle", | ||
102 | - width: '15%', | ||
103 | - render: function (item) { | ||
104 | - return '<span class="text-overflow"">' + item.articleTitle + '</span>' | ||
105 | - } | ||
106 | - }, { | ||
107 | - display: '分类', | ||
108 | - name: "maxSortName" | ||
109 | - }, { | ||
110 | - display: '性别', | ||
111 | - render: function (item) { | ||
112 | - return "<p>" + ENUM.GenderEnum[item.articleGender] + "</p>"; | ||
113 | - } | ||
114 | - }, { | ||
115 | - display: '作者', | ||
116 | - name: "authorName" | ||
117 | - }, { | ||
118 | - display: '状态', | ||
119 | - render: function (item) { | ||
120 | - var sta = ENUM.StatusEnum[item.status]; | ||
121 | - if(item.status == 1 && common.util.__compareDate(Date.now(), item.publishTime * 1000)) { | ||
122 | - //检查是否为定时发布,当未到达所设定时间时,即使status为1,也显示‘未发布’ | ||
123 | - sta = "未发布"; | ||
124 | - | ||
125 | - } else { | ||
126 | - } | ||
127 | - return "<p>" + sta + "</p>"; | ||
128 | - } | ||
129 | - }, { | ||
130 | - display: "创建时间", | ||
131 | - | ||
132 | - render: function (item) { | ||
133 | - if (item.createTime && item.createTime !== 0) { | ||
134 | - var t = new Date(item.createTime * 1000); | ||
135 | - var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm"); | ||
136 | - return "<p>" + formatted + "</p>"; | ||
137 | - } | ||
138 | - else { | ||
139 | - return ""; | ||
140 | - } | ||
141 | - | ||
142 | - } | ||
143 | - }, { | ||
144 | - display: "发布时间", | ||
145 | - render: function (item) { | ||
146 | - //console.log(item.publishTime); | ||
147 | - if (item.publishTime && item.publishTime !== 0) { | ||
148 | - var t = new Date(item.publishTime * 1000); | ||
149 | - var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm"); | ||
150 | - return "<p>" + formatted + "</p>"; | ||
151 | - } | ||
152 | - else { | ||
153 | - return ""; | ||
154 | - } | ||
155 | - } | ||
156 | - }, { | ||
157 | - display: 'BLK', | ||
158 | - render: function (item) { | ||
159 | - return "<p>" + ENUM.BLKEnum[item.appType] + "</p>"; | ||
160 | - } | ||
161 | - },{ | ||
162 | - display: '操作', | ||
163 | - //} | ||
164 | - name: "status", | ||
165 | - render: function (items) { | ||
166 | - var HtmArr = []; | ||
167 | - | ||
168 | - HtmArr.push('<a data-index="' + items.__index + '" href="/guang/article/contentEdit/' + items.id + '" class="btn btn-info btn-xs info-modify">编辑</a>'); | ||
169 | - HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-primary btn-xs info-time">定时</a>'); | ||
170 | - HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs info-del">删除</a>'); | ||
171 | - | ||
172 | - if (items.status == 1) { | ||
173 | - if(common.util.__compareDate(Date.now(), items.publishTime * 1000)) { | ||
174 | - HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-success btn-xs info-open">发布</a>'); | ||
175 | - } else { | ||
176 | - HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-warning btn-xs info-close">关闭</a>'); | ||
177 | - } | ||
178 | - } else { | ||
179 | - HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-success btn-xs info-open">发布</a>'); | ||
180 | - } | ||
181 | - | ||
182 | - if (items.isRecommend == 1) { | ||
183 | - HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-warning btn-xs info-recommend-cancel">取消推荐</a>'); | ||
184 | - } else { | ||
185 | - HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-success btn-xs info-recommend">推荐</a>'); | ||
186 | - } | ||
187 | - | ||
188 | - return HtmArr.join(''); | ||
189 | - } | ||
190 | - }] | ||
191 | -}); | ||
192 | -g.init('/guang/article/list'); | ||
193 | - | ||
194 | - | ||
195 | -//==================== 按钮点击事件 =====================// | ||
196 | -$("#filter-btn").click(function () { | ||
197 | - g.reload(1); | ||
198 | -}); | ||
199 | - | ||
200 | -//关闭资讯 | ||
201 | -$(document).on('click', '.info-close', function () { | ||
202 | - var item = g.rows[$(this).data("index")]; | ||
203 | - | ||
204 | - common.util.__ajax({ | ||
205 | - url: '/guang/article/operation', | ||
206 | - data: { | ||
207 | - id: item.id, | ||
208 | - status: -1 | ||
209 | - } | ||
210 | - }, function (res) { | ||
211 | - if (res.code == 200) { | ||
212 | - common.util.__tip('关闭资讯成功', 'success'); | ||
213 | - g.reload(); | ||
214 | - } else { | ||
215 | - common.util.__tip(res.message); | ||
216 | - } | ||
217 | - }, true); | ||
218 | -}); | ||
219 | - | ||
220 | -//打开资讯 | ||
221 | -$(document).on('click', '.info-open', function () { | ||
222 | - var item = g.rows[$(this).data("index")]; | ||
223 | - | ||
224 | - common.util.__ajax({ | ||
225 | - url: '/guang/article/operation', | ||
226 | - data: { | ||
227 | - id: item.id, | ||
228 | - status: 1 | ||
229 | - } | ||
230 | - }, function (res) { | ||
231 | - | ||
232 | - if (res.code == 200) { | ||
233 | - common.util.__tip('开启资讯成功', 'success'); | ||
234 | - g.reload(); | ||
235 | - } else { | ||
236 | - common.util.__tip(res.message); | ||
237 | - } | ||
238 | - }, true); | ||
239 | -}); | ||
240 | - | ||
241 | -//推荐 | ||
242 | -$(document).on('click', '.info-recommend', function () { | ||
243 | - var item = g.rows[$(this).data("index")]; | ||
244 | - | ||
245 | - common.util.__ajax({ | ||
246 | - url: '/guang/article/operation', | ||
247 | - data: { | ||
248 | - id: item.id, | ||
249 | - isRecommend: 1 | ||
250 | - } | ||
251 | - }, function (res) { | ||
252 | - | ||
253 | - if (res.code == 200) { | ||
254 | - common.util.__tip('成功推荐', 'success'); | ||
255 | - g.reload(); | ||
256 | - } else { | ||
257 | - common.util.__tip(res.message); | ||
258 | - } | ||
259 | - }, true); | ||
260 | -}); | ||
261 | - | ||
262 | -//取消推荐 | ||
263 | -$(document).on('click', '.info-recommend-cancel', function () { | ||
264 | - var item = g.rows[$(this).data("index")]; | ||
265 | - | ||
266 | - common.util.__ajax({ | ||
267 | - url: '/guang/article/operation', | ||
268 | - data: { | ||
269 | - id: item.id, | ||
270 | - isRecommend: 0 | ||
271 | - } | ||
272 | - }, function (res) { | ||
273 | - | ||
274 | - if (res.code == 200) { | ||
275 | - common.util.__tip('成功取消推荐', 'success'); | ||
276 | - g.reload(); | ||
277 | - } else { | ||
278 | - common.util.__tip(res.message); | ||
279 | - } | ||
280 | - }, true); | ||
281 | -}); | ||
282 | - | ||
283 | -//定时 | ||
284 | -$(document).on("click", ".info-time", function () { | ||
285 | - var item = g.rows[$(this).data("index")]; | ||
286 | - var item1= $.extend(true,{},item); | ||
287 | - if(item.publishTime&&item.publishTime!=0){ | ||
288 | - var t = new Date(item.publishTime * 1000); | ||
289 | - item1.publishTime= common.util.__dateFormat(t, "yyyy-MM-dd hh:mm"); | ||
290 | - } | ||
291 | - else{ | ||
292 | - item1.publishTime="yyyy-MM-dd hh:mm" | ||
293 | - } | ||
294 | - var data = function () { | ||
295 | - var dateString = common.util.__input('datepicker'); | ||
296 | - if (dateString === '' || $.trim(dateString) === '') { | ||
297 | - return "请填写时间"; | ||
298 | - } | ||
299 | - return { | ||
300 | - publishTime: dateString, | ||
301 | - id: item.id | ||
302 | - }; | ||
303 | - }; | ||
304 | - Timmer.toast(common.util.__template2($("#template").html(), item1), data); | ||
305 | - $('#datepicker').fdatepicker({ | ||
306 | - format: 'yyyy-mm-dd hh:ii', | ||
307 | - pickTime: true | ||
308 | - }); | ||
309 | -}); | ||
310 | - | ||
311 | -// 删除 | ||
312 | -$(document).on("click", ".info-del", function () { | ||
313 | - var item = g.rows[$(this).data("index")]; | ||
314 | - common.dialog.confirm("温馨提示", "您确定要删除吗?", function () { | ||
315 | - common.util.__ajax({ | ||
316 | - url: '/guang/article/del', | ||
317 | - data: { | ||
318 | - id: item.id | ||
319 | - } | ||
320 | - }, function () { | ||
321 | - g.reload(); | ||
322 | - }); | ||
323 | - }); | ||
324 | -}); | ||
325 | - |
@@ -5,14 +5,23 @@ var $ = require('jquery'), | @@ -5,14 +5,23 @@ var $ = require('jquery'), | ||
5 | base = require('./partials/Base'); | 5 | base = require('./partials/Base'); |
6 | 6 | ||
7 | // 默认系统模板 | 7 | // 默认系统模板 |
8 | -var systemTemplates = | 8 | +var systemTemplates_1 = |
9 | { | 9 | { |
10 | shopId: 0, | 10 | shopId: 0, |
11 | - templateName: '系统默认', | ||
12 | - templateId: 1, | ||
13 | - createTime: '2016-12-14 14:42:00' | 11 | + templateName: '基础模板', |
12 | + templateId: 3, | ||
13 | + createTime: '2016-12-14 14:42:00', | ||
14 | + templateType: '1', | ||
14 | 15 | ||
15 | }; | 16 | }; |
17 | +var systemTemplates_2 = | ||
18 | +{ | ||
19 | + shopId: 0, | ||
20 | + templateName: '经典模板', | ||
21 | + templateId: 1, | ||
22 | + createTime: '2016-12-14 14:42:00', | ||
23 | + templateType: '2', | ||
24 | +}; | ||
16 | 25 | ||
17 | var shopTemplates = []; | 26 | var shopTemplates = []; |
18 | 27 | ||
@@ -43,6 +52,7 @@ var Bll = { | @@ -43,6 +52,7 @@ var Bll = { | ||
43 | $.each(shopTemplates, function(_index, template) { | 52 | $.each(shopTemplates, function(_index, template) { |
44 | if(template.flag && template.flag === 1) { | 53 | if(template.flag && template.flag === 1) { |
45 | index = _index; | 54 | index = _index; |
55 | + Bll.templateType = template.templateType; | ||
46 | return; | 56 | return; |
47 | } | 57 | } |
48 | }); | 58 | }); |
@@ -71,6 +81,14 @@ var Bll = { | @@ -71,6 +81,14 @@ var Bll = { | ||
71 | // 切换模板、执行模块的删除、上下移等动作时,需要重新加载模板装修内容 | 81 | // 切换模板、执行模块的删除、上下移等动作时,需要重新加载模板装修内容 |
72 | // index: 重载模板前,操作的模块在列表中的索引,用于调整滚动条至操作模块的位置 | 82 | // index: 重载模板前,操作的模块在列表中的索引,用于调整滚动条至操作模块的位置 |
73 | reloadMain: function(index) { | 83 | reloadMain: function(index) { |
84 | + var curTemplate = $('.selected-template').parent(); | ||
85 | + var selIndex = $(curTemplate).data('index'); | ||
86 | + $.each(shopTemplates, function(_index, template) { | ||
87 | + if(_index === selIndex) { | ||
88 | + Bll.templateType = template.templateType; | ||
89 | + return; | ||
90 | + } | ||
91 | + }); | ||
74 | if(+t.active) { | 92 | if(+t.active) { |
75 | Bll.renderDecoratorPCTemplate(); | 93 | Bll.renderDecoratorPCTemplate(); |
76 | } else { | 94 | } else { |
@@ -140,7 +158,8 @@ var Bll = { | @@ -140,7 +158,8 @@ var Bll = { | ||
140 | template.createTime = common.util.__dateFormat(new Date(template.createTime * 1000), 'yyyy-MM-dd hh:mm:ss'); | 158 | template.createTime = common.util.__dateFormat(new Date(template.createTime * 1000), 'yyyy-MM-dd hh:mm:ss'); |
141 | } | 159 | } |
142 | }); | 160 | }); |
143 | - shopTemplates.unshift(systemTemplates); | 161 | + shopTemplates.unshift(systemTemplates_2); |
162 | + shopTemplates.unshift(systemTemplates_1); | ||
144 | } | 163 | } |
145 | }, true) | 164 | }, true) |
146 | }, | 165 | }, |
@@ -152,7 +171,11 @@ var Bll = { | @@ -152,7 +171,11 @@ var Bll = { | ||
152 | var index = $(curTemplate).data('index'); | 171 | var index = $(curTemplate).data('index'); |
153 | // index = 0:系统模板,默认数据即可,不查询 | 172 | // index = 0:系统模板,默认数据即可,不查询 |
154 | if(index == 0) { | 173 | if(index == 0) { |
155 | - Bll.moduleDataList = Bll.base.getDefaultModuleData(+t.active ? 0 : 1); | 174 | + Bll.moduleDataList = Bll.base.getDefaultModuleData(+t.active ? 0 : 1, 0); |
175 | + return; | ||
176 | + } | ||
177 | + if(index == 1) { | ||
178 | + Bll.moduleDataList = Bll.base.getDefaultModuleData(+t.active ? 0 : 1, 1); | ||
156 | return; | 179 | return; |
157 | } | 180 | } |
158 | 181 | ||
@@ -187,7 +210,7 @@ var Bll = { | @@ -187,7 +210,7 @@ var Bll = { | ||
187 | }, | 210 | }, |
188 | 211 | ||
189 | renderDecoratorPCTemplate: function() { | 212 | renderDecoratorPCTemplate: function() { |
190 | - $('.decorator-right').html(common.util.__template2($('#pc-template').html(), {data: Bll.moduleDataList})); | 213 | + $('.decorator-right').html(common.util.__template2($('#pc-template').html(), {data: Bll.moduleDataList, templateType: Bll.templateType})); |
191 | new common.dragSort.create(document.getElementById('pc-dragable-975'), { | 214 | new common.dragSort.create(document.getElementById('pc-dragable-975'), { |
192 | animation: 150 | 215 | animation: 150 |
193 | }); | 216 | }); |
@@ -197,7 +220,7 @@ var Bll = { | @@ -197,7 +220,7 @@ var Bll = { | ||
197 | }, | 220 | }, |
198 | 221 | ||
199 | renderDecoratorAppTemplate: function() { | 222 | renderDecoratorAppTemplate: function() { |
200 | - $('.decorator-right').html(common.util.__template2($('#app-template').html(), {data: Bll.moduleDataList})); | 223 | + $('.decorator-right').html(common.util.__template2($('#app-template').html(), {data: Bll.moduleDataList, templateType: Bll.templateType})); |
201 | 224 | ||
202 | new common.dragSort.create(document.getElementById('app-dragable'), { | 225 | new common.dragSort.create(document.getElementById('app-dragable'), { |
203 | animation: 150, | 226 | animation: 150, |
@@ -1526,7 +1549,7 @@ var handleDecoratorTemplate = function() { | @@ -1526,7 +1549,7 @@ var handleDecoratorTemplate = function() { | ||
1526 | } | 1549 | } |
1527 | 1550 | ||
1528 | // 这些模块可能没有模块数据,只是根据标识去渲染。如果检测到没有数据,增加默认数据 | 1551 | // 这些模块可能没有模块数据,只是根据标识去渲染。如果检测到没有数据,增加默认数据 |
1529 | - let noDataModuleArray = ['ProductList', 'ShopNavbar', 'ProductSort']; | 1552 | + let noDataModuleArray = ['ProductList', 'ShopNavbar', 'ProductSort', "ProductListImg"]; |
1530 | 1553 | ||
1531 | $.each(Bll.moduleDataList, function(index, module) { | 1554 | $.each(Bll.moduleDataList, function(index, module) { |
1532 | // 根据模块的排序,重新生成order | 1555 | // 根据模块的排序,重新生成order |
@@ -1597,6 +1620,7 @@ var saveTemplate = function(flag, name, cb) { | @@ -1597,6 +1620,7 @@ var saveTemplate = function(flag, name, cb) { | ||
1597 | platform: +t.active ? 0 : 1, | 1620 | platform: +t.active ? 0 : 1, |
1598 | appType: Bll.appType, | 1621 | appType: Bll.appType, |
1599 | templateName: name, | 1622 | templateName: name, |
1623 | + templateType: Bll.templateType, | ||
1600 | modules: JSON.stringify(Bll.moduleDataList), | 1624 | modules: JSON.stringify(Bll.moduleDataList), |
1601 | flag: flag | 1625 | flag: flag |
1602 | } | 1626 | } |
@@ -111,6 +111,17 @@ base.prototype = { | @@ -111,6 +111,17 @@ base.prototype = { | ||
111 | } | 111 | } |
112 | ], | 112 | ], |
113 | 113 | ||
114 | + defaultModuleDataBase: [ | ||
115 | + { | ||
116 | + dataValid: false, // 系统模板,默认只包含模块信息,并不包含模块内容;新增的模块,也不包含模块内容。默认数据是非法的 | ||
117 | + moduleType: "ShopBanner", | ||
118 | + }, | ||
119 | + { | ||
120 | + dataValid: false, | ||
121 | + moduleType: "ProductListImg", | ||
122 | + } | ||
123 | + ], | ||
124 | + | ||
114 | /** | 125 | /** |
115 | * 根据模块区域获取可添加的模块列表信息 | 126 | * 根据模块区域获取可添加的模块列表信息 |
116 | * styleArea: 模块区域标识,0--APP端,1--PC端160区域,2--PC端975区域 | 127 | * styleArea: 模块区域标识,0--APP端,1--PC端160区域,2--PC端975区域 |
@@ -136,7 +147,11 @@ base.prototype = { | @@ -136,7 +147,11 @@ base.prototype = { | ||
136 | return statusDesc; | 147 | return statusDesc; |
137 | }, | 148 | }, |
138 | 149 | ||
139 | - getDefaultModuleData: function(platform) { | 150 | + getDefaultModuleData: function(platform, index) { |
151 | + if (index == 0) { | ||
152 | + let temp = JSON.stringify(this.defaultModuleDataBase); | ||
153 | + return JSON.parse(temp); | ||
154 | + } else { | ||
140 | if(platform === 0) { | 155 | if(platform === 0) { |
141 | // PC端 | 156 | // PC端 |
142 | let temp = JSON.stringify(this.defaultModuleData); | 157 | let temp = JSON.stringify(this.defaultModuleData); |
@@ -146,6 +161,7 @@ base.prototype = { | @@ -146,6 +161,7 @@ base.prototype = { | ||
146 | return JSON.parse(temp); | 161 | return JSON.parse(temp); |
147 | } | 162 | } |
148 | } | 163 | } |
164 | + } | ||
149 | } | 165 | } |
150 | 166 | ||
151 | module.exports = base; | 167 | module.exports = base; |
-
Please register or login to post a comment