| | |
| | | |
| | | import project from '@project'; |
| | | import { Tools } from '@components/common/Tools'; |
| | | import { $localStorage } from '@components/common/LocalStorage'; |
| | | |
| | | export class HostBoot { |
| | | |
| | |
| | | }; |
| | | } |
| | | // 如果有匹配服务器,使用指定的服务器地址 |
| | | if (typeof this._data.hostList[server] !== 'undefined') { |
| | | else if (typeof this._data.hostList[server] !== 'undefined') { |
| | | this._data.activeHost[typeName] = { |
| | | name: server, |
| | | host: this._data.hostList[server], |
| | |
| | | type: typeName, |
| | | }; |
| | | } |
| | | // 如果有缓存,优先使用缓存 |
| | | const storageHostTypes = $localStorage.load('HostType'); |
| | | if (typeof storageHostTypes[typeName] !== 'undefined') { |
| | | this._data.activeHost[typeName] = storageHostTypes[typeName]; |
| | | } |
| | | } |
| | | |
| | | _matchHostName(host) { |
| | |
| | | host: host2, |
| | | type: typeName, |
| | | }; |
| | | // 存储自定义主机配置 |
| | | const storageHostTypes = $localStorage.load('HostType'); |
| | | storageHostTypes[typeName] = this._data.activeHost[typeName]; |
| | | $localStorage.save('HostType', storageHostTypes); |
| | | } |
| | | |
| | | /** |
| | | * 清除主机类型缓存 |
| | | */ |
| | | cleanHostStorage() { |
| | | $localStorage.remove('HostType'); |
| | | } |
| | | |
| | | /** |
| | | * 判断是否为本地开发模式 |
| | |
| | | return this._data.activeHost[typeName].name; |
| | | } |
| | | |
| | | /** |
| | | * 是否开启本地 mock |
| | | * @return {boolean} |
| | | */ |
| | | isOnMock() { |
| | | if (this.isDevMod()) { |
| | | return this.getHostName() === 'lc'; |