refactor: 统一接口调用为单前缀写法,去除 19 处页面内写死的 /mp-api(API_BASE 已含),并新增 check:api-prefix 防回归脚本

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
jacobxu666
2026-09-04 16:58:01 +08:00
co-authored by Claude Fable 5
parent 6e88f6b09d
commit bba2571f25
15 changed files with 30 additions and 20 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ const loading = ref(true)
onMounted(async () => {
try {
const data = await post<BannerItem[]>('/mp-api/mpContent/queryList', { channel: 'pingxiang', type: 'FAQ' })
const data = await post<BannerItem[]>('/mpContent/queryList', { channel: 'pingxiang', type: 'FAQ' })
faqList.value = (data || []).map(n => ({
id: n.id,
title: n.title,
+1 -1
View File
@@ -41,7 +41,7 @@ const notices = ref<NoticeItem[]>([])
onMounted(async () => {
try {
const data = await post<BannerItem[]>('/mp-api/mpContent/queryList', { channel: 'pingxiang', type: 'NOTICE' })
const data = await post<BannerItem[]>('/mpContent/queryList', { channel: 'pingxiang', type: 'NOTICE' })
notices.value = (data || []).map(n => ({
id: n.id,
title: n.title,
+2 -2
View File
@@ -243,7 +243,7 @@ onLoad((options) => {
async function fetchShopNotice(shopId: string) {
try {
const res = await post<any>('/mp-api/mpShopNotice/queryShopNoticePage', {
const res = await post<any>('/mpShopNotice/queryShopNoticePage', {
shopId,
pageNo: 1,
pageSize: 5,
@@ -265,7 +265,7 @@ async function fetchDetail(shopId: string) {
const phone = uni.getStorageSync('phone') as string
if (phone) params.phone = phone
const res = await post<any>('/mp-api/mpScenic/getScenicDetail', params)
const res = await post<any>('/mpScenic/getScenicDetail', params)
if (res) {
scenic.value = {
id: res.id || res.scenicId || shopId,
+2 -2
View File
@@ -294,7 +294,7 @@ async function fetchScenicList(resetPage = true) {
phone: uni.getStorageSync('phone') || '',
}
const res = await post<any>('/mp-api/mpScenic/queryScenicList', params)
const res = await post<any>('/mpScenic/queryScenicList', params)
const list = res?.list || res?.rows || res?.records || res || []
const totalCount = res?.total || res?.totalCount || 0
total.value = totalCount
@@ -344,7 +344,7 @@ onLoad((query: any) => {
})
onMounted(async () => {
const filterRes = await post<any>('/mp-api/mpScenic/queryFilterOptions', { channel: 'pingxiang' }).catch(() => null)
const filterRes = await post<any>('/mpScenic/queryFilterOptions', { channel: 'pingxiang' }).catch(() => null)
if (filterRes) {
const levels = filterRes.levels || filterRes.levelList || []
+1 -1
View File
@@ -17,7 +17,7 @@ const loading = ref(true)
onMounted(async () => {
try {
const data = await post<BannerItem[]>('/mp-api/mpContent/queryList', { channel: 'pingxiang', type: 'GUIDE' })
const data = await post<BannerItem[]>('/mpContent/queryList', { channel: 'pingxiang', type: 'GUIDE' })
if (data && data.length > 0) {
imageUrl.value = data[0].imageUrl || ''
}
+2 -2
View File
@@ -82,7 +82,7 @@ export async function queryVoucherList(params: QueryVoucherListParams): Promise<
await delay(300)
return MOCK_VOUCHERS.map((v) => ({ ...v, mobile: params.mobile }))
}
return post<VoucherItem[]>('/mp-api/douyin/voucherList', params)
return post<VoucherItem[]>('/douyin/voucherList', params)
}
/**
@@ -94,5 +94,5 @@ export async function activateAndBind(params: ActivateAndBindParams): Promise<vo
await delay(800)
return
}
await post<null>('/mp-api/douyin/activateAndBind', params)
await post<null>('/douyin/activateAndBind', params)
}
+1 -1
View File
@@ -85,7 +85,7 @@ const noticeHtml = computed(() => fixRichHtml(noticeContent.value))
/** 获取购卡须知富文本(type = CARD_PURCHASE_NOTICE) */
async function fetchPurchaseNotice() {
try {
const res = await post<BannerItem[]>('/mp-api/mpContent/queryList', {
const res = await post<BannerItem[]>('/mpContent/queryList', {
channel: 'pingxiang',
type: 'CARD_PURCHASE_NOTICE',
})
+1 -1
View File
@@ -23,7 +23,7 @@ const loading = ref(true)
onMounted(async () => {
try {
const list = await post<any[]>('/mp-api/mpContent/queryList', { channel: 'pingxiang', type: 'CARD_NOTICE' })
const list = await post<any[]>('/mpContent/queryList', { channel: 'pingxiang', type: 'CARD_NOTICE' })
content.value = list?.[0]?.content || ''
} catch {
showToast('加载失败')
+1 -1
View File
@@ -310,7 +310,7 @@ const noticeHtml = computed(() => fixRichHtml(noticeContent.value))
/** 获取购卡须知富文本(type = CARD_PURCHASE_NOTICE) */
async function fetchPurchaseNotice() {
try {
const res = await post<BannerItem[]>('/mp-api/mpContent/queryList', {
const res = await post<BannerItem[]>('/mpContent/queryList', {
channel: 'pingxiang',
type: 'CARD_PURCHASE_NOTICE',
})