更新:loading加载时机问题

This commit is contained in:
2025-11-28 16:16:22 +08:00
parent 8edf719431
commit 3d20683d76
4 changed files with 160 additions and 156 deletions

View File

@@ -6,6 +6,8 @@ import { createRequestClient } from '../request';
import { SERVICE_MAP } from '../config';
export const paymentClient = createRequestClient({
baseURL: SERVICE_MAP.PAYMENT,
baseURL: SERVICE_MAP.MAIN,
// baseURL: SERVICE_MAP.PAYMENT,
loading: false
});

View File

@@ -1,5 +1,6 @@
// api/modules/user.ts
import { mainClient } from '@/api/clients/main'
import { paymentClient } from '@/api/clients/payment'
import type { IApiResponse } from '@/api/types'
import type {
IUserInfo,
@@ -196,7 +197,7 @@ export async function submitFeedback(data: IFeedbackForm) {
*/
export async function verifyGooglePay(productId: number, purchaseToken: string, orderSn: string) {
console.log(productId, purchaseToken, orderSn);
const res = await mainClient.request<IApiResponse>({
const res = await paymentClient.request<IApiResponse>({
url: 'pay/googlepay/googleVerify',
method: 'POST',
data: { productId, purchaseToken, orderSn }
@@ -278,7 +279,7 @@ export async function getTransactionDetailsList(current : number, limit : number
*/
export async function getPlaceOrder(data: object) {
const res = await mainClient.request<IApiResponse>({
const res = await paymentClient.request<IApiResponse>({
url: '/book/buyOrder/placeOrder',
method: 'POST',
data: data

View File

@@ -23,7 +23,7 @@ export function createRequestClient(cfg: ICreateClientConfig) {
const intercepted = requestInterceptor(final as IRequestOptions);
// 全局处理请求 loading
const loading = !cfg.loading ? true : cfg.loading // 接口请求参数不传loading默认显示loading
const loading = cfg.loading ?? true // 接口请求参数不传loading默认显示loading
if (loading) {
uni.showLoading({ mask: true })
reqCount++