Authored by 郭成尧

html-end

@@ -6,9 +6,6 @@ @@ -6,9 +6,6 @@
6 'use strict'; 6 'use strict';
7 const _ = require('lodash'); 7 const _ = require('lodash');
8 8
9 -// const helpers = global.yoho.helpers;  
10 -// const utils = require('../../../utils');  
11 -  
12 const genderMap = { 9 const genderMap = {
13 boys: '1,3', 10 boys: '1,3',
14 girls: '2,3', 11 girls: '2,3',
@@ -39,34 +36,17 @@ module.exports = class extends global.yoho.BaseModel { @@ -39,34 +36,17 @@ module.exports = class extends global.yoho.BaseModel {
39 // 如果有二级菜单,二级菜单跳转,否则一级菜单跳转 36 // 如果有二级菜单,二级菜单跳转,否则一级菜单跳转
40 if (firstItem.sub && firstItem.sub.length) { 37 if (firstItem.sub && firstItem.sub.length) {
41 _.map(firstItem.sub, function(secondItem) { 38 _.map(firstItem.sub, function(secondItem) {
42 - // secondItem.url = helpers.urlFormat('/', utils.mapSort({  
43 - // sort: _.get(secondItem, 'relation_parameter.sort'),  
44 - // sort_name: secondItem.category_name,  
45 - // gender: genderMap[key] || ''  
46 - // }), 'list');  
47 secondItem.url = 39 secondItem.url =
48 - `//m.yohobuy.com/list/gd${genderMap[key] || ''}-ci${_.get(secondItem, 'category_id')}`; 40 + `//m.yohobuy.com/list/gd${genderMap[key] || ''}-ci${_.get(secondItem, 'category_id')}.html`;
49 }); 41 });
50 42
51 firstItem.sub.unshift({ 43 firstItem.sub.unshift({
52 category_name: `全部${firstItem.category_name}`, 44 category_name: `全部${firstItem.category_name}`,
53 -  
54 - // url: helpers.urlFormat('/', utils.mapSort({  
55 - // sort: _.get(firstItem, 'relation_parameter.sort'),  
56 - // sort_name: firstItem.category_name,  
57 - // gender: genderMap[key] || ''  
58 - // }), 'list'),  
59 - url: `//m.yohobuy.com/list/gd${genderMap[key] || ''}-ci${_.get(firstItem, 'category_id')}?title=${firstItem.category_name}` // eslint-disable-line 45 + url: `//m.yohobuy.com/list/gd${genderMap[key] || ''}-ci${_.get(firstItem, 'category_id')}.html?title=${firstItem.category_name}` // eslint-disable-line
60 }); 46 });
61 } else { 47 } else {
62 - // firstItem.url = helpers.urlFormat('/', utils.mapSort({  
63 - // sort: _.get(firstItem, 'relation_parameter.sort'),  
64 - // sort_name: firstItem.category_name,  
65 - // gender: genderMap[key] || ''  
66 - // }), 'list');  
67 -  
68 firstItem.url = 48 firstItem.url =
69 - `//m.yohobuy.com/list/gd${genderMap[key] || ''}-ci${_.get(firstItem, 'category_id')}`; 49 + `//m.yohobuy.com/list/gd${genderMap[key] || ''}-ci${_.get(firstItem, 'category_id')}.html`;
70 } 50 }
71 }); 51 });
72 }); 52 });
@@ -122,6 +122,8 @@ const resolvePathParams = (req, res, next) => { @@ -122,6 +122,8 @@ const resolvePathParams = (req, res, next) => {
122 let queryParams = req.query; 122 let queryParams = req.query;
123 let pathParams = req.params.pathParams; 123 let pathParams = req.params.pathParams;
124 124
  125 + pathParams = _.replace(pathParams, '.html', '');
  126 +
125 // 1. 取 path 的参数 127 // 1. 取 path 的参数
126 req.query = listParamsProcess.getParams(pathParams); 128 req.query = listParamsProcess.getParams(pathParams);
127 129
@@ -149,6 +151,9 @@ const resolvePathParams = (req, res, next) => { @@ -149,6 +151,9 @@ const resolvePathParams = (req, res, next) => {
149 */ 151 */
150 const resolvePathParamsAjax = (req, res, next) => { 152 const resolvePathParamsAjax = (req, res, next) => {
151 let pathParams = _.last(_.split(req.query.currentUrl, '/')); 153 let pathParams = _.last(_.split(req.query.currentUrl, '/'));
  154 +
  155 + pathParams = _.replace(pathParams, '.html', '');
  156 +
152 let currentUrlParams = listParamsProcess.getParams(pathParams); 157 let currentUrlParams = listParamsProcess.getParams(pathParams);
153 let queryParams = {}; 158 let queryParams = {};
154 159