import { PlusOperateForm, PlusCommonWidget, PlusOperatePage, PlusCommonEvent } from '../../main/index'; import { Platform, NetInfo } from 'react-native'; /** * 顶级操作类 该类由uhutucli项目维护并自动生成 请勿修改 * * @export * @class TopSupport */ export default class { static msgAlert(sMessage) { PlusCommonWidget.msgAlert(sMessage); } /** * 打开一个链接对象 * * @static * @param {any} sUrl */ static openUrl(sUrl) { PlusCommonWidget.openUrl(sUrl); } /** * 页面跳转 * * @static * @param {any} sPage * @param {any} that */ static pageNav(sPage, that) { //that.props.navigation.navigate(sPage); PlusOperatePage.pageNaviger(that, sPage); } /** * 返回上一页 * * @static * @param {any} that */ static pageBack(that) { this.pageNav('?base_jump=back', that); } /** * 判断是否android * * @static * @returns */ static upFLagAndroid() { return Platform.OS === 'android'; } static NetConnectDone(fCallBack) { /* NetInfo.isConnected.fetch().done((isConnected) => { fCallBack(isConnected); }); */ return NetInfo.fetch().then((reach) => { this.msgAlert(reach); return reach.toLowerCase() != "none"; }); } /** * 初始化一个页面 * * @static * @param {any} that * @param {any} oPageProperty */ static initPage(that, oPageProperty) { if (oPageProperty.formNames != undefined) { this.initForm(that, oPageProperty.formNames.join(',')); } } /** * 初始化一个form对象 * * @static * @param {any} that * @param {any} sFormName */ static initForm(that, sFormName) { PlusOperateForm.initPageForm({ formName: sFormName, formPage: PlusOperatePage.upNavigerValue(that, 'url') }); } /** * 设置state的值 * * @static * @param {any} that * @param {any} oState */ static topState(that, oState) { that.setState(oState); } /** * 修改注册监听对象的值 * * @static * @param {any} sSubscribeName * @param {any} sValue */ static changeSubscribeValue(sSubscribeName, sValue) { PlusCommonEvent.noticeSubscribeUpdate(sSubscribeName, { eventValue: sValue }); } /** * 获取form的值 * * @static * @param {any} sFormName * @param {any} sFieldName * @returns */ static upFormValue(sFormName, sFieldName) { return PlusOperateForm.upFormValue(PlusOperateForm.upItemName(sFormName, sFieldName)); } /** * 获取url信息 * * @static * @param {any} that * @returns */ static upUrlInfo(that) { return PlusOperatePage.upUrlInfo(undefined, that); } }