feat(medications): 添加AI用药分析功能
- 集成流式AI分析接口,支持实时展示分析结果 - 添加VIP权限校验和会员弹窗引导 - 使用Markdown渲染AI分析内容 - 优化底部按钮布局,AI分析按钮占2/3宽度 - 支持请求取消和错误处理 - 自动滚动到分析结果区域 - InfoCard组件优化,图标、标签和箭头排列在同一行
This commit is contained in:
@@ -31,26 +31,21 @@ export const InfoCard: React.FC<InfoCardProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
// 渲染箭头 - 只在可点击时显示
|
||||
const renderArrow = () => {
|
||||
if (!clickable) return null;
|
||||
|
||||
return (
|
||||
<View style={styles.infoCardArrow}>
|
||||
<Ionicons name="chevron-forward" size={16} color={colors.textMuted} />
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
// 卡片内容
|
||||
// 卡片内容 - icon、label 和箭头在同一行
|
||||
const cardContent = (
|
||||
<View style={[
|
||||
styles.infoCard,
|
||||
{ backgroundColor: colors.surface || '#fff' }
|
||||
]}>
|
||||
{renderArrow()}
|
||||
{renderIcon()}
|
||||
<Text style={[styles.infoCardLabel, { color: colors.textSecondary }]}>{label}</Text>
|
||||
<View style={styles.header}>
|
||||
{renderIcon()}
|
||||
<Text style={[styles.infoCardLabel, { color: colors.textSecondary }]}>{label}</Text>
|
||||
{clickable && (
|
||||
<View style={styles.infoCardArrow}>
|
||||
<Ionicons name="chevron-forward" size={16} color={colors.textMuted} />
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
<Text style={[styles.infoCardValue, { color: colors.text }]}>{value}</Text>
|
||||
</View>
|
||||
);
|
||||
@@ -85,14 +80,11 @@ const styles = StyleSheet.create({
|
||||
borderRadius: 20,
|
||||
padding: 16,
|
||||
backgroundColor: '#FFFFFF',
|
||||
gap: 6,
|
||||
gap: 8,
|
||||
position: 'relative',
|
||||
},
|
||||
infoCardArrow: {
|
||||
position: 'absolute',
|
||||
top: 12,
|
||||
right: 12,
|
||||
zIndex: 1,
|
||||
marginLeft: 'auto',
|
||||
width: 24,
|
||||
height: 24,
|
||||
borderRadius: 12,
|
||||
@@ -106,10 +98,14 @@ const styles = StyleSheet.create({
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
header: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
gap: 4,
|
||||
},
|
||||
infoCardLabel: {
|
||||
fontSize: 13,
|
||||
color: '#6B7280',
|
||||
marginTop: 8,
|
||||
},
|
||||
infoCardValue: {
|
||||
fontSize: 14,
|
||||
|
||||
Reference in New Issue
Block a user