Skip to content

Commit

Permalink
Merge pull request #14 from fleurWang/master
Browse files Browse the repository at this point in the history
for-password
  • Loading branch information
fleurWang committed Dec 24, 2015
2 parents 67d7049 + 2781742 commit c1e000c
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 31 deletions.
Binary file added alert-success.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions component.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dialog",
"version": "0.1.1",
"version": "0.1.2",
"main": "dialog.js",
"description": "公共弹窗组件",
"files":[
Expand All @@ -10,5 +10,8 @@
"i-tip.png",
"icon_close.png",
"loading_2.gif"
]
],
"dependencies": {
"DDFE/imageLoader": "0.0.1"
}
}
57 changes: 28 additions & 29 deletions dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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();
Expand Down Expand Up @@ -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"
Expand All @@ -492,6 +490,7 @@ d.tip = function (cfg) {
}, _cfg.time);
};


d.Fn = Dialog;

module.exports = d;
4 changes: 4 additions & 0 deletions dialog.styl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Binary file added send-text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c1e000c

Please sign in to comment.