Authored by baoss

修改详情页路由、添加即将开始资源位

@@ -26,6 +26,16 @@ function index(req, res, next) { @@ -26,6 +26,16 @@ function index(req, res, next) {
26 } 26 }
27 27
28 function groupListIndex(req, res, next) { 28 function groupListIndex(req, res, next) {
  29 + let params = Object.assign({}, req.query);
  30 + let showType = params.showType || 1; // 1、只展示已开始的 2、只展示即将开始的 3、展示全部
  31 + let resource = '';
  32 +
  33 + console.log(params);
  34 + if (+showType === 2) {
  35 + req.ctx(GroupService).readyListResource().then(result => {
  36 + resource = result;
  37 + });
  38 + }
29 req.ctx(GroupService).groupList() 39 req.ctx(GroupService).groupList()
30 .then(result => { 40 .then(result => {
31 return res.render('group/group-list', { 41 return res.render('group/group-list', {
@@ -35,7 +45,9 @@ function groupListIndex(req, res, next) { @@ -35,7 +45,9 @@ function groupListIndex(req, res, next) {
35 nodownload: true, 45 nodownload: true,
36 width750: true, 46 width750: true,
37 wechatShare: true, 47 wechatShare: true,
38 - activityData: result 48 + activityData: result,
  49 + resource,
  50 + showType
39 }); 51 });
40 }).catch(next); 52 }).catch(next);
41 } 53 }
@@ -43,6 +55,8 @@ function groupListIndex(req, res, next) { @@ -43,6 +55,8 @@ function groupListIndex(req, res, next) {
43 function groupList(req, res, next) { 55 function groupList(req, res, next) {
44 let params = Object.assign({}, req.query); 56 let params = Object.assign({}, req.query);
45 57
  58 + console.log(params);
  59 +
46 req.ctx(GroupService).groupList(params) 60 req.ctx(GroupService).groupList(params)
47 .then(result => { 61 .then(result => {
48 return res.render('group/group-list-ajax', { 62 return res.render('group/group-list-ajax', {
@@ -20,7 +20,17 @@ class GroupService extends global.yoho.BaseModel { @@ -20,7 +20,17 @@ class GroupService extends global.yoho.BaseModel {
20 throw new Error('Group index fail to load resources.'); 20 throw new Error('Group index fail to load resources.');
21 } 21 }
22 } 22 }
  23 + async readyListResource() {
  24 + try {
  25 + const result = await this.api._getResourceCode({
  26 + contentCode: '89141506b9926010f28915a82b3db61d'
  27 + });
23 28
  29 + return result;
  30 + } catch (e) {
  31 + throw new Error('Group index fail to load resources.');
  32 + }
  33 + }
24 34
25 async groupResult({ 35 async groupResult({
26 groupNo, 36 groupNo,
@@ -4,6 +4,13 @@ @@ -4,6 +4,13 @@
4 <img class="img" src="{{activityData.banner.imagePath}}" alt="" style="display:block"> 4 <img class="img" src="{{activityData.banner.imagePath}}" alt="" style="display:block">
5 </a> 5 </a>
6 {{/if}} 6 {{/if}}
  7 + {{#ifcond showType "==" '2'}}
  8 + {{#if resource}}
  9 + {{#ifcond template_name "==" 'focus'}}
  10 + {{> group/resources/focus}}
  11 + {{/ifcond}}
  12 + {{/if}}
  13 + {{/ifcond}}
7 <div id="goodsContainer"> 14 <div id="goodsContainer">
8 <div class="goods-list"> 15 <div class="goods-list">
9 {{#each activityData.activityList}} 16 {{#each activityData.activityList}}
@@ -39,7 +39,7 @@ class ProductList extends Page { @@ -39,7 +39,7 @@ class ProductList extends Page {
39 let activityId = $this.data('activity-id'); 39 let activityId = $this.data('activity-id');
40 40
41 console.log(productSkn, activityId); 41 console.log(productSkn, activityId);
42 - window.location.href = `/activity/group/goodsDetail?activityId=${activityId}&productSkn=${productSkn}`; 42 + window.location.href = `/activity/group/detail?activityId=${activityId}&productSkn=${productSkn}`;
43 } 43 }
44 44
45 } 45 }
@@ -16,7 +16,8 @@ class Group extends Page { @@ -16,7 +16,8 @@ class Group extends Page {
16 floorsContentHeight: $('.floors').height(), 16 floorsContentHeight: $('.floors').height(),
17 groupTab: $('.group-tab'), 17 groupTab: $('.group-tab'),
18 filterTab: $('.filter-nav'), 18 filterTab: $('.filter-nav'),
19 - groupListContent: $('.goods-list') 19 + groupListContent: $('.goods-list'),
  20 + resourceList: $('.resource-collage-buy-prd-list')
20 }; 21 };
21 this.navInfo = { 22 this.navInfo = {
22 new: { 23 new: {
@@ -122,6 +123,7 @@ class Group extends Page { @@ -122,6 +123,7 @@ class Group extends Page {
122 this.selector.groupTab.on('click', this.groupTabChange.bind(this)); 123 this.selector.groupTab.on('click', this.groupTabChange.bind(this));
123 this.selector.filterTab.on('click', 'li', this.filterTabChange.bind(this)); 124 this.selector.filterTab.on('click', 'li', this.filterTabChange.bind(this));
124 this.selector.groupListContent.on('click', '.group-product-cell', this.checkDetail.bind(this)); 125 this.selector.groupListContent.on('click', '.group-product-cell', this.checkDetail.bind(this));
  126 + this.selector.resourceList.on('click', '.product-item', this.checkDetail.bind(this));
125 } 127 }
126 fixedTab() { 128 fixedTab() {
127 let listHeight = this.selector.groupListContent.height(); 129 let listHeight = this.selector.groupListContent.height();
@@ -143,7 +145,7 @@ class Group extends Page { @@ -143,7 +145,7 @@ class Group extends Page {
143 145
144 console.log(productSkn, activityId); 146 console.log(productSkn, activityId);
145 147
146 - window.location.href = `/activity/group/goodsDetail?activityId=${activityId}&productSkn=${productSkn}`; 148 + window.location.href = `/activity/group/detail?activityId=${activityId}&productSkn=${productSkn}`;
147 } 149 }
148 150
149 // 筛选tab切换 151 // 筛选tab切换
@@ -234,11 +236,9 @@ class Group extends Page { @@ -234,11 +236,9 @@ class Group extends Page {
234 } 236 }
235 } 237 }
236 238
237 - console.log(navInfo, 'filterTab', filterTab);  
238 this.selector.filterTab.children('li').removeClass('active'); 239 this.selector.filterTab.children('li').removeClass('active');
239 filterTab.$pre.addClass('active'); 240 filterTab.$pre.addClass('active');
240 241
241 -  
242 // 价格筛选状态设置 242 // 价格筛选状态设置
243 if (filterTab.$pre.hasClass('price')) { 243 if (filterTab.$pre.hasClass('price')) {
244 navInfo.price.order = filterTab.order; 244 navInfo.price.order = filterTab.order;
@@ -341,11 +341,7 @@ class Group extends Page { @@ -341,11 +341,7 @@ class Group extends Page {
341 $.ajax({ 341 $.ajax({
342 type: 'GET', 342 type: 'GET',
343 url: '/activity/group/search', 343 url: '/activity/group/search',
344 - data: {  
345 - ...params,  
346 - ...pageParams,  
347 - page  
348 - }, 344 + data: searchParams,
349 async: false, 345 async: false,
350 beforeSend: () => { 346 beforeSend: () => {
351 let cacheData = cacheStore.get(catchKey); 347 let cacheData = cacheStore.get(catchKey);