refactor: 更新 API 请求路径与配置

This commit is contained in:
pikachu1995@126.com
2026-07-13 14:30:09 +08:00
parent c90559981e
commit e67ea56651
29 changed files with 88 additions and 227 deletions

View File

@@ -3,15 +3,9 @@ var BASE = {
* @description api请求基础路径
*/
API_DEV: {
common: "https://common-api.pickmall.cn",
buyer: "https://buyer-api.pickmall.cn",
seller: "https://store-api.pickmall.cn",
manager: "https://admin-api.pickmall.cn"
},
API_PROD: {
common: "https://common-api.pickmall.cn",
buyer: "https://buyer-api.pickmall.cn",
seller: "https://store-api.pickmall.cn",
manager: "https://admin-api.pickmall.cn"
},
};

View File

@@ -1,5 +1,5 @@
import request, {
Method, commonUrl
Method, buyerUrl
} from '@/plugins/request.js';
// 会员收货地址列表
@@ -55,7 +55,7 @@ export function getAddrDetail (id) {
// 传给后台citycode 获取城市街道等id
export function handleRegion (params) {
return request({
url: `${commonUrl}/common/common/region/region`,
url: `${buyerUrl}/buyer/common/region/region`,
needToken: true,
method: Method.GET,
params

View File

@@ -1,11 +1,11 @@
import request, {Method, commonUrl} from '@/plugins/request.js';
import request, {Method, buyerUrl} from '@/plugins/request.js';
/**
* 获取拼图验证
*/
export function getVerifyImg (verificationEnums) {
return request({
url: `${commonUrl}/common/common/slider/${verificationEnums}`,
url: `${buyerUrl}/buyer/common/slider/${verificationEnums}`,
method: Method.GET,
needToken: false
});
@@ -15,7 +15,7 @@ export function getVerifyImg (verificationEnums) {
*/
export function postVerifyImg (params) {
return request({
url: `${commonUrl}/common/common/slider/${params.verificationEnums}`,
url: `${buyerUrl}/buyer/common/slider/${params.verificationEnums}`,
method: Method.POST,
needToken: false,
params
@@ -26,7 +26,7 @@ export function postVerifyImg (params) {
*/
export function sendSms (params) {
return request({
url: `${commonUrl}/common/common/sms/${params.verificationEnums}/${params.mobile}`,
url: `${buyerUrl}/buyer/common/sms/${params.verificationEnums}/${params.mobile}`,
method: Method.GET,
needToken: false,
params
@@ -36,7 +36,7 @@ export function sendSms (params) {
// 地区数据,用于三级联动
export function getRegion (id) {
return request({
url: `${commonUrl}/common/common/region/item/${id}`,
url: `${buyerUrl}/buyer/common/region/item/${id}`,
needToken: true,
method: Method.GET,
loading: false
@@ -80,7 +80,7 @@ export function articleDetail (id) {
// 获取IM接口前缀
export function getIMDetail () {
return request({
url: `${commonUrl}/common/common/IM`,
url: `${buyerUrl}/buyer/common/IM`,
method: Method.GET
});
}
@@ -89,7 +89,7 @@ export function getIMDetail () {
//获取图片logo
export function getBaseSite(){
return request ({
url:`${commonUrl}/common/common/site`,
url:`${buyerUrl}/buyer/common/site`,
method: Method.GET,
needToken: false
})
@@ -98,7 +98,7 @@ export function getBaseSite(){
// 获取主题色配置
export function getThemeSetting() {
return request({
url: `${commonUrl}/common/common/site/theme`,
url: `${buyerUrl}/buyer/common/site/theme`,
method: Method.GET,
needToken: false,
});

View File

@@ -5,7 +5,7 @@ import request, {
// 商品列表
export function goodsList (params) {
return request({
url: '/buyer/goods/goods/es',
url: '/buyer/goods/goods/search',
method: Method.GET,
needToken: false,
optionalToken: true,
@@ -16,7 +16,7 @@ export function goodsList (params) {
// 商品分类 筛选条件 品牌, 尺寸等
export function filterList (params) {
return request({
url: '/buyer/goods/goods/es/related',
url: '/buyer/goods/goods/search/related',
method: Method.GET,
needToken: false,
optionalToken: true,

View File

@@ -1,5 +1,5 @@
import request, {Method, commonUrl} from '@/plugins/request.js';
import request, {Method, buyerUrl} from '@/plugins/request.js';
import storage from '@/plugins/storage.js';
/**
@@ -7,7 +7,7 @@ import storage from '@/plugins/storage.js';
*/
export function getVerifyImg (verificationEnums) {
return request({
url: `${commonUrl}/common/common/slider/${verificationEnums}`,
url: `${buyerUrl}/buyer/common/slider/${verificationEnums}`,
method: Method.GET,
needToken: false,
headers: {uuid: storage.getItem('uuid')}
@@ -19,7 +19,7 @@ export function getVerifyImg (verificationEnums) {
*/
export function postVerifyImg (params) {
return request({
url: `${commonUrl}/common/common/slider/${params.verificationEnums}`,
url: `${buyerUrl}/buyer/common/slider/${params.verificationEnums}`,
method: Method.POST,
needToken: false,
params,

View File

@@ -46,7 +46,7 @@
<script>
import { editMemberInfo } from '@/api/account.js';
import { commonUrl } from '@/plugins/request.js';
import { buyerUrl } from '@/plugins/request.js';
import storage from '@/plugins/storage.js';
import { User } from '@element-plus/icons-vue';
export default {
@@ -58,7 +58,7 @@ export default {
nickName: [{required: true, message: '用户昵称不能为空'}, { max: 16, message: '用户昵称不能超过15个字符' }]
},
formItem: {}, // 表单数据
action: commonUrl + '/common/common/upload/file', // 上传接口
action: buyerUrl + '/buyer/common/upload/file', // 上传接口
accessToken: {} // 验证token
}
},

View File

@@ -78,7 +78,7 @@
import { Camera, Delete, View } from '@element-plus/icons-vue';
import { orderDetail } from '@/api/order.js';
import { addEvaluation } from '@/api/member.js';
import { commonUrl } from '@/plugins/request.js';
import { buyerUrl } from '@/plugins/request.js';
import storage from '@/plugins/storage';
export default {
components: { Camera, Delete, View },
@@ -92,7 +92,7 @@ export default {
descriptionScore: 5
}, // 表单
visible: false, // 图片预览
action: commonUrl + '/common/common/upload/file', // 上传地址
action: buyerUrl + '/buyer/common/upload/file', // 上传地址
accessToken: {}, // 验证token
previewImage: '', // 预览图片地址
loading: false // 提交加载状态

View File

@@ -104,7 +104,7 @@
<script>
import { Camera, Delete, View } from '@element-plus/icons-vue';
import { afterSaleReason, afterSaleInfo, applyAfterSale } from '@/api/member.js'
import { commonUrl } from '@/plugins/request.js';
import { buyerUrl } from '@/plugins/request.js';
import storage from '@/plugins/storage';
import * as RegExp from '@/plugins/RegExp'
export default {
@@ -131,7 +131,7 @@ export default {
num: 1
},
uploadList: [], // 上传列表
action: commonUrl + '/common/common/upload/file', // 上传地址
action: buyerUrl + '/buyer/common/upload/file', // 上传地址
accessToken: {}, // 验证token
visible: false, // 图片预览
previewImage: '', // 预览图片url

View File

@@ -65,7 +65,7 @@
import { Camera, Delete, View } from '@element-plus/icons-vue';
import { orderDetail } from '@/api/order.js';
import { afterSaleReason, handleComplain } from '@/api/member.js';
import { commonUrl } from '@/plugins/request.js';
import { buyerUrl } from '@/plugins/request.js';
import storage from '@/plugins/storage';
export default {
components: { Camera, Delete, View },
@@ -78,7 +78,7 @@ export default {
content: ''
}, // 表单
visible: false, // 图片预览
action: commonUrl + '/common/common/upload/file', // 上传地址
action: buyerUrl + '/buyer/common/upload/file', // 上传地址
accessToken: {}, // 验证token
previewImage: '', // 图片地址
loading: false, // 加载状态

View File

@@ -196,7 +196,7 @@ import { applyFirst } from '@/api/shopentry';
import * as RegExp from '@/plugins/RegExp.js';
import multipleMap from "@/components/map/multiple-map";
import storage from '@/plugins/storage';
import { commonUrl } from '@/plugins/request.js';
import { buyerUrl } from '@/plugins/request.js';
const FIRST_APPLY_DRAFT_KEY = 'shopEntryFirstDraft';
export default {
@@ -210,7 +210,7 @@ export default {
},
data () {
return {
action: commonUrl + '/common/common/upload/file', // 上传地址
action: buyerUrl + '/buyer/common/upload/file', // 上传地址
accessToken: {}, // 验证token
visible: false, // 预览图片
loading: false, // 加载状态

View File

@@ -98,7 +98,7 @@ import { applyThird } from '@/api/shopentry';
import { getCategory } from '@/api/goods';
import storage from '@/plugins/storage';
import { commonUrl } from '@/plugins/request.js';
import { buyerUrl } from '@/plugins/request.js';
import multipleMap from "@/components/map/multiple-map";
@@ -117,7 +117,7 @@ export default {
return {
loading: false, // 加载状态
uploadLoading: false, // 上传加载状态
action: commonUrl + '/common/common/upload/file', // 上传地址
action: buyerUrl + '/buyer/common/upload/file', // 上传地址
accessToken: {}, // 验证token
previewPicture: '', // 预览图片

View File

@@ -13,18 +13,6 @@ export const buyerUrl =
process.env.NODE_ENV === "development"
? BASE.API_DEV.buyer
: BASE.API_PROD.buyer;
export const commonUrl =
process.env.NODE_ENV === "development"
? BASE.API_DEV.common
: BASE.API_PROD.common;
export const managerUrl =
process.env.NODE_ENV === "development"
? BASE.API_DEV.manager
: BASE.API_PROD.manager;
export const sellerUrl =
process.env.NODE_ENV === "development"
? BASE.API_DEV.seller
: BASE.API_PROD.seller;
let isRefreshToken = 0;
const refreshToken = getTokenDebounce();

View File

@@ -86,7 +86,7 @@ export async function fetchAndApplyTheme(requestFn) {
}
} catch (error) {
console.warn(
"[theme] 主题色加载失败,请确认 common-api(8890) 已启动且已执行 version4.9to4.10.sql",
"[theme] 主题色加载失败,请确认 buyer-api 已启动且站点主题配置可用",
error
);
}