<template>
    <div class="content">
        <Abar>私聊</Abar>. <Abar>送礼物</Abar>. <Abar>逗一下</Abar><br />
        <Abar>拜师</Abar>. <Abar>山寨</Abar>. <Abar>送道具</Abar><br>
        <Abar>加好友</Abar>. <Abar>加仇人</Abar>
    </div>
    <div class="content"></div>
    <div class="content">
        ID:{{ userData.userNo }}({{ online == 1 ? '在线' : '离线' }})<br>
        昵称:{{ userData.nick }}<br>
        特权:<br>
        徽章:<br>
        社交: 暂无<br>
        婚姻:<br>
        结拜:暂无<br>
        宠物:暂无<br>
        坐骑:无<br>
        成就:<br>
        个性签名:{{ userData.sign }}<br>
        罪恶值:0<br>
        师德:{{ accData.teach }}<br>
    </div>
    <div class="content">
        {{ attrData.lev }}级{{ userData.sex }}性({{ onMap }})
    </div>
    <div class="content">
        手持: <br>
        副手:<br>
        头戴:<br>
        身穿: <br>
        腰带: <br>
        脚穿: <br>
        佩戴: <br>
        时装:<br>
        羽翼: <br>
        装饰: <br>
        套装: <br>
        帮会: <br>
        队伍:<br>
    </div>
    <div class="content"></div>
</template>
<script setup lang="ts">

definePageMeta({
    layout: layout.default,
    middleware: 'page-loading'
})
const userData = ref<any>({});
const attrData = ref<any>({});
const accData = ref<any>({});
const online = ref(0);
const onMap = ref('');

onMounted(async () => {
    try {
        await BindData();
    }
    finally {
        PageLoading.Close();
    }
})



const BindData = async (): Promise<void> => {
    let no = PageExtend.QueryString("no");
    let result = await UserService.GetHomeInfo(no);
    if (result.code == 0) {
        userData.value = result.data.user;
        attrData.value = result.data.attr;
        accData.value = result.data.acc;
        online.value = result.data.isOnline;
        onMap.value = result.data.onMapName;
        console.log(result);
    }
    else if (result.code == 101) {
        return PageExtend.Redirect("/user");
    }
    else if (result.code == 102) {
        MessageExtend.ShowDialogEvent("提示", "玩家不存在!", () => {
            return PageExtend.Redirect("/user");
        }, "确认");
    }
    else {
        MessageExtend.ShowDialog("提示", result.msg);
    }
};

</script>