Commit 9f9b5168 authored by xinzhedeai's avatar xinzhedeai

中台偶发加载问题处理

parent 226d247d
...@@ -13,7 +13,7 @@ window.addEventListener("load", function() { ...@@ -13,7 +13,7 @@ window.addEventListener("load", function() {
loading: false, loading: false,
finished: false, finished: false,
page: 0, page: 0,
size: 9999, size: 99,
total: 0 total: 0
} }
}, },
...@@ -34,6 +34,11 @@ window.addEventListener("load", function() { ...@@ -34,6 +34,11 @@ window.addEventListener("load", function() {
gemhoUtil.navigatePage('./dw-list-detail.html?dwId='+item.id+'&type=edit') gemhoUtil.navigatePage('./dw-list-detail.html?dwId='+item.id+'&type=edit')
}, },
getList(){ getList(){
vant.Toast.loading({
message: '正在加载...',
forbidClick: true,
loadingType: 'spinner',
});
setTimeout(() => { setTimeout(() => {
http2.post({ http2.post({
serviceId: API_KEY_MAP["dw-list"]['id'], serviceId: API_KEY_MAP["dw-list"]['id'],
...@@ -45,7 +50,11 @@ window.addEventListener("load", function() { ...@@ -45,7 +50,11 @@ window.addEventListener("load", function() {
sort: 'id,desc', sort: 'id,desc',
} }
}, (res) => { }, (res) => {
if(!res){ // 中台返回为undefined 重新请求
this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值
this.getList()
return
}
if(res){ if(res){
// console.log('接口回调数据', JSON.parse(res)) // console.log('接口回调数据', JSON.parse(res))
...@@ -59,6 +68,7 @@ window.addEventListener("load", function() { ...@@ -59,6 +68,7 @@ window.addEventListener("load", function() {
} }
} }
this.loading = false this.loading = false
vant.Toast.clear()
this.$nextTick(()=>{ this.$nextTick(()=>{
// 滚动条跳转位置 // 滚动条跳转位置
window.scrollTo(0, gemhoUtil.getCookie('scrollPosition')); window.scrollTo(0, gemhoUtil.getCookie('scrollPosition'));
......
...@@ -40,6 +40,11 @@ window.addEventListener("load", function() { ...@@ -40,6 +40,11 @@ window.addEventListener("load", function() {
this.getList() this.getList()
}, },
getList() { getList() {
vant.Toast.loading({
message: '正在加载...',
forbidClick: true,
loadingType: 'spinner',
});
setTimeout(() => { setTimeout(() => {
http2.post({ http2.post({
serviceId: API_KEY_MAP["emergency"]['id'], serviceId: API_KEY_MAP["emergency"]['id'],
...@@ -55,7 +60,11 @@ window.addEventListener("load", function() { ...@@ -55,7 +60,11 @@ window.addEventListener("load", function() {
planName: this.planName, planName: this.planName,
} }
}, (res) => { }, (res) => {
if(!res){ // 中台返回为undefined 重新请求
this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值
this.getList()
return
}
if (res) { if (res) {
// console.log('接口回调数据', JSON.parse(res)) // console.log('接口回调数据', JSON.parse(res))
...@@ -69,6 +78,7 @@ window.addEventListener("load", function() { ...@@ -69,6 +78,7 @@ window.addEventListener("load", function() {
} }
} }
this.loading = false this.loading = false
vant.Toast.clear()
this.$nextTick(()=>{ this.$nextTick(()=>{
// 滚动条跳转位置 // 滚动条跳转位置
window.scrollTo(0, gemhoUtil.getCookie('scrollPosition')); window.scrollTo(0, gemhoUtil.getCookie('scrollPosition'));
......
...@@ -25,6 +25,11 @@ window.addEventListener("load", function() { ...@@ -25,6 +25,11 @@ window.addEventListener("load", function() {
gemhoUtil.navigatePage('./law-list-detail.html?law_id=' + this.list[index].lawId) gemhoUtil.navigatePage('./law-list-detail.html?law_id=' + this.list[index].lawId)
}, },
getList() { getList() {
vant.Toast.loading({
message: '正在加载...',
forbidClick: true,
loadingType: 'spinner',
});
setTimeout(() => { setTimeout(() => {
http2.post({ http2.post({
serviceId: API_KEY_MAP["law-list"]['id'], serviceId: API_KEY_MAP["law-list"]['id'],
...@@ -37,7 +42,11 @@ window.addEventListener("load", function() { ...@@ -37,7 +42,11 @@ window.addEventListener("load", function() {
sort: 'lawId,desc', sort: 'lawId,desc',
} }
}, (res) => { }, (res) => {
if(!res){ // 中台返回为undefined 重新请求
this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值
this.getList()
return
}
if (res) { if (res) {
// console.log('接口回调数据', JSON.parse(res)) // console.log('接口回调数据', JSON.parse(res))
...@@ -50,6 +59,7 @@ window.addEventListener("load", function() { ...@@ -50,6 +59,7 @@ window.addEventListener("load", function() {
} }
} }
this.loading = false this.loading = false
vant.Toast.clear()
this.$nextTick(()=>{ this.$nextTick(()=>{
// 滚动条跳转位置 // 滚动条跳转位置
window.scrollTo(0, gemhoUtil.getCookie('scrollPosition')); window.scrollTo(0, gemhoUtil.getCookie('scrollPosition'));
......
...@@ -26,6 +26,11 @@ window.addEventListener("load", function() { ...@@ -26,6 +26,11 @@ window.addEventListener("load", function() {
gemhoUtil.navigatePage('./law-lv2.html?pid=' + item.id) gemhoUtil.navigatePage('./law-lv2.html?pid=' + item.id)
}, },
getList() { getList() {
vant.Toast.loading({
message: '正在加载...',
forbidClick: true,
loadingType: 'spinner',
});
setTimeout(() => { setTimeout(() => {
http2.post({ http2.post({
serviceId: API_KEY_MAP["law-lv"]['id'], serviceId: API_KEY_MAP["law-lv"]['id'],
...@@ -37,7 +42,11 @@ window.addEventListener("load", function() { ...@@ -37,7 +42,11 @@ window.addEventListener("load", function() {
// sort: 'createTime,desc', // sort: 'createTime,desc',
} }
}, (res) => { }, (res) => {
if(!res){ // 中台返回为undefined 重新请求
this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值
this.getList()
return
}
if (res) { if (res) {
// console.log('接口回调数据', JSON.parse(res)) // console.log('接口回调数据', JSON.parse(res))
...@@ -51,6 +60,7 @@ window.addEventListener("load", function() { ...@@ -51,6 +60,7 @@ window.addEventListener("load", function() {
} }
} }
this.loading = false this.loading = false
vant.Toast.clear()
this.$nextTick(()=>{ this.$nextTick(()=>{
// 滚动条跳转位置 // 滚动条跳转位置
window.scrollTo(0, gemhoUtil.getCookie('scrollPosition')); window.scrollTo(0, gemhoUtil.getCookie('scrollPosition'));
......
...@@ -25,6 +25,11 @@ window.addEventListener("load", function() { ...@@ -25,6 +25,11 @@ window.addEventListener("load", function() {
gemhoUtil.navigatePage('./law-list.html?category_id=' + category_id) gemhoUtil.navigatePage('./law-list.html?category_id=' + category_id)
}, },
getList() { getList() {
vant.Toast.loading({
message: '正在加载...',
forbidClick: true,
loadingType: 'spinner',
});
setTimeout(() => { setTimeout(() => {
http2.post({ http2.post({
serviceId: API_KEY_MAP["law-lv"]['id'], serviceId: API_KEY_MAP["law-lv"]['id'],
...@@ -37,7 +42,11 @@ window.addEventListener("load", function() { ...@@ -37,7 +42,11 @@ window.addEventListener("load", function() {
// sort: 'createTime,desc', // sort: 'createTime,desc',
} }
}, (res) => { }, (res) => {
if(!res){ // 中台返回为undefined 重新请求
this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值
this.getList()
return
}
if (res) { if (res) {
// console.log('接口回调数据', JSON.parse(res)) // console.log('接口回调数据', JSON.parse(res))
...@@ -54,6 +63,7 @@ window.addEventListener("load", function() { ...@@ -54,6 +63,7 @@ window.addEventListener("load", function() {
} }
} }
this.loading = false this.loading = false
vant.Toast.clear()
this.$nextTick(()=>{ this.$nextTick(()=>{
// 滚动条跳转位置 // 滚动条跳转位置
window.scrollTo(0, gemhoUtil.getCookie('scrollPosition')); window.scrollTo(0, gemhoUtil.getCookie('scrollPosition'));
......
...@@ -27,6 +27,11 @@ window.addEventListener("load", function() { ...@@ -27,6 +27,11 @@ window.addEventListener("load", function() {
.noticeId) .noticeId)
}, },
getList() { getList() {
vant.Toast.loading({
message: '正在加载...',
forbidClick: true,
loadingType: 'spinner',
});
setTimeout(() => { setTimeout(() => {
http2.post({ http2.post({
serviceId: API_KEY_MAP["notice-list"]['id'], serviceId: API_KEY_MAP["notice-list"]['id'],
...@@ -38,7 +43,11 @@ window.addEventListener("load", function() { ...@@ -38,7 +43,11 @@ window.addEventListener("load", function() {
// sort: 'noticeId,desc', // sort: 'noticeId,desc',
} }
}, (res) => { }, (res) => {
if(!res){ // 中台返回为undefined 重新请求
this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值
this.getList()
return
}
if (res) { if (res) {
// console.log('接口回调数据', JSON.parse(res)) // console.log('接口回调数据', JSON.parse(res))
...@@ -52,6 +61,7 @@ window.addEventListener("load", function() { ...@@ -52,6 +61,7 @@ window.addEventListener("load", function() {
} }
} }
this.loading = false this.loading = false
vant.Toast.clear()
this.$nextTick(()=>{ this.$nextTick(()=>{
// 滚动条跳转位置 // 滚动条跳转位置
window.scrollTo(0, gemhoUtil.getCookie('scrollPosition')); window.scrollTo(0, gemhoUtil.getCookie('scrollPosition'));
......
...@@ -28,6 +28,11 @@ window.addEventListener("load", function() { ...@@ -28,6 +28,11 @@ window.addEventListener("load", function() {
gemhoUtil.navigatePage('./yh-list-detail.html?hdId=' + item.hdId + '&type=edit') gemhoUtil.navigatePage('./yh-list-detail.html?hdId=' + item.hdId + '&type=edit')
}, },
getList() { getList() {
vant.Toast.loading({
message: '正在加载...',
forbidClick: true,
loadingType: 'spinner',
});
setTimeout(() => { setTimeout(() => {
http2.post({ http2.post({
serviceId: API_KEY_MAP["yh-list"]['id'], serviceId: API_KEY_MAP["yh-list"]['id'],
...@@ -39,6 +44,11 @@ window.addEventListener("load", function() { ...@@ -39,6 +44,11 @@ window.addEventListener("load", function() {
sort: 'hdId,desc', sort: 'hdId,desc',
} }
}, (res) => { }, (res) => {
if(!res){ // 中台返回为undefined 重新请求
this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值
this.getList()
return
}
if (res) { if (res) {
var result = JSON.parse(res) var result = JSON.parse(res)
this.list.push(...result.content); this.list.push(...result.content);
...@@ -49,6 +59,7 @@ window.addEventListener("load", function() { ...@@ -49,6 +59,7 @@ window.addEventListener("load", function() {
} }
} }
this.loadFlag = false this.loadFlag = false
vant.Toast.clear()
// console.log('响应结束',this.total, this.list.length) // console.log('响应结束',this.total, this.list.length)
this.$nextTick(()=>{ this.$nextTick(()=>{
// 滚动条跳转位置 // 滚动条跳转位置
......
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