Commit 7cfc1f95 authored by xiaoye's avatar xiaoye

fix

parent 6bcc929a
...@@ -22,20 +22,24 @@ ...@@ -22,20 +22,24 @@
window.location.replace(url); window.location.replace(url);
} }
const show = async () : Promise<void> => { const show = async (chk : boolean | undefined = undefined) : Promise<void> => {
await (new Promise(resolve => setTimeout(resolve, 500))); await (new Promise(resolve => setTimeout(resolve, 500)));
loading.value = !loading.value; if (typeof chk === 'undefined')
loading.value = !loading.value;
else loading.value = chk;
} }
onBeforeMount(() : void => { onBeforeMount(() : void => {
// @ts-ignore // @ts-ignore
emitter.on(Const.changeUrl, changeUrl); emitter.on(Const.changeUrl, changeUrl);
// @ts-ignore
emitter.on(Const.show, show); emitter.on(Const.show, show);
}) })
onUnmounted(() : void => { onUnmounted(() : void => {
// @ts-ignore // @ts-ignore
emitter.off(Const.changeUrl, changeUrl); emitter.off(Const.changeUrl, changeUrl);
// @ts-ignore
emitter.off(Const.show, show); emitter.off(Const.show, show);
}); });
</script> </script>
......
...@@ -411,12 +411,10 @@ ...@@ -411,12 +411,10 @@
const loading = async () : Promise<void> => { const loading = async () : Promise<void> => {
const url = window.location.hash.match(/#\/(.*?)(?:\?|$)/); const url = window.location.hash.match(/#\/(.*?)(?:\?|$)/);
if (url) { if (url) {
if (!isNaN(parseInt(url[1]))) { if (!isNaN(parseInt(url[1]))) {
page.menu = false; page.menu = false;
page.tournament = true; page.tournament = true;
emitter.emit(Const.showTournament); emitter.emit(Const.showTournament);
return;
} else if (url[1].length == 0) { } else if (url[1].length == 0) {
if (window.location.href.includes('/?') && window.location.hash.endsWith('#/')) { if (window.location.href.includes('/?') && window.location.hash.endsWith('#/')) {
const i = window.location.href.split('/?'); const i = window.location.href.split('/?');
...@@ -427,15 +425,16 @@ ...@@ -427,15 +425,16 @@
page.menu = true; page.menu = true;
search.mine(); search.mine();
await search.on(); await search.on();
emitter.emit(Const.show); emitter.emit(Const.show, false);
return;
} }
} else {
const i = window.location.href.split('/?');
emitter.emit(Const.changeUrl, `${window.location.origin}/#${i[1] ? `/?${i[1]}` : '/'}`);
} }
const i = window.location.href.split('/?');
emitter.emit(Const.changeUrl, `${window.location.origin}/#${i[1] ? `/?${i[1]}` : '/'}`);
}; };
onBeforeMount(() : void => { onBeforeMount(() : void => {
loading();
Uniapp.chkScreen(size.get); Uniapp.chkScreen(size.get);
document.addEventListener("click", page.show.clear); document.addEventListener("click", page.show.clear);
emitter.on(Const.tournamentInfo, page.show.drawer); emitter.on(Const.tournamentInfo, page.show.drawer);
...@@ -443,7 +442,6 @@ ...@@ -443,7 +442,6 @@
emitter.on(Const.tournamentReload, tournament.init); emitter.on(Const.tournamentReload, tournament.init);
emitter.on(Const.createOff, creator.off); emitter.on(Const.createOff, creator.off);
window.addEventListener('hashchange', loading); window.addEventListener('hashchange', loading);
loading();
}); });
onMounted(() => { onMounted(() => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment