zhaogongxue 10 månader sedan
förälder
incheckning
9f818af58e
3 ändrade filer med 39 tillägg och 0 borttagningar
  1. 8 0
      network/base.js
  2. 9 0
      network/homeApi.js
  3. 22 0
      network/http.js

+ 8 - 0
network/base.js

@@ -0,0 +1,8 @@
+const baseURL = ''
+
+const showHttpLog = false
+
+module exports = {
+	baseURL,
+	showHttpLog,
+}

+ 9 - 0
network/homeApi.js

@@ -0,0 +1,9 @@
+import { request } from'./http.js'
+
+export function login (data){
+	return request({
+		url:'',
+		method:'GET',
+		data
+	})
+}

+ 22 - 0
network/http.js

@@ -0,0 +1,22 @@
+import { baseURL } from './base,js'
+
+export const request = (option)=>{
+	return new Promise((resolve,reject)=>{
+		uni.request({
+			url::baseURL+option.url,
+			method:option.method,
+			data:option.data,
+			Headers:{
+				// "Authorization":window.localStorage.getItem('token')
+			},
+			success:(res)=>{
+				console.log(res	)
+				resolve(res)
+			},
+			fail:(error)=>{
+				console.log(error)
+				reject(error)
+			}
+		})
+	})
+}