refactor(mp): E3-2 大文件拆分 + U3-2 微交互统一
E3-2 大文件拆分(3 文件 → 6 文件): - daily-monitoring 449L → useDailyMonitoring.ts hook(238L) + 页面(255L) - request.ts 376L → cache.ts(75L) + limiter.ts(32L) + 主文件(278L) - BLEManager.ts 363L → BLEConnection.ts(212L) + 主文件(228L) U3-2 微交互统一: - 新增 haptic.ts 工具(light/medium/heavy 三级触觉反馈) - PrimaryButton 点击触发 hapticLight() - tokens.scss 新增 5 个动画时序 token(duration/easing) - mixins.scss 新增 fade-in() mixin(支持 fast/normal/slow 三档)
This commit is contained in:
22
apps/miniprogram/src/utils/haptic.ts
Normal file
22
apps/miniprogram/src/utils/haptic.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import Taro from '@tarojs/taro';
|
||||
|
||||
/** 轻触反馈(按钮点击) */
|
||||
export function hapticLight(): void {
|
||||
try {
|
||||
Taro.vibrateShort({ type: 'light' });
|
||||
} catch { /* 部分设备不支持 */ }
|
||||
}
|
||||
|
||||
/** 中等反馈(成功操作) */
|
||||
export function hapticMedium(): void {
|
||||
try {
|
||||
Taro.vibrateShort({ type: 'medium' });
|
||||
} catch { /* ignore */ }
|
||||
}
|
||||
|
||||
/** 重度反馈(错误/警告) */
|
||||
export function hapticHeavy(): void {
|
||||
try {
|
||||
Taro.vibrateShort({ type: 'heavy' });
|
||||
} catch { /* ignore */ }
|
||||
}
|
||||
Reference in New Issue
Block a user