mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-10-13 19:49:12 +00:00
Minor Fixes
This commit is contained in:
parent
0b888f8734
commit
7d0254a7f0
1 changed files with 34 additions and 53 deletions
|
@ -108,17 +108,11 @@
|
||||||
el: '#app',
|
el: '#app',
|
||||||
data: {
|
data: {
|
||||||
themeSwitcher,
|
themeSwitcher,
|
||||||
loadingStates: {
|
loadingStates: { fetched: false, spinning: false },
|
||||||
fetched: false,
|
user: { username: "", password: "", twoFactorCode: "" },
|
||||||
spinning: false
|
|
||||||
},
|
|
||||||
user: {
|
|
||||||
username: "",
|
|
||||||
password: "",
|
|
||||||
twoFactorCode: ""
|
|
||||||
},
|
|
||||||
twoFactorEnable: false,
|
twoFactorEnable: false,
|
||||||
lang: ""
|
lang: "",
|
||||||
|
animationStarted: false
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
this.lang = LanguageManager.getLanguage();
|
this.lang = LanguageManager.getLanguage();
|
||||||
|
@ -127,65 +121,52 @@
|
||||||
methods: {
|
methods: {
|
||||||
async login() {
|
async login() {
|
||||||
this.loadingStates.spinning = true;
|
this.loadingStates.spinning = true;
|
||||||
|
|
||||||
const msg = await HttpUtil.post('/login', this.user);
|
const msg = await HttpUtil.post('/login', this.user);
|
||||||
|
|
||||||
if (msg.success) {
|
if (msg.success) {
|
||||||
location.href = basePath + 'panel/';
|
location.href = basePath + 'panel/';
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loadingStates.spinning = false;
|
this.loadingStates.spinning = false;
|
||||||
},
|
},
|
||||||
async getTwoFactorEnable() {
|
async getTwoFactorEnable() {
|
||||||
const msg = await HttpUtil.post('/getTwoFactorEnable');
|
const msg = await HttpUtil.post('/getTwoFactorEnable');
|
||||||
|
|
||||||
if (msg.success) {
|
if (msg.success) {
|
||||||
this.twoFactorEnable = msg.obj;
|
this.twoFactorEnable = msg.obj;
|
||||||
this.loadingStates.fetched = true;
|
this.loadingStates.fetched = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if (!this.animationStarted) {
|
||||||
|
this.animationStarted = true;
|
||||||
|
this.initHeadline();
|
||||||
|
}
|
||||||
|
});
|
||||||
return msg.obj;
|
return msg.obj;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
initHeadline() {
|
||||||
|
const animationDelay = 2000;
|
||||||
|
const headlines = this.$el.querySelectorAll('.headline');
|
||||||
|
headlines.forEach((headline) => {
|
||||||
|
const first = headline.querySelector('.is-visible');
|
||||||
|
if (!first) return;
|
||||||
|
setTimeout(() => this.hideWord(first, animationDelay), animationDelay);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
hideWord(word, delay) {
|
||||||
|
const nextWord = this.takeNext(word);
|
||||||
|
this.switchWord(word, nextWord);
|
||||||
|
setTimeout(() => this.hideWord(nextWord, delay), delay);
|
||||||
|
},
|
||||||
|
takeNext(word) {
|
||||||
|
return word.nextElementSibling || word.parentElement.firstElementChild;
|
||||||
|
},
|
||||||
|
switchWord(oldWord, newWord) {
|
||||||
|
oldWord.classList.remove('is-visible');
|
||||||
|
oldWord.classList.add('is-hidden');
|
||||||
|
newWord.classList.remove('is-hidden');
|
||||||
|
newWord.classList.add('is-visible');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
|
||||||
var animationDelay = 2000;
|
|
||||||
initHeadline();
|
|
||||||
|
|
||||||
function initHeadline() {
|
|
||||||
animateHeadline(document.querySelectorAll('.headline'));
|
|
||||||
}
|
|
||||||
|
|
||||||
function animateHeadline(headlines) {
|
|
||||||
var duration = animationDelay;
|
|
||||||
headlines.forEach(function (headline) {
|
|
||||||
setTimeout(function () {
|
|
||||||
hideWord(headline.querySelector('.is-visible'));
|
|
||||||
}, duration);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function hideWord(word) {
|
|
||||||
var nextWord = takeNext(word);
|
|
||||||
switchWord(word, nextWord);
|
|
||||||
setTimeout(function () {
|
|
||||||
hideWord(nextWord);
|
|
||||||
}, animationDelay);
|
|
||||||
}
|
|
||||||
|
|
||||||
function takeNext(word) {
|
|
||||||
return word.nextElementSibling ? word.nextElementSibling : word.parentElement.firstElementChild;
|
|
||||||
}
|
|
||||||
|
|
||||||
function switchWord(oldWord, newWord) {
|
|
||||||
oldWord.classList.remove('is-visible');
|
|
||||||
oldWord.classList.add('is-hidden');
|
|
||||||
newWord.classList.remove('is-hidden');
|
|
||||||
newWord.classList.add('is-visible');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const pm_input_selector = 'input.ant-input, textarea.ant-input';
|
const pm_input_selector = 'input.ant-input, textarea.ant-input';
|
||||||
const pm_strip_props = [
|
const pm_strip_props = [
|
||||||
'background',
|
'background',
|
||||||
|
@ -261,4 +242,4 @@
|
||||||
pm_init();
|
pm_init();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
{{ template "page/body_end" .}}
|
{{ template "page/body_end" .}}
|
||||||
|
|
Loading…
Reference in a new issue