This commit is contained in:
sdaduanbilei-d1581 2025-10-13 11:40:51 +08:00
parent 0ae7a7e6ca
commit 528d657968
2 changed files with 22 additions and 2 deletions

View File

@ -11,5 +11,13 @@ export default {
list(params) { list(params) {
return fetch('/library/list', params,'post','json') return fetch('/library/list', params,'post','json')
}, },
/**
* 热门
* @param params
* @returns {Promise | Promise<unknown>}
*/
changeHot(params){
return fetch('/library/hot',params,'post','json')
}
} }

View File

@ -7,8 +7,9 @@
</div> </div>
<a-table class="mt-20" :columns="columns" :data="list" > <a-table class="mt-20" :columns="columns" :data="list" >
<template #menu="{record}"> <template #menu="{record}">
<div> <div class="flex flex-center">
<edit type="edit" :info="record" @ok="fetchList"/> <edit type="edit" :info="record" @ok="fetchList"/>
<a-button type="text" @click="changeHot(record)">{{record.isHot === 0 ?'设置热门':'取消热门'}}</a-button>
</div> </div>
</template> </template>
</a-table> </a-table>
@ -47,7 +48,8 @@ export default {
{ {
title:'科/属', title:'科/属',
dataIndex: 'genus', dataIndex: 'genus',
},{ },
{
title:"操作", title:"操作",
slotName:'menu' slotName:'menu'
} }
@ -67,6 +69,16 @@ export default {
this.$message.error(res.msg); this.$message.error(res.msg);
} }
}) })
},
changeHot(item){
const ids = {ids:[item.id],isHot: item.isHot === 0 ? 1 :0}
this.$api.flower.changeHot(ids).then(res => {
if(res.code === 200){
this.fetchList()
}else {
this.$message.error(res.msg);
}
})
} }
}, },
} }