Browse Source

优化了请求的路径

wzy 10 months ago
parent
commit
68e9d74505
2 changed files with 6 additions and 4 deletions
  1. 2 2
      config/modules/shop.js
  2. 4 2
      utils/request.js

+ 2 - 2
config/modules/shop.js

@@ -1,7 +1,7 @@
-import { request,BASE_URL } from '@/utils/request.js'
+import { request } from '@/utils/request.js'
 
 
 //  获取该分类下的商品列表
 // export function getProductList(params) {
-//     return NET.request(`${BASE_URL}/classify/getClaasifyProducts`, params, "GET");
+//     return NET.request(`/classify/getClaasifyProducts`, params, "GET");
 // }

+ 4 - 2
utils/request.js

@@ -2,7 +2,8 @@
 //  配置请求根路径
 const BASE_URL = process.env.UNI_BASE_URL;
 
-const request = (url, data, method = 'GET') => {
+const request = (requesUrl, data, method = 'GET') => {
+	let url = `${BASE_URL}${requesUrl}`
 	return new Promise((resolve, reject) => {
 		let header = {
 			"Content-Type": "application/json"
@@ -43,7 +44,8 @@ const request = (url, data, method = 'GET') => {
 	});
 }
 //不带token接口请求,首页
-const request1 = (url, data, method = 'GET') => {
+const request1 = (requesUrl, data, method = 'GET') => {
+	let url = `${BASE_URL}${requesUrl}`
 	return new Promise((resolve, reject) => {
 		let header = {
 			'Content-Type': 'application/json',