Merge branch 'feature/material' into 'master'
Feature/material See merge request !675
Showing
19 changed files
with
436 additions
and
44 deletions
apps/3party/controllers/material-new.js
0 → 100644
1 | + | ||
2 | +'use strict'; | ||
3 | + | ||
4 | +const materialModel = require('../models/material-new'); | ||
5 | +const headerModel = require('../../../doraemon/models/header'); // 头部model | ||
6 | + | ||
7 | +exports.list = (req, res, next) => { | ||
8 | + let responseData = { | ||
9 | + pageHeader: headerModel.setNav({ | ||
10 | + navTitle: '商品素材列表页', | ||
11 | + }), | ||
12 | + title: '商品素材列表页', | ||
13 | + module: '3party', | ||
14 | + page: 'material-new', | ||
15 | + width750: true, | ||
16 | + localCss: true | ||
17 | + }; | ||
18 | + | ||
19 | + let params = { | ||
20 | + uid: req.user.uid, | ||
21 | + page: 1, | ||
22 | + isApp: req.yoho.isApp, | ||
23 | + unionType: req.query.union_type | ||
24 | + }; | ||
25 | + | ||
26 | + req.ctx(materialModel).canLogin(params).then(result => { | ||
27 | + if (result === 'N') { | ||
28 | + return next(); | ||
29 | + } else { | ||
30 | + req.ctx(materialModel).list(params).then(list => { | ||
31 | + res.render('material-new', Object.assign(responseData, list)); | ||
32 | + }).catch(next); | ||
33 | + } | ||
34 | + }).catch(next); | ||
35 | +}; |
@@ -45,7 +45,7 @@ exports.submit = (req, res, next) => { | @@ -45,7 +45,7 @@ exports.submit = (req, res, next) => { | ||
45 | // 标识问卷来源 | 45 | // 标识问卷来源 |
46 | if (req.yoho.isApp) { | 46 | if (req.yoho.isApp) { |
47 | params.sourceType = 'APP'; | 47 | params.sourceType = 'APP'; |
48 | - } else if (req.yoho.mobile) { | 48 | + } else if (req.yoho.isMobile) { |
49 | params.sourceType = 'H5'; | 49 | params.sourceType = 'H5'; |
50 | } else { | 50 | } else { |
51 | params.sourceType = 'PC'; | 51 | params.sourceType = 'PC'; |
apps/3party/models/material-new.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +const platformApi = new global.yoho.ApiBase(global.yoho.config.domains.platformApi, { | ||
4 | + name: 'imCs', | ||
5 | + cache: global.yoho.cache, | ||
6 | + useCache: false | ||
7 | +}); | ||
8 | +const _ = require('lodash'); | ||
9 | +const utils = '../../../utils'; | ||
10 | +const productProcess = require(`${utils}/product-process`); | ||
11 | + | ||
12 | +class materialModel extends global.yoho.BaseModel { | ||
13 | + constructor(ctx) { | ||
14 | + super(ctx); | ||
15 | + } | ||
16 | + | ||
17 | + canLogin(params) { | ||
18 | + return platformApi.get('/platform/product/material/canlogin', { | ||
19 | + uid: params.uid | ||
20 | + }).then(result => { | ||
21 | + if (result && result.code === 200) { | ||
22 | + return result.data.canLogin; | ||
23 | + } | ||
24 | + }); | ||
25 | + } | ||
26 | + | ||
27 | + list(params) { | ||
28 | + let options = { | ||
29 | + data: { | ||
30 | + method: 'app.search.recommendProduct', | ||
31 | + type: 'default', | ||
32 | + limit: 24 | ||
33 | + }, | ||
34 | + param: { | ||
35 | + code: 200 | ||
36 | + } | ||
37 | + }; | ||
38 | + | ||
39 | + return this.get(options).then(result => { | ||
40 | + if (result && result.code === 200) { | ||
41 | + let resu = { | ||
42 | + goods: [] | ||
43 | + }; | ||
44 | + | ||
45 | + if (_.get(result, 'data.product_list', [])) { | ||
46 | + let build = []; | ||
47 | + | ||
48 | + build = productProcess.processProductList(result.data.product_list || [], { | ||
49 | + isApp: params.isApp, | ||
50 | + showSimilar: false | ||
51 | + }); | ||
52 | + if (params.unionType) { | ||
53 | + _.forEach(build, (val) => { | ||
54 | + let newUrl = val.url; | ||
55 | + | ||
56 | + val.url = newUrl.replace('.html', `.html?union_type=${params.unionType}`); | ||
57 | + }); | ||
58 | + } | ||
59 | + resu.goods = build; | ||
60 | + } | ||
61 | + return resu; | ||
62 | + } | ||
63 | + }); | ||
64 | + } | ||
65 | +} | ||
66 | + | ||
67 | +module.exports = materialModel; |
@@ -6,6 +6,32 @@ | @@ -6,6 +6,32 @@ | ||
6 | 6 | ||
7 | const _ = require('lodash'); | 7 | const _ = require('lodash'); |
8 | 8 | ||
9 | +const _fillQuestionContents = data => { | ||
10 | + if (data && +data.questionType === 3) { | ||
11 | + data.questionContents = _.fill(Array(data.fillBlankNum || 1), true); | ||
12 | + } | ||
13 | + | ||
14 | + return data; | ||
15 | +}; | ||
16 | + | ||
17 | +const _handelSubQuestion = (qs, jid) => { | ||
18 | + if (qs) { | ||
19 | + qs = _.concat([], qs); | ||
20 | + | ||
21 | + _.forEach(qs, value => { | ||
22 | + Object.assign(value, { | ||
23 | + subQs: true, | ||
24 | + jid: jid | ||
25 | + }); | ||
26 | + _fillQuestionContents(value); | ||
27 | + }); | ||
28 | + | ||
29 | + } | ||
30 | + | ||
31 | + return qs; | ||
32 | + | ||
33 | +}; | ||
34 | + | ||
9 | module.exports = class extends global.yoho.BaseModel { | 35 | module.exports = class extends global.yoho.BaseModel { |
10 | constructor(ctx) { | 36 | constructor(ctx) { |
11 | super(ctx); | 37 | super(ctx); |
@@ -25,7 +51,7 @@ module.exports = class extends global.yoho.BaseModel { | @@ -25,7 +51,7 @@ module.exports = class extends global.yoho.BaseModel { | ||
25 | } | 51 | } |
26 | }); | 52 | }); |
27 | 53 | ||
28 | - return list; | 54 | + return _.isEmpty(list) ? false : list; |
29 | }); | 55 | }); |
30 | } | 56 | } |
31 | getQuestionStatus(params) { | 57 | getQuestionStatus(params) { |
@@ -54,10 +80,21 @@ module.exports = class extends global.yoho.BaseModel { | @@ -54,10 +80,21 @@ module.exports = class extends global.yoho.BaseModel { | ||
54 | let data = _.get(result, '[1].data', {}); | 80 | let data = _.get(result, '[1].data', {}); |
55 | 81 | ||
56 | if (data.questions) { | 82 | if (data.questions) { |
57 | - _.forEach(data.questions, value => { | ||
58 | - if (+value.questionType === 3) { | ||
59 | - value.questionContents = _.fill(Array(value.fillBlankNum || 1), true); | 83 | + _.forEach(data.questions, (value, key) => { |
84 | + if (!_.isEmpty(value.questionContents)) { | ||
85 | + _.forEach(value.questionContents, (subval, subkey) => { | ||
86 | + if (!subval.jumpQuestion) { | ||
87 | + return; | ||
60 | } | 88 | } |
89 | + | ||
90 | + value.hasSub = true; | ||
91 | + subval.jid = `${key}-${subkey}`; | ||
92 | + subval.jumpQuestion = _handelSubQuestion(subval.jumpQuestion, | ||
93 | + subval.jid); | ||
94 | + }); | ||
95 | + } | ||
96 | + | ||
97 | + _fillQuestionContents(value); | ||
61 | }); | 98 | }); |
62 | } | 99 | } |
63 | 100 |
@@ -13,7 +13,9 @@ const check = require(`${cRoot}/check`); | @@ -13,7 +13,9 @@ const check = require(`${cRoot}/check`); | ||
13 | const question = require(`${cRoot}/question`); | 13 | const question = require(`${cRoot}/question`); |
14 | const validateCode = require('../passport/controllers/validateCode'); | 14 | const validateCode = require('../passport/controllers/validateCode'); |
15 | const auth = require('../../doraemon/middleware/auth'); | 15 | const auth = require('../../doraemon/middleware/auth'); |
16 | -const material = require(`${cRoot}/material`); | 16 | + |
17 | +// const material = require(`${cRoot}/material`); | ||
18 | +const materialNew = require(`${cRoot}/material-new`); | ||
17 | 19 | ||
18 | // routers | 20 | // routers |
19 | 21 | ||
@@ -26,7 +28,6 @@ router.get('/questionnaire', auth, question.list); | @@ -26,7 +28,6 @@ router.get('/questionnaire', auth, question.list); | ||
26 | router.post('/questionnaire/check', question.check); | 28 | router.post('/questionnaire/check', question.check); |
27 | router.post('/questionnaire/submit', question.submit); | 29 | router.post('/questionnaire/submit', question.submit); |
28 | router.get('/questionnaire/:id', auth, question.detail); | 30 | router.get('/questionnaire/:id', auth, question.detail); |
29 | -router.get('/material', auth, material.list); | ||
30 | -router.get('/material/moreGoods', auth, material.moreGoods); | 31 | +router.get('/material', auth, materialNew.list); |
31 | 32 | ||
32 | module.exports = router; | 33 | module.exports = router; |
apps/3party/views/action/material-new.hbs
0 → 100644
1 | +<div class="material-c reds-shop"> | ||
2 | + <div class="filter-box"> | ||
3 | + {{> product/filter-tab}} | ||
4 | + {{> common/filter}} | ||
5 | + </div> | ||
6 | + <div id="all-goods" class="tab-panel active"> | ||
7 | + <div class="good-list-page yoho-page"> | ||
8 | + <div id="goods-container" class="goods-container"> | ||
9 | + <div class="default-goods container clearfix"> | ||
10 | + {{#goods}} | ||
11 | + {{> common/goods}} | ||
12 | + {{/goods}} | ||
13 | + </div> | ||
14 | + </div> | ||
15 | + </div> | ||
16 | + </div> | ||
17 | + <input type="hidden" id="material-flag" value="material" /> | ||
18 | +</div> |
@@ -7,38 +7,17 @@ | @@ -7,38 +7,17 @@ | ||
7 | 7 | ||
8 | <div id="qs-wrap" class="qs-wrap" data-id="{{id}}" data-cid="{{uid}}" data-title="{{share.title}}" data-desc="{{share.subtitle}}" data-img="{{share.imgUrl}}"> | 8 | <div id="qs-wrap" class="qs-wrap" data-id="{{id}}" data-cid="{{uid}}" data-title="{{share.title}}" data-desc="{{share.subtitle}}" data-img="{{share.imgUrl}}"> |
9 | {{# questions}} | 9 | {{# questions}} |
10 | - <dl class="qs-item" data-index="{{questionIndex}}" data-type="{{questionType}}"> | ||
11 | - <dt>{{questionTitle}}</dt> | ||
12 | - {{#isEqualOr questionType 1}} | ||
13 | - {{# questionContents}} | ||
14 | - <dd class="radio-option" data-index="{{@index}}"> | ||
15 | - <span class="iconfont"></span> | ||
16 | - <div class="option-box">{{{option}}}</div> | ||
17 | - {{#if addon}} | ||
18 | - <input type="text"> | ||
19 | - {{/if}} | ||
20 | - </dd> | ||
21 | - {{/ questionContents}} | ||
22 | - {{/isEqualOr}} | 10 | + {{> question/item}} |
23 | 11 | ||
24 | - {{#isEqualOr questionType 2}} | 12 | + {{#if hasSub}} |
13 | + <div class="sub-qs-wrap"> | ||
25 | {{# questionContents}} | 14 | {{# questionContents}} |
26 | - <dd class="check-option" data-index="{{@index}}"> | ||
27 | - <span class="iconfont"></span> | ||
28 | - <div class="option-box">{{{option}}}</div> | ||
29 | - {{#if addon}} | ||
30 | - <input type="text"> | ||
31 | - {{/if}} | ||
32 | - </dd> | 15 | + {{# jumpQuestion}} |
16 | + {{> question/item}} | ||
17 | + {{/ jumpQuestion}} | ||
33 | {{/ questionContents}} | 18 | {{/ questionContents}} |
34 | - {{/isEqualOr}} | ||
35 | - | ||
36 | - {{#isEqualOr questionType 3}} | ||
37 | - {{# questionContents}} | ||
38 | - <dd><textarea class="text-input"></textarea></dd> | ||
39 | - {{/ questionContents}} | ||
40 | - {{/isEqualOr}} | ||
41 | - </dl> | 19 | + </div> |
20 | + {{/if}} | ||
42 | {{/ questions}} | 21 | {{/ questions}} |
43 | </div> | 22 | </div> |
44 | 23 |
@@ -5,6 +5,10 @@ | @@ -5,6 +5,10 @@ | ||
5 | <li data-id="{{id}}" data-title="{{title}}" data-desc="{{share.subtitle}}" data-img="{{share.imgUrl}}">{{index}}.{{title}}</li> | 5 | <li data-id="{{id}}" data-title="{{title}}" data-desc="{{share.subtitle}}" data-img="{{share.imgUrl}}">{{index}}.{{title}}</li> |
6 | {{/each}} | 6 | {{/each}} |
7 | </ul> | 7 | </ul> |
8 | + {{^}} | ||
9 | + <div class="empty-list"> | ||
10 | + <p>调研问卷时间未开始,有货君正在生成调研问卷,<br>请您先逛一逛,稍后再来~~</p> | ||
11 | + </div> | ||
8 | {{/if}} | 12 | {{/if}} |
9 | 13 | ||
10 | <div id="tip-dialog" class="tip-dialog hide"> | 14 | <div id="tip-dialog" class="tip-dialog hide"> |
apps/3party/views/partial/question/item.hbs
0 → 100644
1 | +<dl class="{{#if subQs}}sub-qs-item sub-{{jid}} hide{{^}}qs-item{{/if}}" data-index="{{questionIndex}}" data-type="{{questionType}}"> | ||
2 | + <dt>{{questionTitle}}</dt> | ||
3 | + {{#isEqualOr questionType 1}} | ||
4 | + {{# questionContents}} | ||
5 | + <dd class="radio-option" data-index="{{@index}}"{{#if jid}} data-jid="{{jid}}"{{/if}}> | ||
6 | + <span class="iconfont"></span> | ||
7 | + <div class="option-box">{{{option}}}</div> | ||
8 | + {{#if addon}} | ||
9 | + <input type="text"> | ||
10 | + {{/if}} | ||
11 | + </dd> | ||
12 | + {{/ questionContents}} | ||
13 | + {{/isEqualOr}} | ||
14 | + | ||
15 | + {{#isEqualOr questionType 2}} | ||
16 | + {{# questionContents}} | ||
17 | + <dd class="check-option" data-index="{{@index}}"{{#if jid}} data-jid="{{jid}}"{{/if}}> | ||
18 | + <span class="iconfont"></span> | ||
19 | + <div class="option-box">{{{option}}}</div> | ||
20 | + {{#if addon}} | ||
21 | + <input type="text"> | ||
22 | + {{/if}} | ||
23 | + </dd> | ||
24 | + {{/ questionContents}} | ||
25 | + {{/isEqualOr}} | ||
26 | + | ||
27 | + {{#isEqualOr questionType 3}} | ||
28 | + {{# questionContents}} | ||
29 | + <dd><textarea class="text-input"></textarea></dd> | ||
30 | + {{/ questionContents}} | ||
31 | + {{/isEqualOr}} | ||
32 | +</dl> |
@@ -187,6 +187,11 @@ const _searchGoods = (params) => { | @@ -187,6 +187,11 @@ const _searchGoods = (params) => { | ||
187 | method = 'app.search.coupon'; | 187 | method = 'app.search.coupon'; |
188 | } | 188 | } |
189 | 189 | ||
190 | + // 物料商品列表增加 | ||
191 | + if (params.material === 'true') { | ||
192 | + method = 'app.search.recommendProduct'; | ||
193 | + } | ||
194 | + | ||
190 | return api.get('', _.assign({ | 195 | return api.get('', _.assign({ |
191 | method: method | 196 | method: method |
192 | }, params), { | 197 | }, params), { |
@@ -249,8 +254,15 @@ const getSearchData = (params) => { | @@ -249,8 +254,15 @@ const getSearchData = (params) => { | ||
249 | newList.list = productProcess.processProductList(result.data.product_list || [], { | 254 | newList.list = productProcess.processProductList(result.data.product_list || [], { |
250 | isApp: params.isApp || (params.appVersion && params.appVersion !== 'false'), | 255 | isApp: params.isApp || (params.appVersion && params.appVersion !== 'false'), |
251 | gender: _coverChannel[params.coverChannel], | 256 | gender: _coverChannel[params.coverChannel], |
252 | - showSimilar: params.shop_id ? false : true | 257 | + showSimilar: params.shop_id || params.material === 'true' ? false : true |
253 | }); | 258 | }); |
259 | + if (params.unionType && (params.material === 'true')) { | ||
260 | + _.forEach(newList.list, (val) => { | ||
261 | + let newUrl = val.url; | ||
262 | + | ||
263 | + val.url = newUrl.replace('.html', `.html?union_type=${params.unionType}`); | ||
264 | + }); | ||
265 | + } | ||
254 | 266 | ||
255 | if (result.data.rec_shop_list && result.data.rec_shop_list.length > 0 && | 267 | if (result.data.rec_shop_list && result.data.rec_shop_list.length > 0 && |
256 | !params.shop_id && !params.brand && !params.isApp) { | 268 | !params.shop_id && !params.brand && !params.isApp) { |
public/js/3party/material-new/controller.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +import { | ||
4 | + Controller | ||
5 | +} from 'yoho-mvc'; | ||
6 | + | ||
7 | +const allProduct = require('../../product/shop/all-product'); | ||
8 | +const lazyLoad = require('yoho-jquery-lazyload'); | ||
9 | + | ||
10 | +class MaterialController extends Controller { | ||
11 | + constructor() { | ||
12 | + super(); | ||
13 | + allProduct.getFilter(); | ||
14 | + lazyLoad($('img.lazy')); | ||
15 | + } | ||
16 | +} | ||
17 | + | ||
18 | +module.exports = MaterialController; |
public/js/3party/material-new/index.js
0 → 100644
@@ -11,7 +11,7 @@ let question = { | @@ -11,7 +11,7 @@ let question = { | ||
11 | let that = this; | 11 | let that = this; |
12 | 12 | ||
13 | this.$errTip = $('.error-tip'); | 13 | this.$errTip = $('.error-tip'); |
14 | - this.$item = $('.qs-item', this.$base); | 14 | + this.$item = $('.qs-item, .sub-qs-item', this.$base); |
15 | this.startTime = Date.parse(new Date()) / 1000; | 15 | this.startTime = Date.parse(new Date()) / 1000; |
16 | 16 | ||
17 | if (this.$base.length) { | 17 | if (this.$base.length) { |
@@ -44,11 +44,17 @@ let question = { | @@ -44,11 +44,17 @@ let question = { | ||
44 | let that = this; | 44 | let that = this; |
45 | 45 | ||
46 | this.$base.on('click', '.radio-option', function() { | 46 | this.$base.on('click', '.radio-option', function() { |
47 | - let $this = $(this); | 47 | + let $this = $(this), |
48 | + $par = $this.parent(); | ||
49 | + let jid = $this.data('jid'); | ||
48 | 50 | ||
49 | if (!$this.hasClass('on')) { | 51 | if (!$this.hasClass('on')) { |
50 | $this.siblings('.on').removeClass('on'); | 52 | $this.siblings('.on').removeClass('on'); |
51 | $this.addClass('on'); | 53 | $this.addClass('on'); |
54 | + | ||
55 | + if ($par.hasClass('qs-item')) { | ||
56 | + that.setSubQuestion($par.next('.sub-qs-wrap'), jid); | ||
57 | + } | ||
52 | } | 58 | } |
53 | }).on('click', '.check-option', function() { | 59 | }).on('click', '.check-option', function() { |
54 | let $this = $(this); | 60 | let $this = $(this); |
@@ -65,21 +71,48 @@ let question = { | @@ -65,21 +71,48 @@ let question = { | ||
65 | window.event.cancelBubble = true; | 71 | window.event.cancelBubble = true; |
66 | } | 72 | } |
67 | }); | 73 | }); |
74 | + | ||
68 | $('.submit-btn').click(function() { | 75 | $('.submit-btn').click(function() { |
69 | that.saveAnswers(that.packAnswersInfo()); | 76 | that.saveAnswers(that.packAnswersInfo()); |
70 | }); | 77 | }); |
71 | }, | 78 | }, |
79 | + setSubQuestion: function($wrap, ids) { | ||
80 | + if (!$wrap.length) { | ||
81 | + return; | ||
82 | + } | ||
83 | + | ||
84 | + $wrap.slideUp(); | ||
85 | + $wrap.children().addClass('hide'); | ||
86 | + | ||
87 | + if (typeof ids === 'string' || typeof ids === 'number') { | ||
88 | + ids = [ids]; | ||
89 | + } | ||
90 | + | ||
91 | + if (!Array.isArray(ids)) { | ||
92 | + return; | ||
93 | + } | ||
94 | + | ||
95 | + let i; | ||
96 | + | ||
97 | + for (i = 0; i < ids.length; i++) { | ||
98 | + if (ids[i]) { | ||
99 | + $wrap.find('.sub-' + ids[i]).removeClass('hide'); | ||
100 | + } | ||
101 | + } | ||
102 | + $wrap.slideDown(); | ||
103 | + }, | ||
72 | packAnswersInfo: function() { | 104 | packAnswersInfo: function() { |
73 | let that = this; | 105 | let that = this; |
74 | let answer = []; | 106 | let answer = []; |
75 | let $errDom; | 107 | let $errDom; |
76 | 108 | ||
77 | this.$item.each(function() { | 109 | this.$item.each(function() { |
78 | - if ($errDom) { | 110 | + let $this = $(this); |
111 | + | ||
112 | + if ($errDom || $this.hasClass('hide')) { | ||
79 | return; | 113 | return; |
80 | } | 114 | } |
81 | 115 | ||
82 | - let $this = $(this); | ||
83 | let data = $this.data(); | 116 | let data = $this.data(); |
84 | let ans = []; | 117 | let ans = []; |
85 | let errText = ''; | 118 | let errText = ''; |
@@ -44,6 +44,11 @@ let navInfo = { | @@ -44,6 +44,11 @@ let navInfo = { | ||
44 | sale: { | 44 | sale: { |
45 | order: 0, | 45 | order: 0, |
46 | end: false | 46 | end: false |
47 | + }, | ||
48 | + popularity: { | ||
49 | + order: 0, | ||
50 | + end: false, | ||
51 | + type: 'popularity' | ||
47 | } | 52 | } |
48 | }; | 53 | }; |
49 | 54 | ||
@@ -54,6 +59,24 @@ let onSearching = false; // 是否正在搜索 | @@ -54,6 +59,24 @@ let onSearching = false; // 是否正在搜索 | ||
54 | let isScrollLoad = false; // 是否是滚动加载 | 59 | let isScrollLoad = false; // 是否是滚动加载 |
55 | let page = 1; // 页码 | 60 | let page = 1; // 页码 |
56 | let nav; | 61 | let nav; |
62 | +let popularity = false; | ||
63 | +let $dropList = $('.drop-list'); | ||
64 | +let $firstText = $('.first-li-more').find('.nav-txt'); | ||
65 | +let $thisLi = ''; | ||
66 | + | ||
67 | +// 物料商品列表标记 | ||
68 | +if ($('#material-flag').val() === 'material') { | ||
69 | + let material = true; | ||
70 | + | ||
71 | + popularity = true; | ||
72 | + if ($('.first-li-more').hasClass('active')) { | ||
73 | + page = 2; // 已在服务端渲染第一页 | ||
74 | + } | ||
75 | + Object.assign(defaultOpt, { | ||
76 | + material: material, | ||
77 | + unionType: window.queryString.union_type | ||
78 | + }); | ||
79 | +} | ||
57 | 80 | ||
58 | /** | 81 | /** |
59 | * 处理筛选参数 | 82 | * 处理筛选参数 |
@@ -191,6 +214,18 @@ $listNav.bind('contextmenu', function() { | @@ -191,6 +214,18 @@ $listNav.bind('contextmenu', function() { | ||
191 | return false; | 214 | return false; |
192 | }); | 215 | }); |
193 | 216 | ||
217 | +const popularityFilter = function(thisLi, type) { | ||
218 | + if (thisLi.hasClass('active')) { | ||
219 | + $dropList.hide(); | ||
220 | + return false; | ||
221 | + } | ||
222 | + $thisLi.addClass('active').siblings('li').removeClass('active'); | ||
223 | + defaultOpt.type = type; | ||
224 | + Object.assign(defaultOpt, nav); | ||
225 | + getGoodsList(); | ||
226 | + $dropList.hide(); | ||
227 | +}; | ||
228 | + | ||
194 | $listNav.on('touchend touchcancel', function(e) { | 229 | $listNav.on('touchend touchcancel', function(e) { |
195 | page = 1; | 230 | page = 1; |
196 | beforeScroll = $(window).scrollTop(); | 231 | beforeScroll = $(window).scrollTop(); |
@@ -199,7 +234,24 @@ $listNav.on('touchend touchcancel', function(e) { | @@ -199,7 +234,24 @@ $listNav.on('touchend touchcancel', function(e) { | ||
199 | let $this = $(e.target).closest('li'); // 被点击的 Tab | 234 | let $this = $(e.target).closest('li'); // 被点击的 Tab |
200 | let $active; | 235 | let $active; |
201 | 236 | ||
202 | - if ($this.hasClass('filter')) { // 筛选面板 | 237 | + // 默认列表增加人气筛选 |
238 | + if ($this.hasClass('default') && popularity) { | ||
239 | + $this.siblings('.active').removeClass('active'); | ||
240 | + $this.addClass('active'); | ||
241 | + $dropList.toggle(); | ||
242 | + $dropList.find('.default').on('touchend touchcancel', function() { | ||
243 | + $thisLi = $(this); | ||
244 | + $firstText.html('默认'); | ||
245 | + popularityFilter($thisLi, 'default'); | ||
246 | + return false; | ||
247 | + }); | ||
248 | + $dropList.find('.popularity').on('touchend touchcancel', function() { | ||
249 | + $thisLi = $(this); | ||
250 | + $firstText.html('人气'); | ||
251 | + popularityFilter($thisLi, 'popularity'); | ||
252 | + return false; | ||
253 | + }); | ||
254 | + } else if ($this.hasClass('filter')) { // 筛选面板 | ||
203 | 255 | ||
204 | // 筛选面板切换状态 | 256 | // 筛选面板切换状态 |
205 | if ($this.hasClass('active')) { | 257 | if ($this.hasClass('active')) { |
@@ -216,6 +268,7 @@ $listNav.on('touchend touchcancel', function(e) { | @@ -216,6 +268,7 @@ $listNav.on('touchend touchcancel', function(e) { | ||
216 | 268 | ||
217 | filter.showFilter(); | 269 | filter.showFilter(); |
218 | } | 270 | } |
271 | + $dropList.hide().find('li').removeClass('active'); | ||
219 | } else { // 排序改变 | 272 | } else { // 排序改变 |
220 | 273 | ||
221 | if ($this.hasClass('new')) { | 274 | if ($this.hasClass('new')) { |
@@ -265,6 +318,7 @@ $listNav.on('touchend touchcancel', function(e) { | @@ -265,6 +318,7 @@ $listNav.on('touchend touchcancel', function(e) { | ||
265 | /* 排序条件更新 */ | 318 | /* 排序条件更新 */ |
266 | defaultOpt.type = navType; | 319 | defaultOpt.type = navType; |
267 | Object.assign(defaultOpt, nav); | 320 | Object.assign(defaultOpt, nav); |
321 | + $dropList.hide().find('li').removeClass('active'); | ||
268 | 322 | ||
269 | getGoodsList(); | 323 | getGoodsList(); |
270 | } | 324 | } |
public/scss/3party/material-new.page.css
0 → 100644
1 | +@import "common/good"; | ||
2 | +@import "common/filter"; | ||
3 | +@import "../product/shop/reds-shop/nav"; | ||
4 | + | ||
5 | +.reds-shop { | ||
6 | + .filter-box { | ||
7 | + display: block; | ||
8 | + } | ||
9 | +} | ||
10 | + | ||
11 | +#all-goods { | ||
12 | + position: relative; | ||
13 | +} | ||
14 | + | ||
15 | +.no-result-new { | ||
16 | + text-align: center; | ||
17 | + padding-top: 90px; | ||
18 | + padding-bottom: 110px; | ||
19 | + | ||
20 | + p { | ||
21 | + color: #ccc; | ||
22 | + margin-bottom: 25px; | ||
23 | + font-size: 26px; | ||
24 | + | ||
25 | + &:first-child { | ||
26 | + color: #444; | ||
27 | + font-size: 32px; | ||
28 | + } | ||
29 | + } | ||
30 | +} | ||
31 | + | ||
32 | +.search-divide { | ||
33 | + clear: both; | ||
34 | + height: 50px; | ||
35 | + width: 100%; | ||
36 | + padding: 10px 0; | ||
37 | + color: #ccc; | ||
38 | + text-align: center; | ||
39 | +} | ||
40 | + | ||
41 | +.material-c { | ||
42 | + .drop-list { | ||
43 | + padding-left: 30px; | ||
44 | + position: absolute; | ||
45 | + z-index: 10; | ||
46 | + background: #fff; | ||
47 | + width: 100%; | ||
48 | + | ||
49 | + li { | ||
50 | + width: 100%; | ||
51 | + height: 88px; | ||
52 | + font-size: 28px; | ||
53 | + color: #b0b0b0; | ||
54 | + line-height: 88px; | ||
55 | + border-bottom: 1px solid #e0e0e0; | ||
56 | + } | ||
57 | + | ||
58 | + li:last-child { | ||
59 | + border-bottom: none; | ||
60 | + } | ||
61 | + | ||
62 | + .active { | ||
63 | + color: #444; | ||
64 | + | ||
65 | + .chose { | ||
66 | + display: inline-block; | ||
67 | + width: 30px; | ||
68 | + height: 22px; | ||
69 | + background-image: resolve("product/chose.png"); | ||
70 | + background-size: 100%; | ||
71 | + float: right; | ||
72 | + margin-top: 33px; | ||
73 | + margin-right: 30px; | ||
74 | + background-repeat: no-repeat; | ||
75 | + } | ||
76 | + } | ||
77 | + } | ||
78 | +} |
@@ -36,6 +36,13 @@ body { | @@ -36,6 +36,13 @@ body { | ||
36 | color: #555; | 36 | color: #555; |
37 | } | 37 | } |
38 | 38 | ||
39 | + .sub-qs-wrap { | ||
40 | + display: none; | ||
41 | + position: relative; | ||
42 | + z-index: 0; | ||
43 | + } | ||
44 | + | ||
45 | + .sub-qs-item, | ||
39 | .qs-item { | 46 | .qs-item { |
40 | background: #fff; | 47 | background: #fff; |
41 | margin-bottom: 30px; | 48 | margin-bottom: 30px; |
@@ -17,6 +17,14 @@ | @@ -17,6 +17,14 @@ | ||
17 | } | 17 | } |
18 | } | 18 | } |
19 | 19 | ||
20 | + .empty-list { | ||
21 | + font-size: 24px; | ||
22 | + color: #bbb; | ||
23 | + text-align: center; | ||
24 | + padding-top: 360px; | ||
25 | + line-height: 2; | ||
26 | + } | ||
27 | + | ||
20 | .tip-dialog { | 28 | .tip-dialog { |
21 | width: 100%; | 29 | width: 100%; |
22 | height: 100%; | 30 | height: 100%; |
-
Please register or login to post a comment