<script setup>
import { useCdn } from '@/composables/use-cdn'
const { cdnUrl } = useCdn('/elevator/2024/12/31')
import { ACCESS_TOKEN_KEY } from '@/constants/storage'
import { useUserStore } from '@/store/user'

const { setUserInfo } = useUserStore()
const logout = () => {
  uni.setStorageSync(ACCESS_TOKEN_KEY, '')
  setUserInfo({})
  setTimeout(() => {
    uni.reLaunch({
      url: '/pages/views/login/index'
    })
  }, 500)
}
</script>

<template>
  <div class="no-permission">
    <div f-c-c mt-30>
      <up-image
        :src="`${cdnUrl}/ce8cb81df2c142f8bbd777420dcb5776.png`"
        width="300px"
        height="300px"
      />
    </div>
    <p mt-30 text-42 text-center>抱歉，该账号没有访问权限</p>

    <view position="fixed" w-full h-130 bottom-0 z-9 f-s-c flex-col bg-white>
      <view absolute left-0 right-0 m-auto bottom-36>
        <up-button
          type="primary"
          text="切换账号"
          :custom-style="{
            width: '650rpx'
          }"
          @click="logout"
        />
      </view>
    </view>
  </div>
</template>
