feat: v3版疗休养
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
const sublime = {
|
||||
showLoadingbar() {
|
||||
if (!document.getElementById('therapy-loading')) {
|
||||
const bar = document.createElement('div');
|
||||
bar.id = 'therapy-loading';
|
||||
document.body.appendChild(bar);
|
||||
}
|
||||
},
|
||||
closeLoadingbar() {
|
||||
const bar = document.getElementById('therapy-loading');
|
||||
if (bar) bar.remove();
|
||||
}
|
||||
};
|
||||
|
||||
$.ajaxSetup({
|
||||
traditional: true,
|
||||
error(xhr) {
|
||||
sublime.closeLoadingbar();
|
||||
const message = xhr.responseJSON && xhr.responseJSON.msg || '请求失败,请稍后重试';
|
||||
if (window.ELEMENT) ELEMENT.Message.error(message);
|
||||
else if (window.vant) vant.Toast.fail(message);
|
||||
}
|
||||
});
|
||||
|
||||
Vue.prototype.$downLoad = function(url, data = {}) {
|
||||
const query = $.param(data, true);
|
||||
window.open(url + (url.includes('?') ? '&' : '?') + query);
|
||||
};
|
||||
Vue.prototype.$download = Vue.prototype.$downLoad;
|
||||
Vue.prototype.$viewImage = function(url) {
|
||||
const address = CREATE_PREVIEW_URL(url);
|
||||
if (window.vant) vant.ImagePreview([address]);
|
||||
else window.open(address);
|
||||
};
|
||||
window.viewImage = Vue.prototype.$viewImage;
|
||||
|
||||
// v3 views use the same helper for stored file IDs and v4 download URLs.
|
||||
window.therapyPreview = function(value) {
|
||||
if (!value) return '';
|
||||
return /^(https?:|data:|blob:|\/)/.test(value) ? value :
|
||||
'/platform/staffTherapyRecuperation/common/preview?id=' + encodeURIComponent(value);
|
||||
};
|
||||
Reference in New Issue
Block a user