Showing
9 changed files
with
637 additions
and
8 deletions
@@ -11,6 +11,87 @@ const searchModel = require(`${mRoot}/search`); | @@ -11,6 +11,87 @@ const searchModel = require(`${mRoot}/search`); | ||
11 | const _ = require('lodash'); | 11 | const _ = require('lodash'); |
12 | const helpers = global.yoho.helpers; | 12 | const helpers = global.yoho.helpers; |
13 | 13 | ||
14 | +/** | ||
15 | + * 新店铺首页 | ||
16 | + * @param {int} shopId 店铺id | ||
17 | + * @param {int} uid 用户id | ||
18 | + * @param {string} isApp app版本 | ||
19 | + * @return array | ||
20 | + */ | ||
21 | +const _getShopData = (shopId, uid, isApp) => { | ||
22 | + let data = {}; | ||
23 | + let channel = req.yoho.channel; | ||
24 | + isApp = isApp || ''; | ||
25 | + | ||
26 | + //Promise.all([searchModel.getShopDecorator(shopId),searchModel.getShopInfo(shopId, uid)]).then((result) => { | ||
27 | + // data = { | ||
28 | + // decorator: result[0], // 店铺装修资源数据 | ||
29 | + // shopInfo: result[1] // 店铺信息 | ||
30 | + // }; | ||
31 | + // | ||
32 | + // // 店铺使用基础模板,返回品牌页面 | ||
33 | + // if (data.shopInfo.data.shopTemplateType && data.shopInfo.data.shopTemplateType ===1) { | ||
34 | + // return { | ||
35 | + // goBrand: data.shopInfo.data | ||
36 | + // } | ||
37 | + // } | ||
38 | + // | ||
39 | + // // 店铺分类 | ||
40 | + // return searchModel.getShopCategory(shopId, channel); | ||
41 | + //}).then(shopCategory => { | ||
42 | + // _.assign({ | ||
43 | + // shopCategory: shopCategory | ||
44 | + // }, data); | ||
45 | + // | ||
46 | + // return searchModel.formShopData(data, shopId, isApp); // 组织楼层数据 | ||
47 | + //}); | ||
48 | +}; | ||
49 | + | ||
50 | +/** | ||
51 | + * 店铺首页 || 若店铺使用基础模板跳转品牌页 | ||
52 | + * @return int | ||
53 | + */ | ||
54 | +const _shop = (req, res, shopId) => { | ||
55 | + let isApp = req.query.app_version || req.query.appVersion || false; | ||
56 | + let pageHeader = {}; | ||
57 | + let uid = 0; | ||
58 | + | ||
59 | + if (!isApp) { | ||
60 | + pageHeader = headerModel.setNav({ | ||
61 | + navTitle: '' | ||
62 | + }); | ||
63 | + uid = req.user.uid; | ||
64 | + } else { | ||
65 | + uid = req.query.uid; | ||
66 | + req.session.appUid = uid; | ||
67 | + res.cookie('appUid', uid, { | ||
68 | + domain: 'yohobuy.com', | ||
69 | + expires: new Date(Date.now() + 2592000000) // 有效期一年 | ||
70 | + }); | ||
71 | + } | ||
72 | + | ||
73 | + _getShopData(shopId, uid, isApp).then((result) => { | ||
74 | + if (result.goBrand) { | ||
75 | + // 跳转基础模板 | ||
76 | + _baseShop(result.goBrand); | ||
77 | + } | ||
78 | + | ||
79 | + res.render('shop', { | ||
80 | + shopIndex: result, | ||
81 | + shopPage: { | ||
82 | + text: '分类', | ||
83 | + url: helpers.urlFormat('/product/index/category', { | ||
84 | + shop_id: shopId | ||
85 | + }) | ||
86 | + }, | ||
87 | + gender: req.query.gender, | ||
88 | + channel: req.query.channel | ||
89 | + } | ||
90 | + }); | ||
91 | + | ||
92 | + | ||
93 | +}; | ||
94 | + | ||
14 | // 搜索落地页 | 95 | // 搜索落地页 |
15 | const list = (req, res, next) => { | 96 | const list = (req, res, next) => { |
16 | let params = Object.assign({}, req.query); | 97 | let params = Object.assign({}, req.query); |
@@ -106,7 +187,7 @@ const list = (req, res, next) => { | @@ -106,7 +187,7 @@ const list = (req, res, next) => { | ||
106 | }).catch(next); | 187 | }).catch(next); |
107 | }; | 188 | }; |
108 | 189 | ||
109 | -// 分类落地页 | 190 | +// 品类落地页 |
110 | const category = (req, res) => { | 191 | const category = (req, res) => { |
111 | let params = Object.assign({}, req.query); | 192 | let params = Object.assign({}, req.query); |
112 | 193 | ||
@@ -122,6 +203,81 @@ const category = (req, res) => { | @@ -122,6 +203,81 @@ const category = (req, res) => { | ||
122 | }); | 203 | }); |
123 | }; | 204 | }; |
124 | 205 | ||
206 | +// 品牌落地页 | ||
207 | +const brand = (req, res, next) => { | ||
208 | + let params = Object.assign({}, req.query); | ||
209 | + let domain = 'vans'; | ||
210 | + let uid = req.user.uid || 20000032; | ||
211 | + let brandId = 0; | ||
212 | + let brandLogo = {}; | ||
213 | + let title = ''; | ||
214 | + let brandHome = false; | ||
215 | + | ||
216 | + if (!domain) { | ||
217 | + res.redirect('/?go=1'); | ||
218 | + } | ||
219 | + | ||
220 | + searchModel.getBrandLogoByDomain(domain).then((result) => { | ||
221 | + brandLogo = result; | ||
222 | + | ||
223 | + title = brandLogo.name; | ||
224 | + | ||
225 | + //无店铺:0--->品牌页 无单品店有多品店:1--->搜索页 有单品店:2--->店铺页面 | ||
226 | + if (brandLogo.type === 2 && brandLogo.shopId) { | ||
227 | + _shop(req, res, brandLogo.shopId); | ||
228 | + return false; | ||
229 | + } | ||
230 | + | ||
231 | + if (brandLogo && brandLogo.id) { | ||
232 | + brandId = brandLogo.id; | ||
233 | + } | ||
234 | + | ||
235 | + params = _.assign({ | ||
236 | + brand: brandId | ||
237 | + }, params); | ||
238 | + | ||
239 | + //获取品牌店铺信息 | ||
240 | + return searchModel.getBrandShops(brandId); | ||
241 | + }).then((brandShop) => { | ||
242 | + if (brandId === 0) { | ||
243 | + params.query = domain; | ||
244 | + } | ||
245 | + | ||
246 | + // 从搜索页过来的,显示搜索框, 和进入品牌引导信息 或者品牌关联多店铺 | ||
247 | + if (req.query.from === 'search' || brandShop.length > 0) { | ||
248 | + params = { | ||
249 | + brandWay: brandShop ? brandShop : brandLogo, | ||
250 | + search: { | ||
251 | + default: req.query.query, | ||
252 | + url: helpers.urlFormat('', null, 'search') | ||
253 | + } | ||
254 | + }; | ||
255 | + } else if (brandId !== 0) { // 品牌一览过来的展示品牌介绍和LOGO | ||
256 | + return Promise.all([searchModel.getBrandIntro(brandId, uid), searchModel.getBrandBanner(brandId)]).then((result) => { | ||
257 | + title = result[0].title; | ||
258 | + delete result[0].title; | ||
259 | + | ||
260 | + return _.assign({ | ||
261 | + banner: result[1] | ||
262 | + }, result[0]); | ||
263 | + }); | ||
264 | + } | ||
265 | + }).then((brandHome) => { | ||
266 | + params.brandHome = brandHome; | ||
267 | + | ||
268 | + res.render('search/goods-list', { | ||
269 | + module: 'product', | ||
270 | + page: 'search-list', | ||
271 | + pageHeader: headerModel.setNav({ | ||
272 | + navTitle: title !== '' ? title : domain | ||
273 | + }), | ||
274 | + goodList: params, | ||
275 | + showDownloadApp: true, | ||
276 | + pageFooter: true | ||
277 | + }); | ||
278 | + }).catch(next); | ||
279 | +}; | ||
280 | + | ||
125 | const search = (req, res, next) => { | 281 | const search = (req, res, next) => { |
126 | let params = Object.assign({}, req.query); | 282 | let params = Object.assign({}, req.query); |
127 | 283 | ||
@@ -151,9 +307,58 @@ let filter = (req, res, next) => { | @@ -151,9 +307,58 @@ let filter = (req, res, next) => { | ||
151 | }).catch(next); | 307 | }).catch(next); |
152 | }; | 308 | }; |
153 | 309 | ||
310 | +/** | ||
311 | + * 品牌[店铺]收藏/取消收藏 | ||
312 | + * id 品牌ID | ||
313 | + * opt 操作标识("ok":表示收藏,"cancel":表示取消收藏) | ||
314 | + */ | ||
315 | +const favoriteBrand = (req, res, next) => { | ||
316 | + let id = req.body.id; | ||
317 | + let uid = req.user.uid || 20000032; | ||
318 | + let opt = req.body.opt || 'ok'; | ||
319 | + | ||
320 | + | ||
321 | + if (_.isNumber(id)) { | ||
322 | + res.json({ | ||
323 | + code: 401, | ||
324 | + message: '参数不正确', | ||
325 | + data: false | ||
326 | + }); | ||
327 | + return false; | ||
328 | + } else if (!uid) { | ||
329 | + res.json({ | ||
330 | + code: 400, | ||
331 | + message: '未登录', | ||
332 | + data: helpers.urlFormat('/signin.html', { | ||
333 | + refer: decodeURI(req.cookies.refer) | ||
334 | + }) | ||
335 | + }); | ||
336 | + return false; | ||
337 | + } else if (opt !== 'ok') { // 取消收藏 | ||
338 | + searchModel.setFavoriteCancel(id, uid).then((data) => { | ||
339 | + res.json(data); | ||
340 | + return false; | ||
341 | + }).catch(next); | ||
342 | + } | ||
343 | + | ||
344 | + searchModel.setFavorite(id, uid).then((result) => { | ||
345 | + if (!result.code) { // 收藏 | ||
346 | + result = { | ||
347 | + code: 401, | ||
348 | + message: '参数不正确', | ||
349 | + data: false | ||
350 | + }; | ||
351 | + } | ||
352 | + | ||
353 | + res.json(result); | ||
354 | + }); | ||
355 | +}; | ||
356 | + | ||
154 | module.exports = { | 357 | module.exports = { |
155 | list, | 358 | list, |
156 | filter, | 359 | filter, |
157 | search, | 360 | search, |
158 | - category | 361 | + category, |
362 | + brand, | ||
363 | + favoriteBrand | ||
159 | }; | 364 | }; |
@@ -9,6 +9,7 @@ const logger = global.yoho.logger; | @@ -9,6 +9,7 @@ const logger = global.yoho.logger; | ||
9 | const camelCase = global.yoho.camelCase; | 9 | const camelCase = global.yoho.camelCase; |
10 | const productProcess = require(`${utils}/product-process`); | 10 | const productProcess = require(`${utils}/product-process`); |
11 | const _ = require('lodash'); | 11 | const _ = require('lodash'); |
12 | +const helpers = global.yoho.helpers; | ||
12 | const api = global.yoho.API; | 13 | const api = global.yoho.API; |
13 | 14 | ||
14 | /** | 15 | /** |
@@ -113,6 +114,88 @@ const _processClassNames = (list) => { | @@ -113,6 +114,88 @@ const _processClassNames = (list) => { | ||
113 | return formatData; | 114 | return formatData; |
114 | }; | 115 | }; |
115 | 116 | ||
117 | +/* 多品牌店铺列表数据信息处理*/ | ||
118 | +const _processBrandShops = (list) => { | ||
119 | + const formatDat = []; | ||
120 | + | ||
121 | + list = list || []; | ||
122 | + list = camelCase(list); | ||
123 | + | ||
124 | + _.forEach(list, (item) => { | ||
125 | + if (item.shopId) { | ||
126 | + formatDat.push({ | ||
127 | + url: helpers.urlFormat('/product/index/brand/', { | ||
128 | + shop_id: item.brandId | ||
129 | + }), | ||
130 | + thumb: helpers.image(item.brandIco, 75, 40), | ||
131 | + name: item.brandName | ||
132 | + }); | ||
133 | + } | ||
134 | + }); | ||
135 | + | ||
136 | + return formatDat; | ||
137 | +}; | ||
138 | + | ||
139 | +/** | ||
140 | + * 获取品牌信息数据 | ||
141 | + * @param {int} brandId 品牌ID | ||
142 | + * @return array banner数据 | ||
143 | + */ | ||
144 | +const getBrandIntro = (brandId, uid) => { | ||
145 | + let param = {}; | ||
146 | + | ||
147 | + if (uid) { | ||
148 | + param = { | ||
149 | + uid: uid | ||
150 | + }; | ||
151 | + } | ||
152 | + | ||
153 | + return api.get('', _.assign({ | ||
154 | + method: 'app.brand.getBrandIntro', | ||
155 | + brand_id: brandId | ||
156 | + }, param), { | ||
157 | + cache: true | ||
158 | + }).then((result) => { | ||
159 | + if (result && result.code === 200) { | ||
160 | + let list = camelCase(result.data) || {}; | ||
161 | + | ||
162 | + return { | ||
163 | + id: list.brandId, | ||
164 | + intro: list.brandIntro, | ||
165 | + collected: (list.isFavorite && list.isFavorite === 'Y') ? true : false, | ||
166 | + title: list.brandName ? list.brandName : '' | ||
167 | + }; | ||
168 | + } else { | ||
169 | + logger.error('获取店铺信息接口返回code 不是 200'); | ||
170 | + return {}; | ||
171 | + } | ||
172 | + }); | ||
173 | +}; | ||
174 | + | ||
175 | +/** | ||
176 | + * 获取品牌banner数据 | ||
177 | + * @param {int} brandId 品牌ID | ||
178 | + * @return array banner数据 | ||
179 | + */ | ||
180 | +const getBrandBanner = (brandId) => { | ||
181 | + return api.get('', { | ||
182 | + method: 'app.brand.banner', | ||
183 | + brand_id: brandId | ||
184 | + }, { | ||
185 | + cache: true | ||
186 | + }).then((result) => { | ||
187 | + if (result && result.code === 200) { | ||
188 | + if (result.data.banner) { | ||
189 | + return helpers.image(result.data.banner, 640, 150); | ||
190 | + } else { | ||
191 | + return ''; | ||
192 | + } | ||
193 | + } else { | ||
194 | + logger.error('获取店铺banner接口返回code 不是 200'); | ||
195 | + return {}; | ||
196 | + } | ||
197 | + }); | ||
198 | +}; | ||
116 | 199 | ||
117 | /** | 200 | /** |
118 | * 获取商品数据 | 201 | * 获取商品数据 |
@@ -180,9 +263,184 @@ const getClassNames = () => { | @@ -180,9 +263,184 @@ const getClassNames = () => { | ||
180 | }); | 263 | }); |
181 | }; | 264 | }; |
182 | 265 | ||
266 | +/** | ||
267 | + * 根据品牌域名获取品牌LOGO | ||
268 | + * @param {string} domain 品牌域名 | ||
269 | + * @return array | false | ||
270 | + */ | ||
271 | +const getBrandLogoByDomain = (domain) => { | ||
272 | + return api.get('', { | ||
273 | + method: 'web.brand.byDomain', | ||
274 | + domain: domain | ||
275 | + }, { | ||
276 | + cache: true | ||
277 | + }).then((result) => { | ||
278 | + if (result && result.code === 200) { | ||
279 | + if (result.data) { | ||
280 | + let formatData = camelCase(result.data); | ||
281 | + | ||
282 | + return { | ||
283 | + id: formatData.id, | ||
284 | + url: helpers.urlFormat('', null, formatData.brandDomain), | ||
285 | + thumb: helpers.image(formatData.brandIco, 75, 40), | ||
286 | + name: formatData.brandName, | ||
287 | + shopId: formatData.shopId ? formatData.shopId : 0,//店铺id | ||
288 | + type: formatData.type ? formatData.type : 0 | ||
289 | + } | ||
290 | + } else { | ||
291 | + return false; | ||
292 | + } | ||
293 | + } else { | ||
294 | + logger.error('获取品牌logo接口返回code 不是 200'); | ||
295 | + return {}; | ||
296 | + } | ||
297 | + }); | ||
298 | +}; | ||
299 | + | ||
300 | +/** | ||
301 | + * 根据brandId 获取相关店铺列表 | ||
302 | + * @param brandId | ||
303 | + * @return array | ||
304 | + */ | ||
305 | +const getBrandShops = (brandId) => { | ||
306 | + return api.get('', { | ||
307 | + method: 'app.shop.queryShopsByBrandId', | ||
308 | + brand_id: brandId | ||
309 | + }, { | ||
310 | + cache: true | ||
311 | + }).then((result) => { | ||
312 | + if (result && result.code === 200) { | ||
313 | + return _processBrandShops(result.data); | ||
314 | + } else { | ||
315 | + logger.error('根据brandId获取店铺列表接口返回code 不是 200'); | ||
316 | + return {}; | ||
317 | + } | ||
318 | + }); | ||
319 | +}; | ||
320 | + | ||
321 | +/** | ||
322 | + * 收藏 | ||
323 | + * @param {int} id 品牌ID | ||
324 | + * @param {int} uid 用户ID | ||
325 | + * @param {bool} isBrand 是品牌还是商品 | ||
326 | + * @return array | ||
327 | + */ | ||
328 | +const setFavorite = (id, uid, isBrand) => { | ||
329 | + isBrand = isBrand || true; | ||
330 | + | ||
331 | + return api.post('', { | ||
332 | + method: 'app.favorite.add', | ||
333 | + id: id, | ||
334 | + uid: uid, | ||
335 | + type: isBrand ? 'brand' : 'product' | ||
336 | + }); | ||
337 | +}; | ||
338 | + | ||
339 | +/** | ||
340 | + * 取消收藏 | ||
341 | + * | ||
342 | + * @param {int} id 品牌ID | ||
343 | + * @param {int} uid 用户ID | ||
344 | + * @param {bool} isBrand 是品牌还是商品 | ||
345 | + * @return array | ||
346 | + */ | ||
347 | +const setFavoriteCancel = (id, uid, isBrand) => { | ||
348 | + isBrand = isBrand || true; | ||
349 | + | ||
350 | + return api.post('', { | ||
351 | + method: 'app.favorite.cancel', | ||
352 | + fav_id: id, | ||
353 | + uid: uid, | ||
354 | + type: isBrand ? 'brand' : 'product' | ||
355 | + }); | ||
356 | +}; | ||
357 | + | ||
358 | +/** | ||
359 | + * 获取店铺装修的所有资源接口 | ||
360 | + * @param {int} shopId 店铺id | ||
361 | + * @return array | ||
362 | + */ | ||
363 | +const getShopDecorator = (shopId) => { | ||
364 | + return api.get('', { | ||
365 | + method: 'app.shopsdecorator.getList', | ||
366 | + shop_id: shopId | ||
367 | + }, { | ||
368 | + cache: true | ||
369 | + }).then((result) => { | ||
370 | + if (result && result.code === 200) { | ||
371 | + return camelCase(result); | ||
372 | + } else { | ||
373 | + logger.error('获取店铺装修的所有资源接口返回code 不是 200'); | ||
374 | + return {}; | ||
375 | + } | ||
376 | + }); | ||
377 | +}; | ||
378 | + | ||
379 | +/** | ||
380 | + * 获取店铺信息 | ||
381 | + * @param {int} shopId 店铺id | ||
382 | + * @param {int} uid 用户id 判断用户是否收藏店铺 | ||
383 | + * @return array | ||
384 | + */ | ||
385 | +const getShopInfo = (shopId, uid) => { | ||
386 | + return api.get('', { | ||
387 | + method: 'app.shops.getIntro', | ||
388 | + shop_id: shopId, | ||
389 | + uid: uid || 0 | ||
390 | + }).then((result) => { | ||
391 | + if (result && result.code === 200) { | ||
392 | + return camelCase(result); | ||
393 | + } else { | ||
394 | + logger.error('获取店铺信息接口返回code 不是 200'); | ||
395 | + return {}; | ||
396 | + } | ||
397 | + }); | ||
398 | +}; | ||
399 | + | ||
400 | +/** | ||
401 | + * 获取店铺下面的所有分类 | ||
402 | + * @param {int} shopId 店铺id | ||
403 | + * @return array | ||
404 | + */ | ||
405 | +const getShopCategory = (shopId, channel) => { | ||
406 | + return api.get('', { | ||
407 | + method: 'app.shop.getSortInfo', | ||
408 | + yh_channel: channel, | ||
409 | + shop_id: shopId | ||
410 | + }).then((result) => { | ||
411 | + if (result && result.code === 200) { | ||
412 | + return camelCase(result); | ||
413 | + } else { | ||
414 | + logger.error('获取店铺下面的所有分类接口返回code 不是 200'); | ||
415 | + return {}; | ||
416 | + } | ||
417 | + }); | ||
418 | +}; | ||
419 | + | ||
420 | +/** | ||
421 | + * 组织店铺页面数据 | ||
422 | + * @param {array} data 接口返回的店铺页所需数据 | ||
423 | + * @param {int} shopId 店铺id | ||
424 | + * @param {int} isAap app版本 | ||
425 | + * @return array | ||
426 | + */ | ||
427 | +const formShopData = (data, shopId, isApp) => { | ||
428 | + | ||
429 | +}; | ||
430 | + | ||
183 | module.exports = { | 431 | module.exports = { |
184 | getSearchData, | 432 | getSearchData, |
185 | getFilterData, | 433 | getFilterData, |
186 | getAllBrandNames, | 434 | getAllBrandNames, |
187 | - getClassNames | 435 | + getClassNames, |
436 | + getBrandLogoByDomain, | ||
437 | + getBrandIntro, | ||
438 | + getBrandShops, | ||
439 | + getBrandBanner, | ||
440 | + setFavorite, | ||
441 | + setFavoriteCancel, | ||
442 | + getShopDecorator, | ||
443 | + getShopInfo, | ||
444 | + getShopCategory, | ||
445 | + formShopData | ||
188 | }; | 446 | }; |
@@ -59,5 +59,7 @@ router.get('/search/list', search.list); | @@ -59,5 +59,7 @@ router.get('/search/list', search.list); | ||
59 | router.get('/search/filter', search.filter); | 59 | router.get('/search/filter', search.filter); |
60 | router.get('/search/search', search.search); | 60 | router.get('/search/search', search.search); |
61 | router.get('/index/index', search.category); | 61 | router.get('/index/index', search.category); |
62 | +router.get('/index/brand', search.brand); | ||
63 | +router.post('/opt/favoriteBrand', search.favoriteBrand); | ||
62 | 64 | ||
63 | module.exports = router; | 65 | module.exports = router; |
@@ -15,11 +15,14 @@ module.exports = { | @@ -15,11 +15,14 @@ module.exports = { | ||
15 | port: 6001, | 15 | port: 6001, |
16 | siteUrl: '//m.yohobuy.com', | 16 | siteUrl: '//m.yohobuy.com', |
17 | domains: { | 17 | domains: { |
18 | - // api: 'http://devapi.yoho.cn:58078/', | ||
19 | - // service: 'http://devservice.yoho.cn:58077/' | 18 | + //api: 'http://devapi.yoho.cn:58078/', |
19 | + //service: 'http://devservice.yoho.cn:58077/' | ||
20 | + // | ||
21 | + //api: 'http://testapi.yoho.cn:28078/', | ||
22 | + //service: 'http://testservice.yoho.cn:28077/' | ||
20 | 23 | ||
21 | - api: 'http://testapi.yoho.cn:28078/', | ||
22 | - service: 'http://testservice.yoho.cn:28077/' | 24 | + api: 'http://api.yoho.cn/', |
25 | + service: 'http://service.yoho.cn/' | ||
23 | }, | 26 | }, |
24 | subDomains: { | 27 | subDomains: { |
25 | host: '.m.yohobuy.com', | 28 | host: '.m.yohobuy.com', |
public/js/common/footer.js
0 → 100644
1 | +/** | ||
2 | + * 底部JS | ||
3 | + * @author: liangzhifeng<zhifeng.liang@yoho.cn> | ||
4 | + * @date: 2015/10/26 | ||
5 | + */ | ||
6 | + | ||
7 | +var $ = require('yoho-jquery'), | ||
8 | + Hammer = require('yoho-hammer'); | ||
9 | + | ||
10 | +var floatLayerBtnHammer; | ||
11 | + | ||
12 | +require('../common'); | ||
13 | + | ||
14 | +/** | ||
15 | + * 获取url参数 | ||
16 | + */ | ||
17 | +function getQueryString(name) { | ||
18 | + var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i'); | ||
19 | + var r = window.location.search.substr(1).match(reg); | ||
20 | + | ||
21 | + if (r != null) { | ||
22 | + return window.unescape(r[2]); | ||
23 | + } | ||
24 | + return null; | ||
25 | +} | ||
26 | + | ||
27 | +function downLoadApp() { | ||
28 | + var appUrl = 'http://union.yoho.cn/union/downapp.html'; | ||
29 | + var clickedAt = new Date(); | ||
30 | + | ||
31 | + setTimeout(function() { | ||
32 | + var mkt = getQueryString('mkt_code'); | ||
33 | + | ||
34 | + if ((new Date()) - clickedAt < 2000) { | ||
35 | + if (mkt) { | ||
36 | + appUrl += '?union_type=' + mkt; | ||
37 | + } | ||
38 | + window.location = appUrl; | ||
39 | + } | ||
40 | + }, 500); | ||
41 | +} | ||
42 | + | ||
43 | +$('#float-layer-close').on('touchend', function(e) { | ||
44 | + $('#float-layer-app').hide(); | ||
45 | + window.setCookie('_float-layer-app', 'id490655927', | ||
46 | + { | ||
47 | + domain: '.yohobuy.com' | ||
48 | + }); | ||
49 | + window.setCookie('_float-layer-app-close', 1, | ||
50 | + { | ||
51 | + domain: '.yohobuy.com', | ||
52 | + expires: 1 | ||
53 | + }); | ||
54 | + return false; | ||
55 | +}); | ||
56 | + | ||
57 | +if ($('#float-layer-btn') && $('#float-layer-btn')[0]) { | ||
58 | + floatLayerBtnHammer = new Hammer($('#float-layer-btn')[0]); | ||
59 | + floatLayerBtnHammer.on('tap', function(e) { | ||
60 | + downLoadApp('bottom'); | ||
61 | + e.srcEvent.stopPropagation(); | ||
62 | + }); | ||
63 | + | ||
64 | + if (typeof window.cookie === 'function' && !window.cookie('_float-layer-app')) { | ||
65 | + $('#float-layer-app').show(); | ||
66 | + } else { | ||
67 | + $('#float-layer-app').hide(); | ||
68 | + } | ||
69 | +} |
@@ -53,3 +53,93 @@ | @@ -53,3 +53,93 @@ | ||
53 | width: 100%; | 53 | width: 100%; |
54 | } | 54 | } |
55 | } | 55 | } |
56 | + | ||
57 | +.float-layer { | ||
58 | + height: 64PX; | ||
59 | + background: rgba(68, 68, 68, 0.95); | ||
60 | + position: fixed; | ||
61 | + width: 100%; | ||
62 | + bottom: 0; | ||
63 | + left: 0; | ||
64 | + z-index: 9999; | ||
65 | + padding: 10PX 0; | ||
66 | + | ||
67 | + .float-layer-left { | ||
68 | + padding-left: 22PX; | ||
69 | + overflow: hidden; | ||
70 | + float: left; | ||
71 | + | ||
72 | + img { | ||
73 | + height: 44PX; | ||
74 | + float: left; | ||
75 | + margin-right: 10PX; | ||
76 | + } | ||
77 | + | ||
78 | + p { | ||
79 | + float: left; | ||
80 | + font-size: 16PX; | ||
81 | + height: 44PX; | ||
82 | + line-height: 44PX; | ||
83 | + color: white; | ||
84 | + } | ||
85 | + | ||
86 | + .yoho-icon { | ||
87 | + float: left; | ||
88 | + margin-right: 10PX; | ||
89 | + font-size: 22PX; | ||
90 | + line-height: 44PX; | ||
91 | + width: 44PX; | ||
92 | + height: 44PX; | ||
93 | + text-align: center; | ||
94 | + color: #fff; | ||
95 | + border-radius: 10PX; | ||
96 | + background-image: linear-gradient(#323232, #0f0f0f); | ||
97 | + } | ||
98 | + } | ||
99 | + | ||
100 | +} | ||
101 | + | ||
102 | +#float-layer-close { | ||
103 | + position: absolute; | ||
104 | + left: 0; | ||
105 | + top: 0; | ||
106 | + width: 50PX; | ||
107 | + height: 50PX; | ||
108 | + | ||
109 | + .close-icon { | ||
110 | + position: absolute; | ||
111 | + left: 0; | ||
112 | + top: 0; | ||
113 | + color: #C0C0C0; | ||
114 | + z-index: 2; | ||
115 | + } | ||
116 | +} | ||
117 | + | ||
118 | +#float-layer-btn { | ||
119 | + position: absolute; | ||
120 | + top: 50%; | ||
121 | + right: 15PX; | ||
122 | + font-size: 16PX; | ||
123 | + padding: 0 10PX; | ||
124 | + height: 27PX; | ||
125 | + line-height: 27PX; | ||
126 | + background: white; | ||
127 | + border-radius: 5PX; | ||
128 | + margin-top: -13PX; | ||
129 | + -webkit-tap-highlight-color: rgba(0, 0, 0, 0.5); | ||
130 | + &:link, | ||
131 | + &:visited, | ||
132 | + &:hover, | ||
133 | + &:active { | ||
134 | + color: #000; | ||
135 | + } | ||
136 | +} | ||
137 | + | ||
138 | +.circle-rightbottom { | ||
139 | + position: absolute; | ||
140 | + width: 25PX; | ||
141 | + height: 0PX; | ||
142 | + border: 0 solid #323232; | ||
143 | + border-bottom: 25PX solid #323232; | ||
144 | + border-radius: 0 0 25PX 0; | ||
145 | +} |
-
Please register or login to post a comment