 <template>
    <div class="full-height column flex-center items-center" v-if="!result">
        <el-empty :image-size="200" description="抱歉，你的账户信息不存在" />
    </div>
</template>

<script setup lang="ts">
import { useUserStore } from '@/store/user';
import { query } from '@/utils/common';
import { ElLoading } from 'element-plus';
import { ref } from 'vue';
import { useRouter } from 'vue-router';

const router = useRouter();
const forword = decodeURIComponent(router.currentRoute.value.query.forword)
const param = query(forword)
const result = ref(true)

const userLoginHandler = async ()=>{
    const loading = ElLoading.service({
        fullscreen:true,
        lock:true
    })
    if(param.uid){
        let response = await useUserStore().setUserAutoLoginAsync(parseInt(param.uid))
        if(response){
            if(param.model=='0') {
                router.push({
                    path: `/team_editor/${param.ConfigId}`
                })
            } else if(param.model=='1' && useUserStore().getUser.isTemplate==1) {
                router.push({
                    path: `/market`
                })
            } else {
                router.push({
                    path: "/space"
                })
            }
            
            return
        }
    }
    result.value=false        
} 
userLoginHandler()
</script>

<style lang="scss">

</style>