<template>
    <view class="signOut-box">
        <view class="index-header-signOut flex">
            <van-image @click="signOut" width="72rpx" height="72rpx" fit="cover" class="img"
            src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1654580469000_635.png" />
            <text @click="signOut">退出登录</text>
            <view v-if="changePasswordShow" 
            class="changePassword flex" 
            @click="goChangePassword">
            <van-image width="38rpx" height="38rpx" 
            fit="cover" class="img" 
            src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1655279741000_34.png" />
            修改密码
          </view>
        </view>
    </view>
  </template>
  <script>
  import { reactive, toRefs, onMounted } from "vue";
  export default {
    name: "",
    props: ["AccountType"],
    components: {},
    setup(props) {
      let data = reactive({
        changePasswordShow: false
      });
      let methods = {
        goChangePassword(){
          uni.navigateTo({
						url:'/pages/login/changePassword'
					})
        },
        signOut(){
            uni.showModal({
                title: '提示',
                content: '将退出登录,是否继续',
                success: function(res) {
                    if (res.confirm) {
                      uni.removeStorageSync('userWxInfo') 
                      uni.removeStorageSync('wxUserAuthInfo')
                      uni.removeStorageSync('ErpStus') 
                      uni.removeStorageSync('erpUserInfo')
                      uni.removeStorageSync('userInfo') 
                      uni.removeStorageSync('users')
                      uni.reLaunch({
                          url: '/pages/login/accountLogin'
                      });
                        
                    } else if (res.cancel) {
                        
                    }
                }
            });
            
        }
      };
  
      onMounted(() => {
        data.changePasswordShow = props.AccountType
      });
      return {
        ...toRefs(data),
        ...methods,
      };
    },
  };
  </script>
  <style scoped>
    .index-header-signOut text{
        font-size: 26rpx;
        font-weight: bold;
        color: #282828;
        margin-left: 20rpx;
        letter-spacing: 2rpx;
    }
    .index-header-signOut{
        align-items: center;
    }
    .signOut-box{
        padding: 0 30rpx;
    }
    .changePassword{
      color: #282828;
      font-size: 26rpx;
      font-weight: bold;
      /* border-left: 1rpx solid #AFAFAF; */
      margin-left: 20rpx;
      padding: 10rpx 10rpx 10rpx 35rpx;
      letter-spacing: 2rpx;
      align-items: center;
    }
    .changePassword .img{
      margin-right: 20rpx;
      position: relative;
      top: 4rpx;
    }
  </style>