Showing
16 changed files
with
390 additions
and
37 deletions
@@ -128,31 +128,33 @@ | @@ -128,31 +128,33 @@ | ||
128 | </div> | 128 | </div> |
129 | </ul> | 129 | </ul> |
130 | </div> | 130 | </div> |
131 | + | ||
131 | 132 | ||
132 | <p style="margin-top: 20px;">14. 区域/选择地址组件</p> | 133 | <p style="margin-top: 20px;">14. 区域/选择地址组件</p> |
133 | <div style="padding: 5px; height: 300px;"> | 134 | <div style="padding: 5px; height: 300px;"> |
134 | <div id="address"></div> | 135 | <div id="address"></div> |
135 | </div> | 136 | </div> |
136 | - {{/ content}} | ||
137 | 137 | ||
138 | - <p class="title">14. tips</p> | ||
139 | - <div> | ||
140 | - <button id="change" >show or hide tip</button> | ||
141 | - </div> | ||
142 | - <div id="tips" style="width: 200px;"> | ||
143 | - <input style="width: 100%;" type="text" name="" id=""> | ||
144 | - </div> | 138 | + <p class="title">14. tips</p> |
139 | + <div> | ||
140 | + <button id="change" >show or hide tip</button> | ||
141 | + </div> | ||
142 | + <div id="tips" style="width: 200px;"> | ||
143 | + <input style="width: 100%;" type="text" name="" id=""> | ||
144 | + </div> | ||
145 | 145 | ||
146 | - <p class="title">15. 头像</p> | 146 | + <p class="title">15. 头像</p> |
147 | 147 | ||
148 | - <div> | ||
149 | - <img class="avatar" src="http://devlup.com/wp-content/uploads/2013/07/images.jpg" alt="Braden Hamm"> | ||
150 | - </div> | 148 | + <div> |
149 | + <img class="avatar" src="http://devlup.com/wp-content/uploads/2013/07/images.jpg" alt="Braden Hamm"> | ||
150 | + </div> | ||
151 | 151 | ||
152 | 152 | ||
153 | - <p class="title">16. 对话框(弹窗)</p> | ||
154 | - <span class="btn alert-btn">alert</span> | ||
155 | - <span class="btn red confirm-btn">confirm</span> | ||
156 | - <span class="btn white dialog-btn">dialog</span> | 153 | + <p class="title">16. 对话框(弹窗)</p> |
154 | + <span class="btn alert-btn">alert</span> | ||
155 | + <span class="btn red confirm-btn">confirm</span> | ||
156 | + <span class="btn white dialog-btn">dialog</span> | ||
157 | + {{/ content}} | ||
158 | + </div> | ||
157 | 159 | ||
158 | </div> | 160 | </div> |
apps/passport/models/bind-service.js
0 → 100644
1 | +/** | ||
2 | + * 注册数据接口 | ||
3 | + * | ||
4 | + * @author JiangFeng<jeff.jiang@yoho.cn> | ||
5 | + * @date 2016/06/21 | ||
6 | + */ | ||
7 | + | ||
8 | +'use strict'; | ||
9 | + | ||
10 | +const api = global.yoho.API; | ||
11 | + | ||
12 | +const BindService = { | ||
13 | + bindCheck(mobile, openId, sourceType, area) { | ||
14 | + let params = { | ||
15 | + method: 'app.passport.signCheck', | ||
16 | + area: area, | ||
17 | + mobile: mobile, | ||
18 | + open_id: openId, | ||
19 | + source_type: sourceType | ||
20 | + }; | ||
21 | + | ||
22 | + return api.get('', params); | ||
23 | + }, | ||
24 | + sendBindMsg(area, mobile) { | ||
25 | + let params = { | ||
26 | + method: 'app.passport.smsbind', | ||
27 | + mobile: mobile, | ||
28 | + area: area | ||
29 | + }; | ||
30 | + | ||
31 | + return api.get('', params); | ||
32 | + }, | ||
33 | + checkBindCode(area, mobile, code) { | ||
34 | + return api.get('', { | ||
35 | + method: 'app.register.validRegCode', | ||
36 | + mobile: mobile, | ||
37 | + area: area, | ||
38 | + code: code | ||
39 | + }); | ||
40 | + }, | ||
41 | + bindMobile(openId, sourceType, mobile, area, password, nickname) { | ||
42 | + let params = { | ||
43 | + method: 'app.passport.bind', | ||
44 | + mobile: mobile, | ||
45 | + open_id: openId, | ||
46 | + source_type: sourceType, | ||
47 | + area: area | ||
48 | + }; | ||
49 | + | ||
50 | + if (password) { | ||
51 | + params.password = password; | ||
52 | + } | ||
53 | + | ||
54 | + if (nickname) { | ||
55 | + params.nickname = nickname; | ||
56 | + } | ||
57 | + | ||
58 | + return api.get('', params); | ||
59 | + }, | ||
60 | + relateMobile(openId, sourceType, mobile, area) { | ||
61 | + return api.get('', { | ||
62 | + method: 'app.passport.relateMobile', | ||
63 | + mobile: mobile, | ||
64 | + openId: openId, | ||
65 | + source_type: sourceType, | ||
66 | + area: area | ||
67 | + }); | ||
68 | + }, | ||
69 | + changeCheck(mobile, area) { | ||
70 | + return api.get('', { | ||
71 | + method: 'app.passport.changeCheck', | ||
72 | + mobile: mobile, | ||
73 | + area: area | ||
74 | + }); | ||
75 | + }, | ||
76 | + changeMobile(uid, mobile, area, code) { | ||
77 | + return api.get('', { | ||
78 | + method: 'app.passport.changeMobile', | ||
79 | + mobile: mobile, | ||
80 | + uid: uid, | ||
81 | + code: code, | ||
82 | + area: area | ||
83 | + }); | ||
84 | + } | ||
85 | +}; | ||
86 | + | ||
87 | +module.exports = BindService; |
apps/passport/models/captcha-service.js
0 → 100644
1 | +/** | ||
2 | + * Created by TaoHuang on 2016/7/1. | ||
3 | + */ | ||
4 | + | ||
5 | +'use strict'; | ||
6 | + | ||
7 | +const _ = require('lodash'); | ||
8 | +const Captchapng = require('captchapng'); | ||
9 | + | ||
10 | +exports.generateCaptcha = (width, height, length) => { | ||
11 | + let min = Math.pow(10, (length - 1 || 1)); | ||
12 | + let max = Math.pow(10, (length - 1 || 1)) * 9; | ||
13 | + let token = '' + _.random(min, max); | ||
14 | + | ||
15 | + let png = new Captchapng(width, height, token);// | ||
16 | + | ||
17 | + png.color(0, 0, 0, 0); // First color: background (red, green, blue, alpha) | ||
18 | + png.color(80, 80, 80, 255); // Second color: paint (red, green, blue, alpha) | ||
19 | + | ||
20 | + return { | ||
21 | + image: new Buffer(png.getBase64(), 'base64'), | ||
22 | + text: token | ||
23 | + }; | ||
24 | +}; |
public/js/common/footer.js
0 → 100644
1 | +/** | ||
2 | + * 公共底部 | ||
3 | + * @author: yyq<yanqing.yang@yoho.cn> | ||
4 | + * @date: 2016/7/4 | ||
5 | + */ | ||
6 | +var $returnTop = $('.return-top'); | ||
7 | + | ||
8 | +function rePosReturn() { | ||
9 | + if ($(window).height() > $(document).height()) { | ||
10 | + $returnTop.addClass('hide'); | ||
11 | + } | ||
12 | + | ||
13 | + // 只在窗口高度大于文档高度的时候,隐藏返回顶部 | ||
14 | + // else { | ||
15 | + // $returnTop.removeClass('hide'); | ||
16 | + // } | ||
17 | +} | ||
18 | + | ||
19 | +// 返回顶部 | ||
20 | +$returnTop.click(function() { | ||
21 | + $('html,body').animate({ | ||
22 | + scrollTop: 0 | ||
23 | + }, 500); | ||
24 | +}); | ||
25 | + | ||
26 | +$(window).scroll(function() { | ||
27 | + if ($(window).scrollTop() === 0) { | ||
28 | + $returnTop.addClass('hide'); | ||
29 | + } else { | ||
30 | + $returnTop.removeClass('hide'); | ||
31 | + } | ||
32 | +}); | ||
33 | + | ||
34 | +// 如果初始是隐藏的,监听图片加载,重新确定return-top的高度 | ||
35 | +if ($returnTop.hasClass('hide')) { | ||
36 | + $('img').load(rePosReturn); | ||
37 | +} | ||
38 | + | ||
39 | +// 暴露给有可能通AJAX改变内容的页面去用 | ||
40 | +window.rePosReturnTop = rePosReturn; |
1 | var $ = require('yoho-jquery'), | 1 | var $ = require('yoho-jquery'), |
2 | lazyLoad = require('yoho-jquery-lazyload'), | 2 | lazyLoad = require('yoho-jquery-lazyload'), |
3 | - dialog = require('../common/dialog'); | 3 | + dialog = require('../plugins/dialog'); |
4 | 4 | ||
5 | var _dialog = dialog.Dialog, | 5 | var _dialog = dialog.Dialog, |
6 | _alert = dialog.Alert, | 6 | _alert = dialog.Alert, |
7 | _confirm = dialog.Confirm; | 7 | _confirm = dialog.Confirm; |
8 | 8 | ||
9 | + | ||
9 | var cascadingAddress = require('../plugins/cascading-address'); | 10 | var cascadingAddress = require('../plugins/cascading-address'); |
10 | 11 | ||
12 | +var tips = $('#tips'); | ||
13 | +var change = $('#change'); | ||
14 | +var show = false; | ||
15 | + | ||
16 | +require('../plugins/tips'); | ||
17 | + | ||
11 | $('.alert-btn').click(function() { | 18 | $('.alert-btn').click(function() { |
12 | new _alert('购买成功<br>进入 个人中心>我的订单<br>查看门票信息').show(); | 19 | new _alert('购买成功<br>进入 个人中心>我的订单<br>查看门票信息').show(); |
13 | }); | 20 | }); |
@@ -46,21 +53,15 @@ $('.dialog-btn').click(function() { | @@ -46,21 +53,15 @@ $('.dialog-btn').click(function() { | ||
46 | }).show(); | 53 | }).show(); |
47 | }); | 54 | }); |
48 | 55 | ||
49 | -require('../plugins/tips'); | ||
50 | - | ||
51 | lazyLoad($('img.lazy')); | 56 | lazyLoad($('img.lazy')); |
52 | 57 | ||
53 | -var tips = $('#tips'); | ||
54 | -var change = $('#change'); | ||
55 | -var show = false; | ||
56 | - | ||
57 | -change.click(function () { | ||
58 | - "use strict"; | 58 | +change.click(function() { |
59 | + 'use strict'; | ||
59 | if (show) { | 60 | if (show) { |
60 | tips.tips('hide'); | 61 | tips.tips('hide'); |
61 | show = false; | 62 | show = false; |
62 | } else { | 63 | } else { |
63 | - tips.tips("show", "×该用户已存在"); | 64 | + tips.tips('show', '×该用户已存在'); |
64 | show = true; | 65 | show = true; |
65 | } | 66 | } |
66 | 67 |
@@ -88,7 +88,7 @@ function Dialog(options) { | @@ -88,7 +88,7 @@ function Dialog(options) { | ||
88 | Dialog.prototype.close = function() { | 88 | Dialog.prototype.close = function() { |
89 | this.$mask && this.$mask.addClass('hide'); | 89 | this.$mask && this.$mask.addClass('hide'); |
90 | this.$el.remove(); | 90 | this.$el.remove(); |
91 | - | 91 | + |
92 | return this; | 92 | return this; |
93 | }; | 93 | }; |
94 | 94 |
public/js/plugins/slider.js
0 → 100644
1 | +/** | ||
2 | + * 首页banner轮播 | ||
3 | + * @author: liuyue(yue.liu@yoho.cn) | ||
4 | + * @date: 2015/12/04 | ||
5 | + */ | ||
6 | + | ||
7 | +var $ = require('yoho-jquery'), | ||
8 | + lazyLoad = require('yoho-jquery-lazyload'); | ||
9 | + | ||
10 | +(function() { | ||
11 | + var Slider = function(element, options) { | ||
12 | + this.$element = $(element); | ||
13 | + this.options = $.extend({}, $.fn.slider.defaults, options); | ||
14 | + this.bigItem = this.$element.find('.slide-wrapper').find('li'); | ||
15 | + this.smallItem = null; | ||
16 | + this.len = this.bigItem.size(); | ||
17 | + this.index = 0; | ||
18 | + this.timer = null; | ||
19 | + this.init(); | ||
20 | + }; | ||
21 | + | ||
22 | + Slider.prototype = { | ||
23 | + init: function() { | ||
24 | + if (!this.$element) { | ||
25 | + return; | ||
26 | + } | ||
27 | + | ||
28 | + if (this.len <= 1) { | ||
29 | + lazyLoad(this.$element.find('img.lazy')); | ||
30 | + return; | ||
31 | + } | ||
32 | + if (this.options.pagination) { | ||
33 | + this.smallItem = $(this.options.pagination).find('li'); | ||
34 | + } else { | ||
35 | + this._createPage(); | ||
36 | + } | ||
37 | + | ||
38 | + if (this.options.orient) { | ||
39 | + this._createOrient(); | ||
40 | + } | ||
41 | + this._slideShow(); | ||
42 | + this._bindEvent(); | ||
43 | + this._autoplay(); | ||
44 | + }, | ||
45 | + _createOrient: function() { | ||
46 | + | ||
47 | + var orientHtml = '<div class="slide-switch">' + | ||
48 | + '<a class="prev" href="javascript:;"><span class="iconfont"></span></a>' + | ||
49 | + '<a class="next" href="javascript:;"><span class="iconfont"></span></a>' + | ||
50 | + '</div>'; | ||
51 | + | ||
52 | + if (this.$element.find('.slide-switch').length > 0) { | ||
53 | + return; | ||
54 | + } | ||
55 | + | ||
56 | + this.$element.append(orientHtml); | ||
57 | + }, | ||
58 | + _createPage: function() { | ||
59 | + var pageHtml = '<div class="slide-pagination"><div class="slide-pagination-inner">' + | ||
60 | + '<div class="slide-shade"></div><div class="slide-pagination-last">', | ||
61 | + i = 0; | ||
62 | + | ||
63 | + if (this.len <= 1) { | ||
64 | + return; | ||
65 | + } | ||
66 | + for (i = 0; i < this.len; i++) { | ||
67 | + pageHtml += '<span></span>'; | ||
68 | + } | ||
69 | + pageHtml += '</div></div></div>'; | ||
70 | + this.$element.append($(pageHtml)); | ||
71 | + this.smallItem = this.$element.find('.slide-pagination-inner span'); | ||
72 | + }, | ||
73 | + _bindEvent: function() { | ||
74 | + var that = this; | ||
75 | + | ||
76 | + this.$element.find('.slide-switch').on('click', '.next', function() { | ||
77 | + that._nextSlide(); | ||
78 | + clearInterval(that.timer); | ||
79 | + that.timer = setInterval(function() { | ||
80 | + that._nextSlide(); | ||
81 | + }, that.options.time); | ||
82 | + }).on('click', '.prev', function() { | ||
83 | + that._prevSlide(); | ||
84 | + clearInterval(that.timer); | ||
85 | + that.timer = setInterval(function() { | ||
86 | + that._nextSlide(); | ||
87 | + }, that.options.time); | ||
88 | + }); | ||
89 | + | ||
90 | + this.smallItem.on('mouseenter', function() { | ||
91 | + that.index = $(this).index(); | ||
92 | + clearInterval(that.timer); | ||
93 | + that._slideShow(); | ||
94 | + }).on('mouseleave', function() { | ||
95 | + that._autoplay(); | ||
96 | + }); | ||
97 | + | ||
98 | + this.$element.on('mouseenter', function() { | ||
99 | + $(this).find('.slide-switch').addClass('show'); | ||
100 | + }).on('mouseleave', function() { | ||
101 | + $(this).find('.slide-switch').removeClass('show'); | ||
102 | + }); | ||
103 | + }, | ||
104 | + _nextSlide: function() { | ||
105 | + if (this.index === this.len - 1) { | ||
106 | + this.index = 0; | ||
107 | + } else { | ||
108 | + this.index++; | ||
109 | + } | ||
110 | + this._slideShow(); | ||
111 | + }, | ||
112 | + _prevSlide: function() { | ||
113 | + if (this.index === 0) { | ||
114 | + this.index = this.len - 1; | ||
115 | + } else { | ||
116 | + this.index--; | ||
117 | + } | ||
118 | + this._slideShow(); | ||
119 | + }, | ||
120 | + _slideShow: function() { | ||
121 | + var $img = this.bigItem.eq(this.index).find('img.lazy'); | ||
122 | + | ||
123 | + // 未加载图片的及时显示 | ||
124 | + if ($img.attr('src') !== $img.data('original')) { | ||
125 | + lazyLoad($img, { | ||
126 | + event: 'sporty' | ||
127 | + }); | ||
128 | + $img.trigger('sporty'); | ||
129 | + } | ||
130 | + | ||
131 | + this.smallItem.eq(this.index).addClass('focus').siblings().removeClass('focus'); | ||
132 | + this.bigItem.eq(this.index).show().stop().animate({ | ||
133 | + opacity: 1 | ||
134 | + }, function() { | ||
135 | + | ||
136 | + // 修正IE下切换时文字会重叠的问题 | ||
137 | + $(this).find('.slide-tips > p').removeClass('hide'); | ||
138 | + }).siblings().stop().animate({ | ||
139 | + opacity: 0 | ||
140 | + }, function() { | ||
141 | + $(this).hide().find('.slide-tips > p').addClass('hide'); | ||
142 | + }); | ||
143 | + }, | ||
144 | + _autoplay: function() { | ||
145 | + var that = this; | ||
146 | + | ||
147 | + clearInterval(this.timer); | ||
148 | + this.timer = setInterval(function() { | ||
149 | + that._nextSlide(); | ||
150 | + }, this.options.time); | ||
151 | + } | ||
152 | + }; | ||
153 | + $.fn.slider = function(option) { | ||
154 | + return this.each(function() { | ||
155 | + var $this = $(this), | ||
156 | + data = $this.data('Slider'), | ||
157 | + options = typeof option === 'object' && option; | ||
158 | + | ||
159 | + if (!data) { | ||
160 | + $this.data('Slider', (data = new Slider(this, options))); | ||
161 | + } | ||
162 | + if (typeof option === 'string') { | ||
163 | + data[option](); | ||
164 | + } | ||
165 | + }); | ||
166 | + }; | ||
167 | + $.fn.slider.Constructor = Slider; | ||
168 | + $.fn.slider.defaults = { | ||
169 | + time: 5000, | ||
170 | + orient: true, // 左右切换箭头的显示 | ||
171 | + pagination: null | ||
172 | + }; | ||
173 | +}($)); |
public/scss/common/_index.css
deleted
100644 → 0
1 | .yoho-footer { | 1 | .yoho-footer { |
2 | + background: #fff; | ||
3 | + | ||
2 | .center-content { | 4 | .center-content { |
3 | border-top: 2px solid #eee; | 5 | border-top: 2px solid #eee; |
4 | } | 6 | } |
@@ -21,4 +23,26 @@ | @@ -21,4 +23,26 @@ | ||
21 | text-align: center; | 23 | text-align: center; |
22 | padding: 15px 0; | 24 | padding: 15px 0; |
23 | } | 25 | } |
26 | + | ||
27 | + .return-top { | ||
28 | + width: 50px; | ||
29 | + height: 50px; | ||
30 | + line-height: 50px; | ||
31 | + text-align: center; | ||
32 | + background: #000; | ||
33 | + opacity: 0.5; | ||
34 | + position: fixed; | ||
35 | + left: 50%; | ||
36 | + bottom: 20px; | ||
37 | + margin-left: 595px; | ||
38 | + cursor: pointer; | ||
39 | + | ||
40 | + .iconfont { | ||
41 | + color: #fff; | ||
42 | + } | ||
43 | + | ||
44 | + &.min { | ||
45 | + margin-left: 505px; | ||
46 | + } | ||
47 | + } | ||
24 | } | 48 | } |
1 | +@import "header"; | ||
2 | +@import "sign-header"; | ||
3 | +@import "footer"; | ||
1 | @import "pagination"; /* 分页 */ | 4 | @import "pagination"; /* 分页 */ |
2 | @import "goods"; /* 商品 */ | 5 | @import "goods"; /* 商品 */ |
3 | @import "path-nav"; /* 面包屑 */ | 6 | @import "path-nav"; /* 面包屑 */ |
4 | @import "floor"; /* 楼层头部 */ | 7 | @import "floor"; /* 楼层头部 */ |
5 | @import "cascading-address"; /* 区域/地址组件 */ | 8 | @import "cascading-address"; /* 区域/地址组件 */ |
9 | +@import "dialog"; /* 对话框组件 */ |
-
Please register or login to post a comment