Showing
8 changed files
with
210 additions
and
16 deletions
1 | <style> | 1 | <style> |
2 | - .title { | 2 | + .demo-page { |
3 | + padding: 10px; | ||
4 | + } | ||
5 | + | ||
6 | + .demo-page .title { | ||
3 | padding: 10px 0; | 7 | padding: 10px 0; |
4 | } | 8 | } |
5 | 9 | ||
6 | - .btn { | 10 | + .demo-page .btn { |
7 | margin-bottom: 10px; | 11 | margin-bottom: 10px; |
8 | } | 12 | } |
9 | 13 | ||
10 | - .demo-page { | ||
11 | - padding: 10px; | ||
12 | - } | ||
13 | 14 | ||
14 | - .icon_lists span{ | 15 | + .demo-page .icon_lists span{ |
15 | float: left; | 16 | float: left; |
16 | width: 50px; | 17 | width: 50px; |
17 | height: 30px; | 18 | height: 30px; |
@@ -19,19 +20,19 @@ | @@ -19,19 +20,19 @@ | ||
19 | margin-top: 10px; | 20 | margin-top: 10px; |
20 | } | 21 | } |
21 | 22 | ||
22 | - .modality { | 23 | + .demo-page .modality { |
23 | color: #219dd6; | 24 | color: #219dd6; |
24 | } | 25 | } |
25 | 26 | ||
26 | - .modality span{ | 27 | + .demo-page .modality span{ |
27 | font-size: 20px; | 28 | font-size: 20px; |
28 | } | 29 | } |
29 | 30 | ||
30 | - .sort { | 31 | + .demo-page .sort { |
31 | color: #999; | 32 | color: #999; |
32 | } | 33 | } |
33 | 34 | ||
34 | - .sort span { | 35 | + .demo-page .sort span { |
35 | font-size: 20px; | 36 | font-size: 20px; |
36 | } | 37 | } |
37 | </style> | 38 | </style> |
@@ -54,6 +55,10 @@ | @@ -54,6 +55,10 @@ | ||
54 | <span class="btn disable">不可点按钮</span> | 55 | <span class="btn disable">不可点按钮</span> |
55 | <span class="btn red">红色按钮</span> | 56 | <span class="btn red">红色按钮</span> |
56 | <span class="btn white">白色按钮</span> | 57 | <span class="btn white">白色按钮</span> |
58 | + | ||
59 | + <span class="btn alert-btn">alert</span> | ||
60 | + <span class="btn red confirm-btn">confirm</span> | ||
61 | + <span class="btn white dialog-btn">dialog</span> | ||
57 | 62 | ||
58 | <p class="title">4. 提示文字或者某些链接文字颜色</p> | 63 | <p class="title">4. 提示文字或者某些链接文字颜色</p> |
59 | <span class="blue">提示文字</span> | 64 | <span class="blue">提示文字</span> |
@@ -16,7 +16,7 @@ var tpl = | @@ -16,7 +16,7 @@ var tpl = | ||
16 | '<div class="yoho-dialog {{className}} hide">' + | 16 | '<div class="yoho-dialog {{className}} hide">' + |
17 | '{{#if closeIcon}}' + | 17 | '{{#if closeIcon}}' + |
18 | '<span class="close">' + | 18 | '<span class="close">' + |
19 | - '<i class="iconfont"></i>' + | 19 | + '<i class="iconfont"></i>' + |
20 | '</span>' + | 20 | '</span>' + |
21 | '{{/if}}' + | 21 | '{{/if}}' + |
22 | '<div class="content">' + | 22 | '<div class="content">' + |
@@ -93,8 +93,8 @@ Dialog.prototype.close = function() { | @@ -93,8 +93,8 @@ Dialog.prototype.close = function() { | ||
93 | Dialog.prototype.show = function() { | 93 | Dialog.prototype.show = function() { |
94 | this.$mask && this.$mask.removeClass('hide'); | 94 | this.$mask && this.$mask.removeClass('hide'); |
95 | this.$el.removeClass('hide').css({ | 95 | this.$el.removeClass('hide').css({ |
96 | - 'margin-top': -this.$el.height() / 2, | ||
97 | - 'margin-left': -this.$el.width() / 2 | 96 | + 'margin-top': -this.$el.outerHeight() / 2, |
97 | + 'margin-left': -this.$el.outerWidth() / 2 | ||
98 | }); | 98 | }); |
99 | }; | 99 | }; |
100 | 100 |
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'); | ||
4 | + | ||
5 | +var _dialog = dialog.Dialog, | ||
6 | + _alert = dialog.Alert, | ||
7 | + _confirm = dialog.Confirm; | ||
8 | + | ||
9 | +$('.alert-btn').click(function() { | ||
10 | + new _alert('购买成功<br>进入 个人中心>我的订单<br>查看门票信息').show(); | ||
11 | +}); | ||
12 | + | ||
13 | +$('.confirm-btn').click(function() { | ||
14 | + new _confirm({ | ||
15 | + content: '确定要删除?', | ||
16 | + cb: function() { | ||
17 | + console.log('您点击了confirm确认'); | ||
18 | + } | ||
19 | + }).show(); | ||
20 | +}); | ||
21 | + | ||
22 | +$('.dialog-btn').click(function() { | ||
23 | + var tip = new _dialog({ | ||
24 | + className: 'settled-success', | ||
25 | + content: '<h1 class="main-title">恭喜您已提交成功</h1><h2 class="sub-title">我们将尽快与您联系</h2>', | ||
26 | + btns: [ | ||
27 | + { | ||
28 | + id: 'apply', | ||
29 | + btnClass: ['apply'], | ||
30 | + name: '订阅', | ||
31 | + cb: function() { | ||
32 | + tip.close(); | ||
33 | + } | ||
34 | + }, | ||
35 | + { | ||
36 | + id: 'cancel', | ||
37 | + btnClass: ['cancel'], | ||
38 | + name: '取消订阅', | ||
39 | + cb: function() { | ||
40 | + tip.close(); | ||
41 | + } | ||
42 | + } | ||
43 | + ] | ||
44 | + }).show(); | ||
45 | +}); | ||
3 | 46 | ||
4 | lazyLoad($('img.lazy')); | 47 | lazyLoad($('img.lazy')); |
@@ -196,6 +196,15 @@ a { | @@ -196,6 +196,15 @@ a { | ||
196 | -moz-osx-font-smoothing: grayscale; | 196 | -moz-osx-font-smoothing: grayscale; |
197 | } | 197 | } |
198 | 198 | ||
199 | +.body-mask { | ||
200 | + position: absolute; | ||
201 | + z-index: 100; | ||
202 | + background: #1d1d1d; | ||
203 | + opacity: 0.3; | ||
204 | + top: 0; | ||
205 | + left: 0; | ||
206 | +} | ||
207 | + | ||
199 | .block { | 208 | .block { |
200 | display: block; | 209 | display: block; |
201 | } | 210 | } |
public/scss/common/_dialog.css
0 → 100644
1 | +.yoho-dialog { | ||
2 | + position: fixed; | ||
3 | + padding: 40px; | ||
4 | + top: 50%; | ||
5 | + left: 50%; | ||
6 | + min-height: 130px; | ||
7 | + min-width: 420px; | ||
8 | + background: #f8f8f8; | ||
9 | + z-index: 1001; | ||
10 | + border: 1px solid #8f8f8f; | ||
11 | + | ||
12 | + .close { | ||
13 | + padding: 5px; | ||
14 | + text-align: center; | ||
15 | + position: absolute; | ||
16 | + top: 14px; | ||
17 | + right: 14px; | ||
18 | + cursor: pointer; | ||
19 | + | ||
20 | + > * { | ||
21 | + font-size: 16px; | ||
22 | + margin: 0; | ||
23 | + } | ||
24 | + } | ||
25 | + | ||
26 | + .content { | ||
27 | + text-align: center; | ||
28 | + } | ||
29 | + | ||
30 | + .btns { | ||
31 | + padding: 15px 0; | ||
32 | + text-align: center; | ||
33 | + } | ||
34 | + | ||
35 | + .alert-sure { | ||
36 | + background: #1b1b1b; | ||
37 | + color: #fff; | ||
38 | + } | ||
39 | + | ||
40 | + .confirm-sure { | ||
41 | + background: #1b1b1b; | ||
42 | + color: #fff; | ||
43 | + } | ||
44 | + | ||
45 | + .confirm-cancel { | ||
46 | + background: #f8f8f8; | ||
47 | + color: #1b1b1b; | ||
48 | + } | ||
49 | + | ||
50 | + .btn { | ||
51 | + display: inline-block; | ||
52 | + width: 130px; | ||
53 | + height: 30px; | ||
54 | + line-height: 30px; | ||
55 | + font-size: 14px; | ||
56 | + text-align: center; | ||
57 | + border: 1px solid #1b1b1b; | ||
58 | + cursor: pointer; | ||
59 | + margin-left: 10px; | ||
60 | + | ||
61 | + &:first-child { | ||
62 | + margin-left: 0; | ||
63 | + } | ||
64 | + } | ||
65 | + | ||
66 | + &.alert-dialog .content, | ||
67 | + &.confirm-dialog .content { | ||
68 | + width: 350px; | ||
69 | + height: auto; | ||
70 | + min-height: 90px; | ||
71 | + overflow: hidden; | ||
72 | + line-height: 20px; | ||
73 | + position: relative; | ||
74 | + padding-top: 40px; | ||
75 | + padding-bottom: 20px; | ||
76 | + | ||
77 | + p { | ||
78 | + position: absolute; | ||
79 | + left: 0; | ||
80 | + bottom: 25px; | ||
81 | + width: 100%; | ||
82 | + color: #444; | ||
83 | + line-height: 25px; | ||
84 | + } | ||
85 | + | ||
86 | + div { | ||
87 | + position: absolute; | ||
88 | + top: 0; | ||
89 | + left: 100px; | ||
90 | + padding-top: 30px; | ||
91 | + font-size: 22px; | ||
92 | + font-weight: bold; | ||
93 | + width: 150px; | ||
94 | + height: 30px; | ||
95 | + line-height: 30px; | ||
96 | + margin: 0 auto; | ||
97 | + | ||
98 | + span { | ||
99 | + background: url(/cart/del.png); | ||
100 | + float: left; | ||
101 | + width: 27px; | ||
102 | + height: 30px; | ||
103 | + } | ||
104 | + } | ||
105 | + } | ||
106 | + | ||
107 | + &.subcontent-dialog { | ||
108 | + padding: 30px 0; | ||
109 | + | ||
110 | + .content { | ||
111 | + font-weight: bold; | ||
112 | + margin: 0 auto 30px; | ||
113 | + } | ||
114 | + | ||
115 | + .sub-content { | ||
116 | + text-align: center; | ||
117 | + font-size: 12px; | ||
118 | + color: #555; | ||
119 | + margin-left: 5px; | ||
120 | + margin-bottom: 5px; | ||
121 | + } | ||
122 | + | ||
123 | + .btn { | ||
124 | + margin-top: 25px; | ||
125 | + width: 100px; | ||
126 | + font-size: 13px; | ||
127 | + margin-left: 0; | ||
128 | + margin-right: 0; | ||
129 | + | ||
130 | + &.black { | ||
131 | + background-color: #000; | ||
132 | + color: #fff; | ||
133 | + } | ||
134 | + } | ||
135 | + } | ||
136 | +} |
-
Please register or login to post a comment