mirror of
https://github.com/yawaflua/LuckyDiamond.git
synced 2026-02-04 10:14:14 +02:00
Adding user in balance page for mobile
This commit is contained in:
committed by
GitHub
parent
850a62626f
commit
108709b24f
@@ -8,7 +8,7 @@
|
|||||||
<div class="header-mobile__balance">
|
<div class="header-mobile__balance">
|
||||||
<div class="header-mobile__balance--content">
|
<div class="header-mobile__balance--content">
|
||||||
<div class="header-mobile__card card-display card-text card-img">
|
<div class="header-mobile__card card-display card-text card-img">
|
||||||
<h2><img src="@/assets/icons-adaptive/home-adaptive/icon-diamond-ore.png">999</h2>
|
<h2><img src="@/assets/icons-adaptive/home-adaptive/icon-diamond-ore.png">{{ this.balance}}</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="header-mobile__btn--balance btn-card btn-card__margin">
|
<div class="header-mobile__btn--balance btn-card btn-card__margin">
|
||||||
<a href="#" @click="$router.push({ name: 'profile' })"><img src="@/assets/icons-adaptive/home-adaptive/icon-wallet.svg"></a>
|
<a href="#" @click="$router.push({ name: 'profile' })"><img src="@/assets/icons-adaptive/home-adaptive/icon-wallet.svg"></a>
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="header-mobile__user-icon user-icon">
|
<div class="header-mobile__user-icon user-icon">
|
||||||
<img src="@/assets/icons-test/person-icon-profile-userinfo.png">
|
<img :src="this.imageUrl">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -26,7 +26,106 @@
|
|||||||
<script>
|
<script>
|
||||||
import '@/assets/css/ComponentsStyles/AdaptiveStyles/headermobile.css'
|
import '@/assets/css/ComponentsStyles/AdaptiveStyles/headermobile.css'
|
||||||
export default {
|
export default {
|
||||||
|
methods: {
|
||||||
|
logout() {
|
||||||
|
this.auth = false;
|
||||||
|
this.balance = 0;
|
||||||
|
this.authtoken = "";
|
||||||
|
DeleteAllCookie();
|
||||||
|
},
|
||||||
|
updateBalanceMethod() {
|
||||||
|
GetCurrentMoney(GetCookie("AUTHTOKEN"), GetCookie("SearchToken")).then(
|
||||||
|
(response) => {
|
||||||
|
this.balance = response.currentMoney;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
eventBus.emit("Updatebalance-saper");
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
balance: 0,
|
||||||
|
auth: false,
|
||||||
|
authtoken: "",
|
||||||
|
imageUrl: "https://avatar.spworlds.ru/face/55/",
|
||||||
|
userName: "",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
eventBus.on("Updatebalance", () => {
|
||||||
|
this.updateBalanceMethod();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
try {
|
||||||
|
let authCode = this.$route.query.code;
|
||||||
|
|
||||||
|
if (authCode) {
|
||||||
|
LogIn(authCode)
|
||||||
|
.then((response) => {
|
||||||
|
SetCookie("UserId", response.userId);
|
||||||
|
SetCookie("SpUserName", response.spUserName);
|
||||||
|
SetCookie("AUTHTOKEN", response.authtoken);
|
||||||
|
SetCookie("SearchToken", response.searchToken);
|
||||||
|
|
||||||
|
this.imageUrl = this.imageUrl + `${response.spUserName}.png`;
|
||||||
|
this.userName = response.spUserName;
|
||||||
|
this.auth = true;
|
||||||
|
this.authtoken = response.authtoken;
|
||||||
|
GetCurrentMoney(GetCookie("AUTHTOKEN"), GetCookie("SearchToken"))
|
||||||
|
.then((response) => {
|
||||||
|
this.balance = response.currentMoney;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
let currentUserName = GetCookie("SpUserName");
|
||||||
|
GetCurrentMoney(GetCookie("AUTHTOKEN"), GetCookie("SearchToken"))
|
||||||
|
.then((response) => {
|
||||||
|
this.balance = response.currentMoney;
|
||||||
|
console.log(response);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (currentUserName) {
|
||||||
|
this.imageUrl = this.imageUrl + `${currentUserName}.png`;
|
||||||
|
this.userName = GetCookie("SpUserName");
|
||||||
|
this.auth = true;
|
||||||
|
this.authtoken = GetCookie("AUTHTOKEN");
|
||||||
|
} else {
|
||||||
|
this.auth = false;
|
||||||
|
this.balance = 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
let currentUserName = GetCookie("SpUserName");
|
||||||
|
GetCurrentMoney(GetCookie("AUTHTOKEN"), GetCookie("SearchToken"))
|
||||||
|
.then((response) => {
|
||||||
|
this.balance = response.currentMoney;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
// Обработка ошибки
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (currentUserName) {
|
||||||
|
this.imageUrl = this.imageUrl + `${currentUserName}.png`;
|
||||||
|
this.userName = GetCookie("SpUserName");
|
||||||
|
this.auth = true;
|
||||||
|
this.authtoken = GetCookie("AUTHTOKEN");
|
||||||
|
} else {
|
||||||
|
this.auth = false;
|
||||||
|
this.balance = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Auth Code error:", error);
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
<div class="profile-mobile__content">
|
<div class="profile-mobile__content">
|
||||||
<div class="macroinfo-profile text-default-mobile img-margin">
|
<div class="macroinfo-profile text-default-mobile img-margin">
|
||||||
<h2>Профиль</h2>
|
<h2>Профиль</h2>
|
||||||
<img src="@/assets/icons-test/person-icon-profile-userinfo.png">
|
<img :src="this.imageUrl">
|
||||||
</div>
|
</div>
|
||||||
<div class="info-profile">
|
<div class="info-profile">
|
||||||
<h3 class="text-nickname-user">Artmeka</h3>
|
<h3 class="text-nickname-user">{{this.userName}}</h3>
|
||||||
<h3 class="balance-border balance-display balance-text"><img src="@/assets/icons-profile/icon-diamond-ore.png">999</h3>
|
<h3 class="balance-border balance-display balance-text"><img src="@/assets/icons-profile/icon-diamond-ore.png">999</h3>
|
||||||
<div class="profile-mobile__btns-payments">
|
<div class="profile-mobile__btns-payments">
|
||||||
<a href="#" @click="paymetsCall('dep')" class="deposit-button"><img class="icon-margin-deposit-withdraw" src="@/assets/icons-profile/icon-deposit.svg"> Пополнить</a>
|
<a href="#" @click="paymetsCall('dep')" class="deposit-button"><img class="icon-margin-deposit-withdraw" src="@/assets/icons-profile/icon-deposit.svg"> Пополнить</a>
|
||||||
@@ -31,15 +31,7 @@ import PaymentsMobile from "@/components/adaptive-components/PaymentsMobile.vue"
|
|||||||
import '@/assets/css/PagesStyles/adaptive-pages/profilemobile.css'
|
import '@/assets/css/PagesStyles/adaptive-pages/profilemobile.css'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { HeaderMobileComponent, MenuMobileComponent, PaymentsMobile },
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
payments: {
|
|
||||||
paymentsWindow: false,
|
|
||||||
paymentsView: false
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
paymetsCall(view) {
|
paymetsCall(view) {
|
||||||
this.payments.paymentsWindow = true
|
this.payments.paymentsWindow = true
|
||||||
@@ -47,8 +39,111 @@ export default {
|
|||||||
},
|
},
|
||||||
paymentsClose() {
|
paymentsClose() {
|
||||||
this.payments.paymentsWindow = false
|
this.payments.paymentsWindow = false
|
||||||
|
},
|
||||||
|
logout() {
|
||||||
|
this.auth = false;
|
||||||
|
this.balance = 0;
|
||||||
|
this.authtoken = "";
|
||||||
|
DeleteAllCookie();
|
||||||
|
},
|
||||||
|
updateBalanceMethod() {
|
||||||
|
GetCurrentMoney(GetCookie("AUTHTOKEN"), GetCookie("SearchToken")).then(
|
||||||
|
(response) => {
|
||||||
|
this.balance = response.currentMoney;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
eventBus.emit("Updatebalance-saper");
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
balance: 0,
|
||||||
|
auth: false,
|
||||||
|
authtoken: "",
|
||||||
|
imageUrl: "https://avatar.spworlds.ru/face/55/",
|
||||||
|
userName: "",
|
||||||
|
payments: {
|
||||||
|
paymentsWindow: false,
|
||||||
|
paymentsView: false
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
eventBus.on("Updatebalance", () => {
|
||||||
|
this.updateBalanceMethod();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
try {
|
||||||
|
let authCode = this.$route.query.code;
|
||||||
|
|
||||||
|
if (authCode) {
|
||||||
|
LogIn(authCode)
|
||||||
|
.then((response) => {
|
||||||
|
SetCookie("UserId", response.userId);
|
||||||
|
SetCookie("SpUserName", response.spUserName);
|
||||||
|
SetCookie("AUTHTOKEN", response.authtoken);
|
||||||
|
SetCookie("SearchToken", response.searchToken);
|
||||||
|
|
||||||
|
this.imageUrl = this.imageUrl + `${response.spUserName}.png`;
|
||||||
|
this.userName = response.spUserName;
|
||||||
|
this.auth = true;
|
||||||
|
this.authtoken = response.authtoken;
|
||||||
|
GetCurrentMoney(GetCookie("AUTHTOKEN"), GetCookie("SearchToken"))
|
||||||
|
.then((response) => {
|
||||||
|
this.balance = response.currentMoney;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
let currentUserName = GetCookie("SpUserName");
|
||||||
|
GetCurrentMoney(GetCookie("AUTHTOKEN"), GetCookie("SearchToken"))
|
||||||
|
.then((response) => {
|
||||||
|
this.balance = response.currentMoney;
|
||||||
|
console.log(response);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (currentUserName) {
|
||||||
|
this.imageUrl = this.imageUrl + `${currentUserName}.png`;
|
||||||
|
this.userName = GetCookie("SpUserName");
|
||||||
|
this.auth = true;
|
||||||
|
this.authtoken = GetCookie("AUTHTOKEN");
|
||||||
|
} else {
|
||||||
|
this.auth = false;
|
||||||
|
this.balance = 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
let currentUserName = GetCookie("SpUserName");
|
||||||
|
GetCurrentMoney(GetCookie("AUTHTOKEN"), GetCookie("SearchToken"))
|
||||||
|
.then((response) => {
|
||||||
|
this.balance = response.currentMoney;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
// Обработка ошибки
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (currentUserName) {
|
||||||
|
this.imageUrl = this.imageUrl + `${currentUserName}.png`;
|
||||||
|
this.userName = GetCookie("SpUserName");
|
||||||
|
this.auth = true;
|
||||||
|
this.authtoken = GetCookie("AUTHTOKEN");
|
||||||
|
} else {
|
||||||
|
this.auth = false;
|
||||||
|
this.balance = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Auth Code error:", error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: { HeaderMobileComponent, MenuMobileComponent, PaymentsMobile },
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user