初始化uni-app

This commit is contained in:
2026-05-31 15:07:44 +08:00
parent 2df598c0d8
commit daff741c65
18 changed files with 988 additions and 145 deletions
+29
View File
@@ -0,0 +1,29 @@
const BASE_URL = 'http://localhost:8080/api'
export const request = (options) => {
return new Promise((resolve, reject) => {
uni.request({
url: BASE_URL + options.url,
method: options.method || 'GET',
data: options.data || {},
header: {
'Content-Type': 'application/json',
...options.header
},
success: (res) => {
if (res.statusCode === 200) {
resolve(res.data)
} else {
reject(res)
}
},
fail: (err) => {
reject(err)
}
})
})
}
export default {
request
}