WXL
6 天以前 b76de9a566e4435146a970aa22333a58f87b485b
pages/my/index.vue
@@ -2,26 +2,41 @@
  <view class="my-container">
    <!-- 用户信息卡片 -->
    <view class="user-card">
      <view class="user-info" @tap="navigateTo('/pages/my/profile')">
      <view class="user-info" @tap="navigateTo('/pagesSub/my/profile')">
        <image
          src="@/static/avatar/default.png"
        v-if="userInfo.sex == 1"
          src="@/static/avatar/yisn.jpg"
          mode="aspectFill"
          class="avatar"
        />
        <image
        v-else
          src="@/static/avatar/yisna.jpg"
          mode="aspectFill"
          class="avatar"
        />
        <view class="info">
          <text class="name">{{ userInfo.name }}</text>
          <text class="id">就诊卡号:{{ userInfo.cardNo }}</text>
          <text class="name">{{ userInfo.nickName }}</text>
          <text class="id">账号:{{ userInfo.createBy }}</text>
          <!-- 添加协调员信息 -->
          <text class="coordinator" v-if="userInfo.coordinatorName">
            协调员:{{ userInfo.coordinatorName }}
            <text v-if="userInfo.coordinatorNo"
              >(编号:{{ userInfo.coordinatorNo }})</text
            >
          </text>
        </view>
      </view>
      <view class="vip-info" @tap="navigateTo('/pages/my/vip')">
      <!-- <view class="vip-info" @tap="navigateTo('/pagesSub/my/vip')">
        <text class="level">{{ userInfo.vipLevel }}</text>
        <text class="desc">查看会员权益 ></text>
      </view>
      </view> -->
    </view>
    <!-- 快速入口 -->
    <view class="quick-access">
      <view
      <!-- <view
        class="access-item"
        v-for="(item, index) in quickAccess"
        :key="index"
@@ -29,6 +44,18 @@
      >
        <text class="count">{{ item.count }}</text>
        <text class="label">{{ item.label }}</text>
      </view> -->
      <view class="access-item">
        <text class="count">{{ stats.totalCases }}</text>
        <text class="label">总上报量</text>
      </view>
      <view class="access-item">
        <text class="count">{{ stats.readCases }}</text>
        <text class="label">已阅读</text>
      </view>
      <view class="access-item">
        <text class="count">{{ stats.agreedCases }}</text>
        <text class="label">已同意</text>
      </view>
    </view>
@@ -66,6 +93,9 @@
<script setup>
import { ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { useUserStore } from "@/stores/user";
// 用户信息
const userInfo = ref({
@@ -74,6 +104,13 @@
  cardNo: "1234567890",
  vipLevel: "VIP 99",
});
// 统计数据
const stats = ref({
  totalCases: 0,
  readCases: 0,
  agreedCases: 0,
});
const userStore = useUserStore();
// 快速入口
const quickAccess = ref([
@@ -91,22 +128,22 @@
      {
        label: "上报案例",
        icon: "icon-record",
        path: "/pages/case/CaseDetails",
        path: "/pagesSub/case/CaseDetails",
      },
      {
        label: "我的上报",
        icon: "icon-payment",
        path: "/pages/case/index",
        path: "/pagesSub/case/index",
      },
      {
        label: "转运登记",
        icon: "icon-medical",
        path: "/pages/case/transfer",
        path: "/pagesSub/case/transfer",
      },
      {
        label: "审查记录",
        icon: "icon-contacts",
        path: "/pages/ethicalReview/index",
        path: "/pagesSub/ethicalReview/index",
      },
    ],
  },
@@ -143,7 +180,7 @@
      {
        label: "消息通知",
        icon: "icon-notification",
        path: "/pages/my/notification",
        path: "/pagesSub/my/notification",
      },
    ],
  },
@@ -162,7 +199,11 @@
  //   ],
  // },
]);
onLoad(async () => {
  console.log(userStore.userInfo, "userStore.userInfo");
  userInfo.value = userStore.userInfo;
  await donateTotal();
});
// 页面跳转
const navigateTo = (url) => {
  uni.navigateTo({
@@ -179,7 +220,23 @@
    },
  });
};
// 获取统计数据
const donateTotal = async () => {
  try {
    const res = await uni.$uapi.post("/project/donatebaseinforeport/getTotal");
    if (res.code === 200) {
      stats.value = {
        totalCases: res.data["all"] || 0,
        readCases: res.data["2"] || 0,
        agreedCases: res.data["3"] || 0,
      };
    } else {
      throw new Error(res.msg || "获取统计失败");
    }
  } catch (error) {
    console.error("获取统计数据失败:", error);
  }
};
// 退出登录
const handleLogout = () => {
  uni.showModal({
@@ -236,6 +293,22 @@
        .id {
          font-size: 26rpx;
          color: rgba(255, 255, 255, 0.9);
          margin-bottom: 4rpx;
          display: block;
        }
        // 新增协调员样式
        .coordinator {
          font-size: 22rpx;
          color: rgba(255, 255, 255, 0.75);
          display: block;
          margin-top: 4rpx;
          // 编号文字更小一些
          text {
            font-size: 20rpx;
            color: rgba(255, 255, 255, 0.65);
          }
        }
      }
    }
@@ -264,7 +337,7 @@
    border-radius: $radius-lg;
    padding: 30rpx;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-columns: repeat(3, 1fr);
    gap: 20rpx;
    box-shadow: $shadow-sm;