邮件下拉加载更多
This commit is contained in:
parent
6c3f97725f
commit
412cba8aae
@ -15,7 +15,7 @@
|
||||
</el-header>
|
||||
<el-main class="nopadding" v-loading="listLoading" element-loading-text="加载中...">
|
||||
<el-scrollbar height="100%" ref="scrollbar" @scroll="onScroll">
|
||||
<div class="emailMain">
|
||||
<div class="emailMain" ref="emailMain">
|
||||
<div class="itemBox" :class="[item.is_confirm==2?'part':item.is_confirm==1?'complete':'notStarted', emailId == item.id?'itemTrue':'']" v-for="item in confirmList" :key="item" @click="()=>{this.emailChange(item,true);}">
|
||||
<div class="name text">{{item.from && item.from.email}}</div>
|
||||
<div class="title text">{{item.subject}}</div>
|
||||
@ -184,6 +184,7 @@ export default {
|
||||
show: false,
|
||||
},
|
||||
confirmList:[],
|
||||
listMore:false,
|
||||
listLoading:false,
|
||||
listParams:{
|
||||
page:1,
|
||||
@ -276,7 +277,6 @@ export default {
|
||||
return 'all-disabled'
|
||||
}
|
||||
},
|
||||
|
||||
async getData() {
|
||||
this.listLoading = true;
|
||||
const res = await this.$API.orders.order.mail.list.get(this.listParams);
|
||||
@ -285,8 +285,17 @@ export default {
|
||||
res.data.rows.forEach(item=>{
|
||||
item.text = this.stripHtmlTags(item.summary)
|
||||
})
|
||||
}
|
||||
if(res.data.rows && res.data.rows.length < this.listParams.pageSize){
|
||||
this.listMore = true;
|
||||
}else{
|
||||
this.listMore = false;
|
||||
}
|
||||
if(this.listParams.page == 1){
|
||||
this.confirmList = res.data.rows;
|
||||
await this.emailChange(res.data.rows[0])
|
||||
}else{
|
||||
this.confirmList = this.confirmList.concat(res.data.rows);
|
||||
}
|
||||
}
|
||||
this.listLoading = false;
|
||||
@ -298,14 +307,21 @@ export default {
|
||||
},
|
||||
// 滚动分页
|
||||
onScroll(event){
|
||||
this.$nextTick(()=>{
|
||||
const scrollbar = this.$refs.scrollbar;
|
||||
const remainingDistance = scrollbar.$el.scrollHeight - (event.scrollTop + scrollbar.$el.clientHeight);
|
||||
if (remainingDistance <= this.threshold) {
|
||||
const emailHeight = this.$refs.emailMain;
|
||||
const remainingDistance = scrollbar.$el.scrollHeight + event.scrollTop + 100;
|
||||
if (remainingDistance > emailHeight.clientHeight) {
|
||||
this.loadMore();
|
||||
}
|
||||
})
|
||||
},
|
||||
loadMore(){
|
||||
console.log('加载更多')
|
||||
if(this.listLoading || this.listMore){
|
||||
return
|
||||
}
|
||||
this.listParams.page ++;
|
||||
this.getData();
|
||||
},
|
||||
|
||||
emailChange(item,isChange) {
|
||||
@ -363,6 +379,7 @@ export default {
|
||||
res = await this.$API.orders.order.mail.confirm.post(params);
|
||||
}
|
||||
if(res.code == 200){
|
||||
this.listParams.page = 1;
|
||||
await this.getData();
|
||||
}
|
||||
},
|
||||
@ -393,7 +410,7 @@ export default {
|
||||
let searchParams = this.$TOOL.objCopy(params);
|
||||
searchParams.mail_data_id = this.emailId;
|
||||
searchParams.field = ""
|
||||
if(typeof data.code === String){
|
||||
if(typeof data.code === 'string'){
|
||||
searchParams.field = data.code;
|
||||
}else{
|
||||
searchParams.field = data.code[0];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user