gaoluyang
昨天 85b3cc4cb996040632aa656c79b5047bd8b2597c
src/pages/mine.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,331 @@
<template>
  <view class="mine-page">
    <!-- é¡¶éƒ¨ä¸ªäººä¿¡æ¯å¡ -->
    <view class="profile-card">
      <view class="left">
        <view v-if="!avatar" class="avatar-placeholder">
          <view class="iconfont icon-people"></view>
        </view>
        <image
          v-else
          class="avatar"
          :src="avatar"
          mode="aspectFill"
          @click="handleToAvatar"
        />
        <view class="info">
          <view class="name-line">
            <text class="name" @click="name ? handleToInfo() : handleToLogin()">
              {{ name || '点击登录' }}
            </text>
            <text v-if="roleName" class="role-tag">{{ roleName }}</text>
          </view>
        </view>
      </view>
      <view class="right" @click="handleToInfo">
        <text class="link">个人信息</text>
        <view class="iconfont icon-right"></view>
      </view>
    </view>
    <!-- ä¸‰ä¸ªç®¡ç†èœå• -->
    <view class="menu-card">
      <view class="menu-item" @click="handleUnitManage">
        <uni-icons type="home" size="22" color="#3C96F3" />
        <text class="label">单位管理</text>
        <uni-icons class="arrow" type="right" size="18" color="#c0c4cc" />
      </view>
      <view class="menu-item" @click="handleUserManage">
        <uni-icons type="person" size="22" color="#3C96F3" />
        <text class="label">用户管理</text>
        <uni-icons class="arrow" type="right" size="18" color="#c0c4cc" />
      </view>
      <view class="menu-item" @click="handleContractManage">
        <uni-icons type="compose" size="22" color="#3C96F3" />
        <text class="label">合同管理</text>
        <uni-icons class="arrow" type="right" size="18" color="#c0c4cc" />
      </view>
    </view>
    <!-- åº•部两个信息卡片 -->
    <!-- <view class="info-cards">
      <view class="info-card">
        <view class="card-left">
          <view class="title">帮助文档</view>
          <view class="desc">了解平台功能模块</view>
          <button class="card-btn" @click="handleHelp">点击查看</button>
        </view>
        <view class="card-illu note"></view>
      </view>
      <view class="info-card">
        <view class="card-left">
          <view class="title">问题反馈</view>
          <view class="desc">解决平台使用问题</view>
          <button class="card-btn warn" @click="handleFeedback">点击咨询</button>
        </view>
        <view class="card-illu faq"></view>
      </view>
    </view> -->
  </view>
</template>
<script setup>
import { ref, onMounted } from "vue";
import config from '@/config.js'
import { getUserProfile } from "@/api/system/user";
import useUserStore from '@/store/modules/user'
const userStore = useUserStore()
const name = userStore.name;
const roleName = userStore.roleName;
const version = config.appInfo.version;
const avatar = ref(userStore.avatar);
// rem åŸºå‡†ï¼š1rem = 16px(如有不同请调整 REM_BASE æˆ–样式数值)
const REM_BASE = 16;
const windowHeightRem = ref((uni.getSystemInfoSync().windowHeight - 50) / REM_BASE);
const popup = ref(null);
uni.$on('refresh', () => {
  avatar.value = userStore.avatar;
})
function handleToInfo() {
  uni.navigateTo({
    url: '/pages_mine/pages/info/index'
  });
};
function handleToLogin() {
  uni.reLaunch({
    url: '/pages/login'
  });
};
function handleToAvatar() {
  uni.navigateTo({
    url: '/pages_mine/pages/avatar/index'
  });
};
function handleLogout() {
  popup.value.open();
};
function dialogConfirm() {
  //console.log('----------------点击确认------------')
  userStore.logOut().then(() => {
    uni.reLaunch({
      url: '/pages/login'
    });
  })
};
// çŽ°æœ‰è·³è½¬æ–¹æ³•ä¿ç•™ï¼šhandleToInfo / handleToLogin / handleToAvatar / handleHelp ç­‰
function handleUnitManage() {
  // TODO: æ›¿æ¢ä¸ºçœŸå®žè·¯ç”±
  uni.showToast({ title: '模块建设中~', icon: 'none' });
}
function handleUserManage() {
  // TODO: æ›¿æ¢ä¸ºçœŸå®žè·¯ç”±
  uni.showToast({ title: '模块建设中~', icon: 'none' });
}
function handleContractManage() {
  // TODO: æ›¿æ¢ä¸ºçœŸå®žè·¯ç”±
  uni.showToast({ title: '模块建设中~', icon: 'none' });
}
onMounted(() => {
   // è®¾ç½®ç”¨æˆ·ä¿¡æ¯
});
</script>
<style lang="scss" scoped>
/* é¡µé¢å®¹å™¨ */
.mine-page {
  min-height: 100vh;
   padding: 1.25rem;
   padding-top: env(safe-area-inset-top);
   position: relative;
  background: linear-gradient( 225deg, #E7F1FF 0%, rgba(255,255,255,0) 74%, rgba(255,255,255,0) 100%);
}
/* é¡¶éƒ¨ä¸ªäººä¿¡æ¯å¡ */
.profile-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #333;
  margin: 1.25rem 0;
  .left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    .avatar {
      width: 3.5rem;
      height: 3.5rem;
      border-radius: 50%;
      border: 0.125rem solid #fff;
      background: #fff;
      object-fit: cover;
    }
    .avatar-placeholder {
      width: 3.5rem;
      height: 3.5rem;
      border-radius: 50%;
      background: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      border: 0.125rem solid #fff;
      .iconfont {
        font-size: 2rem;
        color: #c0c4cc;
      }
    }
    .info {
      display: flex;
      flex-direction: column;
      .name-line {
        display: flex;
        align-items: flex-end;
        gap: 0.5rem;
        .name {
          font-size: 1.125rem;
          font-weight: 600;
          color: #2c2c2c;
        }
        .role-tag {
          font-size: 0.75rem;
          color: #fff;
          background: #ffa940;
          padding: 0.125rem 0.5rem;
          border-radius: 0.75rem;
        }
      }
      .phone {
        margin-top: 0.25rem;
        font-size: 0.8125rem;
        color: #3c96f3;
      }
    }
  }
  .right {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: #666;
    .link {
      font-size: 0.875rem;
    }
    .iconfont {
      font-size: 0.875rem;
      color: #c0c4cc;
    }
  }
}
/* èœå•卡片 */
.menu-card {
  margin-top: 0.75rem;
  background: #fff;
  border-radius: 0.75rem;
  overflow: hidden;
  .menu-item {
    display: flex;
    align-items: center;
    height: 3.5rem;
    padding: 1.25rem;
    position: relative;
    .label {
      flex: 1;
      margin-left: 0.625rem;
      color: #303133;
      font-size: 0.9375rem;
    }
    .arrow {
      opacity: 0.6;
    }
  }
  .menu-item + .menu-item {
    border-top: 0.0625rem solid #f2f3f5;
  }
}
/* åº•部信息卡片 */
.info-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
  .info-card {
    position: relative;
    background: #fff;
    border-radius: 0.75rem;
    padding: 0.875rem 0.75rem;
    min-height: 7rem;
    overflow: hidden;
    .card-left {
      display: flex;
      flex-direction: column;
      gap: 0.375rem;
      .title {
        font-size: 1rem;
        font-weight: 600;
        color: #2c2c2c;
      }
      .desc {
        font-size: 0.75rem;
        color: #8a8a8a;
      }
      .card-btn {
        margin-top: 0.5rem;
        width: 6rem;
        height: 1.875rem;
        line-height: 1.875rem;
        border: none;
        border-radius: 62.4375rem;
        font-size: 0.8125rem;
        color: #fff;
        background: #3c96f3;
        &.warn {
          background: #ffb03a;
        }
      }
    }
    /* å³ä¾§è£…饰(可替换为图片) */
    .card-illu {
      position: absolute;
      right: -0.375rem;
      bottom: 0;
      width: 4.875rem;
      height: 4.875rem;
      opacity: 0.9;
      &.note {
        background: radial-gradient(closest-side, #e8f2ff, transparent),
                    linear-gradient(135deg, #d8eaff, #f5faff);
        border-radius: 0.75rem 0 0 0;
      }
      &.faq {
        background: radial-gradient(closest-side, #ffe9d0, transparent),
                    linear-gradient(135deg, #ffe0b2, #fff3e0);
        border-radius: 0.75rem 0 0 0;
      }
    }
  }
}
</style>