|
|
|
@ -43,19 +43,18 @@
|
|
|
|
|
}
|
|
|
|
|
function jsonRequest(data) {
|
|
|
|
|
nav.barShow();
|
|
|
|
|
nav.tipShow();
|
|
|
|
|
return jsonService.request(data)
|
|
|
|
|
.then(function (response) {
|
|
|
|
|
nav.tipClose();
|
|
|
|
|
if (response.data.errors) {// 确保服务器正确返回Json
|
|
|
|
|
if (response.data.errors && response.data.errors.length == 0) {
|
|
|
|
|
nav.barFinish();
|
|
|
|
|
} else if(response.data.errors && response.data.errors.length > 0) {
|
|
|
|
|
nav.barError();
|
|
|
|
|
} else {
|
|
|
|
|
response.data = {errors: [{message: '服务器响应错误'}]};
|
|
|
|
|
nav.barError();
|
|
|
|
|
}
|
|
|
|
|
return Promise.resolve(response.data);
|
|
|
|
|
}, function (error) {
|
|
|
|
|
nav.tipClose();
|
|
|
|
|
nav.barError();
|
|
|
|
|
const rsp = {errors: []};
|
|
|
|
|
if (!error.response) {
|
|
|
|
@ -449,38 +448,24 @@
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
barShow: function () {
|
|
|
|
|
if (!this.loadingBar) {
|
|
|
|
|
this.loadingBar = this.$message({
|
|
|
|
|
type: '',
|
|
|
|
|
duration: 0,
|
|
|
|
|
customClass: 'loading-bar',
|
|
|
|
|
dangerouslyUseHTMLString: true,
|
|
|
|
|
message: '<i class="bar" style="width: 90%"></i>'
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.loadingBar.message = '<i class="bar" style="width: 90%"></i>'
|
|
|
|
|
if (window.index) {
|
|
|
|
|
window.index.barStart();
|
|
|
|
|
} else if (window.parent.index) {
|
|
|
|
|
window.parent.index.barStart();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
barFinish: function () {
|
|
|
|
|
if (this.loadingBar) {
|
|
|
|
|
this.loadingBar.message = '<i class="bar" style="width: 100%"></i>'
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
if (this.loadingBar) {
|
|
|
|
|
this.loadingBar.close();
|
|
|
|
|
this.loadingBar = '';
|
|
|
|
|
}
|
|
|
|
|
}.bind(this), 500);
|
|
|
|
|
if (window.index) {
|
|
|
|
|
window.index.barFinish();
|
|
|
|
|
} else if (window.parent.index) {
|
|
|
|
|
window.parent.index.barFinish();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
barError: function () {
|
|
|
|
|
if (this.loadingBar) {
|
|
|
|
|
this.loadingBar.message = '<i class="bar error" style="width: 100%"></i>'
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
if (this.loadingBar) {
|
|
|
|
|
this.loadingBar.close();
|
|
|
|
|
this.loadingBar = '';
|
|
|
|
|
}
|
|
|
|
|
}.bind(this), 500);
|
|
|
|
|
if (window.index) {
|
|
|
|
|
window.index.barError();
|
|
|
|
|
} else if (window.parent.index) {
|
|
|
|
|
window.parent.index.barError();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
i: function (message, callback) {
|
|
|
|
|