Authored by 李奇

资源位上报组件修改

@@ -15,7 +15,7 @@ export default { @@ -15,7 +15,7 @@ export default {
15 data() { 15 data() {
16 return { 16 return {
17 componentStatus: {}, 17 componentStatus: {},
18 - waitingForReport: [] 18 + waiting: []
19 }; 19 };
20 }, 20 },
21 computed: { 21 computed: {
@@ -47,9 +47,9 @@ export default { @@ -47,9 +47,9 @@ export default {
47 47
48 // 每隔三秒钟上报一次数据 48 // 每隔三秒钟上报一次数据
49 setInterval(() => { 49 setInterval(() => {
50 - if (this.waitingForReport.length) {  
51 - this.report(this.waitingForReport);  
52 - this.waitingForReport = []; 50 + if (this.waiting.length) {
  51 + this.report(this.waiting);
  52 + this.waiting = [];
53 } 53 }
54 }, 3000); 54 }, 3000);
55 }, 55 },
@@ -81,17 +81,47 @@ export default { @@ -81,17 +81,47 @@ export default {
81 record(component, index) { 81 record(component, index) {
82 const reportData = _.get(component, '$options.propsData.value'); 82 const reportData = _.get(component, '$options.propsData.value');
83 83
  84 + // TODO 区分不通组件记录以楼层内item为单位、而不是以整个楼层为单位组织数据上报
  85 + let param;
84 if (reportData) { 86 if (reportData) {
85 - const param = {  
86 - P_NAME: this.$route.name,  
87 - F_NAME: reportData.template_name,  
88 - F_ID: reportData.template_id,  
89 - F_INDEX: index,  
90 - ACTION_URL: '',  
91 - PRD_SKN: ''  
92 - };  
93 - console.log('push', param);  
94 - this.waitingForReport.push(param); 87 + switch (reportData.template_name) {
  88 + case 'goods':
  89 + break;
  90 + case 'twoPicture':
  91 + param = [];
  92 + _.each(reportData.data.list, item => {
  93 + param.push({
  94 + P_NAME: this.$route.name,
  95 + F_NAME: reportData.template_name,
  96 + F_ID: reportData.template_id,
  97 + F_INDEX: index,
  98 + ACTION_URL: item.url
  99 + })
  100 + });
  101 + break;
  102 + case 'focus':
  103 + break;
  104 + case 'tfGoodsList':
  105 + break;
  106 + case 'newSingleImage':
  107 + param = {
  108 + P_NAME: this.$route.name,
  109 + F_NAME: reportData.template_name,
  110 + F_ID: reportData.template_id,
  111 + F_INDEX: index,
  112 + ACTION_URL: reportData.data.list[0].url
  113 + };
  114 + break;
  115 + case 'BlkNewProductFloorResource':
  116 + break;
  117 + default:
  118 + break;
  119 + }
  120 +
  121 + if (param) {
  122 + console.log('push', param);
  123 + _.isArray(param) ? (this.waiting = this.waiting.concat(param)) : this.waiting.push(param);
  124 + }
95 } 125 }
96 }, 126 },
97 isVisiable($el, $parent) { 127 isVisiable($el, $parent) {