Showing
67 changed files
with
194 additions
and
437 deletions
@@ -10,7 +10,6 @@ const logger = global.yoho.logger; | @@ -10,7 +10,6 @@ const logger = global.yoho.logger; | ||
10 | const yohoHelpers = global.yoho.helpers; | 10 | const yohoHelpers = global.yoho.helpers; |
11 | const service = require('../models/cart-service'); | 11 | const service = require('../models/cart-service'); |
12 | const helper = require('../models/cart-helper'); | 12 | const helper = require('../models/cart-helper'); |
13 | -const ghelper = require('../../guang/models/guang-helper'); | ||
14 | const simpleHeaderModel = require('../../../doraemon/models/simple-header'); | 13 | const simpleHeaderModel = require('../../../doraemon/models/simple-header'); |
15 | 14 | ||
16 | const stepper = [ | 15 | const stepper = [ |
1 | +/* eslint-disable */ | ||
1 | module.exports = { | 2 | module.exports = { |
2 | '北京市': 'b', | 3 | '北京市': 'b', |
3 | '天津市': 't', | 4 | '天津市': 't', |
@@ -31,3 +32,4 @@ module.exports = { | @@ -31,3 +32,4 @@ module.exports = { | ||
31 | '宁夏回族自治区': 'n', | 32 | '宁夏回族自治区': 'n', |
32 | '新疆维吾尔自治区': 'x' | 33 | '新疆维吾尔自治区': 'x' |
33 | }; | 34 | }; |
35 | +/* eslint-enable */ |
@@ -36,7 +36,8 @@ exports.QRcode = (req, res, next) => { | @@ -36,7 +36,8 @@ exports.QRcode = (req, res, next) => { | ||
36 | } | 36 | } |
37 | 37 | ||
38 | let vm = { | 38 | let vm = { |
39 | - path: [{href: helpers.urlFormat('/'), name: 'YOHO!BUY 有货首页'}, {name: '个人中心'}, {name: '订单中心'}, {name: '查看二维码'}], | 39 | + path: [{href: helpers.urlFormat('/'), name: 'YOHO!BUY 有货首页'}, |
40 | + {name: '个人中心'}, {name: '订单中心'}, {name: '查看二维码'}], | ||
40 | qrcodeData: result, | 41 | qrcodeData: result, |
41 | code: id, | 42 | code: id, |
42 | bgsrc: bg[bgkey], | 43 | bgsrc: bg[bgkey], |
apps/home/models/HelperHome.js
deleted
100644 → 0
1 | -/** | ||
2 | - * @author: weiqingting<qingting.wei@yoho.cn> | ||
3 | - */ | ||
4 | -'use strict'; | ||
5 | - | ||
6 | -const helpers = global.yoho.helpers; | ||
7 | -const Images = require('../../../utils/Images'); | ||
8 | - | ||
9 | -const formatFavBrand = (brandInfo, i)=>{ | ||
10 | - i = i || 10; | ||
11 | - let hotBrands = []; | ||
12 | - if (brandInfo.length > 0) { | ||
13 | - for (let i = 0; i < brandInfo.length; i++) { | ||
14 | - let value = brandInfo[i]; | ||
15 | - if (value.is_hot && value.is_hot == 'Y') { | ||
16 | - hotBrands.push({ | ||
17 | - 'href': helpers.urlFormat('', '', value['brand_domain']), | ||
18 | - 'logo': Images.getSourceUrl(value['brand_ico'], 'brandLogo'), | ||
19 | - 'name': value.brand_name | ||
20 | - }); | ||
21 | - i--; | ||
22 | - } | ||
23 | - if (i <= 0) { | ||
24 | - break; | ||
25 | - } | ||
26 | - } | ||
27 | - } | ||
28 | - return hotBrands; | ||
29 | -}; | ||
30 | -const formatNew = (product)=>{ | ||
31 | - let result = []; | ||
32 | - product.forEach(function(val, key) { | ||
33 | - result[key] = { | ||
34 | - href: helpers.getUrlBySkc(val['product_id'], val['goods_list'][0]['product_skc'], val['cn_alphabet']), | ||
35 | - thumb: val['default_images'] ? Images.getImageUrl(val['default_images'], 400, 500) : '', | ||
36 | - name: val['product_name'], | ||
37 | - price: val['sales_price'] | ||
38 | - }; | ||
39 | - }); | ||
40 | - return result; | ||
41 | -}; | ||
42 | - | ||
43 | -module.exports = { | ||
44 | - formatFavBrand, | ||
45 | - formatNew | ||
46 | -}; |
apps/home/models/SearchData.js
deleted
100644 → 0
1 | -/** | ||
2 | - * @author: weiqingting<qingting.wei@yoho.cn> | ||
3 | - */ | ||
4 | -'use strict'; | ||
5 | - | ||
6 | -const querystring = require('querystring'); | ||
7 | -const searchApi = global.yoho.SearchAPI; | ||
8 | - | ||
9 | - | ||
10 | -const getUrl = (type)=>{ | ||
11 | - var map = { | ||
12 | - sort: '/sortgroup.json', | ||
13 | - discount: '/discount.json', | ||
14 | - recent: '/recent.json', | ||
15 | - suggest: '/suggest.json', | ||
16 | - 'new-shelve': '/new-shelve.json', | ||
17 | - shop: '/shops.json', | ||
18 | - brand: '/brand/list.json' | ||
19 | - }; | ||
20 | - return map[type] || '/search.json'; | ||
21 | -}; | ||
22 | - | ||
23 | -const getBrandListUrl = ()=>{ | ||
24 | - return getUrl('brand'); | ||
25 | -}; | ||
26 | -const getProductUrl = (condition, type)=>{ | ||
27 | - let orderMaps = { | ||
28 | - s_t_desc: 'shelve_time:desc', | ||
29 | - s_t_asc: 'shelve_time:asc', | ||
30 | - s_p_asc: 'sales_price:asc', | ||
31 | - s_p_desc: 'sales_price:desc', | ||
32 | - p_d_desc: 'discount:desc', | ||
33 | - p_d_asc: 'discount:asc', | ||
34 | - skn_desc: 'product_skn:desc', | ||
35 | - skn_asc: 'product_skn:asc', | ||
36 | - activities_desc: 'activities.order_by:desc', | ||
37 | - activities_asc: 'activities.order_by:asc', | ||
38 | - s_n_asc: 'sales_num:asc', | ||
39 | - s_n_desc: 'sales_num:desc', | ||
40 | - activities_id_desc: 'activities.activity_id:desc', | ||
41 | - activities_id_asc: 'activities.activity_id:asc', | ||
42 | - brand_desc: 'brand_weight:desc' | ||
43 | - }; | ||
44 | - let param = { | ||
45 | - status: 1, | ||
46 | - sales: 'Y', | ||
47 | - outlets: 2, | ||
48 | - stocknumber: 1, | ||
49 | - attribute_not: 2 | ||
50 | - }; | ||
51 | - if (!condition.order) { | ||
52 | - param.order = orderMaps.s_t_desc; | ||
53 | - } else { | ||
54 | - param.order = orderMaps[condition.order] ? orderMaps[condition.order] : ''; | ||
55 | - } | ||
56 | - if (!condition.page) { | ||
57 | - param.page = 1; | ||
58 | - } | ||
59 | - if (condition.viewNum) { | ||
60 | - param.viewNum = condition.viewNum; | ||
61 | - } else if (!condition.limit) { | ||
62 | - param.viewNum = 60; | ||
63 | - } else { | ||
64 | - param.viewNum = condition.limit; | ||
65 | - delete condition.limit; | ||
66 | - } | ||
67 | - if (!condition) { | ||
68 | - param += condition; | ||
69 | - } | ||
70 | - return getUrl(type) + '?' + querystring.stringify(param);// searchApi.get(getUrl(type), param,{cache:true}); | ||
71 | -}; | ||
72 | - | ||
73 | -const searchAll = (param)=>{ | ||
74 | - param = param || {}; | ||
75 | - return searchApi.get(getUrl(type), param, {cache: true}); | ||
76 | -}; | ||
77 | - | ||
78 | -module.exports = { | ||
79 | - getProductUrl, | ||
80 | - getBrandListUrl, | ||
81 | - searchAll | ||
82 | -}; |
@@ -4,19 +4,18 @@ const api = global.yoho.API; | @@ -4,19 +4,18 @@ const api = global.yoho.API; | ||
4 | const service = global.yoho.ServiceAPI; | 4 | const service = global.yoho.ServiceAPI; |
5 | const _ = require('lodash'); | 5 | const _ = require('lodash'); |
6 | 6 | ||
7 | -const URL_PRODUCT_FAVORITE = 'shops/service/v1/favorite/'; | 7 | +// const URL_PRODUCT_FAVORITE = 'shops/service/v1/favorite/'; |
8 | const URL_ARTICLE_FAVORITE = '/guang/api/v1/favorite/'; | 8 | const URL_ARTICLE_FAVORITE = '/guang/api/v1/favorite/'; |
9 | -const URL_ARTICLE_FAVORITE_BRAND = '/guang/service/v2/favorite/toggleBrand'; | 9 | + |
10 | +// const URL_ARTICLE_FAVORITE_BRAND = '/guang/service/v2/favorite/toggleBrand'; | ||
10 | 11 | ||
11 | /** | 12 | /** |
12 | * 根据uid和商品的id查询是否被用户收藏 | 13 | * 根据uid和商品的id查询是否被用户收藏 |
13 | * @param int $uid | 14 | * @param int $uid |
14 | * @param int $productId | 15 | * @param int $productId |
15 | - * @param boolean $isOnlyUrl 是否指返回链接 | ||
16 | * @return boolean 收藏 true 未收藏 false | 16 | * @return boolean 收藏 true 未收藏 false |
17 | */ | 17 | */ |
18 | -const getUidProductFav = (uid, productId, isOnlyUrl)=> { | ||
19 | - isOnlyUrl = (isOnlyUrl === undefined) ? false : isOnlyUrl; | 18 | +const getUidProductFav = (uid, productId)=> { |
20 | let options = { | 19 | let options = { |
21 | method: 'web.favorite.isFavorite', | 20 | method: 'web.favorite.isFavorite', |
22 | id: productId, | 21 | id: productId, |
@@ -84,6 +84,7 @@ exports.getTicketCode = (orderCode)=>{ | @@ -84,6 +84,7 @@ exports.getTicketCode = (orderCode)=>{ | ||
84 | method: 'app.SpaceOrders.getQrByOrderCode', | 84 | method: 'app.SpaceOrders.getQrByOrderCode', |
85 | order_code: orderCode | 85 | order_code: orderCode |
86 | }; | 86 | }; |
87 | + | ||
87 | return api.get('', options); | 88 | return api.get('', options); |
88 | }; | 89 | }; |
89 | 90 | ||
@@ -132,6 +133,7 @@ exports.updateOrderPayment = (orderCode, payment, uid)=>{ | @@ -132,6 +133,7 @@ exports.updateOrderPayment = (orderCode, payment, uid)=>{ | ||
132 | payment: payment, | 133 | payment: payment, |
133 | uid: uid | 134 | uid: uid |
134 | }; | 135 | }; |
136 | + | ||
135 | return api.get('', options); | 137 | return api.get('', options); |
136 | }; | 138 | }; |
137 | 139 |
1 | 'use strict'; | 1 | 'use strict'; |
2 | -const helpers = global.yoho.helpers; | ||
3 | const api = global.yoho.API; | 2 | const api = global.yoho.API; |
4 | 3 | ||
5 | /** | 4 | /** |
@@ -11,6 +10,7 @@ const getRedenvelopes = uid=>{ | @@ -11,6 +10,7 @@ const getRedenvelopes = uid=>{ | ||
11 | method: 'app.yoho.redpacketList', | 10 | method: 'app.yoho.redpacketList', |
12 | uid: uid | 11 | uid: uid |
13 | }; | 12 | }; |
13 | + | ||
14 | return api.get('', options); | 14 | return api.get('', options); |
15 | }; | 15 | }; |
16 | 16 | ||
@@ -23,6 +23,7 @@ const getRedenvelopesTotal = uid=>{ | @@ -23,6 +23,7 @@ const getRedenvelopesTotal = uid=>{ | ||
23 | method: 'app.yoho.redpacketInfo', | 23 | method: 'app.yoho.redpacketInfo', |
24 | uid: uid | 24 | uid: uid |
25 | }; | 25 | }; |
26 | + | ||
26 | return api.get('', options); | 27 | return api.get('', options); |
27 | }; | 28 | }; |
28 | 29 |
@@ -2,20 +2,13 @@ | @@ -2,20 +2,13 @@ | ||
2 | 2 | ||
3 | const api = global.yoho.API; | 3 | const api = global.yoho.API; |
4 | 4 | ||
5 | -const privateKeyList = { | ||
6 | - 'android': 'fd4ad5fcfa0de589ef238c0e7331b585', | ||
7 | - 'iphone': 'a85bb0674e08986c6b115d5e3a4884fa', | ||
8 | - 'ipad': 'ad9fcda2e679cf9229e37feae2cdcf80', | ||
9 | - 'web': '0ed29744ed318fd28d2c07985d3ba633', | ||
10 | - 'h5': 'fd4ad5fcfa0de589ef238c0e7331b585' | ||
11 | -}; | ||
12 | - | ||
13 | const getVIPInfoByUid = (uid)=>{ | 5 | const getVIPInfoByUid = (uid)=>{ |
14 | let options = { | 6 | let options = { |
15 | method: 'app.passport.vip', | 7 | method: 'app.passport.vip', |
16 | uid: uid, | 8 | uid: uid, |
17 | private_key: '0ed29744ed318fd28d2c07985d3ba633' | 9 | private_key: '0ed29744ed318fd28d2c07985d3ba633' |
18 | }; | 10 | }; |
11 | + | ||
19 | return api.get('', options); | 12 | return api.get('', options); |
20 | }; | 13 | }; |
21 | 14 | ||
@@ -31,6 +24,7 @@ const getCouponsList = (uid, type, page, limit)=>{ | @@ -31,6 +24,7 @@ const getCouponsList = (uid, type, page, limit)=>{ | ||
31 | page: page, | 24 | page: page, |
32 | limit: limit | 25 | limit: limit |
33 | }; | 26 | }; |
27 | + | ||
34 | return api.get('', options); | 28 | return api.get('', options); |
35 | }; | 29 | }; |
36 | 30 |
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | */ | 3 | */ |
4 | 4 | ||
5 | 'use strict'; | 5 | 'use strict'; |
6 | -const _ =require('lodash'); | 6 | +const _ = require('lodash'); |
7 | 7 | ||
8 | const captchaService = require('../models/captcha-img-service'); | 8 | const captchaService = require('../models/captcha-img-service'); |
9 | const gtestCaptcha = require('./gee-captcha'); | 9 | const gtestCaptcha = require('./gee-captcha'); |
@@ -11,7 +11,6 @@ const co = Promise.coroutine; | @@ -11,7 +11,6 @@ const co = Promise.coroutine; | ||
11 | const _ = require('lodash'); | 11 | const _ = require('lodash'); |
12 | const Fn = require('lodash/fp'); | 12 | const Fn = require('lodash/fp'); |
13 | const cheerio = require('cheerio'); | 13 | const cheerio = require('cheerio'); |
14 | -const url = require('url'); | ||
15 | const helpers = global.yoho.helpers; | 14 | const helpers = global.yoho.helpers; |
16 | const config = global.yoho.config; | 15 | const config = global.yoho.config; |
17 | const crypto = global.yoho.crypto; | 16 | const crypto = global.yoho.crypto; |
@@ -94,7 +94,7 @@ const setSearchData = (result, params, channel) => { | @@ -94,7 +94,7 @@ const setSearchData = (result, params, channel) => { | ||
94 | finalResult.criteo = {skn: searchHandler.getCriteo(_.get(finalResult.search, 'goods'))}; | 94 | finalResult.criteo = {skn: searchHandler.getCriteo(_.get(finalResult.search, 'goods'))}; |
95 | } | 95 | } |
96 | return finalResult; | 96 | return finalResult; |
97 | -} | 97 | +}; |
98 | 98 | ||
99 | /** | 99 | /** |
100 | * 转换价格 | 100 | * 转换价格 |
@@ -144,10 +144,10 @@ exports.getSearchData = (params, channel) => { | @@ -144,10 +144,10 @@ exports.getSearchData = (params, channel) => { | ||
144 | return searchApi.getSortList(Object.assign({}, searchParams, {msort: '', | 144 | return searchApi.getSortList(Object.assign({}, searchParams, {msort: '', |
145 | query: _.get(result, '[2]data.suggestion.terms_suggestion[0]', ''), | 145 | query: _.get(result, '[2]data.suggestion.terms_suggestion[0]', ''), |
146 | misort: '', sort: ''})).then(subRes => { | 146 | misort: '', sort: ''})).then(subRes => { |
147 | - result[1] = subRes; | 147 | + result[1] = subRes; |
148 | 148 | ||
149 | - return setSearchData(result, params, channel); | ||
150 | - }); | 149 | + return setSearchData(result, params, channel); |
150 | + }); | ||
151 | } | 151 | } |
152 | 152 | ||
153 | return setSearchData(result, params, channel); | 153 | return setSearchData(result, params, channel); |
@@ -294,8 +294,8 @@ exports.getSearchLessProduct = (channelNum, uid, udid, page) => { | @@ -294,8 +294,8 @@ exports.getSearchLessProduct = (channelNum, uid, udid, page) => { | ||
294 | img: it.default_images ? helpers.image(it.default_images, 180, 240) : '', | 294 | img: it.default_images ? helpers.image(it.default_images, 180, 240) : '', |
295 | alt: it.product_name, | 295 | alt: it.product_name, |
296 | price: '¥' + transPrice(it.sales_price), | 296 | price: '¥' + transPrice(it.sales_price), |
297 | - marketPrice: transPrice(it.market_price) === transPrice(it.sales_price) | ||
298 | - ? false : ('¥' + transPrice(it.market_price)) | 297 | + marketPrice: transPrice(it.market_price) === transPrice(it.sales_price) ? |
298 | + false : ('¥' + transPrice(it.market_price)) | ||
299 | }; | 299 | }; |
300 | 300 | ||
301 | let firstGoods = it.goods_list && it.goods_list[0]; | 301 | let firstGoods = it.goods_list && it.goods_list[0]; |
@@ -52,33 +52,7 @@ const _shopTopBanner = data => { | @@ -52,33 +52,7 @@ const _shopTopBanner = data => { | ||
52 | return result; | 52 | return result; |
53 | }; | 53 | }; |
54 | 54 | ||
55 | -/** | ||
56 | - * 水牌 | ||
57 | - */ | ||
58 | -const _signboard = data => { | ||
59 | - let result = []; | ||
60 | - let resources = data.resource_data; | ||
61 | - | ||
62 | - resources.forEach(resource => { | ||
63 | - if (_.isEmpty(resource)) { | ||
64 | - return; | ||
65 | - } | ||
66 | - | ||
67 | - resource.data.forEach(val => { | ||
68 | - result.push({ | ||
69 | - img: _imageView2(val.src, 160, 240), | ||
70 | - url: val.url | ||
71 | - }); | ||
72 | - }); | ||
73 | - }); | ||
74 | - | ||
75 | - return { | ||
76 | - title: '', | ||
77 | - list: result | ||
78 | - }; | ||
79 | -}; | ||
80 | - | ||
81 | -const _shopTopBanner_base = _shopTopBanner; | 55 | +const _shopTopBannerBase = _shopTopBanner; |
82 | 56 | ||
83 | /** | 57 | /** |
84 | * 基础模板 | 58 | * 基础模板 |
@@ -87,7 +61,7 @@ exports.basisTemplateAsync = shopId => { | @@ -87,7 +61,7 @@ exports.basisTemplateAsync = shopId => { | ||
87 | return co(function * () { | 61 | return co(function * () { |
88 | let data = { shopTopBanner_base: {}}; | 62 | let data = { shopTopBanner_base: {}}; |
89 | const ResourceHandler = { | 63 | const ResourceHandler = { |
90 | - shopTopBanner_base: _shopTopBanner_base | 64 | + shopTopBanner_base: _shopTopBannerBase |
91 | }; | 65 | }; |
92 | let shops = yield api.shopsDecoratorListAsync(shopId); | 66 | let shops = yield api.shopsDecoratorListAsync(shopId); |
93 | 67 |
@@ -68,21 +68,21 @@ exports.studentsNum = (data) => { | @@ -68,21 +68,21 @@ exports.studentsNum = (data) => { | ||
68 | exports.studentResource = (data) => { | 68 | exports.studentResource = (data) => { |
69 | let dest = {couponObj: {}}; | 69 | let dest = {couponObj: {}}; |
70 | let rightsTextObj = [{ | 70 | let rightsTextObj = [{ |
71 | - rightName: '认证立赠100有货币', | ||
72 | - rightContent: '认证成功,立即赠送100有货币。' | ||
73 | - },{ | ||
74 | - rightName: '新品立享9折', | ||
75 | - rightContent: '学生购买指定原价新品时,可立即享受9折优惠,此折扣与VIP折扣不可同时享受。' | ||
76 | - },{ | ||
77 | - rightName: '每1元返1个有货币', | ||
78 | - rightContent: '学生购买指定商品时,每1元返1个有货币(以商品的实际成交金额计算);<br>' + | 71 | + rightName: '认证立赠100有货币', |
72 | + rightContent: '认证成功,立即赠送100有货币。' | ||
73 | + }, { | ||
74 | + rightName: '新品立享9折', | ||
75 | + rightContent: '学生购买指定原价新品时,可立即享受9折优惠,此折扣与VIP折扣不可同时享受。' | ||
76 | + }, { | ||
77 | + rightName: '每1元返1个有货币', | ||
78 | + rightContent: '学生购买指定商品时,每1元返1个有货币(以商品的实际成交金额计算);<br>' + | ||
79 | '有货币返还时间:确认收货7日后,系统自动将对应数量的有货币返还至购买账户;<br>' + | 79 | '有货币返还时间:确认收货7日后,系统自动将对应数量的有货币返还至购买账户;<br>' + |
80 | '有货币有效期:获得当日至次年12月31日,逾期自动作废;<br>' + | 80 | '有货币有效期:获得当日至次年12月31日,逾期自动作废;<br>' + |
81 | '查看有货币:登录后,点击“个人中心”在“我的有货币”中可以查看有货币余额及明细。' | 81 | '查看有货币:登录后,点击“个人中心”在“我的有货币”中可以查看有货币余额及明细。' |
82 | - },{ | ||
83 | - rightName: '分期付款', | ||
84 | - rightContent: '开通有货分期后,可享受部分商品30天延后付款,最长6个月的分期付款,开启任性购物模式。' | ||
85 | - }]; | 82 | + }, { |
83 | + rightName: '分期付款', | ||
84 | + rightContent: '开通有货分期后,可享受部分商品30天延后付款,最长6个月的分期付款,开启任性购物模式。' | ||
85 | + }]; | ||
86 | 86 | ||
87 | _.forEach(data, (value) => { | 87 | _.forEach(data, (value) => { |
88 | switch (value.template_name) { | 88 | switch (value.template_name) { |
1 | +/* eslint-disable */ | ||
1 | // 在这个文件中配置 DNS 预读域名 | 2 | // 在这个文件中配置 DNS 预读域名 |
2 | - | ||
3 | module.exports = { | 3 | module.exports = { |
4 | 'file.static.yhbimg.com': 'qfile.static.yhbimg.com', | 4 | 'file.static.yhbimg.com': 'qfile.static.yhbimg.com', |
5 | 'static.yohobuy.com': 'qstatic.yohobuy.com', | 5 | 'static.yohobuy.com': 'qstatic.yohobuy.com', |
@@ -15,4 +15,4 @@ module.exports = { | @@ -15,4 +15,4 @@ module.exports = { | ||
15 | 'img13.static.yhbimg.com': 'qyhb02.static.yhbimg.com', | 15 | 'img13.static.yhbimg.com': 'qyhb02.static.yhbimg.com', |
16 | 'cdn.yoho.cn': 'qcdn.yoho.cn' | 16 | 'cdn.yoho.cn': 'qcdn.yoho.cn' |
17 | }; | 17 | }; |
18 | - | 18 | +/* eslint-enable */ |
@@ -22,6 +22,7 @@ module.exports = [ | @@ -22,6 +22,7 @@ module.exports = [ | ||
22 | origin: '/product/sale/?msort=10', | 22 | origin: '/product/sale/?msort=10', |
23 | target: helpers.urlFormat('/product/lifestyle-sale/') | 23 | target: helpers.urlFormat('/product/lifestyle-sale/') |
24 | }, | 24 | }, |
25 | + | ||
25 | // 商品详情页老链接,形试一 | 26 | // 商品详情页老链接,形试一 |
26 | { | 27 | { |
27 | type: TYPE.redirect, | 28 | type: TYPE.redirect, |
@@ -5,9 +5,11 @@ const logger = global.yoho.logger; | @@ -5,9 +5,11 @@ const logger = global.yoho.logger; | ||
5 | const ip = require('./rules/ip-list'); | 5 | const ip = require('./rules/ip-list'); |
6 | const userAgent = require('./rules/useragent'); | 6 | const userAgent = require('./rules/useragent'); |
7 | const qpsLimiter = require('./rules/qps-limit'); | 7 | const qpsLimiter = require('./rules/qps-limit'); |
8 | -const fakerLimiter = require('./rules/faker-limit'); | 8 | + |
9 | +// const fakerLimiter = require('./rules/faker-limit'); | ||
9 | const captchaPolicy = require('./policies/captcha'); | 10 | const captchaPolicy = require('./policies/captcha'); |
10 | -const reporterPolicy = require('./policies/reporter'); | 11 | + |
12 | +// const reporterPolicy = require('./policies/reporter'); | ||
11 | 13 | ||
12 | const IP_WHITE_LIST = [ | 14 | const IP_WHITE_LIST = [ |
13 | '106.38.38.146', | 15 | '106.38.38.146', |
@@ -25,7 +25,7 @@ function urlJoin(a, b) { | @@ -25,7 +25,7 @@ function urlJoin(a, b) { | ||
25 | module.exports = (limiter, policy) => { | 25 | module.exports = (limiter, policy) => { |
26 | const req = limiter.req, | 26 | const req = limiter.req, |
27 | res = limiter.res, | 27 | res = limiter.res, |
28 | - next = limiter.next; | 28 | + next = limiter.next; // eslint-disable-line |
29 | 29 | ||
30 | const key = `pc:limiter:${limiter.remoteIp}`; | 30 | const key = `pc:limiter:${limiter.remoteIp}`; |
31 | 31 | ||
@@ -45,7 +45,7 @@ module.exports = (limiter, policy) => { | @@ -45,7 +45,7 @@ module.exports = (limiter, policy) => { | ||
45 | } | 45 | } |
46 | 46 | ||
47 | if (pageIncr > 0) { | 47 | if (pageIncr > 0) { |
48 | - cache.incr(key, pageIncr, (err) => {}); | 48 | + cache.incr(key, pageIncr, (err) => {}); // eslint-disable-line |
49 | } | 49 | } |
50 | }); | 50 | }); |
51 | 51 |
@@ -6,9 +6,6 @@ const logger = global.yoho.logger; | @@ -6,9 +6,6 @@ const logger = global.yoho.logger; | ||
6 | 6 | ||
7 | 7 | ||
8 | module.exports = (limiter, policy) => { | 8 | module.exports = (limiter, policy) => { |
9 | - const req = limiter.req, | ||
10 | - res = limiter.res, | ||
11 | - next = limiter.next; | ||
12 | const blackKey = 'pc:limiter:ua:black', | 9 | const blackKey = 'pc:limiter:ua:black', |
13 | whiteKey = 'pc:limiter:ua:white'; | 10 | whiteKey = 'pc:limiter:ua:white'; |
14 | 11 |
@@ -16,5 +16,5 @@ $qrcodeImg.qrcode({ | @@ -16,5 +16,5 @@ $qrcodeImg.qrcode({ | ||
16 | }); | 16 | }); |
17 | 17 | ||
18 | $qrcodeActivity.mouseenter(function() { | 18 | $qrcodeActivity.mouseenter(function() { |
19 | - _hmt.push(['_trackEvent', '二维码', '活动页', 'id', $(this).attr('data-id')]); | 19 | + window._hmt.push(['_trackEvent', '二维码', '活动页', 'id', $(this).attr('data-id')]); |
20 | }); | 20 | }); |
@@ -7,8 +7,6 @@ | @@ -7,8 +7,6 @@ | ||
7 | var $ = require('yoho-jquery'), | 7 | var $ = require('yoho-jquery'), |
8 | lazyLoad = require('yoho-jquery-lazyload'); | 8 | lazyLoad = require('yoho-jquery-lazyload'); |
9 | 9 | ||
10 | -var Handlebars = require('yoho-handlebars'); | ||
11 | - | ||
12 | var $tabs = $('.brands-tabs'); | 10 | var $tabs = $('.brands-tabs'); |
13 | var $list = $('.brands-list'); | 11 | var $list = $('.brands-list'); |
14 | var $gory = $('.brands-category'); | 12 | var $gory = $('.brands-category'); |
@@ -4,11 +4,12 @@ | @@ -4,11 +4,12 @@ | ||
4 | 4 | ||
5 | var $ = require('yoho-jquery'), | 5 | var $ = require('yoho-jquery'), |
6 | dialog = require('../common/dialog'), | 6 | dialog = require('../common/dialog'), |
7 | - Alert = dialog.Alert, | 7 | + cartListTpl = require('mix/cart/cart-list.hbs'); |
8 | + | ||
9 | +var Alert = dialog.Alert, | ||
8 | CART_ITEM_DEL_URL = '/cart/cart/remove', | 10 | CART_ITEM_DEL_URL = '/cart/cart/remove', |
9 | CART_ITEM_FAV_URL = '/cart/cart/fav', | 11 | CART_ITEM_FAV_URL = '/cart/cart/fav', |
10 | - cartItemNumChg, | ||
11 | - cartListTpl = require('mix/cart/cart-list.hbs'); | 12 | + cartItemNumChg; |
12 | 13 | ||
13 | // 设置全选按钮的状态 | 14 | // 设置全选按钮的状态 |
14 | function isCheckAll() { | 15 | function isCheckAll() { |
@@ -3,8 +3,10 @@ | @@ -3,8 +3,10 @@ | ||
3 | var cdnDomains = require('../../../../config/dns-prefetch'); | 3 | var cdnDomains = require('../../../../config/dns-prefetch'); |
4 | 4 | ||
5 | function cdnReplace(cdn, imgUrl) { | 5 | function cdnReplace(cdn, imgUrl) { |
6 | + var key; | ||
7 | + | ||
6 | if (cdn === 'qcloud') { | 8 | if (cdn === 'qcloud') { |
7 | - for (var key in cdnDomains) { | 9 | + for (key in cdnDomains) { |
8 | if (imgUrl.indexOf(key) >= 0) { | 10 | if (imgUrl.indexOf(key) >= 0) { |
9 | imgUrl = imgUrl.replace(key, cdnDomains[key]); | 11 | imgUrl = imgUrl.replace(key, cdnDomains[key]); |
10 | } | 12 | } |
@@ -15,12 +17,13 @@ function cdnReplace(cdn, imgUrl) { | @@ -15,12 +17,13 @@ function cdnReplace(cdn, imgUrl) { | ||
15 | 17 | ||
16 | module.exports = function(imageUrl, opts) { | 18 | module.exports = function(imageUrl, opts) { |
17 | var cdn = window.cdn; | 19 | var cdn = window.cdn; |
20 | + var params, urls, query, uri; | ||
18 | 21 | ||
19 | if (imageUrl) { | 22 | if (imageUrl) { |
20 | - var params = opts.hash; | ||
21 | - var urls = imageUrl.split('?'); | ||
22 | - var query = urls[1] || ''; | ||
23 | - var uri = urls[0]; | 23 | + params = opts.hash; |
24 | + urls = imageUrl.split('?'); | ||
25 | + query = urls[1] || ''; | ||
26 | + uri = urls[0]; | ||
24 | 27 | ||
25 | if (uri.indexOf('http:') === 0) { | 28 | if (uri.indexOf('http:') === 0) { |
26 | uri = uri.replace('http:', ''); | 29 | uri = uri.replace('http:', ''); |
@@ -29,7 +32,8 @@ module.exports = function(imageUrl, opts) { | @@ -29,7 +32,8 @@ module.exports = function(imageUrl, opts) { | ||
29 | uri = cdnReplace(cdn, uri); | 32 | uri = cdnReplace(cdn, uri); |
30 | 33 | ||
31 | if (query) { | 34 | if (query) { |
32 | - query = query.replace(/{width}/g, params.w).replace(/{height}/g, params.h).replace(/{mode}/g, (params.mode || 2)); | 35 | + query = query.replace(/{width}/g, params.w).replace(/{height}/g, params.h).replace(/{mode}/g, |
36 | + (params.mode || 2)); | ||
33 | 37 | ||
34 | if (query.indexOf('imageView2') === 0) { | 38 | if (query.indexOf('imageView2') === 0) { |
35 | if (params.q && query.indexOf('/q/') > 0) { | 39 | if (params.q && query.indexOf('/q/') > 0) { |
public/js/common/search.js
deleted
100644 → 0
1 | -/** | ||
2 | - * 公共头部 | ||
3 | - * @author: gxh<xuhui.ge@yoho.cn> | ||
4 | - * @date: 2017/02/27 | ||
5 | - */ | ||
6 | -var $ = require('yoho-jquery'), | ||
7 | - handlebars = require('yoho-handlebars'); | ||
8 | - | ||
9 | -var $head = $('.head-wrapper'), | ||
10 | - $searchForm = $('#search-form'), // 头部搜索栏 | ||
11 | - $searchKey = $searchForm.find('.search-key'), | ||
12 | - $searchSug = $head.find('.search-suggest'); | ||
13 | - | ||
14 | -var defaultSearch = $('#defaultsearch').val() || ''; | ||
15 | - | ||
16 | -// 搜索历史提示 | ||
17 | -function searchSuggest(key) { | ||
18 | - var param = { | ||
19 | - return_type: 'jsonp', | ||
20 | - keyword: key | ||
21 | - }; | ||
22 | - | ||
23 | - $.getJSON('//search.yohobuy.com/product/search/suggest?callback=?', param, function(jsonData) { | ||
24 | - var searchSuggestHtml; | ||
25 | - | ||
26 | - if (jsonData.code === 200) { | ||
27 | - if (jsonData.data && jsonData.data.length) { | ||
28 | - searchSuggestHtml = handlebars.compile($('#search-suggest-tml').html() || ''); | ||
29 | - $searchSug.html(searchSuggestHtml(jsonData)).show(); | ||
30 | - } else { | ||
31 | - $searchSug.hide(); | ||
32 | - } | ||
33 | - } | ||
34 | - }); | ||
35 | -} | ||
36 | - | ||
37 | -function submitSearch() { | ||
38 | - var searchKey = $searchKey.val(); | ||
39 | - | ||
40 | - searchKey = $.trim(searchKey.toLowerCase()); | ||
41 | - | ||
42 | - if (reg.test(searchKey) && searchKey !== '') { | ||
43 | - location.href = 'http://search.yohobuy.com/error?query=' + searchKey; | ||
44 | - } else { | ||
45 | - if (searchKey === '') { | ||
46 | - $('#query-key').val(defaultSearch); | ||
47 | - } | ||
48 | - $searchForm.submit(); | ||
49 | - } | ||
50 | -} | ||
51 | - | ||
52 | -$searchKey.keyup(function(e) { | ||
53 | - var val = $.trim($(this).val()), | ||
54 | - $child = $searchSug.find('li'), | ||
55 | - $act = $searchSug.find('.action'), | ||
56 | - $focus; | ||
57 | - | ||
58 | - if (e.which > 36 && e.which < 41) { | ||
59 | - | ||
60 | - if (e.which === 38) { | ||
61 | - $focus = $act.prev(); | ||
62 | - if (!$act.length || !$focus.length) { | ||
63 | - $focus = $child.eq($child.length - 1); | ||
64 | - } | ||
65 | - } else if (e.which === 40) { | ||
66 | - $focus = $act.next(); | ||
67 | - if (!$act.length || !$focus.length) { | ||
68 | - $focus = $child.eq(0); | ||
69 | - } | ||
70 | - } else { | ||
71 | - return; | ||
72 | - } | ||
73 | - | ||
74 | - $child.removeClass('action'); | ||
75 | - $focus.addClass('action'); | ||
76 | - $(this).val($focus.find('.searchvalue').text()); | ||
77 | - } else if (e.which === 13) { | ||
78 | - submitSearch(); | ||
79 | - } else { | ||
80 | - if ($searchSug && $searchSug.length) { | ||
81 | - val = val.replace(new RegExp('\'', 'gm'), ''); // 去掉特殊字符 | ||
82 | - searchSuggest(val); | ||
83 | - } | ||
84 | - } | ||
85 | -}).focus(function() { | ||
86 | - var val = $.trim($(this).val()); | ||
87 | - | ||
88 | - if (val === defaultSearch) { | ||
89 | - $(this).val(''); | ||
90 | - } | ||
91 | - | ||
92 | - $(this).css('color', '#333'); | ||
93 | -}).blur(function() { | ||
94 | - var val = $.trim($(this).val()); | ||
95 | - | ||
96 | - if (val === '') { | ||
97 | - $(this).val(defaultSearch).css('color', '#999'); | ||
98 | - } | ||
99 | - setTimeout(function() { | ||
100 | - $searchSug.hide(); | ||
101 | - }, 200); | ||
102 | -}); |
@@ -35,7 +35,7 @@ function shareBase(options) { | @@ -35,7 +35,7 @@ function shareBase(options) { | ||
35 | } | 35 | } |
36 | 36 | ||
37 | if ($.inArray(defOption.channel, shareChannels) === -1) { | 37 | if ($.inArray(defOption.channel, shareChannels) === -1) { |
38 | - alert('不存在的分享平台!'); | 38 | + alert('不存在的分享平台!'); // eslint-disable-line |
39 | return false; | 39 | return false; |
40 | } | 40 | } |
41 | 41 | ||
@@ -71,6 +71,8 @@ function shareBase(options) { | @@ -71,6 +71,8 @@ function shareBase(options) { | ||
71 | openUrl = '//www.douban.com/share/service?href=' + defOption.url + '&text=' + | 71 | openUrl = '//www.douban.com/share/service?href=' + defOption.url + '&text=' + |
72 | defOption.desc + '&image=' + defOption.image + '&title=' + defOption.title + '&comment='; | 72 | defOption.desc + '&image=' + defOption.image + '&title=' + defOption.title + '&comment='; |
73 | break; | 73 | break; |
74 | + default: | ||
75 | + break; | ||
74 | } | 76 | } |
75 | 77 | ||
76 | if (defOption.channel === 'weixin') { | 78 | if (defOption.channel === 'weixin') { |
@@ -146,9 +146,9 @@ $returnTop.click(function() { | @@ -146,9 +146,9 @@ $returnTop.click(function() { | ||
146 | }); | 146 | }); |
147 | 147 | ||
148 | $qrcodeHoverBox.mouseenter(function() { | 148 | $qrcodeHoverBox.mouseenter(function() { |
149 | - _hmt.push(['_trackEvent', '二维码', '右侧悬浮', '', '']); | 149 | + window._hmt.push(['_trackEvent', '二维码', '右侧悬浮', '', '']); |
150 | }).click(function() { | 150 | }).click(function() { |
151 | - _hmt.push(['_trackEvent', '二维码', '右侧悬浮', '', '']); | 151 | + window._hmt.push(['_trackEvent', '二维码', '右侧悬浮', '', '']); |
152 | }); | 152 | }); |
153 | 153 | ||
154 | $(window).scroll(function() { | 154 | $(window).scroll(function() { |
@@ -5,8 +5,9 @@ | @@ -5,8 +5,9 @@ | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | var $ = require('yoho-jquery'), | 7 | var $ = require('yoho-jquery'), |
8 | - lazyLoad = require('yoho-jquery-lazyload'), | ||
9 | - $commentArea = $('#comment-area'), | 8 | + lazyLoad = require('yoho-jquery-lazyload'); |
9 | + | ||
10 | +var $commentArea = $('#comment-area'), | ||
10 | articleId = $('.detail-body').data('id'); | 11 | articleId = $('.detail-body').data('id'); |
11 | 12 | ||
12 | var $commentList = $commentArea.find('.comments-wrap'), | 13 | var $commentList = $commentArea.find('.comments-wrap'), |
@@ -135,6 +136,8 @@ $('#collect-btn').click(function() { | @@ -135,6 +136,8 @@ $('#collect-btn').click(function() { | ||
135 | $this.toggleClass('collected'); | 136 | $this.toggleClass('collected'); |
136 | } | 137 | } |
137 | break; | 138 | break; |
139 | + default: | ||
140 | + break; | ||
138 | } | 141 | } |
139 | collecting = false; | 142 | collecting = false; |
140 | }); | 143 | }); |
@@ -160,7 +163,7 @@ function comment(id) { | @@ -160,7 +163,7 @@ function comment(id) { | ||
160 | var commentInfo = $('#comment-info').val(); | 163 | var commentInfo = $('#comment-info').val(); |
161 | 164 | ||
162 | if (commentInfo === '') { | 165 | if (commentInfo === '') { |
163 | - alert('评论不能为空'); | 166 | + alert('评论不能为空'); // eslint-disable-line |
164 | return false; | 167 | return false; |
165 | } | 168 | } |
166 | commenting = true; | 169 | commenting = true; |
@@ -179,7 +182,7 @@ function comment(id) { | @@ -179,7 +182,7 @@ function comment(id) { | ||
179 | window.escape(location.href + '#comment-info'); | 182 | window.escape(location.href + '#comment-info'); |
180 | break; | 183 | break; |
181 | case 400: | 184 | case 400: |
182 | - alert(data.message); | 185 | + alert(data.message); // eslint-disable-line |
183 | break; | 186 | break; |
184 | case 200: | 187 | case 200: |
185 | if (data.data) { | 188 | if (data.data) { |
@@ -191,6 +194,8 @@ function comment(id) { | @@ -191,6 +194,8 @@ function comment(id) { | ||
191 | $('#comment-info').val('').keyup(); | 194 | $('#comment-info').val('').keyup(); |
192 | } | 195 | } |
193 | break; | 196 | break; |
197 | + default: | ||
198 | + break; | ||
194 | } | 199 | } |
195 | commenting = false; | 200 | commenting = false; |
196 | } | 201 | } |
1 | var $ = require('yoho-jquery'); | 1 | var $ = require('yoho-jquery'); |
2 | var Slide = require('../plugins/yohoui/YH.slide'); | 2 | var Slide = require('../plugins/yohoui/YH.slide'); |
3 | 3 | ||
4 | - | ||
5 | var $item = $('li', '.qrctxt'); | 4 | var $item = $('li', '.qrctxt'); |
6 | var len = $item.length, slide; | 5 | var len = $item.length, slide; |
7 | var src = /url\("([^'"]*)"\)/g.exec($('.print-qrcode').css('background'))[1]; | 6 | var src = /url\("([^'"]*)"\)/g.exec($('.print-qrcode').css('background'))[1]; |
7 | + | ||
8 | $('.print-qrcode').find('img').attr('src', src); | 8 | $('.print-qrcode').find('img').attr('src', src); |
9 | 9 | ||
10 | require('../common'); | 10 | require('../common'); |
@@ -43,15 +43,18 @@ $('.next', '.qrcmain-switch').click(function() { | @@ -43,15 +43,18 @@ $('.next', '.qrcmain-switch').click(function() { | ||
43 | }); | 43 | }); |
44 | $('.btn-qcode').click(function() { | 44 | $('.btn-qcode').click(function() { |
45 | var html = ['<ul>']; | 45 | var html = ['<ul>']; |
46 | + | ||
46 | $('.center', '.qrctxt').each(function() { | 47 | $('.center', '.qrctxt').each(function() { |
48 | + var _src, _bianhao, _zuoweihao; | ||
49 | + | ||
47 | html.push('<li>'); | 50 | html.push('<li>'); |
48 | - var src = $(this).find('img').attr('src'); | ||
49 | - html.push('<img src=\'' + src + '\'/>'); | ||
50 | - var bianhao = $(this).find('.bianhao').text(); | ||
51 | - html.push('<p>' + bianhao + '</p>'); | ||
52 | - var zuoweihao = $(this).find('.zuoweihao').text(); | ||
53 | - if (zuoweihao) { | ||
54 | - html.push('<p>' + zuoweihao + '</p>'); | 51 | + _src = $(this).find('img').attr('src'); |
52 | + html.push('<img src=\'' + _src + '\'/>'); | ||
53 | + _bianhao = $(this).find('.bianhao').text(); | ||
54 | + html.push('<p>' + _bianhao + '</p>'); | ||
55 | + _zuoweihao = $(this).find('.zuoweihao').text(); | ||
56 | + if (_zuoweihao) { | ||
57 | + html.push('<p>' + _zuoweihao + '</p>'); | ||
55 | } | 58 | } |
56 | html.push('</li>'); | 59 | html.push('</li>'); |
57 | }); | 60 | }); |
@@ -4,8 +4,9 @@ | @@ -4,8 +4,9 @@ | ||
4 | * @date: 2016/10/28 | 4 | * @date: 2016/10/28 |
5 | */ | 5 | */ |
6 | var $ = require('yoho-jquery'), | 6 | var $ = require('yoho-jquery'), |
7 | - ImgPreview = require('../common/img-preview'), | ||
8 | - preview = new ImgPreview(); /* , | 7 | + ImgPreview = require('../common/img-preview'); |
8 | + | ||
9 | +var preview = new ImgPreview(); /* , | ||
9 | Handlebars = require('yoho-handlebars'), | 10 | Handlebars = require('yoho-handlebars'), |
10 | itemTpl = Handlebars.compile($('#comment-list-item-tpl').html() || '');*/ | 11 | itemTpl = Handlebars.compile($('#comment-list-item-tpl').html() || '');*/ |
11 | 12 | ||
@@ -62,27 +63,27 @@ $('.comment-add').on('click', '.btn-submit', function() { | @@ -62,27 +63,27 @@ $('.comment-add').on('click', '.btn-submit', function() { | ||
62 | // var itemH; | 63 | // var itemH; |
63 | 64 | ||
64 | if (!param.satisfied) { | 65 | if (!param.satisfied) { |
65 | - alert('请选择商品满意度!'); | 66 | + alert('请选择商品满意度!'); // eslint-disable-line |
66 | return; | 67 | return; |
67 | } | 68 | } |
68 | 69 | ||
69 | if (!param.size) { | 70 | if (!param.size) { |
70 | - alert('请选择尺码符合度!'); | 71 | + alert('请选择尺码符合度!'); // eslint-disable-line |
71 | return; | 72 | return; |
72 | } | 73 | } |
73 | 74 | ||
74 | if (param.content && param.content.length > 200) { | 75 | if (param.content && param.content.length > 200) { |
75 | - alert('内容超过限定字数!'); | 76 | + alert('内容超过限定字数!'); // eslint-disable-line |
76 | return; | 77 | return; |
77 | } | 78 | } |
78 | 79 | ||
79 | if (param.height && !/^\d{0,3}$/.test(param.height)) { | 80 | if (param.height && !/^\d{0,3}$/.test(param.height)) { |
80 | - alert('身高必须为最大3位数的数字'); | 81 | + alert('身高必须为最大3位数的数字'); // eslint-disable-line |
81 | return; | 82 | return; |
82 | } | 83 | } |
83 | 84 | ||
84 | if (param.weight && !/^\d{0,3}$/.test(param.weight)) { | 85 | if (param.weight && !/^\d{0,3}$/.test(param.weight)) { |
85 | - alert('体重必须为最大3位数的数字'); | 86 | + alert('体重必须为最大3位数的数字'); // eslint-disable-line |
86 | return; | 87 | return; |
87 | } | 88 | } |
88 | 89 | ||
@@ -101,15 +102,15 @@ $('.comment-add').on('click', '.btn-submit', function() { | @@ -101,15 +102,15 @@ $('.comment-add').on('click', '.btn-submit', function() { | ||
101 | $list.show(); | 102 | $list.show(); |
102 | 103 | ||
103 | resetForm($f);*/ | 104 | resetForm($f);*/ |
104 | - alert('提交成功'); | 105 | + alert('提交成功'); // eslint-disable-line |
105 | window.location.reload(); | 106 | window.location.reload(); |
106 | } else { | 107 | } else { |
107 | - alert(jsonData.message); | 108 | + alert(jsonData.message); // eslint-disable-line |
108 | } | 109 | } |
109 | }).fail(function(jqXhr, status, err) { | 110 | }).fail(function(jqXhr, status, err) { |
110 | var msg = (err && err.message) || '上传失败,请稍后再试!'; | 111 | var msg = (err && err.message) || '上传失败,请稍后再试!'; |
111 | 112 | ||
112 | - alert(msg); | 113 | + alert(msg); // eslint-disable-line |
113 | }); | 114 | }); |
114 | }); | 115 | }); |
115 | 116 | ||
@@ -157,11 +158,11 @@ $('.comment-add').on('change', 'input[type=file]', function() { | @@ -157,11 +158,11 @@ $('.comment-add').on('change', 'input[type=file]', function() { | ||
157 | $p.find('input[name=imgUrl]').val(relaUrl); | 158 | $p.find('input[name=imgUrl]').val(relaUrl); |
158 | $p.addClass('selected'); | 159 | $p.addClass('selected'); |
159 | } else if (data && data.message) { | 160 | } else if (data && data.message) { |
160 | - alert(data.message); | 161 | + alert(data.message); // eslint-disable-line |
161 | } | 162 | } |
162 | }, | 163 | }, |
163 | error: function() { /** data, status, e **/ | 164 | error: function() { /** data, status, e **/ |
164 | - alert('上传失败,请稍后再试!'); | 165 | + alert('上传失败,请稍后再试!'); // eslint-disable-line |
165 | }, | 166 | }, |
166 | complete: function() { | 167 | complete: function() { |
167 | $f.clone().replaceAll($f); | 168 | $f.clone().replaceAll($f); |
@@ -5,8 +5,9 @@ | @@ -5,8 +5,9 @@ | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | var $ = require('yoho-jquery'), | 7 | var $ = require('yoho-jquery'), |
8 | - dialog = require('../common/dialog'), | ||
9 | - Alert = dialog.Alert; | 8 | + dialog = require('../common/dialog'); |
9 | + | ||
10 | +var Alert = dialog.Alert; | ||
10 | 11 | ||
11 | var address = { | 12 | var address = { |
12 | 13 | ||
@@ -25,16 +26,16 @@ var address = { | @@ -25,16 +26,16 @@ var address = { | ||
25 | initDomIds: function(domOptions) { | 26 | initDomIds: function(domOptions) { |
26 | var the = this; | 27 | var the = this; |
27 | 28 | ||
28 | - if (domOptions.provinceDomId !== undefined) { | 29 | + if (typeof domOptions.provinceDomId !== undefined) { |
29 | the.provinceDomId = domOptions.provinceDomId; | 30 | the.provinceDomId = domOptions.provinceDomId; |
30 | } | 31 | } |
31 | - if (domOptions.cityDomId !== undefined) { | 32 | + if (typeof domOptions.cityDomId !== undefined) { |
32 | the.cityDomId = domOptions.cityDomId; | 33 | the.cityDomId = domOptions.cityDomId; |
33 | } | 34 | } |
34 | - if (domOptions.areaDomId !== undefined) { | 35 | + if (typeof domOptions.areaDomId !== undefined) { |
35 | the.areaDomId = domOptions.areaDomId; | 36 | the.areaDomId = domOptions.areaDomId; |
36 | } | 37 | } |
37 | - if (domOptions.streetsDomId !== undefined) { | 38 | + if (typeof domOptions.streetsDomId !== undefined) { |
38 | the.streetsDomId = domOptions.streetsDomId; | 39 | the.streetsDomId = domOptions.streetsDomId; |
39 | } | 40 | } |
40 | }, | 41 | }, |
@@ -96,7 +97,7 @@ var address = { | @@ -96,7 +97,7 @@ var address = { | ||
96 | bindAreaChange: function(domOptions) { | 97 | bindAreaChange: function(domOptions) { |
97 | var the = this; | 98 | var the = this; |
98 | 99 | ||
99 | - if ($('#' + the.provinceDomId).data('events') !== undefined) { | 100 | + if ($('#' + the.provinceDomId).data('events')) { |
100 | return; | 101 | return; |
101 | } | 102 | } |
102 | 103 | ||
@@ -152,7 +153,7 @@ var address = { | @@ -152,7 +153,7 @@ var address = { | ||
152 | strCity = $('#' + the.cityDomId).find('option:selected').text(), | 153 | strCity = $('#' + the.cityDomId).find('option:selected').text(), |
153 | strArea = $('#' + the.areaDomId).find('option:selected').text(); | 154 | strArea = $('#' + the.areaDomId).find('option:selected').text(); |
154 | 155 | ||
155 | - if (dispDomId !== undefined && dispDomId !== '') { | 156 | + if (typeof dispDomId !== undefined && dispDomId !== '') { |
156 | if (strProvince.indexOf('选择') < 0) { | 157 | if (strProvince.indexOf('选择') < 0) { |
157 | strAddr = strProvince; | 158 | strAddr = strProvince; |
158 | } | 159 | } |
@@ -122,7 +122,7 @@ function addComplaint() { | @@ -122,7 +122,7 @@ function addComplaint() { | ||
122 | if (jsonData.code === 200) { | 122 | if (jsonData.code === 200) { |
123 | window.location.reload(); | 123 | window.location.reload(); |
124 | } else { | 124 | } else { |
125 | - alert(jsonData.message); | 125 | + alert(jsonData.message); // eslint-disable-line |
126 | } | 126 | } |
127 | }); | 127 | }); |
128 | } | 128 | } |
@@ -146,7 +146,7 @@ function cancelComplaint(id, dom) { | @@ -146,7 +146,7 @@ function cancelComplaint(id, dom) { | ||
146 | $dom.prev().remove(); | 146 | $dom.prev().remove(); |
147 | $dom.text('问题已撤销'); | 147 | $dom.text('问题已撤销'); |
148 | } else { | 148 | } else { |
149 | - alert(jsonData.message); | 149 | + alert(jsonData.message); // eslint-disable-line |
150 | } | 150 | } |
151 | }); | 151 | }); |
152 | } | 152 | } |
1 | -require('../common'); | ||
2 | var $ = require('yoho-jquery'); | 1 | var $ = require('yoho-jquery'); |
3 | var yas = require('../common/data-yas'); | 2 | var yas = require('../common/data-yas'); |
4 | 3 | ||
5 | var $couponUse = $('#coupon-use'); | 4 | var $couponUse = $('#coupon-use'); |
6 | 5 | ||
6 | +require('../common'); | ||
7 | + | ||
7 | $couponUse.on('click', function() { | 8 | $couponUse.on('click', function() { |
8 | var couponid = $couponUse.parents('.coupon').data('couponid'); | 9 | var couponid = $couponUse.parents('.coupon').data('couponid'); |
9 | - | 10 | + |
10 | yas.yasEvent('YB_COUPON_IMMEDIATE_USE_C', {COUPON_ID: couponid}); | 11 | yas.yasEvent('YB_COUPON_IMMEDIATE_USE_C', {COUPON_ID: couponid}); |
11 | }); | 12 | }); |
@@ -427,13 +427,13 @@ $('#me-del-checked').click(function() { | @@ -427,13 +427,13 @@ $('#me-del-checked').click(function() { | ||
427 | name = '文章'; | 427 | name = '文章'; |
428 | } | 428 | } |
429 | 429 | ||
430 | - if (confirm('您确定要删除您收藏的' + name + '吗?')) { | 430 | + if (confirm('您确定要删除您收藏的' + name + '吗?')) { // eslint-disable-line |
431 | $('.checkbox input[type="checkbox"]:checked').each(function() { | 431 | $('.checkbox input[type="checkbox"]:checked').each(function() { |
432 | ids.push($(this).closest('.fav-row').data('id')); | 432 | ids.push($(this).closest('.fav-row').data('id')); |
433 | }); | 433 | }); |
434 | 434 | ||
435 | if (ids.length === 0) { | 435 | if (ids.length === 0) { |
436 | - alert('请选中您要移除的' + name); | 436 | + alert('请选中您要移除的' + name); // eslint-disable-line |
437 | return; | 437 | return; |
438 | } | 438 | } |
439 | 439 |
@@ -12,11 +12,12 @@ var Alert = dialog.Alert; | @@ -12,11 +12,12 @@ var Alert = dialog.Alert; | ||
12 | 12 | ||
13 | var $giftError = $('.giftCardCode').find('.gift-error'), | 13 | var $giftError = $('.giftCardCode').find('.gift-error'), |
14 | reg = /^[0-9a-zA-Z]{4,4}$/, | 14 | reg = /^[0-9a-zA-Z]{4,4}$/, |
15 | - code = '', | ||
16 | i = 1; | 15 | i = 1; |
17 | 16 | ||
18 | var active; | 17 | var active; |
19 | 18 | ||
19 | +var captcha; | ||
20 | + | ||
20 | var Gift = { | 21 | var Gift = { |
21 | suc: [ | 22 | suc: [ |
22 | false, | 23 | false, |
@@ -63,14 +64,14 @@ var Gift = { | @@ -63,14 +64,14 @@ var Gift = { | ||
63 | if (!reg.test($('#giftCardCode1').val()) || !reg.test($('#giftCardCode2').val()) || | 64 | if (!reg.test($('#giftCardCode1').val()) || !reg.test($('#giftCardCode2').val()) || |
64 | !reg.test($('#giftCardCode3').val())) { | 65 | !reg.test($('#giftCardCode3').val())) { |
65 | $giftError.html('您输入的兑换码有误,兑换码必须为数字或字母,每个文本框里只能输入四个兑换码!'); | 66 | $giftError.html('您输入的兑换码有误,兑换码必须为数字或字母,每个文本框里只能输入四个兑换码!'); |
66 | - return $.Deferred().reject().promise(); | 67 | + return $.Deferred().reject().promise(); // eslint-disable-line |
67 | } | 68 | } |
68 | 69 | ||
69 | return captcha.check(); | 70 | return captcha.check(); |
70 | } | 71 | } |
71 | }; | 72 | }; |
72 | 73 | ||
73 | -var captcha = new Captcha('.captcha-img').init(); | 74 | +captcha = new Captcha('.captcha-img').init(); |
74 | 75 | ||
75 | captcha.refresh(); | 76 | captcha.refresh(); |
76 | 77 |
@@ -5,8 +5,9 @@ | @@ -5,8 +5,9 @@ | ||
5 | */ | 5 | */ |
6 | var $ = require('yoho.jquery'), | 6 | var $ = require('yoho.jquery'), |
7 | regionCode = require('./common-address'), | 7 | regionCode = require('./common-address'), |
8 | - dialog = require('../common/dialog'), | ||
9 | - Alert = dialog.Alert; | 8 | + dialog = require('../common/dialog'); |
9 | + | ||
10 | +var Alert = dialog.Alert; | ||
10 | 11 | ||
11 | var active; | 12 | var active; |
12 | 13 | ||
@@ -55,7 +56,7 @@ var address = { | @@ -55,7 +56,7 @@ var address = { | ||
55 | }); | 56 | }); |
56 | }, | 57 | }, |
57 | 58 | ||
58 | - saveAddr: function(callbackFunc) { | 59 | + saveAddr: function() { |
59 | $.post('/home/address/saveAddress', $('#address-form').serialize(), function(data) { | 60 | $.post('/home/address/saveAddress', $('#address-form').serialize(), function(data) { |
60 | if (data.code === 200) { | 61 | if (data.code === 200) { |
61 | location.reload(); | 62 | location.reload(); |
@@ -104,7 +105,7 @@ var address = { | @@ -104,7 +105,7 @@ var address = { | ||
104 | }; | 105 | }; |
105 | 106 | ||
106 | if (!Array.prototype.indexOf) { | 107 | if (!Array.prototype.indexOf) { |
107 | - Array.prototype.indexOf = function(obj, start) { | 108 | + Array.prototype.indexOf = function(obj, start) { // eslint-disable-line |
108 | var i, | 109 | var i, |
109 | j; | 110 | j; |
110 | 111 |
@@ -83,7 +83,7 @@ $category.click(function() { | @@ -83,7 +83,7 @@ $category.click(function() { | ||
83 | 83 | ||
84 | 84 | ||
85 | // 浮层代码 | 85 | // 浮层代码 |
86 | -function bindTemplete($select, data, templete) { | 86 | +function bindTemplete($select, data, tpl) { |
87 | var $this = $select; | 87 | var $this = $select; |
88 | var offset = { | 88 | var offset = { |
89 | width: $this.width(), | 89 | width: $this.width(), |
@@ -93,7 +93,7 @@ function bindTemplete($select, data, templete) { | @@ -93,7 +93,7 @@ function bindTemplete($select, data, templete) { | ||
93 | var myTemplate; | 93 | var myTemplate; |
94 | 94 | ||
95 | $list.find('.brands-layer').remove(); | 95 | $list.find('.brands-layer').remove(); |
96 | - myTemplate = Handlebars.compile(templete); | 96 | + myTemplate = Handlebars.compile(tpl); |
97 | 97 | ||
98 | $this.parent('li').find('.brands-dialog').html(myTemplate(data)); | 98 | $this.parent('li').find('.brands-dialog').html(myTemplate(data)); |
99 | 99 |
@@ -122,7 +122,7 @@ function addComplaint() { | @@ -122,7 +122,7 @@ function addComplaint() { | ||
122 | if (jsonData.code === 200) { | 122 | if (jsonData.code === 200) { |
123 | window.location.reload(); | 123 | window.location.reload(); |
124 | } else { | 124 | } else { |
125 | - alert(jsonData.message); | 125 | + alert(jsonData.message); // eslint-disable-line |
126 | } | 126 | } |
127 | }); | 127 | }); |
128 | } | 128 | } |
@@ -146,7 +146,7 @@ function cancelComplaint(id, dom) { | @@ -146,7 +146,7 @@ function cancelComplaint(id, dom) { | ||
146 | $dom.prev().remove(); | 146 | $dom.prev().remove(); |
147 | $dom.text('问题已撤销'); | 147 | $dom.text('问题已撤销'); |
148 | } else { | 148 | } else { |
149 | - alert(jsonData.message); | 149 | + alert(jsonData.message); // eslint-disable-line |
150 | } | 150 | } |
151 | }); | 151 | }); |
152 | } | 152 | } |
@@ -656,7 +656,7 @@ $('.me-orders, .order-detail').on('click', '.cancel-order', function() { | @@ -656,7 +656,7 @@ $('.me-orders, .order-detail').on('click', '.cancel-order', function() { | ||
656 | active = editOrder(orderId); | 656 | active = editOrder(orderId); |
657 | active.show(); | 657 | active.show(); |
658 | newAddress(0); | 658 | newAddress(0); |
659 | - traceChangeAddress(orderId); // eslint-diable-line | 659 | + traceChangeAddress(orderId); // eslint-disable-line |
660 | }).on('click', '.rebuy', function() { | 660 | }).on('click', '.rebuy', function() { |
661 | var id = $(this).closest('.order, .order-detail').data('id'); | 661 | var id = $(this).closest('.order, .order-detail').data('id'); |
662 | 662 |
@@ -102,7 +102,7 @@ $('#captcha').keyup(function() { | @@ -102,7 +102,7 @@ $('#captcha').keyup(function() { | ||
102 | } | 102 | } |
103 | }); | 103 | }); |
104 | } else { | 104 | } else { |
105 | - $next.addClass('disable').attr('href', 'javascript:;'); | 105 | + $next.addClass('disable').attr('href', 'javascript:;'); // eslint-disable-line |
106 | } | 106 | } |
107 | }).blur(function() { | 107 | }).blur(function() { |
108 | var v = $.trim($(this).val()); | 108 | var v = $.trim($(this).val()); |
@@ -129,7 +129,7 @@ function sendMessageValidate() { | @@ -129,7 +129,7 @@ function sendMessageValidate() { | ||
129 | } | 129 | } |
130 | }).then(function(data) { | 130 | }).then(function(data) { |
131 | if (data.code !== 200) { | 131 | if (data.code !== 200) { |
132 | - alert(data.message); | 132 | + alert(data.message); // eslint-disable-line |
133 | } | 133 | } |
134 | }); | 134 | }); |
135 | 135 | ||
@@ -258,7 +258,7 @@ function actionSubmit() { | @@ -258,7 +258,7 @@ function actionSubmit() { | ||
258 | if (data.code === 200) { | 258 | if (data.code === 200) { |
259 | window.location.href = '/passport/thirdlogin/bindsuccess'; | 259 | window.location.href = '/passport/thirdlogin/bindsuccess'; |
260 | } else { | 260 | } else { |
261 | - alert(data.message); | 261 | + alert(data.message); // eslint-disable-line |
262 | } | 262 | } |
263 | }); | 263 | }); |
264 | } | 264 | } |
@@ -275,23 +275,23 @@ function actionConfirm() { | @@ -275,23 +275,23 @@ function actionConfirm() { | ||
275 | validatenum = $('#validatenum').val(); | 275 | validatenum = $('#validatenum').val(); |
276 | pwd = $('#pwd').val(); | 276 | pwd = $('#pwd').val(); |
277 | if (validatenum === '') { | 277 | if (validatenum === '') { |
278 | - alert('短信验证码不能为空'); | 278 | + alert('短信验证码不能为空'); // eslint-disable-line |
279 | return; | 279 | return; |
280 | } | 280 | } |
281 | if (pwd === '') { | 281 | if (pwd === '') { |
282 | - alert('密码不能为空'); | 282 | + alert('密码不能为空'); // eslint-disable-line |
283 | return; | 283 | return; |
284 | } | 284 | } |
285 | if (!/^(?![^a-zA-Z]+$)(?!\D+$).{6,20}$/.test(pwd)) { | 285 | if (!/^(?![^a-zA-Z]+$)(?!\D+$).{6,20}$/.test(pwd)) { |
286 | - alert('密码只支持6-20位字符,建议字母+数字的组合。'); | 286 | + alert('密码只支持6-20位字符,建议字母+数字的组合。'); // eslint-disable-line |
287 | return; | 287 | return; |
288 | } | 288 | } |
289 | if (isvalidatecode === false) { | 289 | if (isvalidatecode === false) { |
290 | - alert('请输入正确的验证码'); | 290 | + alert('请输入正确的验证码'); // eslint-disable-line |
291 | return; | 291 | return; |
292 | } | 292 | } |
293 | if (isvalidatepwd === false) { | 293 | if (isvalidatepwd === false) { |
294 | - alert('请输入符合强度的密码'); | 294 | + alert('请输入符合强度的密码'); // eslint-disable-line |
295 | return; | 295 | return; |
296 | } | 296 | } |
297 | actionSubmit(); | 297 | actionSubmit(); |
@@ -66,7 +66,7 @@ function sendVerifyMsg() { | @@ -66,7 +66,7 @@ function sendVerifyMsg() { | ||
66 | }).then(function(jsonData) { | 66 | }).then(function(jsonData) { |
67 | if (jsonData && jsonData.code !== 200) { | 67 | if (jsonData && jsonData.code !== 200) { |
68 | circleTime.clearTime(); | 68 | circleTime.clearTime(); |
69 | - alert(jsonData.message); | 69 | + alert(jsonData.message); // eslint-disable-line |
70 | } | 70 | } |
71 | }); | 71 | }); |
72 | } | 72 | } |
@@ -95,7 +95,7 @@ function relateMobile() { | @@ -95,7 +95,7 @@ function relateMobile() { | ||
95 | $errTip.removeClass('hide'); | 95 | $errTip.removeClass('hide'); |
96 | } else { | 96 | } else { |
97 | $errTip.addClass('hide'); | 97 | $errTip.addClass('hide'); |
98 | - alert(jsonData.message); | 98 | + alert(jsonData.message); // eslint-disable-line |
99 | } | 99 | } |
100 | }); | 100 | }); |
101 | } | 101 | } |
@@ -136,7 +136,7 @@ function sendMessageValidate() { | @@ -136,7 +136,7 @@ function sendMessageValidate() { | ||
136 | } | 136 | } |
137 | }).then(function(data) { | 137 | }).then(function(data) { |
138 | if (data.code !== 200) { | 138 | if (data.code !== 200) { |
139 | - alert(data.message); | 139 | + alert(data.message); // eslint-disable-line |
140 | } | 140 | } |
141 | }); | 141 | }); |
142 | 142 | ||
@@ -280,7 +280,7 @@ function actionSubmit() { | @@ -280,7 +280,7 @@ function actionSubmit() { | ||
280 | window.location.href = '/passport/thirdlogin/bindsuccess'; | 280 | window.location.href = '/passport/thirdlogin/bindsuccess'; |
281 | } | 281 | } |
282 | } else { | 282 | } else { |
283 | - alert(data.message); | 283 | + alert(data.message); // eslint-disable-line |
284 | } | 284 | } |
285 | }); | 285 | }); |
286 | } | 286 | } |
@@ -86,7 +86,7 @@ function codeValidate() { | @@ -86,7 +86,7 @@ function codeValidate() { | ||
86 | if (data.code === 200) { | 86 | if (data.code === 200) { |
87 | validatecode = true; | 87 | validatecode = true; |
88 | } else { | 88 | } else { |
89 | - alert(data.message); | 89 | + alert(data.message); // eslint-disable-line |
90 | } | 90 | } |
91 | }); | 91 | }); |
92 | } | 92 | } |
@@ -238,7 +238,7 @@ function sendMessageValidate() { | @@ -238,7 +238,7 @@ function sendMessageValidate() { | ||
238 | } | 238 | } |
239 | }).then(function(data) { | 239 | }).then(function(data) { |
240 | if (data.code !== 200) { | 240 | if (data.code !== 200) { |
241 | - alert(data.message); | 241 | + alert(data.message); // eslint-disable-line |
242 | } | 242 | } |
243 | }); | 243 | }); |
244 | 244 | ||
@@ -272,7 +272,7 @@ function actionSubmit() { | @@ -272,7 +272,7 @@ function actionSubmit() { | ||
272 | window.location.href = '/passport/thirdlogin/bindsuccess'; | 272 | window.location.href = '/passport/thirdlogin/bindsuccess'; |
273 | } | 273 | } |
274 | } else { | 274 | } else { |
275 | - alert(data.message); | 275 | + alert(data.message); // eslint-disable-line |
276 | } | 276 | } |
277 | }); | 277 | }); |
278 | } | 278 | } |
@@ -288,7 +288,7 @@ function goToBindPhone() { | @@ -288,7 +288,7 @@ function goToBindPhone() { | ||
288 | $('#inmobile').val($('#mobile').val()); | 288 | $('#inmobile').val($('#mobile').val()); |
289 | actionSubmit(); | 289 | actionSubmit(); |
290 | } else { | 290 | } else { |
291 | - alert('请输入正确验证码'); | 291 | + alert('请输入正确验证码'); // eslint-disable-line |
292 | } | 292 | } |
293 | }); | 293 | }); |
294 | } | 294 | } |
@@ -388,7 +388,7 @@ function nextStep() { | @@ -388,7 +388,7 @@ function nextStep() { | ||
388 | $phoneTip.removeClass('hide'); | 388 | $phoneTip.removeClass('hide'); |
389 | } else { | 389 | } else { |
390 | if (data && data.message) { | 390 | if (data && data.message) { |
391 | - alert(data.message); | 391 | + alert(data.message); // eslint-disable-line |
392 | } | 392 | } |
393 | } | 393 | } |
394 | } | 394 | } |
@@ -53,7 +53,7 @@ function sendMessageValidate() { | @@ -53,7 +53,7 @@ function sendMessageValidate() { | ||
53 | } | 53 | } |
54 | }).then(function(data) { | 54 | }).then(function(data) { |
55 | if (data.code !== 200) { | 55 | if (data.code !== 200) { |
56 | - alert(data.message); | 56 | + alert(data.message); // eslint-disable-line |
57 | } | 57 | } |
58 | }); | 58 | }); |
59 | 59 | ||
@@ -87,7 +87,7 @@ function actionSubmit() { | @@ -87,7 +87,7 @@ function actionSubmit() { | ||
87 | if (data.code === 200) { | 87 | if (data.code === 200) { |
88 | window.location.href = data.data.nextUrl; | 88 | window.location.href = data.data.nextUrl; |
89 | } else { | 89 | } else { |
90 | - alert(data.message); | 90 | + alert(data.message); // eslint-disable-line |
91 | } | 91 | } |
92 | }); | 92 | }); |
93 | } | 93 | } |
@@ -102,7 +102,7 @@ function actionConfirm() { | @@ -102,7 +102,7 @@ function actionConfirm() { | ||
102 | $('#confirmsubmit').on('click', function() { | 102 | $('#confirmsubmit').on('click', function() { |
103 | validatenum = $('#validatenum').val(); | 103 | validatenum = $('#validatenum').val(); |
104 | if (validatenum === '') { | 104 | if (validatenum === '') { |
105 | - alert('短信验证码不能为空'); | 105 | + alert('短信验证码不能为空'); // eslint-disable-line |
106 | return; | 106 | return; |
107 | } | 107 | } |
108 | 108 |
@@ -151,7 +151,7 @@ function nextStep() { | @@ -151,7 +151,7 @@ function nextStep() { | ||
151 | $phoneTip.removeClass('hide'); | 151 | $phoneTip.removeClass('hide'); |
152 | } else { | 152 | } else { |
153 | if (data && data.message) { | 153 | if (data && data.message) { |
154 | - alert(data.message); | 154 | + alert(data.message); // eslint-disable-line |
155 | } | 155 | } |
156 | } | 156 | } |
157 | } | 157 | } |
@@ -66,7 +66,7 @@ function sendVerifyMsg() { | @@ -66,7 +66,7 @@ function sendVerifyMsg() { | ||
66 | }).then(function(jsonData) { | 66 | }).then(function(jsonData) { |
67 | if (jsonData && jsonData.code !== 200) { | 67 | if (jsonData && jsonData.code !== 200) { |
68 | circleTime.clearTime(); | 68 | circleTime.clearTime(); |
69 | - alert(jsonData.message); | 69 | + alert(jsonData.message); // eslint-disable-line |
70 | } | 70 | } |
71 | }); | 71 | }); |
72 | } | 72 | } |
@@ -94,7 +94,7 @@ function relateMobile() { | @@ -94,7 +94,7 @@ function relateMobile() { | ||
94 | $errTip.removeClass('hide'); | 94 | $errTip.removeClass('hide'); |
95 | } else { | 95 | } else { |
96 | $errTip.addClass('hide'); | 96 | $errTip.addClass('hide'); |
97 | - alert(jsonData.message); | 97 | + alert(jsonData.message); // eslint-disable-line |
98 | } | 98 | } |
99 | }); | 99 | }); |
100 | } | 100 | } |
@@ -136,7 +136,7 @@ function sendMessageValidate() { | @@ -136,7 +136,7 @@ function sendMessageValidate() { | ||
136 | } | 136 | } |
137 | }).then(function(data) { | 137 | }).then(function(data) { |
138 | if (data.code !== 200) { | 138 | if (data.code !== 200) { |
139 | - alert(data.message); | 139 | + alert(data.message); // eslint-disable-line |
140 | } | 140 | } |
141 | }); | 141 | }); |
142 | 142 | ||
@@ -280,7 +280,7 @@ function actionSubmit() { | @@ -280,7 +280,7 @@ function actionSubmit() { | ||
280 | window.location.href = '/passport/thirdlogin/bindsuccess'; | 280 | window.location.href = '/passport/thirdlogin/bindsuccess'; |
281 | } | 281 | } |
282 | } else { | 282 | } else { |
283 | - alert(data.message); | 283 | + alert(data.message); // eslint-disable-line |
284 | } | 284 | } |
285 | }); | 285 | }); |
286 | } | 286 | } |
@@ -653,7 +653,7 @@ exports.init = function(page) { | @@ -653,7 +653,7 @@ exports.init = function(page) { | ||
653 | 653 | ||
654 | 654 | ||
655 | $('.qrcode-hover-reg').mouseenter(function() { | 655 | $('.qrcode-hover-reg').mouseenter(function() { |
656 | - _hmt.push(['_trackEvent', '二维码', '注册页', '', '']); | 656 | + window._hmt.push(['_trackEvent', '二维码', '注册页', '', '']); |
657 | }).click(function() { | 657 | }).click(function() { |
658 | - _hmt.push(['_trackEvent', '二维码', '注册页', '', '']); | 658 | + window._hmt.push(['_trackEvent', '二维码', '注册页', '', '']); |
659 | }); | 659 | }); |
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | * upload plugin | 2 | * upload plugin |
3 | * | 3 | * |
4 | */ | 4 | */ |
5 | +/* eslint-disable */ | ||
5 | var $ = require('yoho-jquery'); | 6 | var $ = require('yoho-jquery'); |
6 | var SWFUpload = require('./swfupload.queue').SWFUpload; | 7 | var SWFUpload = require('./swfupload.queue').SWFUpload; |
7 | 8 | ||
@@ -308,3 +309,4 @@ function initSwfUpload(btnId, options) { | @@ -308,3 +309,4 @@ function initSwfUpload(btnId, options) { | ||
308 | } | 309 | } |
309 | 310 | ||
310 | window.SWFUpload = SWFUpload; | 311 | window.SWFUpload = SWFUpload; |
312 | +/* eslint-enable */ |
@@ -26,7 +26,7 @@ function shareBase(options) { | @@ -26,7 +26,7 @@ function shareBase(options) { | ||
26 | defOption = $.extend(defOption, options); | 26 | defOption = $.extend(defOption, options); |
27 | 27 | ||
28 | if ($.inArray(defOption.channel, shareChannels) === -1) { | 28 | if ($.inArray(defOption.channel, shareChannels) === -1) { |
29 | - alert('不存在的分享平台!'); | 29 | + alert('不存在的分享平台!'); // eslint-disable-line |
30 | return false; | 30 | return false; |
31 | } | 31 | } |
32 | 32 | ||
@@ -62,6 +62,8 @@ function shareBase(options) { | @@ -62,6 +62,8 @@ function shareBase(options) { | ||
62 | openUrl = 'http://www.douban.com/share/service?href=' + defOption.url + '&text=' + | 62 | openUrl = 'http://www.douban.com/share/service?href=' + defOption.url + '&text=' + |
63 | defOption.desc + '&image=' + defOption.image + '&title=' + defOption.title + '&comment='; | 63 | defOption.desc + '&image=' + defOption.image + '&title=' + defOption.title + '&comment='; |
64 | break; | 64 | break; |
65 | + default: | ||
66 | + break; | ||
65 | } | 67 | } |
66 | 68 | ||
67 | if (defOption.channel === 'weixin') { | 69 | if (defOption.channel === 'weixin') { |
@@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
10 | * http://www.opensource.org/licenses/mit-license.php | 10 | * http://www.opensource.org/licenses/mit-license.php |
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | - | 13 | +/* eslint-disable */ |
14 | 14 | ||
15 | /* ******************* */ | 15 | /* ******************* */ |
16 | /* Constructor & Init */ | 16 | /* Constructor & Init */ |
@@ -986,3 +986,4 @@ SWFUpload.Console.writeLine = function(message) { | @@ -986,3 +986,4 @@ SWFUpload.Console.writeLine = function(message) { | ||
986 | }; | 986 | }; |
987 | 987 | ||
988 | exports.SWFUpload = SWFUpload; | 988 | exports.SWFUpload = SWFUpload; |
989 | +/* eslint-enable */ |
@@ -10,6 +10,8 @@ | @@ -10,6 +10,8 @@ | ||
10 | Set the event handler with the queue_complete_handler setting. | 10 | Set the event handler with the queue_complete_handler setting. |
11 | 11 | ||
12 | */ | 12 | */ |
13 | + | ||
14 | +/* eslint-disable */ | ||
13 | var SWFUpload = require('./swfupload').SWFUpload; | 15 | var SWFUpload = require('./swfupload').SWFUpload; |
14 | 16 | ||
15 | if (typeof(SWFUpload) === 'function') { | 17 | if (typeof(SWFUpload) === 'function') { |
@@ -98,3 +100,4 @@ if (typeof(SWFUpload) === 'function') { | @@ -98,3 +100,4 @@ if (typeof(SWFUpload) === 'function') { | ||
98 | } | 100 | } |
99 | 101 | ||
100 | exports.SWFUpload = SWFUpload; | 102 | exports.SWFUpload = SWFUpload; |
103 | +/* eslint-enable */ |
1 | +/* eslint-disable */ | ||
1 | var assembly; | 2 | var assembly; |
2 | var classtype = { | 3 | var classtype = { |
3 | '[object Array]': 'array', | 4 | '[object Array]': 'array', |
@@ -432,3 +433,4 @@ assembly.prototype.off = function(name, callback) { | @@ -432,3 +433,4 @@ assembly.prototype.off = function(name, callback) { | ||
432 | me.assembly = assembly; | 433 | me.assembly = assembly; |
433 | 434 | ||
434 | module.exports = me; | 435 | module.exports = me; |
436 | +/* eslint-enable */ |
1 | +/* eslint-disable */ | ||
1 | var me = require('./YH.base'); | 2 | var me = require('./YH.base'); |
2 | 3 | ||
3 | var slide = function(options) { | 4 | var slide = function(options) { |
@@ -137,3 +138,4 @@ slide.prototype.defaults = { | @@ -137,3 +138,4 @@ slide.prototype.defaults = { | ||
137 | }; | 138 | }; |
138 | 139 | ||
139 | module.exports = slide; | 140 | module.exports = slide; |
141 | +/* eslint-enable */ |
@@ -399,7 +399,7 @@ bindEvent.add(function() { | @@ -399,7 +399,7 @@ bindEvent.add(function() { | ||
399 | }); | 399 | }); |
400 | 400 | ||
401 | $('.qrcode-buy').mouseenter(function() { | 401 | $('.qrcode-buy').mouseenter(function() { |
402 | - _hmt.push(['_trackEvent', '二维码', '商品详情页', 'skn', $(this).attr('skn')]); | 402 | + window._hmt.push(['_trackEvent', '二维码', '商品详情页', 'skn', $(this).attr('skn')]); |
403 | }); | 403 | }); |
404 | 404 | ||
405 | // 是否能:量贩购买,量贩小于库存才能购买 | 405 | // 是否能:量贩购买,量贩小于库存才能购买 |
@@ -67,7 +67,7 @@ function getSearchRecommend() { | @@ -67,7 +67,7 @@ function getSearchRecommend() { | ||
67 | $goodsIdArr.push($(this).data('id')); | 67 | $goodsIdArr.push($(this).data('id')); |
68 | }); | 68 | }); |
69 | 69 | ||
70 | - initPageYas(); | 70 | + initPageYas(); // eslint-disable-line |
71 | } | 71 | } |
72 | } | 72 | } |
73 | 73 | ||
@@ -88,6 +88,7 @@ function initPageYas() { | @@ -88,6 +88,7 @@ function initPageYas() { | ||
88 | ACTION_ID: 0, | 88 | ACTION_ID: 0, |
89 | PAGE_NUM: 1 | 89 | PAGE_NUM: 1 |
90 | }; | 90 | }; |
91 | + | ||
91 | // 关键词搜索结果页展示时 | 92 | // 关键词搜索结果页展示时 |
92 | yas.givePoint('YB_CHOOSE_FOR_YOU_Y', loadYas); | 93 | yas.givePoint('YB_CHOOSE_FOR_YOU_Y', loadYas); |
93 | } | 94 | } |
1 | var $ = require('yoho-jquery'), | 1 | var $ = require('yoho-jquery'), |
2 | lazyload = require('yoho-jquery-lazyload'); | 2 | lazyload = require('yoho-jquery-lazyload'); |
3 | -var Handlebars = require('yoho-handlebars'); | ||
4 | 3 | ||
5 | function InfiniteLoad(options) { | 4 | function InfiniteLoad(options) { |
6 | var defaults = { | 5 | var defaults = { |
@@ -144,6 +144,6 @@ $qrcodeImg.qrcode({ | @@ -144,6 +144,6 @@ $qrcodeImg.qrcode({ | ||
144 | }); | 144 | }); |
145 | 145 | ||
146 | $('.qrcode-hover-box').mouseenter(function() { | 146 | $('.qrcode-hover-box').mouseenter(function() { |
147 | - _hmt.push(['_trackEvent', '二维码', '普通店铺', 'shopId', $(this).attr('data-id')]); | 147 | + window._hmt.push(['_trackEvent', '二维码', '普通店铺', 'shopId', $(this).attr('data-id')]); |
148 | }); | 148 | }); |
149 | require('./good-slide'); | 149 | require('./good-slide'); |
@@ -43,7 +43,7 @@ $qrcodeImg.qrcode({ | @@ -43,7 +43,7 @@ $qrcodeImg.qrcode({ | ||
43 | }); | 43 | }); |
44 | 44 | ||
45 | $('.qrcode-decoration').mouseenter(function() { | 45 | $('.qrcode-decoration').mouseenter(function() { |
46 | - _hmt.push(['_trackEvent', '二维码', '经典店铺', 'shopId', $(this).attr('data-id')]); | 46 | + window._hmt.push(['_trackEvent', '二维码', '经典店铺', 'shopId', $(this).attr('data-id')]); |
47 | }); | 47 | }); |
48 | 48 | ||
49 | // require('../product/list'); | 49 | // require('../product/list'); |
@@ -446,13 +446,13 @@ $couponDia.on('click', function() { | @@ -446,13 +446,13 @@ $couponDia.on('click', function() { | ||
446 | createStuDialog('stu-agree-dialog', cont); | 446 | createStuDialog('stu-agree-dialog', cont); |
447 | }); | 447 | }); |
448 | 448 | ||
449 | -$rightsItem.each(function(index,ele) { | 449 | +$rightsItem.each(function(index, ele) { |
450 | var title = $(ele).find('.item-title').html(), | 450 | var title = $(ele).find('.item-title').html(), |
451 | detail = $(ele).find('.item-detail').html(), | 451 | detail = $(ele).find('.item-detail').html(), |
452 | i = Number(index) + 1; | 452 | i = Number(index) + 1; |
453 | 453 | ||
454 | rightsText += '<p>权益' + i + ':' + title + '</p><p>' + detail + '</p>'; | 454 | rightsText += '<p>权益' + i + ':' + title + '</p><p>' + detail + '</p>'; |
455 | - i !== $rightsItem.length ? rightsText+='<br>' : ''; | 455 | + i !== $rightsItem.length ? rightsText += '<br>' : ''; |
456 | }); | 456 | }); |
457 | 457 | ||
458 | $rightDia.on('click', function() { | 458 | $rightDia.on('click', function() { |
@@ -794,22 +794,22 @@ $(function() { | @@ -794,22 +794,22 @@ $(function() { | ||
794 | 794 | ||
795 | // 悬浮效果 | 795 | // 悬浮效果 |
796 | $rightsItem.hover(function() { | 796 | $rightsItem.hover(function() { |
797 | - var content = $(this).find('.item-content'); | 797 | + var content = $(this).find('.item-content'); |
798 | 798 | ||
799 | - var gapHeight; | 799 | + var gapHeight; |
800 | 800 | ||
801 | - content.removeClass('hide'); | 801 | + content.removeClass('hide'); |
802 | 802 | ||
803 | - gapHeight = parseInt(content.height(), 10) + 40 - parseInt($(this).height(), 10); | 803 | + gapHeight = parseInt(content.height(), 10) + 40 - parseInt($(this).height(), 10); |
804 | 804 | ||
805 | - if (gapHeight > 0) { | ||
806 | - content.css('margin-top', -(gapHeight) + 'px'); | ||
807 | - } | ||
808 | - }, function() { | ||
809 | - var content = $(this).find('.item-content'); | 805 | + if (gapHeight > 0) { |
806 | + content.css('margin-top', -(gapHeight) + 'px'); | ||
807 | + } | ||
808 | + }, function() { | ||
809 | + var content = $(this).find('.item-content'); | ||
810 | 810 | ||
811 | - content.addClass('hide').css('margin-top', '0'); | ||
812 | - }); | 811 | + content.addClass('hide').css('margin-top', '0'); |
812 | + }); | ||
813 | }); | 813 | }); |
814 | 814 | ||
815 | window.onbeforeunload = function() { | 815 | window.onbeforeunload = function() { |
@@ -82,22 +82,6 @@ function setLoginStatus(data) { | @@ -82,22 +82,6 @@ function setLoginStatus(data) { | ||
82 | $('.header-tool li').eq(0).html(loginHtml); | 82 | $('.header-tool li').eq(0).html(loginHtml); |
83 | } | 83 | } |
84 | 84 | ||
85 | -/** | ||
86 | - * 获取登录信息 | ||
87 | - * @return {[type]} [description] | ||
88 | - */ | ||
89 | -function actionLoginInfo() { | ||
90 | - var param = { | ||
91 | - return_type: 'jsonp' | ||
92 | - }; | ||
93 | - | ||
94 | - $.getJSON('//www.yohobuy.com/common/passport/?callback=?', param, function(_data) { | ||
95 | - if (_data && _data.data) { | ||
96 | - setLoginStatus(_data.data); | ||
97 | - } | ||
98 | - }); | ||
99 | -} | ||
100 | - | ||
101 | // 获取头部登陆信息 | 85 | // 获取头部登陆信息 |
102 | (function() { | 86 | (function() { |
103 | var uid = getUid(), //eslint-disable-line | 87 | var uid = getUid(), //eslint-disable-line |
1 | 'use strict'; | 1 | 'use strict'; |
2 | 2 | ||
3 | -const url = require('url'); | ||
4 | const _ = require('lodash'); | 3 | const _ = require('lodash'); |
5 | -const config = require('../config/common'); | ||
6 | -const assetUrl = config.assetUrl; | ||
7 | 4 | ||
8 | let cdnDomains = require('../config/dns-prefetch'); | 5 | let cdnDomains = require('../config/dns-prefetch'); |
9 | 6 | ||
@@ -35,7 +32,8 @@ module.exports = { | @@ -35,7 +32,8 @@ module.exports = { | ||
35 | uri = cdnReplace(cdn, uri); | 32 | uri = cdnReplace(cdn, uri); |
36 | 33 | ||
37 | if (query) { | 34 | if (query) { |
38 | - query = query.replace(/{width}/g, params.w).replace(/{height}/g, params.h).replace(/{mode}/g, (params.mode || 2)); | 35 | + query = query.replace(/{width}/g, params.w).replace(/{height}/g, |
36 | + params.h).replace(/{mode}/g, (params.mode || 2)); | ||
39 | 37 | ||
40 | if (query.indexOf('imageView2') === 0) { | 38 | if (query.indexOf('imageView2') === 0) { |
41 | if (params.q && query.indexOf('/q/') > 0) { | 39 | if (params.q && query.indexOf('/q/') > 0) { |
@@ -131,6 +131,7 @@ exports.getSourceUrl = (fileName, bucket)=>{ | @@ -131,6 +131,7 @@ exports.getSourceUrl = (fileName, bucket)=>{ | ||
131 | return fileName; | 131 | return fileName; |
132 | } | 132 | } |
133 | let domain = getDomain(bucket, fileName); | 133 | let domain = getDomain(bucket, fileName); |
134 | + | ||
134 | return '//' + domain + '/' + bucket + fileName; | 135 | return '//' + domain + '/' + bucket + fileName; |
135 | }; | 136 | }; |
136 | 137 |
-
Please register or login to post a comment