Browse Source

帮助中心数据找回

ouxq 8 years ago
parent
commit
a3ea78256a
1 changed files with 51 additions and 0 deletions
  1. 51 0
      store/index.js

+ 51 - 0
store/index.js

@@ -179,5 +179,56 @@ export const actions = {
       }, err => {
         commit('brandCategories/GET_CATEGORIES_FAILURE', err)
       })
+  },
+  // 获取帮助中心信息
+  loadHelpSnapsho ({ commit }, params = {}) {
+    commit('help/REQUEST_SNAPSHO')
+    return axios.get('/api/help-service/helps', {params})
+      .then(response => {
+        commit('help/GET_SNAPSHO_SUCCESS', response.data)
+      }, err => {
+        commit('help/GET_SNAPSHO_FAILURE', err)
+      })
+  },
+  // 获取帮助中心二级菜单
+  loadHelpList ({ commit }, params = {}) {
+    commit('help/REQUEST_HELPLIST')
+    return axios.get('/api/help-service/issues', {params})
+      .then(response => {
+        commit('help/GET_HELPLIST_SUCCESS', response.data)
+      }, err => {
+        commit('help/GET_HELPLIST_FAILURE', err)
+      })
+  },
+  // 获取帮助中心名称
+  loadHelpTitle ({ commit }, params = {}) {
+    let id = params.id
+    commit('help/REQUEST_TITLE')
+    return axios.get(`/api/help-service/${id}`, {params})
+      .then(response => {
+        commit('help/GET_TITLE_SUCCESS', response.data)
+        console.log('parent', response.data)
+      }, err => {
+        commit('help/GET_TITLE_FAILURE', err)
+      })
+  },
+  // 获取详情
+  loadHelpDetail ({ commit }, params = {}) {
+    let id = params.id
+    commit('help/REQUEST_DETAIL')
+    return axios.get(`/api/help-service/issues/${id}`, {params})
+      .then(response => {
+        commit('help/GET_DETAIL_SUCCESS', response.data)
+        let id = response.data.navId
+        commit('help/REQUEST_TITLE')
+        return axios.get(`/api/help-service/${id}`)
+          .then(response => {
+            commit('help/GET_TITLE_SUCCESS', response.data)
+          }, err => {
+            commit('help/GET_TITLE_FAILURE', err)
+          })
+      }, err => {
+        commit('help/GET_DETAIL_FAILURE', err)
+      })
   }
 }