文章管理部分接口对接
This commit is contained in:
parent
d27a44d446
commit
8a48837db7
@ -2,7 +2,7 @@ import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/article',
|
||||
url: 'aerocraftAdminApi/cpArticle',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
|
33
src/api/platform/label.js
Normal file
33
src/api/platform/label.js
Normal file
@ -0,0 +1,33 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function tree(moduleId) {
|
||||
return request({
|
||||
url: `aerocraftAdminApi/cpLabel/tree/${moduleId}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'aerocraftAdminApi/cpLabel',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(id) {
|
||||
return request({
|
||||
url: `aerocraftAdminApi/cpLabel/${id}`,
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'aerocraftAdminApi/cpLabel',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { tree, add, edit, del }
|
33
src/api/platform/module.js
Normal file
33
src/api/platform/module.js
Normal file
@ -0,0 +1,33 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function all() {
|
||||
return request({
|
||||
url: 'aerocraftAdminApi/cpModule/all',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'aerocraftAdminApi/cpModule',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(id) {
|
||||
return request({
|
||||
url: `aerocraftAdminApi/cpModule/${id}`,
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'aerocraftAdminApi/cpModule',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { all, add, edit, del }
|
@ -4,13 +4,13 @@
|
||||
<div class="head-container">
|
||||
<div>
|
||||
<!-- 搜索 -->
|
||||
<el-select v-model="query.moduleName" placeholder="请选择模块" clearable size="small" class="filter-item"
|
||||
style="width: 200px">
|
||||
<el-option v-for="(item,index) in modules" :key="index" :label="item.label" :value="item.value" />
|
||||
<el-select v-model="query.moduleId" placeholder="请选择模块" clearable size="small" class="filter-item"
|
||||
style="width: 200px" @change="getLabels">
|
||||
<el-option v-for="(item,index) in modules" :key="index" :label="item.moduleName" :value="item.id" />
|
||||
</el-select>
|
||||
<el-select v-model="query.labelName" placeholder="请选择标签" clearable size="small" class="filter-item"
|
||||
<el-select v-model="query.cplabelId" placeholder="请选择标签" clearable size="small" class="filter-item"
|
||||
style="width: 200px">
|
||||
<el-option v-for="(item,index) in labels" :key="index" :label="item.label" :value="item.value" />
|
||||
<el-option v-for="(item,index) in labels" :key="index" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
<el-input v-model="query.title" clearable size="small" placeholder="请输入标题" style="width: 200px;"
|
||||
class="filter-item" @keyup.enter.native="crud.toQuery"/>
|
||||
@ -50,7 +50,7 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
<pagination pageProp="pages" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@ -58,15 +58,15 @@ import crudArticle from '@/api/platform/article'
|
||||
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import { all } from '@/api/platform/module'
|
||||
import { tree } from '@/api/platform/label'
|
||||
export default {
|
||||
name: 'Article',
|
||||
components: { rrOperation, pagination },
|
||||
// 数据字典
|
||||
dicts: ['material_type'],
|
||||
cruds() {
|
||||
return CRUD({ title: '文章', url: 'api/article', crudMethod: { ...crudArticle }, optShow: { reset: true }})
|
||||
},
|
||||
mixins: [presenter(), header(), crud()],
|
||||
cruds() {
|
||||
return CRUD({ title: '文章', url: '/aerocraftAdminApi/cpArticle', crudMethod: { ...crudArticle }, optShow: { reset: true }})
|
||||
},
|
||||
mixins: [presenter(), header(), crud()],
|
||||
data() {
|
||||
return {
|
||||
permission: {
|
||||
@ -74,25 +74,12 @@ export default {
|
||||
edit: ['admin', 'article:edit'],
|
||||
del: ['admin', 'article:del']
|
||||
},
|
||||
modules:[
|
||||
{ label: '景区', value: '景区' },
|
||||
{ label: '新闻', value: '新闻' },
|
||||
{ label: '活动', value: '活动' },
|
||||
{ label: '其他', value: '其他' }
|
||||
],
|
||||
labels:[
|
||||
{ label: '图片', value: '图片' },
|
||||
{ label: '视频', value: '视频' },
|
||||
{ label: '音频', value: '音频' },
|
||||
{ label: '文件', value: '文件' }
|
||||
]
|
||||
modules:[],
|
||||
labels:[]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.crud.data = [{ id: 1, title: '景区', articletype: '图文', top: 1, moduleName: '工作台', labelName: '使用教程', createTime: '2020-01-01' },
|
||||
{ id: 2, title: '景区', articletype: '图文', top: 0, moduleName: '工作台', labelName: '使用教程', createTime: '2020-01-01' },
|
||||
]
|
||||
this.crud.resetDataStatus()
|
||||
this.getModules();
|
||||
},
|
||||
methods: {
|
||||
// 复制链接
|
||||
@ -107,6 +94,23 @@ export default {
|
||||
this.$message.success('复制成功');
|
||||
aux.remove();
|
||||
},
|
||||
// 查询模块
|
||||
getModules(){
|
||||
all().then(res => {
|
||||
this.modules = res;
|
||||
})
|
||||
},
|
||||
// 根据模块id查询标签
|
||||
getLabels(){
|
||||
if(this.query.moduleId){
|
||||
tree(this.query.moduleId).then(res => {
|
||||
this.labels = res;
|
||||
});
|
||||
}else{
|
||||
this.labels = [];
|
||||
this.query.cplabelId = '';
|
||||
}
|
||||
},
|
||||
// 文章详情
|
||||
toShowDetail(row) {
|
||||
this.$router.push({ path: '/platform/article/detail' , query: { id:row.id, moduleName: row.moduleName, labelName: row.labelName } });
|
||||
@ -144,6 +148,9 @@ export default {
|
||||
// state.tableData.loading = false;
|
||||
}
|
||||
})
|
||||
},
|
||||
[CRUD.HOOK.beforeRefresh](crud, form) {
|
||||
crud.query.current = crud.page.page;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,13 +29,13 @@ module.exports = {
|
||||
},
|
||||
// lintOnSave: false,
|
||||
proxy: {
|
||||
// '/aerocraftAdminApi': {
|
||||
// target: process.env.VUE_APP_BASE_API,
|
||||
// changeOrigin: true,
|
||||
// // pathRewrite: {
|
||||
// // '^/api': 'api'
|
||||
// // }
|
||||
// },
|
||||
'/aerocraftAdminApi': {
|
||||
target: process.env.VUE_APP_BASE_API,
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
'^/aerocraftAdminApi': ''
|
||||
}
|
||||
},
|
||||
'/api': {
|
||||
target: process.env.VUE_APP_BASE_API,
|
||||
changeOrigin: true,
|
||||
|
Loading…
Reference in New Issue
Block a user