add categoty
This commit is contained in:
parent
820be964a9
commit
87778cff11
@ -1,26 +1,26 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<navbar title="成就徽章"/>
|
<navbar title="成就徽章" />
|
||||||
<a-card>
|
<a-card>
|
||||||
<div >
|
<div>
|
||||||
<div class="flex flex-center flex-justify-start">
|
<div class="flex flex-center flex-justify-start">
|
||||||
<edit :options="categoryList" @ok="fetchList"/>
|
<edit :options="categoryList" @ok="fetchList" />
|
||||||
<category @ok="fetchCategory"/>
|
<category @ok="fetchCategory" />
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-20">
|
<div class="mt-20">
|
||||||
<a-table :data="list" :columns="columns" :pagination="page">
|
<a-table :data="list" :columns="columns" :pagination="page" @page-change="pageChange">
|
||||||
<template #name="{record}">
|
<template #name="{ record }">
|
||||||
<div class="flex flex-center flex-justify-start">
|
<div class="flex flex-center flex-justify-start">
|
||||||
<a-image v-if="record.oss" :src="record.oss.url" width="40px"></a-image>
|
<a-image v-if="record.oss" :src="record.oss.url" width="40px"></a-image>
|
||||||
<div class="ml-10">{{record.name}}</div>
|
<div class="ml-10">{{ record.name }}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #category="{record}">
|
<template #category="{ record }">
|
||||||
<a-tag color="blue">{{record.category.name}}</a-tag>
|
<a-tag color="blue">{{ record.category.name }}</a-tag>
|
||||||
</template>
|
</template>
|
||||||
<template #menu="{record}">
|
<template #menu="{ record }">
|
||||||
<div class="flex flex-center flex-justify-start">
|
<div class="flex flex-center flex-justify-start">
|
||||||
<edit type="edit" :info="record" @ok="fetchList"/>
|
<edit type="edit" :info="record" @ok="fetchList" />
|
||||||
<a-popconfirm content="是否确认删除该数据?" @ok="remove(record.id)">
|
<a-popconfirm content="是否确认删除该数据?" @ok="remove(record.id)">
|
||||||
<a-button type="text">删除</a-button>
|
<a-button type="text">删除</a-button>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
@ -45,29 +45,29 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
page:{
|
page: {
|
||||||
current:0,
|
current: 0,
|
||||||
pageSize:10,
|
pageSize: 10,
|
||||||
total:0,
|
total: 0,
|
||||||
},
|
},
|
||||||
categoryList:[],
|
categoryList: [],
|
||||||
list: [],
|
list: [],
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
title:'徽章名称',
|
title: '徽章名称',
|
||||||
slotName:'name'
|
slotName: 'name'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title:'徽章描述',
|
title: '徽章描述',
|
||||||
dataIndex:'desc'
|
dataIndex: 'desc'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title:'徽章分类',
|
title: '徽章分类',
|
||||||
slotName:'category'
|
slotName: 'category'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title:'操作',
|
title: '操作',
|
||||||
slotName:'menu'
|
slotName: 'menu'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -78,27 +78,33 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fetchList() {
|
fetchList() {
|
||||||
this.$api.badge.list(this.page).then(res=>{
|
this.$api.badge.list(this.page).then(res => {
|
||||||
if (res.code === 200){
|
if (res.code === 200) {
|
||||||
this.list = res.data.list
|
this.list = res.data.list
|
||||||
|
this.page.total = res.dta.total
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
fetchCategory(){
|
pageChange(page) {
|
||||||
|
console.log(page);
|
||||||
|
this.page.page = page
|
||||||
|
this.fetchList()
|
||||||
|
},
|
||||||
|
fetchCategory() {
|
||||||
const data = {
|
const data = {
|
||||||
current:0,
|
current: 0,
|
||||||
pageSize:999,
|
pageSize: 999,
|
||||||
total:0,
|
total: 0,
|
||||||
}
|
}
|
||||||
this.$api.badge.listCategory(data).then(res=>{
|
this.$api.badge.listCategory(data).then(res => {
|
||||||
if (res.code === 200){
|
if (res.code === 200) {
|
||||||
this.categoryList = res.data.list
|
this.categoryList = res.data.list
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
remove(id){
|
remove(id) {
|
||||||
this.$api.badge.delete({ ids: [id] }).then(res=>{
|
this.$api.badge.delete({ ids: [id] }).then(res => {
|
||||||
if (res.code === 200){
|
if (res.code === 200) {
|
||||||
this.$message.success(res.msg)
|
this.$message.success(res.msg)
|
||||||
this.fetchList()
|
this.fetchList()
|
||||||
} else {
|
} else {
|
||||||
@ -110,6 +116,4 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped></style>
|
||||||
|
|
||||||
</style>
|
|
||||||
Loading…
Reference in New Issue
Block a user