Merge branch 'release/4.6' of http://git.yoho.cn/fe/yohobuywap-node into release/4.6
Showing
38 changed files
with
164 additions
and
59 deletions
@@ -18,12 +18,10 @@ const path = require('path'); | @@ -18,12 +18,10 @@ const path = require('path'); | ||
18 | const bodyParser = require('body-parser'); | 18 | const bodyParser = require('body-parser'); |
19 | const cookieParser = require('cookie-parser'); | 19 | const cookieParser = require('cookie-parser'); |
20 | const favicon = require('serve-favicon'); | 20 | const favicon = require('serve-favicon'); |
21 | -const session = require('yoho-express-session'); | ||
22 | -const memcached = require('yoho-connect-memcached'); | ||
23 | -const uuid = require('uuid'); | 21 | +const session = require('express-session'); |
22 | +const memcached = require('connect-memcached'); | ||
24 | const _ = require('lodash'); | 23 | const _ = require('lodash'); |
25 | const pkg = require('./package.json'); | 24 | const pkg = require('./package.json'); |
26 | -const sign = require('./library/sign'); | ||
27 | const cookie = require('./library/cookie'); | 25 | const cookie = require('./library/cookie'); |
28 | 26 | ||
29 | const app = express(); | 27 | const app = express(); |
@@ -52,19 +50,15 @@ app.use(session({ | @@ -52,19 +50,15 @@ app.use(session({ | ||
52 | resave: false, | 50 | resave: false, |
53 | saveUninitialized: true, | 51 | saveUninitialized: true, |
54 | unset: 'destroy', | 52 | unset: 'destroy', |
55 | - secret: 'nothing', // 兼容 PHP SESSION,sessionID 不加密 | ||
56 | - name: 'PHPSESSID', // 兼容 PHP SESSION | ||
57 | - genid: () => { | ||
58 | - return uuid.v4(); // 兼容 PHP SESSION | ||
59 | - }, | 53 | + secret: '82dd7e724f2c6870472c89dfa43cf48d', |
54 | + name: 'yohobuy_session', | ||
60 | cookie: { | 55 | cookie: { |
61 | - domain: 'yohobuy.com', | 56 | + // domain: 'yohobuy.com', |
62 | httpOnly: false | 57 | httpOnly: false |
63 | }, | 58 | }, |
64 | store: new MemcachedStore({ | 59 | store: new MemcachedStore({ |
65 | hosts: config.memcache.session, | 60 | hosts: config.memcache.session, |
66 | - prefix: 'qinsessionsession:', // 兼容 PHP SESSION | ||
67 | - key: 'yohobuy_session' // 兼容 PHP SESSION | 61 | + prefix: 'yohobuy_session:' |
68 | }) | 62 | }) |
69 | })); | 63 | })); |
70 | 64 | ||
@@ -78,14 +72,8 @@ app.use((req, res, next) => { | @@ -78,14 +72,8 @@ app.use((req, res, next) => { | ||
78 | 72 | ||
79 | // session 没有读取到的时候,从 cookie 读取 UID | 73 | // session 没有读取到的时候,从 cookie 读取 UID |
80 | if (!req.user.uid && req.cookies._UID) { | 74 | if (!req.user.uid && req.cookies._UID) { |
81 | - let uid = cookie.getUid(req); | ||
82 | - | ||
83 | - // 校验 cookie 的 uid 有没有被修改 | ||
84 | - if (req.cookies._TOKEN === sign.makeToken(uid)) { | ||
85 | - req.user.uid = uid; | ||
86 | - } | 75 | + req.user.uid = cookie.getUid(req); |
87 | } | 76 | } |
88 | - | ||
89 | next(); | 77 | next(); |
90 | }); | 78 | }); |
91 | 79 |
@@ -10,7 +10,10 @@ const sign = require(`${library}/sign`); | @@ -10,7 +10,10 @@ const sign = require(`${library}/sign`); | ||
10 | */ | 10 | */ |
11 | const getPageInfo = (pageInfo) => { | 11 | const getPageInfo = (pageInfo) => { |
12 | var dest = {}; | 12 | var dest = {}; |
13 | - | 13 | + dest.shareTitle = pageInfo.data.shareTitle; |
14 | + dest.shareDesc = pageInfo.data.shareContent; | ||
15 | + dest.shareImg = pageInfo.data.shareImgUrl; | ||
16 | + dest.shareLink = pageInfo.data.shareUrl; | ||
14 | dest.code = pageInfo.code; | 17 | dest.code = pageInfo.code; |
15 | dest.activityID = pageInfo.id; | 18 | dest.activityID = pageInfo.id; |
16 | dest.title = pageInfo.data.h5Title; | 19 | dest.title = pageInfo.data.h5Title; |
@@ -18,9 +21,12 @@ const getPageInfo = (pageInfo) => { | @@ -18,9 +21,12 @@ const getPageInfo = (pageInfo) => { | ||
18 | dest.couponPic = pageInfo.data.couponPic; | 21 | dest.couponPic = pageInfo.data.couponPic; |
19 | dest.oldUserCouponPic = pageInfo.data.oldUserCouponPic; | 22 | dest.oldUserCouponPic = pageInfo.data.oldUserCouponPic; |
20 | dest.mobile = pageInfo.data.mobile; | 23 | dest.mobile = pageInfo.data.mobile; |
24 | + | ||
25 | + // 强制活动开始,活动上线产品要求这样设置 | ||
26 | + pageInfo.data.flag = 1; | ||
21 | if (pageInfo.data.flag === 1) { | 27 | if (pageInfo.data.flag === 1) { |
22 | dest.bgImg = pageInfo.data.activityNormalPic; | 28 | dest.bgImg = pageInfo.data.activityNormalPic; |
23 | - } else if (pageInfo.data.flag !== 1) { | 29 | + } else { |
24 | dest.bgImg = pageInfo.data.activityEndPic; | 30 | dest.bgImg = pageInfo.data.activityEndPic; |
25 | dest.ended = true; | 31 | dest.ended = true; |
26 | } | 32 | } |
@@ -13,10 +13,10 @@ const coupon = require(`${cRoot}/coupon`); | @@ -13,10 +13,10 @@ const coupon = require(`${cRoot}/coupon`); | ||
13 | 13 | ||
14 | // routers | 14 | // routers |
15 | 15 | ||
16 | -router.get('/index', coupon.index); | 16 | +router.get('/coupon', coupon.index); |
17 | 17 | ||
18 | -router.get('/phone', coupon.getCoupon); | 18 | +router.get('/coupon/phone', coupon.getCoupon); |
19 | 19 | ||
20 | -router.get('/verify', coupon.verify); | 20 | +router.get('/coupon/verify', coupon.verify); |
21 | 21 | ||
22 | module.exports = router; | 22 | module.exports = router; |
@@ -10,6 +10,11 @@ | @@ -10,6 +10,11 @@ | ||
10 | <p class="hidden" id="newUser">{{newUser}}</p> | 10 | <p class="hidden" id="newUser">{{newUser}}</p> |
11 | <p class="hidden" id="tipMessage">{{message}}</p> | 11 | <p class="hidden" id="tipMessage">{{message}}</p> |
12 | <p class="hidden" id="activityID">{{activityID}}</p> | 12 | <p class="hidden" id="activityID">{{activityID}}</p> |
13 | + <input type="hidden" id="shareTitle" value="{{shareTitle}}"> | ||
14 | + <input type="hidden" id="shareDesc" value="{{shareDesc}}"> | ||
15 | + <input type="hidden" id="shareImg" value="{{shareImg}}"> | ||
16 | + <input type="hidden" id="shareLink" value="{{shareLink}}"> | ||
17 | + | ||
13 | <div class="page"> | 18 | <div class="page"> |
14 | <div class="gain-coupon-centent hidden"> | 19 | <div class="gain-coupon-centent hidden"> |
15 | <div class="coupon"> | 20 | <div class="coupon"> |
@@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
6 | 6 | ||
7 | 'use strict'; | 7 | 'use strict'; |
8 | const passport = require('passport'); | 8 | const passport = require('passport'); |
9 | -const WeixinStrategy = require('passport-weixin-plus'); | 9 | +const WeixinStrategy = require('passport-weixin'); |
10 | 10 | ||
11 | const config = require('../../config/common'); | 11 | const config = require('../../config/common'); |
12 | 12 | ||
@@ -15,14 +15,14 @@ let siteUrl = config.siteUrl.indexOf('//') === 0 ? 'http:' + config.siteUrl : co | @@ -15,14 +15,14 @@ let siteUrl = config.siteUrl.indexOf('//') === 0 ? 'http:' + config.siteUrl : co | ||
15 | /** | 15 | /** |
16 | * wechat登录 | 16 | * wechat登录 |
17 | */ | 17 | */ |
18 | -passport.use(new WeixinStrategy({ | ||
19 | - authorizationURL: 'https://open.weixin.qq.com/connect/oauth2/authorize', | ||
20 | - tokenURL: 'https://api.weixin.qq.com/sns/oauth2/access_token', | 18 | + |
19 | +passport.use('weixin', new WeixinStrategy({ | ||
21 | clientID: config.thirdLogin.wechat.appID, | 20 | clientID: config.thirdLogin.wechat.appID, |
22 | clientSecret: config.thirdLogin.wechat.appSecret, | 21 | clientSecret: config.thirdLogin.wechat.appSecret, |
23 | callbackURL: `${siteUrl}/passport/login/wechat/callback`, | 22 | callbackURL: `${siteUrl}/passport/login/wechat/callback`, |
24 | - requireState: false, | 23 | + requireState: true, |
24 | + authorizationURL: 'https://open.weixin.qq.com/connect/oauth2/authorize', | ||
25 | scope: 'snsapi_userinfo' | 25 | scope: 'snsapi_userinfo' |
26 | -}, (accessToken, refreshToken, profile, done) => { | 26 | +}, function(accessToken, refreshToken, profile, done) { |
27 | done(null, profile); | 27 | done(null, profile); |
28 | })); | 28 | })); |
@@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
7 | 7 | ||
8 | const library = '../../../library'; | 8 | const library = '../../../library'; |
9 | const passport = require('passport'); | 9 | const passport = require('passport'); |
10 | +const uuid = require('uuid'); | ||
10 | const cookie = require(`${library}/cookie`); | 11 | const cookie = require(`${library}/cookie`); |
11 | const helpers = require(`${library}/helpers`); | 12 | const helpers = require(`${library}/helpers`); |
12 | const log = require(`${library}/logger`); | 13 | const log = require(`${library}/logger`); |
@@ -42,7 +43,6 @@ function doPassportCallback(openId, nickname, sourceType, req, res) { | @@ -42,7 +43,6 @@ function doPassportCallback(openId, nickname, sourceType, req, res) { | ||
42 | }); | 43 | }); |
43 | } | 44 | } |
44 | }).then((redirectTo) => { | 45 | }).then((redirectTo) => { |
45 | - console.log('redirectTo=', redirectTo); | ||
46 | return res.redirect(redirectTo); | 46 | return res.redirect(redirectTo); |
47 | }).catch((e) => { | 47 | }).catch((e) => { |
48 | log.error('频道页面渲染错误:' + JSON.stringify(e)); | 48 | log.error('频道页面渲染错误:' + JSON.stringify(e)); |
@@ -64,7 +64,9 @@ const wechat = { | @@ -64,7 +64,9 @@ const wechat = { | ||
64 | next(); | 64 | next(); |
65 | }, | 65 | }, |
66 | login: (req, res, next) => { | 66 | login: (req, res, next) => { |
67 | - return passport.authenticate('weixin')(req, res, next); | 67 | + return passport.authenticate('weixin', { |
68 | + state: uuid.v4() | ||
69 | + })(req, res, next); | ||
68 | }, | 70 | }, |
69 | callback: (req, res, next) => { | 71 | callback: (req, res, next) => { |
70 | passport.authenticate('weixin', (err, user) => { | 72 | passport.authenticate('weixin', (err, user) => { |
@@ -72,8 +74,8 @@ const wechat = { | @@ -72,8 +74,8 @@ const wechat = { | ||
72 | log.error(`wechat authenticate error : ${JSON.stringify(err)}`); | 74 | log.error(`wechat authenticate error : ${JSON.stringify(err)}`); |
73 | return res.redirect(loginPage); | 75 | return res.redirect(loginPage); |
74 | } | 76 | } |
75 | - let nickname = user.displayName || user._json.nickname; | ||
76 | - let openId = user.id || user._json.unionid; | 77 | + let nickname = user._json.nickname || user.displayName; |
78 | + let openId = user._json.unionid || user.id; | ||
77 | 79 | ||
78 | doPassportCallback(openId, nickname, 'wechat', req, res); | 80 | doPassportCallback(openId, nickname, 'wechat', req, res); |
79 | })(req, res, next); | 81 | })(req, res, next); |
@@ -13,8 +13,8 @@ module.exports = { | @@ -13,8 +13,8 @@ module.exports = { | ||
13 | port: 6001, | 13 | port: 6001, |
14 | siteUrl: '//m.yohobuy.com', | 14 | siteUrl: '//m.yohobuy.com', |
15 | domains: { | 15 | domains: { |
16 | - api: 'http://testapi.yoho.cn:58078/', | ||
17 | - service: 'http://testservice.yoho.cn:58077/' | 16 | + api: 'http://testapi.yoho.cn:28078/', |
17 | + service: 'http://testservice.yoho.cn:28077/' | ||
18 | }, | 18 | }, |
19 | useOneapm: false, | 19 | useOneapm: false, |
20 | useCache: false, | 20 | useCache: false, |
@@ -64,9 +64,9 @@ if (isProduction) { | @@ -64,9 +64,9 @@ if (isProduction) { | ||
64 | service: 'http://service.yoho.yohoops.org/' | 64 | service: 'http://service.yoho.yohoops.org/' |
65 | }, | 65 | }, |
66 | memcache: { | 66 | memcache: { |
67 | - master: ['172.31.22.1:12111', '172.31.20.56:12111', '172.31.31.146:12111'], | ||
68 | - slave: ['172.31.22.1:12112', '172.31.20.56:12112', '172.31.31.146:12112'], | ||
69 | - session: ['172.31.22.1:12111', '172.31.20.56:12111', '172.31.31.146:12111'], | 67 | + master: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111', 'memcache3.yohoops.org:12111'], |
68 | + slave: ['memcache1.yohoops.org:12112', 'memcache2.yohoops.org:12112', 'memcache3.yohoops.org:12112'], | ||
69 | + session: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111', 'memcache3.yohoops.org:12111'], | ||
70 | timeout: 1000, | 70 | timeout: 1000, |
71 | retries: 0 | 71 | retries: 0 |
72 | }, | 72 | }, |
@@ -15,5 +15,5 @@ module.exports = app => { | @@ -15,5 +15,5 @@ module.exports = app => { | ||
15 | app.use('/product', require('./apps/product')); | 15 | app.use('/product', require('./apps/product')); |
16 | app.use('/guang', require('./apps/guang')); | 16 | app.use('/guang', require('./apps/guang')); |
17 | app.use('/passport', require('./apps/passport')); | 17 | app.use('/passport', require('./apps/passport')); |
18 | - app.use('/coupon', require('./apps/coupon')); | 18 | + app.use('/activity', require('./apps/activity')); |
19 | }; | 19 | }; |
@@ -17,6 +17,7 @@ | @@ -17,6 +17,7 @@ | ||
17 | <script type="text/javascript"> | 17 | <script type="text/javascript"> |
18 | (function(d,c){var e=d.documentElement,a="orientationchange" in window?"orientationchange":"resize",b=function(){var f=e.clientWidth;if(!f){return}if(f>=640){e.style.fontSize="40px"}else{e.style.fontSize=40*(f/640)+"px"}};if(!d.addEventListener){return}b();c.addEventListener(a,b,false);d.addEventListener("DOMContentLoaded",b,false)})(document,window); | 18 | (function(d,c){var e=d.documentElement,a="orientationchange" in window?"orientationchange":"resize",b=function(){var f=e.clientWidth;if(!f){return}if(f>=640){e.style.fontSize="40px"}else{e.style.fontSize=40*(f/640)+"px"}};if(!d.addEventListener){return}b();c.addEventListener(a,b,false);d.addEventListener("DOMContentLoaded",b,false)})(document,window); |
19 | </script> | 19 | </script> |
20 | + <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script> | ||
20 | {{#if devEnv}} | 21 | {{#if devEnv}} |
21 | <link rel="stylesheet" href="//localhost:5001/css/index.css"> | 22 | <link rel="stylesheet" href="//localhost:5001/css/index.css"> |
22 | {{^}} | 23 | {{^}} |
@@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
4 | * @return {[string]} | 4 | * @return {[string]} |
5 | */ | 5 | */ |
6 | 'use strict'; | 6 | 'use strict'; |
7 | +const sign = require('./sign'); | ||
7 | 8 | ||
8 | exports.getUid = (req) => { | 9 | exports.getUid = (req) => { |
9 | const cookie = req.cookies._UID; | 10 | const cookie = req.cookies._UID; |
@@ -21,6 +22,11 @@ exports.getUid = (req) => { | @@ -21,6 +22,11 @@ exports.getUid = (req) => { | ||
21 | } | 22 | } |
22 | } | 23 | } |
23 | 24 | ||
25 | + // 校验 cookie 的 uid 有没有被修改 | ||
26 | + if (req.cookies._TOKEN !== sign.makeToken(_uid)) { | ||
27 | + _uid = 0; | ||
28 | + } | ||
29 | + | ||
24 | return _uid; | 30 | return _uid; |
25 | }; | 31 | }; |
26 | 32 |
@@ -33,9 +33,11 @@ | @@ -33,9 +33,11 @@ | ||
33 | "dependencies": { | 33 | "dependencies": { |
34 | "bluebird": "^3.4.0", | 34 | "bluebird": "^3.4.0", |
35 | "body-parser": "^1.15.0", | 35 | "body-parser": "^1.15.0", |
36 | + "connect-memcached": "^0.2.0", | ||
36 | "cookie-parser": "^1.4.3", | 37 | "cookie-parser": "^1.4.3", |
37 | "express": "^4.13.1", | 38 | "express": "^4.13.1", |
38 | "express-handlebars": "^3.0.0", | 39 | "express-handlebars": "^3.0.0", |
40 | + "express-session": "^1.13.0", | ||
39 | "influxdb-winston": "^1.0.1", | 41 | "influxdb-winston": "^1.0.1", |
40 | "lodash": "^4.13.1", | 42 | "lodash": "^4.13.1", |
41 | "md5": "^2.1.0", | 43 | "md5": "^2.1.0", |
@@ -44,15 +46,12 @@ | @@ -44,15 +46,12 @@ | ||
44 | "morgan": "^1.7.0", | 46 | "morgan": "^1.7.0", |
45 | "oneapm": "^1.2.20", | 47 | "oneapm": "^1.2.20", |
46 | "passport": "^0.3.2", | 48 | "passport": "^0.3.2", |
47 | - "passport-weixin-plus": "0.0.4", | 49 | + "passport-weixin": "^0.1.0", |
48 | "request-promise": "^3.0.0", | 50 | "request-promise": "^3.0.0", |
49 | "serve-favicon": "^2.3.0", | 51 | "serve-favicon": "^2.3.0", |
50 | "uuid": "^2.0.2", | 52 | "uuid": "^2.0.2", |
51 | "winston": "^2.2.0", | 53 | "winston": "^2.2.0", |
52 | - "winston-daily-rotate-file": "^1.1.3", | ||
53 | - "yoho-connect-memcached": "^1.0.3", | ||
54 | - "yoho-express-session": "^1.0.3", | ||
55 | - "yoho-iscroll": "0.0.1" | 54 | + "winston-daily-rotate-file": "^1.1.4" |
56 | }, | 55 | }, |
57 | "devDependencies": { | 56 | "devDependencies": { |
58 | "autoprefixer": "^6.3.6", | 57 | "autoprefixer": "^6.3.6", |
@@ -85,7 +84,7 @@ | @@ -85,7 +84,7 @@ | ||
85 | "precss": "^1.4.0", | 84 | "precss": "^1.4.0", |
86 | "rewire": "^2.5.1", | 85 | "rewire": "^2.5.1", |
87 | "shelljs": "^0.7.0", | 86 | "shelljs": "^0.7.0", |
88 | - "stylelint": "^6.5.1", | 87 | + "stylelint": "^6.6.0", |
89 | "stylelint-config-yoho": "^1.2.3", | 88 | "stylelint-config-yoho": "^1.2.3", |
90 | "webpack": "^1.13.1", | 89 | "webpack": "^1.13.1", |
91 | "webpack-dev-server": "^1.14.1", | 90 | "webpack-dev-server": "^1.14.1", |
public/.DS_Store
0 → 100644
No preview for this file type
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
@@ -205,6 +205,7 @@ gulp.task('webpack', () => { | @@ -205,6 +205,7 @@ gulp.task('webpack', () => { | ||
205 | var proConfig = Object.assign({}, webpackConfig); | 205 | var proConfig = Object.assign({}, webpackConfig); |
206 | 206 | ||
207 | proConfig.output.path = dist.js; | 207 | proConfig.output.path = dist.js; |
208 | + proConfig.plugins = [new webpack.optimize.UglifyJsPlugin()]; | ||
208 | webpack(proConfig, (err, stats) => { | 209 | webpack(proConfig, (err, stats) => { |
209 | if (err) { | 210 | if (err) { |
210 | throw new gutil.PluginError('webpack', err); | 211 | throw new gutil.PluginError('webpack', err); |
public/img/.DS_Store
0 → 100644
No preview for this file type
public/img/channel/.DS_Store
0 → 100644
No preview for this file type
@@ -6,7 +6,14 @@ var $ = require('yoho-jquery'), | @@ -6,7 +6,14 @@ var $ = require('yoho-jquery'), | ||
6 | oldUserCouponPic = $('#oldUserCouponPic').html(), | 6 | oldUserCouponPic = $('#oldUserCouponPic').html(), |
7 | newUserCouponPic = $('#newUserCouponPic').html(), | 7 | newUserCouponPic = $('#newUserCouponPic').html(), |
8 | tipMessage = $('#tipMessage').html(), | 8 | tipMessage = $('#tipMessage').html(), |
9 | - activityID = $('#activityID').html(); | 9 | + activityID = $('#activityID').html(), |
10 | + pageInfo = $('#pageInfo').html(), | ||
11 | + _weChatInterface = 'http://www.yohoshow.com/api/wechat/getSignPackage', | ||
12 | + shareTitle = $('#shareTitle').val(), | ||
13 | + shareImg = $('#shareImg').val(), | ||
14 | + shareDesc = $('#shareDesc').val(), | ||
15 | + shareLink = $('#shareLink').val(), | ||
16 | + wx = window.wx; | ||
10 | 17 | ||
11 | $('#phone').bind('input propertychange', function() { | 18 | $('#phone').bind('input propertychange', function() { |
12 | if ($(this).val().length === 11) { | 19 | if ($(this).val().length === 11) { |
@@ -42,8 +49,90 @@ if (!$('#newUser').html()) { | @@ -42,8 +49,90 @@ if (!$('#newUser').html()) { | ||
42 | $('.gain-coupon-centent .coupon img').attr('src', oldUserCouponPic); | 49 | $('.gain-coupon-centent .coupon img').attr('src', oldUserCouponPic); |
43 | } | 50 | } |
44 | 51 | ||
45 | -$('.input-content').on('click', '.verification-code', function() { | ||
46 | - $('.input-content div').eq('0').removeClass('verification-code'); | 52 | +/** |
53 | + * 微信分享 | ||
54 | + */ | ||
55 | +if (typeof wx !== 'undefined') { | ||
56 | + $.getJSON(_weChatInterface + '?pageurl=' + | ||
57 | + encodeURIComponent(location.href.split('#')[0]) + '&callback=?', | ||
58 | + function(json) { | ||
59 | + var _appId, _timestamp, _nonceStr, _signature; | ||
60 | + | ||
61 | + if (json) { | ||
62 | + _appId = json.appId.toString(); | ||
63 | + _timestamp = json.timestamp; | ||
64 | + _nonceStr = json.nonceStr.toString(); | ||
65 | + _signature = json.signature.toString(); | ||
66 | + | ||
67 | + wx.config({ | ||
68 | + debug: false, | ||
69 | + appId: _appId, | ||
70 | + timestamp: _timestamp, | ||
71 | + nonceStr: _nonceStr, | ||
72 | + signature: _signature, | ||
73 | + jsApiList: [ | ||
74 | + 'checkJsApi', | ||
75 | + 'onMenuShareTimeline', | ||
76 | + 'onMenuShareAppMessage', | ||
77 | + 'onMenuShareQQ', | ||
78 | + 'onMenuShareWeibo', | ||
79 | + 'hideMenuItems', | ||
80 | + 'showMenuItems', | ||
81 | + 'hideAllNonBaseMenuItem', | ||
82 | + 'showAllNonBaseMenuItem', | ||
83 | + 'translateVoice', | ||
84 | + 'startRecord', | ||
85 | + 'stopRecord', | ||
86 | + 'onRecordEnd', | ||
87 | + 'playVoice', | ||
88 | + 'pauseVoice', | ||
89 | + 'stopVoice', | ||
90 | + 'uploadVoice', | ||
91 | + 'downloadVoice', | ||
92 | + 'chooseImage', | ||
93 | + 'previewImage', | ||
94 | + 'uploadImage', | ||
95 | + 'downloadImage', | ||
96 | + 'getNetworkType', | ||
97 | + 'openLocation', | ||
98 | + 'getLocation', | ||
99 | + 'hideOptionMenu', | ||
100 | + 'showOptionMenu', | ||
101 | + 'closeWindow', | ||
102 | + 'scanQRCode', | ||
103 | + 'chooseWXPay', | ||
104 | + 'openProductSpecificView', | ||
105 | + 'addCard', | ||
106 | + 'chooseCard', | ||
107 | + 'openCard' | ||
108 | + ] | ||
109 | + }); | ||
110 | + } | ||
111 | + }); | ||
112 | + | ||
113 | + wx.ready(function() { | ||
114 | + var shareData = { | ||
115 | + title: shareTitle, | ||
116 | + desc: shareDesc, | ||
117 | + imgUrl: shareImg, | ||
118 | + link: shareLink | ||
119 | + }; | ||
120 | + | ||
121 | + // 分享给朋友 | ||
122 | + wx.onMenuShareAppMessage(shareData); | ||
123 | + | ||
124 | + // 分享到朋友圈 | ||
125 | + wx.onMenuShareTimeline(shareData); | ||
126 | + | ||
127 | + // 分享到QQ | ||
128 | + wx.onMenuShareQQ(shareData); | ||
129 | + | ||
130 | + // 分享到微博 | ||
131 | + wx.onMenuShareWeibo(shareData); | ||
132 | + }); | ||
133 | +} | ||
134 | + | ||
135 | +$('.input-content div').on('click', function() { | ||
47 | phone = $(this).siblings('input').val(); | 136 | phone = $(this).siblings('input').val(); |
48 | reg = /[0-9]{11}/; | 137 | reg = /[0-9]{11}/; |
49 | if (!reg.test(phone)) { | 138 | if (!reg.test(phone)) { |
@@ -58,12 +147,11 @@ $('.input-content').on('click', '.verification-code', function() { | @@ -58,12 +147,11 @@ $('.input-content').on('click', '.verification-code', function() { | ||
58 | return; | 147 | return; |
59 | } | 148 | } |
60 | $.ajax({ | 149 | $.ajax({ |
61 | - url: '/coupon/phone', | 150 | + url: '/activity/coupon/phone', |
62 | data: { | 151 | data: { |
63 | mobile: $('#phone').val(), | 152 | mobile: $('#phone').val(), |
64 | ordercode: orderCode | 153 | ordercode: orderCode |
65 | }, | 154 | }, |
66 | - dataType: 'json', | ||
67 | success: function(data) { | 155 | success: function(data) { |
68 | if (data.result.code === 200) { | 156 | if (data.result.code === 200) { |
69 | if (window._yas) { | 157 | if (window._yas) { |
@@ -122,11 +210,15 @@ $('.input-content').on('click', '.verification-code', function() { | @@ -122,11 +210,15 @@ $('.input-content').on('click', '.verification-code', function() { | ||
122 | }, 1400); | 210 | }, 1400); |
123 | } | 211 | } |
124 | }, | 212 | }, |
125 | - error: function(data) { | 213 | + error: function() { |
126 | $('#dialog').removeClass('hidden'); | 214 | $('#dialog').removeClass('hidden'); |
127 | $('.mask').removeClass('hidden'); | 215 | $('.mask').removeClass('hidden'); |
128 | $('#dialog .content').html('<p class="phone-error">网络错误,稍后再试!<p>'); | 216 | $('#dialog .content').html('<p class="phone-error">网络错误,稍后再试!<p>'); |
129 | - console.log(data); | 217 | + setTimeout(function() { |
218 | + $('.messages').addClass('hidden'); | ||
219 | + $('.mask').addClass('hidden'); | ||
220 | + $('#dialog .content').html(' '); | ||
221 | + }, 1400); | ||
130 | } | 222 | } |
131 | }); | 223 | }); |
132 | }); | 224 | }); |
@@ -134,7 +226,7 @@ $('.input-content').on('click', '.get', function() { | @@ -134,7 +226,7 @@ $('.input-content').on('click', '.get', function() { | ||
134 | $('.input-content div').eq('1').removeClass('get'); | 226 | $('.input-content div').eq('1').removeClass('get'); |
135 | if ($(this).siblings('input').val().length === 4) { | 227 | if ($(this).siblings('input').val().length === 4) { |
136 | $.ajax({ | 228 | $.ajax({ |
137 | - url: '/coupon/verify', | 229 | + url: '/activity/coupon/verify', |
138 | data: { | 230 | data: { |
139 | identifycode: $('#verification').val(), | 231 | identifycode: $('#verification').val(), |
140 | mobile: $('#phone').val(), | 232 | mobile: $('#phone').val(), |
@@ -211,11 +303,15 @@ $('.input-content').on('click', '.get', function() { | @@ -211,11 +303,15 @@ $('.input-content').on('click', '.get', function() { | ||
211 | }, 1400); | 303 | }, 1400); |
212 | } | 304 | } |
213 | }, | 305 | }, |
214 | - error: function(data) { | 306 | + error: function() { |
215 | $('#dialog').removeClass('hidden'); | 307 | $('#dialog').removeClass('hidden'); |
216 | $('.mask').removeClass('hidden'); | 308 | $('.mask').removeClass('hidden'); |
217 | $('#dialog .content').html('<p class="phone-error">网络错误,稍后再试!<p>'); | 309 | $('#dialog .content').html('<p class="phone-error">网络错误,稍后再试!<p>'); |
218 | - console.log(data); | 310 | + setTimeout(function() { |
311 | + $('.messages').addClass('hidden'); | ||
312 | + $('.mask').addClass('hidden'); | ||
313 | + $('#dialog .content').html(' '); | ||
314 | + }, 1400); | ||
219 | } | 315 | } |
220 | }); | 316 | }); |
221 | } else { | 317 | } else { |
@@ -243,7 +339,7 @@ $('.description').on('click', function() { | @@ -243,7 +339,7 @@ $('.description').on('click', function() { | ||
243 | $('.mask').removeClass('hidden'); | 339 | $('.mask').removeClass('hidden'); |
244 | }); | 340 | }); |
245 | 341 | ||
246 | -$('.input-content').on('click', '.get', function() { | 342 | +$('.use-coupon-btn').on('click', function() { |
247 | if (window._yas) { | 343 | if (window._yas) { |
248 | window._yas.sendCustomInfo({ | 344 | window._yas.sendCustomInfo({ |
249 | activityID: activityID | 345 | activityID: activityID |
@@ -210,7 +210,7 @@ exports.processFilter = (list, options) => { | @@ -210,7 +210,7 @@ exports.processFilter = (list, options) => { | ||
210 | subs: [] | 210 | subs: [] |
211 | }; | 211 | }; |
212 | 212 | ||
213 | - if (key === 'group_sort') { | 213 | + if (key === 'group_sort' || !filtersType[key]) { |
214 | return; | 214 | return; |
215 | } | 215 | } |
216 | 216 |
-
Please register or login to post a comment