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) => {
|
||||
ViewUI.LoadingBar.start();
|
||||
next();
|
||||
setTimeout($A.spinnerShow, 1000);
|
||||
});
|
||||
router.afterEach(() => {
|
||||
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({
|
||||
// 加载器
|
||||
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") {
|
||||
|
@ -24,7 +24,7 @@
|
||||
<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>
|
||||
</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-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'),
|
||||
|
||||
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);
|
||||
|
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);
|
||||
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user