<!--
 * @Description: 
 * @Author: 欧阳承珺
 * @LastEditors: 欧阳承珺
 * @Date: 2022-10-17 15:19:11
 * @LastEditTime: 2022-10-19 16:58:12
-->
<template>
  <div class="h-80px flex justify-between px-[10%] border-b-1 border-b-[#f0f0f0] border-b-solid">
    <div class="flex items-center ml-16px">
      <a href="/" title="17PDF Reader阅读器支持文件扫描和文件格式转换">
        <img src="http://cn-file.17pdf.com/website/index/logo_pdf_top.png"></img>
      </a>
    </div>
    <div class="flex justify-between">
      <div class="text-[#666] flex">
        <NuxtLink to="/converter" class="inline-block mx-0 mt-28px md-35px hover:text-[#E93636] hover:opacity-70">格式转换</NuxtLink>
        <NuxtLink to="/pricing" class="inline-block mt-28px mr-0 md-0 ml-35px hover:text-[#E93636] hover:opacity-70">订阅服务</NuxtLink>
        <NuxtLink to="/sdk" class="inline-block mt-28px mr-0 md-0 ml-35px hover:text-[#E93636] hover:opacity-70">SDK介绍</NuxtLink>
        <NuxtLink to="/pdf-reader/download" class="inline-block mt-28px mr-100px md-0 ml-35px hover:text-[#E93636] hover:opacity-70">下载</NuxtLink>
      </div>
      <img v-if="isLogin" class="w-36px h-36px rounded-full mt-23px mr-0 md-0 ml-90px" src="https://user-file.17pdf.com/avatars/2020/11/16/0577b907be980556bdafa23fb0be0732-jpg.jpg" />
      <div v-else class="flex items-center">
        <button class="border-1 rounded-4px ml-9px text-$btn-color-primary border-$btn-color-primary border-solid w-70px h-42px leading-22px cursor-pointer hover:opacity-70" @click="loadUsers">登录</button>
        <button class="bg-$btn-color-primary rounded-4px ml-25px text-[#fff] w-70px h-42px leading-22px cursor-pointer hover:bg-[#f34545]" @click="loginUser">注册</button>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
import { defineComponent } from '@nuxtjs/composition-api'
import qs from 'qs'
import { userApi } from '@/api/user'

const { fetchUser,fetchUsers } = userApi()
    const users = ref([])
  const attributes = {
    'phone_zone': '86',
    'email': '123334@qq.com',
    'password': '123321',
    'password_confirm': '123321'
  }
  // document.cookie = 'AGL_USER_ID=8b8faaff-615b-46e9-ae33-e21bdb6c56d1; _ga=GA1.2.1169218754.1665476186; 17pdf_cookie=true; _gid=GA1.2.1720288704.1665991200; _gat_UA-98861421-2=1; refresh_user=1666168604993; _PDF17_Server_session=UU5iekxkdlRnZnc0QjNQVm1mNHI1dWFuUDJvZ1E2ZlkxbXowWGZJajVBQzAzMXNzelJHOGZpMzB2bHlQWkR5ZW1ySUJ2YUMwbCtKazFiT1MrLzFURXQ5Vm1EdWhwV1A5Y3B4dGlCdkpkREFOdmZObnVqallSZlpVeWcvYUU2Und6ZVRyVzZ4R2YwRWVlMnpGVG1aendBPT0tLUoydWYwT2dPb21XR3h5bFZxYVBuekE9PQ%3D%3D--6a49669b945e77430d4f1f345a75b8db10256c7e'

  const loadUsers = async () => {
      const res = await fetchUser(qs.stringify({attributes}))
      users.value = res.data
    }
  const info = {
    account: '443155690@qq.com',
    phone_zone: '86',
    password: '321654',
    rememberMe: 'on'
  }
  const loginUser = async () => {
    const res = await fetchUsers(qs.stringify({info}))
    console.log(res)
  }

const isLogin = ref(false)

</script>

<!-- <script>
export default {
  data() {
    return {
      isLogin: false
    }
  },
  mounted() {
    const fm = new FormData()
    fm.append('account','443155690@qq.com')
    fm.append('password','1213123')
    fm.append('phone_zone','86')
    // this.$axios.post('/sessions', {data:fm}).then(res => {
    //   console.log(res)
    // })
  }
}
</script> -->
