Skip to content

Commit

Permalink
allCmpInv添加下拉刷新方法
Browse files Browse the repository at this point in the history
  • Loading branch information
suvvm committed Dec 4, 2019
1 parent eeb5a62 commit 0077fa4
Showing 1 changed file with 41 additions and 2 deletions.
43 changes: 41 additions & 2 deletions pages/investigates/allCmpInv.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
<template>
<view>
<van-cell v-for="(item, key) in userInfo.investigates" v-bind:key="key" :title="item.name" :value="item.statusText" size="large" :label="item.description" clickable @click="cmpInvDetails(key)" />
<van-pull-refresh v-model="isLoading" @refresh="onRefresh">
<van-cell v-for="(item, key) in userInfo.investigates" v-bind:key="key" :title="item.name" :value="item.statusText" size="large" :label="item.description" clickable @click="cmpInvDetails(key)" />
</van-pull-refresh>
</view>
</template>

<script>
export default {
data() {
return {
userInfo: {}
userInfo: {},
isLoading: false
}
},
onLoad() {
Expand Down Expand Up @@ -66,6 +69,42 @@
invId: this.userInfo.investigates[key].id
}
});
},
onRefresh() {
setTimeout(() => {
var rp = require('request-promise');
var options = {
method: 'POST',
uri: 'http://101.201.70.76:8211/getUserById',
form: {
id: this.$cookies.get("userInfo").id,
}
};
rp(options).then(res => {
this.isLoading = false;
if(res == "error") {
this.$toast.fail('获取用户信息识别,未找到用户信息');
} else {
this.userInfo = JSON.parse(res);
console.log(this.userInfo);
for(var i = 0; i < this.userInfo.investigates.length; i++){
if(this.userInfo.investigates[i].visible){
this.userInfo.investigates[i].statusText = "已审核";
} else {
this.userInfo.investigates[i].statusText = "未审核";
}
}
this.$forceUpdate();
this.$toast.success('刷新成功');
}
// console.log(this.note.backgroundImage)
}).catch(err => {
this.isLoading = false;
this.$toast.fail('获取用户信息, 请检查网络连接');
console.log(err);
});
}, 500);
}
}
}
Expand Down

0 comments on commit 0077fa4

Please sign in to comment.