Revert "Merge pull request #21 from danilt2000/DevelopCkutls"

This reverts commit 25c8bab94f, reversing
changes made to 3b06b7ef2d.
This commit is contained in:
rafael1209
2024-04-08 21:05:36 +03:00
parent cf57aaa54c
commit 2d65e4cd74
16 changed files with 94 additions and 1324 deletions

View File

@@ -8,45 +8,15 @@
<div class="header-mobile__balance">
<div class="header-mobile__balance--content">
<div class="header-mobile__card card-display card-text card-img">
<h2><img src="@/assets/icons-adaptive/home-adaptive/icon-diamond-ore.png">{{ balance }}</h2>
<h2><img src="@/assets/icons-adaptive/home-adaptive/icon-diamond-ore.png">999</h2>
</div>
<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>
</div>
</div>
</div>
<!-- <div class="header-mobile__user-icon user-icon">-->
<!-- <img src="@/assets/icons-test/person-icon-profile-userinfo.png">-->
<!-- </div>-->
<div class="header__auth--discord">
<div v-if="auth" class="header__card--discord mobile-discord__card">
<div class="discord__card--name">
<h2>{{ userName }}</h2>
<a href="#" @click="logout"
>Выход<span
><img src="@/assets/icons-header/exit-icon.png" /></span
></a>
</div>
<img :src="imageUrl" alt="test-ico" />
<!-- <img src="../assets/icons-test/person-icon.svg" alt="test-ico"> -->
</div>
<div v-else class="header__card--auth">
<!-- <div class="header__card--auth"> -->
<div class="auth__card--content mobile-auth__card--content">
<a
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"
><span
><img
width="30"
height="30"
src="@/assets/icons-header/discord-icon.svg" /></span
>Вход</a
>
<!-- https://media.discordapp.net/attachments/1175674631684898866/1214143880073842698/Undwadtitled.png?ex=65f80a9a&is=65e5959a&hm=9cb0ffffa2bfc6ee9302f8d96be7f8c3049dc04df478dd05cdd94f697c662e1d&=&format=webp&quality=lossless -->
<!-- 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 class="header-mobile__user-icon user-icon">
<img src="@/assets/icons-test/person-icon-profile-userinfo.png">
</div>
</div>
</div>
@@ -55,119 +25,8 @@
<script>
import '@/assets/css/ComponentsStyles/AdaptiveStyles/headermobile.css'
import { LogIn } from "@/assets/js/authentication/AuthService.js";
import { GetCurrentMoney } from "@/assets/js/rest/RestMethods.js";
import { eventBus } from "@/main";
import {
SetCookie,
GetCookie,
DeleteAllCookie,
} from "@/assets/js/storage/CookieStorage.js";
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>

View File

@@ -2,11 +2,11 @@
<footer class="footer-mobile">
<div class="footer-mobile__content">
<div class="footer-mobile__icons icons-size">
<a class="icon-center" @click="$router.push({ name: 'home' })" href="#"><img src="@/assets/icons-adaptive/home-adaptive/icon-home-menu.png"></a>
<a :class="{ 'disabled': cokiehave }" @click="$router.push({ name: 'profile' })" class="icon-center" href="#"><img src="@/assets/icons-adaptive/home-adaptive/icon-wallet-menu.svg"></a>
<a class="icon-center" href="#"><img src="@/assets/icons-adaptive/home-adaptive/icon-chat-menu.png"></a>
<a class="icon-center" href="#"><img src="@/assets/icons-adaptive/home-adaptive/icon-info-menu.png"></a>
<a class="icon-center" href="#"><img src="@/assets/icons-adaptive/home-adaptive/icon-menu.png"></a>
<a href="#"><img class="icon-start" src="@/assets/icons-adaptive/home-adaptive/icon-home-menu.png"></a>
<a href="#" @click="$router.push({ name: 'profile' })"><img class="icon-center" src="@/assets/icons-adaptive/home-adaptive/icon-wallet-menu.svg"></a>
<a href="#"><img class="icon-center" src="@/assets/icons-adaptive/home-adaptive/icon-chat-menu.png"></a>
<a href="#"><img class="icon-center" src="@/assets/icons-adaptive/home-adaptive/icon-info-menu.png"></a>
<a href="#"><img class="icon-end" src="@/assets/icons-adaptive/home-adaptive/icon-menu.png"></a>
</div>
</div>
</footer>
@@ -14,24 +14,11 @@
<script>
import '@/assets/css/ComponentsStyles/AdaptiveStyles/menumobile.css'
import { GetCookie } from "@/assets/js/storage/CookieStorage";
export default {
data() {
return {
cokiehave: true
}
},
created() {
const auth = GetCookie('AUTHTOKEN')
const search = GetCookie('SearchToken')
if (auth && search) {
this.cokiehave = false
}
}
}
</script>
<style scoped>
</style>
</style>

View File

@@ -12,39 +12,27 @@
<h2>Сумма {{ payments.paymentsView ? 'пополнения' : 'вывода' }}</h2>
<div class="payments-modal__input input-style__mobile img-style">
<img src="@/assets/icons-games/saper-game/icon-diamond-ore-saper.png">
<input type="number" v-model="amount" class="input-mobile__number">
<input type="number" v-model="number" class="input-mobile__number">
<div class="payments-modal__btns-mobile">
<ul class="button-style__mobile">
<li v-for="(number, index) in PaymentsModalNumbers" :key="index">
<button
@click="clickedBtnChoice(index, number.diamonds)"
:class="{
'btn-click': clickedBtn === index,
[number]: clickedBtn === number,
}"
>
{{ number.diamonds }}
</button>
<li v-for="number in PaymentsModalNumbers" :key="number">
<button>{{ number.diamonds }}</button>
</li>
</ul>
</div>
<div class="payments-modal__card input-style__mobile" v-if="payments.paymentsView === false">
<h2>Номер карты</h2>
<input type="text" v-model="card" class="input-mobile__number">
</div>
</div>
<div class="payments-modal__promocode input-style__mobile" v-if="payments.paymentsView === true">
<input type="text" placeholder="Введите промокод">
</div>
<div class="payments-modal__agree checkbox-styles">
<input v-if="!payments.paymentsView" type="checkbox" @click="agreeUser = !agreeUser">
<input v-else type="checkbox" @click="agreeUserDonate = !agreeUserDonate">
<input v-if="!payments.paymentsView" type="checkbox" v-model="agreeUser">
<input v-else type="checkbox">
<h3>Я согласен с пользовательским соглашением.</h3>
</div>
<captcha-component class="captcha-mobile" @captchatokendata="claimCaptchaToken" :showcaptcha="agreeUser"></captcha-component>
<captcha-component class="captcha-mobile" :showcaptcha="agreeUser"></captcha-component>
<div class="payments-modal__submit">
<p>Вы подтверждаете правильность введенных данных при создании вывода.</p>
<button @click="clickBtn()">{{ payments.paymentsView ? 'Пополнить' : 'Вывод' }}</button>
<button @click="closeModal()">{{ payments.paymentsView ? 'Пополнить' : 'Вывод' }}</button>
</div>
</div>
</div>
@@ -54,26 +42,6 @@
import PaymentsModalNumbers from "@/mocks/PaymentsModalNumbers";
import CaptchaComponent from "@/components/CaptchaComponent.vue";
import {
GettingMoneyOperation,
WithdrawMoneyOperation,
} from "@/assets/js/moneyoperation/Claimmoney";
import { eventBus } from "@/main";
import { useVuelidate } from "@vuelidate/core";
import {
minValue,
required,
numeric,
integer,
minLength,
maxLength,
} from "@vuelidate/validators";
import { GetCurrentMoney } from "@/assets/js/rest/RestMethods";
import { GetCookie } from "@/assets/js/storage/CookieStorage";
// import { ApplyPromoCode } from "@/assets/js/rest/RestMethods.js"; // Замените на правильный путь к файлу с функцией ApplyPromoCode
import '@/assets/css/ComponentsStyles/AdaptiveStyles/payments-modalmobile.css'
export default {
@@ -83,147 +51,13 @@ export default {
return {
PaymentsModalNumbers,
agreeUser: false,
agreeUserDonate: false,
amount: 0,
card: '',
captchaToken: null,
url: '',
clickedBtn: "",
}
},
watch: {
amount(DepositCount) {
console.log(DepositCount);
if (![1, 5, 10, 50, 100, 1000].includes(DepositCount)) {
this.clickedBtn = null;
} else {
let index;
switch (DepositCount) {
case 1:
index = 0;
break;
case 5:
index = 1;
break;
case 10:
index = 2;
break;
case 50:
index = 3;
break;
case 100:
index = 4;
break;
case 1000:
index = 5;
break;
}
this.clickedBtnChoice(index, DepositCount);
}
}
},
setup() {
return { v$: useVuelidate() };
},
validations() {
return {
amount: { required, numeric, minValue: minValue(1), integer },
card: { required, numeric, minLength: minLength(5), maxLength: maxLength(5), integer }
number: 0
}
},
methods: {
closeModal() {
return this.$emit('closemodal')
},
clickBtn() {
this.v$.$touch()
if (this.payments.paymentsView === true) {
if (this.v$.amount.$error) {
console.log('error amount')
}
if (this.agreeUserDonate !== true) {
console.log('agreeuser error')
}
if (
!this.v$.amount.$error &&
this.agreeUserDonate === true
) {
try {
GettingMoneyOperation(this.amount).then((response) => {
this.url = response
window.location.href = this.url;
})
}
catch (e) {
console.error(e)
}
}
}
else if (this.payments.paymentsView === false) {
this.v$.$touch()
if (this.v$.amount.$error) {
console.log('amount error')
}
if (this.v$.card.$error) {
console.log('card error')
}
if (this.agreeUser !== true) {
console.log('agree error')
}
if (this.captchaToken === null) {
console.log('token error')
}
let balanceUser = 0
GetCurrentMoney(GetCookie('AUTHTOKEN'), GetCookie('SearchToken'))
.then((response) => {
balanceUser = response.currentMoney
})
if (this.amount < balanceUser) {
console.log('money small balance')
}
if (
!this.v$.amount.$error &&
!this.v$.card.$error &&
this.agreeUser === true &&
this.captchaToken !== null &&
this.amount >= balanceUser
) {
WithdrawMoneyOperation(
this.amount,
this.card.toString(),
this.captchaToken
) .then((response) => {
try {
console.log('work', response)
eventBus.emit('Updatebalance')
return this.$emit('closemodal')
}
catch (e) {
console.error(e)
}
})
}
}
},
claimCaptchaToken(Token) {
this.captchaToken = Token
},
clickedBtnChoice(index, content) {
this.clickedBtn = index;
this.amount = content;
console.log(index);
},
}
}
}
</script>