Authored by 陶雨

资源位内容删除4.3注释内容

@@ -9,7 +9,6 @@ var addObj = require('./partials/addObj'); @@ -9,7 +9,6 @@ var addObj = require('./partials/addObj');
9 var resources = []; 9 var resources = [];
10 var times = []; 10 var times = [];
11 var currIndex = 0; 11 var currIndex = 0;
12 -//var ViewModel = {};  
13 //资源id 12 //资源id
14 var param = location.href.substring(location.href.lastIndexOf("/") + 1); 13 var param = location.href.substring(location.href.lastIndexOf("/") + 1);
15 common.util.__ajax({ 14 common.util.__ajax({
@@ -18,7 +17,6 @@ common.util.__ajax({ @@ -18,7 +17,6 @@ common.util.__ajax({
18 async: false 17 async: false
19 }, function (res) { 18 }, function (res) {
20 resources = res.data; 19 resources = res.data;
21 - //ViewModel = res.data;  
22 console.log(resources); 20 console.log(resources);
23 }, true); 21 }, true);
24 22
@@ -43,8 +41,7 @@ var Bll = { @@ -43,8 +41,7 @@ var Bll = {
43 //console.log("打开的数据module",module); 41 //console.log("打开的数据module",module);
44 var d = new common.dialog({ 42 var d = new common.dialog({
45 title: (!!~index ? "修改" : "添加") + btn[0].button_name, 43 title: (!!~index ? "修改" : "添加") + btn[0].button_name,
46 - content: common.util.__template2($("#" + module.contentData.dialog).html(), module),  
47 - //content: common.util.__template2($("#" + btn[0].dialog).html(), module), 44 + content: common.util.__template2($("#" + btn[0].dialog).html(), module),
48 width: '50%', 45 width: '50%',
49 button: [{ 46 button: [{
50 value: "保存", 47 value: "保存",
@@ -62,8 +59,6 @@ var Bll = { @@ -62,8 +59,6 @@ var Bll = {
62 } 59 }
63 !!~index ? Bll.contentDatas[currIndex][index] = module : Bll.contentDatas[currIndex].push(module); 60 !!~index ? Bll.contentDatas[currIndex][index] = module : Bll.contentDatas[currIndex].push(module);
64 Bll.__render("#add-content", "template_content", {modules: Bll.contentDatas[currIndex]}); 61 Bll.__render("#add-content", "template_content", {modules: Bll.contentDatas[currIndex]});
65 - //!!~index ? Bll.contentDatas[index] = module : Bll.contentDatas.push(module);  
66 - //Bll.__render("#add-content", "template_content", {modules: Bll.contentDatas});  
67 d.close(); 62 d.close();
68 } 63 }
69 return false; 64 return false;
@@ -189,7 +184,6 @@ for(var i = 0; i < resources.length; i++) { @@ -189,7 +184,6 @@ for(var i = 0; i < resources.length; i++) {
189 184
190 /*第一步,基础模板*/ 185 /*第一步,基础模板*/
191 Bll.__render("#content-list", "content-template", resources[currIndex]); 186 Bll.__render("#content-list", "content-template", resources[currIndex]);
192 -//Bll.__render("#content-list", "content-template", ViewModel);  
193 Bll.__render(".contents", "template_content_btns", {btns: Button}); 187 Bll.__render(".contents", "template_content_btns", {btns: Button});
194 Bll.__render("#times-list", "times-template", {times:times, selected:0}); 188 Bll.__render("#times-list", "times-template", {times:times, selected:0});
195 189
@@ -217,30 +211,9 @@ for(var i = 0; i < resources.length; i++) { @@ -217,30 +211,9 @@ for(var i = 0; i < resources.length; i++) {
217 Bll.contentDatas[i].push(item); 211 Bll.contentDatas[i].push(item);
218 }); 212 });
219 } 213 }
220 -//ViewModel.contentData.forEach(function (item, index) {  
221 -// item.contentData = JSON.parse(item.contentData);  
222 -// var temp;  
223 -// if (item.contentData.template_name == "kidsBrands") {  
224 -// temp = item.contentData.data.params.more_url;  
225 -// item.contentData.data.params.more_url = {};  
226 -// item.contentData.data.params.more_url.action = JSON.parse(temp).action || "";  
227 -// item.contentData.data.params.more_url.url = JSON.parse(temp).url || "";  
228 -// }  
229 -// if (item.contentData.template_name == 'title') {  
230 -// temp = item.contentData.data.more_link;  
231 -// item.contentData.data.more_link = {};  
232 -// item.contentData.data.more_link.action = JSON.parse(temp).action || "";  
233 -// item.contentData.data.more_link.url = JSON.parse(temp).url || "";  
234 -// }  
235 -// item.contentData = JSON.stringify(item.contentData);  
236 -// item.contentData = item.contentData.replace(/(gif|png|jpg|jpeg)\?[^"]*/g, '$1');  
237 -// item.contentData = common.util.__ObjToArray(JSON.parse(item.contentData));  
238 -// Bll.contentDatas.push(item);  
239 -//});  
240 214
241 /*第三部解析楼层*/ 215 /*第三部解析楼层*/
242 Bll.__render("#add-content", "template_content", {modules: Bll.contentDatas[currIndex]}); 216 Bll.__render("#add-content", "template_content", {modules: Bll.contentDatas[currIndex]});
243 -//Bll.__render("#add-content", "template_content", {modules: Bll.contentDatas});  
244 217
245 /*第四部 操作按钮 添加 删除 修改*/ 218 /*第四部 操作按钮 添加 删除 修改*/
246 $(document).on("click", ".add_btn", function () { 219 $(document).on("click", ".add_btn", function () {
@@ -269,6 +242,7 @@ $(document).on("change", ".observe", function () { @@ -269,6 +242,7 @@ $(document).on("change", ".observe", function () {
269 /*删除*/ 242 /*删除*/
270 $(document).on("click", ".del", function () {//删除 243 $(document).on("click", ".del", function () {//删除
271 var index = $(this).data("index"); 244 var index = $(this).data("index");
  245 + console.log(Bll.contentDatas[currIndex][index]);
272 common.dialog.confirm("警告", 246 common.dialog.confirm("警告",
273 common.util.__template2("是否确认删除?", {}), 247 common.util.__template2("是否确认删除?", {}),
274 function () { 248 function () {
@@ -283,30 +257,12 @@ $(document).on("click", ".del", function () {//删除 @@ -283,30 +257,12 @@ $(document).on("click", ".del", function () {//删除
283 }); 257 });
284 }); 258 });
285 259
286 -$(document).on("click", ".del", function () {//删除  
287 - var index = $(this).data("index");  
288 - common.dialog.confirm("警告",  
289 - common.util.__template2("是否确认删除?", {}),  
290 - function () {  
291 - if (Bll.contentDatas[index].id) {  
292 - common.util.__ajax({  
293 - url: "/resources/delResContent",  
294 - data: {id: Bll.contentDatas[index].id}  
295 - });  
296 - }  
297 - Bll.contentDatas.splice(index, 1);  
298 - Bll.__render("#add-content", "template_content", {modules: Bll.contentDatas});  
299 - });  
300 -  
301 - //$("#index_" + index).remove();  
302 -});  
303 -  
304 /*编辑*/ 260 /*编辑*/
305 $(document).on("click", ".edit", function () { 261 $(document).on("click", ".edit", function () {
306 var index = $(this).data("index"); 262 var index = $(this).data("index");
307 var item = Bll.contentDatas[currIndex][index]; 263 var item = Bll.contentDatas[currIndex][index];
308 - //var item = Bll.contentDatas[index];  
309 Bll.module = $.extend(true, {}, item); 264 Bll.module = $.extend(true, {}, item);
  265 + console.log(Bll.module);
310 Bll.toast(index, Bll.module); 266 Bll.toast(index, Bll.module);
311 }); 267 });
312 268
@@ -425,9 +381,7 @@ $(document).on("click", "#copyTab", function() { @@ -425,9 +381,7 @@ $(document).on("click", "#copyTab", function() {
425 url: "/resources/copyResContent", 381 url: "/resources/copyResContent",
426 data: {rId:resources[currIndex].resource.id} 382 data: {rId:resources[currIndex].resource.id}
427 }, function (res) { 383 }, function (res) {
428 - //setTimeout(function() {  
429 window.location.href = window.location.href; 384 window.location.href = window.location.href;
430 - //}, 2000);  
431 }); 385 });
432 }); 386 });
433 //保存时间 387 //保存时间
@@ -447,9 +401,7 @@ $(document).on("click", "#saveTime", function() { @@ -447,9 +401,7 @@ $(document).on("click", "#saveTime", function() {
447 time:times[currIndex].time 401 time:times[currIndex].time
448 } 402 }
449 }, function (res) { 403 }, function (res) {
450 - //setTimeout(function() {  
451 window.location.href = window.location.href; 404 window.location.href = window.location.href;
452 - //}, 2000);  
453 }); 405 });
454 }); 406 });
455 new common.edit2("#times-list").init(); 407 new common.edit2("#times-list").init();
@@ -483,9 +435,7 @@ $(document).on("click", "#delTab", function() { @@ -483,9 +435,7 @@ $(document).on("click", "#delTab", function() {
483 id: resources[currIndex].resource.id 435 id: resources[currIndex].resource.id
484 } 436 }
485 }, function (res) { 437 }, function (res) {
486 - //setTimeout(function() {  
487 window.location.href = window.location.href; 438 window.location.href = window.location.href;
488 - //}, 2000);  
489 439
490 }); 440 });
491 }); 441 });
@@ -500,8 +450,6 @@ $(document).on("click", "#sub_btn", function () { @@ -500,8 +450,6 @@ $(document).on("click", "#sub_btn", function () {
500 }; 450 };
501 for (var i = 0; i < Bll.contentDatas[currIndex].length; i++) { 451 for (var i = 0; i < Bll.contentDatas[currIndex].length; i++) {
502 var contentData = Bll.contentDatas[currIndex][i].contentData; 452 var contentData = Bll.contentDatas[currIndex][i].contentData;
503 - //for (var i = 0; i < Bll.contentDatas.length; i++) {  
504 - // var contentData = Bll.contentDatas[i].contentData;  
505 var action; 453 var action;
506 var url; 454 var url;
507 var goodsSrc = "imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90"; 455 var goodsSrc = "imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90";
@@ -547,13 +495,9 @@ $(document).on("click", "#sub_btn", function () { @@ -547,13 +495,9 @@ $(document).on("click", "#sub_btn", function () {
547 data.content[i] = JSON.stringify(common.util.__ArrayToObj(Bll.contentDatas[currIndex][i].contentData)); 495 data.content[i] = JSON.stringify(common.util.__ArrayToObj(Bll.contentDatas[currIndex][i].contentData));
548 if (Bll.contentDatas[currIndex][i].id) { 496 if (Bll.contentDatas[currIndex][i].id) {
549 data.data_id[i] = "id_" + Bll.contentDatas[currIndex][i].id; 497 data.data_id[i] = "id_" + Bll.contentDatas[currIndex][i].id;
550 - //data.content[i] = JSON.stringify(common.util.__ArrayToObj(Bll.contentDatas[i].contentData));  
551 - //if (Bll.contentDatas[i].id) {  
552 - // data.data_id[i] = "id_" + Bll.contentDatas[i].id;  
553 } 498 }
554 } 499 }
555 data.rId = resources[currIndex].resource.id; 500 data.rId = resources[currIndex].resource.id;
556 - //data.rId = param;  
557 data.content = JSON.stringify(data.content); 501 data.content = JSON.stringify(data.content);
558 data.data_id = JSON.stringify(data.data_id); 502 data.data_id = JSON.stringify(data.data_id);
559 common.util.__ajax({ 503 common.util.__ajax({
@@ -744,13 +688,7 @@ $(document).on("mouseover", "#add-content .dragItem", function () { @@ -744,13 +688,7 @@ $(document).on("mouseover", "#add-content .dragItem", function () {
744 }) 688 })
745 drag.Initialize(); 689 drag.Initialize();
746 }); 690 });
747 -//$(document).on("mouseover", "#add-content .dragItem", function () {  
748 -// var drag = new common.drag("#add-content", Bll.contentDatas, function (data) {  
749 -// Bll.contentDatas = data;  
750 -// Bll.__render("#add-content", "template_content", {modules: Bll.contentDatas});  
751 -// })  
752 -// drag.Initialize();  
753 -//}); 691 +
754 $(document).on("mouseleave", "#add-content .dragItem", function () { 692 $(document).on("mouseleave", "#add-content .dragItem", function () {
755 new common.drag("#add-content").destroy(); 693 new common.drag("#add-content").destroy();
756 }); 694 });
@@ -460,4 +460,36 @@ li.sortable-placeholder { @@ -460,4 +460,36 @@ li.sortable-placeholder {
460 .matchImage img{ 460 .matchImage img{
461 width: 100%; 461 width: 100%;
462 height: 100%; 462 height: 100%;
  463 +}
  464 +
  465 +
  466 +#resourcePre li{
  467 + line-height: 40px;
  468 + height: 62px;
  469 + width: 150px;
  470 + border-bottom: 2px solid #0b97c4;
  471 + float: left;
  472 + padding: 0;
  473 + margin: 0;
  474 + text-align:center;
  475 + white-space:nowrap;
  476 +}
  477 +
  478 +#resourcePre li.active{
  479 + border: 2px solid #0b97c4;
  480 + border-bottom: 0;
  481 + font-weight: bold;
  482 +}
  483 +
  484 +#resourcePre li input{
  485 + border: 1px;
  486 + height: 30px;
  487 + line-height: 30px;
  488 + background: none;
  489 + margin: 5px 0;
  490 +}
  491 +
  492 +.input-form{
  493 + display:inline-block;
  494 + width: 200px;
463 } 495 }