if (HIVUI_SETTING.url == "/e5") HIVUI_SETTING.url = "";
var root = window.location.origin;
var server = "";
serverName = server;
var pName = HIVUI_SETTING.projectName.split("/")[0];
var user = HIVUI_SETTING.projectName.split("/")[1];
var deployDir = "";
//登录页url
var loginUrl = HIVUI_SETTING.url + "/" + server + "/index.html?pn=" + pName + "/" + user;
if (window._global && window._global.env == 'dev') {
    deployDir = ""
    serverName = ""
    //登录页url
    var loginUrl = location.origin + deployDir + "/" + pName + "/hivuiLogin/index.html#/";
}
HIVUI_SETTING = eap.mergeConfig({
    serverName: serverName,
    //登录页url
    loginUrl: loginUrl,
    //用户信息
    userInfo: HIVUI_SETTING.url + "/sys/user/detail",
}, window.HIVUI_SETTING || {})

window.appsettings = {
    studioHelp: "http://doc.hieap.cn/web/#/7?page_id=1006",
    hiuiHelp: "http://hiui.hieap.cn/",
    mbHelper: "http://doc.hieap.cn/web/#/15?page_id=1252",
    serverHelper: "http://doc.hieap.cn/web/#/1?page_id=44",
    devcenter: "http://192.168.4.106:5156/",
    fileUrl: "http://file.hieap.cn",
    desktopPreview: "http://192.168.4.194:3000",
    preview: "http://192.168.4.193",
    serverUrl: HIVUI_SETTING.url || root,
    serverName: HIVUI_SETTING.serverName,
    login: HIVUI_SETTING.loginUrl,//"http://192.168.4.193:39784/eap5csxm/hivuiLogin/index.html#?returnUrl=",
    userInfo: HIVUI_SETTING.userInfo,//http://192.168.4.106:7777/hidev/sys/user/detail?pn=hidev",
    //logo: "/"+pName+"/setting/desktop/sysAssets/sy_logo/png/1.0.0/sy_logo.png"
    // dev: true
}
var MiniSite = new Object();
/**
 * 判断浏览器
 */
MiniSite.Browser = {
    ie: /msie/.test(window.navigator.userAgent.toLowerCase()),
    moz: /gecko/.test(window.navigator.userAgent.toLowerCase()),
    opera: /opera/.test(window.navigator.userAgent.toLowerCase()),
    safari: /safari/.test(window.navigator.userAgent.toLowerCase())
};
/**
 * JsLoader对象用来加载外部的js文件
 */
MiniSite.JsLoader = {
    /**
     * 加载外部的js文件
     * @param sUrl 要加载的js的url地址
     * @fCallback js加载完成之后的处理函数
     */
    load: function (sUrl, fCallback) {
        var _script = document.createElement('script');
        _script.setAttribute('charset', 'gbk');
        _script.setAttribute('type', 'text/javascript');
        _script.setAttribute('src', sUrl);
        document.getElementsByTagName('head')[0].appendChild(_script);
        if (MiniSite.Browser.ie) {
            _script.onreadystatechange = function () {
                if (this.readyState == 'loaded' || this.readyStaate == 'complete') {
                    //fCallback();
                    if (fCallback != undefined) {
                        fCallback();
                    }

                }
            };
        } else if (MiniSite.Browser.moz) {
            _script.onload = function () {
                //fCallback();
                if (fCallback != undefined) {
                    fCallback();
                }
            };
        } else {
            //fCallback();
            if (fCallback != undefined) {
                fCallback();
            }
        }
    }
};
MiniSite.JsLoader.load(`${appsettings.serverUrl}/designer/tree/view/setting.setrootdir/studioscript.js?pn=${HIVUI_SETTING.projectName}`)