diff --git a/src/App.vue b/src/App.vue
index 178de75..5a01caf 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,6 +1,8 @@
-
+
+
+
@@ -28,10 +30,27 @@ Vue.use(MdProgress);
Vue.use(MdSnackbar);
import TabsMenu from "@/components/TabsMenu.vue";
+import LoaderPage from "@/components/Others/LoaderPage.vue";
+import FailLoad from "@/components/Others/FailLoad.vue";
export default {
name: 'App',
components: {
+ FailLoad,
+ LoaderPage,
TabsMenu
+ },
+ data: () => ({
+ l:true,
+ f:true
+ }),
+ beforeMount() {
+ this.$API.load().then(() => {
+ this.l = this.$API.loading;
+ this.f = this.$API.failed;
+ console.log('s', this.l,this.f);
+ }).catch(() => {
+ console.log('e', this.l,this.f);
+ })
}
}
@@ -173,4 +192,8 @@ a {
.md-progress-bar-buffer {
color: black;
}
+
+.clickable:hover {
+ cursor: pointer;
+}
diff --git a/src/api/AdminApi.js b/src/api/AdminApi.js
index 9793aab..eb348f3 100644
--- a/src/api/AdminApi.js
+++ b/src/api/AdminApi.js
@@ -17,12 +17,16 @@ export default class AdminApi {
});
}
- async load() {
+ async load(stages) {
console.log(`[AdminAPI] request permissions`);
console.log(document.cookie);
if (document.cookie.indexOf("steam64=") === -1) return;
- await this.checkPermition('ban')
- await this.checkPermition('mute')
- await this.checkPermition('kick')
+ stages.add("permitions")
+ await Promise.all([
+ this.checkPermition('ban'),
+ this.checkPermition('mute'),
+ this.checkPermition('kick')
+ ]);
+ stages.remove("permitions");
}
}
\ No newline at end of file
diff --git a/src/api/GlobalApi.js b/src/api/GlobalApi.js
index 5ff5f28..c6dffd8 100644
--- a/src/api/GlobalApi.js
+++ b/src/api/GlobalApi.js
@@ -1,25 +1,41 @@
import axios from "axios";
import AdminApi from "@/api/AdminApi";
import PlayerApi from "@/api/PlayerApi";
+import Stages from "@/api/Stages";
export default class GlobalApi {
stats = {
- 'statistic':null,
- 'servers': null,
+ 'statistic':{
+ working_servers:0,
+ player_now:0,
+ player_max:0,
+ total_servers:0
+ },
+ 'servers':{
+ "w":[],
+ "e":[],
+ "n":[]
+ },
'uniq': null
}
loading = false;
+ failed = false;
admin = new AdminApi()
player = new PlayerApi()
builddate = process.env.BUILDDATE === undefined ? null : process.env.BUILDDATE;
+ current_window = "";
+
+ load_stages = new Stages();
+
constructor() {
}
async fillThis(value) {
console.log(`[API] load: ${value}`);
+ this.load_stages.add(value);
return await axios.get(`/api/stats?filter=${value}`)
.then(response => response.data)
.then(response => {
@@ -27,10 +43,14 @@ export default class GlobalApi {
})
.catch(err => {
console.log(`[API] cannot request ${value}, err: ${err}`);
+ throw new Error("BLYA");
+ }).finally(() => {
+ this.load_stages.remove(value);
})
}
async fillServers() {
+ this.load_stages.add("servers")
console.log(`[API] load: servers`);
return axios.get("/api/stats?filter=servers")
.then(response => response.data['servers'])
@@ -49,17 +69,29 @@ export default class GlobalApi {
})
.catch(err => {
console.log(`[API] cannot request servers, err: ${err}`);
+ throw new Error("BLYA SERVERS");
+ })
+ .finally(() => {
+ this.load_stages.remove("servers");
});
}
async load() {
this.loading = true;
- await this.fillThis('statistic');
- await this.fillThis('uniq');
- await this.fillServers();
- await this.admin.load();
- await this.player.load();
- this.loading = false;
+ await Promise.all(
+ [this.fillThis('statistic'),
+ this.fillThis('uniq'),
+ this.fillServers(),
+ this.admin.load(this.load_stages),
+ this.player.load(this.load_stages)]
+ ).then(() => {
+ console.log("end loading");
+ this.loading = false;
+ }).catch(() => {
+ this.loading = false;
+ this.failed = true;
+ console.log("some error in loading");
+ });
}
getRandomBackground() {
diff --git a/src/api/PlayerApi.js b/src/api/PlayerApi.js
index 5548b70..70b773e 100644
--- a/src/api/PlayerApi.js
+++ b/src/api/PlayerApi.js
@@ -47,9 +47,11 @@ export default class PlayerApi {
});
}
- async load() {
+ async load(stages) {
console.log(`[PlayerAPI] request info`);
+ stages.add("profile");
if (this.auth('steam')) await this.loadFull();
if (this.auth('discord')) await this.loadDiscord();
+ stages.remove("profile");
}
}
\ No newline at end of file
diff --git a/src/api/Stages.js b/src/api/Stages.js
new file mode 100644
index 0000000..3134935
--- /dev/null
+++ b/src/api/Stages.js
@@ -0,0 +1,21 @@
+export default class Stages {
+ stages = [];
+
+ add(s) {
+ this.stages.push(s)
+ }
+
+ remove(s) {
+ const p = this.stages.indexOf(s);
+ if (p !== -1) this.stages.splice(p)
+ }
+
+ human(s) {
+ switch (s) {
+ case 'servers':return 'информация о серверах...';
+ case 'uniq': return 'уникальные игроки...';
+ case 'statistic': return 'сейчас играют...';
+ default: return s;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/assets/images/pivo.png b/src/assets/images/pivo.png
new file mode 100644
index 0000000..7a2329a
Binary files /dev/null and b/src/assets/images/pivo.png differ
diff --git a/src/components/Others/BackgroundImage.vue b/src/components/Others/BackgroundImage.vue
index 1469c09..7274019 100644
--- a/src/components/Others/BackgroundImage.vue
+++ b/src/components/Others/BackgroundImage.vue
@@ -5,9 +5,16 @@
\ No newline at end of file
diff --git a/src/components/Others/LoaderPage.vue b/src/components/Others/LoaderPage.vue
new file mode 100644
index 0000000..10d9dcb
--- /dev/null
+++ b/src/components/Others/LoaderPage.vue
@@ -0,0 +1,32 @@
+
+
+
+ Загрузка
+ {{$API.load_stages.human(stage)}}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/TabsMenu.vue b/src/components/TabsMenu.vue
index db1554f..b26e16a 100644
--- a/src/components/TabsMenu.vue
+++ b/src/components/TabsMenu.vue
@@ -2,7 +2,7 @@
-
+
@@ -31,10 +31,7 @@ export default {
components: {BackendStatus, MainView, EmptyTab, RulesView, ServersView, ProfileView, VipView, AboutView, BackgroundImage},
data: () => ({
current_tab: ""
- }),
- beforeCreate() {
- console.log("wait data to render");
- }
+ })
}
diff --git a/src/components/TabsMenuElements/MainView/Components/SubComponents/ConnectButton.vue b/src/components/TabsMenuElements/MainView/Components/SubComponents/ConnectButton.vue
index d9c0f25..a478293 100644
--- a/src/components/TabsMenuElements/MainView/Components/SubComponents/ConnectButton.vue
+++ b/src/components/TabsMenuElements/MainView/Components/SubComponents/ConnectButton.vue
@@ -5,7 +5,7 @@
{{' > '}}
-
+
ПОДКЛЮЧИТЬСЯ К СЕРВЕРУ
@@ -19,6 +19,11 @@
\ No newline at end of file
diff --git a/src/components/TabsMenuElements/MainView/Components/SubComponents/CurrentPlayers.vue b/src/components/TabsMenuElements/MainView/Components/SubComponents/CurrentPlayers.vue
index 345ea51..0bd4f4b 100644
--- a/src/components/TabsMenuElements/MainView/Components/SubComponents/CurrentPlayers.vue
+++ b/src/components/TabsMenuElements/MainView/Components/SubComponents/CurrentPlayers.vue
@@ -36,6 +36,9 @@ export default {
data: () => ({
puff_size: 10,
space_size: 5
- })
+ }),
+ beforeMount() {
+
+ }
}
\ No newline at end of file
diff --git a/src/components/TabsMenuElements/MainView/MainView.vue b/src/components/TabsMenuElements/MainView/MainView.vue
index 5650c8b..806cc15 100644
--- a/src/components/TabsMenuElements/MainView/MainView.vue
+++ b/src/components/TabsMenuElements/MainView/MainView.vue
@@ -16,9 +16,6 @@ export default {
toStyle() {
return {};
}
- },
- props: {
- current_tab: String
}
}
\ No newline at end of file
diff --git a/src/components/TabsMenuElements/ProfileView/AuthWindow.vue b/src/components/TabsMenuElements/ProfileView/AuthWindow.vue
index f66386e..ff75af5 100644
--- a/src/components/TabsMenuElements/ProfileView/AuthWindow.vue
+++ b/src/components/TabsMenuElements/ProfileView/AuthWindow.vue
@@ -1,23 +1,23 @@
-
+
Выйти
{{this.$API.player.store.steam_data['nickname']}}
-
+
Войти через Steam
(жми на иконку)
-
+
Выйти
{{this.$API.player.discord.username}}
-
+
Войти через Discord
если хочешь на наш дискорд сервер, а так не надо
diff --git a/src/components/TabsMenuElements/ProfileView/ProfileView.vue b/src/components/TabsMenuElements/ProfileView/ProfileView.vue
index d1b004d..296c077 100644
--- a/src/components/TabsMenuElements/ProfileView/ProfileView.vue
+++ b/src/components/TabsMenuElements/ProfileView/ProfileView.vue
@@ -12,7 +12,7 @@
-
+
diff --git a/src/components/TabsMenuElements/ServersView/Components/PlayerTableInfo.vue b/src/components/TabsMenuElements/ServersView/Components/PlayerTableInfo.vue
index 7ae185f..a554461 100644
--- a/src/components/TabsMenuElements/ServersView/Components/PlayerTableInfo.vue
+++ b/src/components/TabsMenuElements/ServersView/Components/PlayerTableInfo.vue
@@ -1,5 +1,5 @@
-
+
{{player['name']}} |
{{player['score']}} |
{{player['duration']}} |
diff --git a/src/components/TabsMenuElements/ServersView/Components/ServerCard.vue b/src/components/TabsMenuElements/ServersView/Components/ServerCard.vue
index 79df7f2..08b487f 100644
--- a/src/components/TabsMenuElements/ServersView/Components/ServerCard.vue
+++ b/src/components/TabsMenuElements/ServersView/Components/ServerCard.vue
@@ -1,5 +1,5 @@
-
+
diff --git a/src/components/TabsMenuElements/ServersView/Components/ServerFullInfo.vue b/src/components/TabsMenuElements/ServersView/Components/ServerFullInfo.vue
index 0a8a1ff..cc46d5f 100644
--- a/src/components/TabsMenuElements/ServersView/Components/ServerFullInfo.vue
+++ b/src/components/TabsMenuElements/ServersView/Components/ServerFullInfo.vue
@@ -6,7 +6,7 @@
{{serverData['name']}}
-
@@ -18,17 +18,17 @@
-
+
Подключиться
{{serverData['address']}}
-
+
-
+
FastDL
by Добродей
diff --git a/src/components/TabsMenuElements/ServersView/ServersView.vue b/src/components/TabsMenuElements/ServersView/ServersView.vue
index 2cdbf5f..bbeaecb 100644
--- a/src/components/TabsMenuElements/ServersView/ServersView.vue
+++ b/src/components/TabsMenuElements/ServersView/ServersView.vue
@@ -4,7 +4,7 @@
-
@@ -12,12 +12,12 @@
Для подключения к серверу нажми на него
- где сейчас играют карлики
-
- где сейчас никого нет
-
- где сейчас играют карлики
-
+ где сейчас играют карлики
+
+ где сейчас никого нет
+
+ где сейчас играют карлики
+
@@ -34,9 +34,6 @@ export default {
data:() => ({
servers: {'w':[], 'n':[], 'e':[]}
}),
- beforeMount() {
- this.servers = this.$API.stats.servers;
- },
methods: {
updateServers() {
this.$refs.s_loader.setLoading(true);
diff --git a/src/main.js b/src/main.js
index fa92765..93fb9be 100644
--- a/src/main.js
+++ b/src/main.js
@@ -3,9 +3,8 @@ import App from './App.vue'
import GlobalApi from './api/GlobalApi'
Vue.config.productionTip = false
-Vue.prototype.$API = new GlobalApi();
-Vue.prototype.$API.load().then(() => {
- new Vue({
- render: h => h(App),
- }).$mount('#app')
-});
\ No newline at end of file
+Vue.prototype.$API = Vue.observable(new GlobalApi());
+
+new Vue({
+ render: h => h(App),
+}).$mount('#app')