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({ return request({
url: '/mail/list', url: '/mail/list?cursor=' + cursor + '&pagesize=' + pagesize,
method: 'get' method: 'get'
}) })
} }
@ -25,7 +25,7 @@ export function updateEmail(data) {
export function delMail(mailid) { export function delMail(mailid) {
return request({ return request({
url: '/mail/delete/' + mailid, url: '/mail/del/' + mailid,
method: 'delete' method: 'get'
}) })
} }

View File

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