<script setup>
import { onMounted, getCurrentInstance } from 'vue'
import { userStore } from '@/store/userInfo'
import { get } from '../../utils/request'
import Download from '@/components/icon/menu_download.vue'

const { proxy } = getCurrentInstance()

onMounted(() => {
  updataUserInfo()
})
// 获取用户信息
const updataUserInfo = () => {
  get(
    '/pdf-tech/vppMember/getMemberInfo'
  ).then((res) => {
    if (res.data.code === 200 && res.data.msg == 'success') {
      userStore().setUserInfo(res.data.result)
      if (res.data.result.validFlag === '0') {
        proxy.$router.push('/login')
      }
    }
  })
}

// 下载链接
let macPro = import.meta.env.VITE_PRO_WEB + '/downloads/' + import.meta.env.VITE_APP + import.meta.env.VITE_MAC_APP_VERSION + '.dmg'
let windowsPro = import.meta.env.VITE_PRO_WEB + '/downloads/' + import.meta.env.VITE_APP + import.meta.env.VITE_WINDOWS_APP_VERSION + '.exe'
let macEditor = import.meta.env.VITE_PRO_WEB + '/downloads/' + import.meta.env.VITE_EDITOR + import.meta.env.VITE_MAC_EDITOR_VERSION + '.dmg'
let windowsEditor = import.meta.env.VITE_PRO_WEB + '/downloads/' + import.meta.env.VITE_EDITOR + import.meta.env.VITE_WINDOWS_EDITOR_VERSION + '.exe'
</script>

<template>
  <div>
    <h1 class="leading-40px text-[#232A40]">Download Center</h1>
    <div class="mt-32px flex items-center text-20px leading-24px font-700 text-[#232A40]">
      <img class="w-32px mr-12px" src="@/assets/images/logo.png" alt="logo">
      LynxPDF Editor (Enterprise)
    </div>
    <div class="mt-20px flex">
      <div class="card w-320px bg-[#FFFFFF] rounded-8px p-32px">
        <div class="flex items-center text-16px leading-20px font-700 text-[#232A40]">
          <img src="@/assets/images/store/mac.svg" alt="mac" class="mr-8px">
          macOS
        </div>
        <div class="mt-20px text-14px leading-20px text-[#505258]">Support macOS 11 or later</div>
        <a :href="macEditor"
          class="rounded-8px bg-[#1460F3] mt-24px flex leading-40px text-[#fff] justify-center items-center font-700 text-16px hover:opacity-80">
          <Download class="mr-8px" /> Download</a>
      </div>
      <div class="card w-320px ml-24px bg-[#FFFFFF] rounded-8px p-32px">
        <div class="flex items-center text-16px leading-20px font-700 text-[#232A40]">
          <img src="@/assets/images/store/windows.svg" alt="mac" class="mr-8px">
          Windows
        </div>
        <div class="mt-20px text-14px leading-20px text-[#505258]">Support Windows 7 or later</div>
        <a :href="windowsEditor"
          class="rounded-8px bg-[#1460F3] mt-24px flex leading-40px text-[#fff] justify-center items-center font-700 text-16px hover:opacity-80">
          <Download class="mr-8px" /> Download</a>
      </div>
    </div>
    <div class="mt-48px flex items-center text-20px leading-24px font-700 text-[#232A40]">
      <img class="w-32px mr-12px" src="@/assets/images/logo.png" alt="logo">
      PDF Reader Pro
    </div>
    <div class="mt-20px flex">
      <div class="card w-320px bg-[#FFFFFF] rounded-8px p-32px">
        <div class="flex items-center text-16px leading-20px font-700 text-[#232A40]">
          <img src="@/assets/images/store/mac.svg" alt="mac" class="mr-8px">
          macOS
        </div>
        <div class="mt-20px text-14px leading-20px text-[#505258]">Support macOS 11 or later</div>
        <a :href="macPro"
          class="rounded-8px bg-[#1460F3] mt-24px flex leading-40px text-[#fff] justify-center items-center font-700 text-16px hover:opacity-80">
          <Download class="mr-8px" /> Download</a>
      </div>
      <div class="card w-320px ml-24px bg-[#FFFFFF] rounded-8px p-32px">
        <div class="flex items-center text-16px leading-20px font-700 text-[#232A40]">
          <img src="@/assets/images/store/windows.svg" alt="mac" class="mr-8px">
          Windows
        </div>
        <div class="mt-20px text-14px leading-20px text-[#505258]">Support Windows 7 or later</div>
        <a :href="windowsPro"
          class="rounded-8px bg-[#1460F3] mt-24px flex leading-40px text-[#fff] justify-center items-center font-700 text-16px hover:opacity-80">
          <Download class="mr-8px" /> Download</a>
      </div>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.card {
  box-shadow: 0px 0px 12px 0px #2361A90D;
}
</style>