generated from ccsens_fe/uni-vue3-template
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
701 B
35 lines
701 B
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)
|
|
}
|
|
|