import { fetch } from '../../../utils/util'; export class PathParams { /** fileName */ fileName = ''; [key: string]: any; } export type ResponseType = Promise; export const URL = '/api/image/get/{fileName}'; /** * @desc 获取文件 */ export function request( pathParams: PathParams, options?: WechatMiniprogram.RequestOption, ): ResponseType { let url = '/api/image/get/{fileName}'; for (let key in pathParams) { url.replace('{' + key + '}', pathParams[key]); } const fetchOption = Object.assign( { url: url, method: 'GET', headers: { 'Content-Type': 'application/json', }, }, options, ); return fetch(fetchOption); }