This commit is contained in:
yangduo 2024-08-08 10:31:02 +08:00
parent 54e7baa6e8
commit 965115fd52
2 changed files with 35 additions and 7 deletions

View File

@ -8,9 +8,9 @@ export function addMail(data) {
})
}
export function getMailList() {
export function getMailList(cursor, pagesize) {
return request({
url: '/mail/list',
url: '/mail/list?cursor=' + cursor + '&pagesize=' + pagesize,
method: 'get'
})
}
@ -25,7 +25,7 @@ export function updateEmail(data) {
export function delMail(mailid) {
return request({
url: '/mail/delete/' + mailid,
method: 'delete'
url: '/mail/del/' + mailid,
method: 'get'
})
}

View File

@ -1,6 +1,9 @@
<template>
<div class="app-container">
<el-table
v-table-scroll-load="nextStream"
:empty-text="emptytext"
height="700"
:data="mailList"
border
fit
@ -83,7 +86,11 @@ export default {
return {
dialogAttaVisible: false,
mailList: [],
attaData: []
attaData: [],
cursor: 0,
remaining: 0,
pagesize: 50,
emptytext: ' '
}
},
created() {
@ -92,9 +99,14 @@ export default {
methods: {
parseTime,
getList() {
getMailList().then(response => {
getMailList(this.cursor, this.pagesize).then(response => {
if (response.code === 0) {
this.mailList = response.data
this.cursor = response.cursor
this.remaining = response.remaining
if (this.mailList === undefined || this.mailList.length <= 0) {
this.emptytext = 'No data'
}
}
})
},
@ -108,13 +120,15 @@ export default {
this.$router.push('update/' + row.mail_id)
},
handleDelete(row) {
delMail(row.mailid).then((response) => {
console.log(row)
delMail(row.mail_id).then((response) => {
if (response.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1200,
onClose: () => {
this.cursor = 0
this.getList()
}
})
@ -126,6 +140,20 @@ export default {
})
}
})
},
nextStream() {
console.log('remaining', this.remaining)
if (this.remaining > 0) {
this.remaining = 0
getMailList(this.cursor, this.pagesize).then(response => {
if (response.code === 0) {
console.log('next response', response)
this.mailList = this.mailList.concat(response.data)
this.cursor = response.cursor
this.remaining = response.remaining
}
})
}
}
}
}