UNPKG

fcc-core

Version:

Fusion communication center.

48 lines (43 loc) 1.37 kB
// import { XWPrivate } from '../../core/XW' import { language, serverUrl as configApi } from '../../../config' import http from '../../../utils/ajaxRequest/instance' // 获取接口根路径 const isProd = process.env.NODE_ENV === 'production' const BASE_PATH = isProd ? configApi.production : configApi.development export default async function (xw, params) { await xw.validate(params, { path: { type: 'string' } }) xw.public.baseUrl = params.path let path = params.path if (path) { if (path.slice(-1) === '/') { path = path.substr(0, path.length - 1) } for (let apiType in BASE_PATH) { BASE_PATH[apiType] = path + BASE_PATH[apiType] } } await getSysParamDict(xw) // 获取数据字典和系统参数 } // 获取数据字典和系统参数 async function getSysParamDict (xw) { return Promise.all([ http({ apiType: 'UCC', method: 'get', url: `/njdf_cache?cacheType=dictCache&language=${language}` }).then(result => { Object.assign(xw.dictList, result.data) return Promise.resolve() }), http({ apiType: 'UCC', method: 'get', url: `/njdf_cache?cacheType=sysParamCache&language=${language}` }).then(result => { Object.assign(xw.sysParam, result.data) return Promise.resolve() }) ]) }