fix:去掉对战房间兼容代码
This commit is contained in:
@@ -9,7 +9,7 @@ import Signin from "@/components/Signin.vue";
|
|||||||
import CreateRoom from "@/components/CreateRoom.vue";
|
import CreateRoom from "@/components/CreateRoom.vue";
|
||||||
import Avatar from "@/components/Avatar.vue";
|
import Avatar from "@/components/Avatar.vue";
|
||||||
|
|
||||||
import { getRoomAPI, joinRoomAPI, getBattleDataAPI, getHomeData } from "@/apis";
|
import { getRoomAPI, joinRoomAPI, getBattleDataAPI } from "@/apis";
|
||||||
import { debounce, canEenter } from "@/util";
|
import { debounce, canEenter } from "@/util";
|
||||||
|
|
||||||
import useStore from "@/store";
|
import useStore from "@/store";
|
||||||
@@ -88,26 +88,8 @@ onShow(async () => {
|
|||||||
onLoad(async (options) => {
|
onLoad(async (options) => {
|
||||||
if (options.roomID) {
|
if (options.roomID) {
|
||||||
roomID.value = options.roomID;
|
roomID.value = options.roomID;
|
||||||
if (user.value.id) {
|
if (user.value.id) enterRoom(options.roomID);
|
||||||
// 内存中有用户状态,直接进房
|
else showSignin.value = true;
|
||||||
enterRoom(options.roomID);
|
|
||||||
} else {
|
|
||||||
// 冷启动(如分享链接进入)时 Pinia 状态已重置,尝试用已存储的 token 静默恢复用户信息
|
|
||||||
const env = uni.getAccountInfoSync().miniProgram.envVersion;
|
|
||||||
const token = uni.getStorageSync(`${env}_token`);
|
|
||||||
if (token) {
|
|
||||||
try {
|
|
||||||
const homeData = await getHomeData();
|
|
||||||
if (homeData?.user) {
|
|
||||||
store.updateUser(homeData.user);
|
|
||||||
enterRoom(options.roomID);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} catch {}
|
|
||||||
}
|
|
||||||
// token 不存在或已失效,弹出授权登录弹窗
|
|
||||||
showSignin.value = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user