修改接口 默认应用问题

This commit is contained in:
joker 2025-08-27 21:16:28 +08:00
parent 25664afcd6
commit 49b2280732
5 changed files with 19 additions and 18 deletions

View File

@ -6,7 +6,7 @@ import { request } from '@/utils/request'
export const getSettingApi = () => { export const getSettingApi = () => {
return request<settingItem>({ return request<settingItem>({
method: 'GET', method: 'GET',
url: '/common/setting', url: '/shop/common/setting',
}) })
} }
@ -20,7 +20,7 @@ export const uploadApi = (filePath: string): Promise<AnyObject> => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.uploadFile({ uni.uploadFile({
url: `shop/common/upload?driver=${uploadSetting.mode}`, url: `/shop/common/upload?driver=${uploadSetting.mode}`,
filePath, filePath,
name: 'file', name: 'file',
success: (res) => { success: (res) => {

View File

@ -11,7 +11,7 @@ import { request } from '@/utils/request'
export const getGoodsListApi = (data?: PageParams & goodsListParams) => { export const getGoodsListApi = (data?: PageParams & goodsListParams) => {
return request<PageResult<goodsListItem>>({ return request<PageResult<goodsListItem>>({
method: 'GET', method: 'GET',
url: 'shop/goods', url: '/shop/goods',
data, data,
}) })
} }
@ -19,7 +19,7 @@ export const getGoodsListApi = (data?: PageParams & goodsListParams) => {
export const getGoodsByIdApi = (id: number) => { export const getGoodsByIdApi = (id: number) => {
return request<goodsResult>({ return request<goodsResult>({
method: 'GET', method: 'GET',
url: 'shop/goods/detail', url: '/shop/goods/detail',
data: { data: {
id, id,
}, },
@ -29,7 +29,7 @@ export const getGoodsByIdApi = (id: number) => {
export const getGoodsServiceApi = (service_ids: string) => { export const getGoodsServiceApi = (service_ids: string) => {
return request<goodsServiceItem[]>({ return request<goodsServiceItem[]>({
method: 'GET', method: 'GET',
url: 'shop/goods/service', url: '/shop/goods/service',
data: { data: {
service_ids, service_ids,
}, },
@ -39,7 +39,7 @@ export const getGoodsServiceApi = (service_ids: string) => {
export const getShareInfoApi = (id: number) => { export const getShareInfoApi = (id: number) => {
return request<goodsShareResult>({ return request<goodsShareResult>({
method: 'GET', method: 'GET',
url: 'shop/goods/share', url: '/shop/goods/share',
data: { data: {
id, id,
}, },

View File

@ -9,7 +9,7 @@ import { request } from '@/utils/request'
export const getBannerApi = (type: number = 1) => { export const getBannerApi = (type: number = 1) => {
return request<bannerItem[]>({ return request<bannerItem[]>({
method: 'GET', method: 'GET',
url: 'shop/advert/banner', url: '/shop/advert/banner',
data: { data: {
type, type,
}, },
@ -24,7 +24,7 @@ export const getBannerApi = (type: number = 1) => {
export const getGoodsListApi = (data?: PageParams) => { export const getGoodsListApi = (data?: PageParams) => {
return request<PageResult<goodsListItem>>({ return request<PageResult<goodsListItem>>({
method: 'GET', method: 'GET',
url: 'shop/goods', url: '/shop/goods',
data, data,
}) })
} }
@ -37,13 +37,13 @@ export const getGoodsListApi = (data?: PageParams) => {
export const getNoticeBartApi = () => { export const getNoticeBartApi = () => {
return request<noticeBarItem[]>({ return request<noticeBarItem[]>({
method: 'GET', method: 'GET',
url: 'shop/advert/noticeBar', url: '/shop/advert/noticeBar',
}) })
} }
export const getHotRecommendApi = () => { export const getHotRecommendApi = () => {
return request<hotRecommendItem[]>({ return request<hotRecommendItem[]>({
method: 'GET', method: 'GET',
url: 'shop/advert/hotRecommend', url: '/shop/advert/hotRecommend',
}) })
} }

View File

@ -5,10 +5,10 @@ const url = ref('')
if (isDev) { if (isDev) {
// dev模式请求域名 // dev模式请求域名
url.value = 'http://api-test.haibao.shop' url.value = 'https://apis.haibao.shop'
} else { } else {
// build模式请求域名 // build模式请求域名
url.value = 'http://api.haibao.shop' url.value = 'https://api.haibao.shop'
} }
/** /**

View File

@ -12,11 +12,12 @@ const Interceptor = {
//拼接请求地址 //拼接请求地址
if (!/^https?:\/\//.test(options.url)) { if (!/^https?:\/\//.test(options.url)) {
// /api是系统保留的接口不代理 // /api是系统保留的接口不代理
if (options.url.startsWith('/api')) { // if (options.url.startsWith('/api')) {
options.url = apiUrl + options.url // options.url = apiUrl + options.url
} else { // } else {
options.url = apiUrl + apiName + options.url // options.url = apiUrl + apiName + options.url
} // }
options.url = apiUrl +'/'+ options.url
} }
//请求超时 10s //请求超时 10s
options.timeout = 10000 options.timeout = 10000
@ -63,7 +64,7 @@ const loginFail = (res: any) => {
useMemberStore().clearProfile() useMemberStore().clearProfile()
uni.showModal({ uni.showModal({
title: '温馨提示', title: '温馨提示',
content: '登录解锁更多精彩,是否继续?', content: '登录体验保税,是否继续?',
confirmText: '去登录', confirmText: '去登录',
cancelText: '再看看', cancelText: '再看看',
success: function (res) { success: function (res) {