UNPKG

kdesign-ui

Version:

kd is from company of klx, it provide quickly genarator company inner business front structure

46 lines (44 loc) 1.68 kB
/* md5: 0edc4e3a982bbc926f7b74620e38caa8 */ /* 仓库id: 241245 */ /* 版本: 0.0.1-beta.0 */ /* eslint-disable */ /* tslint:disable */ /** * 本文件由接口平台自动生成,请勿修改 * 仓库地址: http://gitee/repository/editor?id=241245 */ import axios from '@/plugins/axios' import { downLoad } from '@/utils' import { {{ each definition }} {{ ($value.method || '').toLowerCase() + $value.definitionCode + `V${$value.version}` + ($index !== definition.length - 1 ? ',' : '') }} {{/each}} } from './model' import {ValidateType} from './model/utils' const isPod = process.env.NODE_ENV === 'production' {{ each definition }} let validate{{$value.definitionCode}}{{`V${$value.version}`}} = new ValidateType({{($value.method || '').toLowerCase() + $value.definitionCode + `V${$value.version}`}}.Req, '{{($value.gatewayName || "").trim() ? $value.gatewayName + $value.url : $value.url}}', '{{$value.method || GET}}') export function {{$value.definitionCode}}{{`V${$value.version}`}} (req, config = {}, filterKey = []) { {{if !$value.isDownload}} // 生产环境去除校验,提升性能 !isPod && validate{{$value.definitionCode}}{{`V${$value.version}`}}.setFilterKey(filterKey).validate(req) {{set header = $value.header[0] || ({})}} return axios({ url: '{{$value.url}}', method: '{{$value.method || "GET"}}', {{ if(header.name === 'Content-Type' && header.value === 'application/json')}} headers: { '{{header.name}}': '{{header.value}}' }, disabledData: true, {{/if}} data: req, ...config }).then(({ data }) => { return data }) {{else}} downLoad('{{$value.url}}', req) {{/if}} } {{/each}}