feat(app): 添加版本更新模拟功能并优化主界面

- 在 MainViewScreen 中添加应用更新模拟按钮
- 增加基础包版本号和更新提示功能
- 优化小程序跳转界面布局- 在医院和医网签小程序中添加版本号显示
这个提交包含在:
xuqm 2025-07-22 16:03:22 +08:00
父节点 c8840ac185
当前提交 06cc7cbb85
共有 7 个文件被更改,包括 112 次插入24 次删除

查看文件

@ -0,0 +1,10 @@
import type { TurboModule } from 'react-native';
import { TurboModuleRegistry } from 'react-native';
export interface Spec extends TurboModule {
update(name: string): void;
}
export default TurboModuleRegistry.getEnforcing<Spec>(
'NavigationManager',
) as Spec;

查看文件

@ -1,36 +1,97 @@
import React from 'react'; import React from 'react';
import { Button, StyleSheet, View } from 'react-native'; import {
Button,
Linking,
Platform,
ScrollView,
StyleSheet,
Text,
View,
} from 'react-native';
import { StackScreenProps } from '@react-navigation/stack'; import { StackScreenProps } from '@react-navigation/stack';
import { MainParamList } from '@app/routes/MainParamList'; import { MainParamList } from '@app/routes/MainParamList';
import { Apps, NavigationPushByName } from '@common/NavigationHelper.ts'; import { Apps, NavigationPushByName } from '@common/NavigationHelper.ts';
import { showMessage } from '@common/ToastHelper.ts'; import { showMessage } from '@common/ToastHelper.ts';
import Alert from '@common/components/Alert.tsx';
import { version_common } from '@common/common.ts';
type Props = StackScreenProps<MainParamList, 'MainView'>; type Props = StackScreenProps<MainParamList, 'MainView'>;
export default function WebViewScreen(props: Props) { export default function WebViewScreen(props: Props) {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<View style={{ height: 100 }} /> <ScrollView>
<Button <>
title={'进入互联网医院'} <Text style={{ fontSize: 20, marginVertical: 15 }}>
onPress={() => {
NavigationPushByName(Apps.Hospital, {}); </Text>
}} <Button
/> title={'进入互联网医院'}
<View style={{ height: 15 }} /> onPress={() => {
<Button NavigationPushByName(Apps.Hospital, {});
title={'进入医网签'} }}
onPress={() => { />
NavigationPushByName(Apps.Ywq, {}); <View style={{ height: 15 }} />
}} <Button
/> title={'进入医网签'}
<View style={{ height: 15 }} /> onPress={() => {
<Button NavigationPushByName(Apps.Ywq, {});
title={'Toast'} }}
onPress={() => { />
showMessage('APP页面弹出toast'); <View style={{ height: 15 }} />
}} <Button
/> title={'Toast'}
onPress={() => {
showMessage('APP页面弹出toast');
}}
/>
<View style={{ height: 45 }} />
<Button
title={'应用更新模拟'}
onPress={() => {
Alert.show(
'提示',
<Text style={styles.alertText}>
,
</Text>,
{
action: () => {
if (Platform.OS === 'ios') {
Linking.openURL(
'https://apps.apple.com/cn/app/%E5%8C%BB%E7%BD%91%E4%BF%A1/id1074200788',
);
return;
}
Linking.openURL('https://www.51trust.com/download.html/');
},
},
{
action: () => {},
},
);
}}
/>
<View style={{ height: 45 }} />
<Text>{version_common}</Text>
<Button
title={'基础包前台更新'}
onPress={() => {
Alert.show(
'提示',
<Text style={styles.alertText}>
,
</Text>,
{
action: () => {},
},
{
action: () => {},
},
);
}}
/>
</>
</ScrollView>
</View> </View>
); );
} }
@ -39,4 +100,9 @@ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
}, },
alertText: {
textAlign: 'center',
color: '#999999',
fontSize: 12,
},
}); });

查看文件

@ -1,3 +1,6 @@
export const version_common = '1.0.0';
export const version_code = 1;
import 'react'; import 'react';
import 'react-native'; import 'react-native';
import '@react-navigation/native'; import '@react-navigation/native';

查看文件

@ -16,6 +16,7 @@ import {
import { NavigationPop } from '@common/NavigationHelper.ts'; import { NavigationPop } from '@common/NavigationHelper.ts';
import { showMessage } from '@common/ToastHelper.ts'; import { showMessage } from '@common/ToastHelper.ts';
import Toast from 'react-native-toast-message'; import Toast from 'react-native-toast-message';
import { versionName } from '@hospital/hospital.ts';
function HospitalMain() { function HospitalMain() {
const isDarkMode = useColorScheme() === 'dark'; const isDarkMode = useColorScheme() === 'dark';
@ -24,7 +25,7 @@ function HospitalMain() {
<View style={styles.container}> <View style={styles.container}>
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} /> <StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
<View style={{ height: 100 }} /> <View style={{ height: 100 }} />
<Text></Text> <Text>{versionName}</Text>
<Button <Button
title={'返回'} title={'返回'}
onPress={() => { onPress={() => {

查看文件

@ -2,4 +2,7 @@ import { AppRegistry } from 'react-native';
import { Apps } from '@common/NavigationHelper.ts'; import { Apps } from '@common/NavigationHelper.ts';
import HospitalMain from './HospitalMain.tsx'; import HospitalMain from './HospitalMain.tsx';
export const versionName = '1.0.0';
export const versionCode = 1;
AppRegistry.registerComponent(Apps.Hospital, () => HospitalMain); AppRegistry.registerComponent(Apps.Hospital, () => HospitalMain);

查看文件

@ -9,6 +9,7 @@ import {
Button, Button,
StatusBar, StatusBar,
StyleSheet, StyleSheet,
Text,
useColorScheme, useColorScheme,
View, View,
} from 'react-native'; } from 'react-native';
@ -16,6 +17,7 @@ import { showMessage } from '@common/ToastHelper.ts';
import Toast from 'react-native-toast-message'; import Toast from 'react-native-toast-message';
import Alert from '@common/components/Alert.tsx'; import Alert from '@common/components/Alert.tsx';
import { NavigationPop } from '@common/NavigationHelper.ts'; import { NavigationPop } from '@common/NavigationHelper.ts';
import { versionName } from '@ywx/ywq.ts';
function YwqMain() { function YwqMain() {
const isDarkMode = useColorScheme() === 'dark'; const isDarkMode = useColorScheme() === 'dark';
@ -24,6 +26,7 @@ function YwqMain() {
<View style={styles.container}> <View style={styles.container}>
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} /> <StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
<View style={{ height: 100 }} /> <View style={{ height: 100 }} />
<Text>{versionName}</Text>
<Button <Button
title={'onConfirm'} title={'onConfirm'}
onPress={() => { onPress={() => {
@ -42,7 +45,7 @@ function YwqMain() {
}} }}
/> />
<Toast /> <Toast />
<Alert ref={ref => Alert.setRef(ref)} /> {/*<Alert ref={ref => Alert.setRef(ref)} />*/}
</View> </View>
); );
} }

查看文件

@ -2,4 +2,6 @@ import { AppRegistry } from 'react-native';
import YwqMain from './YwqMain.tsx'; import YwqMain from './YwqMain.tsx';
import { Apps } from '@common/NavigationHelper'; import { Apps } from '@common/NavigationHelper';
export const versionName = '1.0.0';
export const versionCode = 1;
AppRegistry.registerComponent(Apps.Ywq, () => YwqMain); AppRegistry.registerComponent(Apps.Ywq, () => YwqMain);