Authored by zhangxiaoru

图标添加

... ... @@ -128,31 +128,33 @@
</div>
</ul>
</div>
<p style="margin-top: 20px;">14. 区域/选择地址组件</p>
<div style="padding: 5px; height: 300px;">
<div id="address"></div>
</div>
{{/ content}}
<p class="title">14. tips</p>
<div>
<button id="change" >show or hide tip</button>
</div>
<div id="tips" style="width: 200px;">
<input style="width: 100%;" type="text" name="" id="">
</div>
<p class="title">14. tips</p>
<div>
<button id="change" >show or hide tip</button>
</div>
<div id="tips" style="width: 200px;">
<input style="width: 100%;" type="text" name="" id="">
</div>
<p class="title">15. 头像</p>
<p class="title">15. 头像</p>
<div>
<img class="avatar" src="http://devlup.com/wp-content/uploads/2013/07/images.jpg" alt="Braden Hamm">
</div>
<div>
<img class="avatar" src="http://devlup.com/wp-content/uploads/2013/07/images.jpg" alt="Braden Hamm">
</div>
<p class="title">16. 对话框(弹窗)</p>
<span class="btn alert-btn">alert</span>
<span class="btn red confirm-btn">confirm</span>
<span class="btn white dialog-btn">dialog</span>
<p class="title">16. 对话框(弹窗)</p>
<span class="btn alert-btn">alert</span>
<span class="btn red confirm-btn">confirm</span>
<span class="btn white dialog-btn">dialog</span>
{{/ content}}
</div>
</div>
\ No newline at end of file
... ...
/**
* 注册数据接口
*
* @author JiangFeng<jeff.jiang@yoho.cn>
* @date 2016/06/21
*/
'use strict';
const api = global.yoho.API;
const BindService = {
bindCheck(mobile, openId, sourceType, area) {
let params = {
method: 'app.passport.signCheck',
area: area,
mobile: mobile,
open_id: openId,
source_type: sourceType
};
return api.get('', params);
},
sendBindMsg(area, mobile) {
let params = {
method: 'app.passport.smsbind',
mobile: mobile,
area: area
};
return api.get('', params);
},
checkBindCode(area, mobile, code) {
return api.get('', {
method: 'app.register.validRegCode',
mobile: mobile,
area: area,
code: code
});
},
bindMobile(openId, sourceType, mobile, area, password, nickname) {
let params = {
method: 'app.passport.bind',
mobile: mobile,
open_id: openId,
source_type: sourceType,
area: area
};
if (password) {
params.password = password;
}
if (nickname) {
params.nickname = nickname;
}
return api.get('', params);
},
relateMobile(openId, sourceType, mobile, area) {
return api.get('', {
method: 'app.passport.relateMobile',
mobile: mobile,
openId: openId,
source_type: sourceType,
area: area
});
},
changeCheck(mobile, area) {
return api.get('', {
method: 'app.passport.changeCheck',
mobile: mobile,
area: area
});
},
changeMobile(uid, mobile, area, code) {
return api.get('', {
method: 'app.passport.changeMobile',
mobile: mobile,
uid: uid,
code: code,
area: area
});
}
};
module.exports = BindService;
... ...
/**
* Created by TaoHuang on 2016/7/1.
*/
'use strict';
const _ = require('lodash');
const Captchapng = require('captchapng');
exports.generateCaptcha = (width, height, length) => {
let min = Math.pow(10, (length - 1 || 1));
let max = Math.pow(10, (length - 1 || 1)) * 9;
let token = '' + _.random(min, max);
let png = new Captchapng(width, height, token);//
png.color(0, 0, 0, 0); // First color: background (red, green, blue, alpha)
png.color(80, 80, 80, 255); // Second color: paint (red, green, blue, alpha)
return {
image: new Buffer(png.getBase64(), 'base64'),
text: token
};
};
... ...
... ... @@ -15,4 +15,7 @@
<p>NewPower Co. 版权所有 经营许可证编号:苏B2-20120395</p>
</div>
</div>
<div class="return-top hide">
{{> icon/up}}
</div>
</div>
\ No newline at end of file
... ...
/**
* 公共底部
* @author: yyq<yanqing.yang@yoho.cn>
* @date: 2016/7/4
*/
var $returnTop = $('.return-top');
function rePosReturn() {
if ($(window).height() > $(document).height()) {
$returnTop.addClass('hide');
}
// 只在窗口高度大于文档高度的时候,隐藏返回顶部
// else {
// $returnTop.removeClass('hide');
// }
}
// 返回顶部
$returnTop.click(function() {
$('html,body').animate({
scrollTop: 0
}, 500);
});
$(window).scroll(function() {
if ($(window).scrollTop() === 0) {
$returnTop.addClass('hide');
} else {
$returnTop.removeClass('hide');
}
});
// 如果初始是隐藏的,监听图片加载,重新确定return-top的高度
if ($returnTop.hasClass('hide')) {
$('img').load(rePosReturn);
}
// 暴露给有可能通AJAX改变内容的页面去用
window.rePosReturnTop = rePosReturn;
... ...
var $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload'),
dialog = require('../common/dialog');
dialog = require('../plugins/dialog');
var _dialog = dialog.Dialog,
_alert = dialog.Alert,
_confirm = dialog.Confirm;
var cascadingAddress = require('../plugins/cascading-address');
var tips = $('#tips');
var change = $('#change');
var show = false;
require('../plugins/tips');
$('.alert-btn').click(function() {
new _alert('购买成功<br>进入 个人中心>我的订单<br>查看门票信息').show();
});
... ... @@ -46,21 +53,15 @@ $('.dialog-btn').click(function() {
}).show();
});
require('../plugins/tips');
lazyLoad($('img.lazy'));
var tips = $('#tips');
var change = $('#change');
var show = false;
change.click(function () {
"use strict";
change.click(function() {
'use strict';
if (show) {
tips.tips('hide');
show = false;
} else {
tips.tips("show", "×该用户已存在");
tips.tips('show', '×该用户已存在');
show = true;
}
... ...
... ... @@ -88,7 +88,7 @@ function Dialog(options) {
Dialog.prototype.close = function() {
this.$mask && this.$mask.addClass('hide');
this.$el.remove();
return this;
};
... ...
/**
* 首页banner轮播
* @author: liuyue(yue.liu@yoho.cn)
* @date: 2015/12/04
*/
var $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload');
(function() {
var Slider = function(element, options) {
this.$element = $(element);
this.options = $.extend({}, $.fn.slider.defaults, options);
this.bigItem = this.$element.find('.slide-wrapper').find('li');
this.smallItem = null;
this.len = this.bigItem.size();
this.index = 0;
this.timer = null;
this.init();
};
Slider.prototype = {
init: function() {
if (!this.$element) {
return;
}
if (this.len <= 1) {
lazyLoad(this.$element.find('img.lazy'));
return;
}
if (this.options.pagination) {
this.smallItem = $(this.options.pagination).find('li');
} else {
this._createPage();
}
if (this.options.orient) {
this._createOrient();
}
this._slideShow();
this._bindEvent();
this._autoplay();
},
_createOrient: function() {
var orientHtml = '<div class="slide-switch">' +
'<a class="prev" href="javascript:;"><span class="iconfont">&#xe609;</span></a>' +
'<a class="next" href="javascript:;"><span class="iconfont">&#xe608;</span></a>' +
'</div>';
if (this.$element.find('.slide-switch').length > 0) {
return;
}
this.$element.append(orientHtml);
},
_createPage: function() {
var pageHtml = '<div class="slide-pagination"><div class="slide-pagination-inner">' +
'<div class="slide-shade"></div><div class="slide-pagination-last">',
i = 0;
if (this.len <= 1) {
return;
}
for (i = 0; i < this.len; i++) {
pageHtml += '<span></span>';
}
pageHtml += '</div></div></div>';
this.$element.append($(pageHtml));
this.smallItem = this.$element.find('.slide-pagination-inner span');
},
_bindEvent: function() {
var that = this;
this.$element.find('.slide-switch').on('click', '.next', function() {
that._nextSlide();
clearInterval(that.timer);
that.timer = setInterval(function() {
that._nextSlide();
}, that.options.time);
}).on('click', '.prev', function() {
that._prevSlide();
clearInterval(that.timer);
that.timer = setInterval(function() {
that._nextSlide();
}, that.options.time);
});
this.smallItem.on('mouseenter', function() {
that.index = $(this).index();
clearInterval(that.timer);
that._slideShow();
}).on('mouseleave', function() {
that._autoplay();
});
this.$element.on('mouseenter', function() {
$(this).find('.slide-switch').addClass('show');
}).on('mouseleave', function() {
$(this).find('.slide-switch').removeClass('show');
});
},
_nextSlide: function() {
if (this.index === this.len - 1) {
this.index = 0;
} else {
this.index++;
}
this._slideShow();
},
_prevSlide: function() {
if (this.index === 0) {
this.index = this.len - 1;
} else {
this.index--;
}
this._slideShow();
},
_slideShow: function() {
var $img = this.bigItem.eq(this.index).find('img.lazy');
// 未加载图片的及时显示
if ($img.attr('src') !== $img.data('original')) {
lazyLoad($img, {
event: 'sporty'
});
$img.trigger('sporty');
}
this.smallItem.eq(this.index).addClass('focus').siblings().removeClass('focus');
this.bigItem.eq(this.index).show().stop().animate({
opacity: 1
}, function() {
// 修正IE下切换时文字会重叠的问题
$(this).find('.slide-tips > p').removeClass('hide');
}).siblings().stop().animate({
opacity: 0
}, function() {
$(this).hide().find('.slide-tips > p').addClass('hide');
});
},
_autoplay: function() {
var that = this;
clearInterval(this.timer);
this.timer = setInterval(function() {
that._nextSlide();
}, this.options.time);
}
};
$.fn.slider = function(option) {
return this.each(function() {
var $this = $(this),
data = $this.data('Slider'),
options = typeof option === 'object' && option;
if (!data) {
$this.data('Slider', (data = new Slider(this, options)));
}
if (typeof option === 'string') {
data[option]();
}
});
};
$.fn.slider.Constructor = Slider;
$.fn.slider.defaults = {
time: 5000,
orient: true, // 左右切换箭头的显示
pagination: null
};
}($));
... ...
... ... @@ -205,6 +205,11 @@ a {
left: 0;
}
.center-content {
width: 1150px;
margin: 0 auto;
}
.block {
display: block;
}
... ...
@import "header";
@import "sign-header";
@import "footer";
@import "dialog";
.yoho-footer {
background: #fff;
.center-content {
border-top: 2px solid #eee;
}
... ... @@ -21,4 +23,26 @@
text-align: center;
padding: 15px 0;
}
.return-top {
width: 50px;
height: 50px;
line-height: 50px;
text-align: center;
background: #000;
opacity: 0.5;
position: fixed;
left: 50%;
bottom: 20px;
margin-left: 595px;
cursor: pointer;
.iconfont {
color: #fff;
}
&.min {
margin-left: 505px;
}
}
}
... ...
.center-content {
width: 1150px;
margin: 0 auto;
}
.yoho-header {
height: 50px;
line-height: 50px;
... ...
@import "header";
@import "sign-header";
@import "footer";
@import "pagination"; /* 分页 */
@import "goods"; /* 商品 */
@import "path-nav"; /* 面包屑 */
@import "floor"; /* 楼层头部 */
@import "cascading-address"; /* 区域/地址组件 */
@import "dialog"; /* 对话框组件 */
... ...
@charset "utf-8";
/* 公共 */
@import "common/index";
@import "plugin/index";
/* 模块 */
... ...