style: 登录成功加载效果
This commit is contained in:
parent
7318b8917d
commit
76db0c41d3
2
resources/assets/js/app.js
vendored
2
resources/assets/js/app.js
vendored
@ -70,9 +70,11 @@ ViewUI.LoadingBar.config({
|
|||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
ViewUI.LoadingBar.start();
|
ViewUI.LoadingBar.start();
|
||||||
next();
|
next();
|
||||||
|
setTimeout($A.spinnerShow, 1000);
|
||||||
});
|
});
|
||||||
router.afterEach(() => {
|
router.afterEach(() => {
|
||||||
ViewUI.LoadingBar.finish();
|
ViewUI.LoadingBar.finish();
|
||||||
|
$A.spinnerHide();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 加载函数
|
// 加载函数
|
||||||
|
22
resources/assets/js/functions/web.js
vendored
22
resources/assets/js/functions/web.js
vendored
@ -9,6 +9,28 @@
|
|||||||
* =============================================================================
|
* =============================================================================
|
||||||
*/
|
*/
|
||||||
$.extend({
|
$.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) {
|
modalConfig(config) {
|
||||||
if (typeof config === "undefined") {
|
if (typeof config === "undefined") {
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<Icon type="ios-checkmark-circle-outline" class="login-icon" slot="prepend"></Icon>
|
<Icon type="ios-checkmark-circle-outline" class="login-icon" slot="prepend"></Icon>
|
||||||
<div slot="append" class="login-code-end" @click="reCode"><img :src="codeUrl"/></div>
|
<div slot="append" class="login-code-end" @click="reCode"><img :src="codeUrl"/></div>
|
||||||
</Input>
|
</Input>
|
||||||
<Button type="primary" :loading="loadIng > 0" size="large" long @click="onLogin">{{$L(loginType=='login'?'登录':'注册')}}</Button>
|
<Button type="primary" :loading="loadIng > 0 || loginJump" size="large" long @click="onLogin">{{$L(loginText)}}</Button>
|
||||||
|
|
||||||
<div v-if="loginType=='reg'" class="login-switch">{{$L('已经有帐号?')}}<a href="javascript:void(0)" @click="loginType='login'">{{$L('登录帐号')}}</a></div>
|
<div v-if="loginType=='reg'" class="login-switch">{{$L('已经有帐号?')}}<a href="javascript:void(0)" @click="loginType='login'">{{$L('登录帐号')}}</a></div>
|
||||||
<div v-else class="login-switch">{{$L('还没有帐号?')}}<a href="javascript:void(0)" @click="loginType='reg'">{{$L('注册帐号')}}</a></div>
|
<div v-else class="login-switch">{{$L('还没有帐号?')}}<a href="javascript:void(0)" @click="loginType='reg'">{{$L('注册帐号')}}</a></div>
|
||||||
@ -59,6 +59,7 @@ export default {
|
|||||||
codeUrl: this.$store.state.method.apiUrl('users/login/codeimg'),
|
codeUrl: this.$store.state.method.apiUrl('users/login/codeimg'),
|
||||||
|
|
||||||
loginType: 'login',
|
loginType: 'login',
|
||||||
|
loginJump: false,
|
||||||
email: this.$store.state.method.getStorageString("cacheLoginEmail") || '',
|
email: this.$store.state.method.getStorageString("cacheLoginEmail") || '',
|
||||||
password: '',
|
password: '',
|
||||||
password2: '',
|
password2: '',
|
||||||
@ -70,9 +71,19 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
this.getDemoAccount();
|
this.getDemoAccount();
|
||||||
},
|
},
|
||||||
|
deactivated() {
|
||||||
|
this.loginJump = false;
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
currentLanguage() {
|
currentLanguage() {
|
||||||
return this.languageList[this.languageType] || 'Language'
|
return this.languageList[this.languageType] || 'Language'
|
||||||
|
},
|
||||||
|
loginText() {
|
||||||
|
let text = this.loginType == 'login' ? '登录' : '注册';
|
||||||
|
if (this.loginJump) {
|
||||||
|
text += "成功..."
|
||||||
|
}
|
||||||
|
return text
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -160,6 +171,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
goNext() {
|
goNext() {
|
||||||
|
this.loginJump = true;
|
||||||
let fromUrl = decodeURIComponent($A.getObject(this.$route.query, 'from'));
|
let fromUrl = decodeURIComponent($A.getObject(this.$route.query, 'from'));
|
||||||
if (fromUrl) {
|
if (fromUrl) {
|
||||||
window.location.replace(fromUrl);
|
window.location.replace(fromUrl);
|
||||||
|
17
resources/assets/js/store/actions.js
vendored
17
resources/assets/js/store/actions.js
vendored
@ -20,23 +20,6 @@ export default {
|
|||||||
//
|
//
|
||||||
const cloneParams = state.method.cloneJSON(params);
|
const cloneParams = state.method.cloneJSON(params);
|
||||||
return new Promise(function (resolve, reject) {
|
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) => {
|
params.success = (result, status, xhr) => {
|
||||||
if (!state.method.isJson(result)) {
|
if (!state.method.isJson(result)) {
|
||||||
console.log(result, status, xhr);
|
console.log(result, status, xhr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user