Commit ec64a0a8 authored by xinzhedeai's avatar xinzhedeai

请求报错 重新请求进度条显示处理

parent 411ff42a
...@@ -129,6 +129,7 @@ window.addEventListener("load", function() { ...@@ -129,6 +129,7 @@ window.addEventListener("load", function() {
let sm2_encrypt_result = value // 后台返回待解密内容 let sm2_encrypt_result = value // 后台返回待解密内容
let sm2_decrypt_result = sm2_Decrypt(sm2_encrypt_result, API_KEY_MAP["upload"]["privateKey"],) let sm2_decrypt_result = sm2_Decrypt(sm2_encrypt_result, API_KEY_MAP["upload"]["privateKey"],)
if(!sm2_decrypt_result){ // 如果解密后的值为空字符串则重新上传图片 if(!sm2_decrypt_result){ // 如果解密后的值为空字符串则重新上传图片
vant.Toast.clear()
this.afterRead(file) this.afterRead(file)
return return
} }
...@@ -143,7 +144,9 @@ window.addEventListener("load", function() { ...@@ -143,7 +144,9 @@ window.addEventListener("load", function() {
} }
this.filePathList = decryptRes.body ? [decryptRes.body] : [] this.filePathList = decryptRes.body ? [decryptRes.body] : []
// 可根据后端返回的数据做进一步处理,如显示上传成功信息等 // 可根据后端返回的数据做进一步处理,如显示上传成功信息等
vant.Toast.clear() setTimeout(() => {
vant.Toast.clear()
}, 0);
}else{ }else{
this.afterRead(file) this.afterRead(file)
} }
...@@ -209,12 +212,16 @@ window.addEventListener("load", function() { ...@@ -209,12 +212,16 @@ window.addEventListener("load", function() {
}, (res) => { }, (res) => {
if(!res){ // 中台返回为undefined 重新请求 if(!res){ // 中台返回为undefined 重新请求
vant.Toast.clear() vant.Toast.clear()
this.detail() setTimeout(() => {
this.detail()
}, 0);
return return
} }
if (res) { if (res) {
console.log('接口回调数据', JSON.parse(res)) console.log('接口回调数据', JSON.parse(res))
vant.Toast.clear() setTimeout(() => {
vant.Toast.clear()
}, 0);
var result = JSON.parse(res) var result = JSON.parse(res)
// this.noticeContent = result.noticeContent // this.noticeContent = result.noticeContent
this.form = result.content[0] this.form = result.content[0]
...@@ -261,7 +268,10 @@ window.addEventListener("load", function() { ...@@ -261,7 +268,10 @@ window.addEventListener("load", function() {
}, (res, type) => { }, (res, type) => {
if(!res && !type){ // 如果是中台接口返回为undefined,则重新发起请求 if(!res && !type){ // 如果是中台接口返回为undefined,则重新发起请求
vant.Toast.clear() vant.Toast.clear()
this.submit() setTimeout(() => {
this.submit()
}, 0);
return return
} }
if (res) { if (res) {
......
...@@ -51,8 +51,11 @@ window.addEventListener("load", function() { ...@@ -51,8 +51,11 @@ window.addEventListener("load", function() {
} }
}, (res) => { }, (res) => {
if(!res){ // 中台返回为undefined 重新请求 if(!res){ // 中台返回为undefined 重新请求
vant.Toast.clear()
this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值 this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值
this.getList() setTimeout(() => {
this.getList()
}, 0);
return return
} }
if(res){ if(res){
...@@ -68,7 +71,9 @@ window.addEventListener("load", function() { ...@@ -68,7 +71,9 @@ window.addEventListener("load", function() {
} }
} }
this.loading = false this.loading = false
vant.Toast.clear() setTimeout(() => {
vant.Toast.clear()
}, 0);
this.$nextTick(()=>{ this.$nextTick(()=>{
// 滚动条跳转位置 // 滚动条跳转位置
window.scrollTo(0, gemhoUtil.getCookie('scrollPosition')); window.scrollTo(0, gemhoUtil.getCookie('scrollPosition'));
......
...@@ -183,7 +183,9 @@ window.addEventListener("load", function() { ...@@ -183,7 +183,9 @@ window.addEventListener("load", function() {
let sm2_decrypt_result = sm2_Decrypt(sm2_encrypt_result, API_KEY_MAP["upload"]["privateKey"],) let sm2_decrypt_result = sm2_Decrypt(sm2_encrypt_result, API_KEY_MAP["upload"]["privateKey"],)
if(!sm2_decrypt_result){ // 如果解密后的值为空字符串则重新上传图片 if(!sm2_decrypt_result){ // 如果解密后的值为空字符串则重新上传图片
vant.Toast.clear() vant.Toast.clear()
this.afterRead(file) setTimeout(() => {
this.afterRead(file)
}, 0);
return return
} }
console.log('upload响应解密', sm2_decrypt_result) console.log('upload响应解密', sm2_decrypt_result)
...@@ -196,7 +198,9 @@ window.addEventListener("load", function() { ...@@ -196,7 +198,9 @@ window.addEventListener("load", function() {
return return
} }
this.filePathList = decryptRes.body ? [decryptRes.body] : [] this.filePathList = decryptRes.body ? [decryptRes.body] : []
vant.Toast.clear() setTimeout(() => {
vant.Toast.clear()
}, 0);
} }
}) })
.catch(error => { .catch(error => {
...@@ -231,7 +235,9 @@ window.addEventListener("load", function() { ...@@ -231,7 +235,9 @@ window.addEventListener("load", function() {
}, (res) => { }, (res) => {
if(!res){ // 中台返回为undefined 重新请求 if(!res){ // 中台返回为undefined 重新请求
vant.Toast.clear() vant.Toast.clear()
this.detail() setTimeout(() => {
this.detail()
}, 0);
return return
} }
if(res){ if(res){
...@@ -249,7 +255,9 @@ window.addEventListener("load", function() { ...@@ -249,7 +255,9 @@ window.addEventListener("load", function() {
this.disabled = false this.disabled = false
} }
this.filePathList = this.form.drillPhotoList || []; this.filePathList = this.form.drillPhotoList || [];
vant.Toast.clear() setTimeout(() => {
vant.Toast.clear()
}, 0);
} }
}) })
}, },
......
...@@ -61,8 +61,11 @@ window.addEventListener("load", function() { ...@@ -61,8 +61,11 @@ window.addEventListener("load", function() {
} }
}, (res) => { }, (res) => {
if(!res){ // 中台返回为undefined 重新请求 if(!res){ // 中台返回为undefined 重新请求
vant.Toast.clear()
this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值 this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值
this.getList() setTimeout(() => {
this.getList()
}, 0);
return return
} }
if (res) { if (res) {
...@@ -78,7 +81,9 @@ window.addEventListener("load", function() { ...@@ -78,7 +81,9 @@ window.addEventListener("load", function() {
} }
} }
this.loading = false this.loading = false
vant.Toast.clear() setTimeout(() => {
vant.Toast.clear()
}, 0);
this.$nextTick(()=>{ this.$nextTick(()=>{
// 滚动条跳转位置 // 滚动条跳转位置
window.scrollTo(0, gemhoUtil.getCookie('scrollPosition')); window.scrollTo(0, gemhoUtil.getCookie('scrollPosition'));
......
...@@ -33,7 +33,10 @@ window.addEventListener("load", function() { ...@@ -33,7 +33,10 @@ window.addEventListener("load", function() {
} }
}, (res) => { }, (res) => {
if(!res){ // 中台返回为undefined 重新请求 if(!res){ // 中台返回为undefined 重新请求
this.detail() vant.Toast.clear()
setTimeout(() => {
this.detail()
}, 0);
return return
} }
if(res){ if(res){
...@@ -41,7 +44,9 @@ window.addEventListener("load", function() { ...@@ -41,7 +44,9 @@ window.addEventListener("load", function() {
var result = JSON.parse(res) var result = JSON.parse(res)
this.lawChapter = result.lawChapter this.lawChapter = result.lawChapter
} }
vant.Toast.clear() setTimeout(() => {
vant.Toast.clear()
}, 0);
}) })
}, },
}, },
......
...@@ -43,8 +43,11 @@ window.addEventListener("load", function() { ...@@ -43,8 +43,11 @@ window.addEventListener("load", function() {
} }
}, (res) => { }, (res) => {
if(!res){ // 中台返回为undefined 重新请求 if(!res){ // 中台返回为undefined 重新请求
vant.Toast.clear()
this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值 this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值
this.getList() setTimeout(() => {
this.getList()
}, 0);
return return
} }
if (res) { if (res) {
...@@ -59,7 +62,9 @@ window.addEventListener("load", function() { ...@@ -59,7 +62,9 @@ window.addEventListener("load", function() {
} }
} }
this.loading = false this.loading = false
vant.Toast.clear() setTimeout(() => {
vant.Toast.clear()
}, 0);
this.$nextTick(()=>{ this.$nextTick(()=>{
// 滚动条跳转位置 // 滚动条跳转位置
window.scrollTo(0, gemhoUtil.getCookie('scrollPosition')); window.scrollTo(0, gemhoUtil.getCookie('scrollPosition'));
......
...@@ -43,8 +43,11 @@ window.addEventListener("load", function() { ...@@ -43,8 +43,11 @@ window.addEventListener("load", function() {
} }
}, (res) => { }, (res) => {
if(!res){ // 中台返回为undefined 重新请求 if(!res){ // 中台返回为undefined 重新请求
vant.Toast.clear()
this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值 this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值
this.getList() setTimeout(() => {
this.getList()
}, 0);
return return
} }
if (res) { if (res) {
...@@ -60,7 +63,9 @@ window.addEventListener("load", function() { ...@@ -60,7 +63,9 @@ window.addEventListener("load", function() {
} }
} }
this.loading = false this.loading = false
vant.Toast.clear() setTimeout(() => {
vant.Toast.clear()
}, 0);
this.$nextTick(()=>{ this.$nextTick(()=>{
// 滚动条跳转位置 // 滚动条跳转位置
window.scrollTo(0, gemhoUtil.getCookie('scrollPosition')); window.scrollTo(0, gemhoUtil.getCookie('scrollPosition'));
......
...@@ -43,8 +43,11 @@ window.addEventListener("load", function() { ...@@ -43,8 +43,11 @@ window.addEventListener("load", function() {
} }
}, (res) => { }, (res) => {
if(!res){ // 中台返回为undefined 重新请求 if(!res){ // 中台返回为undefined 重新请求
vant.Toast.clear()
this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值 this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值
this.getList() setTimeout(() => {
this.getList()
}, 0);
return return
} }
if (res) { if (res) {
...@@ -63,7 +66,9 @@ window.addEventListener("load", function() { ...@@ -63,7 +66,9 @@ window.addEventListener("load", function() {
} }
} }
this.loading = false this.loading = false
vant.Toast.clear() setTimeout(() => {
vant.Toast.clear()
}, 0);
this.$nextTick(()=>{ this.$nextTick(()=>{
// 滚动条跳转位置 // 滚动条跳转位置
window.scrollTo(0, gemhoUtil.getCookie('scrollPosition')); window.scrollTo(0, gemhoUtil.getCookie('scrollPosition'));
......
...@@ -31,7 +31,10 @@ window.addEventListener("load", function() { ...@@ -31,7 +31,10 @@ window.addEventListener("load", function() {
} }
}, (res) => { }, (res) => {
if(!res){ // 中台返回为undefined 重新请求 if(!res){ // 中台返回为undefined 重新请求
this.detail() vant.Toast.clear()
setTimeout(() => {
this.detail()
}, 0);
return return
} }
if(res){ if(res){
...@@ -40,7 +43,9 @@ window.addEventListener("load", function() { ...@@ -40,7 +43,9 @@ window.addEventListener("load", function() {
var result = JSON.parse(res) var result = JSON.parse(res)
this.noticeContent = result.noticeContent this.noticeContent = result.noticeContent
} }
vant.Toast.clear() setTimeout(() => {
vant.Toast.clear()
}, 0);
}) })
}, },
......
...@@ -44,8 +44,11 @@ window.addEventListener("load", function() { ...@@ -44,8 +44,11 @@ window.addEventListener("load", function() {
} }
}, (res) => { }, (res) => {
if(!res){ // 中台返回为undefined 重新请求 if(!res){ // 中台返回为undefined 重新请求
vant.Toast.clear()
this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值 this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值
this.getList() setTimeout(() => {
this.getList()
}, 0);
return return
} }
if (res) { if (res) {
...@@ -61,7 +64,9 @@ window.addEventListener("load", function() { ...@@ -61,7 +64,9 @@ window.addEventListener("load", function() {
} }
} }
this.loading = false this.loading = false
vant.Toast.clear() setTimeout(() => {
vant.Toast.clear()
}, 0);
this.$nextTick(()=>{ this.$nextTick(()=>{
// 滚动条跳转位置 // 滚动条跳转位置
window.scrollTo(0, gemhoUtil.getCookie('scrollPosition')); window.scrollTo(0, gemhoUtil.getCookie('scrollPosition'));
......
...@@ -91,7 +91,9 @@ window.addEventListener("load", function() { ...@@ -91,7 +91,9 @@ window.addEventListener("load", function() {
}, (res) => { }, (res) => {
if(!res){ // 中台返回为undefined 重新请求 if(!res){ // 中台返回为undefined 重新请求
vant.Toast.clear() vant.Toast.clear()
this.detail() setTimeout(() => {
this.detail()
}, 0);
return return
} }
if(res){ if(res){
...@@ -113,7 +115,10 @@ window.addEventListener("load", function() { ...@@ -113,7 +115,10 @@ window.addEventListener("load", function() {
// 隐患状态 成功和待验证 则不允许编辑 // 隐患状态 成功和待验证 则不允许编辑
this.disabled = this.form.hdStatus === 1 || this.form.hdStatus === 3 this.disabled = this.form.hdStatus === 1 || this.form.hdStatus === 3
vant.Toast.clear() setTimeout(() => {
vant.Toast.clear()
}, 0);
} }
}) })
}, },
......
...@@ -45,8 +45,11 @@ window.addEventListener("load", function() { ...@@ -45,8 +45,11 @@ window.addEventListener("load", function() {
} }
}, (res) => { }, (res) => {
if(!res){ // 中台返回为undefined 重新请求 if(!res){ // 中台返回为undefined 重新请求
vant.Toast.clear()
this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值 this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值
this.getList() setTimeout(() => {
this.getList()
}, 0);
return return
} }
if (res) { if (res) {
...@@ -59,7 +62,9 @@ window.addEventListener("load", function() { ...@@ -59,7 +62,9 @@ window.addEventListener("load", function() {
} }
} }
this.loadFlag = false this.loadFlag = false
vant.Toast.clear() setTimeout(() => {
vant.Toast.clear()
}, 0);
// 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