Commit 1aacffec authored by 沈翠玲's avatar 沈翠玲

loading卡顿

parent 6def5d61
......@@ -1441,9 +1441,9 @@ export default {
// },
mounted() {
//监听工作中心切换事件
uni.$on('switchWorkunit', (station) => {
this.getTaskList();
});
// uni.$on('switchWorkunit', (station) => {
// this.getTaskList();
// });
},
created() {
//获取屏幕高度
......@@ -1929,6 +1929,7 @@ export default {
const t = this;
this.tableData = [];
this.tableSelectData = []
console.log('sadada', t.vuex_workunit.workunitId)
this.$u.api
.getTaskList({
workunitId: t.vuex_workunit.workunitId,
......@@ -1951,7 +1952,9 @@ export default {
} else {
}
}
});
}).catch(e=>{
console.log('eee', e)
})
},
typeChange(index) {
this.currentType = index;
......
......@@ -25,11 +25,13 @@ class Request {
options.params = options.params || {};
options.header = Object.assign({}, this.config.header, options.header);
options.method = options.method || this.config.method;
return new Promise((resolve, reject) => {
options.complete = (response) => {
// 请求返回后,隐藏loading(如果请求返回快的话,可能会没有loading)
uni.hideLoading();
// uni.hideLoading();
setTimeout(()=>{
uni.hideLoading();
}, 10)
// 清除定时器,如果请求回来了,就无需loading
clearTimeout(this.config.timer);
this.config.timer = null;
......@@ -77,7 +79,6 @@ class Request {
// 判断用户传递的URL是否/开头,如果不是,加上/,这里使用了uView的test.js验证库的url()方法
options.url = validate.url(options.url) ? options.url : (this.config.baseUrl + (options.url.indexOf('/') == 0 ?
options.url : '/' + options.url));
// 是否显示loading
// 加一个是否已有timer定时器的判断,否则有两个同时请求的时候,后者会清除前者的定时器id
// 而没有清除前者的定时器,导致前者超时,一直显示loading
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment