This commit is contained in:
Hepatica
2024-02-25 17:19:17 +01:00
parent 72aea3ad3f
commit 7c76b2af8d

View File

@@ -4,7 +4,7 @@ import "@/assets/css/ComponentsStyles/header.css";
import { LogIn } from "@/assets/js/authentication/AuthService.js"; import { LogIn } from "@/assets/js/authentication/AuthService.js";
import { GetCurrentMoney } from "@/assets/js/rest/RestMethods.js"; import { GetCurrentMoney } from "@/assets/js/rest/RestMethods.js";
import {eventBus} from "@/main"; import { eventBus } from "@/main";
import { import {
SetCookie, SetCookie,
@@ -18,30 +18,31 @@ export default {
logout() { logout() {
this.auth = false; this.auth = false;
this.balance = 0; this.balance = 0;
this.authtoken = '' this.authtoken = "";
DeleteAllCookie(); DeleteAllCookie();
}, },
updateBalanceMethod() { updateBalanceMethod() {
GetCurrentMoney(GetCookie("AUTHTOKEN"), GetCookie("SearchToken")) GetCurrentMoney(GetCookie("AUTHTOKEN"), GetCookie("SearchToken")).then(
.then(response => { (response) => {
this.balance = response.currentMoney this.balance = response.currentMoney;
})
eventBus.emit('Updatebalance-saper')
} }
);
eventBus.emit("Updatebalance-saper");
},
}, },
data() { data() {
return { return {
balance: 0, balance: 0,
auth: false, auth: false,
authtoken: '', authtoken: "",
imageUrl: "https://avatar.spworlds.ru/face/55/", imageUrl: "https://avatar.spworlds.ru/face/55/",
userName: "", userName: "",
}; };
}, },
mounted() { mounted() {
eventBus.on('Updatebalance', () => { eventBus.on("Updatebalance", () => {
this.updateBalanceMethod() this.updateBalanceMethod();
}) });
}, },
created() { created() {
try { try {
@@ -58,7 +59,7 @@ export default {
this.imageUrl = this.imageUrl + `${response.spUserName}.png`; this.imageUrl = this.imageUrl + `${response.spUserName}.png`;
this.userName = response.spUserName; this.userName = response.spUserName;
this.auth = true; this.auth = true;
this.authtoken = response.authtoken this.authtoken = response.authtoken;
GetCurrentMoney(GetCookie("AUTHTOKEN"), GetCookie("SearchToken")) GetCurrentMoney(GetCookie("AUTHTOKEN"), GetCookie("SearchToken"))
.then((response) => { .then((response) => {
this.balance = response.currentMoney; this.balance = response.currentMoney;
@@ -82,7 +83,7 @@ export default {
this.imageUrl = this.imageUrl + `${currentUserName}.png`; this.imageUrl = this.imageUrl + `${currentUserName}.png`;
this.userName = GetCookie("SpUserName"); this.userName = GetCookie("SpUserName");
this.auth = true; this.auth = true;
this.authtoken = GetCookie('AUTHTOKEN') this.authtoken = GetCookie("AUTHTOKEN");
} else { } else {
this.auth = false; this.auth = false;
this.balance = 0; this.balance = 0;
@@ -104,7 +105,7 @@ export default {
this.imageUrl = this.imageUrl + `${currentUserName}.png`; this.imageUrl = this.imageUrl + `${currentUserName}.png`;
this.userName = GetCookie("SpUserName"); this.userName = GetCookie("SpUserName");
this.auth = true; this.auth = true;
this.authtoken = GetCookie('AUTHTOKEN') this.authtoken = GetCookie("AUTHTOKEN");
} else { } else {
this.auth = false; this.auth = false;
this.balance = 0; this.balance = 0;
@@ -120,14 +121,39 @@ export default {
<header class="header"> <header class="header">
<div class="header__content"> <div class="header__content">
<div class="header__logo"> <div class="header__logo">
<img @click="$router.push({ name: 'home' })" src="../assets/logo.svg" alt="" /> <img
@click="$router.push({ name: 'home' })"
src="../assets/logo.svg"
alt=""
/>
</div> </div>
<div class="header__nav"> <div class="header__nav">
<nav> <nav>
<a href="#" @click="$router.push({ name: 'home' })" :class="{ 'header__nav--now' : $route.name === 'home' }">Главная</a> <a
<a v-if="authtoken !== ''" href="#" @click="$router.push({ name: 'profile' })" :class="{ 'header__nav--now' : $route.name === 'profile' }">Профиль</a> href="#"
<a href="#" @click="$router.push({ name: 'help' })" :class="{ 'header__nav--now' : $route.name === 'help' }">Помощь</a> @click="$router.push({ name: 'home' })"
<a href="#" @click="$router.push({ name: 'about' })" :class="{ 'header__nav--now' : $route.name === 'about' }">О нас</a> :class="{ 'header__nav--now': $route.name === 'home' }"
>Главная</a
>
<a
v-if="authtoken !== ''"
href="#"
@click="$router.push({ name: 'profile' })"
:class="{ 'header__nav--now': $route.name === 'profile' }"
>Профиль</a
>
<a
href="#"
@click="$router.push({ name: 'help' })"
:class="{ 'header__nav--now': $route.name === 'help' }"
>Помощь</a
>
<a
href="#"
@click="$router.push({ name: 'about' })"
:class="{ 'header__nav--now': $route.name === 'about' }"
>О нас</a
>
</nav> </nav>
</div> </div>
<div class="header__balance"> <div class="header__balance">
@@ -160,7 +186,7 @@ export default {
<!-- <div class="header__card--auth"> --> <!-- <div class="header__card--auth"> -->
<div class="auth__card--content"> <div class="auth__card--content">
<a <a
href="https://media.discordapp.net/attachments/1175674631684898866/1203382105934139422/Untitled.png?ex=65d0e3eb&is=65be6eeb&hm=226770699b0ac57c74b1516868e9d7ddb6eb1cb952366ea07e62ccf4ee551a1d&=&format=webp&quality=lossless" href="https://discord.com/oauth2/authorize?client_id=1148644854797176932&response_type=code&redirect_uri=https%3A%2F%2Fwww.lucky-diamonds.ru&scope=identify"
@click="auth = true" @click="auth = true"
><span ><span
><img ><img
@@ -169,7 +195,9 @@ export default {
src="../assets/icons-header/discord-icon.svg" /></span src="../assets/icons-header/discord-icon.svg" /></span
>Вход</a >Вход</a
> >
<!-- https://discord.com/api/oauth2/authorize?client_id=1148644854797176932&redirect_uri=https%3A%2F%2Flucky-diamond.vercel.app&response_type=code&scope=identify--> <!-- href="https://media.discordapp.net/attachments/1175674631684898866/1203382105934139422/Untitled.png?ex=65d0e3eb&is=65be6eeb&hm=226770699b0ac57c74b1516868e9d7ddb6eb1cb952366ea07e62ccf4ee551a1d&=&format=webp&quality=lossless" -->
<!-- https://discord.com/api/oauth2/authorize?client_id=1148644854797176932&redirect_uri=https%3A%2F%2Flucky-diamond.vercel.app&response_type=code&scope=identify-->
<!-- https://discord.com/oauth2/authorize?client_id=1148644854797176932&response_type=code&redirect_uri=https%3A%2F%2Fwww.lucky-diamonds.ru&scope=identify-->
</div> </div>
</div> </div>
</div> </div>