guhongwei 2 years ago
parent
commit
2bf234399b
1 changed files with 9 additions and 1 deletions
  1. 9 1
      common/api.js

+ 9 - 1
common/api.js

@@ -4,8 +4,16 @@ const getDomain = (uri, method, type) => {
 	if (uri.startsWith('/wechat/api')) return config.serverUrl + uri;
 	else return config.serverUrl + '/point/v1/api' + uri;
 }
-export const requestBase = (uri, method, data, type, token) => {
+// 获取token
+const getToken = () => {
+	try {
+		const value = uni.getStorageSync('token');
+		if (value) return value;
+	} catch {}
+}
+export const requestBase = (uri, method, data, type) => {
 	let baseUrl = getDomain(uri, method, type);
+	let token = getToken();
 	return new Promise((resolve, reject) => {
 		uni.request({
 			url: baseUrl,