<route lang="json5">
{
  style: {
    navigationBarTitleText: '个人中心',
    navigationBarBackgroundColor: '#0957DE',
    navigationBarTextStyle: 'white',
  },
}
</route>

<template>
  <view class="me-page">
    <view class="user-info-box">
      <view class="flex items-center">
        <view class="avatar">
          <text class="i-carbon-user-avatar text-4xl" />
        </view>
        <view class="ml-4">
          <text class="name">保险专员007</text>
          <text class="dept">核保部 / 高级专员</text>
        </view>
      </view>
    </view>
    
    <view class="menu-group">
      <wd-cell-group border>
        <wd-cell title="我的保单" is-link to="/pagesInsurance/policy/list">
          <template #icon>
            <text class="i-carbon-document-protected text-lg mr-2 text-blue-500" />
          </template>
        </wd-cell>
        <wd-cell title="业绩统计" is-link>
          <template #icon>
            <text class="i-carbon-chart-line text-lg mr-2 text-orange-500" />
          </template>
        </wd-cell>
        <wd-cell title="联系客服" is-link>
          <template #icon>
            <text class="i-carbon-customer-service text-lg mr-2 text-green-500" />
          </template>
        </wd-cell>
        <wd-cell title="账户设置" is-link>
          <template #icon>
            <text class="i-carbon-settings text-lg mr-2 text-gray-500" />
          </template>
        </wd-cell>
      </wd-cell-group>
    </view>
    
    <view class="p-4 mt-4">
      <wd-button type="error" plain block @click="handleLogout">退出登录</wd-button>
    </view>
  </view>
</template>

<script lang="ts" setup>
function handleLogout() {
  uni.showModal({
    title: '提示',
    content: '确定要退出登录吗？',
    success: (res) => {
      if (res.confirm) {
        uni.reLaunch({ url: '/pages/login/index' })
      }
    }
  })
}
</script>

<style lang="scss" scoped>
.me-page {
  min-height: 100vh;
  background: #f5f7fa;
}

.user-info-box {
  background: #0957DE;
  padding: 60rpx 40rpx 80rpx;
  color: #fff;
  
  .avatar {
    width: 100rpx;
    height: 100rpx;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .name { font-size: 36rpx; font-weight: 600; display: block; }
  .dept { font-size: 26rpx; opacity: 0.8; margin-top: 8rpx; display: block; }
}

.menu-group {
  margin-top: -20rpx;
  background: #fff;
  border-top-left-radius: 20rpx;
  border-top-right-radius: 20rpx;
  overflow: hidden;
  padding-top: 20rpx;
}
</style>
