1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
| import { BASE_URL } from "@/config/config.js";
| export const request = (url, data, method) => {
| return new Promise((resolve, reject) => {
| uni.request({
| url: BASE_URL + url,
| method: method || 'POST',
| header: {
| token:uni.getStorageSync('token') || ''
| },
| data: data || {},
| success: (res) => {
| const data = res.data
| resolve(data)
| },
| fail:(error)=>{
| uni.showToast({
| icon:'error',
| title:'请求错误'
| })
| reject(error)
| },
| })
| }).catch((e) => {});
| }
|
|