me-menu.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <view class="">
  3. <view class="mx-30">
  4. <view class="mt-40 text-30 text-fore-title font-bold mb-16">常用功能</view>
  5. <view class="shadow-card rounded-8 py-20 grid grid-cols-4 bg-white">
  6. <view v-for="item in menus" :key="item.name" class="flex flex-col items-center" @click="handleClick(item)">
  7. <ie-image :src="item.icon" custom-class="w-70 h-70 rounded-full" />
  8. <view class="mt-10 text-28 text-fore-subtitle">{{ item.name }}</view>
  9. </view>
  10. </view>
  11. <view class="mt-40 text-30 text-fore-title font-bold">其他功能</view>
  12. <view class="mt-16 shadow-card rounded-8 bg-white overflow-hidden">
  13. <uv-cell-group :border="false">
  14. <uv-cell isLink :cellStyle="cellStyle"
  15. @click="handleNavigate('/pagesSystem/pages/edit-profile/edit-profile', '基本资料')">
  16. <template #title>
  17. <view class="flex items-center gap-x-10">
  18. <ie-image src="/static/personal/icon-profile.png" custom-class="w-34 h-34" />
  19. <text class="text-30 text-fore-subtitle">基本资料</text>
  20. </view>
  21. </template>
  22. </uv-cell>
  23. <uv-cell isLink :cellStyle="cellStyle" @click="handleQuestion" :border="true">
  24. <template #title>
  25. <view class="flex items-center gap-x-10">
  26. <uv-icon name="question-circle" size="32rpx" color="#888888" />
  27. <text class="text-30 text-fore-subtitle">常见问题</text>
  28. </view>
  29. </template>
  30. </uv-cell>
  31. <uv-cell isLink :cellStyle="cellStyle" @click="handlePhone" :border="false">
  32. <template #title>
  33. <view class="flex items-center gap-x-10">
  34. <uv-icon name="phone" size="34rpx" color="#888888" />
  35. <text class="text-30 text-fore-subtitle">客服电话</text>
  36. </view>
  37. </template>
  38. <template #value>
  39. <text class="text-30 text-fore-subtitle">{{ contactPhone }}</text>
  40. </template>
  41. </uv-cell>
  42. </uv-cell-group>
  43. </view>
  44. </view>
  45. <view v-if="userStore.isLogin" class="mt-80 mb-40 px-30">
  46. <ie-button type="primary" custom-class="w-full" @click="handleLogout">退出登陆</ie-button>
  47. </view>
  48. </view>
  49. </template>
  50. <script lang="ts" setup>
  51. import { useTransferPage } from '@/hooks/useTransferPage';
  52. import { useUserStore } from '@/store/userStore';
  53. import config from '@/config';
  54. const { transferTo, routes } = useTransferPage();
  55. const userStore = useUserStore();
  56. const contactPhone = computed(() => userStore.orgInfo.contactPhone);
  57. type MenuItem = {
  58. name: string;
  59. icon: string;
  60. pagePath: string;
  61. };
  62. const menus = [
  63. {
  64. name: '测评报告',
  65. icon: '/static/personal/test_report.png',
  66. pagePath: '/pagesOther/pages/test-center/list/list',
  67. },
  68. {
  69. name: '我的收藏',
  70. icon: '/static/personal/my_collected.png',
  71. pagePath: routes.pageCollect,
  72. },
  73. {
  74. name: '我的志愿表',
  75. icon: '/static/personal/my_simulated.png',
  76. pagePath: routes.voluntaryList,
  77. },
  78. {
  79. name: '绑定会员卡',
  80. icon: '/static/personal/bind_card.png',
  81. pagePath: routes.pageCardVerify,
  82. }
  83. ];
  84. const cellStyle = {
  85. padding: '30rpx 30rpx'
  86. }
  87. const handleClick = async (item: MenuItem) => {
  88. const isLogin = await userStore.checkLogin();
  89. if (isLogin) {
  90. if (item.name === '绑定会员卡' && userStore.isVip) {
  91. uni.$ie.showToast('您已是会员');
  92. return;
  93. }
  94. transferTo(item.pagePath);
  95. }
  96. }
  97. const handleNavigate = async (pagePath: string, title: string) => {
  98. const isLogin = await userStore.checkLogin();
  99. if (isLogin) {
  100. transferTo(pagePath, {
  101. data: {
  102. settingName: title
  103. }
  104. });
  105. }
  106. }
  107. const handleQuestion = async () => {
  108. transferTo(routes.pageWebview, {
  109. data: {
  110. title: '常见问题',
  111. url: config.faqUrl
  112. }
  113. });
  114. }
  115. const handleLogout = async () => {
  116. const confirm = await userStore.askLogout();
  117. if (confirm) {
  118. }
  119. }
  120. const handlePhone = async () => {
  121. userStore.callContactPhone();
  122. }
  123. </script>
  124. <style lang="scss" scoped></style>