This commit is contained in:
2024-09-10 10:49:08 +08:00
parent b5fd06b800
commit dd4f5938da
6391 changed files with 722800 additions and 0 deletions

22
http/classApi.js Normal file
View File

@@ -0,0 +1,22 @@
class API {
constructor(url,req) {
const map={
add:'POST',
del:'DELETE',
update:'PUT',
get:'GET'
}
this.url=url
for(let key in map){
this[key]=function(data){
data=Array.isArray(data)?data:{...data,shopId:uni.getStorageSync('shopId')}
if(key==='del'){
delete data.shopId
}
return req(url, data,map[key])
}
}
}
}
export default API