WXL
3 天以前 9bce51f651aad297ef9eb6df832bfdaf1de05d84
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
<template>
  <view class="my-container">
    <!-- 用户信息卡片 -->
    <view class="user-card">
      <view class="user-info" @tap="navigateTo('/pages/my/profile')">
        <image src="@/static/avatar/default.png" mode="aspectFill" class="avatar" />
        <view class="info">
          <text class="name">{{ userInfo.name }}</text>
          <text class="id">就诊卡号:{{ userInfo.cardNo }}</text>
        </view>
      </view>
      <view class="vip-info" @tap="navigateTo('/pages/my/vip')">
        <text class="level">{{ userInfo.vipLevel }}</text>
        <text class="desc">查看会员权益 ></text>
      </view>
    </view>
 
    <!-- 快速入口 -->
    <view class="quick-access">
      <view
        class="access-item"
        v-for="(item, index) in quickAccess"
        :key="index"
        @tap="navigateTo(item.path)"
      >
        <text class="count">{{ item.count }}</text>
        <text class="label">{{ item.label }}</text>
      </view>
    </view>
 
    <!-- 功能列表 -->
    <view class="function-list">
      <view class="section" v-for="(section, idx) in functionList" :key="idx">
        <text class="section-title" v-if="section.title">{{
          section.title
        }}</text>
        <view class="menu-list">
          <view
            class="menu-item"
            v-for="(item, index) in section.items"
            :key="index"
            @tap="navigateTo(item.path)"
          >
            <view class="left">
              <text class="iconfont" :class="item.icon"></text>
              <text class="label">{{ item.label }}</text>
            </view>
            <view class="right">
              <text class="value" v-if="item.value">{{ item.value }}</text>
              <text class="tag" v-if="item.tag">{{ item.tag }}</text>
              <text class="iconfont icon-arrow-right"></text>
            </view>
          </view>
        </view>
      </view>
    </view>
 
    <!-- 退出登录 -->
    <view class="logout-btn" @tap="handleLogout"> 退出登录 </view>
  </view>
</template>
 
<script setup>
import { ref } from "vue";
 
// 用户信息
const userInfo = ref({
  name: "小毛🥚",
  avatar: "@/static/avatar/default.png",
  cardNo: "1234567890",
  vipLevel: "VIP 99",
});
 
// 快速入口
const quickAccess = ref([
  { label: "待就诊", count: 1, path: "/pages/appointment/record" },
  { label: "待付款", count: 2, path: "/pages/payment/record" },
  { label: "待评价", count: 3, path: "/pages/my/reviews" },
  { label: "优惠券", count: 5, path: "/pages/my/coupons" },
]);
 
// 功能列表
const functionList = ref([
  {
    title: "就医服务",
    items: [
      {
        label: "挂号记录",
        icon: "icon-record",
        path: "/pages/appointment/record",
      },
      {
        label: "缴费记录",
        icon: "icon-payment",
        path: "/pages/payment/record",
      },
      {
        label: "就医记录",
        icon: "icon-medical",
        path: "/pages/records/medical",
      },
      {
        label: "就诊人管理",
        icon: "icon-contacts",
        path: "/pages/patient/list",
        value: "已添加3人",
      },
    ],
  },
  {
    title: "健康服务",
    items: [
      {
        label: "健康档案",
        icon: "icon-health",
        path: "/pages/my/health-records",
      },
      {
        label: "检查报告",
        icon: "icon-report",
        path: "/pages/records/reports",
        tag: "新",
      },
    ],
  },
  {
    title: "账户设置",
    items: [
      {
        label: "实名认证",
        icon: "icon-verify",
        path: "/pages/my/verify",
        value: "已认证",
      },
      {
        label: "支付方式",
        icon: "icon-wallet",
        path: "/pages/my/payment-method",
      },
      {
        label: "消息通知",
        icon: "icon-notification",
        path: "/pages/my/notification",
      },
    ],
  },
  {
    items: [
      {
        label: "客服中心",
        icon: "icon-service",
        path: "/pages/my/service",
      },
      {
        label: "设置",
        icon: "icon-settings",
        path: "/pages/my/settings",
      },
    ],
  },
]);
 
// 页面跳转
const navigateTo = (url) => {
  uni.navigateTo({
    url,
    fail: (err) => {
      console.error("导航失败:", err);
      // 如果导航失败,尝试使用 redirectTo
      uni.redirectTo({
        url,
        fail: (err2) => {
          console.error("重定向失败:", err2);
        },
      });
    },
  });
};
 
// 退出登录
const handleLogout = () => {
  uni.showModal({
    title: "提示",
    content: "确定要退出登录吗?",
    success: (res) => {
      if (res.confirm) {
        // 清除登录状态
        uni.clearStorageSync();
        // 跳转到登录页
        uni.reLaunch({
          url: "/pages/login/index",
        });
      }
    },
  });
};
</script>
 
<style lang="scss">
.my-container {
  min-height: 100vh;
  background: $bg-color;
  padding-bottom: 40rpx;
 
  .user-card {
    background: $primary-gradient;
    padding: 40rpx 30rpx;
    display: flex;
    justify-content: space-between;
    align-items: center;
 
    .user-info {
      display: flex;
      align-items: center;
 
      .avatar {
        width: 120rpx;
        height: 120rpx;
        border-radius: 50%;
        border: 4rpx solid rgba(255, 255, 255, 0.3);
        margin-right: 20rpx;
      }
 
      .info {
        .name {
          font-size: 36rpx;
          color: #fff;
          font-weight: bold;
          margin-bottom: 8rpx;
          display: block;
        }
 
        .id {
          font-size: 26rpx;
          color: rgba(255, 255, 255, 0.9);
        }
      }
    }
 
    .vip-info {
      text-align: right;
 
      .level {
        font-size: 32rpx;
        color: #fff;
        font-weight: bold;
        margin-bottom: 8rpx;
        display: block;
      }
 
      .desc {
        font-size: 24rpx;
        color: rgba(255, 255, 255, 0.9);
      }
    }
  }
 
  .quick-access {
    margin: -40rpx 20rpx 0;
    background: #fff;
    border-radius: $radius-lg;
    padding: 30rpx;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20rpx;
    box-shadow: $shadow-sm;
 
    .access-item {
      text-align: center;
 
      .count {
        font-size: 36rpx;
        color: $primary-color;
        font-weight: bold;
        margin-bottom: 8rpx;
        display: block;
      }
 
      .label {
        font-size: 26rpx;
        color: $text-regular;
      }
    }
  }
 
  .function-list {
    margin-top: 20rpx;
 
    .section {
      margin-bottom: 20rpx;
 
      .section-title {
        font-size: 28rpx;
        color: $text-secondary;
        padding: 20rpx 30rpx;
      }
 
      .menu-list {
        background: #fff;
 
        .menu-item {
          display: flex;
          justify-content: space-between;
          align-items: center;
          padding: 30rpx;
          border-bottom: 1rpx solid #eee;
 
          &:last-child {
            border-bottom: none;
          }
 
          .left {
            display: flex;
            align-items: center;
 
            .iconfont {
              font-size: 40rpx;
              color: $primary-color;
              margin-right: 20rpx;
            }
 
            .label {
              font-size: 30rpx;
              color: $text-primary;
            }
          }
 
          .right {
            display: flex;
            align-items: center;
 
            .value {
              font-size: 26rpx;
              color: $text-secondary;
              margin-right: 12rpx;
            }
 
            .tag {
              font-size: 22rpx;
              color: $primary-color;
              background: $primary-light;
              padding: 4rpx 12rpx;
              border-radius: $radius-sm;
              margin-right: 12rpx;
            }
 
            .icon-arrow-right {
              font-size: 24rpx;
              color: $text-secondary;
            }
          }
 
          &:active {
            background: darken(#fff, 2%);
          }
        }
      }
    }
  }
 
  .logout-btn {
    margin: 40rpx 30rpx;
    height: 88rpx;
    line-height: 88rpx;
    text-align: center;
    font-size: 30rpx;
    color: $danger;
    background: #fff;
    border-radius: $radius-lg;
 
    &:active {
      background: darken(#fff, 2%);
    }
  }
}
</style>