App开发文档(临时版)

常用函数列表:
 
//正在加载
ShowLoadingStatusDIV("", "正在撤回中...");
HideLoadingStatusDIV();

//调用alert
NotificationClass.alert("标题", "内容", "按钮文字");

//调用confirm
NotificationClass.confirm("标题", "内容", function ()
{
//回调
});

//调用beep
NotificationClass.beep(3);

//调用toast
NotificationClass.toast("提示内容");

//调用actionSheet
            var ButtonNameArray = ["只保存经度纬度", "保存经度纬度及地址"];
            NotificationClass.actionSheet(ButtonNameArray, function (Config)
            {
                var SelectValue = ButtonNameArray[Config.SelectedButtonIndex - 1];
                if (SelectValue == "保存经度纬度及地址")
                {
                }
            });

//返回的效果
PageTransitionClass.Back();

//切换到新页面的效果
PageTransitionClass.New();

//弹出窗口
var ToolBarHTML = "";
PopupDialogWindowClass.Show({}, "选择人员列表", "<div style='padding-bottom:300px;'><div style='height:900px;'>测试一下</div>ddddd</div>", ToolBarHTML, true);

//弹出窗口(未配置模板时默认内置浏览器)
    PopupDialogWindowClass.Show({}, "选择人员列表", "<div style='padding-bottom:300px;'><div style='height:900px;'>测试一下</div>ddddd</div>", "", true, function ()
    {
        if (IsInIframe())
        {
            MobileDeviceAPI.Webview.HidePopupNewWindowPageHeader();
        }
    }, function ()
    {
        if (IsInIframe())
        {
            MobileDeviceAPI.Webview.ShowPopupNewWindowPageHeader();
        }
    });

//弹出窗口显示右边的按钮
PopupDialogWindowClass.ShowPopupWindowRightButton("<div style='width:100px;'><span class=\"mui-badge mui-badge-primary mui-badge-green FloatLeft\" style=\"font-size:14px !important; line-height:18px;\">确定</span></div>", function ()
{
    //关闭
    PopupDialogWindowClass.Close();
});

//在主窗口中加载手机页面
LoadPageClass.LoadServerMobilePage(true, false, 'page.InstantMessenger.Chat', {});


//用新窗口加载手机页面 
LoadPageClass.LoadServerMobilePageInNewWindow("page.CRM.CustomerInfo.Load_AddNew_Page", "新建公海客户", true, { IsPublic: true, PageTitle: "新建公海客户" }, function () { });


//人员选择器
UserChooserClass.InitiateChooseUser(true, "", "", "", function (SelectedDataList)
{
    console.log(SelectedDataList);
});

//自定义选择器
UserCustomizedDataSelectorClass.InitiateSelector("cf436ad4-704e-4f98-9c8e-ba28b4bb1a68", "人员选择器", false, function (SelectedDataList)
{
    console.log(SelectedDataList);
}, "");

//定位
MobileDeviceAPI.Geolocation.GetCurrentPosition(function (latitude, longitude, altitude)
{
    alert("latitude=" + latitude);
    alert("longitude=" + longitude);
    alert("altitude=" + altitude);
});

//定位并显示到地图上
MapClass.GetLocation("MapDIV", function (latitude, longitude, address)
{
    alert(address);
});

//显示经度、纬度到地图上
MapClass.DisplayLocation("MapDIV", latitude, longitude, address);

//常用变量
<$MaxWidth$>

//检查权限 <CheckPermission>CRM.CustomizedWCFUI.ServiceFactory.CRM.CustomerActionHistoryClass.Load_AddNew_Page,CRM.CustomizedWCFUI.ServiceFactory.CRM.CustomerActionHistoryClass.Load_Edit_Page,CRM.CustomizedWCFUI.ServiceFactory.CRM.CustomerActionHistoryClass.DeleteEvent</CheckPermission>
//页面里面自动生成对象
CheckPermissionMenuCodeResultList

//发起流程
LoadInitiateWorkFlowPage(WorkFlowType, ExtraQuery);

//自定义CRM功能
LoadPageClass.LoadServerMobilePage(true, false, 'page.CRM.CRMUserCustomizedFunction.index', { MenuCode: '486fed24-b588-4974-a893-cd616455461a',CurrentTab:'报价',SearchDateColumnName:'报价日期',SearchDateColumnNameCN:'报价日期' });


//自定义统计功能(CRM相关的)
LoadPageClass.LoadServerMobilePage(true, false, 'page.UserCustomizedSummary.CRM', { MenuCode: '9aff9802-dcac-46a9-991f-bdea3bf07a04',CurrentTab:'投标',SearchDateColumnName:'InitiateDate',SearchDateColumnNameCN:'发起日期' });

//自定义功能
LoadPageClass.LoadServerMobilePage(true, false, 'page.UserCustomizedFunction.index', { MenuCode: "c1f67137-9c5f-4e3e-a975-331fdd90e5b3" });

            //扫一扫
            SystemBarCodeScan(function (Config)
            {
                alert(Config.Result);
            });


PageParameterObject.RequestQueryDictionary.hasOwnProperty("IsViewed") ? PageParameterObject.RequestQueryDictionary.IsViewed : "",
Element.SetHtml($(".mui-title"), PageParameterObject.RequestQueryDictionary.hasOwnProperty("PageTitle") ? PageParameterObject.RequestQueryDictionary.PageTitle : "公告通知");



        LoadServiceClass.LoadServiceInterfaceByDLLSetting("石兴凯.dll|标准项目插件.划卡管理|判断是否允许划卡", "判断是否允许划卡", false, "", "", { 消费编号: 消费编号, 子项目编号: document.getElementById("划卡管理_子项目编号").value }, function (返回值)
        {
            HideLoadingStatusDIV();
            document.getElementById("划卡管理_划卡金额").value = 返回值.Result;
            window.setTimeout(function ()
            {
                PageDynamicObject.提交前提醒();
            });
        }, Common_Error, { ActionName: "加载消费项目治疗档案" });






        #region 函数说明:手机端加载数据列表模板
        /// <summary>
        /// 手机端加载数据列表模板
        /// </summary>
        /// <returns></returns>
        public AjaxResultModel 手机端加载数据列表模板()
        {
            AjaxResultModel AjaxResultObject = new AjaxResultModel();
            string CommonParameterJSON = PublicFunctions.PublicFunctions.GetDataFromDictionary("CommonParameter", ServiceData.RequestFormDictionary);
            if (Check.IsNull(CommonParameterJSON))
            {
                AjaxResultObject.ErrorMsg = "必要参数缺失!";
            }
            else
            {
                string ErrorMsg;
                Dictionary<string, string> CommonParameter = Serializer.DeSerializeJSON<Dictionary<string, string>>(CommonParameterJSON, out ErrorMsg);
                if (CommonParameter == null)
                {
                    AjaxResultObject.ErrorMsg = "无效的参数对象!";
                }
                else
                {
                    string SQLTableName = "数据表名";
                    string FormKey = "CRM." + SQLTableName + ".1";

                    #region 代码块说明:将CommonParameter转化为RequestFormDictionary
                    foreach (var pair in CommonParameter)
                    {
                        ServiceData.RequestFormDictionary[pair.Key] = pair.Value;
                    }
                    #endregion

                    #region 代码块说明:生成SearchKeywordColumnList
                    string SearchKeyword = PublicFunctions.PublicFunctions.GetDataFromDictionary("SearchKeyword", ServiceData.RequestFormDictionary);
                    string SearchKeywordColumnList = PublicFunctions.PublicFunctions.GetDataFromDictionary("SearchKeywordColumnList", ServiceData.RequestFormDictionary);
                    if (!Check.IsNull(SearchKeyword) && Check.IsNull(SearchKeywordColumnList))
                    {
                        List<string> list = PublicFunctions.Form.FormEngine.GetAllowFuzzySearchColumnNameList(FormKey);
                        ServiceData.RequestFormDictionary["SearchKeywordColumnList"] = string.Join(",", list);
                    }
                    #endregion

                    DataGridDataModel DataGridDataObject = new DataGridDataModel();
                    string ExtraStrWhere = PublicFunctions.PublicFunctions.GetDataFromDictionary("ExtraStrWhere", ServiceData.RequestFormDictionary);

                    //获得客户端传递过来的查询对象,可以根据需要在初始化后对其进行修改
                    DataQueryModel DataQueryObject = new DataQueryModel(ServiceData.RequestFormDictionary, NeedTableName: false);
                    DataQueryObject.EqualQueryFieldList = PublicFunctions.Form.FormEngine.GetEqualQueryFieldList(FormKey);
                    if (DataQueryObject.OrderByDictionary.Count == 0)
                    {
                        //默认排序方式,用户没有点击字段排序的时候生效
                        DataQueryObject.OrderByDictionary["ID"] = "desc";
                    }

                    if (!Check.IsNull(ExtraStrWhere))
                    {
                        DataQueryObject.ExtraStrWhereList.Add(ExtraStrWhere);
                    }

                    List<string> SummaryColumnList = new List<string>() { };
                    DataTable ResultDataTable = new DataTable();
                    string ActionResultMsg = "";
                    int PageNo = DataQueryObject.PageNo, TotalResult = 0, TotalPage = 0;
                    //正式采用ADO.NET在数据库中分页查询
                    Dictionary<string, string> SqlDictionary;
                    Dictionary<string, string> CurrentPageSummaryDictionary;
                    Dictionary<string, string> AllPageSummaryDictionary;
                    if (PublicFunctions.DBHelper.RawDBHelper.CustomPage.GetCustomPageDataDebug(out SqlDictionary, out CurrentPageSummaryDictionary, out AllPageSummaryDictionary, PublicSetting.RawDBHelper_CRM_ConnectionStringKey, ref ResultDataTable, SQLTableName, ref PageNo, DataQueryObject.PageSize, ref TotalResult, ref TotalPage, "*", DataQueryObject.ToStrWhere(), DataQueryObject.ToOrderBy(), ref ActionResultMsg, SummaryColumnList: SummaryColumnList))
                    {
                        using (PublicFunctions.DBHelper.RawDBHelper.SqlDataFactory SystemFrameWorkContext = new PublicFunctions.DBHelper.RawDBHelper.SqlDataFactory(PublicSetting.RawDBHelper_ApplicationSetting_ConnectionStringKey))
                        {
                            using (PublicFunctions.DBHelper.RawDBHelper.SqlDataFactory context = new PublicFunctions.DBHelper.RawDBHelper.SqlDataFactory(PublicSetting.RawDBHelper_CRM_ConnectionStringKey))
                            {
                                //处理数据表的值
                                PublicFunctions.Form.FormEngine.RestoreFormDataByFormKey(FormKey, ref ResultDataTable, ShowDisplayCSSClassName: true, FillNullDisplayValue: false);

                                //应用PermissionProperty
                                PublicFunctions.Permission.PermissionPropertyClass.ApplyPermissionProperty(ServiceData.UserInfo, FormKey, ref ResultDataTable);

                                //定义用于DataGrid的数据源的数据表模型
                                DataGridDataObject.DataGridDataTable = new DataGridDataTableModel() { ResultDataTable = ResultDataTable, DataTableName = "", DataGridUniqueKeyColumnName = "ID", IsNeedRowCheckBox = true, PageNo = DataQueryObject.PageNo, PageSize = DataQueryObject.PageSize };
                                DataGridDataObject.TotalResult = TotalResult;
                                DataGridDataObject.CurrentPageSummaryDictionary = CurrentPageSummaryDictionary;
                                DataGridDataObject.AllPageSummaryDictionary = AllPageSummaryDictionary;
                            }
                        }
                    }
                    ResultDataTable.Dispose();
                    ResultDataTable = null;

                    AjaxResultObject.IsSuccess = true;
                    AjaxResultObject.Result = DataGridDataObject.ToString();
                    AjaxResultObject.Script = "";
                }
            }
            return AjaxResultObject;
        }
        #endregion


            //分享
            MobileDeviceAPI.Share.ShareContent("企管宝官网,这是一个好的系统地址", "http://www.qiguanbao.com");

//设置状态栏默认背景
MobileDeviceAPI.Navigator.SetDefaultBackground();

//设置状态栏蓝色背景
MobileDeviceAPI.Navigator.SetBlueBackground();

//恢复到之前的背景
MobileDeviceAPI.Navigator.RestoreBackground();

//弹出新的视图
MobileDeviceAPI.Webview.PopupNewWindowPage(title,url,function(WebViewID){});

//关闭弹出的视图窗口
MobileDeviceAPI.Webview.ClosePopupNewWindow();


                    //用父窗口显示选项
                    MobileDeviceAPI.DataPicker.Show([{ text: "选项1", value: "值1" }, { text: "选项2", value: "值2" }], "值1", function (item)
                    {
                        alert(item.text);
                        alert(item.value);
                    });

            //绑定日期控件
            MobileFormClassV5.InitiateDateControl($("#StartSearchDate"), { IsAccurateToMinute: false, MinValue: "", MaxValue: "", });

if (PageParameterObject.IsMobile)

MobileDeviceAPI.Device.dial("")
 
MobileIframeInnerPageV5.js:
/*-----------通用函数列表(Begin)-----------*/
function ShowLoadingStatusDIV(Title, LoadingMsg)
{
    if (IsInIframe())
    {
        WindowMessageClass.PostMessage("ShowLoadingStatusDIVNew", { Title: Title, LoadingMsg: LoadingMsg });
    }
}

function HideLoadingStatusDIV()
{
    if (IsInIframe())
    {
        WindowMessageClass.PostMessage("HideLoadingStatusDIV", {});
    }
}

//通用的执行成功函数
function Common_Success(AjaxResultObject)
{
    try
    {
        HideLoadingStatusDIV();
        var ActionName = AjaxResultObject.hasOwnProperty("ActionName") ? AjaxResultObject.ActionName : "";
        NotificationClass.toast(ActionName + "成功!");
    }
    catch (e)
    { }
}

//通用的执行失败函数
function Common_Error(AjaxResultObject)
{
    HideLoadingStatusDIV();
    var ActionName = AjaxResultObject.hasOwnProperty("ActionName") ? AjaxResultObject.ActionName : "";
    NotificationClass.alert(ActionName, ActionName + "失败,原因:" + RegexClass.RemoveHTMLTag(AjaxResultObject.ErrorMsg), "确定");
}

//重写PopupAlertWindow
function PopupAlertWindow(title, content, width, height, Closable)
{
    NotificationClass.alert(title, content, "确定");
}

//获得正在加载的消息
function GetLoadingMsg(msg)
{
    return "<span style='color:#888; font-size:13px;'>" + LoaderImg + msg + "</span>";
}

//加载服务端函数
function LoadServerService(MethodName, NeedUpdateShowMsgDIVID, ShowMsgDIVID, LoadingMsg, AjaxPostDataObject, SuccessCallBack, ErrorCallBack, CallBackObject, DLLFileName, ClassName, IsCRMSystemDLL, IsCRMSystemLogic, RequestQueryObject)
{
    if (typeof (DLLFileName) == "undefined")
    {
        DLLFileName = "";
    }

    if (typeof (ClassName) == "undefined")
    {
        ClassName = "";
    }

    var obj = (ExtraAjaxPostDataObject != null ? Object.merge(AjaxPostDataObject, ExtraAjaxPostDataObject) : AjaxPostDataObject);
    var ExtraQueryString = "";
    if (typeof (IsCRMSystemDLL) == "undefined")
    {
        IsCRMSystemDLL = false;
    }
    if (typeof (IsCRMSystemLogic) == "undefined")
    {
        IsCRMSystemLogic = false;
    }
    ExtraQueryString += "&Token=" + UserInfo.Token + "&IsCRMSystemDLL=" + IsCRMSystemDLL + "&IsCRMSystemLogic=" + IsCRMSystemLogic;

    if (typeof (RequestQueryObject) != "undefined" && RequestQueryObject != null)
    {
        for (var key in RequestQueryObject)
        {
            ExtraQueryString += "&" + key + "=" + encodeURIComponent(RequestQueryObject[key]);
        }
    }
    var ActionURL = "Mobile/MobileAPI.aspx?MethodName=" + MethodName + (DLLFileName.length > 0 ? ("&DLLFileName=" + encodeURIComponent(DLLFileName)) : "") + (ClassName.length > 0 ? ("&ClassName=" + encodeURIComponent(ClassName)) : "") + ExtraQueryString;
    AjaxLoader(NeedUpdateShowMsgDIVID, ActionURL, ShowMsgDIVID, LoadingMsg, obj, SuccessCallBack, ErrorCallBack, CallBackObject);
}

function IsSwitchChecked(SwitchID)
{
    return Element.HasClass(jQuery("#" + SwitchID), "mui-active");
}

function InitiateCommonTab(ContainerID, InitiateFocusTab, ToogleTabCallBack, AllContainerDIVID)
{
    $("#" + ContainerID + " div").foreach(function (tab, index)
    {
        BlindEvent($(tab),
            {
                "tap": function ()
                {
                    var title = Element.GetAttribute($(tab), "title");
                    if (typeof (AllContainerDIVID) == "undefined")
                    {
                        OpenOrHideElementByCssName("hide", "CommonTabMainContentDIV");
                    }
                    else
                    {
                        OpenOrHideElementByElement("hide", $("#" + AllContainerDIVID + " .CommonTabMainContentDIV"));
                    }
                    OpenOrHideElement("open", title + "DIV");

                    Element.RemoveClass($("#" + ContainerID + " div"), "Focus");
                    Element.AddClass($(tab), "Focus");
                    if (typeof (ToogleTabCallBack) != "undefined")
                    {
                        ToogleTabCallBack.call(this, title);
                    }
                }
            });

        if (InitiateFocusTab.length > 0 && InitiateFocusTab == Element.GetAttribute($(tab), "title"))
        {
            $(tab).fireEvent("tap");
        }
    });
};

function AutoFocusField(ObjectID)
{
    return;
    try
    {
        //自动获得焦点
        WindowMessageClass.PostMessage("OpenSoftKeyBoard", {});
        document.getElementById(ObjectID).focus();
    }
    catch (e)
    {
        alert(e.toString());
    }
}

//扫一扫
var SystemBarCodeScanSuccessCallBack = null;
function SystemBarCodeScan(SuccessCallBack)
{
    SystemBarCodeScanSuccessCallBack = SuccessCallBack;
    LoadPageClass.GetServerMobilePage("page.Public.BarCodeScan", {}, function (url)
    {
        MobileDeviceAPI.Webview.BarCodeScan();
    });
}

DomReady(function ()
{
    WindowMessageClass.PostMessage("LoadPageClass.LoadPageComplete", {});
});
/*-----------通用函数列表(End)-----------*/

/*-----------用户信息管理(Begin)-----------*/
var UserInfoClass =
    {
        GetUserPermissionMenuCodeList: function (SuccessCallBack)
        {
            WindowMessageClass.PostMessage("UserInfoClass.GetUserPermissionMenuCodeList", {}, function (UserPermissionMenuCodeList)
            {
                SuccessCallBack.call(this, UserPermissionMenuCodeList);
            });
        }
    };
/*-----------用户信息管理(End)-----------*/

/*-----------提醒消息管理类(Begin)-----------*/
var NotificationClass =
    {
        alert: function (title, message, buttonName)
        {
            if (IsInIframe())
            {
                WindowMessageClass.PostMessage("NotificationClass.alert", { message: message, title: title, buttonName: buttonName });
            }
            else
            {
                alert(message);
            }
        },
        confirmCallback: null,
        confirm: function (title, message, confirmCallback)
        {
            if (IsInIframe())
            {
                NotificationClass.confirmCallback = confirmCallback;
                WindowMessageClass.PostMessage("NotificationClass.confirm", { message: message, title: title });
            }
            else
            {
                if (confirm(message))
                {
                    confirmCallback();
                }
            }
        },
        beep: function (times)
        {
            WindowMessageClass.PostMessage("NotificationClass.beep", { times: times });
        },
        toast: function (message)
        {
            if (IsInIframe())
            {
                WindowMessageClass.PostMessage("NotificationClass.toast", { message: message });
            }
            else
            {
                alert(message);
            }
        },
        actionsheetCallback: null,
        actionSheet: function (ButtonTitleList, actionsheetCallback)
        {
            NotificationClass.actionsheetCallback = actionsheetCallback;
            WindowMessageClass.PostMessage("NotificationClass.actionSheet", { ButtonTitleList: ButtonTitleList });
        }
    };
/*-----------提醒消息管理类(End)-----------*/

/*-----------页面切换效果管理类(Begin)-----------*/
var PageTransitionClass =
    {
        New: function ()
        {
            WindowMessageClass.PostMessage("PageTransitionClass.New", {});
        },
        Back: function ()
        {
            WindowMessageClass.PostMessage("PageTransitionClass.Back", {});
        }
    };
/*-----------页面切换效果管理类(End)-----------*/

/*-----------弹出层管理类(Begin)-----------*/
var PopupDialogWindowClass =
{
    Config:
        {
            opacity: 0,
            width: "100%",
            height: "100%"
        },
    ScrollTop: function (TopDistance)
    {
        $("#PopupWindowMainContentOutterDIV").scrollTop(TopDistance);
    },
    InitiatePopupWindow: function ()
    {
        var html = "";
        html += "<div id=\"PopupWindowDIV\" style=\"display: none;\">";
        html += "<div id=\"PopupWindowOverlayDIV\" style=\"z-index: 120000; opacity: 0.8; background-color: #000; width: 100%; height: 100%; position: fixed; top: 0px; left: 0px; overflow: hidden;\"></div>";
        html += "<div id=\"PopupWindowContainerDIV\" style=\"z-index: 130000; width: 90%; height: 40%; position: fixed; top: 30%; left: 5%; border-radius: 0px; background-color: #fff; overflow: hidden;\">";
        html += "<div class=\"Relative\" style=\"height: 100%; width: 100%; overflow: hidden;\">";

        //标题
        html += "<div id=\"PopupWindowCloseButtonDIV\" class=\"Absolute\" style=\"top: 16px; left: 8px; color: #000; display: none; font-weight:bold !important; line-height:50px; width:50px;\"><span class=\"mui-icon mui-icon-left-nav mui-pull-left\"></span></div>";
        html += "<div id=\"PopupWindowTitleDIV\" style=\"font-size: 18px; padding: 10px; border-bottom: 0px solid #fff; color: #333; font-weight: bold; display: none;   background-color: transparent; text-align:center; padding-top:16px; height:50px; \"><div id=\"PopupWindowTitleInnerDIV\"></div></div>";
        html += "<div id=\"PopupWindowRightButtonDIV\" class=\"Absolute Hidden\" style=\"top: 16px; right: 20px; color: #000; font-weight:bold !important; line-height:50px; width:50px;\"><span class=\"mui-icon mui-pull-right\"></span></div>";

        //底部工具栏
        html += "<div id=\"PopupWindowBottomDIV\" style=\"padding: 10px; border-top: 1px solid #eaeaea; font-weight: normal;  background-color: #fff; position:absolute; bottom:0px; left:0px; width:100%; display:none; z-index: 150000; box-shadow: 0 .1rem .25rem rgba(0, 0, 0, .05) !important; -webkit-box-shadow: 0 .1rem .25rem rgba(0, 0, 0, .05) !important; -moz-box-shadow: 0 .1rem .25rem rgba(0, 0, 0, .05) !important; -ms-box-shadow: 0 .1rem .25rem rgba(0, 0, 0, .05) !important;\"></div>";

        //内容
        html += "<div style=\"overflow: auto; width: 100%; height: 100%;\" id=\"PopupWindowMainContentOutterDIV\">";
        html += "<div id=\"PopupWindowMainContentDIV\" style=\"padding: 0px; padding-top:8px;padding-bottom:150px;\"></div>";
        html += "</div>";

        html += "</div>";
        html += "</div>";
        html += "</div>";
        Element.AppendByElement(jQuery(document.body), html);

        //绑定关闭按钮事件
        BlindEvent(jQuery("#PopupWindowCloseButtonDIV"),
            {
                "click": function ()
                {
                    PopupDialogWindowClass.Close()
                }
            });
    },
    UpdateTitle: function (title)
    {
        Element.SetHtml($("#PopupWindowTitleInnerDIV"), title);
    },
    UpdateContent: function (content)
    {
        Element.SetHtml($("#PopupWindowMainContentDIV"), content);
    },
    ShowPopupWindowRightButton: function (html, ClickCallBack)
    {
        var RightButton = $("#PopupWindowRightButtonDIV");
        Element.SetHtml(RightButton, html);
        Element.RemoveClass(RightButton, "Hidden");
        UnBlindEvent(RightButton, "click");
        BlindEvent(RightButton,
            {
                "click": ClickCallBack
            });
    },
    IsHorizontalTransition: false,
    Show: function (ExtraConfig, Title, Content, ToolBarHTML, AllowClose, SuccessCallBack, CloseCallBack, IsHorizontalTransition)
    {
        //设置为默认背景色
        MobileDeviceAPI.Navigator.SetDefaultBackground();

        try
        {
            window.scrollTo(0, 0);
            WindowMessageClass.PostMessage("(function(){ window.scrollTo(0, 0); })", {});
        }
        catch (e)
        { }

        PopupDialogWindowClass.CloseCallBack = CloseCallBack;
        if (typeof (IsHorizontalTransition) != "undefined")
        {
            PopupDialogWindowClass.IsHorizontalTransition = IsHorizontalTransition;
        }

        try
        {
            //先禁止主视图滚动
            mui('.mui-scroll-wrapper').scroll({ bounce: false, indicators: false });
        }
        catch (e)
        { }

        //先关闭弹层
        PopupDialogWindowClass.CloseCore(false);

        //为body应用OverFlowHidden
        Element.AddClass(jQuery(document.body), "OverFlowHidden");

        //应用配置
        var Config = PopupDialogWindowClass.Config;
        for (var Key in ExtraConfig)
        {
            Config[Key] = ExtraConfig[Key];
        }

        Element.SetStyle(jQuery("#PopupWindowOverlayDIV"), "opacity", Config.opacity);
        Element.SetStyle(jQuery("#PopupWindowContainerDIV"), "width", Config.width);
        Element.SetStyle(jQuery("#PopupWindowContainerDIV"), "height", Config.height);
        Element.SetStyle(jQuery("#PopupWindowContainerDIV"), "top", ((100 - parseInt(Config.height.replace("%", ""))) / 2) + "%");
        Element.SetStyle(jQuery("#PopupWindowContainerDIV"), "left", ((100 - parseInt(Config.width.replace("%", ""))) / 2) + "%");

        //设置标题
        if (Title.length > 0)
        {
            document.getElementById("PopupWindowTitleInnerDIV").innerHTML = Title;
            OpenOrHideElement("open", "PopupWindowTitleDIV");
        }
        else
        {
            OpenOrHideElement("hide", "PopupWindowTitleDIV");
        }

        //设置工具栏内容
        if (ToolBarHTML.length > 0)
        {
            document.getElementById("PopupWindowBottomDIV").innerHTML = ToolBarHTML;
            OpenOrHideElement("open", "PopupWindowBottomDIV");
        }
        else
        {
            OpenOrHideElement("hide", "PopupWindowBottomDIV");
        }

        //设置内容
        document.getElementById("PopupWindowMainContentDIV").innerHTML = Content;

        //显示PopupWindowDIV
        OpenOrHideElement("open", "PopupWindowDIV");

        //判断是否允许关闭
        if (AllowClose)
        {
            OpenOrHideElement("open", "PopupWindowCloseButtonDIV");
        }
        else
        {
            OpenOrHideElement("hide", "PopupWindowCloseButtonDIV");
        }

        //回调
        if (typeof (SuccessCallBack) != "undefined" && SuccessCallBack != null)
        {
            SuccessCallBack.call(this);
        }

        if (PopupDialogWindowClass.IsHorizontalTransition)
        {
            //动画从左到右滑动
            Element.SetStyle(jQuery("#PopupWindowContainerDIV"), "transform", "translate(100%)");
            //Element.SetStyle(jQuery("#PopupWindowContainerDIV"), "transform", "translate(-100%, 0px)");
            $('#PopupWindowContainerDIV').transition({ x: '0px' }, 250);
        }
        else
        {
            //动画从下到上滑动
            Element.SetStyle(jQuery("#PopupWindowContainerDIV"), "transform", "translate(0px, 100%)");
            $('#PopupWindowContainerDIV').transition({ y: '0px' });
        }

        try
        {
            //隐藏父窗口的头部
            HidePageHeader();
        }
        catch (e)
        { }
    },
    CloseCallBack: null,
    Close: function ()
    {
        //隐藏顶部工具栏右侧的按钮
        Element.AddClass($("#PopupWindowRightButtonDIV"), "Hidden");

        if (typeof (PopupDialogWindowClass.CloseCallBack) != "undefined" && PopupDialogWindowClass.CloseCallBack != null)
        {
            PopupDialogWindowClass.CloseCallBack();
        }

        if (PopupDialogWindowClass.IsHorizontalTransition)
        {
            //动画从左到右滑动
            //$('#PopupWindowContainerDIV').transition({ x: '-100%' }, 250, "out", function ()
            //{
            //    PopupDialogWindowClass.CloseCore();
            //});
            $('#PopupWindowContainerDIV').transition({ x: '100%' }, 250, "out", function ()
            {
                PopupDialogWindowClass.CloseCore();
            });
        }
        else
        {
            //动画从下到上滑动
            $('#PopupWindowContainerDIV').transition({ y: '100%' }, 350, "out", function ()
            {
                PopupDialogWindowClass.CloseCore();
            });
        }
    },
    CloseCore: function (ChangeBackgroundColor)
    {
        if (typeof (ChangeBackgroundColor) == "undefined" || ChangeBackgroundColor)
        {
            //恢复到之前的背景
            MobileDeviceAPI.Navigator.RestoreBackground();
        }

        //去除BODY上面的样式
        Element.RemoveClass(jQuery(document.body), "OverFlowHidden");

        //隐藏
        OpenOrHideElement("hide", "PopupWindowDIV");

        //隐藏标题
        OpenOrHideElement("hide", "PopupWindowTitleDIV");
        document.getElementById("PopupWindowTitleInnerDIV").innerHTML = "";

        //隐藏关闭按钮
        OpenOrHideElement("hide", "PopupWindowCloseButtonDIV");

        //去除内容
        document.getElementById("PopupWindowMainContentDIV").innerHTML = "";

        try
        {
            //允许主视图滚动
            mui('.mui-scroll-wrapper').scroll({ bounce: true, indicators: true });
        }
        catch (e)
        { }

        try
        {
            //显示父窗口的头部
            OpenPageHeader();
        }
        catch (e)
        { }
    },
    FixedDisplayContent: function ()
    {
        //删除所有图片的height属性
        $("img", $("#PopupWindowMainContentDIV")).foreach(function (img, index)
        {
            Element.RemoveAttribute($(img), "height");
        });

        //删除table的height属性
        $("table", $("#PopupWindowMainContentDIV")).foreach(function (table, index)
        {
            Element.RemoveAttribute($(table), "height");
        });

        //重写A标签的事件,用原生的浏览器来打开
        BlindEvent($("a", $("#PopupWindowMainContentDIV")),
            {
                "click": function (event)
                {
                    element = $(event.currentTarget);
                    var href = Element.GetAttribute(element, "href");
                    var url = PageParameterObject.SystemFrameWorkBaseURL + "/RedirectPage.aspx?url=" + encodeURIComponent(href) + "&Version=" + Math.random();
                    //MobileDeviceAPI.Webview.OpenSystemBrowser(url);
                    MobileDeviceAPI.Webview.OpenInnerBrowser("查看详情", false, url);
                    event.preventDefault();
                }
            });
    }
};
/*-----------弹出层管理类(End)-----------*/

/*-----------页面切换管理类(Begin)-----------*/
var LoadPageClass =
    {
        LoadServerMobilePage: function (EnablePageTransition, IsNewPageTransition, PageName, RequestQueryDictionary)
        {
            AbortAllAjaxRequest();
            if (EnablePageTransition)
            {
                if (IsNewPageTransition)
                {
                    PageTransitionClass.New();
                }
                else
                {
                    PageTransitionClass.Back();
                }
            }

            WindowMessageClass.PostMessage("LoadPageClass.LoadServerMobilePage", { PageName: PageName, RequestQueryDictionary: RequestQueryDictionary });
        },
        GetServerMobilePage: function (PageName, RequestQueryDictionary, SuccessCallBack)
        {
            WindowMessageClass.PostMessage("LoadPageClass.GetServerMobilePage", { PageName: PageName, RequestQueryDictionary: RequestQueryDictionary }, function (url)
            {
                SuccessCallBack.call(this, url);
            });
        },
        LoadServerMobilePageInNewWindow: function (PageName,PageTitle,HideHeader, RequestQueryDictionary, SuccessCallBack)
        {
            LoadPageClass.GetServerMobilePage(PageName, RequestQueryDictionary, function (url)
            {
                MobileDeviceAPI.Webview.PopupNewWindowPage(PageTitle, url, function (WebViewID) { }, HideHeader);
            });
        },
        LoadServerMobileDLLPage: function (EnablePageTransition, IsNewPageTransition, DLLSetting, RequestQueryDictionary)
        {
            AbortAllAjaxRequest();
            if (EnablePageTransition)
            {
                if (IsNewPageTransition)
                {
                    PageTransitionClass.New();
                }
                else
                {
                    PageTransitionClass.Back();
                }
            }

            WindowMessageClass.PostMessage("LoadPageClass.LoadServerMobileDLLPage", { DLLSetting: DLLSetting, RequestQueryDictionary: RequestQueryDictionary });
        },
        GetServerMobileDLLPage: function (DLLSetting, RequestQueryDictionary, SuccessCallBack)
        {
            WindowMessageClass.PostMessage("LoadPageClass.GetServerMobileDLLPage", { DLLSetting: DLLSetting, RequestQueryDictionary: RequestQueryDictionary }, function (url)
            {
                SuccessCallBack.call(this, url);
            });
        },
        GetServerPage: function (ServiceURL, SuccessCallBack)
        {
            WindowMessageClass.PostMessage("LoadPageClass.GetServerPage", { ServiceURL: ServiceURL }, function (url)
            {
                SuccessCallBack.call(this, url);
            });
        },
        Back: function ()
        {
            try
            {
                AbortAllAjaxRequest();
                WindowMessageClass.PostMessage("LoadPageClass.Back", {});
            }
            catch (e)
            {
                alert(e.toString());
            }
        }
    };
/*-----------页面切换管理类(End)-----------*/

/*-----------手机原生API控制类(Begin)-----------*/
var MobileDeviceAPI =
    {
        GetOSName: function (SuccessCallBack)
        {
            WindowMessageClass.PostMessage("(function(){ return plus.os.name; })", {}, SuccessCallBack);
        },
        Navigator:
            {
                DefaultBackground: "#fff",
                CurrentBackground: "#fff",
                SetDefaultBackground: function ()
                {
                    try
                    {
                        if (IsInIframe())
                        {
                            WindowMessageClass.PostMessage("(function(){ plus.navigator.setStatusBarBackground('" + MobileDeviceAPI.Navigator.DefaultBackground + "'); })", {});
                        }
                    }
                    catch (e)
                    { }
                },
                SetGreyBackground: function ()
                {
                    try
                    {
                        if (IsInIframe())
                        {
                            MobileDeviceAPI.Navigator.CurrentBackground = "#fff";
                            WindowMessageClass.PostMessage("(function(){ plus.navigator.setStatusBarBackground('" + MobileDeviceAPI.Navigator.CurrentBackground + "'); })", {});
                        }
                    }
                    catch (e)
                    { }
                },
                SetBlueBackground: function ()
                {
                    try
                    {
                        if (IsInIframe())
                        {
                            MobileDeviceAPI.Navigator.CurrentBackground = "#11B7F3";
                            WindowMessageClass.PostMessage("(function(){ plus.navigator.setStatusBarBackground('" + MobileDeviceAPI.Navigator.CurrentBackground + "'); })", {});
                        }
                    }
                    catch (e)
                    { }
                },
                RestoreBackground: function ()
                {
                    try
                    {
                        if (IsInIframe())
                        {
                            WindowMessageClass.PostMessage("(function(){ plus.navigator.setStatusBarBackground('" + MobileDeviceAPI.Navigator.CurrentBackground + "'); })", {});
                        }
                    }
                    catch (e)
                    { }
                },
            },
        //设备管理类
        Device:
            {
                dial: function (number)
                {
                    NotificationClass.toast("正在拨打中...");
                    window.setTimeout(function ()
                    {
                        WindowMessageClass.PostMessage("MobileDeviceAPI.Device.dial", { number: number });
                    }, 100);
                },
                sms: function (number, content)
                {
                    var dic = { number: number };
                    if (typeof (content) != "undefined")
                    {
                        dic.content = content;
                    }
                    WindowMessageClass.PostMessage("MobileDeviceAPI.Device.sms", dic);
                },
                GetOSName: function (SuccessCallBack)
                {
                    WindowMessageClass.PostMessage("(function(){ return plus.os.name; })", {}, SuccessCallBack);
                },
                GetScreenHeight: function (SuccessCallBack)
                {
                    WindowMessageClass.PostMessage("(function(){ return plus.screen.resolutionHeight; })", {}, SuccessCallBack);
                }
            },
        //摄像头管理类
        Camera:
            {
                //IsAllowCaptureImage:是否允许实时拍照
                //IsAllowGetGalleryImage:是否允许选报相册
                //SuccessCallBack:成功后的回调
                //IsAllowVideo:是否允许录像
                //IsAllowVoice:是否允许录音
                SuccessCallBack: null,
                Initiate: function (IsAllowCaptureImage, IsAllowGetGalleryImage, SuccessCallBack, IsAllowVideo, IsAllowVoice)
                {
                    MobileDeviceAPI.Camera.SuccessCallBack = SuccessCallBack;
                    var ButtonList = [];
                    if (IsAllowCaptureImage)
                    {
                        Array.include(ButtonList, "实时拍照");
                    }

                    if (IsAllowGetGalleryImage)
                    {
                        Array.include(ButtonList, "选取相册");
                    }

                    Array.include(ButtonList, "实时录像");
                    if (typeof (IsAllowVideo) != "undefined" && IsAllowVideo)
                    {
                    }

                    //Array.include(ButtonList, "实时录音");
                    if (typeof (IsAllowVoice) != "undefined" && IsAllowVoice)
                    {
                    }

                    NotificationClass.actionSheet(ButtonList, function (Config)
                    {
                        var ButtonName = ButtonList[Config.SelectedButtonIndex - 1];
                        if (ButtonName == "实时拍照")
                        {
                            WindowMessageClass.PostMessage("MobileDeviceAPI.Camera.CaptureImage", {});
                        }
                        else if (ButtonName == "选取相册")
                        {
                            WindowMessageClass.PostMessage("MobileDeviceAPI.Camera.GetGalleryImage", {});
                        }
                        else if (ButtonName == "实时录像")
                        {
                            WindowMessageClass.PostMessage("MobileDeviceAPI.Camera.CaptureVideo", {});
                        }
                        else if (ButtonName == "实时录音")
                        {
                            var PlayButtonHTML = "<div id='UserStartRecordDIV'><span class=\"iconfont icon-play\" style=\"font-size: 50px; color: #1AAD19;\"></span><div style='font-size:14px; margin-top:5px;'>开始录音</div></div>";
                            var StopButtonHTML = "<div id='UserStopRecordDIV' class='Hidden'><span class=\"iconfont icon-pause\" style=\"font-size: 20px; color: #dd524d; padding: 12px; border: 3px solid #dd524d; border-radius: 40px; font-weight:bold;\"></span><div style='font-size:14px; margin-top:5px;'>停止录音</div></div>";

                            var html = "";
                            html += "<div id=\"second_watch\" style='text-align:center; margin-bottom:10px;'>00:00:00</div>";
                            html += "<div class='Center'>" + PlayButtonHTML + "</div>";
                            html += "<div class='Center'>" + StopButtonHTML + "</div>";
                            html += "<div style='padding:5px 10px; margin-top:30px; text-align:center; font-size:13px;'><a href=\"javascript:void(0)\" id='UserCanelRecordDIV'>取消录音</a></div> ";
                            Element.SetHtml($("#RecordVideoDIV"), html);

                            //开始录音按钮
                            BlindEvent($("#UserStartRecordDIV"),
                                {
                                    "tap": function ()
                                    {
                                        Element.SetHtml($("#second_watch"), "00:00:00");
                                        time_start();
                                        Element.AddClass($("#UserStartRecordDIV"), "Hidden");
                                        Element.RemoveClass($("#UserStopRecordDIV"), "Hidden");
                                        MobileDeviceAPI.Audio.Record(function (path)
                                        {
                                            if (MobileDeviceAPI.Audio.UserRecordSuccess)
                                            {
                                                MobileDeviceAPI.Camera.SuccessCallBack.call(this, path);
                                            }
                                            Element.SetHtml($('#RecordVideoDIV'), "");
                                        });

                                        MobileDeviceAPI.Audio.UserRecordTimer = window.setTimeout(function ()
                                        {
                                            Element.SetHtml($('#RecordVideoDIV'), "");
                                            MobileDeviceAPI.Audio.UserRecordSuccess = false;
                                            MobileDeviceAPI.Audio.Stop();
                                        }, 60000);
                                    }
                                });

                            //停止录音按钮
                            BlindEvent($("#UserStopRecordDIV"),
                                {
                                    "tap": function ()
                                    {
                                        time_reset();
                                        Element.RemoveClass($("#UserStartRecordDIV"), "Hidden");
                                        Element.AddClass($("#UserStopRecordDIV"), "Hidden");
                                        MobileDeviceAPI.Audio.UserRecordSuccess = true;
                                        MobileDeviceAPI.Audio.Stop();
                                        window.clearTimeout(MobileDeviceAPI.Audio.UserRecordTimer);
                                    }
                                });

                            //取消录音按钮
                            BlindEvent($("#UserCanelRecordDIV"),
                                {
                                    "tap": function ()
                                    {
                                        time_reset();
                                        Element.SetHtml($('#RecordVideoDIV'), "");
                                        MobileDeviceAPI.Audio.UserRecordSuccess = false;
                                        MobileDeviceAPI.Audio.Stop();
                                        window.clearTimeout(MobileDeviceAPI.Audio.UserRecordTimer);
                                    }
                                });

                            $("#UserStartRecordDIV").fireEvent("tap");
                        }
                    });
                },
                GetImageSuccessCallBack: function (Config)
                {
                    MobileDeviceAPI.Camera.SuccessCallBack.call(this, Config.path);
                },
                GetVideoSuccessCallBack: function (Config)
                {
                    MobileDeviceAPI.Camera.SuccessCallBack.call(this, Config.path);
                }
            },
        //文件上传管理类
        Uploader:
            {
                //FilePath:文件路径
                //ReturnBase64:是否返回BASE64编码
                //SuccessCallBack:成功后的回调
                SuccessCallBack: null,
                ErrorCallBack: null,
                UploadFile: function (FilePath, ReturnBase64, SuccessCallBack, ErrorCallBack)
                {
                    MobileDeviceAPI.Uploader.SuccessCallBack = SuccessCallBack;
                    MobileDeviceAPI.Uploader.ErrorCallBack = ErrorCallBack;
                    WindowMessageClass.PostMessage("MobileDeviceAPI.Uploader.UploadFile", { FilePath: FilePath, ReturnBase64: ReturnBase64 });
                },
                UploadFileSuccessCallBack: function (Config)
                {
                    MobileDeviceAPI.Uploader.SuccessCallBack.call(this, Config);
                },
                UploadFileErrorCallBack: function (Config)
                {
                    MobileDeviceAPI.Uploader.ErrorCallBack.call(this, Config.ErrorMsg);
                }
            },
        //窗口管理类
        Webview:
            {
                Create: function (ViewID, url, styles, extras, PageTitle, HideHeader)
                {
                    if (typeof (HideHeader) == "undefined")
                    {
                        HideHeader = false;
                    }

                    WindowMessageClass.PostMessage("MobileDeviceAPI.Webview.Create", { ViewID: ViewID, url: url, styles: styles, extras: extras, PageTitle: PageTitle, HideHeader: HideHeader, OpenAsOrigin: true });
                },
                CreateNew: function (ViewID, url, styles, extras, PageTitle, HideHeader)
                {
                    if (typeof (HideHeader) == "undefined")
                    {
                        HideHeader = false;
                    }

                    WindowMessageClass.PostMessage("MobileDeviceAPI.Webview.Create", { ViewID: ViewID, url: url, styles: styles, extras: extras, PageTitle: PageTitle, OpenAsOrigin: true, HideHeader: HideHeader });
                },
                Close: function (ViewID)
                {
                    WindowMessageClass.PostMessage("MobileDeviceAPI.Webview.Close", { ViewID: ViewID });
                },
                CloseAll: function ()
                {
                    WindowMessageClass.PostMessage("MobileDeviceAPI.Webview.CloseAll", {});
                },
                OpenSystemBrowser: function (url)
                {
                    //WindowMessageClass.PostMessage("(function(){  plus.runtime.openURL( '" + url + "', function(e){  plus.nativeUI.toast('打开地址失败,原因:'+e.message);   } );   })", {});
                    //return;
                    WindowMessageClass.PostMessage("MobileDeviceAPI.Webview.OpenSystemBrowser", { url: url });
                },
                OpenInnerBrowser: function (PageTitle, HideHeader, url)
                {
                    WindowMessageClass.PostMessage("(function(){  plus.runtime.openURL( '" + url + "', function(e){  plus.nativeUI.toast('打开地址失败,原因:'+e.message);   } );   })", {});
                    return;
                    MobileDeviceAPI.GetOSName(function (os)
                    {
                        if (os.toLocaleLowerCase() == "android")
                        {
                            MobileDeviceAPI.Webview.Create(NewGuid(), url, null, null, PageTitle, HideHeader);
                        }
                        else
                        {
                            LoadPageClass.GetServerMobilePage("OpenInnerBrowser", { PageTitle: PageTitle, HideHeader: HideHeader, url: url }, function (url)
                            {
                                MobileDeviceAPI.Webview.Create(NewGuid(), url, null, null, PageTitle, true);
                            });
                        }
                    });
                },
                PopupNewWindowPage: function (title, url, SuccessCallBack, HideHeader)
                {
                    if (typeof (HideHeader) == "undefined")
                    {
                        HideHeader = false;
                    }
                    WindowMessageClass.PostMessage("MobileDeviceAPI.Webview.PopupNewWindowPage", { title: title, url: url, HideHeader: HideHeader }, SuccessCallBack);
                },
                HidePopupNewWindowPageHeader: function ()
                {
                    WindowMessageClass.PostMessage("(function(){ Element.SetStyle($('.PageHeaderArea'),'display','none'); })", {}, null);
                },
                ShowPopupNewWindowPageHeader: function ()
                {
                    WindowMessageClass.PostMessage("(function(){ Element.SetStyle($('.PageHeaderArea'),'display','inherit'); })", {}, null);
                },
                DisablePopupNewWindowZoom: function ()
                {
                    //禁止弹出的新webview放大缩小
                    WindowMessageClass.PostMessage("(function(){ $('head meta[name=viewport]').remove();$('head').prepend('<meta name=\"viewport\" content=\"width=device-width, height=device-height, user-scalable=0\" />'); })", {}, null);
                },
                ClosePopupNewWindow: function ()
                {
                    WindowMessageClass.PostMessage("AppFrameWork.Webview.CloseWindow", {}, null);
                },
                BarCodeScan: function ()
                {
                    WindowMessageClass.PostMessage("MobileDeviceAPI.Webview.BarCodeScan", {}, null);
                }
            },
        Speech:
        {
            SuccessCallBack: null,
            StartRecognize: function (SuccessCallBack)
            {
                MobileDeviceAPI.Speech.SuccessCallBack = SuccessCallBack;
                WindowMessageClass.PostMessage("MobileDeviceAPI.Speech.StartRecognize", {});
            }
        },
        Geolocation:
        {
            SuccessCallBack: null,
            GetCurrentPosition: function (SuccessCallBack)
            {
                MobileDeviceAPI.Geolocation.SuccessCallBack = SuccessCallBack;
                WindowMessageClass.PostMessage("MobileDeviceAPI.Geolocation.GetCurrentPosition", {});
            },
            GetCurrentPositionSuccessCallBack: function (Config)
            {
                MobileDeviceAPI.Geolocation.SuccessCallBack(Config.latitude, Config.longitude, Config.altitude);
            }
        },
        Audio:
        {
            SuccessCallBack: null,
            SuccessCallBackPlay: null,
            ErrorCallBackPlay: null,
            Record: function (SuccessCallBack)
            {
                MobileDeviceAPI.Audio.SuccessCallBack = SuccessCallBack;
                WindowMessageClass.PostMessage("MobileDeviceAPI.Audio.Record", {});
            },
            RecordSuccessCallBack: function (Config)
            {
                MobileDeviceAPI.Audio.SuccessCallBack(Config.path);
            },
            Stop: function ()
            {
                WindowMessageClass.PostMessage("AppFrameWork.Audio.Stop", {});
            },
            Play: function (AudioURL, SuccessCallBack, ErrorCallBack)
            {
                MobileDeviceAPI.Audio.SuccessCallBackPlay = SuccessCallBack;
                MobileDeviceAPI.Audio.ErrorCallBackPlay = ErrorCallBack;
                WindowMessageClass.PostMessage("MobileDeviceAPI.Audio.Play", { AudioURL: AudioURL });
            },
            PlaySuccessCallBack: function ()
            {
                MobileDeviceAPI.Audio.SuccessCallBackPlay();
            },
            PlayErrorCallBack: function ()
            {
                MobileDeviceAPI.Audio.ErrorCallBackPlay();
            },
            StopPlay: function ()
            {
                WindowMessageClass.PostMessage("AppFrameWork.Audio.StopPlay", {});
            }
        },
        IDCard:
        {
            SuccessCallBack: null,
            StartRecognize: function (SuccessCallBack)
            {
                MobileDeviceAPI.IDCard.SuccessCallBack = SuccessCallBack;
                WindowMessageClass.PostMessage("MobileDeviceAPI.IDCard.StartRecognize", {});
            },
            StartRecognizeSuccessCallBack: function (Config)
            {
                MobileDeviceAPI.IDCard.SuccessCallBack(Config);
            }
        },
        Share:
        {
            ShareContent: function (content, href)
            {
                WindowMessageClass.PostMessage("MobileDeviceAPI.Share.ShareContent", { content: content, href: href });
            }
        },
        DataPicker:
        {
            SuccessCallBack: null,
            Show: function (OptionList, DefaultValue, SuccessCallBack)
            {
                MobileDeviceAPI.DataPicker.SuccessCallBack = SuccessCallBack;
                WindowMessageClass.PostMessage("MobileDeviceAPI.DataPicker.Show", { OptionList: OptionList,DefaultValue });
            },
            SelectSuccessCallBack: function (Config)
            {
                MobileDeviceAPI.DataPicker.SuccessCallBack(Config.item);
            }
        }
    };
/*-----------手机原生API控制类(end)-----------*/
 
ViewClass.js:
/*-----------查看管理类(Begin)-----------*/
var ViewClass =
    {
        ViewUserInfo: function (UserGuid)
        {
            LoadPageClass.LoadServerMobilePage(true, true, "page.User.UserInfo", { UserGuid: UserGuid });
        },
        ViewCustomerInfo: function (CustomerID)
        {
            LoadPageClass.LoadServerMobilePageInNewWindow("page.CRM.CustomerInfo.ViewCustomerInfo", "查看客户", true, { CustomerID: CustomerID }, function () { });
        },
        ViewNewsData: function (NewsID)
        {
            Element.Remove("SmallRedStatus" + NewsID);
            var ToolBarHTML = "";
            PopupDialogWindowClass.Show({}, "<img src=\"App/image/loadingnew.gif\">  正在加载...", "", ToolBarHTML, true);
            LoadServiceClass.LoadServiceInterfaceByDLLSetting("QiGuanBaoAppV5.dll|QiGuanBaoAppV5.News.NewsDataClass|ViewNewsData", "查看公告通知", false, "", "", { NewsID: NewsID }, function (AjaxResultObject)
            {
                var Config = eval("(" + AjaxResultObject.Result + ")");
                PopupDialogWindowClass.UpdateTitle(Config.Title);
                PopupDialogWindowClass.UpdateContent("<div style=\"background-color:#fff !important; padding-top:10px; padding-bottom:0px; border-top:1px solid #eee; border-bottom:1px solid #eee;\"><div class='MaxWidthSetting CenterDIV' style='padding:3px;'>" + Config.Content + "</div></div>");
            },
            Common_Error, { ActionName: "查看公告通知" });
        },
        ViewCompanyRule: function (NewsID)
        {
            Element.Remove("SmallRedStatus" + NewsID);
            var ToolBarHTML = "";
            PopupDialogWindowClass.Show({}, "<img src=\"App/image/loadingnew.gif\">  正在加载...", "", ToolBarHTML, true);
            LoadServiceClass.LoadServiceInterfaceByDLLSetting("QiGuanBaoAppV5.dll|QiGuanBaoAppV5.CompanyRule.CompanyRuleClass|ViewCompanyRule", "查看管理制度", false, "", "", { NewsID: NewsID }, function (AjaxResultObject)
            {
                var Config = eval("(" + AjaxResultObject.Result + ")");
                PopupDialogWindowClass.UpdateTitle(Config.Title);
                PopupDialogWindowClass.UpdateContent("<div style=\"background-color:#fff !important; padding-top:10px; padding-bottom:0px; border-top:1px solid #eee; border-bottom:1px solid #eee;\"><div class='MaxWidthSetting CenterDIV' style='padding:3px;'>" + Config.Content + "</div></div>");
            },
            Common_Error, { ActionName: "查看管理制度" });
        },
        ViewMailGuid: "",
        ViewMail: function (MailGuid)
        {
            ViewClass.ViewMailGuid = MailGuid;
            var ToolBarHTML = "";
            PopupDialogWindowClass.Show({}, "<img src=\"App/image/loadingnew.gif\">  正在加载...", "", ToolBarHTML, true);
            LoadServerService("Message_ViewMailInfo", false, "", "", { MailGuid: MailGuid, WebMailEngineParameter: JSON.encode(MailBoxClass.Config), RowIndex: 1 }, function (返回值)
            {
                var Title = "";
                var html = "";
                try
                {
                    var Mail = eval("(" + 返回值.Result + ")");
                    html += "<table class='MailContentTable'>";
                    html += "<tr><td><div style='width:55px;'>发件人:</div></td><td>" + Mail.MailFrom.replace(/\"/ig, "") + "<" + Mail.FromAddress + "></td></tr>";
                    html += "<tr><td>收件人:</td><td>" + Mail.MailTo + "</td></tr>";
                    if (Mail.CC != null && Mail.CC.length > 0)
                    {
                        html += "<tr><td>抄送人:</td><td>" + Mail.CC + "</td></tr>";
                    }
                    if (Mail.BCC != null && Mail.BCC.length > 0)
                    {
                        html += "<tr><td>密送人:</td><td>" + Mail.BCC + "</td></tr>";
                    }
                    if (Mail.Attachments != null && Mail.Attachments.length > 2)
                    {
                        html += "<tr><td>附   件:</td><td>" + Mail.Attachments + "</td></tr>";
                    }
                    html += "<tr><td>时   间:</td><td>" + Mail.Date + "</td></tr>";
                    html += "<tr><td>主   题:</td><td>" + Mail.Subject + "</td></tr>";
                    html += "</table>";
                    html += "<div style='margin-top:15px;' class='MobileHTMLBody'>";
                    html += Mail.HTMLBody;
                    html += "</div>";

                    Title = Mail.Subject;
                }
                catch (e)
                {
                    html = "加载邮件内容失败,原因:" + e.toString();
                }

                PopupDialogWindowClass.UpdateTitle(Title);
                PopupDialogWindowClass.UpdateContent("<div style=\"background-color:#fff !important; padding-top:10px; padding-bottom:0px; border-top:1px solid #eee; border-bottom:1px solid #eee;\"><div class='MaxWidthSetting CenterDIV' style='padding:3px;'>" + html + "</div></div>");

                //显示右侧按钮层
                PopupDialogWindowClass.ShowPopupWindowRightButton("<span class=\"mui-icon mui-pull-right mui-icon-bars\"></span>", function ()
                {
                    var ButtonList = ["删除"];
                    NotificationClass.actionSheet(ButtonList, function (Config)
                    {
                        var ButtonName = ButtonList[Config.SelectedButtonIndex - 1];
                        if (ButtonName == "删除")
                        {
                            MailBoxClass.DeleteMail(ViewClass.ViewMailGuid, function ()
                            {
                                PopupDialogWindowClass.Close();
                            });
                        }
                    });
                });

                //修正内容
                PopupDialogWindowClass.FixedDisplayContent();
            }, Common_Error, { ActionName: "查看邮件" });
        },
        ViewWorkFlow: function (WorkFlowGUID)
        {
            var ServiceURL = "Service.CRM.CustomizedWCFUI.ServiceFactory.WorkFlow.ViewWorkFlow.LoadDataGrid.aspx?WorkFlowGUID=" + WorkFlowGUID + "&PageTitle=" + encodeURIComponent("查看流程") + "&IsMobileV5=true&Version=" + Math.random();
            LoadPageClass.GetServerPage(ServiceURL, function (url)
            {
                MobileDeviceAPI.Webview.PopupNewWindowPage("查看流程", url, function (WebViewID) { });
            });
        },
        ViewWorkingLog: function (ID)
        {
            var ServiceURL = "Service.CRM.CustomizedWCFUI.ServiceFactory.WorkingLog.WorkingLogClass.LoadDataGrid.aspx?Method=ViewWorkingLog&PageTitle=" + encodeURIComponent("查看工作日志") + "&ID=" + ID + "&IsMobileV5=true&Version=" + Math.random();
            LoadPageClass.GetServerPage(ServiceURL, function (url)
            {
                MobileDeviceAPI.Webview.Create("ViewWorkingLog", url, null, null, "查看工作日志");
            });
        },
        ViewWorkingPlan: function (ID)
        {
            var ServiceURL = "Service.CRM.CustomizedWCFUI.ServiceFactory.WorkingPlan.WorkingPlanClass.LoadDataGrid.aspx?Method=ViewWorkingPlan&PageTitle=" + encodeURIComponent("查看日程安排") + "&ID=" + ID + "&IsMobileV5=true&Version=" + Math.random();
            LoadPageClass.GetServerPage(ServiceURL, function (url)
            {
                MobileDeviceAPI.Webview.Create("ViewWorkingPlan", url, null, null, "查看日程安排");
            });
        },
        ViewCustomerActionHistory: function (ID)
        {
            LoadPageClass.LoadServerMobilePageInNewWindow("page.CRM.CustomerActionHistory.View", "查看跟进记录", true, { ID: ID }, function () { });
        },
        ViewCustomerSaleChance: function (ID)
        {
            LoadPageClass.LoadServerMobilePageInNewWindow("page.CRM.CustomerSaleChance.View", "查看商机", true, { ID: ID }, function () { });
        },
        ViewCustomerRequirement: function (ID)
        {
            LoadPageClass.LoadServerMobilePageInNewWindow("page.CRM.CustomerRequirement.View", "查看需求", true, { ID: ID }, function () { });
        },
        ViewCustomerProposal: function (ID)
        {
            LoadPageClass.LoadServerMobilePageInNewWindow("page.CRM.CustomerProposal.View", "查看方案", true, { ID: ID }, function () { });
        },
        ViewCustomerCompetitor: function (ID)
        {
            LoadPageClass.LoadServerMobilePageInNewWindow("page.CRM.CustomerCompetitor.View", "查看竞争对手", true, { ID: ID }, function () { });
        },
        ViewCRMUserCustomizedFunction: function (MenuCode, MenuName, ID)
        {
            LoadPageClass.LoadServerMobilePageInNewWindow("page.CRM.CRMUserCustomizedFunction.View", "查看" + MenuName, true, { ID: ID, MenuCode: MenuCode, MenuName: MenuName }, function () { });
        },
        ViewCRMUserCustomizedFunctionCore: function (MenuCode, MenuName, IsViewedWorkFlow, UniqueKey)
        {
            if (IsViewedWorkFlow)
            {
                //查看关联的流程
                ViewClass.ViewWorkFlow(UniqueKey);
            }
            else
            {
                //查看自身表
                var ServiceURL = "Service." + MenuCode + ".aspx?Method=ViewCRMUserCustomizedFunction&MethodName=查看" + encodeURIComponent(MenuName) + "&ID=" + UniqueKey + "&IsMobileV5=true&Version=" + Math.random();
                LoadPageClass.GetServerPage(ServiceURL, function (url)
                {
                    MobileDeviceAPI.Webview.Create("ViewCRMUserCustomizedFunction", url, null, null, "查看" + encodeURIComponent(MenuName));
                });
            }
        },
        ViewUserCustomizedFunction: function (MenuCode, MenuName, item)
        {
            //判断是否查看流程
            var IsViewedWorkFlow = false;

            //这里根据不同的菜单代码,来判断是否显示关联的流程
            if (MenuCode == "")
            {
                IsViewedWorkFlow = true;
            }

            if (IsViewedWorkFlow)
            {
                //查看关联的流程
                ViewClass.ViewWorkFlow(item.WorkFlowGUID);
            }
            else
            {
                //查看自身表
                var ServiceURL = "Service." + MenuCode + ".aspx?Method=ViewUserCustomizedFunction&MethodName=查看" + encodeURIComponent(MenuName) + "&ID=" + item.ID + "&IsMobileV5=true&Version=" + Math.random();
                LoadPageClass.GetServerPage(ServiceURL, function (url)
                {
                    MobileDeviceAPI.Webview.Create("ViewUserCustomizedFunction", url, null, null, "查看" + encodeURIComponent(MenuName));
                });
            }
        },
        ViewUserCustomizedFunctionCore: function (MenuCode, MenuName, IsViewedWorkFlow, UniqueKey)
        {
            if (IsViewedWorkFlow)
            {
                //查看关联的流程
                ViewClass.ViewWorkFlow(UniqueKey);
            }
            else
            {
                //查看自身表
                var ServiceURL = "Service." + MenuCode + ".aspx?Method=ViewUserCustomizedFunction&MethodName=查看" + encodeURIComponent(MenuName) + "&ID=" + UniqueKey + "&IsMobileV5=true&Version=" + Math.random();
                LoadPageClass.GetServerPage(ServiceURL, function (url)
                {
                    MobileDeviceAPI.Webview.Create("ViewUserCustomizedFunction", url, null, null, "查看" + encodeURIComponent(MenuName));
                });
            }
        }
    };

function ViewUserInfo(UserGuid, RealName)
{
    ViewClass.ViewUserInfo(UserGuid);
}
/*-----------查看管理类(End)-----------*/