|
|
@@ -1,15 +1,22 @@
|
|
|
import { Toast } from 'antd-mobile'
|
|
|
import { fetchPostObj } from '../common/fetchRequest'
|
|
|
import { API } from '../../configs/api.config'
|
|
|
-import { analysisDocList, refreshDocList } from '../../redux/actions/docState'
|
|
|
+import { refreshDocList } from '../../redux/actions/docState'
|
|
|
import { message } from 'antd'
|
|
|
+import { isObjEmpty } from '../common/common.util'
|
|
|
+import { FUNC_TYPE_DOC } from '../../configs/constans.config'
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by RaoMeng on 2020/12/3
|
|
|
+ * Desc: 应用模块通用方法类
|
|
|
+ */
|
|
|
|
|
|
/**
|
|
|
* 获取应用列表
|
|
|
*/
|
|
|
export function requestServices () {
|
|
|
Toast.loading('正在获取应用列表', 0)
|
|
|
- fetchPostObj(API.APPCOMMON_GETSERVICE, {
|
|
|
+ return fetchPostObj(API.APPCOMMON_GETSERVICE, {
|
|
|
kind: 'uasapp',
|
|
|
}).then(response => {
|
|
|
Toast.hide()
|
|
|
@@ -26,3 +33,48 @@ export function requestServices () {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 解析并缓存应用列表数据
|
|
|
+ * @param response
|
|
|
+ */
|
|
|
+export const analysisDocList = (response) => {
|
|
|
+ const data = response.data
|
|
|
+ const docFuncGroupList = []
|
|
|
+ if (!isObjEmpty(data)) {
|
|
|
+ const responseList = data.list
|
|
|
+ if (!isObjEmpty(responseList)) {
|
|
|
+ responseList.forEach((groupItem, groupIndex) => {
|
|
|
+ let docFuncGroup = {
|
|
|
+ groupTitle: groupItem.groupTitle,
|
|
|
+ groupIndex: groupIndex,
|
|
|
+ }
|
|
|
+ const funcList = groupItem.funcList
|
|
|
+ if (!isObjEmpty(funcList)) {
|
|
|
+ let docFuncList = []
|
|
|
+ funcList.forEach((childItem, childIndex) => {
|
|
|
+ const docFunc = {
|
|
|
+ id: childItem.fid,
|
|
|
+ name: childItem.name,
|
|
|
+ caller: childItem.caller,
|
|
|
+ img: childItem.icon && childItem.icon.exticon,
|
|
|
+ often: childItem.often,
|
|
|
+ url: childItem.url && childItem.url.skipurl,
|
|
|
+ countUrl: childItem.url && childItem.url.counturl,
|
|
|
+ groupIndex: groupIndex,
|
|
|
+ childIndex: childIndex,
|
|
|
+ funcType: FUNC_TYPE_DOC,
|
|
|
+ }
|
|
|
+ docFuncList.push(docFunc)
|
|
|
+ })
|
|
|
+ docFuncGroup.funcList = docFuncList
|
|
|
+ }
|
|
|
+ docFuncGroupList.push(docFuncGroup)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ refreshDocList({
|
|
|
+ docFuncGroupList,
|
|
|
+ })
|
|
|
+}
|