<template>
  <view>
    <web-view :src="url"></web-view>
  </view>
</template>

<script setup lang="ts">
import {ref} from 'vue';
import Taro from '@tarojs/taro';

const url = ref('');

Taro.useDidShow(() => {
  const token = Taro.getStorageSync('token');
  if (token) {
    url.value = `${process.env.TARO_APP_GAME}${Taro.getStorageSync('token')}`;
  } else {
    Taro.showToast({
      title: '请先登录,再尝试进入游戏大厅。',
      icon: 'none',
    });
    setTimeout(() => {
      Taro.switchTab({
        url: '/pages/index/index',
      });
    }, 1000);
  }
});
</script>

<style lang="scss"></style>
