const baseUrl = '' export interface IParam { pageNum?: number pageSize?: number sort?: string param: object } export const post = (path: string, params: IParam) => { let url = baseUrl + path // #ifdef APP-PLUS if (!uni.host) { const host = uni.getStorageSync(uni.$u.LOCAL_KEY.HOST) if (!host) { uni.showModal({ title: '提示', content: '请先配置服务地址', showCancel: true, success: ({ confirm }) => { if (confirm) { // 跳转到配置地址的地方 } }, }) return } uni.host = host } url = `${uni.host}${baseUrl}` // #endif return uni.$u.post(url, params) }