import React from 'react'; import { View, Text } from '@tarojs/components'; import Taro, { useDidShow } from '@tarojs/taro'; import { useAuthStore } from '../../stores/auth'; import { usePointsStore } from '../../stores/points'; import './index.scss'; const MENU_ITEMS = [ { label: '็งฏๅˆ†ๅ•†ๅŸŽ', icon: '๐ŸŽ', bg: '#FDEAEA' }, { label: 'ๆˆ‘็š„่ฎขๅ•', icon: '๐Ÿ“ฆ', bg: '#E8F0F8' }, { label: 'ๅฐฑ่ฏŠไบบ็ฎก็†', icon: '๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘ง', bg: '#F0DDD4' }, { label: 'ๆˆ‘็š„ๆŠฅๅ‘Š', icon: '๐Ÿ“„', bg: '#E8F0E8' }, { label: 'ๅฅๅบท่ฎฐๅฝ•', icon: '๐Ÿ“', bg: '#E8F0F8' }, { label: '่ฏŠๆ–ญ่ฎฐๅฝ•', icon: '๐Ÿ“‹', bg: '#E8F0E8' }, { label: 'ๆˆ‘็š„้š่ฎฟ', icon: '๐Ÿฅ', bg: '#F3E8F8' }, { label: '็”จ่ฏๆ้†’', icon: '๐Ÿ’Š', bg: '#FFF3E0' }, { label: '้€ๆž่ฎฐๅฝ•', icon: '๐Ÿ’‰', bg: '#E8F0F8' }, { label: '้€ๆžๅค„ๆ–น', icon: '๐Ÿ’Š', bg: '#E8F0E8' }, { label: '็Ÿฅๆƒ…ๅŒๆ„', icon: '๐Ÿ“‹', bg: '#F3E8F8' }, { label: '็งฏๅˆ†ๆ˜Ž็ป†', icon: '๐Ÿ“Š', bg: '#F0DDD4' }, { label: '่ฎพ็ฝฎ', icon: 'โš™๏ธ', bg: '#f0f0f0' }, ]; const MENU_PATHS: Record = { '็งฏๅˆ†ๅ•†ๅŸŽ': '/pages/mall/index', 'ๆˆ‘็š„่ฎขๅ•': '/pages/pkg-mall/orders/index', '็งฏๅˆ†ๆ˜Ž็ป†': '/pages/pkg-mall/detail/index', 'ๅฐฑ่ฏŠไบบ็ฎก็†': '/pages/pkg-profile/family/index', 'ๆˆ‘็š„ๆŠฅๅ‘Š': '/pages/pkg-profile/reports/index', 'ๅฅๅบท่ฎฐๅฝ•': '/pages/pkg-profile/health-records/index', '่ฏŠๆ–ญ่ฎฐๅฝ•': '/pages/pkg-profile/diagnoses/index', 'ๆˆ‘็š„้š่ฎฟ': '/pages/pkg-profile/followups/index', '็”จ่ฏๆ้†’': '/pages/pkg-profile/medication/index', '้€ๆž่ฎฐๅฝ•': '/pages/pkg-profile/dialysis-records/index', '้€ๆžๅค„ๆ–น': '/pages/pkg-profile/dialysis-prescriptions/index', '็Ÿฅๆƒ…ๅŒๆ„': '/pages/pkg-profile/consents/index', '่ฎพ็ฝฎ': '/pages/pkg-profile/settings/index', }; export default function Profile() { const { user, logout } = useAuthStore(); const { account: pointsAccount, checkinStatus: checkinInfo, refresh: refreshPoints } = usePointsStore(); useDidShow(() => { refreshPoints(); }); const handleMenuClick = (label: string) => { const path = MENU_PATHS[label]; if (path) Taro.navigateTo({ url: path }); }; const handleLogout = () => { Taro.showModal({ title: '้€€ๅ‡บ็™ปๅฝ•', content: '็กฎๅฎš่ฆ้€€ๅ‡บ็™ปๅฝ•ๅ—๏ผŸ', }).then((res) => { if (res.confirm) { logout(); } }); }; return ( {/* ็”จๆˆทไฟกๆฏๅก็‰‡ */} ๐Ÿ‘ค {user?.display_name || 'ๆœช็™ปๅฝ•'} {user?.phone || ''} {/* ็งฏๅˆ† + ๆ‰“ๅก โ€” ไธคไธช็‹ฌ็ซ‹ๅก็‰‡ๅนถๆŽ’ */} {(pointsAccount?.balance ?? 0).toLocaleString()} ๅฅๅบท็งฏๅˆ† {checkinInfo?.consecutive_days ?? 0}ๅคฉ ่ฟž็ปญๆ‰“ๅก {/* ่œๅ• */} {MENU_ITEMS.map((item) => ( handleMenuClick(item.label)} > {item.icon} {item.label} โ€บ ))} {/* ้€€ๅ‡บ็™ปๅฝ• */} ้€€ๅ‡บ็™ปๅฝ• ); }