Authored by liuyue

页面崩溃bug fix

@@ -116,9 +116,11 @@ $(document).on("click", "#saveAllInfo", function() { @@ -116,9 +116,11 @@ $(document).on("click", "#saveAllInfo", function() {
116 $.extend(data, value, true); 116 $.extend(data, value, true);
117 }); 117 });
118 118
119 - e.submit('/goods/product/saveNetSaleAllInfo', function(option) {  
120 - option.data = data;  
121 - option.success = function(res) { 119 + if (typeof data != 'string') {
  120 + common.util.__ajax({
  121 + url: '/goods/product/saveNetSaleAllInfo',
  122 + data: data
  123 + }, function(res) {
122 res = res.data; 124 res = res.data;
123 if (res.code == '200') { 125 if (res.code == '200') {
124 e.$tip(res.message, function() { 126 e.$tip(res.message, function() {
@@ -128,8 +130,9 @@ $(document).on("click", "#saveAllInfo", function() { @@ -128,8 +130,9 @@ $(document).on("click", "#saveAllInfo", function() {
128 e.$tip(res.message); 130 e.$tip(res.message);
129 } 131 }
130 return false; 132 return false;
131 - }  
132 - }); 133 + });
  134 + }
  135 +
133 }) 136 })
134 137
135 138
@@ -174,20 +174,10 @@ $('#saveBasicInfo').on('click', function() { @@ -174,20 +174,10 @@ $('#saveBasicInfo').on('click', function() {
174 }); 174 });
175 175
176 GOLABDATA.on("LYbasicInfo", function() { 176 GOLABDATA.on("LYbasicInfo", function() {
177 - /*return e.submit('', function(option) {  
178 - var list = option.data.sellChannels.split('|').join(','); 177 + return e.submit('', function(option) {
179 option.data.productSkn = $('#productSkn').val(); 178 option.data.productSkn = $('#productSkn').val();
180 - option.data.sellChannels = list;  
181 - option.data.shopIds = $('#shopIds').val() ? $('#shopIds').val().split('|').join(',') : ''; 179 + option.data.sellChannels = option.data.sellChannels.split('|').join(',');
  180 + option.data.shopIds = option.data.shopIds.split('|').join(',');
182 option.debug = true; 181 option.debug = true;
183 - });*/  
184 - var data = {};  
185 - data.productSkn = $('#productSkn').val();  
186 - $('#basicInfoWrap').find('input').each(function() {  
187 - var key = $(this).attr('id');  
188 - if (key) {  
189 - data[key] = $(this).val().split('|').join(',');  
190 - }  
191 }); 182 });
192 - return data;  
193 }); 183 });
1 -var $ = require('jquery'),  
2 - common = require('../../common/common');  
3 -  
4 -  
5 -var e = new common.edit('#brandWrap'),  
6 - brandSelectArr = [];  
7 -  
8 -common.util.__ajax({  
9 - url: '/goods/brands/queryBrandsByStatus'  
10 -}, function(res) {  
11 - var data = res.data,  
12 - map = {},  
13 - firstName = '';  
14 -  
15 - $.each(data, function(i, item) {  
16 - firstName = item.brandAlif.toUpperCase();  
17 - if (/^[a-zA-Z]$/.test(firstName)) {  
18 - if (!map.hasOwnProperty(firstName)) {  
19 - map[firstName] = [];  
20 - }  
21 - map[firstName].push(item);  
22 - } else {  
23 - if (!map.hasOwnProperty('0-9')) {  
24 - map['0-9'] = [];  
25 - }  
26 - map['0-9'].push(item);  
27 - }  
28 - });  
29 -  
30 - var brandHtml = common.util.__template2($('#brandTemp').html(), {  
31 - map: map  
32 - });  
33 - // var docFrag = new DocumentFragment();  
34 - // docFrag.firstChild.nodeValue = brandHtml;  
35 - $('#brand-list').html(brandHtml);  
36 -  
37 - if (NETSALEDATA.brandRelationList) {  
38 - $('.selected-brand').html(common.util.__template2($('#brandShowTemp').html(), {  
39 - brandRelationList: NETSALEDATA.brandRelationList,  
40 - brandRelation: brandSelectArr.join('|')  
41 - }));  
42 - };  
43 - e.init();  
44 - if ($('.contentpanel').data('type') == 'info') {  
45 - $('.brand-list').find('input').attr('disabled', true);  
46 - }  
47 -  
48 -}, true);  
49 -  
50 -$.each(NETSALEDATA.brandRelationList, function(index, value) {  
51 - brandSelectArr.push(value.brandId);  
52 -});  
53 -  
54 -$('#brandWrap').on('change', 'input[name="brandRelationList"]', function() {  
55 - var $val = parseInt($(this).val()),  
56 - position = brandSelectArr.indexOf($val);  
57 -  
58 - if (position == -1) {  
59 - brandSelectArr.push($val);  
60 - $('<div class="col-sm-2" data-id="' + $val + '">' + $(this).data('name') + '</div>').appendTo($('.selected-brand'));  
61 - } else {  
62 - brandSelectArr.splice(position, 1);  
63 - $('div[data-id="' + $val + '"]').remove();  
64 - };  
65 -  
66 -});  
67 -  
68 -$('#saveBrandRelation').on('click', function() {  
69 - e.submit('/goods/product/saveBrandRelation', function(option) {  
70 - option.data = GOLABDATA.fire("LYbrandRelation");  
71 - option.success = function(res) {  
72 - res = res.data;  
73 - if (res.code == '200') {  
74 - e.$tip(res.message, function() {}, 'growl-success');  
75 - } else {  
76 - e.$tip(res.message);  
77 - }  
78 - return false;  
79 - }  
80 - });  
81 -});  
82 -  
83 -GOLABDATA.on("LYbrandRelation", function() {  
84 - return {  
85 - productSkn: $('#productSkn').val(),  
86 - brandRelationList: JSON.stringify($('#brandRelationList').val().split('|'))  
87 - }  
88 -  
89 - /*return e.submit('', function(option) {  
90 - option.data.productSkn = $('#productSkn').val();  
91 - option.data.brandRelationList = JSON.stringify(option.data.brandRelationList.split('|'));  
92 - option.debug = true;  
93 - });*/ 1 +var $ = require('jquery'),
  2 + common = require('../../common/common');
  3 +
  4 +
  5 +var e = new common.edit('#brandWrap'),
  6 + brandSelectArr = [];
  7 +
  8 +common.util.__ajax({
  9 + url: '/goods/brands/queryBrandsByStatus'
  10 +}, function(res) {
  11 + var data = res.data,
  12 + map = {},
  13 + firstName = '';
  14 +
  15 + $.each(data, function(i, item) {
  16 + firstName = item.brandAlif.toUpperCase();
  17 + if (/^[a-zA-Z]$/.test(firstName)) {
  18 + if (!map.hasOwnProperty(firstName)) {
  19 + map[firstName] = [];
  20 + }
  21 + map[firstName].push(item);
  22 + } else {
  23 + if (!map.hasOwnProperty('0-9')) {
  24 + map['0-9'] = [];
  25 + }
  26 + map['0-9'].push(item);
  27 + }
  28 + });
  29 +
  30 + var brandHtml = common.util.__template2($('#brandTemp').html(), {
  31 + map: map
  32 + });
  33 + // var docFrag = new DocumentFragment();
  34 + // docFrag.firstChild.nodeValue = brandHtml;
  35 + $('#brand-list').html(brandHtml);
  36 +
  37 + if (NETSALEDATA.brandRelationList) {
  38 + $('.selected-brand').html(common.util.__template2($('#brandShowTemp').html(), {
  39 + brandRelationList: NETSALEDATA.brandRelationList,
  40 + brandRelation: brandSelectArr.join('|')
  41 + }));
  42 + };
  43 + e.init();
  44 + if ($('.contentpanel').data('type') == 'info') {
  45 + $('.brand-list').find('input').attr('disabled', true);
  46 + }
  47 +
  48 +}, true);
  49 +
  50 +$.each(NETSALEDATA.brandRelationList, function(index, value) {
  51 + brandSelectArr.push(value.brandId);
  52 +});
  53 +
  54 +$('#brandWrap').on('change', 'input[name="brandRelationList"]', function() {
  55 + var $val = parseInt($(this).val()),
  56 + position = brandSelectArr.indexOf($val);
  57 +
  58 + if (position == -1) {
  59 + brandSelectArr.push($val);
  60 + $('<div class="col-sm-2" data-id="' + $val + '">' + $(this).data('name') + '</div>').appendTo($('.selected-brand'));
  61 + } else {
  62 + brandSelectArr.splice(position, 1);
  63 + $('div[data-id="' + $val + '"]').remove();
  64 + };
  65 +
  66 +});
  67 +
  68 +$('#saveBrandRelation').on('click', function() {
  69 + e.submit('/goods/product/saveBrandRelation', function(option) {
  70 + option.data = GOLABDATA.fire("LYbrandRelation");
  71 + option.success = function(res) {
  72 + res = res.data;
  73 + if (res.code == '200') {
  74 + e.$tip(res.message, function() {}, 'growl-success');
  75 + } else {
  76 + e.$tip(res.message);
  77 + }
  78 + return false;
  79 + }
  80 + });
  81 +});
  82 +
  83 +GOLABDATA.on("LYbrandRelation", function() {
  84 + return {
  85 + productSkn: $('#productSkn').val(),
  86 + brandRelationList: JSON.stringify($('#brandRelationList').val().split('|'))
  87 + }
  88 +
  89 + /*return e.submit('', function(option) {
  90 + option.data.productSkn = $('#productSkn').val();
  91 + option.data.brandRelationList = JSON.stringify(option.data.brandRelationList.split('|'));
  92 + option.debug = true;
  93 + });*/
94 }); 94 });
@@ -54,8 +54,8 @@ $(document).on("click", "#btn-recommand", function() { @@ -54,8 +54,8 @@ $(document).on("click", "#btn-recommand", function() {
54 return false; 54 return false;
55 }); 55 });
56 56
57 -GOLABDATA.on("bianjiqi", function() {  
58 - /*if (UMdescriptioner.getContent() != '') { 57 +/*GOLABDATA.on("bianjiqi", function() {
  58 + if (UMdescriptioner.getContent() != '') {
59 return { 59 return {
60 recommend: UMrecommender.getContent(), 60 recommend: UMrecommender.getContent(),
61 productDesc: UMdescriptioner.getContent() 61 productDesc: UMdescriptioner.getContent()
@@ -64,14 +64,27 @@ GOLABDATA.on("bianjiqi", function() { @@ -64,14 +64,27 @@ GOLABDATA.on("bianjiqi", function() {
64 common.util.__tip('商品描述不可为空', 'warning'); 64 common.util.__tip('商品描述不可为空', 'warning');
65 return; 65 return;
66 } 66 }
67 -*/  
68 67
69 - $('#productDesc').val(UMdescriptioner.getContent());  
70 - return {  
71 - recommend: UMrecommender.getContent(),  
72 - productDesc: $('#productDesc').val()  
73 - } 68 +});*/
  69 +
  70 +GOLABDATA.on("LYrecommend", function() {
  71 + var recommendEdit = new common.edit('#recommenderWrap');
  72 + $('#recommend').val(UMrecommender.getContent());
  73 + return recommendEdit.submit('', function(option) {
  74 + option.productSkn = productSkn;
  75 + option.recommend = $('#recommend').val();
  76 + option.debug = true;
  77 + });
  78 +});
74 79
  80 +GOLABDATA.on("LYproductDesc", function() {
  81 + var descriptionEdit = new common.edit('#descriptionerWrap');
  82 + $('#productDesc').val(UMdescriptioner.getContent());
  83 + return descriptionEdit.submit('', function(option) {
  84 + option.productSkn = productSkn;
  85 + option.productDesc = $('#productDesc').val();
  86 + option.debug = true;
  87 + });
75 }); 88 });
76 89
77 if (editType == 'info') { 90 if (editType == 'info') {
@@ -17,7 +17,7 @@ var config = { @@ -17,7 +17,7 @@ var config = {
17 // domain:'http://172.16.6.240:8088/platform',// 王书生 17 // domain:'http://172.16.6.240:8088/platform',// 王书生
18 // domain: 'http://172.16.6.124:8088/platform',//陈超 18 // domain: 'http://172.16.6.124:8088/platform',//陈超
19 //http://172.16.6.124:8088/platform/product/queryAllProductAttr 19 //http://172.16.6.124:8088/platform/product/queryAllProductAttr
20 - //domain: 'http://172.16.6.227:8088/platform', //玛丽 20 + // domain: 'http://172.16.6.227:8088/platform', //玛丽
21 // domain: 'http://192.168.102.202:8088/platform', 21 // domain: 'http://192.168.102.202:8088/platform',
22 //domain:'http://172.16.9.8:8080/yohobuy-platform-web',//葛超 22 //domain:'http://172.16.9.8:8080/yohobuy-platform-web',//葛超
23 domain: 'http://192.168.102.202:8088/platform', 23 domain: 'http://192.168.102.202:8088/platform',
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 </div> 9 </div>
10 <div class="panel-body nopadding"> 10 <div class="panel-body nopadding">
11 <script id="edit-recommender" type="text/plain" style="width:100%;height:500px;"></script> 11 <script id="edit-recommender" type="text/plain" style="width:100%;height:500px;"></script>
  12 + <input id="recommend" type="hidden">
12 <p> 13 <p>
13 <span class="red">提示:与商品相关的逛信息自动抓取到下列各模块中,若要在商品详情中展示,请将其编辑在【小编推荐】中。 14 <span class="red">提示:与商品相关的逛信息自动抓取到下列各模块中,若要在商品详情中展示,请将其编辑在【小编推荐】中。
14 </span> 15 </span>
@@ -8,7 +8,8 @@ @@ -8,7 +8,8 @@
8 <h2 class="panel-title">商品描述</h2> 8 <h2 class="panel-title">商品描述</h2>
9 </div> 9 </div>
10 <div class="panel-body nopadding"> 10 <div class="panel-body nopadding">
11 - <script id="edit-descriptioner" type="text/plain" style="width:100%;height:500px;"></script> 11 + <script id="edit-descriptioner" type="text/plain" style="width:100%;height:500px;"></script>
  12 + <input id="productDesc" type="hidden" required>
12 </div> 13 </div>
13 <div class="panel-footer"> 14 <div class="panel-footer">
14 <input type="hidden" id="productDesc" required placeholder="商品描述"> 15 <input type="hidden" id="productDesc" required placeholder="商品描述">