首页 > 技术文章 > artDialog记录

elves 2016-03-24 20:18 原文

 

//在子页面加按钮的方式
var api = frameElement.api, W = api.opener;
    api.button({
        id: 'valueOk',
        name: '确定',
        callback: true
    });
    //api.button({
    //    id: 'valueCancel',
    //    name: '取消',
    //    callback: true
    //});
    
artDialog.alert = function (content, callback) {
            return artDialog({
                id: 'Alert',
                icon: 'warning',
                fixed: true,
                //lock: true,
                //background: '#600', // 背景色  
                //opacity: 0.87,  // 透明度  
                width: 250,
                height: 50,
                content: content,
                ok: true,
                close: callback
            });
        };


  art.dialog({
                    lock: true,
                    background: '#600', // 背景色  
                    opacity: 0.87,  // 透明度  
                    content: '请填写修约数据2',
                    icon: 'error',
                    ok: function () {
                        console.info(1);
                        return false;
                    },
                    cancel: true
                });

 

function showConfirmMsg(msg, callBack) {
    top.art.dialog({
        id: 'confirmId',
        title: '系统提示',
        content: msg,
        icon: 'warning',
        background: '#000000',
        opacity: 0.1,
        lock: true,
        button: [{
            name: '确定',
            callback: function () {
                callBack(true);
            },
            focus: true
        }, {
            name: '取消',
            callback: function () {
                this.close();
                return false;
            }
        }]
    });
}

/**
短暂提示 - hy
msg: 显示消息
time:停留时间ms
type:类型 1:成功,2:失败,3:警告
callBack:函数
**/
function showArtTipsMsg(msg, time, type, callback) {
    switch (type) {
        case 1: type = 'succeed'; break;
        case 2: type = 'error'; break;
        case 3: type = 'warning'; break;
        //case 4: type = 'face-smile'; break;
        default: type = 'face-smile'; break;
    }
    top.art.dialog({
        //id: 'faceId',
        //title: '温馨提醒',
        icon: type,
        time: time ? time : 5,
        content: msg,
        opacity: 0.1,
        lock: true,
        okVal: '关闭',
        ok: true,
        close: callback
    });
}
        /// <summary>
        /// 用ArtDialog弹出消息
        /// huyong
        /// </summary>
        /// <param name="message">消息内容</param>
        /// <param name="type">提示类型</param>
        /// <param name="reloadMainframe">0 刷新父级列表页面</param>
        /// <param name="closePage">0 关闭当前页面 1刷新当前页面</param>
        /// <param name="dbTime">提示时长(秒)</param>
        /// <param name="callBack">回调方法 [回调的方法需放到Form表单结束前]</param>
        public static void AlertTipsMsg(string message, DialogIcon type = DialogIcon.FaceSmile, int setMainframe = -1, int setPage = -1, double dbTime = 2.5, string callBack = "")
        {
            string jsInfo = string.Format("showArtTipsMsg('{0}',{1},{2},{3});", message, dbTime, (int)Enum.Parse(typeof(DialogIcon), type.ToString()), string.IsNullOrEmpty(callBack) ? "null" : callBack);
            if (setMainframe == 0)
                jsInfo += "top.mainframe.windowload();";

            if (setPage == 0)
                jsInfo += "TopOpenClose();";
            else if (setPage == 1)
                jsInfo += "rePage();";

            ShowMsgHelper.ExecuteScript(jsInfo);
        }

 public static void ExecuteScript(string scriptBody)
        {
            string scriptKey = "Somekey";
            Page p = HttpContext.Current.Handler as Page;
            p.ClientScript.RegisterStartupScript(typeof(string), scriptKey, scriptBody, true);
        }

 

 

//关闭弹出窗口页面(由顶级页面打开的)
top.art.dialog({ id: window.name }).close();
//获取打开当前窗口的页面
art.dialog.open.origin;

 

//窗口关闭
function OpenClose() {
    art.dialog.close();
}
//窗口关闭(从父页面关闭子页面窗口) - hy
function TopOpenClose() {
    top.art.dialog({ id: window.name }).close();
}

 

推荐阅读