From 76db0c41d3bac7f42ef79cb0cdf7bad900144ef7 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Sun, 26 Dec 2021 00:11:44 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E7=99=BB=E5=BD=95=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/assets/js/app.js | 2 ++ resources/assets/js/functions/web.js | 22 ++++++++++++++++++++++ resources/assets/js/pages/login.vue | 14 +++++++++++++- resources/assets/js/store/actions.js | 17 ----------------- 4 files changed, 37 insertions(+), 18 deletions(-) diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js index 0caa3ae5..3202f92f 100644 --- a/resources/assets/js/app.js +++ b/resources/assets/js/app.js @@ -70,9 +70,11 @@ ViewUI.LoadingBar.config({ router.beforeEach((to, from, next) => { ViewUI.LoadingBar.start(); next(); + setTimeout($A.spinnerShow, 1000); }); router.afterEach(() => { ViewUI.LoadingBar.finish(); + $A.spinnerHide(); }); // 加载函数 diff --git a/resources/assets/js/functions/web.js b/resources/assets/js/functions/web.js index d47e0bd1..9e90c97a 100755 --- a/resources/assets/js/functions/web.js +++ b/resources/assets/js/functions/web.js @@ -9,6 +9,28 @@ * ============================================================================= */ $.extend({ + // 加载器 + spinnerShow() { + $A.spinnerLoadNum++ + if ($A.spinnerLoadNum > 0) { + const spinner = document.getElementById("common-spinner"); + if (spinner) { + spinner.style.display = "block" + } + } + }, + + spinnerHide() { + $A.spinnerLoadNum-- + if ($A.spinnerLoadNum <= 0) { + const spinner = document.getElementById("common-spinner"); + if (spinner) { + spinner.style.display = "none" + } + } + }, + spinnerLoadNum: 0, + // 弹窗 modalConfig(config) { if (typeof config === "undefined") { diff --git a/resources/assets/js/pages/login.vue b/resources/assets/js/pages/login.vue index 3d9c6c14..16fee88d 100644 --- a/resources/assets/js/pages/login.vue +++ b/resources/assets/js/pages/login.vue @@ -24,7 +24,7 @@
- +
{{$L('已经有帐号?')}}{{$L('登录帐号')}}
{{$L('还没有帐号?')}}{{$L('注册帐号')}}
@@ -59,6 +59,7 @@ export default { codeUrl: this.$store.state.method.apiUrl('users/login/codeimg'), loginType: 'login', + loginJump: false, email: this.$store.state.method.getStorageString("cacheLoginEmail") || '', password: '', password2: '', @@ -70,9 +71,19 @@ export default { mounted() { this.getDemoAccount(); }, + deactivated() { + this.loginJump = false; + }, computed: { currentLanguage() { return this.languageList[this.languageType] || 'Language' + }, + loginText() { + let text = this.loginType == 'login' ? '登录' : '注册'; + if (this.loginJump) { + text += "成功..." + } + return text } }, methods: { @@ -160,6 +171,7 @@ export default { }, goNext() { + this.loginJump = true; let fromUrl = decodeURIComponent($A.getObject(this.$route.query, 'from')); if (fromUrl) { window.location.replace(fromUrl); diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index a480b8c3..e3810f18 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -20,23 +20,6 @@ export default { // const cloneParams = state.method.cloneJSON(params); return new Promise(function (resolve, reject) { - if (params.spinner === true) { - const spinner = document.getElementById("common-spinner"); - if (spinner) { - params.before = () => { - state.ajaxLoadNum++; - spinner.style.display = "block" - }; - // - params.complete = () => { - state.ajaxLoadNum--; - if (state.ajaxLoadNum <= 0) { - spinner.style.display = "none" - } - }; - } - } - // params.success = (result, status, xhr) => { if (!state.method.isJson(result)) { console.log(result, status, xhr);