interface FamilyMember {
  avatar: string;
  name: string;
  gender: string;
  birthday: string;
  relation: string;
  bloodType: string;
  allergies: string;
  chronicDiseases: string;
  longTermMeds: string;
  notes: string;
}

const MEMBER_KEY = 'family_member';

Page({
  data: {
    member: {} as FamilyMember,
  },
  onLoad() {},
  onShow() {
    if (typeof this.getTabBar === 'function' && this.getTabBar()) {
      this.getTabBar().setData({ selected: 3 });
    }
    this.loadMember();
  },
  loadMember() {
    const member = wx.getStorageSync(MEMBER_KEY) || {};
    this.setData({ member });
  },
  goEdit() {
    wx.navigateTo({ url: '/pages/tab-bar/profile/edit/index' });
  },
});
