4.9.1 -> feature_student
Showing
9 changed files
with
252 additions
and
97 deletions
@@ -6,11 +6,13 @@ const crypto = global.yoho.crypto; | @@ -6,11 +6,13 @@ const crypto = global.yoho.crypto; | ||
6 | const queryString = require('querystring'); | 6 | const queryString = require('querystring'); |
7 | const Promise = require('bluebird'); | 7 | const Promise = require('bluebird'); |
8 | const co = Promise.coroutine; | 8 | const co = Promise.coroutine; |
9 | +const headerModel = require('../../../doraemon/models/header'); // 头部model | ||
9 | 10 | ||
10 | 11 | ||
11 | const getResource = code => { | 12 | const getResource = code => { |
12 | return serviceApi.get('operations/api/v5/resource/get', { | 13 | return serviceApi.get('operations/api/v5/resource/get', { |
13 | - content_code: code | 14 | + content_code: code, |
15 | + platform: 'iphone' | ||
14 | }); | 16 | }); |
15 | }; | 17 | }; |
16 | const vip = (limit) => { | 18 | const vip = (limit) => { |
@@ -27,6 +29,8 @@ const verifiedStudentTotal = () => { | @@ -27,6 +29,8 @@ const verifiedStudentTotal = () => { | ||
27 | const getProvince = () => { | 29 | const getProvince = () => { |
28 | return api.get('', { | 30 | return api.get('', { |
29 | method: 'app.studentMarket.getAddressList' | 31 | method: 'app.studentMarket.getAddressList' |
32 | + }, { | ||
33 | + cache: true | ||
30 | }); | 34 | }); |
31 | }; | 35 | }; |
32 | const getSchool = code => { | 36 | const getSchool = code => { |
@@ -91,26 +95,45 @@ const getPlatForm = (req) => { | @@ -91,26 +95,45 @@ const getPlatForm = (req) => { | ||
91 | 95 | ||
92 | yoho.isiOS = /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(userAgent); | 96 | yoho.isiOS = /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(userAgent); |
93 | yoho.isAndroid = /Android/i.test(userAgent); | 97 | yoho.isAndroid = /Android/i.test(userAgent); |
94 | - yoho.isApp = /YohoBuy/i.test(req.get('User-Agent')); | 98 | + yoho.isApp = /YohoBuy/i.test(req.get('User-Agent')) || (req.query.app_version && req.query.client_type); |
99 | + yoho.isSupportStudent = !yoho.isApp || (/^4.9/i.test(req.query.app_version) && !/^4.9.0/i.test(req.query.app_version)); | ||
95 | yoho.http = 'http:'; | 100 | yoho.http = 'http:'; |
96 | if (isProduction) { | 101 | if (isProduction) { |
97 | yoho.http = 'https:'; | 102 | yoho.http = 'https:'; |
98 | } | 103 | } |
99 | yoho.uid = uids && uids.length === 2 ? uids[1] : ''; // 8041246 | 104 | yoho.uid = uids && uids.length === 2 ? uids[1] : ''; // 8041246 |
100 | - yoho.uid = req.user.uid || yoho.uid; | 105 | + yoho.uid = req.user.uid || yoho.uid || req.query.uid || ''; |
101 | yoho.isLogin = yoho.uid ? true : false; | 106 | yoho.isLogin = yoho.uid ? true : false; |
102 | return co(function*() { | 107 | return co(function*() { |
103 | let data = yield getUser(yoho.uid); | 108 | let data = yield getUser(yoho.uid); |
104 | 109 | ||
105 | yoho.isStudent = data.data && data.data.vip_info && data.data.vip_info.is_student ? true : false; | 110 | yoho.isStudent = data.data && data.data.vip_info && data.data.vip_info.is_student ? true : false; |
106 | - console.log(yoho); | 111 | + |
112 | + // console.log(yoho); | ||
107 | return yoho; | 113 | return yoho; |
108 | })(); | 114 | })(); |
109 | 115 | ||
110 | 116 | ||
111 | }; | 117 | }; |
112 | 118 | ||
113 | - | 119 | +// const getRequest = (url)=>{ |
120 | +// | ||
121 | +// let regurl = /^[^\?]+\?([\w\W]+)$/; | ||
122 | +// let regpara = /([^&=]+)=([\w\W]*?)(&|$|#)/g; | ||
123 | +// let ret = {}; | ||
124 | +// let strpara, | ||
125 | +// result; | ||
126 | +// | ||
127 | +// let arrurl = regurl.exec(url); | ||
128 | +// | ||
129 | +// if (arrurl && arrurl[1]) { | ||
130 | +// strpara = arrurl[1]; | ||
131 | +// while ((result = regpara.exec(strpara)) !== null) { | ||
132 | +// ret[result[1]] = result[2]; | ||
133 | +// } | ||
134 | +// } | ||
135 | +// return ret; | ||
136 | +// }; | ||
114 | 137 | ||
115 | 138 | ||
116 | exports.index = (req, res, next) => { | 139 | exports.index = (req, res, next) => { |
@@ -118,12 +141,16 @@ exports.index = (req, res, next) => { | @@ -118,12 +141,16 @@ exports.index = (req, res, next) => { | ||
118 | let uid = req.__USER__.uid; | 141 | let uid = req.__USER__.uid; |
119 | let options; | 142 | let options; |
120 | 143 | ||
144 | + | ||
145 | + | ||
121 | Promise.all([getResource(code), vip()]).then(datas => { | 146 | Promise.all([getResource(code), vip()]).then(datas => { |
122 | let coupons, | 147 | let coupons, |
123 | activities, | 148 | activities, |
124 | banner, | 149 | banner, |
125 | icons, | 150 | icons, |
126 | link, | 151 | link, |
152 | + // url, | ||
153 | + // param, | ||
127 | couponids = []; | 154 | couponids = []; |
128 | 155 | ||
129 | (datas[0].data || []).forEach((item) => { | 156 | (datas[0].data || []).forEach((item) => { |
@@ -148,11 +175,22 @@ exports.index = (req, res, next) => { | @@ -148,11 +175,22 @@ exports.index = (req, res, next) => { | ||
148 | break; | 175 | break; |
149 | } | 176 | } |
150 | }); | 177 | }); |
151 | - | ||
152 | if (coupons && coupons.data) { | 178 | if (coupons && coupons.data) { |
153 | - coupons.link = link && link.data ? link.data[0].url + '&app_version=1' : ''; | 179 | + coupons.link = link && link.data ? link.data[0].url + (req.__USER__.isApp ? '&app_version=1' : '') : ''; |
154 | coupons.data = (coupons.data || []).map((item) => { | 180 | coupons.data = (coupons.data || []).map((item) => { |
155 | couponids.push(item.couponID); | 181 | couponids.push(item.couponID); |
182 | + | ||
183 | + // if (item.image.url.indexOf('?') === -1) { | ||
184 | + // item.image.url += '?'; | ||
185 | + // } | ||
186 | + // | ||
187 | + // | ||
188 | + // url = item.image.url.substring(0, item.image.url.indexOf('?')); | ||
189 | + // | ||
190 | + // param = JSON.stringify(getRequest(item.image.url)); | ||
191 | + // item.image.url = item.image.url + '&app_version=1&openby:yohobuy={"action":"go.h5","params":{"islogin":"N","url":"' + url + '","param":' + param + '}}'; | ||
192 | + | ||
193 | + // console.log(item); | ||
156 | return item; | 194 | return item; |
157 | }); | 195 | }); |
158 | } | 196 | } |
@@ -161,6 +199,7 @@ exports.index = (req, res, next) => { | @@ -161,6 +199,7 @@ exports.index = (req, res, next) => { | ||
161 | coupons.data = (coupons.data || []).map((item)=>{ | 199 | coupons.data = (coupons.data || []).map((item)=>{ |
162 | item.status = 1; | 200 | item.status = 1; |
163 | (cous.data || []).forEach((it) => { | 201 | (cous.data || []).forEach((it) => { |
202 | + | ||
164 | if (+it.couponId === +item.couponID) { | 203 | if (+it.couponId === +item.couponID) { |
165 | item.hasNum = it.hasNum; | 204 | item.hasNum = it.hasNum; |
166 | item.status = it.status; | 205 | item.status = it.status; |
@@ -171,7 +210,7 @@ exports.index = (req, res, next) => { | @@ -171,7 +210,7 @@ exports.index = (req, res, next) => { | ||
171 | }); | 210 | }); |
172 | 211 | ||
173 | 212 | ||
174 | - | 213 | + datas[1].data = datas[1].data || {}; |
175 | datas[1].data.product_list = (datas[1].data.product_list || []).map(function(value) { | 214 | datas[1].data.product_list = (datas[1].data.product_list || []).map(function(value) { |
176 | value.goodsId = value.goods_list[0].goods_id; | 215 | value.goodsId = value.goods_list[0].goods_id; |
177 | value.url = helpers.urlFormat(`/product/pro_${value.product_id}_${value.goodsId}/${value.cn_alphabet}.html`) + `?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":${value.product_skn}}}`; | 216 | value.url = helpers.urlFormat(`/product/pro_${value.product_id}_${value.goodsId}/${value.cn_alphabet}.html`) + `?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":${value.product_skn}}}`; |
@@ -186,10 +225,18 @@ exports.index = (req, res, next) => { | @@ -186,10 +225,18 @@ exports.index = (req, res, next) => { | ||
186 | coupons: coupons, | 225 | coupons: coupons, |
187 | activities: activities, | 226 | activities: activities, |
188 | isStudent: req.__USER__.isStudent, | 227 | isStudent: req.__USER__.isStudent, |
228 | + isSupportStudent: req.__USER__.isSupportStudent, | ||
189 | isLogin: req.__USER__.isLogin, | 229 | isLogin: req.__USER__.isLogin, |
190 | title: '有货学生专享优惠', | 230 | title: '有货学生专享优惠', |
191 | - http: req.__USER__.http | 231 | + http: req.__USER__.http, |
232 | + uid: req.__USER__.uid | ||
192 | }; | 233 | }; |
234 | + if (!req.__USER__.isApp) { | ||
235 | + options.pageHeader = headerModel.setNav({ | ||
236 | + navTitle: options.title, | ||
237 | + navBtn: true | ||
238 | + }); | ||
239 | + } | ||
193 | 240 | ||
194 | options.loginUrl = '//m.yohobuy.com/activity/student/register'; | 241 | options.loginUrl = '//m.yohobuy.com/activity/student/register'; |
195 | if (options.isApp) { | 242 | if (options.isApp) { |
@@ -200,7 +247,7 @@ exports.index = (req, res, next) => { | @@ -200,7 +247,7 @@ exports.index = (req, res, next) => { | ||
200 | options.loginUrl = options.loginUrl + '?openby:yohobuy={"action":"go.h5","params":{"islogin":"N","url":"' + req.__USER__.http + '//m.yohobuy.com/activity/student/register"}}'; | 247 | options.loginUrl = options.loginUrl + '?openby:yohobuy={"action":"go.h5","params":{"islogin":"N","url":"' + req.__USER__.http + '//m.yohobuy.com/activity/student/register"}}'; |
201 | } | 248 | } |
202 | } else { | 249 | } else { |
203 | - options.loginUrl = options.loginUrl + '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' + req.__USER__.http + '//m.yohobuy.com/activity/student/register"}}}'; | 250 | + options.loginUrl = options.loginUrl + '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' + req.__USER__.http + '//m.yohobuy.com/activity/student"}}}'; |
204 | } | 251 | } |
205 | } else { | 252 | } else { |
206 | if (options.isLogin) { | 253 | if (options.isLogin) { |
@@ -227,14 +274,23 @@ exports.province = (req, res, next) => { | @@ -227,14 +274,23 @@ exports.province = (req, res, next) => { | ||
227 | }; | 274 | }; |
228 | 275 | ||
229 | exports.register = (req, res, next) => { | 276 | exports.register = (req, res, next) => { |
230 | - let years = []; | 277 | + let years = [], |
278 | + refer; | ||
231 | 279 | ||
232 | for (let i = 0; i < 8; i++) { | 280 | for (let i = 0; i < 8; i++) { |
233 | years.push((new Date()).getFullYear() - i); | 281 | years.push((new Date()).getFullYear() - i); |
234 | } | 282 | } |
235 | Promise.all([verifiedStudentTotal(), getEducationLevelList()]).then((arr) => { | 283 | Promise.all([verifiedStudentTotal(), getEducationLevelList()]).then((arr) => { |
236 | if (req.__USER__.isStudent) { | 284 | if (req.__USER__.isStudent) { |
237 | - res.redirect(helpers.urlFormat('/activity/student')); | 285 | + refer = req.get('referer') || '/home?openby:yohobuy={"action":"go.mine"}';// TODO |
286 | + | ||
287 | + // if (refer) { | ||
288 | + // refer = decodeURI(req.cookies.refer); | ||
289 | + // } else { | ||
290 | + // refer = '/activity/student'; | ||
291 | + // } | ||
292 | + // refer = refer; | ||
293 | + res.redirect(helpers.urlFormat(refer)); | ||
238 | } else { | 294 | } else { |
239 | res.render('register', { | 295 | res.render('register', { |
240 | title: '认证信息填写', | 296 | title: '认证信息填写', |
@@ -308,7 +364,9 @@ exports.verifystudent = (req, res, next) => { | @@ -308,7 +364,9 @@ exports.verifystudent = (req, res, next) => { | ||
308 | isverify: isverify, | 364 | isverify: isverify, |
309 | prompt: prompt, | 365 | prompt: prompt, |
310 | isLogin: user.data && user.data.vip_info && user.data.vip_info.is_student ? true : false, | 366 | isLogin: user.data && user.data.vip_info && user.data.vip_info.is_student ? true : false, |
311 | - title: '学生身份认证' | 367 | + title: '学生身份认证', |
368 | + http: req.__USER__.http, | ||
369 | + uid: req.__USER__.uid | ||
312 | }); | 370 | }); |
313 | }).catch(next); | 371 | }).catch(next); |
314 | 372 | ||
@@ -335,7 +393,7 @@ exports.detail = (req, res) => { | @@ -335,7 +393,7 @@ exports.detail = (req, res) => { | ||
335 | }; | 393 | }; |
336 | 394 | ||
337 | exports.isLogin = (req, res, next) => { | 395 | exports.isLogin = (req, res, next) => { |
338 | - let refer = req.cookies.refer; | 396 | + // let refer = req.cookies.refer; |
339 | 397 | ||
340 | 398 | ||
341 | getPlatForm(req).then((yoho)=>{ | 399 | getPlatForm(req).then((yoho)=>{ |
@@ -345,21 +403,22 @@ exports.isLogin = (req, res, next) => { | @@ -345,21 +403,22 @@ exports.isLogin = (req, res, next) => { | ||
345 | return; | 403 | return; |
346 | } | 404 | } |
347 | 405 | ||
348 | - if (refer) { | ||
349 | - refer = decodeURI(req.cookies.refer); | ||
350 | - } else { | ||
351 | - refer = '/activity/student/register'; | ||
352 | - } | 406 | + // refer = decodeURI(req.cookies.refer)||req.get("refer"); |
407 | + // | ||
408 | + // if (refer) { | ||
409 | + // refer = decodeURI(req.cookies.refer)||req.get("refer"); | ||
410 | + // } else { | ||
411 | + // refer = '/activity/student/register'; | ||
412 | + // } | ||
353 | 413 | ||
354 | res.redirect(helpers.urlFormat('/signin.html', { | 414 | res.redirect(helpers.urlFormat('/signin.html', { |
355 | - refer: refer | 415 | + refer: req.get('referer') || '/activity/student/register' |
356 | })); | 416 | })); |
357 | }); | 417 | }); |
358 | 418 | ||
359 | 419 | ||
360 | }; | 420 | }; |
361 | 421 | ||
362 | - | ||
363 | exports.getUser = (req, res, next)=>{ | 422 | exports.getUser = (req, res, next)=>{ |
364 | getPlatForm(req).then((yoho)=>{ | 423 | getPlatForm(req).then((yoho)=>{ |
365 | req.__USER__ = yoho; | 424 | req.__USER__ = yoho; |
@@ -13,10 +13,10 @@ | @@ -13,10 +13,10 @@ | ||
13 | </section> | 13 | </section> |
14 | <div class="s-form"> | 14 | <div class="s-form"> |
15 | <section class="s-feild"> | 15 | <section class="s-feild"> |
16 | - <label>真实姓名</label><input type="text" name="tb_name" id="tb_name" placeholder="请输入您的真实姓名"> | 16 | + <label>真实姓名</label><input type="text" name="tb_name" id="tb_name" placeholder="请输入您的真实姓名" > |
17 | </section> | 17 | </section> |
18 | <section class="s-feild"> | 18 | <section class="s-feild"> |
19 | - <label>身份证号</label><input type="text" id="tb_cert_no" name="tb_cert_no" placeholder="请输入您身份证号码"> | 19 | + <label>身份证号</label><input type="text" id="tb_cert_no" name="tb_cert_no" placeholder="请输入您身份证号码" maxlength="18"> |
20 | </section> | 20 | </section> |
21 | <section class="s-feild" data-aslider-in="province|fade"> | 21 | <section class="s-feild" data-aslider-in="province|fade"> |
22 | <label>学校省份</label><input type="text" id="s-province-tb" name="s-province-tb" readonly="readonly" placeholder="请选择省份"><span class="s-select iconfont" ></span> | 22 | <label>学校省份</label><input type="text" id="s-province-tb" name="s-province-tb" readonly="readonly" placeholder="请选择省份"><span class="s-select iconfont" ></span> |
@@ -34,7 +34,9 @@ | @@ -34,7 +34,9 @@ | ||
34 | </div> | 34 | </div> |
35 | <div class="s-footer"> | 35 | <div class="s-footer"> |
36 | <section class="s-shenming"> | 36 | <section class="s-shenming"> |
37 | - <span class="checkbox icon-s-checked iconfont"></span> | 37 | + <input type="checkbox" id="checkbox" class="regular-checkbox" style="visibility: hidden;"> |
38 | + <label class="checkbox icon-s-checked iconfont" for="checkbox"> | ||
39 | + </label> | ||
38 | 同意<a class="s-blue" href='//m.yohobuy.com/activity/student/detail/renzhen?openby:yohobuy={"action":"go.h5","params":{"islogin":"N","url":"{{http}}//m.yohobuy.com/activity/student/detail/renzhen"}}'>Yoho!Buy有货学生认证协议</a> | 40 | 同意<a class="s-blue" href='//m.yohobuy.com/activity/student/detail/renzhen?openby:yohobuy={"action":"go.h5","params":{"islogin":"N","url":"{{http}}//m.yohobuy.com/activity/student/detail/renzhen"}}'>Yoho!Buy有货学生认证协议</a> |
39 | </section> | 41 | </section> |
40 | <a class="s-submit" href="javascript:void(0);">去支付宝完成认证</a> | 42 | <a class="s-submit" href="javascript:void(0);">去支付宝完成认证</a> |
@@ -78,8 +80,10 @@ | @@ -78,8 +80,10 @@ | ||
78 | <div class="mobile-container"> | 80 | <div class="mobile-container"> |
79 | <div class="mobile-wrap yoho-page student"> | 81 | <div class="mobile-wrap yoho-page student"> |
80 | <section class='s-search'> | 82 | <section class='s-search'> |
83 | + <span class="iconfont s-empty"></span> | ||
81 | <div class='s-seach-tip'><span class="iconfont search-icon empty"></span>搜索学校</div> | 84 | <div class='s-seach-tip'><span class="iconfont search-icon empty"></span>搜索学校</div> |
82 | - <input id='s-search-school' class='s-input-search'> | 85 | + <input id='s-search-school' class='s-input-search'> |
86 | + <span class="iconfont s-clear"></span> | ||
83 | </section> | 87 | </section> |
84 | <div class='s-items' id='s-school'> | 88 | <div class='s-items' id='s-school'> |
85 | </div> | 89 | </div> |
1 | -{{#unless isApp}} | ||
2 | -<header class="yoho-header"> | ||
3 | - <a href="javascript:history.go(-1);" class="iconfont nav-back"></a> | ||
4 | - <p class="nav-title">有货学生专享优惠</p> | ||
5 | -</header> | ||
6 | -{{/unless}} | 1 | + |
7 | <div class="mobile-container"> | 2 | <div class="mobile-container"> |
8 | <div class="mobile-wrap yoho-page student"> | 3 | <div class="mobile-wrap yoho-page student"> |
9 | {{! 头部banner}} | 4 | {{! 头部banner}} |
@@ -32,15 +27,20 @@ | @@ -32,15 +27,20 @@ | ||
32 | <a class='more' href="{{link}}">...</a> | 27 | <a class='more' href="{{link}}">...</a> |
33 | </h1> | 28 | </h1> |
34 | <div class='s-coupon-contain'> | 29 | <div class='s-coupon-contain'> |
30 | + <style type="text/css"> | ||
31 | + .no-bg{ | ||
32 | + color: #fff!important; | ||
33 | + background-image: none!important; | ||
34 | + } | ||
35 | + </style> | ||
35 | {{#each data}} | 36 | {{#each data}} |
36 | <div class="coupon-floor" coupon-id="{{couponID}}"> | 37 | <div class="coupon-floor" coupon-id="{{couponID}}"> |
37 | <div class="floor-main" style="background-image: url({{image image.src 0 0}});"> | 38 | <div class="floor-main" style="background-image: url({{image image.src 0 0}});"> |
38 | - <a href="{{image.url}}" class="main-left"></a> | ||
39 | - | ||
40 | - <a href="{{image.url}}" class="main-right-use" > | 39 | + <a href='{{image.url}}' class="main-left"></a> |
40 | + <a href='{{image.url}}' class="main-right-use" > | ||
41 | {{#isEqual status 1}} | 41 | {{#isEqual status 1}} |
42 | - <span class="on-receive on-lingqu" style="color: #fff;background-image: none;"> | ||
43 | - <p>可以</p> | 42 | + <span class="on-receive on-lingqu no-bg"> |
43 | + <p>点击</p> | ||
44 | <p>领取</p> | 44 | <p>领取</p> |
45 | </span> | 45 | </span> |
46 | {{/isEqual}} | 46 | {{/isEqual}} |
@@ -51,7 +51,7 @@ | @@ -51,7 +51,7 @@ | ||
51 | <span class="received"></span> | 51 | <span class="received"></span> |
52 | {{/isEqual}} | 52 | {{/isEqual}} |
53 | {{#isEqual status 4}} | 53 | {{#isEqual status 4}} |
54 | - <span class="on-receive" style="color: #fff;background-image: none;"> | 54 | + <span class="on-receive no-bg" > |
55 | <p>已经</p> | 55 | <p>已经</p> |
56 | <p>过期</p> | 56 | <p>过期</p> |
57 | </span> | 57 | </span> |
@@ -76,7 +76,7 @@ | @@ -76,7 +76,7 @@ | ||
76 | {{/activities}} | 76 | {{/activities}} |
77 | 77 | ||
78 | <section class='s-section clearfix'> | 78 | <section class='s-section clearfix'> |
79 | - <h1>学生专享商品<a class="more" href="//search.m.yohobuy.com/?students=1&title=学生专享商品&app_version=1">...</a></h1> | 79 | + <h1>学生专享商品<a class="more" href="//search.m.yohobuy.com/?students=1&title=学生专享商品&uid={{uid}}{{#isApp}}&app_version=1{{/isApp}}">...</a></h1> |
80 | <div class='goods-list clearfix'> | 80 | <div class='goods-list clearfix'> |
81 | {{#each goods}} | 81 | {{#each goods}} |
82 | <div class="good-info"> | 82 | <div class="good-info"> |
@@ -118,13 +118,20 @@ | @@ -118,13 +118,20 @@ | ||
118 | </div> | 118 | </div> |
119 | {{/each}} | 119 | {{/each}} |
120 | </div> | 120 | </div> |
121 | - <a class='s-more' href='//search.m.yohobuy.com/?students=1&title=学生专享商品&app_version=1'>查看更多</a> | 121 | + <a class='s-more' href='//search.m.yohobuy.com/?students=1&title=学生专享商品&uid={{uid}}{{#isApp}}&app_version=1{{/isApp}}'>查看更多</a> |
122 | </section> | 122 | </section> |
123 | 123 | ||
124 | {{#loginUrl}} | 124 | {{#loginUrl}} |
125 | <div class='s-layout'> | 125 | <div class='s-layout'> |
126 | - 快来认证吧,认证通过即可享受专属优惠! | 126 | + {{#if @root.isSupportStudent}} |
127 | + 快来认证吧,认证通过即可享受专属优惠! | ||
128 | + {{else}} | ||
129 | + 请升级最新APP版本,完成认证 | ||
130 | + {{/if}} | ||
131 | + | ||
132 | + {{#if @root.isSupportStudent}} | ||
127 | <a class='s-renzhen' href='{{.}}'>立即认证</a> | 133 | <a class='s-renzhen' href='{{.}}'>立即认证</a> |
134 | + {{/if}} | ||
128 | </div> | 135 | </div> |
129 | <div class="s-replace"></div> | 136 | <div class="s-replace"></div> |
130 | {{/loginUrl}} | 137 | {{/loginUrl}} |
1 | +{{#unless isApp}} | ||
1 | <header class="yoho-header"> | 2 | <header class="yoho-header"> |
2 | <a href="//m.yohobuy.com/activity/student?openby:yohobuy={'action':'go.h5','params':{'islogin':'N','url':'{{http}}//m.yohobuy.com/activity/student'}}" class="iconfont nav-back"></a> | 3 | <a href="//m.yohobuy.com/activity/student?openby:yohobuy={'action':'go.h5','params':{'islogin':'N','url':'{{http}}//m.yohobuy.com/activity/student'}}" class="iconfont nav-back"></a> |
3 | <p class="nav-title">学生身份认证</p> | 4 | <p class="nav-title">学生身份认证</p> |
4 | </header> | 5 | </header> |
6 | +{{/unless}} | ||
5 | <div class="mobile-container"> | 7 | <div class="mobile-container"> |
6 | <div class="mobile-wrap yoho-page student"> | 8 | <div class="mobile-wrap yoho-page student"> |
7 | {{#if isverify}} | 9 | {{#if isverify}} |
@@ -18,7 +20,7 @@ | @@ -18,7 +20,7 @@ | ||
18 | </section> | 20 | </section> |
19 | {{/if}} | 21 | {{/if}} |
20 | <section class='s-section clearfix'> | 22 | <section class='s-section clearfix'> |
21 | - <h1>学生专享商品<a class="more" href="//search.m.yohobuy.com/?students=1&title=学生专享商品&app_version=1">...</a></h1> | 23 | + <h1>学生专享商品<a class="more" href="//search.m.yohobuy.com/?students=1&title=学生专享商品&uid={{uid}}{{#isApp}}&app_version=1{{/isApp}}">...</a></h1> |
22 | <div class='goods-list clearfix'> | 24 | <div class='goods-list clearfix'> |
23 | {{#each goods}} | 25 | {{#each goods}} |
24 | <div class="good-info"> | 26 | <div class="good-info"> |
@@ -60,7 +62,7 @@ | @@ -60,7 +62,7 @@ | ||
60 | </div> | 62 | </div> |
61 | {{/each}} | 63 | {{/each}} |
62 | </div> | 64 | </div> |
63 | - <a class='s-more' href="//search.m.yohobuy.com/?students=1&title=学生专享商品&app_version=1">查看更多</a> | 65 | + <a class='s-more' href="//search.m.yohobuy.com/?students=1&title=学生专享商品{{#isApp}}&app_version=1{{/isApp}}">查看更多</a> |
64 | </section> | 66 | </section> |
65 | </div> | 67 | </div> |
66 | </div> | 68 | </div> |
@@ -64,20 +64,21 @@ | @@ -64,20 +64,21 @@ | ||
64 | </div> | 64 | </div> |
65 | {{/if}} | 65 | {{/if}} |
66 | </div> | 66 | </div> |
67 | - {{#studentPrice}} | ||
68 | - <div class="price-date"> | ||
69 | - <div class="student-price"> | ||
70 | - <i class="student-name">学生价</i><span class="student-value">¥{{.}}</span> | 67 | + |
68 | + {{#if studentPrice}} | ||
69 | + <div class="price-date"> | ||
70 | + <div class="student-price"> | ||
71 | + <i class="student-name">学生价</i><span class="student-value">¥{{round studentPrice}}</span> | ||
72 | + </div> | ||
71 | </div> | 73 | </div> |
72 | - </div> | ||
73 | - {{/studentPrice}} | 74 | + {{/if}} |
74 | 75 | ||
75 | {{#if studentCoinNum}} | 76 | {{#if studentCoinNum}} |
76 | - <div class="price-date"> | ||
77 | - <div class="student-price"> | ||
78 | - <i class="student-name">返</i> 学生返币{{studentCoinNum}}个 | 77 | + <div class="price-date"> |
78 | + <div class="student-price"> | ||
79 | + <i class="student-name">返</i> 学生返币{{ studentCoinNum}}个 | ||
80 | + </div> | ||
79 | </div> | 81 | </div> |
80 | - </div> | ||
81 | {{else}} | 82 | {{else}} |
82 | {{#commodityReturn}} | 83 | {{#commodityReturn}} |
83 | <div class="price-date"> | 84 | <div class="price-date"> |
@@ -90,15 +91,15 @@ | @@ -90,15 +91,15 @@ | ||
90 | 91 | ||
91 | {{#unless studentPrice}} | 92 | {{#unless studentPrice}} |
92 | {{# vipLevel}} | 93 | {{# vipLevel}} |
93 | - <ul class="vip-level clearfix"> | ||
94 | - {{# list}} | ||
95 | - <li class="icons-item {{#if currentLevel}}current-level{{/if}}"> | 94 | + <ul class="vip-level clearfix"> |
95 | + {{# list}} | ||
96 | + <li class="icons-item {{#if currentLevel}}current-level{{/if}}"> | ||
96 | <span class="vip-img " style="background-size:contain;"> | 97 | <span class="vip-img " style="background-size:contain;"> |
97 | </span> | 98 | </span> |
98 | - <span class="vip-price ">{{text}}</span> | ||
99 | - </li> | ||
100 | - {{/ list}} | ||
101 | - </ul> | 99 | + <span class="vip-price ">{{text}}</span> |
100 | + </li> | ||
101 | + {{/ list}} | ||
102 | + </ul> | ||
102 | {{/ vipLevel}} | 103 | {{/ vipLevel}} |
103 | {{/unless}} | 104 | {{/unless}} |
104 | 105 |
@@ -348,8 +348,18 @@ AsideSlider.prototype.init = function() { | @@ -348,8 +348,18 @@ AsideSlider.prototype.init = function() { | ||
348 | var _scope = this; | 348 | var _scope = this; |
349 | var y = this.y; | 349 | var y = this.y; |
350 | var lastY = this.lastY; | 350 | var lastY = this.lastY; |
351 | - $(asliders).bind('webkitTransitionEnd', $.proxy(this.onTransitionEnd, this)); | ||
352 | - $(asliders).bind('transitionEnd', $.proxy(this.onTransitionEnd, this)); | 351 | + var me=this; |
352 | + // $(asliders).bind('webkitTransitionEnd', $.proxy(this.onTransitionEnd, this)); | ||
353 | + // $(asliders).bind('transitionEnd', $.proxy(this.onTransitionEnd, this)); | ||
354 | + // | ||
355 | + // // Safari 3.1 到 6.0 代码 | ||
356 | + // $(asliders)[0].addEventListener("webkitTransitionEnd", function () { | ||
357 | + // alert(1); | ||
358 | + // }); | ||
359 | + | ||
360 | +// 标准语法 | ||
361 | + $(asliders).on("webkitTransitionEnd", $.proxy(this.onTransitionEnd, this)); | ||
362 | + $(asliders).on("transitionend", $.proxy(this.onTransitionEnd, this)); | ||
353 | 363 | ||
354 | $(asliders).on('click', '.close', $.proxy(this.onClose, this)); | 364 | $(asliders).on('click', '.close', $.proxy(this.onClose, this)); |
355 | $(document).on('click', '[data-aslider="' + $(asliders).data('aslider') + '"]', $.proxy(this.onClose, this)); | 365 | $(document).on('click', '[data-aslider="' + $(asliders).data('aslider') + '"]', $.proxy(this.onClose, this)); |
@@ -384,6 +394,10 @@ AsideSlider.prototype.init = function() { | @@ -384,6 +394,10 @@ AsideSlider.prototype.init = function() { | ||
384 | * 每次点击开始时,先重置lastY | 394 | * 每次点击开始时,先重置lastY |
385 | */ | 395 | */ |
386 | $slider.on('touchstart', function(e) { | 396 | $slider.on('touchstart', function(e) { |
397 | + if(me.isFirst){ | ||
398 | + y=0; | ||
399 | + me.isFirst=false; | ||
400 | + } | ||
387 | lastY = e.originalEvent.touches[0].pageY; | 401 | lastY = e.originalEvent.touches[0].pageY; |
388 | }); | 402 | }); |
389 | 403 | ||
@@ -462,6 +476,7 @@ AsideSlider.prototype._bindAsideSlider = function($initialator, $slider) { | @@ -462,6 +476,7 @@ AsideSlider.prototype._bindAsideSlider = function($initialator, $slider) { | ||
462 | isShow = isShow === 'true' ? true : false; | 476 | isShow = isShow === 'true' ? true : false; |
463 | } | 477 | } |
464 | if (isShow) { | 478 | if (isShow) { |
479 | + this.isFirst=true; | ||
465 | this.asideSlideIn($slider); | 480 | this.asideSlideIn($slider); |
466 | } else { | 481 | } else { |
467 | tip.show('请先选择省份'); | 482 | tip.show('请先选择省份'); |
@@ -493,12 +508,34 @@ AsideSlider.prototype._findAslider = function(el) { | @@ -493,12 +508,34 @@ AsideSlider.prototype._findAslider = function(el) { | ||
493 | return $(theSlider); | 508 | return $(theSlider); |
494 | }; | 509 | }; |
495 | 510 | ||
511 | +// function supportCss3(style) { | ||
512 | +// var prefix = ['webkit', 'Moz', 'ms', 'o'], | ||
513 | +// i, | ||
514 | +// humpString = [], | ||
515 | +// htmlStyle = document.documentElement.style, | ||
516 | +// _toHumb = function (string) { | ||
517 | +// return string.replace(/-(\w)/g, function ($0, $1) { | ||
518 | +// return $1.toUpperCase(); | ||
519 | +// }); | ||
520 | +// }; | ||
521 | +// | ||
522 | +// for (i in prefix) | ||
523 | +// humpString.push(_toHumb(prefix[i] + '-' + style)); | ||
524 | +// | ||
525 | +// humpString.push(_toHumb(style)); | ||
526 | +// | ||
527 | +// for (i in humpString) | ||
528 | +// if (humpString[i] in htmlStyle) return true; | ||
529 | +// | ||
530 | +// return false; | ||
531 | +// } | ||
496 | /** | 532 | /** |
497 | * @public | 533 | * @public |
498 | * 遍历所有侧边栏,滑出隐藏当前显示的那个 | 534 | * 遍历所有侧边栏,滑出隐藏当前显示的那个 |
499 | * @return {null} | 535 | * @return {null} |
500 | */ | 536 | */ |
501 | AsideSlider.prototype.asideSlideOut = AsideSlider.prototype.slideOut = function($el) { | 537 | AsideSlider.prototype.asideSlideOut = AsideSlider.prototype.slideOut = function($el) { |
538 | + | ||
502 | $el = typeof $el === 'string' ? $($el) : $el; | 539 | $el = typeof $el === 'string' ? $($el) : $el; |
503 | if ($el.css('display') != 'none') { | 540 | if ($el.css('display') != 'none') { |
504 | var isFade = $el.data('aslider-fade'); | 541 | var isFade = $el.data('aslider-fade'); |
@@ -508,6 +545,7 @@ AsideSlider.prototype.asideSlideOut = AsideSlider.prototype.slideOut = function( | @@ -508,6 +545,7 @@ AsideSlider.prototype.asideSlideOut = AsideSlider.prototype.slideOut = function( | ||
508 | } | 545 | } |
509 | $el.find('.asilder_wrapper').removeClass('slide_in'); | 546 | $el.find('.asilder_wrapper').removeClass('slide_in'); |
510 | $el.find('.asilder_wrapper').addClass('slide_out'); | 547 | $el.find('.asilder_wrapper').addClass('slide_out'); |
548 | + | ||
511 | } | 549 | } |
512 | this.visibleStack.pop(); | 550 | this.visibleStack.pop(); |
513 | if (this.visibleStack.length === 0) | 551 | if (this.visibleStack.length === 0) |
@@ -5,6 +5,8 @@ var yas = window._yas || { | @@ -5,6 +5,8 @@ var yas = window._yas || { | ||
5 | sendCustomInfo: function() {} | 5 | sendCustomInfo: function() {} |
6 | }; | 6 | }; |
7 | 7 | ||
8 | +var STUDENTCOOKIES = 'STUDENTCOOKIES'; | ||
9 | + | ||
8 | var C_ID, | 10 | var C_ID, |
9 | getChannel, | 11 | getChannel, |
10 | asideSlider = new AsideSlider();//eslint-disable-line | 12 | asideSlider = new AsideSlider();//eslint-disable-line |
@@ -106,6 +108,10 @@ function changeSuccess() { | @@ -106,6 +108,10 @@ function changeSuccess() { | ||
106 | }, | 108 | }, |
107 | msg; | 109 | msg; |
108 | 110 | ||
111 | + if (province.selected() && province.selected().areaCode) { | ||
112 | + data.procode = province.selected().areaCode; | ||
113 | + data.provinceName = $('#s-province-tb').val(); | ||
114 | + } | ||
109 | msg = isValidate(ruleMap, data); | 115 | msg = isValidate(ruleMap, data); |
110 | if (!msg) { | 116 | if (!msg) { |
111 | $('.s-submit').addClass('succ'); | 117 | $('.s-submit').addClass('succ'); |
@@ -118,6 +124,34 @@ function changeSuccess() { | @@ -118,6 +124,34 @@ function changeSuccess() { | ||
118 | }; | 124 | }; |
119 | } | 125 | } |
120 | 126 | ||
127 | +function setFormByCookes(item) { | ||
128 | + var msg; | ||
129 | + | ||
130 | + item = item ? JSON.parse(item) : {}; | ||
131 | + item.cert_no && $('#tb_cert_no').val(item.cert_no); | ||
132 | + item.name && $('#tb_name').val(item.name); | ||
133 | + item.college_name && $('#s-school-tb').val(item.college_name); | ||
134 | + item.education_degree && $('#s-education-tb').val(item.education_degree); | ||
135 | + item.enrollment_year && $('#s-year-tb').val(item.enrollment_year); | ||
136 | + item.provinceName && $('#s-province-tb').val(item.provinceName); | ||
137 | + if (item.procode) { | ||
138 | + province.selected().areaCode = item.procode; | ||
139 | + province.selected().addresseeName = item.provinceName; | ||
140 | + } | ||
141 | + if ($.trim($('#s-school-tb').val())) { | ||
142 | + $('#s-school-tb').parent('section').attr('aslider-isshow', true); | ||
143 | + } | ||
144 | + if (item.isread) { | ||
145 | + $('.checkbox', '.s-shenming').addClass('icon-s-checked'); | ||
146 | + } | ||
147 | + msg = isValidate(ruleMap, item); | ||
148 | + if (!msg) { | ||
149 | + $('.s-submit').addClass('succ'); | ||
150 | + } else { | ||
151 | + $('.s-submit').removeClass('succ'); | ||
152 | + } | ||
153 | +} | ||
154 | + | ||
121 | /* | 155 | /* |
122 | * 筛选器 | 156 | * 筛选器 |
123 | */ | 157 | */ |
@@ -125,7 +159,7 @@ function Filter(ele, title, feild, data) { | @@ -125,7 +159,7 @@ function Filter(ele, title, feild, data) { | ||
125 | this.__ele__ = ele; | 159 | this.__ele__ = ele; |
126 | this.__title__ = title; | 160 | this.__title__ = title; |
127 | this.__data__ = data || null; | 161 | this.__data__ = data || null; |
128 | - this.__select__ = null; | 162 | + this.__select__ = {}; |
129 | this.__feild__ = feild; | 163 | this.__feild__ = feild; |
130 | } | 164 | } |
131 | Filter.prototype = { | 165 | Filter.prototype = { |
@@ -225,6 +259,7 @@ Filter.prototype = { | @@ -225,6 +259,7 @@ Filter.prototype = { | ||
225 | 259 | ||
226 | $('#s-' + name + '-tb').val(item[that.__feild__]); | 260 | $('#s-' + name + '-tb').val(item[that.__feild__]); |
227 | if (name === 'province') { | 261 | if (name === 'province') { |
262 | + $('#s-school-tb').val(''); | ||
228 | $('[data-aslider-in=\'school|fade\']').attr('aslider-isShow', 'true'); | 263 | $('[data-aslider-in=\'school|fade\']').attr('aslider-isShow', 'true'); |
229 | } | 264 | } |
230 | changeSuccess(); | 265 | changeSuccess(); |
@@ -322,6 +357,11 @@ window.JI_getselectvalue = function(type, value) { | @@ -322,6 +357,11 @@ window.JI_getselectvalue = function(type, value) { | ||
322 | changeSuccess(); | 357 | changeSuccess(); |
323 | }; | 358 | }; |
324 | 359 | ||
360 | +$('.s-blue').click(function() { | ||
361 | + localStorage.setItem(STUDENTCOOKIES, JSON.stringify(changeSuccess().data)); | ||
362 | +}); | ||
363 | +setFormByCookes(localStorage.getItem(STUDENTCOOKIES)); | ||
364 | + | ||
325 | 365 | ||
326 | 366 | ||
327 | // data-aslider-in="education|fade" | 367 | // data-aslider-in="education|fade" |
@@ -76,38 +76,41 @@ $('.on-lingqu').on('click', function() { | @@ -76,38 +76,41 @@ $('.on-lingqu').on('click', function() { | ||
76 | if (getUrlParam('uid')) { | 76 | if (getUrlParam('uid')) { |
77 | req += '&uid=' + getUrlParam('uid'); | 77 | req += '&uid=' + getUrlParam('uid'); |
78 | } | 78 | } |
79 | - | ||
80 | - $.ajax({ | ||
81 | - url: '//m.yohobuy.com/coupon/receiveCoupon?code=a83b7d55324fb65f96c1f85a3387ebd8' + req, | ||
82 | - data: { | ||
83 | - couponID: $curDom.parents('.coupon-floor').attr('coupon-id') | ||
84 | - }, | ||
85 | - dataType: 'json', | ||
86 | - success: function(data) { | ||
87 | - var msg = data.msg, | ||
88 | - status = data.status, | ||
89 | - newUrl = '//m.yohobuy.com/signin.html?refer=' + location.href; | ||
90 | - | ||
91 | - | ||
92 | - if (data.isApp === true) { | ||
93 | - newUrl = data.url; | ||
94 | - } | ||
95 | - if (data.noLogin === true) { | ||
96 | - location.href = newUrl; | ||
97 | - } else { | ||
98 | - if (status) { | ||
99 | - $curDom.html('<span class="received"></span>'); | ||
100 | - tip.show('领券成功'); | 79 | + if (!$curDom.hasClass('received')) { |
80 | + $.ajax({ | ||
81 | + url: '//m.yohobuy.com/coupon/receiveCoupon?code=a83b7d55324fb65f96c1f85a3387ebd8' + req, | ||
82 | + data: { | ||
83 | + couponID: $curDom.parents('.coupon-floor').attr('coupon-id') | ||
84 | + }, | ||
85 | + dataType: 'json', | ||
86 | + success: function(data) { | ||
87 | + var msg = data.msg, | ||
88 | + status = data.status, | ||
89 | + newUrl = '//m.yohobuy.com/signin.html?refer=' + location.href; | ||
90 | + | ||
91 | + | ||
92 | + if (data.isApp === true) { | ||
93 | + newUrl = data.url; | ||
94 | + } | ||
95 | + if (data.noLogin === true) { | ||
96 | + location.href = newUrl; | ||
101 | } else { | 97 | } else { |
102 | - tip.show(msg); | 98 | + if (status) { |
99 | + $curDom.html('').removeClass('on-receive').removeClass('no-bg'); | ||
100 | + $curDom.addClass('received'); | ||
101 | + tip.show('领券成功'); | ||
102 | + } else { | ||
103 | + tip.show(msg); | ||
104 | + } | ||
103 | } | 105 | } |
106 | + }, | ||
107 | + error: function() { | ||
108 | + tip.show('网络异常!'); | ||
104 | } | 109 | } |
105 | - }, | ||
106 | - error: function() { | ||
107 | - tip.show('网络异常!'); | ||
108 | - } | ||
109 | - }); | ||
110 | - return false; | 110 | + }); |
111 | + return false; | ||
112 | + } | ||
113 | + | ||
111 | }); | 114 | }); |
112 | 115 | ||
113 | 116 |
@@ -339,19 +339,20 @@ | @@ -339,19 +339,20 @@ | ||
339 | height: 80px; | 339 | height: 80px; |
340 | line-height: 80px; | 340 | line-height: 80px; |
341 | bottom: 0; | 341 | bottom: 0; |
342 | - width: 100%; | ||
343 | width: 640px; | 342 | width: 640px; |
344 | 343 | ||
345 | 344 | ||
346 | .s-renzhen { | 345 | .s-renzhen { |
347 | - background-color: #d10922; | ||
348 | - border-radius: 20px; | ||
349 | - font-size: 22px; | 346 | + |
347 | + font-size: 20px; | ||
350 | width: 140px; | 348 | width: 140px; |
351 | - height: 50px; | ||
352 | - line-height: 50px; | 349 | + height: 48px; |
350 | + line-height: 48px; | ||
353 | color: #fff; | 351 | color: #fff; |
352 | + background-color: #d10922; | ||
353 | + border-radius: 20px; | ||
354 | text-align: center; | 354 | text-align: center; |
355 | + vertical-align:middle; | ||
355 | display: block; | 356 | display: block; |
356 | position: absolute; | 357 | position: absolute; |
357 | right: 30px; | 358 | right: 30px; |
-
Please register or login to post a comment