diff --git a/src/api/faq.js b/src/api/faq.js new file mode 100644 index 00000000..671b593d --- /dev/null +++ b/src/api/faq.js @@ -0,0 +1,31 @@ +import axios from 'axios' + +const FAQEndpointUrl = 'https://metadata.service.development.therig.onlinefuelslabs.io' + +export function fetchList(query) { + return axios.get(`${FAQEndpointUrl}/faqs`, { params: query }) +} + +export function fetchFaq(id) { + return axios.get(`${FAQEndpointUrl}/faqs/${id}?platform=OLFDE`) +} + +export function createFaq(data) { + const dto = __dataToDTO(data) + return axios.post(`${FAQEndpointUrl}/faqs`, dto) +} + +export function updateFaq(data) { + const dto = __dataToDTO(data) + return axios.put(`${FAQEndpointUrl}/faqs/${data._id}`, dto) +} + +function __dataToDTO(data) { + return { + 'question': data.question, + 'answer': data.answer, + 'order': parseInt(data.order), + 'status': data.status, + 'platform': 'OLFDE' + } +} diff --git a/src/router/index.js b/src/router/index.js index 7b5cda9d..fb160cfb 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -261,6 +261,37 @@ export const asyncRoutes = [ } ] }, + { + path: '/faqs', + component: Layout, + redirect: '/faqs/list', + name: 'FAQs', + meta: { + title: 'FAQs', + icon: 'example' + }, + children: [ + { + path: 'create', + component: () => import('@/views/faqs/create'), + name: 'CreateFAQ', + meta: { title: 'Create FAQ', icon: 'edit' } + }, + { + path: 'edit/:id', + component: () => import('@/views/faqs/edit'), + name: 'EditFAQs', + meta: { title: 'Edit FAQ', noCache: true, activeMenu: '/faqs/list' }, + hidden: true + }, + { + path: 'list', + component: () => import('@/views/faqs/list'), + name: 'FAQList', + meta: { title: 'FAQ List', icon: 'list' } + } + ] + }, { path: '/permission', component: Layout, diff --git a/src/views/faqs/components/FaqDetail.vue b/src/views/faqs/components/FaqDetail.vue new file mode 100644 index 00000000..2dbf0867 --- /dev/null +++ b/src/views/faqs/components/FaqDetail.vue @@ -0,0 +1,230 @@ + + + + + diff --git a/src/views/faqs/create.vue b/src/views/faqs/create.vue new file mode 100644 index 00000000..54787aea --- /dev/null +++ b/src/views/faqs/create.vue @@ -0,0 +1,13 @@ + + + + diff --git a/src/views/faqs/edit.vue b/src/views/faqs/edit.vue new file mode 100644 index 00000000..109cb466 --- /dev/null +++ b/src/views/faqs/edit.vue @@ -0,0 +1,13 @@ + + + + diff --git a/src/views/faqs/list.vue b/src/views/faqs/list.vue new file mode 100644 index 00000000..fe8fad09 --- /dev/null +++ b/src/views/faqs/list.vue @@ -0,0 +1,93 @@ + + + + +