Joywork/js/vue_scripts/first_entry_vue.js

102 lines
2.5 KiB
JavaScript
Raw Normal View History

2026-05-22 20:21:54 +02:00
var firstentry = new Vue({
el: '#first_entry',
components: {
vuejsDatepicker: window.vuejsDatepicker
},
data() {
return {
ru: vdp_translation_ru.js,
is_show: false,
}
},
methods: {
//Открытие
open() {
this.is_show = true;
$("body").addClass("lock");
$('.jw__add-popup').removeClass('is__show');
},
//Закрытие
closes() {
this.is_show = false;
this.updateCanOpen();
$("body").removeClass("lock");
$('.jw__add-popup').removeClass('is__show');
},
//Переход на видосы
openHelp() {
this.updateCanOpen();
window.location.href = "/help.php";
},
//Проверка входа
canOpen() {
axios.post('/ajax/ajax_first_entry_vue.php', {
request: 'can_open',
}, )
.then((response) => {
var res = response.data;
if (res == 0) {
this.open();
}
})
.catch(function(error) {
console.log(error);
});
},
//Изменение признака первого входа
updateCanOpen() {
axios.post('/ajax/ajax_first_entry_vue.php', {
request: 'update_can_open',
}, )
.then((response) => {
console.log(response.data);
})
.catch(function(error) {
console.log(error);
});
},
//Проверка на пустоту
isEmpty(data) {
if (typeof(data) === 'object') {
if (JSON.stringify(data) === '{}' || JSON.stringify(data) === '[]') {
return true;
} else if (!data) {
return true;
}
return false;
} else if (typeof(data) === 'string') {
if (!data.trim()) {
return true;
}
return false;
} else if (typeof(data) === 'undefined') {
return true;
} else {
return false;
}
},
},
mounted() {
this.canOpen();
},
created: function() {
$("#first_entry").removeClass("hidden");
}
})