<script setup>
import { ref } from "vue";
import changeKeyIcon from "~/assets/changeKeyIcon.png";
import cacheIcon from "~/assets/cacheIcon.png";
import contactKey from "~/assets/contactKey.png";
import aboutKey from "~/assets/aboutKey.png";
import setting_rightArrow from "~/assets/setting_rightArrow.png";
import { user } from '~/store'
import { useRouter } from 'vue-router';
const router = useRouter();

const phone = ref("18015656482");

const onClickLeft = () => {
  router.push('/main/personal');
}

const handleTo = (item) => {
  let whereUrl = `/main/personal/${item}`;
  router.push(whereUrl);
}

//联系我们
const callPhone=()=> {
  window.location.href = 'tel:18015656482';
}
//退出
const logoOut = () => {
   user.value = null
  router.push('/login');
}
let fromZlb = localStorage.getItem('fromZlb') === '1'
</script>

<template>
  <div>
    <van-nav-bar title="设置" left-text="" :left-arrow="!fromZlb" fixed placeholder @click-left="onClickLeft"/>

    <div class="mt-10px box-border px-1/20" >
      <div v-if="!fromZlb" class="h-50px flex flex-row flex-nowrap justify-between items-center border-b border-[#e5e5e5] singlePart" @click="handleTo('changepas')">
        <div class="w-1/10"><img :src="changeKeyIcon" alt=""></div>
        <div class="w-8/10 text-14px text-left text-[#333333] commonT">修改密码</div>
        <div class="w-1/10 text-right flex justify-end"><img :src="setting_rightArrow" alt=""></div>
      </div>
      <div class="h-50px flex flex-row flex-nowrap justify-between items-center border-b border-[#e5e5e5] singlePart" v-if="false">
        <div class="w-1/10"><img :src="cacheIcon" alt=""></div>
        <div class="w-8/10 text-14px text-left text-[#333333] commonT">缓存设置</div>
        <div class="w-1/10 text-right flex justify-end"><img :src="setting_rightArrow" alt=""></div>
      </div>
      <div class="h-50px flex flex-row flex-nowrap justify-between items-center border-b border-[#e5e5e5] singlePart" @click="callPhone">
        <div class="w-1/10"><img :src="contactKey" alt=""></div>
        <div class="w-5/10 text-14px text-left text-[#333333] commonT">联系我们</div>
        <div class="w-4/10 text-14px font-bold text-left text-[#333333] commonC flex justify-end" >{{ phone }}</div>
      </div>
      <div class="h-50px flex flex-row flex-nowrap justify-between items-center border-b border-[#e5e5e5] singlePart" @click="handleTo('aboutus')">
        <div class="w-1/10"><img :src="aboutKey" alt=""></div>
        <div class="w-8/10 text-14px text-left text-[#333333] commonT">关于我们</div>
        <div class="w-1/10 text-right flex justify-end"><img :src="setting_rightArrow" alt=""></div>
      </div>

    </div>

    <div v-if="!fromZlb" class="mt-8 box-border px-6">
      <van-button type="primary" color="#154A9A" block @click="logoOut">退出登录</van-button>
    </div>


  </div>
</template>



<style lang="scss" scoped>

</style>
