WebApp【公共组件库】@前端(For Git Submodule)
Tevin
2022-04-24 d66ea987a3926731bff1582b2d5d0e90635c9976
bases/Fetcher.js
@@ -390,7 +390,7 @@
            }
            // 在App中,跳转到首页取消登陆
            if (project.appHybrid) {
                Taro.redirectTo({ url: '/pages/home/index/index?mode=logout' });
                Taro.navigateTo({ url: '/pages/home/index/index?mode=logout' });
            }
            return null;
        } else {
@@ -510,7 +510,7 @@
                    return path;
                }
                // 绝对路径
                if (/^(\/upload|\/static)/.test(path)) {
                if (/^(\/upload|\/static|\/mini|\/assets)/.test(path)) {
                    return Fetcher.host + path;
                }
                // 部分路径
@@ -578,8 +578,22 @@
    static inDevMod = (() => {
        // 网页
        if (process.env.TARO_ENV === 'h5') {
            // 当没有 url 指定时,只有内网 ip 和 33**/35** 的端口号,视为本地开发模式
            return /^(192|127|localhost).*?:3[35]\d{2}$/i.test(window.location.host);
            // http协议访问
            if (window.location.protocol.indexOf('http') > 0) {
                // 当内网 ip 且使用 33**/35** 的端口号时,视为本地开发模式
                return /^(192|127|localhost).*?:3[35]\d{2}$/i.test(window.location.host);
            }
            // 非http协议访问
            else {
                // 开发编译
                if (process.env.NODE_ENV === 'development') {
                    return true;
                }
                // 生产编译
                else if (process.env.NODE_ENV === 'production') {
                    return false;
                }
            }
        }
        // 小程序
        else if (process.env.TARO_ENV === 'weapp') {