<template>
  <view class="container">
    <!-- Header Section: Profile Picture and Name -->
    <view class="content-wrapper">
      <view class="header">
        <view class="profile-info">
          <view class="profile-pic-container">
            <image src="@/static/images/cat.png" mode="aspectFill" class="profile-pic"></image>
          </view>
          <view class="user-details">
            <text class="username">GT-呆河马</text>
            <view class="id-copy-wrapper">
              <text class="user-id">ID: 10086</text>
              <text class="copy-id">复制ID</text>
            </view>
          </view>
        </view>
      </view>

      <!-- Second Section: Interactions -->
      <view class="menu-section">
<!--        <view class="menu-item" hover-class="menu-item-hover" @tap="navigateToMailbox">-->
<!--          <text class="item-text">已发短信</text>-->
<!--          <text class="arrow">›</text>-->
<!--        </view>-->
        <view class="menu-item" hover-class="menu-item-hover" @tap="navigateToReply">
          <text class="item-text highlight">收到回复</text>
          <text class="arrow">›</text>
        </view>
        <view class="menu-item" hover-class="menu-item-hover" @tap="navigateToPlanned">
          <text class="item-text">已建计划</text>
          <text class="arrow">›</text>
        </view>
      </view>

      <!-- Additional Section -->
      <view class="menu-section">
        <!-- <view class="menu-item" hover-class="menu-item-hover">
          <text class="item-text highlight">通话记录</text>
          <text class="arrow">›</text>
        </view> -->
        <view class="menu-item" hover-class="menu-item-hover" @tap="copyWechatContact">
          <text class="item-text">联系我们</text>
          <text class="arrow">›</text>
        </view>
      </view>

      <!-- Logout Button Section -->
      <view class="button-container">
        <tui-button btnSize="medium" shape="circle" size="28">退出登陆</tui-button>
      </view>
    </view>
  </view>
</template>

<script setup lang="ts">
// Script logic here
import TuiButton from "@/components/thorui/tui-button/tui-button.vue";

// 导航到消息页面
const navigateToMailbox = (): void => {
  console.log("触发跳转其他页面")
  uni.navigateTo({
    url: '/pages/mailbox/index',
  });
};

// 导航到计划页面
const navigateToReply = (): void => {
  console.log("触发跳转其他页面")
  uni.navigateTo({
    url: '/pages/reply/index',
  });
};

// 导航到计划页面
const navigateToPlanned = (): void => {
  console.log("触发跳转其他页面")
  uni.navigateTo({
    url: '/pages/planning/planned',
  });
};  

// 复制微信联系方式
const copyWechatContact = (): void => {
  const wechatID = "I18888"; // 要复制的微信号
  
  uni.setClipboardData({
    data: wechatID,
    success: () => {
      // 显示提示信息
      uni.showToast({
        title: '微信号已复制',
        icon: 'success',
        duration: 2000
      });
    },
    fail: () => {
      uni.showToast({
        title: '复制失败，请重试',
        icon: 'none',
        duration: 2000
      });
    }
  });
};

</script>

<style scoped lang="scss">
/* Global page styles to prevent scrolling */
page {
  overflow: hidden;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

.container {
  display: flex;
  flex-direction: column;
  padding: 0;
  background-color: #f5f7fa;
  height: 100vh;
  overflow: hidden;
  box-sizing: border-box;
  position: relative;
}

.content-wrapper {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 12px;
}

.header {
  width: 100%;
  padding: 20px;
  background-color: #fff;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
  border-radius: 12px;
  box-sizing: border-box;
}

.profile-info {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0;
}

.profile-pic-container {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  padding: 4px;
  background-color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  margin-right: 16px;
  flex-shrink: 0;
}

.profile-pic {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.username {
  font-size: 20px;
  color: #333;
  font-weight: 600;
  margin-bottom: 4px;
}

.id-copy-wrapper {
  display: flex;
  align-items: center;
}

.user-id {
  font-size: 14px;
  color: #666;
}

.copy-id {
  color: #4285f4;
  font-size: 14px;
  margin-left: 8px;
  padding: 2px 6px;
  background-color: rgba(66, 133, 244, 0.1);
  border-radius: 4px;
}

.menu-section {
  width: 100%;
  margin-bottom: 12px;
  background-color: #fff;
  overflow: hidden;
  flex-shrink: 0;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s;

  &:last-child {
    border-bottom: none;
  }
}

.menu-item-hover {
  background-color: #f9f9f9;
}

.item-text {
  font-size: 16px;
  color: #333;
}

.highlight {
  color: #4CAF50;
  font-weight: 500;
}

.arrow {
  color: #ccc;
  font-size: 22px;
  font-weight: 300;
}

.button-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 10px 0;
}

.logout-section {
  margin-top: auto;
  padding: 0;
  overflow: hidden;
}

.logout-button {
  width: 100%;
  background-color: #fff;
  color: #ff3b30;
  font-size: 16px;
  font-weight: 500;
  padding: 16px 0;
  border-radius: 0;
  text-align: center;
  border: none;
  transition: all 0.2s;
  line-height: 1;
}

.logout-button-hover {
  background-color: #fff0f0;
}
</style>