diff --git a/src/api/subject.js b/src/api/subject.js new file mode 100644 index 0000000..7c1dd47 --- /dev/null +++ b/src/api/subject.js @@ -0,0 +1,69 @@ +import request from '@/utils/request' + +// 查询主题列表 +export function listSubject(query) { + return request({ + url: '/special/specialBackList', + method: 'get', + params: query + }) +} + + +// 新增主题 +export function addSubject(data) { + return request({ + url: '/special/addSpecial', + method: 'post', + data: data + }) +} + +// 修改主题 +export function updateSubject(data) { + return request({ + url: '/special/specialEdit', + method: 'post', + data: data + }) +} + +// 删除主题 +export function delSubject(data) { + return request({ + url: '/special/specialDel', + method: 'post', + data: data + }) +} + + + +// 查询主题文章列表 +export function listSubjectArticle(query) { + return request({ + url: '/special/specialBackListMore', + method: 'get', + params: query + }) +} + + +// 新增文章 +export function addSubjectArticle(data) { + return request({ + url: '/special/specialBind', + method: 'post', + data: data + }) +} + +// 删除主题 +export function delSubjectArticle(data) { + console.log(data) + return request({ + url: '/special/specialSolution', + method: 'post', + data: data + }) +} diff --git a/src/router/routes.js b/src/router/routes.js index c81da2b..814e48f 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -40,37 +40,55 @@ const routes = [ path: '/dashboard', component: () => import('@/views/dashboard'), }], - meta: { title: '欢迎页', icon: 'form', noCache: true} + meta: { title: '欢迎页', icon: 'form', noCache: true } }, { path: '/menuManage', component: Layout, children: [{ - path: 'index', - name: 'MenuManage', - component: () => import('@/views/menu'), - meta: { title: '菜单管理', icon: 'tree-table', noCache: true} + path: 'index', + name: 'MenuManage', + component: () => import('@/views/menu'), + meta: { title: '菜单管理', icon: 'tree-table', noCache: true } }] }, { path: '*', component: Notfound, hidden: true }, { - path: '/article', - component: Layout, - name: 'article', - meta: { title: '内容中心', icon: 'form' }, + path: '/article', + component: Layout, + name: 'article', + meta: { title: '内容中心', icon: 'form' }, + children: [{ + path: 'index', + name: 'articleIndex', + component: () => import('@/views/article/index'), + meta: { title: '文章列表', icon: 'form', noCache: true } + }, { + path: 'category', + name: 'articleCategory', + component: () => import('@/views/article/category'), + meta: { title: '文章类别', icon: 'form', noCache: true } + }, + { + path: 'subject', + component: () => import('@/views/article/subject/layout'), + name: 'subject', + meta: { title: '专题管理', icon: 'form' }, children: [{ - path: 'index', - name: 'articleIndex', - component: () => import('@/views/article/index'), - meta: { title: '文章列表', icon: 'form', noCache: true} - },{ - path: 'category', - name: 'articleCategory', - component: () => import('@/views/article/category'), - meta: { title: '文章类别', icon: 'form', noCache: true} + path: 'list', + name: 'subjectIndex', + component: () => import('@/views/article/subject/index'), + meta: { title: '专题列表', icon: 'form', noCache: true } + }, { + path: 'article', + name: 'subjectArticle', + component: () => import('@/views/article/subject/article'), + meta: { title: '专题文章', icon: 'form', noCache: true } }, ] + }, + ] }, { @@ -79,40 +97,40 @@ const routes = [ name: 'AD', meta: { title: '广告中心', icon: 'form' }, children: [{ - path: 'index', - name: 'adIndex', - component: () => import('@/views/ad/index'), - meta: { title: '首页管理', icon: 'form', noCache: true} - } + path: 'index', + name: 'adIndex', + component: () => import('@/views/ad/index'), + meta: { title: '首页管理', icon: 'form', noCache: true } + } ] -}, + }, -{ - path: '/admin', - component: Layout, - name: 'Admin', - meta: { title: '用户', icon: 'form' }, - children: [{ + { + path: '/admin', + component: Layout, + name: 'Admin', + meta: { title: '用户', icon: 'form' }, + children: [{ path: 'index', name: 'AdminIndex', component: () => import('@/views/admin/index'), - meta: { title: '管理员管理', icon: 'form', noCache: true} + meta: { title: '管理员管理', icon: 'form', noCache: true } } - ] -}, -{ - path: '/role', - component: Layout, - name: 'Role', - meta: { title: '角色', icon: 'form' }, - children: [{ + ] + }, + { + path: '/role', + component: Layout, + name: 'Role', + meta: { title: '角色', icon: 'form' }, + children: [{ path: 'index', name: 'RoleIndex', component: () => import('@/views/role/index'), - meta: { title: '角色管理', icon: 'form', noCache: true} + meta: { title: '角色管理', icon: 'form', noCache: true } } - ] -}, + ] + }, ...warning, @@ -121,10 +139,10 @@ const routes = [ path: '/updateVersion', component: Layout, children: [{ - path: 'index', - name: 'UpdateVersion', - component: () => import('@/views/updateVersion/updateVersion'), - meta: { title: '版本更新', icon: 'form', noCache: true} + path: 'index', + name: 'UpdateVersion', + component: () => import('@/views/updateVersion/updateVersion'), + meta: { title: '版本更新', icon: 'form', noCache: true } }] }, ...playground, diff --git a/src/utils/get-img-width.js b/src/utils/get-img-width.js index 1a29234..4bcf056 100644 --- a/src/utils/get-img-width.js +++ b/src/utils/get-img-width.js @@ -31,6 +31,14 @@ export default function (file, id) { width = 722; height = 406; break; + case 'subjectCover': //专题封面 + width = 650; + height = 350; + break; + case 'subjectBanner': //专题封面 + width = 1585; + height = 224; + break; }; return new Promise(resolve => { let reader = new FileReader(); diff --git a/src/views/article/index.vue b/src/views/article/index.vue index 3992c62..e957843 100644 --- a/src/views/article/index.vue +++ b/src/views/article/index.vue @@ -208,6 +208,7 @@ :options="categoryOptions" :normalizer="normalizer" :show-count="true" + :disabled="dialogStatus=='create'" placeholder="选择分类" /> @@ -394,8 +395,8 @@ export default { dialogFormVisible: false, dialogStatus: "", textMap: { - update: "Edit", - create: "Create", + update: "编辑", + create: "添加", }, rules: { title: [ diff --git a/src/views/article/subject/article.vue b/src/views/article/subject/article.vue new file mode 100644 index 0000000..8e6dbcb --- /dev/null +++ b/src/views/article/subject/article.vue @@ -0,0 +1,354 @@ + + + + + \ No newline at end of file diff --git a/src/views/article/subject/index.vue b/src/views/article/subject/index.vue new file mode 100644 index 0000000..0b682ea --- /dev/null +++ b/src/views/article/subject/index.vue @@ -0,0 +1,398 @@ + + + + diff --git a/src/views/article/subject/layout.vue b/src/views/article/subject/layout.vue new file mode 100644 index 0000000..5e1bb62 --- /dev/null +++ b/src/views/article/subject/layout.vue @@ -0,0 +1,3 @@ +