Commit ff1d5203 by Denglingling

增加手动填写域名,接口获取当前【动态域名】

parent 577d3f4b
...@@ -15,10 +15,11 @@ import { ...@@ -15,10 +15,11 @@ import {
// 获取组织 params={access_token:''} // 获取组织 params={access_token:''}
export function requestEquipOrganizations(params) { export function requestEquipOrganizations(params) {
return dispatch => { return (dispatch, getState) => {
console.log('----requestEquipOrganizations====================') console.log('----requestEquipOrganizations====================')
dispatch(requestListDataing()); dispatch(requestListDataing());
GetRequest(getUrlParams('/authorized_inventory/search', params)) let {global_domain_config} = getState().login
GetRequest(global_domain_config, getUrlParams('/authorized_inventory/search', params))
.then(res => { .then(res => {
console.log('res=====', Object.keys(res), res); console.log('res=====', Object.keys(res), res);
if(res.error_code == 0) { if(res.error_code == 0) {
...@@ -42,10 +43,11 @@ export function requestEquipOrganizations(params) { ...@@ -42,10 +43,11 @@ export function requestEquipOrganizations(params) {
// 获取手术医院 params={access_token:'', org_code:'', seller_code:''} // 获取手术医院 params={access_token:'', org_code:'', seller_code:''}
export function requestEquipSurgeryHospital(params) { export function requestEquipSurgeryHospital(params) {
return dispatch => { return (dispatch, getState) => {
console.log('----requestEquipSurgeryHospital====================', params) console.log('----requestEquipSurgeryHospital====================', params)
dispatch(requestListDataing()); dispatch(requestListDataing());
GetRequest(getUrlParams('/sale/seller_customer/search', params)) let {global_domain_config} = getState().login
GetRequest(global_domain_config, getUrlParams('/sale/seller_customer/search', params))
.then(res => { .then(res => {
console.log('res===!!==', Object.keys(res)); console.log('res===!!==', Object.keys(res));
if(res.error_code == 0) { if(res.error_code == 0) {
...@@ -70,10 +72,11 @@ export function requestEquipSurgeryHospital(params) { ...@@ -70,10 +72,11 @@ export function requestEquipSurgeryHospital(params) {
// api/latest/surgery/collect_order/search?access_token=${access_token}&org_code=A02&seller_code=shi.ming&customer_code=CU00000017&collect_header_status=RETURNED,COLLECTED // api/latest/surgery/collect_order/search?access_token=${access_token}&org_code=A02&seller_code=shi.ming&customer_code=CU00000017&collect_header_status=RETURNED,COLLECTED
// 获取订单信息 params={access_token:'', org_code:'', seller_code:'', customer_code:'', collect_header_status: ''} // 获取订单信息 params={access_token:'', org_code:'', seller_code:'', customer_code:'', collect_header_status: ''}
export function requestEquipOrderInfo(params) { export function requestEquipOrderInfo(params) {
return dispatch => { return (dispatch, getState) => {
console.log('----requestEquipOrderInfo====================', params) console.log('----requestEquipOrderInfo====================', params)
dispatch(requestListDataing()); dispatch(requestListDataing());
GetRequest(getUrlParams('/surgery/collect_order/search', params)) let {global_domain_config} = getState().login
GetRequest(global_domain_config, getUrlParams('/surgery/collect_order/search', params))
.then(res => { .then(res => {
console.log('res===!!==', Object.keys(res)); console.log('res===!!==', Object.keys(res));
if(res.error_code == 0) { if(res.error_code == 0) {
...@@ -123,24 +126,25 @@ export function getSubdetailOption(data) { ...@@ -123,24 +126,25 @@ export function getSubdetailOption(data) {
} }
// 获取消耗明细 params={access_token:'', surgery_collect_number:''} // 获取消耗明细 params={access_token:'', surgery_collect_number:''}
export const requestEquipDetails = async (params) => { export const requestEquipDetails = async (global_domain_config, params) => {
console.log('----requestEquipDetails----', params) console.log('----requestEquipDetails----', params)
return await GetRequest(getUrlParams('/surgery/collected_order_line/search', params)) return await GetRequest(global_domain_config, getUrlParams('/surgery/collected_order_line/search', params))
} }
// 图片上传 // 图片上传
export const uploadEquipImg = async (params) => { export const uploadEquipImg = async (global_domain_config, params) => {
let { access_token, formData } = params let { access_token, formData } = params
console.log('--------', access_token, formData) console.log('--------', access_token, formData)
return await UploadRequest(getUrlParams('/dingding/upload_media', { access_token }), formData) return await UploadRequest(global_domain_config, getUrlParams('/dingding/upload_media', { access_token }), formData)
} }
// 提交数据 // 提交数据
export function requestEquipSumbit({access_token, ...params}) { export function requestEquipSumbit({access_token, ...params}) {
return dispatch => { return (dispatch, getState) => {
console.warn('----requestEquipSumbit====================', access_token, params) console.warn('----requestEquipSumbit====================', access_token, params)
dispatch(requestSubmiting()); dispatch(requestSubmiting());
PostRequest(getUrlParams('/surgery/consume_order/create', {access_token: access_token}), params) let {global_domain_config} = getState().login
PostRequest(global_domain_config, getUrlParams('/surgery/consume_order/create', {access_token: access_token}), params)
.then(res => { .then(res => {
console.warn('res=====', Object.keys(res), res); console.warn('res=====', Object.keys(res), res);
if(res.error_code == 0) { if(res.error_code == 0) {
......
import {LOGIN_DOING,LOGIN_SUCCESS,LOGIN_FAILURE,EXIT_LOGIN,AUTO_LOGIN_SUCCESS,AUTO_LOGIN_FAILURE} from '../base/ActionTypes'; import {
LOGIN_DOING,
LOGIN_SUCCESS,
LOGIN_FAILURE,
EXIT_LOGIN,
AUTO_LOGIN_SUCCESS,
AUTO_LOGIN_FAILURE,
SET_DOMAIN_CONFIGURATE
} from '../base/ActionTypes';
import { PostRequest,GetRequest } from '../network/RequestUtils'; import { PostRequest,GetRequest } from '../network/RequestUtils';
import {show} from '../utils/Utils'; import { show } from '../utils/Utils';
export function requestLogin(params) { export function requestLogin(params) {
return dispatch => { return (dispatch, getState) => {
console.log('-------store--!!=========================---', getState())
dispatch(logining()); dispatch(logining());
PostRequest('/access_token/password/search?app_code=PDA', params).then((res) => { let {global_domain_config} = getState().login
PostRequest(global_domain_config, '/access_token/password/search?app_code=MOBILE', params).then((res) => {
if(res.error_code === 0){ if(res.error_code === 0){
// console.warn('res---', res)
// if(res.functions && res.functions.length) {
// show('登录成功');
// dispatch(loginSuccess(res, params.data.user_name, params.data.user_password));
// } else {
// show(`当前用户没有菜单权限,\n请联系管理员配置!`)
// dispatch(loginFailure())
// }
show('登录成功'); show('登录成功');
console.warn('res---', res)
dispatch(loginSuccess(res, params.data.user_name, params.data.user_password)); dispatch(loginSuccess(res, params.data.user_name, params.data.user_password));
}else { }else {
show(res.error_msg); let {error_msg} = res
if(error_code == -3) {
error_msg += '\n尝试修改域名'
}
show(error_msg);
dispatch(loginFailure()) dispatch(loginFailure())
} }
}).catch((err) => { }).catch((err) => {
...@@ -60,10 +83,17 @@ function autoLoginFailure() { ...@@ -60,10 +83,17 @@ function autoLoginFailure() {
} }
export function autoLogin(params) { export function autoLogin(params) {
return dispatch => { return (dispatch, getState) => {
PostRequest('/access_token/password/search?app_code=PDA', params).then((res) => { let {global_domain_config} = getState().login
PostRequest(global_domain_config, '/access_token/password/search?app_code=MOBILE', params).then((res) => {
if(res.error_code === 0){ if(res.error_code === 0){
console.warn('auto------',res); console.warn('auto------',res);
// if(res.functions && res.functions.length) {
// dispatch(autoLoginSuccess(res));
// } else {
// show(`当前用户没有菜单权限,\n请联系管理员配置!`)
// dispatch(autoLoginFailure())
// }
dispatch(autoLoginSuccess(res)) dispatch(autoLoginSuccess(res))
}else { }else {
console.warn(res.error_msg); console.warn(res.error_msg);
...@@ -75,3 +105,10 @@ export function autoLogin(params) { ...@@ -75,3 +105,10 @@ export function autoLogin(params) {
}) })
} }
} }
export function setDomainConfigurate(domainVal) {
return {
type: SET_DOMAIN_CONFIGURATE,
global_domain_config: domainVal
}
}
\ No newline at end of file
...@@ -13,11 +13,12 @@ import { ...@@ -13,11 +13,12 @@ import {
// 获取组织 params={access_token:''} // 获取组织 params={access_token:''}
export function requestQuickOrganizations(params) { export function requestQuickOrganizations(params) {
return dispatch => { return (dispatch, getState) => {
console.log('----requestQuickOrganizations====================') console.log('----requestQuickOrganizations====================')
dispatch(requestListDataing()); dispatch(requestListDataing());
let {global_domain_config} = getState().login
// GetRequest(`/authorized_inventory/search?access_token=${access_token}`) // GetRequest(`/authorized_inventory/search?access_token=${access_token}`)
GetRequest(getUrlParams('/authorized_inventory/search', params)) GetRequest(global_domain_config, getUrlParams('/authorized_inventory/search', params))
.then(res => { .then(res => {
console.log('res=====', Object.keys(res), res); console.log('res=====', Object.keys(res), res);
if(res.error_code == 0) { if(res.error_code == 0) {
...@@ -41,10 +42,11 @@ export function requestQuickOrganizations(params) { ...@@ -41,10 +42,11 @@ export function requestQuickOrganizations(params) {
// 获取手术医院 params={access_token:'', org_code:'', seller_code:''} // 获取手术医院 params={access_token:'', org_code:'', seller_code:''}
export function requestQuickSurgeryHospital(params) { export function requestQuickSurgeryHospital(params) {
return dispatch => { return (dispatch, getState) => {
console.log('----requestQuickSurgeryHospital====================', params) console.log('----requestQuickSurgeryHospital====================', params)
dispatch(requestListDataing()); dispatch(requestListDataing());
GetRequest(getUrlParams('/sale/seller_customer/search', params)) let {global_domain_config} = getState().login
GetRequest(global_domain_config, getUrlParams('/sale/seller_customer/search', params))
.then(res => { .then(res => {
console.log('res===!!==', Object.keys(res)); console.log('res===!!==', Object.keys(res));
if(res.error_code == 0) { if(res.error_code == 0) {
...@@ -68,10 +70,11 @@ export function requestQuickSurgeryHospital(params) { ...@@ -68,10 +70,11 @@ export function requestQuickSurgeryHospital(params) {
// 获取订单类型 params={access_token:'', value_set_code:'SUR_ORDER_TYPE'} // 获取订单类型 params={access_token:'', value_set_code:'SUR_ORDER_TYPE'}
export function requestQuickOrderType(params) { export function requestQuickOrderType(params) {
return dispatch => { return (dispatch, getState) => {
console.log('----requestQuickOrderType====================', params) console.log('----requestQuickOrderType====================', params)
dispatch(requestListDataing()); dispatch(requestListDataing());
GetRequest(getUrlParams('/system/value_set/search', params)) let {global_domain_config} = getState().login
GetRequest(global_domain_config, getUrlParams('/system/value_set/search', params))
.then(res => { .then(res => {
console.log('res===!!==', Object.keys(res)); console.log('res===!!==', Object.keys(res));
if(res.error_code == 0) { if(res.error_code == 0) {
...@@ -95,10 +98,11 @@ export function requestQuickOrderType(params) { ...@@ -95,10 +98,11 @@ export function requestQuickOrderType(params) {
// 获取配台模版 params={access_token:'', org_code:'', seller_code: 'shi.ming', customer_code: '', surgery_type: '', doctor_name: ''} // 获取配台模版 params={access_token:'', org_code:'', seller_code: 'shi.ming', customer_code: '', surgery_type: '', doctor_name: ''}
export function requestQuickTemplateCollect(params) { export function requestQuickTemplateCollect(params) {
return dispatch => { return (dispatch, getState) => {
console.log('----requestQuickTemplateCollect====================', params) console.log('----requestQuickTemplateCollect====================', params)
dispatch(requestListDataing()); dispatch(requestListDataing());
GetRequest(getUrlParams('/surgery/template_header/search', params)) let {global_domain_config} = getState().login
GetRequest(global_domain_config, getUrlParams('/surgery/template_header/search', params))
.then(res => { .then(res => {
console.log('res===!!==', Object.keys(res)); console.log('res===!!==', Object.keys(res));
if(res.error_code == 0) { if(res.error_code == 0) {
...@@ -140,7 +144,7 @@ function requestListDataFail() { ...@@ -140,7 +144,7 @@ function requestListDataFail() {
} }
// 上传语音 // 上传语音
export const requestQuickAudio = async (params) => { export const requestQuickAudio = async (global_domain_config, params) => {
let { access_token, path } = params let { access_token, path } = params
let formData = new FormData() let formData = new FormData()
let soundPath = `file://${path}` let soundPath = `file://${path}`
...@@ -148,15 +152,16 @@ export const requestQuickAudio = async (params) => { ...@@ -148,15 +152,16 @@ export const requestQuickAudio = async (params) => {
let file = { uri: soundPath, type: "multipart/form-data", name: fileName} let file = { uri: soundPath, type: "multipart/form-data", name: fileName}
formData.append('file', file) formData.append('file', file)
console.log('--------', file, formData) console.log('--------', file, formData)
return await UploadRequest(getUrlParams('/dingding/upload_media', { access_token }), formData) return await UploadRequest(global_domain_config, getUrlParams('/dingding/upload_media', { access_token }), formData)
} }
// 提交数据 // 提交数据
export function requestQuickSumbit({access_token, ...params}) { export function requestQuickSumbit({access_token, ...params}) {
return dispatch => { return (dispatch, getState) => {
console.warn('----requestQuickSumbit====================', access_token, params) console.warn('----requestQuickSumbit====================', access_token, params)
dispatch(requestSubmiting()); dispatch(requestSubmiting());
PostRequest(getUrlParams('/surgery/collect_order/via_data/create', {access_token: access_token}), params) let {global_domain_config} = getState().login
PostRequest(global_domain_config, getUrlParams('/surgery/collect_order/via_data/create', {access_token: access_token}), params)
.then(res => { .then(res => {
console.warn('res=====', Object.keys(res)); console.warn('res=====', Object.keys(res));
if(res.error_code == 0) { if(res.error_code == 0) {
......
...@@ -13,10 +13,11 @@ import { ...@@ -13,10 +13,11 @@ import {
// return await GetRequest(`/api/latest/authorized_inventory/search?access_token=${params.access_token}`) // return await GetRequest(`/api/latest/authorized_inventory/search?access_token=${params.access_token}`)
// } // }
export function requestOrganizations(access_token) { export function requestOrganizations(access_token) {
return dispatch => { return (dispatch, getState) => {
// console.warn('----requestOrganizations') // console.warn('----requestOrganizations')
dispatch(requestOrganizationsing()); dispatch(requestOrganizationsing());
GetRequest(`/authorized_inventory/search?access_token=${access_token}`) let {global_domain_config} = getState().login
GetRequest(global_domain_config, `/authorized_inventory/search?access_token=${access_token}`)
.then(res => { .then(res => {
// console.warn('res=====', Object.keys(res)); // console.warn('res=====', Object.keys(res));
if(res.error_code == 0) { if(res.error_code == 0) {
......
...@@ -6,6 +6,7 @@ export const LOGIN_FAILURE = "LOGIN_FAILURE" ...@@ -6,6 +6,7 @@ export const LOGIN_FAILURE = "LOGIN_FAILURE"
export const EXIT_LOGIN = "EXIT_LOGIN" export const EXIT_LOGIN = "EXIT_LOGIN"
export const AUTO_LOGIN_SUCCESS = "AUTO_LOGIN_SUCCESS" export const AUTO_LOGIN_SUCCESS = "AUTO_LOGIN_SUCCESS"
export const AUTO_LOGIN_FAILURE = "AUTO_LOGIN_FAILURE" export const AUTO_LOGIN_FAILURE = "AUTO_LOGIN_FAILURE"
export const SET_DOMAIN_CONFIGURATE="SET_DOMAIN_CONFIGURATE"
//-----------self order--------------------- //-----------self order---------------------
export const SELF_ORDER_LIST_NO = "SELF_ORDER_LIST_NO" export const SELF_ORDER_LIST_NO = "SELF_ORDER_LIST_NO"
export const SELF_ORDER_LIST_DOING = "SELF_ORDER_LIST_DOING" export const SELF_ORDER_LIST_DOING = "SELF_ORDER_LIST_DOING"
...@@ -37,3 +38,8 @@ export const EQUIP_SUBMIT_SUCCESS = "EQUIP_SUBMIT_SUCCESS" ...@@ -37,3 +38,8 @@ export const EQUIP_SUBMIT_SUCCESS = "EQUIP_SUBMIT_SUCCESS"
export const EQUIP_SUBMIT_FAILURE = "EQUIP_SUBMIT_FAILURE" export const EQUIP_SUBMIT_FAILURE = "EQUIP_SUBMIT_FAILURE"
export const EQUIP_INIT_DATA = "EQUIP_INIT_DATA" export const EQUIP_INIT_DATA = "EQUIP_INIT_DATA"
export const GET_SUB_DETAIL_OPTION = "GET_SUB_DETAIL_OPTION" export const GET_SUB_DETAIL_OPTION = "GET_SUB_DETAIL_OPTION"
//-----------historical order search---------------------
export const HISTOR_ORDER_SEARCH_NO = "HISTOR_ORDER_SEARCH_NO"
export const HISTOR_ORDER_SEARCH_DOING = "HISTOR_ORDER_SEARCH_DOING"
export const HISTOR_ORDER_SEARCH_SUCCESS = "HISTOR_ORDER_SEARCH_SUCCESS"
export const HISTOR_ORDER_SEARCH_FAILURE = "HISTOR_ORDER_SEARCH_FAILURE"
\ No newline at end of file
...@@ -913,9 +913,10 @@ class EquipConsuPage extends Component { ...@@ -913,9 +913,10 @@ class EquipConsuPage extends Component {
access_token: props.token, access_token: props.token,
formData formData
} }
let {global_domain_config} = props
//上传图片接口 //上传图片接口
// console.log('---handleSubmit--',params) // console.log('---handleSubmit--',params)
let imgResult = await uploadEquipImg(params); let imgResult = await uploadEquipImg(global_domain_config, params);
// console.log('返回---imgResult======',imgResult) // console.log('返回---imgResult======',imgResult)
if(imgResult.error_code == 0) { if(imgResult.error_code == 0) {
that.changeSubLoding(false) that.changeSubLoding(false)
...@@ -1585,7 +1586,8 @@ const mapStateToProps = (state) => { ...@@ -1585,7 +1586,8 @@ const mapStateToProps = (state) => {
equip_list_status: state.equip.equip_list_status, equip_list_status: state.equip.equip_list_status,
submit_equip_order_status: state.equip.submit_equip_order_status, submit_equip_order_status: state.equip.submit_equip_order_status,
equipOrderOption: state.equip.equipOrderOption, equipOrderOption: state.equip.equipOrderOption,
subDetOption: state.equip.subDetOption subDetOption: state.equip.subDetOption,
global_domain_config: state.login.global_domain_config
} }
} }
......
...@@ -114,11 +114,12 @@ class ConsumDetailsPage extends Component { ...@@ -114,11 +114,12 @@ class ConsumDetailsPage extends Component {
// 获取当前订单的消耗明细 // 获取当前订单的消耗明细
async getCurOrderDetail() { async getCurOrderDetail() {
let {orderId} = this.props.navigation.state.params let {orderId} = this.props.navigation.state.params
let {global_domain_config} = this.props
let params = { let params = {
access_token: this.props.token, access_token: this.props.token,
surgery_collect_number: orderId surgery_collect_number: orderId
} }
let detailResult = await requestEquipDetails(params) let detailResult = await requestEquipDetails(global_domain_config, params)
if(detailResult.error_code === 0) { if(detailResult.error_code === 0) {
let {lines} = detailResult.data let {lines} = detailResult.data
let {subDetOption} = this.props // 【器械消耗】已存在的明细 let {subDetOption} = this.props // 【器械消耗】已存在的明细
...@@ -464,7 +465,8 @@ const mapStateToProps = (state) => { ...@@ -464,7 +465,8 @@ const mapStateToProps = (state) => {
userInfo: state.login.userInfo, userInfo: state.login.userInfo,
token: state.login.token, token: state.login.token,
loginState: state.login.loginState, loginState: state.login.loginState,
subDetOption: state.equip.subDetOption subDetOption: state.equip.subDetOption,
global_domain_config: state.login.global_domain_config
} }
} }
......
...@@ -32,7 +32,7 @@ class HomePage extends Component { ...@@ -32,7 +32,7 @@ class HomePage extends Component {
showList: [ showList: [
{ {
icon: require('../../images/quick_order.png'), icon: require('../../images/quick_order.png'),
title: '快速下单', title: '借货订单', // 原快速下单、手术报台
page: 'QuickOrderPage', page: 'QuickOrderPage',
}, },
// { // {
...@@ -42,12 +42,12 @@ class HomePage extends Component { ...@@ -42,12 +42,12 @@ class HomePage extends Component {
// }, // },
// { // {
// icon: require('../../images/trans_order.png'), // icon: require('../../images/trans_order.png'),
// title: '转单', // title: '转单申请', // 原转单
// page: 'TransOrderPage', // page: 'TransOrderPage',
// }, // },
{ {
icon: require('../../images/equip_consu.png'), icon: require('../../images/equip_consu.png'),
title: '器械消耗', title: '消耗确认', // 原器械消耗
page: 'EquipConsuPage', page: 'EquipConsuPage',
}, },
// { // {
......
...@@ -23,28 +23,33 @@ import { ...@@ -23,28 +23,33 @@ import {
pxSize, pxSize,
placehold_text_color, placehold_text_color,
font_family_regular, font_family_regular,
safe_view safe_view,
font_family_medium
} from '../../base/BaseStyle'; } from '../../base/BaseStyle';
import {requestLogin, autoLogin} from '../../action/LoginAction'; import { requestLogin, autoLogin, setDomainConfigurate } from '../../action/LoginAction';
import {show, isEmpty} from '../../utils/Utils'; import { show, isEmpty } from '../../utils/Utils';
import {LOGIN_DOING,LOGIN_SUCCESS,LOGIN_FAILURE,LOGIN_NO} from '../../base/ActionTypes'; import { LOGIN_DOING, LOGIN_SUCCESS, LOGIN_FAILURE, LOGIN_NO } from '../../base/ActionTypes';
import StatusBarView from '../common/StatusBarView'; import StatusBarView from '../common/StatusBarView';
import LodingModel from '../common/LodingModel'; import LodingModel from '../common/LodingModel';
import FillDomainModel from './module/FillDomainModel';
import SplashScreen from 'react-native-splash-screen';
class LoginPage extends Component{ class LoginPage extends Component{
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
username: '', // shi.ming username: '', // shi.ming gao.xiaoming
password: '', // sfrx2019 password: '', // sfrx2019
subTit: '登录', subTit: '登录',
subTitList: ['登录', '登录中...'], subTitList: ['登录', '登录中...'],
isSubLoding: false isSubLoding: false,
isShowDomain: false, // 域名填写
} }
} }
componentDidMount() { componentDidMount() {
// this.subAutoLogin() // this.subAutoLogin()
SplashScreen.hide() //关闭启动屏幕
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
...@@ -103,11 +108,11 @@ class LoginPage extends Component{ ...@@ -103,11 +108,11 @@ class LoginPage extends Component{
let {username, password, isSubLoding} = this.state let {username, password, isSubLoding} = this.state
if (!isSubLoding) { if (!isSubLoding) {
if (isEmpty(username)) { if (isEmpty(username)) {
show('请输入用户名') show('请输入用户名', 'warn')
return return
} }
if(isEmpty(password)) { if(isEmpty(password)) {
show('请输入密码') show('请输入密码', 'warn')
return return
} }
let params = { let params = {
...@@ -163,8 +168,34 @@ class LoginPage extends Component{ ...@@ -163,8 +168,34 @@ class LoginPage extends Component{
this.props.navigation.navigate('HomePage') this.props.navigation.navigate('HomePage')
} }
// 打开域名弹窗
handleOpenDomain() {
this.setState({
isShowDomain: true
})
}
// 关闭域名 回调
handleCloseDomain() {
this.setState({
isShowDomain: false
})
}
// 域名弹窗 回调
fillDomainCallBack(domainVal) {
// 存储值到 store
console.log('login-----', domainVal)
let {props} = this
props.setDomainConfigurate(domainVal)
}
render() { render() {
let {username, password, isSubLoding, subTit} = this.state let {username, password, isSubLoding, subTit, isShowDomain} = this.state
let {global_domain_config} = this.props
console.log('login-----', global_domain_config)
let tempInd = global_domain_config.indexOf('/') + 2
let tempGlobalDomain = global_domain_config.slice(tempInd)
return ( return (
<View style={styles.login_container}> <View style={styles.login_container}>
<StatusBarView <StatusBarView
...@@ -216,6 +247,13 @@ class LoginPage extends Component{ ...@@ -216,6 +247,13 @@ class LoginPage extends Component{
activeOpacity={ isSubLoding ? 1 : .8}> activeOpacity={ isSubLoding ? 1 : .8}>
<Text style={styles.btn_text}>{ subTit }</Text> <Text style={styles.btn_text}>{ subTit }</Text>
</TouchableOpacity> </TouchableOpacity>
<TouchableOpacity
activeOpacity={.8}
style={styles.fo_domain_box}
onPress={() => this.handleOpenDomain()}
>
<Text style={styles.domain_txt}>修改域名</Text>
</TouchableOpacity>
</View> </View>
</View> </View>
<View style={styles.login_footer}> <View style={styles.login_footer}>
...@@ -226,8 +264,16 @@ class LoginPage extends Component{ ...@@ -226,8 +264,16 @@ class LoginPage extends Component{
<LodingModel title={subTit} show={isSubLoding} /> <LodingModel title={subTit} show={isSubLoding} />
<FillDomainModel
show={isShowDomain}
closeModal={() => this.handleCloseDomain()}
callback={(domainVal) => this.fillDomainCallBack(domainVal)}
domainValue={tempGlobalDomain}
/>
</View> </View>
</ImageBackground> </ImageBackground>
</SafeAreaView> </SafeAreaView>
</View> </View>
) )
...@@ -288,7 +334,6 @@ const styles = StyleSheet.create({ ...@@ -288,7 +334,6 @@ const styles = StyleSheet.create({
paddingHorizontal: '8%', paddingHorizontal: '8%',
paddingVertical: '12%', paddingVertical: '12%',
paddingBottom: 0 paddingBottom: 0
}, },
cont_head: { cont_head: {
marginBottom: '12%' marginBottom: '12%'
...@@ -320,7 +365,8 @@ const styles = StyleSheet.create({ ...@@ -320,7 +365,8 @@ const styles = StyleSheet.create({
}, },
cont_footer: { cont_footer: {
// borderRadius: 50 // borderRadius: 50
justifyContent: 'center', // justifyContent: 'center',
justifyContent: 'flex-end',
flex: 1 flex: 1
}, },
btn_footer: { btn_footer: {
...@@ -346,7 +392,17 @@ const styles = StyleSheet.create({ ...@@ -346,7 +392,17 @@ const styles = StyleSheet.create({
}, },
btn_text: { btn_text: {
color: title_text_color, color: title_text_color,
fontSize: second_text_size fontSize: second_text_size,
fontFamily: font_family_medium
},
fo_domain_box: {
alignItems: 'flex-end',
marginTop: 14
},
domain_txt: {
color: '#919191',
fontSize: 14,
fontFamily: font_family_regular
}, },
login_footer: { login_footer: {
// height: '20%', // height: '20%',
...@@ -367,7 +423,7 @@ const styles = StyleSheet.create({ ...@@ -367,7 +423,7 @@ const styles = StyleSheet.create({
resizeMode: 'contain', resizeMode: 'contain',
width: '100%', width: '100%',
height: '100%' height: '100%'
} },
}) })
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({
...@@ -375,7 +431,8 @@ const mapStateToProps = (state) => ({ ...@@ -375,7 +431,8 @@ const mapStateToProps = (state) => ({
userInfo:state.login.userInfo, userInfo:state.login.userInfo,
loginState:state.login.loginState, loginState:state.login.loginState,
username:state.login.username, username:state.login.username,
password:state.login.password password:state.login.password,
global_domain_config:state.login.global_domain_config
}) })
const mapDispatchToProps = (dispatch) => ({ const mapDispatchToProps = (dispatch) => ({
...@@ -384,6 +441,9 @@ const mapDispatchToProps = (dispatch) => ({ ...@@ -384,6 +441,9 @@ const mapDispatchToProps = (dispatch) => ({
}, },
autoLogin: (data) => { autoLogin: (data) => {
dispatch(autoLogin(data)) dispatch(autoLogin(data))
},
setDomainConfigurate: (domainVal) => {
dispatch(setDomainConfigurate(domainVal))
} }
}) })
......
import React, { Component } from 'react';
import {
View,
Text,
Modal,
SafeAreaView,
TextInput,
StyleSheet,
TouchableOpacity
} from 'react-native';
import {
safe_view,
placehold_text_color,
Width,
pxHeight,
foundation_color,
promary_text_color,
font_family_semibold,
font_family_regular,
first_text_color,
btn_sub_color,
second_text_size,
title_text_color
} from '../../../base/BaseStyle';
import { show } from '../../../utils/Utils';
class FillDomainModel extends Component {
constructor(props) {
super(props);
this.state = {
isVisible: false,
defaDomainHead: 'https://',
domainValue: '',
isNull: false
}
}
componentWillReceiveProps(nextProps) {
console.log('nextProps.show----', nextProps.show, nextProps.domainValue)
if (this.state.isVisible != nextProps.show) {
this.setState({
isVisible: nextProps.show
});
}
if(this.state.domainValue != nextProps.domainValue) {
let tempDomain = nextProps.domainValue
let {isVisible} = this.state
if(tempDomain.includes("obs.uat.guke.tech")) {
tempDomain = ''
isVisible = true
}
this.setState({
domainValue: tempDomain,
isVisible
})
}
}
closeModal() {
this.setState({
isVisible: false
})
this.props.closeModal(false)
}
// 域名 输入
handleDomainInput(text) {
console.log('text----', text)
let isNull = false
if(!text) {
isNull = true
}
this.setState({
domainValue: text,
isNull
})
}
// 确定
handleSubClick() {
let {defaDomainHead, domainValue, isNull} = this.state
console.log('确定-----', defaDomainHead, domainValue)
if(!domainValue) {
console.log('请输入域名!', isNull, domainValue)
this.setState({
isNull: true
})
return
}
// 存储值 !!!
let tempDomain = defaDomainHead+domainValue
this.closeModal()
this.props.callback(tempDomain)
}
renderDialog() {
let { domainValue, defaDomainHead, isNull } = this.state
return (
<View style={styles.cont_mian}>
<View style={styles.cont_inner}>
<View style={styles.cont_tit_box}>
<Text style={styles.cont_tit}>配置域名</Text>
</View>
<View style={styles.cont_cell}>
<Text style={styles.input_head}>{defaDomainHead}</Text>
<TextInput
autoCapitalize='none'
style={styles.cell_inp_txt}
placeholderTextColor={placehold_text_color}
returnKeyType="done"
defaultValue={domainValue}
placeholder={'请输入域名'}
keyboardType="email-address"
onChangeText={(text) => this.handleDomainInput(text)}
/>
</View>
{
isNull ?
<View style={styles.err_input_box}>
<Text style={styles.err_input}>请输入域名</Text>
</View> : null
}
<View style={styles.cont_footer}>
<TouchableOpacity
activeOpacity={.8}
style={styles.sub_btn_box}
onPress={() => this.handleSubClick()}
>
<Text style={styles.sub_tit}>确定</Text>
</TouchableOpacity>
</View>
</View>
</View>
)
}
render() {
return (
<View style={styles.dia_container}>
<Modal
transparent={true}
visible={this.state.isVisible}
animationType={'fade'}
// onRequestClose={() => this.closeModal()}
>
<SafeAreaView style={safe_view}>
{/* <TouchableOpacity style={styles.container} activeOpacity={1}
// onPress={() => this.closeModal()}
>
{this.renderDialog()}
</TouchableOpacity> */}
<View style={styles.container}>
{/* <Text>hhh</Text> */}
{this.renderDialog()}
</View>
</SafeAreaView>
</Modal>
</View>
);
}
}
const styles = StyleSheet.create({
dia_container: {
flex: 1
},
container: {
flex: 1,
backgroundColor: 'rgba(0, 0, 0, 0.8)',
// paddingTop: '55%',
// alignItems: 'center'
},
cont_mian: {
flex: 1,
justifyContent: 'center',
position: 'relative'
},
cont_inner: {
position: 'absolute',
left: 0,
top: pxHeight(196),
width: Width() - 60,
flex: 1,
flexDirection: 'column',
backgroundColor: foundation_color,
height: pxHeight(400),
borderRadius: 10,
marginHorizontal: 30,
marginVertical: 20,
paddingTop: 30,
paddingBottom: 60,
paddingHorizontal: 20
},
cont_tit_box: {
height: 20
},
cont_tit: {
color: promary_text_color,
fontSize: 20,
fontFamily: font_family_semibold
},
cont_cell: {
height: 45,
// borderWidth: 1,
// borderColor: '#FF0000',
flexDirection: 'row',
alignItems: 'center',
borderRadius: 100,
paddingHorizontal: 12,
backgroundColor: '#EFEFEF',
marginTop: 30
},
input_head: {
fontSize: 14,
fontFamily: font_family_semibold,
color: promary_text_color
},
cell_inp_txt: {
paddingLeft: 4,
fontFamily: font_family_regular,
fontSize: 14,
color: first_text_color,
width: '80%'
},
err_input_box: {
paddingLeft: 10,
paddingTop: 4
},
err_input:{
fontSize: 14,
fontFamily: font_family_regular,
color: '#FF0000'
},
cont_footer: {
flex: 1,
justifyContent: 'flex-end'
},
sub_btn_box: {
width: '100%',
height: 38,
backgroundColor: btn_sub_color,
borderRadius: 20,
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
shadowColor: btn_sub_color,
shadowOffset: {
width: 1,
height: 2
},
shadowOpacity: 1,
elevation: 2,
borderWidth: 0
},
sub_tit: {
color: title_text_color,
fontSize: second_text_size
}
})
export default FillDomainModel;
\ No newline at end of file
...@@ -1020,8 +1020,9 @@ class EquipConsuPage extends Component { ...@@ -1020,8 +1020,9 @@ class EquipConsuPage extends Component {
access_token: props.token, access_token: props.token,
path: state.audioPath path: state.audioPath
} }
let {global_domain_config} = props
console.log('---handleSubmit--',params) console.log('---handleSubmit--',params)
let audioResult = await requestQuickAudio(params); let audioResult = await requestQuickAudio(global_domain_config, params);
console.log('返回---audioResult======',audioResult) console.log('返回---audioResult======',audioResult)
that.changeSubLoding(true, '上传中') that.changeSubLoding(true, '上传中')
if(audioResult.error_code == 0) { if(audioResult.error_code == 0) {
...@@ -1540,7 +1541,8 @@ const mapStateToProps = (state) => { ...@@ -1540,7 +1541,8 @@ const mapStateToProps = (state) => {
loginState: state.login.loginState, loginState: state.login.loginState,
quick_list_status: state.quick.quick_list_status, quick_list_status: state.quick.quick_list_status,
submit_quick_order_status: state.quick.submit_quick_order_status, submit_quick_order_status: state.quick.submit_quick_order_status,
quickOrderOption: state.quick.quickOrderOption quickOrderOption: state.quick.quickOrderOption,
global_domain_config: state.login.global_domain_config
} }
} }
...@@ -1558,9 +1560,9 @@ const mapDispatchToProps = (dispatch) => { ...@@ -1558,9 +1560,9 @@ const mapDispatchToProps = (dispatch) => {
requestQuickTemplateCollect: (params) => { requestQuickTemplateCollect: (params) => {
dispatch(requestQuickTemplateCollect(params)) dispatch(requestQuickTemplateCollect(params))
}, },
requestQuickAudio: (params) => { // requestQuickAudio: (params) => {
dispatch(requestQuickAudio(params)) // dispatch(requestQuickAudio(params))
}, // },
requestQuickSumbit: (params) => { requestQuickSumbit: (params) => {
dispatch(requestQuickSumbit(params)) dispatch(requestQuickSumbit(params))
}, },
......
import {BaseUrl, BaseUrlOther, VERSION} from '../base/BaseConstants'; // import {BaseUrl, BaseUrlOther, VERSION} from '../base/BaseConstants';
// const fetch = require("node-fetch"); import {VERSION} from '../base/BaseConstants';
//post方式请求 //post方式请求
export const PostRequest = (url, paramsObject) => { export const PostRequest = (BaseUrl, url, paramsObject) => {
const opts = { const opts = {
method: 'POST', method: 'POST',
headers: { headers: {
...@@ -24,7 +24,7 @@ export const PostRequest = (url, paramsObject) => { ...@@ -24,7 +24,7 @@ export const PostRequest = (url, paramsObject) => {
//get方式请求 //get方式请求
export const GetRequest = (url) => { export const GetRequest = (BaseUrl, url) => {
const opts = { const opts = {
method: 'GET', method: 'GET',
headers: { headers: {
...@@ -32,16 +32,7 @@ export const GetRequest = (url) => { ...@@ -32,16 +32,7 @@ export const GetRequest = (url) => {
}, },
timeout: 20000 //20s超时 timeout: 20000 //20s超时
}; };
return fetch(BaseUrl + VERSION + url, opts)
let endBashUrl = BaseUrl
if(!url.includes('/authorized_inventory/search')) {
endBashUrl = BaseUrlOther
}
let allUrl = endBashUrl + VERSION + url
// console.warn('---allUrl--=================--', allUrl)
// return fetch(BaseUrl + VERSION + url, opts)
return fetch(allUrl, opts)
.then(response => response.json()) .then(response => response.json())
.then(data => data) .then(data => data)
.catch(error => { .catch(error => {
...@@ -50,7 +41,7 @@ export const GetRequest = (url) => { ...@@ -50,7 +41,7 @@ export const GetRequest = (url) => {
}; };
//上传 //上传
export const UploadRequest = (url,datas) => { export const UploadRequest = (BaseUrl, url,datas) => {
const opts = { const opts = {
method: 'POST', method: 'POST',
body: datas, body: datas,
...@@ -64,7 +55,6 @@ export const UploadRequest = (url,datas) => { ...@@ -64,7 +55,6 @@ export const UploadRequest = (url,datas) => {
.then(response => response.json()) .then(response => response.json())
.then(data => data) .then(data => data)
.catch(error => { .catch(error => {
console.log('error--------------------',error, Object.keys(error))
return {error_code: -3, error_msg:'请求异常,请重试'} return {error_code: -3, error_msg:'请求异常,请重试'}
}) })
}; };
\ No newline at end of file
...@@ -5,7 +5,8 @@ import { ...@@ -5,7 +5,8 @@ import {
LOGIN_FAILURE, LOGIN_FAILURE,
EXIT_LOGIN, EXIT_LOGIN,
AUTO_LOGIN_SUCCESS, AUTO_LOGIN_SUCCESS,
AUTO_LOGIN_FAILURE AUTO_LOGIN_FAILURE,
SET_DOMAIN_CONFIGURATE
} from '../../base/ActionTypes'; } from '../../base/ActionTypes';
// 登录状态 // 登录状态
...@@ -14,7 +15,8 @@ const defaultState = { ...@@ -14,7 +15,8 @@ const defaultState = {
userInfo:{}, // 保存用户信息 userInfo:{}, // 保存用户信息
token:null, token:null,
username:'', username:'',
password:'' password:'',
global_domain_config: 'https://obs.uat.guke.tech', // 默认【深圳仓】;【十方】https://obs.uat.sfrx.guke.tech
} }
export default login = (state = defaultState, action) => { export default login = (state = defaultState, action) => {
...@@ -52,6 +54,10 @@ export default login = (state = defaultState, action) => { ...@@ -52,6 +54,10 @@ export default login = (state = defaultState, action) => {
return Object.assign({}, state, { return Object.assign({}, state, {
loginState: LOGIN_FAILURE loginState: LOGIN_FAILURE
}); });
case SET_DOMAIN_CONFIGURATE:
return Object.assign({}, state, {
global_domain_config: action.global_domain_config
})
default: // need this for default case default: // need this for default case
return state return state
} }
......
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