fix(mp): 行业标准第二轮审计修复 — 安全存储+UX+合规
- 安全:AI聊天历史、患者档案、设备同步数据统一走 secureSet/secureGet 加密存储 - 合规:TabBar "消息" 改为 "助手" 消除命名误导 - 合规:新增 .env.production 模板配置 HTTPS API URL - UX:AI发送按钮 40→44px、反馈按钮 32→44px、协议勾选框 44px 点击热区 - UX:5处硬编码 10-12px 字号替换为 design token(DoctorTabBar/ShortcutButton/TodoAlert/mall) - UX:6处安全区域写法统一(全部使用 --tk-page-padding/--tk-tabbar-space + env fallback) - 新增 safe-bottom-padded / safe-bottom-tabbar 两个 mixin Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { api } from './request';
|
||||
import { secureGet, secureSet } from '@/utils/secure-storage';
|
||||
|
||||
export interface AiChatMessage {
|
||||
id: string;
|
||||
@@ -74,10 +75,10 @@ export async function closeSession(sessionId: string): Promise<void> {
|
||||
await api.post(`/ai/chat/sessions/${sessionId}/close`, {});
|
||||
}
|
||||
|
||||
/** 获取聊天历史(本地缓存) */
|
||||
/** 获取聊天历史(本地加密缓存) */
|
||||
export function getLocalHistory(): AiChatMessage[] {
|
||||
try {
|
||||
const raw = wx.getStorageSync('ai_chat_history');
|
||||
const raw = secureGet('ai_chat_history');
|
||||
return raw ? JSON.parse(raw) : [];
|
||||
} catch (err) {
|
||||
console.warn('[ai-chat] 读取本地聊天历史失败:', err);
|
||||
@@ -85,9 +86,9 @@ export function getLocalHistory(): AiChatMessage[] {
|
||||
}
|
||||
}
|
||||
|
||||
/** 保存聊天历史到本地 */
|
||||
/** 保存聊天历史到本地(加密存储) */
|
||||
export function saveLocalHistory(messages: AiChatMessage[]): void {
|
||||
try {
|
||||
wx.setStorageSync('ai_chat_history', JSON.stringify(messages.slice(-100)));
|
||||
secureSet('ai_chat_history', JSON.stringify(messages.slice(-100)));
|
||||
} catch (err) { console.warn('[ai-chat] 保存本地聊天历史失败:', err); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user