fix
This commit is contained in:
parent
0c6859987f
commit
15b03f0164
@ -7,6 +7,9 @@ export default {
|
|||||||
update(params) {
|
update(params) {
|
||||||
return fetch('/library/update', params,'post','json')
|
return fetch('/library/update', params,'post','json')
|
||||||
},
|
},
|
||||||
|
remove(params) {
|
||||||
|
return fetch('/library/delete', params,'post','json')
|
||||||
|
},
|
||||||
|
|
||||||
list(params) {
|
list(params) {
|
||||||
return fetch('/library/list', params,'post','json')
|
return fetch('/library/list', params,'post','json')
|
||||||
@ -37,6 +40,18 @@ export default {
|
|||||||
|
|
||||||
wechatList(params){
|
wechatList(params){
|
||||||
return fetch('/config/qrcode/list',params,'post','json')
|
return fetch('/config/qrcode/list',params,'post','json')
|
||||||
|
},
|
||||||
|
|
||||||
|
saveCategory(params){
|
||||||
|
return fetch('/class/add',params, 'post','json')
|
||||||
|
},
|
||||||
|
|
||||||
|
updateCategory(params){
|
||||||
|
return fetch('/class/update',params, 'post','json')
|
||||||
|
},
|
||||||
|
|
||||||
|
listCategory(params){
|
||||||
|
return fetch('/class/list',params, 'post','json')
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
78
src/views/flower/knowledge/components/category.vue
Normal file
78
src/views/flower/knowledge/components/category.vue
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<a-button type="text" @click="show = true">添加分类</a-button>
|
||||||
|
<a-modal v-model:visible="show" title="添加徽章分类" @before-ok="submit">
|
||||||
|
<div>
|
||||||
|
<div class="bold mb-20">已有分类</div>
|
||||||
|
<div>
|
||||||
|
<a-tag v-for="item in list" type="primary" class="mr-15">
|
||||||
|
{{item.tag}}
|
||||||
|
</a-tag>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mt-20">
|
||||||
|
<div class="bold mb-20">新增分类</div>
|
||||||
|
<a-textarea v-model="from" :auto-size="{minRows:6}"></a-textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</a-modal>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
watch: {
|
||||||
|
show:{
|
||||||
|
handler(val){
|
||||||
|
if (val){
|
||||||
|
this.fetchList()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
show: false,
|
||||||
|
list:[],
|
||||||
|
from:{
|
||||||
|
ossId:'1',
|
||||||
|
name:'',
|
||||||
|
tag:''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.from = JSON.stringify(this.from, null, 4)
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
fetchList(){
|
||||||
|
const data = {current:1,pageSize:999,}
|
||||||
|
this.$api.flower.listCategory(data).then((res) => {
|
||||||
|
if (res.code === 200){
|
||||||
|
this.list = res.data.list
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
submit(done) {
|
||||||
|
const data = JSON.parse(this.from)
|
||||||
|
this.$api.flower.saveCategory(data).then((res) => {
|
||||||
|
if (res.code === 200){
|
||||||
|
this.$message.success(res.msg)
|
||||||
|
this.$emit('ok')
|
||||||
|
done()
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.msg)
|
||||||
|
done(false)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@ -4,6 +4,7 @@
|
|||||||
<a-card>
|
<a-card>
|
||||||
<div class="flex flex-center flex-justify-start">
|
<div class="flex flex-center flex-justify-start">
|
||||||
<edit @ok="fetchList"/>
|
<edit @ok="fetchList"/>
|
||||||
|
<category/>
|
||||||
</div>
|
</div>
|
||||||
<a-table class="mt-20" :columns="columns" :data="list" :pagination="page" @pageChange="change">
|
<a-table class="mt-20" :columns="columns" :data="list" :pagination="page" @pageChange="change">
|
||||||
<template #name="{record}">
|
<template #name="{record}">
|
||||||
@ -17,6 +18,9 @@
|
|||||||
<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>
|
<a-button type="text" @click="changeHot(record)">{{record.isHot === 0 ?'设置热门':'取消热门'}}</a-button>
|
||||||
<upload @ok="upload(record,$event)"/>
|
<upload @ok="upload(record,$event)"/>
|
||||||
|
<a-popconfirm content="确认删除该条数据" @ok="remove(record.id)">
|
||||||
|
<a-button type="text">删除</a-button>
|
||||||
|
</a-popconfirm>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</a-table>
|
</a-table>
|
||||||
@ -28,10 +32,12 @@
|
|||||||
import navbar from '@/components/navbar/index.vue'
|
import navbar from '@/components/navbar/index.vue'
|
||||||
import upload from "../../../components/upload/index.vue";
|
import upload from "../../../components/upload/index.vue";
|
||||||
import edit from './components/edit.vue'
|
import edit from './components/edit.vue'
|
||||||
|
import category from './components/category.vue'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
navbar,
|
navbar,
|
||||||
edit,
|
edit,
|
||||||
|
category,
|
||||||
upload
|
upload
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -105,6 +111,15 @@ export default {
|
|||||||
this.$message.error(res.msg)
|
this.$message.error(res.msg)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
remove(id){
|
||||||
|
this.$api.flower.remove({ids:[id]}).then(res => {
|
||||||
|
if(res.code === 200){
|
||||||
|
this.fetchList()
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user