goeasy + login

This commit is contained in:
2021-04-06 14:05:14 +08:00
parent 39e00f1811
commit 3ec8d96fff
11 changed files with 151 additions and 10 deletions

5
utils/api.js Normal file
View File

@@ -0,0 +1,5 @@
import {get,post} from "./request"
export function login(data){
return get('/login/login',data)
}

2
utils/goeasy-1.2.1.js Normal file

File diff suppressed because one or more lines are too long

40
utils/request.js Normal file
View File

@@ -0,0 +1,40 @@
const BASEURL = "http://192.168.3.122:8080";
export function get(url,data, baseurl = BASEURL){
return new Promise((res,err)=>{
let d = "?";
for(let i in data){
d += i + '=' + data[i] + "&";
}
if(d == "?"){
d = ""
}
wx.request({
url: baseurl + url + d,
success(r){
try {
r.data.data = JSON.parse(r.data.data)
res(r)
} catch (error) {
res(r)
}
},
error(e){
err(e)
}
})
})
}
export function post(url,data, baseurl = BASEURL){
return new Promise((res,err)=>{
wx.request({
url: baseurl + url,
data,
success(r){
res(r)
},
error(e){
err(e)
}
})
})
}