Browse Source

预生产收货任务列表--上拉加载

hella_online_20240829
yufei0306 5 months ago
parent
commit
2b3d3407db
  1. 12
      src/api/httpRequest3.js
  2. 35
      src/pages/index/index.vue
  3. 24
      src/pages/productReceipt/job/productReceiptJob.vue
  4. 4
      src/pages/productReceipt/job/scrapReceiptJob.vue
  5. 4
      src/pages/productReceipt/job/semiProductReceiptJob.vue

12
src/api/httpRequest3.js

@ -1,5 +1,8 @@
import storage from '../common/utils/storage' import storage from '../common/utils/storage'
import {
removeToken
} from '@/common/utils/auth'
function service(options = {}) { function service(options = {}) {
var token = storage.getStorage(storage.constant.token) var token = storage.getStorage(storage.constant.token)
@ -20,7 +23,7 @@ function service(options = {}) {
"dataType":"json", "dataType":"json",
"tenant-id":tenantId "tenant-id":tenantId
}; };
options.timeout = 10000 options.timeout = 300000
options.url = requestUrl+options.url options.url = requestUrl+options.url
@ -31,6 +34,13 @@ function service(options = {}) {
if(res.data.code==0){ if(res.data.code==0){
resolve(res.data); resolve(res.data);
}else { }else {
if(res.data.code==401){
uni.clearStorageSync()
removeToken();
uni.reLaunch({
url: '/pages/login/index'
})
}
reject("系统异常:"+res.data.msg) reject("系统异常:"+res.data.msg)
console.log("系统异常",res.data.msg) console.log("系统异常",res.data.msg)
} }

35
src/pages/index/index.vue

@ -156,25 +156,28 @@
}, },
onShow() { onShow() {
if (uni.getStorageSync("hasLogin") == null || uni.getStorageSync("hasLogin") == false) { if (uni.getStorageSync("hasLogin") == null || uni.getStorageSync("hasLogin") == false) {
uni.showModal({ // uni.showModal({
title: '未登录', // title: '',
content: '您未登录 , 需要登录后才能继续', // // content: ' , ', //
showCancel: !this.forcedLogin, // showCancel: !this.forcedLogin,
success: (res) => { // success: (res) => {
if (res.confirm) { // if (res.confirm) {
//使reLanch // //使reLanch
if (this.forcedLogin) { // if (this.forcedLogin) {
// uni.reLaunch({
// url: '../login/index'
// })
// } else {
// uni.navigateTo({
// url: '../login/index'
// })
// }
// }
// }
// })
uni.reLaunch({ uni.reLaunch({
url: '../login/index' url: '../login/index'
}) })
} else {
uni.navigateTo({
url: '../login/index'
})
}
}
}
})
} else { } else {
this.timerRefresh(); this.timerRefresh();
} }

24
src/pages/productReceipt/job/productReceiptJob.vue

@ -72,7 +72,7 @@
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
totalCount: 0, totalCount: 0,
loadingType: "nomore", loadingType: "noMore",
checkedToday: false, checkedToday: false,
checkedWaitTask: false, checkedWaitTask: false,
todayTime: "", todayTime: "",
@ -94,13 +94,7 @@
this.getList('refresh'); this.getList('refresh');
}, },
onReachBottom() {
//
if (this.loadingType == 'loading' || this.loadingType == 'nomore') {
return;
}
this.getList("more");
},
onPullDownRefresh() { onPullDownRefresh() {
this.getList('refresh'); this.getList('refresh');
@ -127,6 +121,14 @@
}, },
methods: { methods: {
onReachBottom() {
console.log('onReachBottom',this.loadingType)
//
if (this.loadingType == 'loading' || this.loadingType == 'noMore') {
return;
}
this.getList("more");
},
refresh() { refresh() {
this.getList('refresh'); this.getList('refresh');
}, },
@ -183,9 +185,9 @@
} else { } else {
updateTitle("报废收货任务(" + this.totalCount + ")"); updateTitle("报废收货任务(" + this.totalCount + ")");
} }
this.loadingType = "loadmore"; this.loadingType = "more";
if (list == null || list.length == 0) { if (list == null || list.length == 0) {
this.loadingType = "nomore"; this.loadingType = "noMore";
return; return;
} }
this.jobList = type === "refresh" ? list : this.jobList.concat(list); this.jobList = type === "refresh" ? list : this.jobList.concat(list);
@ -332,7 +334,7 @@
goHome() goHome()
}, },
onReach() { onReach() {
if (this.loadingType == 'loading' || this.loadingType == 'nomore') { if (this.loadingType == 'loading' || this.loadingType == 'noMore') {
return; return;
} }
this.getList("more"); this.getList("more");

4
src/pages/productReceipt/job/scrapReceiptJob.vue

@ -17,7 +17,9 @@
}; };
}, },
onReachBottom() {
this.$refs.productreceiptjob.onReach();
},
onPullDownRefresh() { onPullDownRefresh() {
this.$refs.productreceiptjob.refresh(); this.$refs.productreceiptjob.refresh();
}, },

4
src/pages/productReceipt/job/semiProductReceiptJob.vue

@ -17,7 +17,9 @@
}; };
}, },
onReachBottom() {
this.$refs.productreceiptjob.onReach();
},
onShow() { onShow() {
if(this.$refs.productreceiptjob!=undefined){ if(this.$refs.productreceiptjob!=undefined){
this.$refs.productreceiptjob.refresh(); this.$refs.productreceiptjob.refresh();

Loading…
Cancel
Save