<template>
  <view class="container">
    <view class="PersonalInformation">
      <view class="header">
        <image :src="userinfo.headerIcon" mode="scaleToFill" class="headerIcon" />
      </view>
      <view>
        <view class="name">{{ userinfo.nickName }}</view>
      </view>
      <view class="Settings" @click="goSetting">
        <image class="SettingsIcon" src="../../static/Settings.png" mode="scaleToFill" />
      </view>
    </view>

    <view>
      <view class="logout" @click="pkInformation">pk信息</view>
    </view>
    <view>
      <view class="logout" @click="pkRecord">我的pk记录</view>
    </view>
    <view>
      <view class="logout" @click="contact">联系客服</view>
    </view>
    <view>
      <view class="logout" @click="logout">退出登录</view>
    </view>
  </view>
  <view class="copyright">版权所有 © 2025 ...................</view>
  <view class="tabBar">
    <tabBar></tabBar>
  </view>
</template>

<script>
import tabBar from "../../components/tabBar/tabBar";
export default {
  data() {
    return {
      userinfo: {},
    };
  },
  onShow() {
    uni.getStorage({
      key: "userinfo",
      success: (res) => {
        this.userinfo = res.data;
      },
    });
  },
  methods: {
    pkInformation() {
      uni.navigateTo({
        url: "/pages/Mine/minecomponents/pkInformation",
      });
    },
    pkRecord() {
      uni.navigateTo({
        url: "/pages/Mine/minecomponents/pkRecord",
      });
    },
    contact() {
      uni.navigateTo({
        url: "/pages/Mine/minecomponents/contact",
      });
    },

    goSetting() {
      uni.navigateTo({
        url: "/pages/Setting/Setting",
      });
    },
    logout() {
      uni.removeStorage({
        key: "chatInfo",
      });
      uni.removeStorage({
        key: "userinfo",
      });
      uni.removeStorage({
        key: "userSig",
      });
      uni.removeStorage({
        key: "lastPage",
      });
      uni.reLaunch({
        url: "/pages/login/login",
      }); 
    }
  },
  components: {
    tabBar,
  },
};
</script>

<style scoped>
.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  width: 100%;
  background: linear-gradient(to bottom, #11cb2a6e, #2574fc6d);
}
.PersonalInformation {
  margin-top: 200rpx;
  display: flex;
  align-items: center;
  width: 100%;
}
.header {
  background: #ffffff;
  margin-left: 50rpx;
  width: 100rpx;
  height: 100rpx;
  border-radius: 50%;
}
.headerIcon {
  width: 100rpx;
  height: 100rpx;
  border-radius: 50%;
}
.name {
  margin-left: 30rpx;
}
.Settings {
  margin-left: 370rpx;
  width: 50rpx;
  height: 50rpx;
}
.SettingsIcon {
  width: 50rpx;
  height: 50rpx;
}
.logout{
  margin-top: 20rpx;
  width: 100vw;
  height: 80rpx;
  line-height: 80rpx;
  color: #000000;
  font-size: 36rpx;
  background: #ffffff;
  border-top: 1px solid #000000;
  border-bottom: 1px solid #000000;
  text-align: center;
}
.copyright{
  position: absolute;
  bottom: 250rpx;
  width: 100%;
  text-align: center;
  color: #ffffff;
  font-size: 24rpx;
  z-index: 999;
}
</style>
