Commit 699c8fe2 authored by xiaoye's avatar xiaoye

fix

parent 24a24550
<template> <template>
<transition name = 'move_right'> <transition name = 'page'>
<view v-show = 'loading.end' class = 'background' :style = "{ '--index' : index.end }"> <view v-show = 'loading' class = 'background'>
<view class = 'pic' v-html = 'Const.pic.hajimi'></view>
</view>
</transition>
<transition name = 'move_left'>
<view v-show = 'loading.start' class = 'background' :style = "{ '--index' : index.start }">
<view class = 'pic' v-html = 'Const.pic.hajimi'></view> <view class = 'pic' v-html = 'Const.pic.hajimi'></view>
</view> </view>
</transition> </transition>
...@@ -17,37 +12,17 @@ ...@@ -17,37 +12,17 @@
import emitter from '../script/emitter.ts'; import emitter from '../script/emitter.ts';
import Const from '../script/const.ts'; import Const from '../script/const.ts';
let loading = reactive({ let loading = ref(true);
start : false,
end : true
});
let index = reactive({
start : 100,
end : 99
});
const changeUrl = async (url : string) : Promise<void> => { const changeUrl = async (url : string) : Promise<void> => {
loading.start = true; loading.value = !loading.value;
await (new Promise(resolve => setTimeout(resolve, 500))); await (new Promise(resolve => setTimeout(resolve, 500)));
window.location.replace(url); window.location.replace(url);
} }
const show = async () : Promise<void> => { const show = async () : Promise<void> => {
if (loading.start) {
loading.end = true;
await (new Promise(resolve => setTimeout(resolve, 500)));
index.end = 100;
index.start = 99;
loading.start = false;
await (new Promise(resolve => setTimeout(resolve, 500)));
loading.end = false;
index.end = 99;
index.start = 100;
return;
}
await (new Promise(resolve => setTimeout(resolve, 500))); await (new Promise(resolve => setTimeout(resolve, 500)));
loading.end = false; loading.value = !loading.value;
} }
onBeforeMount(() : void => { onBeforeMount(() : void => {
...@@ -69,7 +44,7 @@ ...@@ -69,7 +44,7 @@
background: linear-gradient(45deg, rgb(0, 162, 255), rgb(0, 72, 255)); background: linear-gradient(45deg, rgb(0, 162, 255), rgb(0, 72, 255));
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
z-index: var(--index); z-index: 100;
font-family: 'Courier New', monospace; font-family: 'Courier New', monospace;
display: flex; display: flex;
justify-content: center; justify-content: center;
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
:title = 'Mycard.username' :title = 'Mycard.username'
:sub-title = 'Mycard.email' :sub-title = 'Mycard.email'
:thumbnail = 'Mycard.avatar' :thumbnail = 'Mycard.avatar'
:style = "{ '--size' : `${size.width > size.height ? size.width / 2 : size.width / 1.2}px` }" :style = "{ '--size' : `${size.width > size.height ? size.width / 2 : size.width / 1.2}px`, '--minsize' : `${size.width > size.height ? size.width / 4 : size.width / 2.4}px` }"
> >
<view v-show = 'Mycard.id >= 0'><h2>{{ Mycard.id }}</h2></view> <view v-show = 'Mycard.id >= 0'><h2>{{ Mycard.id }}</h2></view>
<hr v-show = 'Mycard.id >= 0'> <hr v-show = 'Mycard.id >= 0'>
...@@ -181,7 +181,7 @@ ...@@ -181,7 +181,7 @@
}, },
tournament : (v : number = 0): void => { tournament : (v : number = 0): void => {
const url = window.location.href.split('/?'); const url = window.location.href.split('/?');
emitter.emit(Const.changeUrl, `${url[0].replace(/\/?$/, '')}/${search.result.tournaments[v].id}${url[1] ? `/?${url[1]}` : ''}`); emitter.emit(Const.changeUrl, `${url[0]}/${search.result.tournaments[v].id}${url[1] ? `/?${url[1]}` : ''}`);
}, },
menu : async(): Promise<void> => { menu : async(): Promise<void> => {
page.tournament = false; page.tournament = false;
...@@ -411,12 +411,18 @@ ...@@ -411,12 +411,18 @@
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; return;
} else if (url[1].length == 0) { } else if (url[1].length == 0) {
if (window.location.href.includes('/?') && window.location.hash.endsWith('#/')) {
const i = window.location.href.split('/?');
window.location.replace(`${i[0].replace('#/', '')}/#${i[1] ? `/?${i[1].replace('#/', '')}` : '/'}`);
return;
}
page.tournament = false; page.tournament = false;
page.menu = true; page.menu = true;
search.mine(); search.mine();
......
import { Buffer } from 'buffer'; import { Buffer } from 'buffer';
import { ref } from 'vue';
import emitter from './emitter.ts' import emitter from './emitter.ts'
import Const from './const.ts' import Const from './const.ts'
...@@ -51,9 +52,16 @@ class MyCard { ...@@ -51,9 +52,16 @@ class MyCard {
logout() { logout() {
window.localStorage.removeItem('mycardLogin'); window.localStorage.removeItem('mycardLogin');
emitter.emit(Const.changeUrl, window.location.href.replace(/\/\?.*/, '')); this.user = {} as MyCardSSOUser;
this.id = -1;
this.token = '';
this.username = '';
this.email = '';
this.avatar = 'https://cdn02.moecube.com:444/accounts/default_avatar.jpg';
const url = window.location.href.split('/?');
emitter.emit(Const.changeUrl, `${url[0]}/`);
} }
} }
const Mycard = new MyCard(); const Mycard = ref(new MyCard()).value;
export default Mycard; export default Mycard;
\ No newline at end of file
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
right: 2%; right: 2%;
z-index: 2; z-index: 2;
max-width: var(--size); max-width: var(--size);
min-width: var(--minsize);
.user { .user {
&:hover { &:hover {
cursor: pointer; cursor: pointer;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
} }
} }
.move_left, .move_left_slow { .move_left {
&-enter-active, &-enter-active,
&-leave-active { &-leave-active {
transition: transform 0.5s ease; transition: transform 0.5s ease;
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
} }
} }
.move_right, .move_right_slow { .move_right {
&-enter-active, &-enter-active,
&-leave-active { &-leave-active {
transition: transform 0.5s ease; transition: transform 0.5s ease;
...@@ -71,3 +71,23 @@ ...@@ -71,3 +71,23 @@
transform: translateY(0%); transform: translateY(0%);
} }
} }
.page {
&-enter-active,
&-leave-active {
transition: transform 0.5s ease;
}
&-enter-from {
transform: translateX(-200%);
}
&-enter-to,
&-leave-from {
transform: translateX(0%);
}
&-leave-to {
transform: translateX(200%);
}
}
\ No newline at end of file
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