| | |
| | | } |
| | | // 正常模式 |
| | | else { |
| | | // 代理模式 |
| | | if (typeof project.host.proxyType !== 'undefined' && project.host.proxyType !== 'lc') { |
| | | url = '/proxy' + this._data.urlPrefix[1] + (serSuffix || devSuffix); |
| | | } |
| | | // 开发环境地址 |
| | | else if (Fetcher.inDevMod) { |
| | | if (Fetcher.inDevMod) { |
| | | url = this._data.urlPrefix[0] + devSuffix; |
| | | } |
| | | // 生产环境地址 |
| | |
| | | }); |
| | | } |
| | | |
| | | // 小程序中,保存 cookies |
| | | _saveCookies(cookies) { |
| | | const localCookies = JSON.parse(Taro.getStorageSync('cookies') || '{}'); |
| | | cookies.forEach(cookie => { |
| | |
| | | Taro.setStorageSync('cookies', JSON.stringify(localCookies)); |
| | | } |
| | | |
| | | // 小程序中,获取 cookies |
| | | _getCookies() { |
| | | const localCookies = JSON.parse(Taro.getStorageSync('cookies') || '{}'); |
| | | const cookiesArr = []; |
| | |
| | | if (process.env.TARO_ENV === 'weapp') { |
| | | Taro.navigateTo({ url: '/pages/home/index/index?mode=login' }); |
| | | } |
| | | // 在App中,直接跳转登陆页 |
| | | // 在App中,跳转到首页取消登陆 |
| | | if (project.appHybrid) { |
| | | Taro.reLaunch({ url: '/pages/home/login/login' }); |
| | | Taro.redirectTo({ url: '/pages/home/index/index?mode=logout' }); |
| | | } |
| | | return null; |
| | | } else { |
| | |
| | | // 如果网址参数有指定服务器 |
| | | const server = Tools.getUrlParam('server'); |
| | | if (server) { |
| | | // 如果是完整网址,直接使用地址 |
| | | // 如果是完整网址,使用网址对应的域名 |
| | | if (server.indexOf('http') >= 0) { |
| | | return server; |
| | | const portal = server.split('//')[0]; |
| | | const domain = server.split('//')[1].split('/')[0]; |
| | | return portal + '//' + domain; |
| | | } |
| | | // 如果有匹配服务器,使用指定的服务器地址 |
| | | if (typeof project.host.hosts[server] !== 'undefined') { |