<template>
  <view class="content flex items-center justify-center">

    <div class="logo flex flex-col animate-twinkle">

      <view class="rounded-3xl overflow-hidden">
        <wd-img :width="100" :height="100" :src="shop.logo_url" />
      </view>

      <text class="flex p-2 text-center justify-center">
        {{ shop.name }}
      </text>

    </div>

    <wd-toast />
    <wd-message-box></wd-message-box>
  </view>
</template>

<script setup>
import { ref } from 'vue';
import utils from '@/utils/utils.js';
import system from '@/api/modules/system.js';
import myTabbar from "../components/myTabbar/index.vue";
import kevyloading from "@/components/kevy-loading/kevy-loading";
import { useMessage } from '@/uni_modules/wot-design-uni';
import { useToast } from '@/uni_modules/wot-design-uni'
import { useApi } from "@/hooks/useApi.js"

const toast = useToast()
const message1 = useMessage();

import {
  onShow, onLoad
} from "@dcloudio/uni-app";

const shop = ref({})

onLoad((opt) => {
  const tableLogin = async (id) => {
    try {
      const res = await system.loginShop({
        shop_id: id
      });

      if (res.code === 0) {
        uni.setStorageSync("mall_token", res.data.access_token);
        uni.setStorageSync("mall_info", res.data.user_info);
        // uni.showToast({
        //   icon: "none",
        //   title: "登录成功",
        // });
        utils.toUrl("/mall/index/index", 'redirectTo')
      } {
        uni.showToast({
          title: menu.message,
          icon: "none"
        });
        return false;
      }
    } catch (error) {
      return false;
    }
  }

  shop.value = JSON.parse(opt.shop)


  setTimeout(() => {
    tableLogin(shop.value.id)
  }, 1000);

})

// 初始化调用获取一行数据
onShow(() => {
  // getShopList();
})
</script>

<style lang="scss" scoped>
.shopBox,
.title {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
}

.shopBox {
  justify-content: flex-start;
}

.title {
  justify-content: space-between;
}

.title-tip {
  color: rgba(0, 0, 0, 0.25);
  font-size: 12px;
}

@keyframes twinkling {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }

  100% {
    opacity: 1;
  }
}

.animate-twinkle {
  animation: twinkling 1s infinite;
}
</style>
