<template>
	<page-meta :page-font-size="fontValue+'px'" :root-font-size="fontValue+'px'"></page-meta>
  <view class="userV" >
    <view  class="contentIncolumnC bg-img-mine bottomLine">
      <view v-if="user" class="contentIncolumnC">
        <image class="logoImg" :src="user.avatar" mode="scaleToFill"></image>
        <view class="text-xl text-center text-black" >
          {{ user.name }}
        </view>
      </view>
    </view>
	<view class="contentIncolumnC" style="margin-top:20rpx">
	  <view class="contentInRowS itemView" @tap="userinfo">
	    <view class="contentInRowL">
	      <image style="width:40rpx;height:40rpx;" src="/static/mine/gerenxx.png" mode="scaleToFill"></image>
		  <text class="titleText">个人信息</text>
	    </view>
		<image style="width:40rpx;height:40rpx;" src="/static/mine/youjt.png" mode="scaleToFill"></image>
	  </view>
	  <view class="contentInRowS itemView" @tap="fontSizeSetting">
	    <view class="contentInRowL">
	      <image style="width:40rpx;height:40rpx;" src="/static/mine/gerenxx.png" mode="scaleToFill"></image>
	  		  <text class="titleText">字体大小</text>
	    </view>
	  		<image style="width:40rpx;height:40rpx;" src="/static/mine/youjt.png" mode="scaleToFill"></image>
	  </view>
	  <view class="contentInRowS itemView" @tap="handlePassword">
	    <view class="contentInRowL">
	      <image style="width:40rpx;height:40rpx;" src="/static/mine/xiugaimm.png" mode="scaleToFill"></image>
	  		  <text class="titleText">修改密码</text>
	    </view>
	  		<image style="width:40rpx;height:40rpx;" src="/static/mine/youjt.png" mode="scaleToFill"></image>
	  </view>
	  <view class="contentInRowS itemView" style="margin-top: 0rpx;" @tap="zhaohuiPassword">
	    <view class="contentInRowL">
	      <image style="width:40rpx;height:40rpx;" src="/static/mine/gerenxx.png" mode="scaleToFill"></image>
	  		  <text class="titleText">重置密码</text>
	    </view>
	  		<image style="width:40rpx;height:40rpx;" src="/static/mine/youjt.png" mode="scaleToFill"></image>
	  </view>
	  <view class="contentInRowS itemView" style="margin-top: 0rpx;" @tap="handlesavePassword">
	    <view class="contentInRowL">
	      <image style="width:40rpx;height:40rpx;" src="/static/mine/anquanmm.png" mode="scaleToFill"></image>
	  		  <text class="titleText">安全密码</text>
	    </view>
	  		<image style="width:40rpx;height:40rpx;" src="/static/mine/youjt.png" mode="scaleToFill"></image>
	  </view>
	  <view class="contentInRowS itemView" @tap="handleCollect">
	    <view class="contentInRowL">
	      <image style="width:40rpx;height:40rpx;" src="/static/mine/shoucjia.png" mode="scaleToFill"></image>
	  		  <text class="titleText">收藏夹</text>
	    </view>
	  		<image style="width:40rpx;height:40rpx;" src="/static/mine/youjt.png" mode="scaleToFill"></image>
	  </view>
	  
	  <view class="contentInRowS itemView" @tap="setting">
	    <view class="contentInRowL">
	      <image style="width:40rpx;height:40rpx;" src="/static/mine/shezhi.png" mode="scaleToFill"></image>
	  		  <text class="titleText">聊天设置</text>
	    </view>
	  		<image style="width:40rpx;height:40rpx;" src="/static/mine/youjt.png" mode="scaleToFill"></image>
	  </view>
	  <view class="contentInRowS itemView" @tap="yinsizhengc">
	    <view class="contentInRowL">
	      <image style="width:40rpx;height:40rpx;" src="/static/mine/gerenxx.png" mode="scaleToFill"></image>
	  		  <text class="titleText">隐私政策</text>
	    </view>
	  		<image style="width:40rpx;height:40rpx;" src="/static/mine/youjt.png" mode="scaleToFill"></image>
	  </view>
	  <view class="contentInRowS itemView" @tap="zhuxiaozhanghao">
	    <view class="contentInRowL">
	      <image style="width:40rpx;height:40rpx;" src="/static/mine/gerenxx.png" mode="scaleToFill"></image>
	  		  <text class="titleText">注销账号</text>
	    </view>
	  		<image style="width:40rpx;height:40rpx;" src="/static/mine/youjt.png" mode="scaleToFill"></image>
	  </view>
	  <view class="contentIncolumnC itemView" style="margin-top: 40rpx;" @tap="logout">
	    <text class="titleText">退出登录</text>
	  </view>
	</view>
	
	<view class="text-sm text-center text-grey" style="margin-top: 10rpx;">
	  {{version}}
	</view>
	
	<view class="text-center text-black" style="margin-top: 10rpx;font-size: 10px;">
	  Copyright © 2024 Amazeway TECH Inc. 保留所有权利。
	</view>
	
	<view style="height: 150upx;"></view>
  </view>
</template>

<script setup lang="ts">
import {getCurrentInstance, ref} from "vue";
import Auth from "@/api/Auth";
import UserApi from "@/api/UserApi";
import type User from "@/mode/User";
import {onShow} from '@dcloudio/uni-app'
const fontValue=ref(Auth.getfontSize());
const user = ref<User>();
const version = ref('');
const {proxy} = getCurrentInstance();
UserApi.currentUser()
    .then((res) => {
      user.value = res.data;
	  getVersion();
})


onShow(() =>{
	fontValue.value=Auth.getfontSize();
})

const handlePassword = () => {
  uni.navigateTo({
    url: '/pages/mine/password'
  })
}
const zhaohuiPassword = () => {
  uni.navigateTo({
    url: '/pages/mine/zhpassword'
  })
}


const handlesavePassword = () => {
  uni.navigateTo({
    url: '/pages/mine/savepassword'
  })
}


const handleCollect = () => {
  uni.navigateTo({
    url: '/pages/collect/index'
  })
}

const systemInfo = () => {
  uni.navigateTo({
    url: '/pages/mine/system'
  })
}


if (!user) {
  uni.reLaunch({
    url: '/pages/login/login'
  })
}

const userinfo = () => {
  uni.navigateTo({
    url: '/pages/mine/info'
  })
}
const fontSizeSetting = () => {
	console.log('fontSizeSetting')
  uni.navigateTo({
    url: '/pages/mine/fontSizeSetting'
  })
}


const setting = () => {
  uni.navigateTo({
    url: '/pages/mine/setting'
  })
}

const yinsizhengc = () =>{
	uni.navigateTo({
	  url: '/pages/mine/yinsizhngce'
	})
}

const zhuxiaozhanghao = () =>{
	uni.navigateTo({
	  url: '/pages/mine/zhuxiaozhanghao'
	})
}


const logout = () => {
  uni.showModal({
    title: '提示',
    content: '是否退出登录？',
    cancelText: '取消',
    confirmText: '确定',
    success: res => {
      if (res.confirm) {
        Auth.logout();
      }
    }
  });
  
}

const getVersion=()=>{
	var info = uni.getSystemInfoSync();
	version.value='Version:'+info.appVersion+'   VersionCode:'+info.appVersionCode;
	console.log(info);
}
</script>

<style scoped>
@import url('@/static/css/main.css');
.logoImg{
  width: 170upx;
  height: 170upx;
  margin-top: 50upx;
  border-radius: 85upx;
  margin-bottom:16rpx;
}

.gif-wave {
  position: absolute;
  width: 100%;
  bottom: 0;
  left: 0;
  z-index: 99;
  mix-blend-mode: screen;
  height: 100upx;
}

.bg-img-mine {
  height: 400upx;
}

.menu-margin {
  margin-bottom: 51px;
}
.userV{
	width: 100%;
	height:100%;
	background-image: url("/static/wodeBG.png");
	/* background-image: url("/static/images/wodetop.jpg"); */
	background-size: cover;
	background-position: center bottom;
}

.itemView{
	padding: 16rpx;
	margin-top:20rpx;
	width:90%;
	height: 100rpx;
	border-radius: 8rpx;
	border: 1rpx solid lightgray;
}

.titleText{
	font-weight:600;
	font-size: 32upx;
	color:black;
	margin-left: 10rpx;
}
</style>
