Authored by lijing

个人中心增加资源位

@@ -12,6 +12,9 @@ const singleAPI = global.yoho.SingleAPI; @@ -12,6 +12,9 @@ const singleAPI = global.yoho.SingleAPI;
12 const helpers = global.yoho.helpers; 12 const helpers = global.yoho.helpers;
13 const _ = require('lodash'); 13 const _ = require('lodash');
14 const crypto = global.yoho.crypto; 14 const crypto = global.yoho.crypto;
  15 +const service = global.yoho.ServiceAPI;
  16 +const utils = '../../../utils';
  17 +const resourcesProcess = require(`${utils}/resources-process`);
15 18
16 /** 19 /**
17 * 个人详情数据 20 * 个人详情数据
@@ -92,6 +95,24 @@ const _getAddressData = (params) => { @@ -92,6 +95,24 @@ const _getAddressData = (params) => {
92 } 95 }
93 }; 96 };
94 97
  98 +// 资源位
  99 +const _getRes = () => {
  100 + return service.get('/operations/api/v5/resource/home', {
  101 + content_code: '5d05d443a557783b1489d328c127e9bf',
  102 + }).then(result => {
  103 + if (result && result.code === 200 && result.data && result.data.list) {
  104 + for (let item of result.data.list) {
  105 + item.template_name === 'single_image' &&
  106 + item.data.length === 1 &&
  107 + (item.singleOne = true);
  108 + }
  109 + return resourcesProcess(result.data.list);
  110 + } else {
  111 + return result;
  112 + }
  113 + });
  114 +};
  115 +
95 /** 116 /**
96 * 个人中心首页 117 * 个人中心首页
97 * @param params 118 * @param params
@@ -116,7 +137,8 @@ const index = (params) => { @@ -116,7 +137,8 @@ const index = (params) => {
116 _noticeData(), 137 _noticeData(),
117 _favoriteData(params), 138 _favoriteData(params),
118 _infoNum(params), 139 _infoNum(params),
119 - _getAddressData(params) 140 + _getAddressData(params),
  141 + _getRes()
120 ]).then(result => { 142 ]).then(result => {
121 if (result[0] && result[0].data) { 143 if (result[0] && result[0].data) {
122 Object.assign(finalResult, { 144 Object.assign(finalResult, {
@@ -167,6 +189,10 @@ const index = (params) => { @@ -167,6 +189,10 @@ const index = (params) => {
167 }); 189 });
168 } 190 }
169 191
  192 + if (result[5]) {
  193 + finalResult.content = result[5];
  194 + }
  195 +
170 return finalResult; 196 return finalResult;
171 }); 197 });
172 }; 198 };
@@ -121,6 +121,13 @@ @@ -121,6 +121,13 @@
121 </a> 121 </a>
122 </div> 122 </div>
123 123
  124 + {{! 资源位}}
  125 + <div class="res-c">
  126 + <div class="resource-content">
  127 + {{> content}}
  128 + </div>
  129 + </div>
  130 +
124 {{!-- 131 {{!--
125 <div class="group-list"> 132 <div class="group-list">
126 <a class="list-item" href="/home/onlineService"> 133 <a class="list-item" href="/home/onlineService">
  1 +{{#content}}
  2 + {{! 中间banner}}
  3 + {{#if singleImage}}
  4 + <div data-id="{{template_id}}">
  5 + {{> resources/banner}}
  6 + </div>
  7 + {{/if}}
  8 + {{! 两个小图}}
  9 + {{#if smallPic}}
  10 + {{> resources/thumb-row}}
  11 + {{/if}}
  12 + {{! 分隔楼层}}
  13 + {{#if divideImage}}
  14 + {{> resources/divide-image}}
  15 + {{/if}}
  16 +{{/content}}
@@ -319,4 +319,14 @@ @@ -319,4 +319,14 @@
319 font-size: 16PX; 319 font-size: 16PX;
320 } 320 }
321 } 321 }
  322 +
  323 + .res-c {
  324 + img {
  325 + width: 100%;
  326 + }
  327 +
  328 + .thumb-row {
  329 + padding-top: 0;
  330 + }
  331 + }
322 } 332 }
@@ -2,3 +2,5 @@ @@ -2,3 +2,5 @@
2 @import "product/detail/recommend-for-you"; 2 @import "product/detail/recommend-for-you";
3 @import "common/good"; 3 @import "common/good";
4 @import "channel/footer-tab"; 4 @import "channel/footer-tab";
  5 +@import "channel/thumb-row";
  6 +@import "channel/divide-image";