Authored by weiqingting

fixed bug

... ... @@ -38,6 +38,13 @@ const getEducationLevelList = () => {
method: 'app.studentMarket.getEducationLevelList'
});
};
const userAcquireStatus = (uid, couponIds) => {
return api.get('', {
method: 'app.coupons.userAcquireStatus',
uid: uid,
couponIds: couponIds
});
};
const verifyStudent = (uid, collegename, educationdegree, enrollmentyear) => {
return api.get('', {
method: 'app.student.verifyStudent',
... ... @@ -80,7 +87,7 @@ const getPlatForm = (req) => {
let yoho = {};
let uids = req.get('User-Agent').match(/uid=([^;]+)/i);
yoho.uid = uids && uids.length === 2 ? uids[1] : ''; // 8041246
yoho.uid = uids && uids.length === 2 ? uids[1] : 8041246; // 8041246
yoho.isiOS = /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(userAgent);
yoho.isAndroid = /Android/i.test(userAgent);
yoho.isApp = /YohoBuy/i.test(req.get('User-Agent'));
... ... @@ -104,7 +111,8 @@ exports.index = (req, res, next) => {
let coupons,
activities,
banner,
icons;
icons,
couponids = [];
(datas[0].data || []).forEach((item) => {
switch (item.template_name) {
... ... @@ -128,30 +136,39 @@ exports.index = (req, res, next) => {
if (coupons && coupons.data) {
coupons.data = (coupons.data || []).map((item) => {
couponids.push(item.couponID);
item.couponID = crypto.encryption('yoho9646abcdefgh', item.couponID);
return item;
});
}
datas[1].data.product_list = (datas[1].data.product_list || []).map(function(value) {
value.goodsId = value.goods_list[0].goods_id;
value.url = helpers.urlFormat(`/product/pro_${value.product_id}_${value.goodsId}/${value.cn_alphabet}.html`);
return value;
});
res.render('student', {
isApp: yoho.isApp,
goods: datas[1].data.product_list,
banner: banner,
icons: icons,
coupons: coupons,
activities: activities,
isLogin: getUserStatus(datas[2]).isStudent,
channel: req.yoho.channel,
title: '有货学生专享优惠'
return userAcquireStatus(uid, couponids.join(',')).then((cous) => {
// res.json(result);
console.log(cous);
datas[1].data.product_list = (datas[1].data.product_list || []).map(function(value) {
value.goodsId = value.goods_list[0].goods_id;
value.url = helpers.urlFormat(`/product/pro_${value.product_id}_${value.goodsId}/${value.cn_alphabet}.html`);
return value;
});
res.render('student', {
isApp: yoho.isApp,
goods: datas[1].data.product_list,
banner: banner,
icons: icons,
coupons: coupons,
activities: activities,
isLogin: getUserStatus(datas[2]).isStudent,
channel: req.yoho.channel,
title: '有货学生专享优惠'
});
});
}).catch(next);
};
exports.province = (req, res, next) => {
getProvince().then((result) => {
res.json(result);
... ... @@ -215,7 +232,7 @@ exports.verifystudent = (req, res, next) => {
let uid = req.user.uid || yoho.uid;
Promise.all([verifiedStudentTotal(), vip(), verifyStudent(uid, params.college_name, params.education_degree, params.enrollment_year, params.token), getUser(uid)])
Promise.all([verifiedStudentTotal(), vip(), verifyStudent(uid, params.college_name, params.education_degree, params.enrollment_year, params.token)])
.then((datas) => {
let isverify = false,
prompt = '你的学校信息未通审核';
... ... @@ -233,16 +250,18 @@ exports.verifystudent = (req, res, next) => {
value.url = helpers.urlFormat(`/product/pro_${value.product_id}_${value.goodsId}/${value.cn_alphabet}.html`);
return value;
});
return getUser(uid).then((user) => {
res.render('verify', {
isApp: yoho.isApp,
count: datas[0].data,
goods: datas[1].data.product_list,
isverify: isverify,
prompt: prompt,
isLogin: getUserStatus(user).isStudent,
title: '学生身份认证'
});
}).catch(next);
res.render('verify', {
isApp: yoho.isApp,
count: datas[0].data,
goods: datas[1].data.product_list,
isverify: isverify,
prompt: prompt,
isLogin: getUserStatus(datas[3]).isStudent,
title: '学生身份认证'
});
}).catch(next);
};
... ...
... ... @@ -38,6 +38,8 @@ router.get('/student/verify', student.isLogin, student.verifystudent);
router.get('/student/detail/:type', student.detail);
// router.get('/student/getCoupons',student.getCoupons)
router.get('/invite', invite.index);
router.get('/invite/index', invite.index);
... ...
{{#unless isApp}}
<header class="yoho-header">
<a href="javascript:history.go(-1);" class="iconfont nav-back close"></a>
<p class="nav-title">更多学生权益</p>
<p class="nav-title">{{title}}</p>
</header>
{{/unless}}
{{#isQuanYi}}
... ...
... ... @@ -21,19 +21,18 @@
<section class="s-feild" data-aslider-in="province|fade">
<label>学校省份</label><input type="text" id="s-province-tb" name="s-province-tb" readonly="readonly" placeholder="请选择省份"><span class="s-select iconfont" >&#xe604;</span>
</section>
<section class="s-feild" data-aslider-in="school|fade">
<section class="s-feild" data-aslider-in="school|fade" aslider-isShow="false">
<label>学校名称</label><input type="text" id="s-school-tb" name="s-school-tb" readonly="readonly" placeholder="请选择您所在的学校"><span id='s-toast-school' class="s-select iconfont">&#xe604;</span>
</section>
<section class="s-feild" data-aslider-in="education|fade">
<a {{#if isApp}} href='http://172.16.6.159:6001/activity/student/register?openby:yohobuy={"action":"go.picker","type":"1","params":{"title":"选择学历","list":{{educationsStr}} }}'{{else}} data-aslider-in="education|fade"{{/if}}><label>当前学历</label><input type="text" id="s-education-tb" name="s-education-tb" readonly="readonly" placeholder="请选择您的学历"><span class="s-select iconfont">&#xe604;</span></a>
<a {{#if isApp}} href='//m.yohobuy.com/activity/student/register?openby:yohobuy={"action":"go.picker","type":"1","params":{"title":"选择学历","list":{{educationsStr}} }}'{{else}} data-aslider-in="education|fade"{{/if}}><label>当前学历</label><input type="text" id="s-education-tb" name="s-education-tb" readonly="readonly" placeholder="请选择您的学历"><span class="s-select iconfont">&#xe604;</span></a>
</section>
<section class="s-feild">
<a {{#if isApp}} href='http://172.16.6.159:6001/activity/student/register?openby:yohobuy={"action":"go.picker","type":"2","params":{"title":"选择入学时间","list":{{yearsStr}} }}' {{else}} data-aslider-in="year|fade" {{/if}}><label>入学年份</label><input type="text" id="s-year-tb" name="s-year-tb" readonly="readonly" placeholder="请选择您的入学年份"><span class="s-select iconfont">&#xe604;</span></a>
<a {{#if isApp}} href='//m.yohobuy.com/activity/student/register?openby:yohobuy={"action":"go.picker","type":"2","params":{"title":"选择入学时间","list":{{yearsStr}} }}' {{else}} data-aslider-in="year|fade" {{/if}}><label>入学年份</label><input type="text" id="s-year-tb" name="s-year-tb" readonly="readonly" placeholder="请选择您的入学年份"><span class="s-select iconfont">&#xe604;</span></a>
</section>
</div>
<div class="s-footer">
<section class="s-shenming">
<!--<input type="checkbox" name="tb-is-read" id="tb-is-read" checked="checked">-->
<span class="checkbox icon-s-checked iconfont"></span>
同意<a class="s-blue" href="//m.yohobuy.com/activity/student/detail/renzhen">Yoho!Buy有货认证协议</a>
</section>
... ... @@ -131,6 +130,3 @@
</div>
</section>
</article>
... ...
... ... @@ -59,7 +59,7 @@
{{/activities}}
<section class='s-section clearfix'>
<h1>学生专享商品</h1>
<h1>学生专享商品<a class="more" href="//search.m.yohobuy.com/?students=1&title=学生专享商品">...</a></h1>
<div class='goods-list clearfix'>
{{#each goods}}
<div class="good-info">
... ... @@ -93,7 +93,7 @@
</div>
<div class="price">
<span class="sale-price">¥{{round student_price}} <i class='s-biaoqian'>学生价</i></span>
<p>
<p class="s-price-block">
<span class="market-price">¥{{round market_price}}</span>
</p>
</div>
... ... @@ -110,7 +110,5 @@
</div>
{{/unless}}
<input type="hidden" id="channel" name="channel" value="{{channel}}">
</div>
</div>
... ...
... ... @@ -20,7 +20,7 @@
</section>
{{/if}}
<section class='s-section clearfix'>
<h1>学生专享商品</h1>
<h1>学生专享商品<a class="more" href="//search.m.yohobuy.com/?students=1&title=学生专享商品">...</a></h1>
<div class='goods-list clearfix'>
{{#each goods}}
<div class="good-info">
... ... @@ -53,10 +53,8 @@
<a href="{{url}}">{{product_name}}</a>
</div>
<div class="price">
{{#if ../isLogin}}
<span class="sale-price">¥{{round student_price}} <i class='s-biaoqian'>学生价</i></span>
{{/if}}
<p>
<p class="s-price-block">
<span class="market-price">¥{{round market_price}}</span>
</p>
</div>
... ... @@ -64,7 +62,7 @@
</div>
{{/each}}
</div>
<div class='s-more' href="//search.m.yohobuy.com/?students=1&title=学生专享商品">查看更多</div>
<a class='s-more' href="//search.m.yohobuy.com/?students=1&title=学生专享商品">查看更多</a>
</section>
</div>
</div>
... ...
... ... @@ -69,11 +69,7 @@
{{# studentPrice}}
<div class="price-date">
<div class="student-price">
{{#if ../../isStudent}}
<i class="student-name">学生专享价</i><span class="student-value red">¥{{.}}</span>
{{else}}
<i class="student-name">学生价</i><span class="student-value">¥{{.}}</span>
{{/if}}
</div>
</div>
{{/ studentPrice}}
... ...

37.3 KB | W: | H:

36.9 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
/*eslint-disable*/
var $ = require('yoho-jquery');
(function ($, undefined) {
var prefix = '', eventPrefix,
vendors = {Webkit: 'webkit', Moz: '', O: 'o'},
testEl = document.createElement('div'),
supportedTransforms = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i,
transform,
transitionProperty, transitionDuration, transitionTiming, transitionDelay,
animationName, animationDuration, animationTiming, animationDelay,
cssReset = {};
function dasherize(str) {
return str.replace(/([a-z])([A-Z])/, '$1-$2').toLowerCase();
var tip = require('../plugin/tip');
(function($, undefined) {
var prefix = '',
eventPrefix,
vendors = {
Webkit: 'webkit',
Moz: '',
O: 'o'
},
testEl = document.createElement('div'),
supportedTransforms = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i,
transform,
transitionProperty,
transitionDuration,
transitionTiming,
transitionDelay,
animationName,
animationDuration,
animationTiming,
animationDelay,
cssReset = {};
function dasherize(str) {
return str.replace(/([a-z])([A-Z])/, '$1-$2').toLowerCase();
}
function normalizeEvent(name) {
return eventPrefix ? eventPrefix + name : name.toLowerCase();
}
$.each(vendors, function(vendor, event) {
if (testEl.style[vendor + 'TransitionProperty'] !== undefined) {
prefix = '-' + vendor.toLowerCase() + '-';
eventPrefix = event;
return false;
}
function normalizeEvent(name) {
return eventPrefix ? eventPrefix + name : name.toLowerCase();
});
transform = prefix + 'transform';
cssReset[transitionProperty = prefix + 'transition-property'] = cssReset[transitionDuration = prefix + 'transition-duration'] = cssReset[transitionDelay = prefix + 'transition-delay'] = cssReset[transitionTiming = prefix + 'transition-timing-function'] = cssReset[animationName = prefix + 'animation-name'] = cssReset[animationDuration = prefix + 'animation-duration'] = cssReset[animationDelay = prefix + 'animation-delay'] = cssReset[animationTiming = prefix + 'animation-timing-function'] = '';
$.fx = {
off: (eventPrefix === undefined && testEl.style.transitionProperty === undefined),
speeds: {
_default: 400,
fast: 200,
slow: 600
},
cssPrefix: prefix,
transitionEnd: normalizeEvent('TransitionEnd'),
animationEnd: normalizeEvent('AnimationEnd')
};
$.fn.animate = function(properties, duration, ease, callback, delay) {
if ($.isFunction(duration))
callback = duration, ease = undefined, duration = undefined;
if ($.isFunction(ease))
callback = ease, ease = undefined;
if ($.isPlainObject(duration))
ease = duration.easing, callback = duration.complete, delay = duration.delay, duration = duration.duration;
if (duration)
duration = (typeof duration == 'number' ? duration :
($.fx.speeds[duration] || $.fx.speeds._default)) / 1000;
if (delay)
delay = parseFloat(delay) / 1000;
return this.anim(properties, duration, ease, callback, delay);
};
$.fn.anim = function(properties, duration, ease, callback, delay) {
var key,
cssValues = {},
cssProperties,
transforms = '',
that = this,
wrappedCallback,
endEvent = $.fx.transitionEnd,
fired = false;
if (duration === undefined)
duration = $.fx.speeds._default / 1000;
if (delay === undefined)
delay = 0;
if ($.fx.off)
duration = 0;
if (typeof properties == 'string') {
// keyframe animation
cssValues[animationName] = properties;
cssValues[animationDuration] = duration + 's';
cssValues[animationDelay] = delay + 's';
cssValues[animationTiming] = (ease || 'linear');
endEvent = $.fx.animationEnd;
} else {
cssProperties = [];
// CSS transitions
for (key in properties)
if (supportedTransforms.test(key))
transforms += key + '(' + properties[key] + ') ';
else cssValues[key] = properties[key], cssProperties.push(dasherize(key));
if (transforms) cssValues[transform] = transforms, cssProperties.push(transform);
if (duration > 0 && typeof properties === 'object') {
cssValues[transitionProperty] = cssProperties.join(', ');
cssValues[transitionDuration] = duration + 's';
cssValues[transitionDelay] = delay + 's';
cssValues[transitionTiming] = (ease || 'linear');
}
}
$.each(vendors, function (vendor, event) {
if (testEl.style[vendor + 'TransitionProperty'] !== undefined) {
prefix = '-' + vendor.toLowerCase() + '-';
eventPrefix = event;
return false;
}
});
wrappedCallback = function(event) {
if (typeof event !== 'undefined') {
if (event.target !== event.currentTarget) return; // makes sure the event didn't bubble from "below"
$(event.target).unbind(endEvent, wrappedCallback);
} else
$(this).unbind(endEvent, wrappedCallback); // triggered by setTimeout
transform = prefix + 'transform';
cssReset[transitionProperty = prefix + 'transition-property'] =
cssReset[transitionDuration = prefix + 'transition-duration'] =
cssReset[transitionDelay = prefix + 'transition-delay'] =
cssReset[transitionTiming = prefix + 'transition-timing-function'] =
cssReset[animationName = prefix + 'animation-name'] =
cssReset[animationDuration = prefix + 'animation-duration'] =
cssReset[animationDelay = prefix + 'animation-delay'] =
cssReset[animationTiming = prefix + 'animation-timing-function'] = '';
$.fx = {
off: (eventPrefix === undefined && testEl.style.transitionProperty === undefined),
speeds: {_default: 400, fast: 200, slow: 600},
cssPrefix: prefix,
transitionEnd: normalizeEvent('TransitionEnd'),
animationEnd: normalizeEvent('AnimationEnd')
fired = true;
$(this).css(cssReset);
callback && callback.call(this);
};
$.fn.animate = function (properties, duration, ease, callback, delay) {
if ($.isFunction(duration))
callback = duration, ease = undefined, duration = undefined;
if ($.isFunction(ease))
callback = ease, ease = undefined;
if ($.isPlainObject(duration))
ease = duration.easing, callback = duration.complete, delay = duration.delay, duration = duration.duration;
if (duration) duration = (typeof duration == 'number' ? duration :
($.fx.speeds[duration] || $.fx.speeds._default)) / 1000;
if (delay) delay = parseFloat(delay) / 1000;
return this.anim(properties, duration, ease, callback, delay);
};
$.fn.anim = function (properties, duration, ease, callback, delay) {
var key, cssValues = {}, cssProperties, transforms = '',
that = this, wrappedCallback, endEvent = $.fx.transitionEnd,
fired = false;
if (duration === undefined) duration = $.fx.speeds._default / 1000;
if (delay === undefined) delay = 0;
if ($.fx.off) duration = 0;
if (typeof properties == 'string') {
// keyframe animation
cssValues[animationName] = properties;
cssValues[animationDuration] = duration + 's';
cssValues[animationDelay] = delay + 's';
cssValues[animationTiming] = (ease || 'linear');
endEvent = $.fx.animationEnd;
} else {
cssProperties = [];
// CSS transitions
for (key in properties)
if (supportedTransforms.test(key)) transforms += key + '(' + properties[key] + ') ';
else cssValues[key] = properties[key], cssProperties.push(dasherize(key));
if (transforms) cssValues[transform] = transforms, cssProperties.push(transform);
if (duration > 0 && typeof properties === 'object') {
cssValues[transitionProperty] = cssProperties.join(', ');
cssValues[transitionDuration] = duration + 's';
cssValues[transitionDelay] = delay + 's';
cssValues[transitionTiming] = (ease || 'linear');
}
}
wrappedCallback = function (event) {
if (typeof event !== 'undefined') {
if (event.target !== event.currentTarget) return; // makes sure the event didn't bubble from "below"
$(event.target).unbind(endEvent, wrappedCallback);
} else
$(this).unbind(endEvent, wrappedCallback); // triggered by setTimeout
fired = true;
$(this).css(cssReset);
callback && callback.call(this);
};
if (duration > 0) {
this.bind(endEvent, wrappedCallback);
// transitionEnd is not always firing on older Android phones
// so make sure it gets fired
setTimeout(function () {
if (fired) return;
wrappedCallback.call(that);
}, ((duration + delay) * 1000) + 25);
}
// trigger page reflow so new elements can animate
this.size() && this.get(0).clientLeft;
this.css(cssValues);
if (duration <= 0) setTimeout(function () {
that.each(function () {
wrappedCallback.call(this);
});
}, 0);
return this;
};
testEl = null;
})($)
;
(function ($, undefined) {
var document = window.document, docElem = document.documentElement,
origShow = $.fn.show, origHide = $.fn.hide, origToggle = $.fn.toggle;
function anim(el, speed, opacity, scale, callback) {
if (typeof speed == 'function' && !callback) callback = speed, speed = undefined;
var props = {opacity: opacity};
if (scale) {
props.scale = scale;
el.css($.fx.cssPrefix + 'transform-origin', '0 0');
}
return el.animate(props, speed, null, callback);
if (duration > 0) {
this.bind(endEvent, wrappedCallback);
// transitionEnd is not always firing on older Android phones
// so make sure it gets fired
setTimeout(function() {
if (fired) return;
wrappedCallback.call(that);
}, ((duration + delay) * 1000) + 25);
}
function hide(el, speed, scale, callback) {
return anim(el, speed, 0, scale, function () {
origHide.call($(this));
callback && callback.call(this);
});
}
// trigger page reflow so new elements can animate
this.size() && this.get(0).clientLeft;
$.fn.show = function (speed, callback) {
origShow.call(this);
if (speed === undefined) speed = 0;
else this.css('opacity', 0);
return anim(this, speed, 1, '1,1', callback);
};
this.css(cssValues);
$.fn.hide = function (speed, callback) {
if (speed === undefined) return origHide.call(this);
else return hide(this, speed, '0,0', callback);
};
$.fn.toggle = function (speed, callback) {
if (speed === undefined || typeof speed == 'boolean')
return origToggle.call(this, speed);
else return this.each(function () {
var el = $(this);
el[el.css('display') == 'none' ? 'show' : 'hide'](speed, callback);
if (duration <= 0) setTimeout(function() {
that.each(function() {
wrappedCallback.call(this);
});
};
$.fn.fadeTo = function (speed, opacity, callback) {
return anim(this, speed, opacity, null, callback);
};
}, 0);
$.fn.fadeIn = function (speed, callback) {
var target = this.css('opacity');
if (target > 0) this.css('opacity', 0);
else target = 1;
return origShow.call(this).fadeTo(speed, target, callback);
};
return this;
};
$.fn.fadeOut = function (speed, callback) {
return hide(this, speed, null, callback);
testEl = null;
})($)
;
(function($, undefined) {
var document = window.document,
docElem = document.documentElement,
origShow = $.fn.show,
origHide = $.fn.hide,
origToggle = $.fn.toggle;
function anim(el, speed, opacity, scale, callback) {
if (typeof speed == 'function' && !callback) callback = speed, speed = undefined;
var props = {
opacity: opacity
};
if (scale) {
props.scale = scale;
el.css($.fx.cssPrefix + 'transform-origin', '0 0');
}
return el.animate(props, speed, null, callback);
}
$.fn.fadeToggle = function (speed, callback) {
return this.each(function () {
var el = $(this);
el[
(el.css('opacity') == 0 || el.css('display') == 'none') ? 'fadeIn' : 'fadeOut'
](speed, callback);
});
};
function hide(el, speed, scale, callback) {
return anim(el, speed, 0, scale, function() {
origHide.call($(this));
callback && callback.call(this);
});
}
$.fn.show = function(speed, callback) {
origShow.call(this);
if (speed === undefined)
speed = 0;
else this.css('opacity', 0);
return anim(this, speed, 1, '1,1', callback);
};
$.fn.hide = function(speed, callback) {
if (speed === undefined) return origHide.call(this);
else return hide(this, speed, '0,0', callback);
};
$.fn.toggle = function(speed, callback) {
if (speed === undefined || typeof speed == 'boolean')
return origToggle.call(this, speed);
else return this.each(function() {
var el = $(this);
el[el.css('display') == 'none' ? 'show' : 'hide'](speed, callback);
});
};
$.fn.fadeTo = function(speed, opacity, callback) {
return anim(this, speed, opacity, null, callback);
};
$.fn.fadeIn = function(speed, callback) {
var target = this.css('opacity');
if (target > 0) this.css('opacity', 0);
else
target = 1;
return origShow.call(this).fadeTo(speed, target, callback);
};
$.fn.fadeOut = function(speed, callback) {
return hide(this, speed, null, callback);
};
$.fn.fadeToggle = function(speed, callback) {
return this.each(function() {
var el = $(this);
el[
(el.css('opacity') == 0 || el.css('display') == 'none') ? 'fadeIn' : 'fadeOut'
](speed, callback);
});
};
})($)
;
(function ($, undefined) {
Array.prototype.find = function (item) {
for (var i = 0; i < this.length; i++) {
if (this[i] === item) {
return this[i];
}
}
return null;
};
var uc = false;
if (window.navigator.userAgent.match(/(UCBrowser|UCWeb)/i))
uc = true;
var AsideSlider = function () {
this.visibleStack = [];
this.bindArray = [];
this.lastY = 0;
this.y = 0;
this.bind();
};
AsideSlider.prototype._findEntry = function (item) {
for (var i = 0; i < this.bindArray.length; i++) {
if (this.bindArray[i].initialator === item && $(this.bindArray[i].slider).length > 0) {
return true;
Array.prototype.find = function(item) {
for (var i = 0; i < this.length; i++) {
if (this[i] === item) {
return this[i];
}
}
return null;
};
var uc = false;
if (window.navigator.userAgent.match(/(UCBrowser|UCWeb)/i))
uc = true;
var AsideSlider = function() {
this.visibleStack = [];
this.bindArray = [];
this.lastY = 0;
this.y = 0;
this.bind();
};
AsideSlider.prototype._findEntry = function(item) {
for (var i = 0; i < this.bindArray.length; i++) {
if (this.bindArray[i].initialator === item && $(this.bindArray[i].slider).length > 0) {
return true;
}
}
return false;
};
AsideSlider.prototype.bind = AsideSlider.prototype.rebind = function() {
var asliderEntries = $('[data-aslider-in]');
var _scope = this;
var historyList = [];
$(asliderEntries).each(function(idx, el) {
if (_scope._findEntry(el)) {
return;
}
var array = String($(this).data('aslider-in')).split('|');
var targetSlider = array[0];
_scope.bindArray.push({
initialator: this,
slider: '[data-aslider="' + targetSlider + '"]',
options: {
isFade: (function() {
var isFade = false;
array.forEach(function(value, idx) {
if (value == 'fade') {
isFade = true;
return false;
}
}
return false;
};
AsideSlider.prototype.bind = AsideSlider.prototype.rebind = function () {
var asliderEntries = $('[data-aslider-in]');
var _scope = this;
var historyList = [];
$(asliderEntries).each(function (idx, el) {
if (_scope._findEntry(el)) {
return;
});
return isFade;
})(),
direction: (function() {
var direction = 'right';
array.forEach(function(value, idx) {
if (value == 'right' || value == 'left' || value == 'top' || value == 'bottom') {
direction = value;
return false;
}
var array = String($(this).data('aslider-in')).split('|');
var targetSlider = array[0];
_scope.bindArray.push({
initialator: this,
slider: '[data-aslider="' + targetSlider + '"]',
options: {
isFade: (function () {
var isFade = false;
array.forEach(function (value, idx) {
if (value == 'fade') {
isFade = true;
return false;
}
});
return isFade;
})(),
direction: (function () {
var direction = 'right';
array.forEach(function (value, idx) {
if (value == 'right' || value == 'left' || value == 'top' || value == 'bottom') {
direction = value;
return false;
}
});
return direction;
})(),
size: (function () {
var size = '100%';
var direction = 'right';
array.forEach(function (value, idx) {
if (value == 'right' || value == 'left' || value == 'top' || value == 'bottom') {
direction = value;
return false;
}
});
})()
}
});
for (var i in historyList) {
if (historyList[i].entry == $(el).data('aslider-in')) {
return;
}
});
return direction;
})(),
size: (function() {
var size = '100%';
var direction = 'right';
array.forEach(function(value, idx) {
if (value == 'right' || value == 'left' || value == 'top' || value == 'bottom') {
direction = value;
return false;
}
historyList.push(
{
'entry': $(el).data('aslider-in'),
'slider': '[data-aslider="' + targetSlider + '"]',
}
);
var $bg = $('<div class=\'bg close\'></div>');
$(_scope.bindArray[_scope.bindArray.length - 1].slider).prepend($bg);
});
// sliders to be inited
var sliders = historyList.map(function (item) {
return item.slider;
}).join(',');
this.init($(sliders));
};
AsideSlider.prototype.onTransitionEnd = function (e) {
var $el = $(e.currentTarget);
this.y = 0;
this.lastY = 0;
$el.find('.slider').css({
'-moz-transform': 'translate(0,0)',
'-ms-transform': 'translate(0,0)',
'transform': 'translate(0,0)',
'-webkit-transform': 'translate(0,0)',
});
if ($el.find('.slide_out')[0])
$el.css('display', 'none');
};
/**
* 侦听侧边栏的关闭点击事件,调用滑出侧边栏方法
* @param {event}
* @return {null}
*/
AsideSlider.prototype.onClose = function (e) {
if ($(e.target).hasClass('close')) {
var $el = this._findAslider(e.currentTarget);
this.asideSlideOut($el);
}
};
AsideSlider.prototype.init = function () {
var asliders = $('[data-aslider]');
var _scope = this;
var y = this.y;
var lastY = this.lastY;
$(asliders).bind('webkitTransitionEnd', $.proxy(this.onTransitionEnd, this));
$(asliders).bind('transitionEnd', $.proxy(this.onTransitionEnd, this));
$(asliders).on('click', '.close', $.proxy(this.onClose, this));
$(document).on('click', '[data-aslider="' + $(asliders).data('aslider') + '"]', $.proxy(this.onClose, this));
/**
* 侦听触摸事件的div
*/
$(asliders).each(function (idx, aslider) {
if (uc)
$(aslider).find('.asilder_wrapper').addClass('for_uc');
var lastScrollTop = 0;
// 找不到slider,就创建slider
var children = $(aslider).find('.asilder_wrapper').children();
if ($(aslider).find('.slider').length == 0) {
var $slider = $('<div class=\'slider\'></div>');
$slider.append(children);
$(aslider).find('.asilder_wrapper').append($slider);
} else
var $slider = $(aslider).find('.slider');
if ($(aslider).find('.scroll').length == 0) {
var $scroll = $('<div class=\'scroll\'></>');
// 创建scroll
$slider.before($scroll);
// 将slider添加到scroll
$scroll.append($slider);
}
/**
* 每次点击开始时,先重置lastY
*/
$slider.on('touchstart', function (e) {
lastY = e.originalEvent.touches[0].pageY;
});
/**
* 触摸移动事件
* 通过当前的触摸Y值 - 上一次事件的y值
* 得到两次触摸事件的差
* y = y +deltaY使div移动
* 如果y > 0,则div的顶部低于窗口了,所以y>0时,y=0
* 同理y < limit是为了防止div的底部高于窗口
* 最后让当前的触摸y值 = lastY,即对下一次触摸来说,这次的y就是lastY
*/
$slider.on('touchmove', function (e) {
var curY = e.originalEvent.touches[0].pageY;
var deltaY = curY - lastY;
var height = $(this)[0].scrollHeight;
var limit = height - $(this).parent().height();
y = y + deltaY;
if (y < limit * -1) y = limit * -1;
if (y > 0) y = 0;
var translate = 'translate3d(0,' + y + 'px,0)';
$(this).css({
'-moz-transform': translate,
'-ms-transform': translate,
'transform': translate,
'-webkit-transform': translate,
});
lastY = curY;
});
$slider.on('touchend', function (e) {
});
});
this.bindArray.forEach(function (item) {
_scope._bindAsideSlider($(item.initialator), $(item.slider));
if (item.options.isFade)
$(item.slider).data('aslider-fade', item.options.isFade);
else
$(item.slider).find('.bg').css('opacity', '0');
$(item.slider).data('aslider-direction', item.options.direction);
$(item.slider).find('.asilder_wrapper').addClass(item.options.direction);
});
};
/**
* @private
* 绑定页面的侧边栏和侧边栏滑出的发起者的click事件,当点击发起者时,滑出侧边栏
* @param {zepto object} $initialator 发起者
* @param {zepto object} $slider 侧边栏
* @return {null}
*/
AsideSlider.prototype._bindAsideSlider = function ($initialator, $slider) {
if (typeof($initialator) == 'undefined') return;
$initialator.click($.proxy(function (e) {
this.asideSlideIn($slider);
}, this));
};
/**
* @private
* 给定一个侧边栏的子节点,找到这个侧边栏
* @param {Type} 一个html dom node
*/
AsideSlider.prototype._findAslider = function (el) {
var theSlider;
$('[data-aslider]').each(function (idx, aslider) {
if (aslider == el) {
theSlider = aslider;
return false;
}
$(aslider).find('.close').each(function (idx, _el) {
if (el == _el) {
theSlider = aslider;
return false;
} else {
return true;
}
});
});
return $(theSlider);
};
});
})()
}
});
for (var i in historyList) {
if (historyList[i].entry == $(el).data('aslider-in')) {
return;
}
}
historyList.push(
{
'entry': $(el).data('aslider-in'),
'slider': '[data-aslider="' + targetSlider + '"]',
}
);
var $bg = $('<div class=\'bg close\'></div>');
$(_scope.bindArray[_scope.bindArray.length - 1].slider).prepend($bg);
});
// sliders to be inited
var sliders = historyList.map(function(item) {
return item.slider;
}).join(',');
this.init($(sliders));
};
AsideSlider.prototype.onTransitionEnd = function(e) {
var $el = $(e.currentTarget);
this.y = 0;
this.lastY = 0;
$el.find('.slider').css({
'-moz-transform': 'translate(0,0)',
'-ms-transform': 'translate(0,0)',
'transform': 'translate(0,0)',
'-webkit-transform': 'translate(0,0)',
});
if ($el.find('.slide_out')[0])
$el.css('display', 'none');
};
/**
* 侦听侧边栏的关闭点击事件,调用滑出侧边栏方法
* @param {event}
* @return {null}
*/
AsideSlider.prototype.onClose = function(e) {
if ($(e.target).hasClass('close')) {
var $el = this._findAslider(e.currentTarget);
this.asideSlideOut($el);
}
};
AsideSlider.prototype.init = function() {
var asliders = $('[data-aslider]');
var _scope = this;
var y = this.y;
var lastY = this.lastY;
$(asliders).bind('webkitTransitionEnd', $.proxy(this.onTransitionEnd, this));
$(asliders).bind('transitionEnd', $.proxy(this.onTransitionEnd, this));
$(asliders).on('click', '.close', $.proxy(this.onClose, this));
$(document).on('click', '[data-aslider="' + $(asliders).data('aslider') + '"]', $.proxy(this.onClose, this));
/**
* 侦听触摸事件的div
*/
$(asliders).each(function(idx, aslider) {
if (uc)
$(aslider).find('.asilder_wrapper').addClass('for_uc');
var lastScrollTop = 0;
// 找不到slider,就创建slider
var children = $(aslider).find('.asilder_wrapper').children();
if ($(aslider).find('.slider').length == 0) {
var $slider = $('<div class=\'slider\'></div>');
$slider.append(children);
$(aslider).find('.asilder_wrapper').append($slider);
} else
var $slider = $(aslider).find('.slider');
if ($(aslider).find('.scroll').length == 0) {
var $scroll = $('<div class=\'scroll\'></>');
// 创建scroll
$slider.before($scroll);
// 将slider添加到scroll
$scroll.append($slider);
}
/**
* @public
* 遍历所有侧边栏,滑出隐藏当前显示的那个
* @return {null}
* 每次点击开始时,先重置lastY
*/
AsideSlider.prototype.asideSlideOut =
AsideSlider.prototype.slideOut = function ($el) {
$el = typeof $el === 'string' ? $($el) : $el;
if ($el.css('display') != 'none') {
var isFade = $el.data('aslider-fade');
if (isFade === '' || isFade || $el.isFade) {
$el.find('.bg').removeClass('fade_in');
$el.find('.bg').addClass('fade_out');
}
$el.find('.asilder_wrapper').removeClass('slide_in');
$el.find('.asilder_wrapper').addClass('slide_out');
}
this.visibleStack.pop();
if (this.visibleStack.length === 0)
$('body').unbind('touchmove');
};
$slider.on('touchstart', function(e) {
lastY = e.originalEvent.touches[0].pageY;
});
/**
* @public
* 滑入显示一个侧边栏
* @param {zepto object} $el 侧边栏dom对象
* @return {null}
* 触摸移动事件
* 通过当前的触摸Y值 - 上一次事件的y值
* 得到两次触摸事件的差
* y = y +deltaY使div移动
* 如果y > 0,则div的顶部低于窗口了,所以y>0时,y=0
* 同理y < limit是为了防止div的底部高于窗口
* 最后让当前的触摸y值 = lastY,即对下一次触摸来说,这次的y就是lastY
*/
AsideSlider.prototype.asideSlideIn =
AsideSlider.prototype.slideIn = function ($el) {
$el = typeof $el === 'string' ? $($el) : $el;
$el.show();
var isFade = $el.data('aslider-fade');
if (isFade === '' || isFade || $el.isFade) {
$el.find('.bg').removeClass('fade_out');
$el.find('.bg').addClass('fade_in');
}
$el.find('.asilder_wrapper').removeClass('slide_out');
$el.find('.asilder_wrapper').addClass('slide_in');
this.visibleStack.push($el);
$('body').bind('touchmove', function (e) {
e.preventDefault();
});
window.JI_bilibili && window.JI_bilibili($el);
};
$(function () {
$.asideSlider = $.aslider = new AsideSlider();
$slider.on('touchmove', function(e) {
var curY = e.originalEvent.touches[0].pageY;
var deltaY = curY - lastY;
var height = $(this)[0].scrollHeight;
var limit = height - $(this).parent().height();
y = y + deltaY;
if (y < limit * -1)
y = limit * -1;
if (y > 0)
y = 0;
var translate = 'translate3d(0,' + y + 'px,0)';
$(this).css({
'-moz-transform': translate,
'-ms-transform': translate,
'transform': translate,
'-webkit-transform': translate,
});
lastY = curY;
});
$slider.on('touchend', function(e) {});
$(aslider).on("click", ".s-group-zimu a", function() {
lastY = 0;
var name = $(this).html();
var curY = $(aslider).find('[data-pos=' + name + ']').offset().top;
var height = $slider.offset().top;
var deltaY = -(curY - lastY) + height;
var translate = 'translate3d(0,' + deltaY + 'px,0)';
$slider.css({
'-moz-transform': translate,
'-ms-transform': translate,
'transform': translate,
'-webkit-transform': translate,
});
y = deltaY;
})
});
this.bindArray.forEach(function(item) {
_scope._bindAsideSlider($(item.initialator), $(item.slider));
if (item.options.isFade)
$(item.slider).data('aslider-fade', item.options.isFade);
else
$(item.slider).find('.bg').css('opacity', '0');
$(item.slider).data('aslider-direction', item.options.direction);
$(item.slider).find('.asilder_wrapper').addClass(item.options.direction);
});
};
/**
* @private
* 绑定页面的侧边栏和侧边栏滑出的发起者的click事件,当点击发起者时,滑出侧边栏
* @param {zepto object} $initialator 发起者
* @param {zepto object} $slider 侧边栏
* @return {null}
*/
AsideSlider.prototype._bindAsideSlider = function($initialator, $slider) {
if (typeof ($initialator) == 'undefined') return;
$initialator.click($.proxy(function(e) {
var isShow = $initialator.attr("aslider-isShow") || true;
if (typeof isShow === 'string') {
isShow = isShow === 'true' ? true : false;
}
if (isShow) {
this.asideSlideIn($slider);
} else {
tip.show('请先选择省份');
}
}, this));
};
/**
* @private
* 给定一个侧边栏的子节点,找到这个侧边栏
* @param {Type} 一个html dom node
*/
AsideSlider.prototype._findAslider = function(el) {
var theSlider;
$('[data-aslider]').each(function(idx, aslider) {
if (aslider == el) {
theSlider = aslider;
return false;
}
$(aslider).find('.close').each(function(idx, _el) {
if (el == _el) {
theSlider = aslider;
return false;
} else {
return true;
}
});
})($);
});
return $(theSlider);
};
/**
* @public
* 遍历所有侧边栏,滑出隐藏当前显示的那个
* @return {null}
*/
AsideSlider.prototype.asideSlideOut = AsideSlider.prototype.slideOut = function($el) {
$el = typeof $el === 'string' ? $($el) : $el;
if ($el.css('display') != 'none') {
var isFade = $el.data('aslider-fade');
if (isFade === '' || isFade || $el.isFade) {
$el.find('.bg').removeClass('fade_in');
$el.find('.bg').addClass('fade_out');
}
$el.find('.asilder_wrapper').removeClass('slide_in');
$el.find('.asilder_wrapper').addClass('slide_out');
}
this.visibleStack.pop();
if (this.visibleStack.length === 0)
$('body').unbind('touchmove');
};
/**
* @public
* 滑入显示一个侧边栏
* @param {zepto object} $el 侧边栏dom对象
* @return {null}
*/
AsideSlider.prototype.asideSlideIn = AsideSlider.prototype.slideIn = function($el) {
$el = typeof $el === 'string' ? $($el) : $el;
$el.show();
var isFade = $el.data('aslider-fade');
if (isFade === '' || isFade || $el.isFade) {
$el.find('.bg').removeClass('fade_out');
$el.find('.bg').addClass('fade_in');
}
$el.find('.asilder_wrapper').removeClass('slide_out');
$el.find('.asilder_wrapper').addClass('slide_in');
this.visibleStack.push($el);
$('body').bind('touchmove', function(e) {
e.preventDefault();
});
window.JI_bilibili && window.JI_bilibili($el);
};
// $(function () {
// $.asideSlider = $.aslider = new AsideSlider();
// });
module.exports = AsideSlider;
/*eslint-enable*/
... ...
var $ = require('yoho-jquery');
var tip = require('../plugin/tip');
var AsideSlider = require('./aslider');
var yas = window._yas || {
sendCustomInfo: function() {}
};
var C_ID,
getChannel;
getChannel,
asideSlider;
var top = 0,
province,
var province,
school,
ruleMap = {
name: {
... ... @@ -42,9 +43,11 @@ var top = 0,
}
};
require('./aslider');
require('../common');
asideSlider = new AsideSlider();
getChannel = function functionName() {
var name = window.cookie('_Channel');
... ... @@ -214,28 +217,22 @@ Filter.prototype = {
bindEvent: function() {
var that = this;
$(document).on('click', '' + that.__ele__ + ' .s-item', function() {
var item = $(this).data('obj');
$('' + that.__ele__ + ' .s-item').unbind('click').click(function() {
var item = $(this).data('obj'),
name;
that.__select__ = item;
$('#s-' + that.__ele__.match(/=(\w+)/)[1] + '-tb').val(item[that.__feild__]);
name = that.__ele__.match(/=(\w+)/)[1];
$('#s-' + name + '-tb').val(item[that.__feild__]);
if (name === 'province') {
$('[data-aslider-in=\'school|fade\']').attr('aslider-isShow', 'true');
}
changeSuccess();
});
$(document).on('click', '' + that.__ele__ + ' .s-group-zimu a', function() {
var name = $(this).html();
var y = $('[data-pos=' + name + ']', that.__ele__).data('zpos') - top;
var translate = 'translate3d(0,' + (-y) + 'px,0)';
$('.slider', that.__ele__).css({
'-moz-transform': translate,
'-ms-transform': translate,
transform: translate,
'-webkit-transform': translate,
});
});
}
};
// $.asideSlider.lastY=100;
province = new Filter('[data-aslider=province]', '当前地区', 'addresseeName');
... ... @@ -298,21 +295,17 @@ $('.s-clear').click(function() {
window.JI_bilibili = function($el) {
top = $('.slider', $el).offset().top;
if ($el.selector === '[data-aslider="school"]') {
if (province.selected() && province.selected().areaCode) {
$.get('/activity/student/school?code=' + province.selected().areaCode, function(res) {
school.set(res.data);
school.init();
$('[data-pos]', $el).each(function() {
$(this).data('zpos', $(this).offset().top);
});
});
} else {
// $("[data-aslider-in='school|fade']").attr("aslider-isshow","false")
}
} else {
$('[data-pos]', $el).each(function() {
$(this).data('zpos', $(this).offset().top);
});
}
};
... ... @@ -320,14 +313,10 @@ window.JI_getselectvalue = function(type, value) {
if (+type === 1) {
if ($.trim(value)) {
$('#s-education-tb').val($.trim(value));
} else {
tip.show('请选择当前学历');
}
} else {
if ($.trim(value)) {
$('#s-year-tb').val($.trim(value));
} else {
tip.show('请选择入学年份');
}
}
changeSuccess();
... ...
var $ = require('yoho-jquery');
var tip = require('../plugin/tip');
var yas = window._yas || {
sendCustomInfo: function() {}
};
var C_ID,
getChannel;
var top = 0,
province,
school,
ruleMap = {
name: {
name: '姓名',
require: true,
regex: /^[\u2E80-\u9FFF]+$/g,
msg: '请输入中文姓名'
},
cert_no: {
name: '身份证号',
require: true,
regex: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/g,
msg: '身份证号输入错误'
},
college_name: {
name: '学校名称',
require: true
},
education_degree: {
name: '当前学历',
require: true
},
enrollment_year: {
name: '同意认证',
require: true
},
isread: {
name: '入学年份',
is: true,
msg: '请同意有货网学生认证协议'
}
};
require('./aslider');
require('../common');
getChannel = function functionName() {
var name = window.cookie('_Channel');
return {
boys: 1,
girls: 2,
kids: 3,
lifestyle: 4
}[name] || 1;
};
C_ID = getChannel();
/*
* 用于对规则验证
*/
function isValidate(rules, datas) {
var message = '',
data,
name,
reg,
rule;
for (name in rules) {
if (datas.hasOwnProperty(name)) {
data = datas[name];
rule = rules[name];
if (rule.require && !$.trim(data)) {
message = rule.name + '不可为空';
break;
}
if (rule.regex) {
reg = $.trim(data).match(rule.regex);
if (!reg || (reg && !reg.length)) {
message = rule.msg;
break;
}
}
if (rule.is !== void (0) && data !== rule.is) {
message = rule.msg;
}
}
}
return message;
}
/*
* 获取数据
*/
function changeSuccess() {
var data = {
cert_no: $.trim($('#tb_cert_no').val()),
name: $.trim($('#tb_name').val()),
college_name: $.trim($('#s-school-tb').val()),
education_degree: $.trim($('#s-education-tb').val()),
enrollment_year: $.trim($('#s-year-tb').val()),
isread: $('.checkbox', '.s-shenming').hasClass('icon-s-checked')
},
msg;
msg = isValidate(ruleMap, data);
if (!msg) {
$('.s-submit').addClass('succ');
} else {
$('.s-submit').removeClass('succ');
}
return {
msg: msg,
data: data
};
}
/*
* 筛选器
*/
function Filter(ele, title, feild, data) {
this.__ele__ = ele;
this.__title__ = title;
this.__data__ = data || null;
this.__select__ = null;
this.__feild__ = feild;
}
Filter.prototype = {
get: function() {
return this.__data__;
},
set: function(data) {
this.__data__ = data;
},
selected: function() {
return this.__select__;
},
init: function(data, key) {
var d,
html;
data = data || this.get();
d = this.adapterData(this.filterData(data, key));
$('.s-items', this.__ele__).html('').html(this.dataToHtml(d));
$('.s-group-zimu', this.__ele__).html('');
if (!key) {
html = '<span class=\'iconfont search-icon empty\'>&#xe60f;</span>';
Object.keys(d).forEach(function(item) {
html += '<a href=\'javascript:;\'>' + item + '</a>';
});
html += '';
$('.s-group-zimu', this.__ele__).html(html);
}
this.bindEvent();
},
filterData: function(data, key) {
var that = this,
regex;
if (!key) {
return data;
}
return data.filter(function(item) {
regex = new RegExp('^' + key, 'i');
return regex.test(item[that.__feild__]);
});
},
adapterData: function(items) {
var result = {},
map = {};
items = items || this.__data__;
items.forEach(function(item) {
if (item.groupBy) {
if (!result.hasOwnProperty(item.groupBy)) {
result[item.groupBy] = [];
}
result[item.groupBy].push(item);
}
});
Object.keys(result).sort().forEach(function(name) {
map[name] = result[name];
});
return map;
},
dataToHtml: function(data) {
var that = this;
var html = [],
name;
if (this.__select__ && this.__title__) {
html.push('<h6 class=\'s-title\'>当前地区</h6>');
html.push('<div class=\'s-item close\'>' + this.__select__[this.__feild__] + '</div>');
}
for (name in data) {
if (data.hasOwnProperty(name)) {
html.push('<h6 class=\'s-title\' data-pos=\'' + name + '\'>' + name + '</h6>');
if (data[name].length > 0) {
data[name].forEach(function(item) {
html.push('<div class=\'s-item close\' data-obj=\'' +
JSON.stringify(item) + '\'>' + item[that.__feild__] + '</div>');
});
}
}
}
return html;
},
bindEvent: function() {
var that = this;
$(document).on('click', '' + that.__ele__ + ' .s-item', function() {
var item = $(this).data('obj');
that.__select__ = item;
$('#s-' + that.__ele__.match(/=(\w+)/)[1] + '-tb').val(item[that.__feild__]);
changeSuccess();
});
$(document).on('click', '' + that.__ele__ + ' .s-group-zimu a', function() {
var name = $(this).html();
var y = $('[data-pos=' + name + ']', that.__ele__).data('zpos') - top;
var translate = 'translate3d(0,' + (-y) + 'px,0)';
$('.slider', that.__ele__).css({
'-moz-transform': translate,
'-ms-transform': translate,
transform: translate,
'-webkit-transform': translate,
});
});
}
};
province = new Filter('[data-aslider=province]', '当前地区', 'addresseeName');
$.get('/activity/student/province', function(res) {
province.set(res.data);
province.init();
});
$(document).on('keyup', '#s-search-provinces', function() {
var name = $.trim($(this).val());
var clear = $(this).next('.s-clear');
var stip = $(this).prev('.s-seach-tip');
province.init(province.get(), name);
if ($(this).val().length > 0) {
clear.show();
} else {
clear.hide();
stip.show();
stip.prev('.s-empty').hide();
}
});
$(document).on('focusin', '#s-search-provinces', function() {
var stip = $(this).prev('.s-seach-tip');
stip.hide();
stip.prev('.s-empty').show();
});
school = new Filter('[data-aslider=school]', null, 'schoolName');
$(document).on('keyup', '#s-search-school', function() {
var name = $.trim($(this).val());
var clear = $(this).next('.s-clear');
var stip = $(this).prev('.s-seach-tip');
school.init(school.get(), name);
if ($(this).val().length > 0) {
clear.show();
} else {
clear.hide();
stip.show();
stip.prev('.s-empty').hide();
}
});
$(document).on('focusin', '#s-search-school', function() {
var stip = $(this).prev('.s-seach-tip');
stip.hide();
stip.prev('.s-empty').show();
});
$('.s-clear').click(function() {
$(this).prev('.s-input-search').val('').keyup();
$(this).hide();
});
window.JI_bilibili = function($el) {
top = $('.slider', $el).offset().top;
if ($el.selector === '[data-aslider="school"]') {
if (province.selected() && province.selected().areaCode) {
$.get('/activity/student/school?code=' + province.selected().areaCode, function(res) {
school.set(res.data);
school.init();
$('[data-pos]', $el).each(function() {
$(this).data('zpos', $(this).offset().top);
});
});
}
} else {
$('[data-pos]', $el).each(function() {
$(this).data('zpos', $(this).offset().top);
});
}
};
window.JI_getselectvalue = function(type, value) {
if (+type === 1) {
if ($.trim(value)) {
$('#s-education-tb').val($.trim(value));
} else {
tip.show('请选择当前学历');
}
} else {
if ($.trim(value)) {
$('#s-year-tb').val($.trim(value));
} else {
tip.show('请选择入学年份');
}
}
changeSuccess();
};
// data-aslider-in="education|fade"
$(document).on('click', '#s-education .s-item', function() {
$('#s-education-tb').val($.trim($(this).html()));
changeSuccess();
});
$(document).on('click', '#s-year .s-item', function() {
$('#s-year-tb').val($.trim($(this).html()));
changeSuccess();
});
$(document).on('click', '.s-footer .checkbox', function() {
var $that = $(this);
if ($that.hasClass('icon-s-checked')) {
$that.removeClass('icon-s-checked').addClass('icon-s-check');
} else {
$that.removeClass('icon-s-check').addClass('icon-s-checked');
}
changeSuccess();
});
/*
* 数据提交
*/
$(document).on('click', '.s-submit', function() {
var obj = changeSuccess(),
FAILURE_CAUSE;
if (!obj.msg) {
$.ajax({
url: '/activity/student/join',
type: 'post',
data: obj.data
}).then(function(data) {
if (+data.code === 200) {
yas.sendCustomInfo({
EVENT: 'YB_STUDENT_ATTCT_SUBMIT',
C_ID: C_ID,
SRC_ID: 5,
SUBMIT_RES: 1
}, false);
location.href = data.data;
} else {
tip.show(data.message);
}
});
} else {
tip.show(obj.msg);
if (obj.msg.indexOf('字段为空') > -1) {
FAILURE_CAUSE = 1;
} else if (obj.msg.indexOf('认证协议') > -1) {
FAILURE_CAUSE = 3;
} else {
FAILURE_CAUSE = 2;
}
yas.sendCustomInfo({
EVENT: 'YB_STUDENT_ATTCT_SUBMIT',
C_ID: C_ID,
SRC_ID: 5,
SUBMIT_RES: 2,
FAILURE_CAUSE: FAILURE_CAUSE
}, true);
}
});
$('#tb-is-read').change(function() {
changeSuccess();
});
// $('.s-input-search').focusin(function() {
// $('.s-seach-tip').hide();
// }).focusout(function() {
// if (!$.trim($(this).val())) {
// $('.s-seach-tip').show();
// }
// });
// 埋点 学生认证-信息填写页面
yas.sendCustomInfo({
EVENT: 'YB_STUDENT_ATTCT_INFO',
C_ID: C_ID,
SRC_ID: 5
}, true);
... ...
... ... @@ -63,6 +63,8 @@ function getUrlParam(name) {
return null;
}
$('.main-right-receive').on('click', function() {
var $curDom = $(this),
req = '';
... ...
... ... @@ -224,7 +224,7 @@
.more {
float: right;
font-size: 24px;
font-size: 36px;
color: #b0b0b0;
position: absolute;
display: block;
... ... @@ -340,9 +340,6 @@
width: 640px;
.s-renzhen {
/* background-image: url('/channel/student/renzheng.png');
background-repeat: no-repeat;
background-size: 120px 20px; */
background-color: #d10922;
border-radius: 20px;
font-size: 22px;
... ... @@ -456,16 +453,22 @@
border-radius: 8px;
}
.s-sub-tip{
font-size: 12px;
line-height: 40px;
font-size: 24px;
color: #B0B0B0;
text-align: center;
margin-top: 24px;
}
.s-submit.succ {
background-color: #444444;
}
}
.s-price-block{
margin-top: 14px;
.market-price{
margin-left: 0px;
}
}
.s-search {
height: 55px;
line-height: 55px;
... ...
... ... @@ -128,6 +128,7 @@
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
height: 60px;
}
.price {
... ...