Authored by 514335620@qq.com

outlet tab 代码

@@ -23,3 +23,15 @@ exports.activity = (req, res) => { @@ -23,3 +23,15 @@ exports.activity = (req, res) => {
23 res.render('outlet/activity', Object.assign(renderData, result)); 23 res.render('outlet/activity', Object.assign(renderData, result));
24 }); 24 });
25 }; 25 };
  26 +
  27 +exports.willBeEnd = (req, res) => {
  28 + outletModel.willBeEnd().then(result => {
  29 + res.render('outlet/willBeEnd', Object.assign(renderData, result));
  30 + });
  31 +};
  32 +
  33 +exports.willBeCome = (req, res) => {
  34 + outletModel.willBeCome().then(result => {
  35 + res.render('outlet/willBeCome', Object.assign(renderData, result));
  36 + });
  37 +};
@@ -140,26 +140,29 @@ const convertActicityData = (data) => { @@ -140,26 +140,29 @@ const convertActicityData = (data) => {
140 return {data: formatData, showMore: showMore}; 140 return {data: formatData, showMore: showMore};
141 }; 141 };
142 142
143 -const getHomeActivity = () => { 143 +const getHomeActivity = (id) => {
144 var params = { 144 var params = {
145 method: 'app.outlets.activityGet', 145 method: 'app.outlets.activityGet',
146 platform: 2, 146 platform: 2,
147 size: 0, 147 size: 0,
148 yh_channel: 1, 148 yh_channel: 1,
149 - type: 0, 149 + type: id,
150 sort: 2, 150 sort: 2,
151 client_type: 'h5' 151 client_type: 'h5'
152 }; 152 };
153 153
154 return api.get('', sign.apiSign(params)).then(res => { 154 return api.get('', sign.apiSign(params)).then(res => {
  155 + if (id === 0) {
155 return convertActicityData(res.data); 156 return convertActicityData(res.data);
  157 + }
  158 + return res.data;
156 }); 159 });
157 }; 160 };
158 161
159 exports.getContent = () => { 162 exports.getContent = () => {
160 let floorsData = {}; 163 let floorsData = {};
161 164
162 - return Promise.all([getNavData(), getOutletResource(), getHomeActivity(), getGoodsList()]).then(data => { 165 + return Promise.all([getNavData(), getOutletResource(), getHomeActivity(0), getGoodsList()]).then(data => {
163 floorsData.nav = data[0] || []; 166 floorsData.nav = data[0] || [];
164 floorsData.content = data[1] || []; 167 floorsData.content = data[1] || [];
165 floorsData.activity = data[2] || []; 168 floorsData.activity = data[2] || [];
@@ -178,3 +181,15 @@ exports.getActivity = () => { @@ -178,3 +181,15 @@ exports.getActivity = () => {
178 return data; 181 return data;
179 }); 182 });
180 }; 183 };
  184 +
  185 +exports.willBeEnd = () => {
  186 + return getHomeActivity(3).then(res => {
  187 + return res;
  188 + });
  189 +};
  190 +
  191 +exports.willBeCome = () => {
  192 + return getHomeActivity(4).then(res => {
  193 + return res;
  194 + });
  195 +};
@@ -36,6 +36,7 @@ router.get('/sale/filter', sale.filter); @@ -36,6 +36,7 @@ router.get('/sale/filter', sale.filter);
36 36
37 router.get('/outlet', outlet.index); 37 router.get('/outlet', outlet.index);
38 router.get('/outlet/activity', outlet.activity); 38 router.get('/outlet/activity', outlet.activity);
39 - 39 +router.get('/outlet/willBeEnd', outlet.willBeEnd);
  40 +router.get('/outlet/willBeCome', outlet.willBeCome);
40 41
41 module.exports = router; 42 module.exports = router;
@@ -4,6 +4,8 @@ @@ -4,6 +4,8 @@
4 {{#each data}} 4 {{#each data}}
5 <li><a href="{{url}}">{{name}}</a></li> 5 <li><a href="{{url}}">{{name}}</a></li>
6 {{/each}} 6 {{/each}}
  7 + <li><a href="{{url}}" data-url="outlet/willBeEnd">即将结束</a></li>
  8 + <li><a href="{{url}}" data-url="/outlet/willBeCome">上线预告</a></li>
7 </ul> 9 </ul>
8 </nav> 10 </nav>
9 {{/nav}} 11 {{/nav}}
@@ -24,5 +24,16 @@ if (('.outlet-page').length > 0) { @@ -24,5 +24,16 @@ if (('.outlet-page').length > 0) {
24 $('.more-activity').addClass('hidden'); 24 $('.more-activity').addClass('hidden');
25 $('.back-ground-white').removeClass('hidden'); 25 $('.back-ground-white').removeClass('hidden');
26 }); 26 });
  27 +}
  28 +
  29 +
  30 +if (('.outlet-page').length > 0) {
  31 +
  32 + $('.outlet-nav').find('li').each(function() {
  33 + $(this).on('click', function() {
  34 +
  35 + });
  36 + });
  37 +
27 38
28 } 39 }