From 2781742669ad48ea0a4df1dad48e2c6219f616dd Mon Sep 17 00:00:00 2001 From: fleurWang <1159971011@qq.com> Date: Thu, 24 Dec 2015 14:37:35 +0800 Subject: [PATCH] for-password --- alert-success.png | Bin 0 -> 5623 bytes component.json | 7 ++++-- dialog.js | 57 +++++++++++++++++++++++----------------------- dialog.styl | 4 ++++ send-text.png | Bin 0 -> 4577 bytes 5 files changed, 37 insertions(+), 31 deletions(-) create mode 100644 alert-success.png create mode 100644 send-text.png diff --git a/alert-success.png b/alert-success.png new file mode 100644 index 0000000000000000000000000000000000000000..457e15c71f14d017d636f3b37353c8308c963a05 GIT binary patch literal 5623 zcmVKLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf zVxhe-O!X z{f;To;xw^bEES6JSc$k$B2CA6xl)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4 ze(nJRiw;=Qb^t(r^DT@T3y}a2XEZW-_W%Hszxj_qD**t_m!#tW0KDiJT&R>6OvVTR z07RgHDzHHZ48atvzz&?j9lXF70$~P3Knx_nJP<+#`N z#-MZ2bTkiLfR>_b(HgWKJ%F~Nr_oF3b#wrIijHG|(J>BYjM-sajE6;FiC7vY#};Gd zST$CUHDeuEH+B^pz@B062qXfFfD`NpUW5?BY=V%GM_5c)L#QR}BeW8_2v-S%gfYS= zB9o|3v?Y2H`NVi)In3rTB8+ej^> zQ=~r95NVuDChL%G$=>7$vVg20my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WimaQ5BgLpl?vPHr)TR9-|;Mb{RL>X`Fo3Hm~B*Qk1&-=g{MaJB(Oh`NL1!5ZoJEg z?j`H&*$-kHmgTcEfd<%D(WuV1ftz2QpA9VYY@-sQ z`HgF`+f>k+rp0aVyjab%#oE9M%{D5wlcH%_9OHLSX9caAu&Z~bR&8Lep3ziW1Is46 zeX=a8bAbkUUQrZ#M_uf;flUr$5=@nbr)IVLnGA}e#DN#4zBbborD0%?s;axH{u>=P z-UXev8HJ`uzfrUPe2+1utAwu;mrJUu0_>4xd1zW}%qMHSkw_$t%CdZ5 zR#R1AACE_)QMK#^r#ebhcmJb)~k6GO3Q?Xd=l%got>6%g$g;*?h3b0f*vWI(w==U}f>6s3P5G?0p-peRZ|ux>t( zO974f(OIXe>gh-%LRD(m6|!)us-89>56pKzr51C;!0oYE?8R_6Oe6ImlgT8bqoc%P zu|2@;#WZ~70G+dbJCey{-{|P5+6c7~P16`19aWRbWS`l!E_rgIox>A{fi=-+^jJ6? zW_*0S?f{REj}s1uiAJNxfHmed*&@5gfi3|X6N$uqBO@aN(P)&aj?`FGCX*o=jWRMa zGLT3l?lbM%B|DE%v1RsrK3~l(P?pJL&@`>Cm)Xmg1nk6EIMQEZ3rDIL3rGH(I$k(( zs{9yBp>B7%TwNZIhqku1iY|qkNF<2I3Fz`0U#FmC$+;=vu<=W+{1*g+VZpmtw>*_Km`HunezY?PB`jw@s z%_&()u3fJBbU9AGo9%CkK?s5JC>=juD+$!k*4*)%QIngH& R{=5JH002ovPDHLkV1je))aw8M literal 0 HcmV?d00001 diff --git a/component.json b/component.json index 8f70ac9..4e765ce 100644 --- a/component.json +++ b/component.json @@ -1,6 +1,6 @@ { "name": "dialog", - "version": "0.1.1", + "version": "0.1.2", "main": "dialog.js", "description": "公共弹窗组件", "files":[ @@ -10,5 +10,8 @@ "i-tip.png", "icon_close.png", "loading_2.gif" - ] + ], + "dependencies": { + "DDFE/imageLoader": "0.0.1" + } } \ No newline at end of file diff --git a/dialog.js b/dialog.js index 71e61f1..38b9a88 100644 --- a/dialog.js +++ b/dialog.js @@ -6,6 +6,16 @@ 'use strict'; +var imageLoader = require('imageLoader'); + +var images = [ + __uri("i-loading.gif"), + __uri("loading_2.gif") +]; + +//图片预加载 +imageLoader(images); + var d = {}; var docElem = document.documentElement, @@ -315,8 +325,18 @@ d.confirm = function (cfg) { var cancel = opts.cancel || {}; var confirm = opts.confirm || {}; - var btn = []; - var cancelObj = { + dialog = Dialog({ + type: "confirm", + title: { + txt: opts.tip ? opts.text : "" + }, + tip: { + txt: opts.tip ? opts.tip : opts.text + }, + icon: "icon-confirm", + wallCss: "", + wrapCss: "background: #fff;width: 280px;text-align: center;", + btns: [{ id: cancel.id || "btn-cancel", val: cancel.val || "取消", kls: cancel.kls || "btn-white", @@ -327,8 +347,7 @@ d.confirm = function (cfg) { cancel.handler(e); } } - }; - var confirmObj = { + }, { id: confirm.id || "btn-ok", val: confirm.val || "确定", kls: confirm.kls || "btn-orange", @@ -339,28 +358,7 @@ d.confirm = function (cfg) { confirm.handler(e); } } - }; - - if(! opts.swapBtn){ - btn.push(cancelObj); - btn.push(confirmObj); - }else{ - btn.push(confirmObj); - btn.push(cancelObj); - } - - dialog = Dialog({ - type: "confirm", - title: { - txt: opts.tip ? opts.text : "" - }, - tip: { - txt: opts.tip ? opts.tip : opts.text - }, - icon: "icon-confirm", - wallCss: "", - wrapCss: "background: #fff;width: 280px;text-align: center;", - btns: btn, + }], ext: opts.ext }); dialog.show(); @@ -475,10 +473,10 @@ d.tip = function (cfg) { dialog = Dialog({ type: "tip", - icon: "icon-tip", + icon: cfg.icon || "icon-tip", wallCss: "background:#fff;", - wrapCss: "background:#0c0d0d;width:140px;height:140px;opacity:0.7;", - tip: { + wrapCss: cfg.wrapCss || "background:#0c0d0d;width:140px;height:140px;opacity:0.7;", + tip: cfg.tip || { txt: _cfg.text || "温馨提醒", color: "#fff", size: "14px" @@ -492,6 +490,7 @@ d.tip = function (cfg) { }, _cfg.time); }; + d.Fn = Dialog; module.exports = d; \ No newline at end of file diff --git a/dialog.styl b/dialog.styl index d103813..94237aa 100644 --- a/dialog.styl +++ b/dialog.styl @@ -58,6 +58,10 @@ background-image: url(i-tip.png?__sprite) background-size: 45px 45px background-repeat: no-repeat + .icon-success + background-image: url(send-text.png) + background-size: 45px 45px + background-repeat: no-repeat .alert .icon-alert background-image: url(i-alert.png?__sprite) diff --git a/send-text.png b/send-text.png new file mode 100644 index 0000000000000000000000000000000000000000..628a808d02318c2dd75b61238a4858ff96892d42 GIT binary patch literal 4577 zcmV<75gzV|P)KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf zVxhe-O!X z{f;To;xw^bEES6JSc$k$B2CA6xl)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4 ze(nJRiw;=Qb^t(r^DT@T3y}a2XEZW-_W%Hszxj_qD**t_m!#tW0KDiJT&R>6OvVTR z07RgHDzHHZ48atvzz&?j9lXF70$~P3Knx_nJP<+#`N z#-MZ2bTkiLfR>_b(HgWKJ%F~Nr_oF3b#wrIijHG|(J>BYjM-sajE6;FiC7vY#};Gd zST$CUHDeuEH+B^pz@B062qXfFfD`NpUW5?BY=V%GM_5c)L#QR}BeW8_2v-S%gfYS= zB9o|3v?Y2H`NVi)In3rTB8+ej^> zQ=~r95NVuDChL%G$=>7$vVg20myx%S50Foi`^m%Pw-h?Xh~i8Mq9jtJloCocWk2Nv zrJpiF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