<template>
  <div>这里是用户中心信息查看</div>
  <div class="user-info">
    <div>{{ company }}</div>
    <div>
      <img :src="userImg" />
      <p>{{ userName }}</p>
    </div>
    <div class="phone">
      <span>绑定手机号</span>
      <span>{{ userPhone }}</span>
      <span @click="goback">返回上一页</span>
    </div>
  </div>
</template>

<script>
import { reactive, onMounted, toRefs, ref } from "vue"
import Cookie from "js-cookie"
import { useRouter } from "vue-router"
import { getStatus, getUserbyUserId } from "@/api/fileDeduplication"
export default {
  name: "UserInfo",
  setup(props, context) {
    const router = useRouter()
    const company = ref("雷克沙")
    const state = reactive({
      userName: "",
      userImg: "",
      userPhone: "",
    })

    const getStatusFn = async () => {
      const data = await getStatus({ kid: Cookie.get("kid") })
      if (data.error_code == 0 && data.data.status) {
        // const userInfo = await getUserbyUserId({})
        // console.log(888, userInfo)
        reactive({
          userName: "cy名称",
          userImg:
            "https://www.baidu.com/link?url=zMW9_uJenXdqHzAwGAkOidYygAdjWIF1e0bkMSyCWXcGYJZuq-1JnlucDzg-Mmuj&wd=&eqid=bd0330430000168d000000066287485e",
          userPhone: "15201654415",
        })
      }
    }

    const goback = () => {
      router.go(-1)
    }

    onMounted(() => {
      getStatusFn()
    })

    return {
      company,
      ...toRefs(state),
      goback,
    }
  },
}
</script>

<style lang="less" scoped></style>
