Commit 9265037c by wong.peiyi

只安装的时候设置一次域名地址

parent bba2421e
......@@ -6,7 +6,8 @@ import {
AUTO_LOGIN_SUCCESS,
AUTO_LOGIN_FAILURE,
SET_DOMAIN_CONFIGURATE,
SET_VERSION_APK
SET_VERSION_APK,
SET_DOMAIN_FROM_ORIGIN
} from '../base/ActionTypes';
import { GetRequest, PostRequest } from '../network/RequestUtils';
import { getUrlParams, show, showWarnErrorMessage, showErrorMessage } from '../utils/Utils';
......@@ -116,6 +117,13 @@ export function setDomainConfigurate(domainVal) {
}
}
export function setDomainFromOrigin(hasSet) {
return {
type: SET_DOMAIN_FROM_ORIGIN,
data: hasSet
}
}
//系统配置文件查询接口 access_token profile_code
export const requestSysProfile = async (global_domain_config, params) => {
return await GetRequest(global_domain_config, getUrlParams('/system/sys_profile/search', params))
......
......@@ -7,6 +7,7 @@ export const EXIT_LOGIN = "EXIT_LOGIN"
export const AUTO_LOGIN_SUCCESS = "AUTO_LOGIN_SUCCESS"
export const AUTO_LOGIN_FAILURE = "AUTO_LOGIN_FAILURE"
export const SET_DOMAIN_CONFIGURATE="SET_DOMAIN_CONFIGURATE"
export const SET_DOMAIN_FROM_ORIGIN = 'SET_DOMAIN_FROM_ORIGIN'
export const SET_VERSION_APK="SET_VERSION_APK"
//-----------self order---------------------
export const SELF_ORDER_LIST_NO = "SELF_ORDER_LIST_NO"
......
......@@ -28,7 +28,7 @@ import {
safe_view,
font_family_medium
} from '../../base/BaseStyle';
import { requestLogin, autoLogin, setDomainConfigurate, setVersionApk } from '../../action/LoginAction';
import { requestLogin, autoLogin, setDomainConfigurate, setVersionApk, setDomainFromOrigin } from '../../action/LoginAction';
import { show, isEmpty } from '../../utils/Utils';
import { LOGIN_DOING, LOGIN_SUCCESS, LOGIN_FAILURE, LOGIN_NO } from '../../base/ActionTypes';
import StatusBarView from '../common/StatusBarView';
......@@ -67,7 +67,10 @@ class LoginPage extends Component{
async setDefaultDomain() {
try {
const baseUrl = await NativeModules.RNToolsManager.getBaseUrl()
if (baseUrl && !this.props.hasSet) {
this.props.setDomainConfigurate(baseUrl)
this.props.setDomainFromOrigin(true)
}
} catch (error) {
console.log('do not suppor getBaseUrl')
}
......@@ -507,7 +510,8 @@ const mapStateToProps = (state) => ({
loginState:state.login.loginState,
username:state.login.username,
password:state.login.password,
global_domain_config:state.login.global_domain_config
global_domain_config:state.login.global_domain_config,
hasSet:state.login.hasSetDomainFromOrigin
})
const mapDispatchToProps = (dispatch) => ({
......@@ -523,6 +527,9 @@ const mapDispatchToProps = (dispatch) => ({
setVersionApk: (versionApk) => {
dispatch(setVersionApk(versionApk))
},
setDomainFromOrigin: (hasSet) => {
dispatch(setDomainFromOrigin(hasSet))
}
})
export default connect(mapStateToProps, mapDispatchToProps)(LoginPage)
......@@ -7,7 +7,8 @@ import {
AUTO_LOGIN_SUCCESS,
AUTO_LOGIN_FAILURE,
SET_DOMAIN_CONFIGURATE,
SET_VERSION_APK
SET_VERSION_APK,
SET_DOMAIN_FROM_ORIGIN
} from '../../base/ActionTypes';
// 登录状态
......@@ -18,6 +19,7 @@ const defaultState = {
username:'',
password:'',
global_domain_config: 'https://obs.uat.guke.tech',
hasSetDomainFromOrigin: false,
local_version_apk: '',
// 默认【深圳仓】https://obs.uat.guke.tech;【十方uat】https://obs.uat.sfrx.guke.tech;【十方pro】https://obs.sfrx.orth.tech
// 【国药dev】https://obs.dev.guke.tech;【国药pro】https://obs-pro.gyjtsx.com
......@@ -63,6 +65,10 @@ export default login = (state = defaultState, action) => {
return Object.assign({}, state, {
global_domain_config: action.global_domain_config
})
case SET_DOMAIN_FROM_ORIGIN:
return Object.assign({}, state, {
hasSetDomainFromOrigin: action.data
})
case SET_VERSION_APK:
return Object.assign({}, state, {
local_version_apk: action.local_version_apk
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment