Authored by bevishuang

新增资源位Tab

@@ -57,8 +57,6 @@ export default { @@ -57,8 +57,6 @@ export default {
57 } 57 }
58 }, 58 },
59 data() { 59 data() {
60 - console.log('editor==this.value')  
61 - console.log(this.value)  
62 return { 60 return {
63 value_: this.handleData(util.clone(this.value)) 61 value_: this.handleData(util.clone(this.value))
64 }; 62 };
@@ -96,6 +94,7 @@ export default { @@ -96,6 +94,7 @@ export default {
96 this.$emit('input', this.handleSaveData(this.value_)); 94 this.$emit('input', this.handleSaveData(this.value_));
97 }, 95 },
98 handleData(m) { 96 handleData(m) {
  97 +
99 let keys = Object.keys(m); 98 let keys = Object.keys(m);
100 99
101 keys.sort((a,b) => { 100 keys.sort((a,b) => {
@@ -133,8 +132,6 @@ export default { @@ -133,8 +132,6 @@ export default {
133 } 132 }
134 } 133 }
135 this.addId(a); 134 this.addId(a);
136 - console.log('========')  
137 - console.log(a)  
138 135
139 if (a.url && a.url.action && a.url.action === 'go.ufo') { 136 if (a.url && a.url.action && a.url.action === 'go.ufo') {
140 if (util.getUrlQueryString(a.url.url, 'pagename') === 'productDetail') { 137 if (util.getUrlQueryString(a.url.url, 'pagename') === 'productDetail') {
@@ -151,21 +148,15 @@ export default { @@ -151,21 +148,15 @@ export default {
151 a.url.action = 'go.list'; 148 a.url.action = 'go.list';
152 } 149 }
153 } 150 }
154 - console.log('====a====')  
155 - console.log(a)  
156 result.push(a); 151 result.push(a);
157 } 152 }
158 153
159 return result; 154 return result;
160 }, 155 },
161 handleSaveData(m) { 156 handleSaveData(m) {
162 - console.log('handleSaveData')  
163 - console.log(m)  
164 let temp = util.clone(m); 157 let temp = util.clone(m);
165 158
166 for (const i of Object.keys(temp)) { 159 for (const i of Object.keys(temp)) {
167 - console.log('temp')  
168 - console.log(temp)  
169 if (['go.pool', 'go.detail', 'go.list', 'go.calendar', 'go.hotlist', 'go.identifyList'].includes(temp[i].url.action)) { 160 if (['go.pool', 'go.detail', 'go.list', 'go.calendar', 'go.hotlist', 'go.identifyList'].includes(temp[i].url.action)) {
170 temp[i].url.action = 'go.ufo'; 161 temp[i].url.action = 'go.ufo';
171 } 162 }
@@ -178,7 +169,6 @@ export default { @@ -178,7 +169,6 @@ export default {
178 temp[i].url.islogin = 'Y' 169 temp[i].url.islogin = 'Y'
179 } 170 }
180 if (temp[i].url.action === 'go.channel') { 171 if (temp[i].url.action === 'go.channel') {
181 - console.log('======'+temp[i].url.action)  
182 temp[i].tabName = util.getUrlQueryString(temp[i].url.url, 'tabName') 172 temp[i].tabName = util.getUrlQueryString(temp[i].url.url, 'tabName')
183 temp[i].code = util.getUrlQueryString(temp[i].url.url, 'channelCode') 173 temp[i].code = util.getUrlQueryString(temp[i].url.url, 'channelCode')
184 } else { 174 } else {
@@ -186,8 +176,6 @@ export default { @@ -186,8 +176,6 @@ export default {
186 temp[i].alt = util.getUrlQueryString(temp[i].url.url, 'title') 176 temp[i].alt = util.getUrlQueryString(temp[i].url.url, 'title')
187 } 177 }
188 } 178 }
189 - // console.log('temp')  
190 - // console.log(m)  
191 // array to object 179 // array to object
192 const result = {} 180 const result = {}
193 181
@@ -195,21 +183,15 @@ export default { @@ -195,21 +183,15 @@ export default {
195 result[i] = temp[i]; 183 result[i] = temp[i];
196 } 184 }
197 185
198 -console.log('result')  
199 - console.log(result)  
200 return result; 186 return result;
201 }, 187 },
202 getValue(){ 188 getValue(){
203 - console.log('getValue=>')  
204 - console.log(this.value_)  
205 return this.handleSaveData(this.value_); 189 return this.handleSaveData(this.value_);
206 }, 190 },
207 addId(m) { 191 addId(m) {
208 m.id = this.$bus.genId(); 192 m.id = this.$bus.genId();
209 }, 193 },
210 setValue(newVal) { 194 setValue(newVal) {
211 - console.log('setValue=newVal')  
212 - console.log(newVal)  
213 this.value_ = this.handleData(util.clone(newVal)); 195 this.value_ = this.handleData(util.clone(newVal));
214 }, 196 },
215 reset() { 197 reset() {
@@ -219,8 +201,6 @@ console.log('result') @@ -219,8 +201,6 @@ console.log('result')
219 }, 201 },
220 watch: { 202 watch: {
221 value(newVal) { 203 value(newVal) {
222 - // console.log('watch=newVal')  
223 - // console.log(newVal)  
224 this.value_ = this.handleData(util.clone(newVal)); 204 this.value_ = this.handleData(util.clone(newVal));
225 } 205 }
226 }, 206 },
@@ -35,8 +35,6 @@ @@ -35,8 +35,6 @@
35 props: ['value','type'], 35 props: ['value','type'],
36 36
37 data() { 37 data() {
38 - console.log('params==this.value')  
39 - console.log(this.value)  
40 return { 38 return {
41 url_: this.value.url? this.value.url : '', 39 url_: this.value.url? this.value.url : '',
42 action_: this.value.action ? this.value.action : 'go.h5', 40 action_: this.value.action ? this.value.action : 'go.h5',
@@ -46,15 +44,10 @@ @@ -46,15 +44,10 @@
46 }; 44 };
47 }, 45 },
48 methods: { 46 methods: {
49 - // loggerValue(){  
50 - // console.log('loggerValue===this.type')  
51 - // console.log(this.type)  
52 - // },  
53 - initAction() {  
54 - // console.log('loggerValue===this.value_')  
55 - // console.log(this.type)  
56 - let action = [];  
57 - if(this.type === 'H5'){ 47 + initAction() {
  48 +
  49 + let action = [];
  50 + if(this.type === 'H5'){
58 action = [ 51 action = [
59 { 52 {
60 value: 'go.h5', 53 value: 'go.h5',
@@ -76,8 +69,8 @@ @@ -76,8 +69,8 @@
76 value: 'go.channel', 69 value: 'go.channel',
77 label: '首页频道Tab', 70 label: '首页频道Tab',
78 }, 71 },
79 - ]  
80 - }else { 72 + ]
  73 + }else {
81 action = [ 74 action = [
82 { 75 {
83 value: 'go.h5', 76 value: 'go.h5',
@@ -120,7 +113,6 @@ @@ -120,7 +113,6 @@
120 return action; 113 return action;
121 }, 114 },
122 updateStatus() { 115 updateStatus() {
123 - console.log('updateStatus');  
124 const data = {url: this.url_, action: this.action_}; 116 const data = {url: this.url_, action: this.action_};
125 117
126 if (this.islogin) { 118 if (this.islogin) {
@@ -136,13 +128,9 @@ @@ -136,13 +128,9 @@
136 }, 128 },
137 watch: { 129 watch: {
138 url_(newVal) { 130 url_(newVal) {
139 - // console.log('url_');  
140 - // console.log(newVal);  
141 this.updateStatus(); 131 this.updateStatus();
142 }, 132 },
143 action_(newVal) { 133 action_(newVal) {
144 - console.log('action_');  
145 - console.log(newVal);  
146 if (newVal === 'go.detail') { 134 if (newVal === 'go.detail') {
147 this.url_ = 'https://m.yohobuy.com/?pagename=productDetail'; 135 this.url_ = 'https://m.yohobuy.com/?pagename=productDetail';
148 } else if (newVal === 'go.pool') { 136 } else if (newVal === 'go.pool') {
@@ -330,7 +330,6 @@ @@ -330,7 +330,6 @@
330 }, 330 },
331 methods: { 331 methods: {
332 getResourceDetailList() { 332 getResourceDetailList() {
333 - console.log('this.resId:'+this.resId)  
334 this.resourceService.info(this.resId).then(result => { 333 this.resourceService.info(this.resId).then(result => {
335 this.list = result; 334 this.list = result;
336 this.manageAllData(result); 335 this.manageAllData(result);
@@ -338,8 +337,6 @@ @@ -338,8 +337,6 @@
338 }); 337 });
339 }, 338 },
340 manageAllData(data) { 339 manageAllData(data) {
341 - console.log('manageAllData')  
342 - console.log(data)  
343 this.uploadData.items = []; 340 this.uploadData.items = [];
344 for (let i = 0; i < data.length; i++) { 341 for (let i = 0; i < data.length; i++) {
345 let item = { 342 let item = {
@@ -353,21 +350,15 @@ @@ -353,21 +350,15 @@
353 } 350 }
354 }, 351 },
355 manageFloorList(data) { 352 manageFloorList(data) {
356 - console.log('manageFloorList')  
357 this.floorList = []; 353 this.floorList = [];
358 - console.log(data);  
359 for (let i = 0; i < data.length; i++) { 354 for (let i = 0; i < data.length; i++) {
360 let item = JSON.parse(data[i].data); 355 let item = JSON.parse(data[i].data);
361 - // console.log(item)  
362 item.resContentId = data[i].resContentId; 356 item.resContentId = data[i].resContentId;
363 item.type = data[i].type; 357 item.type = data[i].type;
364 this.floorList.push(item); 358 this.floorList.push(item);
365 - console.log(this.floorList);  
366 } 359 }
367 }, 360 },
368 showModal(type, data, index) { 361 showModal(type, data, index) {
369 -  
370 - console.log(data, index);  
371 let modalType = 0; 362 let modalType = 0;
372 let modalTitle = ''; 363 let modalTitle = '';
373 let hideAddButton = true; 364 let hideAddButton = true;
@@ -377,14 +368,9 @@ @@ -377,14 +368,9 @@
377 forData = data.data; 368 forData = data.data;
378 } 369 }
379 for (let i in forData) { 370 for (let i in forData) {
380 - let itemData = forData[i];  
381 - console.log('itemData')  
382 - console.log(itemData)  
383 - this.modalData.push(itemData);  
384 - }  
385 -  
386 -  
387 - console.log('modalData:', this.modalData); 371 + let itemData = forData[i];
  372 + this.modalData.push(itemData);
  373 + }
388 374
389 switch (type) { 375 switch (type) {
390 case 'singleImage': 376 case 'singleImage':
@@ -433,7 +419,6 @@ @@ -433,7 +419,6 @@
433 this.show = true; 419 this.show = true;
434 420
435 } 421 }
436 - // console.log('ModalInfo:', this.modalInfo);  
437 }, 422 },
438 showDeleteModal(index) { // 确认删除对话框 423 showDeleteModal(index) { // 确认删除对话框
439 this.$Modal.confirm({ 424 this.$Modal.confirm({
@@ -456,7 +441,6 @@ @@ -456,7 +441,6 @@
456 template_name: '' 441 template_name: ''
457 }; 442 };
458 } else { 443 } else {
459 - // console.log(res);  
460 this.$Message.error(res.message || '修改失败!'); 444 this.$Message.error(res.message || '修改失败!');
461 } 445 }
462 }); 446 });
@@ -465,9 +449,9 @@ @@ -465,9 +449,9 @@
465 }, 449 },
466 onOk() { // 对话框点击确认时,保存数据 450 onOk() { // 对话框点击确认时,保存数据
467 let modalValue = this.$refs.addEditor.getValue(); 451 let modalValue = this.$refs.addEditor.getValue();
468 - console.log('modalValue')  
469 - console.log(modalValue) 452 + let size = 0;
470 for(let key in modalValue) { // 提交空数据的判断 453 for(let key in modalValue) { // 提交空数据的判断
  454 + size ++ ;
471 if (modalValue[key].url.url === '') { 455 if (modalValue[key].url.url === '') {
472 this.modalData = []; 456 this.modalData = [];
473 this.$Message.error('请填写所有信息后再提交!'); 457 this.$Message.error('请填写所有信息后再提交!');
@@ -481,16 +465,18 @@ @@ -481,16 +465,18 @@
481 list: modalValue, 465 list: modalValue,
482 }; 466 };
483 } 467 }
484 - console.log('dataResult')  
485 - console.log(dataResult) 468 +
  469 + let name = this.modalInfo.template_name;
  470 + let intro =this.modalInfo.template_intro;
486 let data = { 471 let data = {
487 id: this.modalInfo.resContentId, 472 id: this.modalInfo.resContentId,
488 contentName: '楼层' + (this.floorList.length + 1), 473 contentName: '楼层' + (this.floorList.length + 1),
489 templateKey: '123', 474 templateKey: '123',
490 contentData: JSON.stringify({ 475 contentData: JSON.stringify({
491 - template_name: this.modalInfo.template_name,  
492 - template_intro: this.modalInfo.template_intro,  
493 - data: dataResult 476 + template_name: name,
  477 + template_intro: intro,
  478 + data: dataResult,
  479 + size: size,
494 }), 480 }),
495 type: this.modalInfo.modalType 481 type: this.modalInfo.modalType
496 }; 482 };
@@ -501,9 +487,7 @@ @@ -501,9 +487,7 @@
501 this.uploadData.items[this.modalInfo.floorIndex] = data; 487 this.uploadData.items[this.modalInfo.floorIndex] = data;
502 } 488 }
503 489
504 - console.log('uploadData:', this.uploadData);  
505 this.resourceService.addOrUpdateResourceDetail(this.uploadData).then(res => { 490 this.resourceService.addOrUpdateResourceDetail(this.uploadData).then(res => {
506 - // console.log(res);  
507 if (res && res.code === 200) { 491 if (res && res.code === 200) {
508 this.$Message.success(res.message || '修改成功!'); 492 this.$Message.success(res.message || '修改成功!');
509 this.getResourceDetailList(); 493 this.getResourceDetailList();
@@ -518,7 +502,6 @@ @@ -518,7 +502,6 @@
518 }; 502 };
519 this.show = false; 503 this.show = false;
520 } else { 504 } else {
521 - // console.log(res);  
522 this.$Message.error(res.message || '修改失败!'); 505 this.$Message.error(res.message || '修改失败!');
523 } 506 }
524 }); 507 });