优化打开团购券分享时用户已登录&未登录,店铺已注册&未注册逻辑处理

This commit is contained in:
2024-06-14 02:21:35 +08:00
parent 6921c82ad3
commit f83bf3dd98
15 changed files with 175 additions and 53 deletions

View File

@@ -79,11 +79,17 @@ export function goPath(path: string, needAuth: boolean = false) {
}
}
export function goLogin() {
uni.navigateTo({
url: '/pages/common/login/index'
}).then(r => {
});
export function goLogin(reLaunch: boolean = false) {
const path = '/pages/common/login/index';
if(reLaunch) {
uni.reLaunch({
url: path
}).then();
} else {
uni.navigateTo({
url: path
}).then();
}
}
export function formatTimeWithZeroPad(num: number): string {

View File

@@ -33,8 +33,8 @@ export const handlePayResult = (orderId: string | undefined, e: any, { onSuccess
const str = url.split('?')[1];
const resultObj = JSON.parse(str.replaceAll('result=', ''));
getApp().globalData?.logger?.info('pay reuslt : ', orderId, resultObj);
if(resultObj?.is_success === true) {
getApp().globalData?.logger?.info('pay success : ', orderId, resultObj);
if(onSuccess) {
onSuccess(resultObj);
} else {
@@ -46,9 +46,9 @@ export const handlePayResult = (orderId: string | undefined, e: any, { onSuccess
});
}
} else {
getApp().globalData?.logger?.error('pay failure :', resultObj);
getApp().globalData?.logger?.error('pay failure :', orderId, resultObj);
if(onFailure) {
onFailure();
onFailure(resultObj);
} else {
const msg = resultObj?.error_message || '支付失败';
showToast(msg, {

View File

@@ -26,7 +26,7 @@ function requestInterceptors() {
// config.header.contentType = "x-www-form-urlencoded"
}
getApp().globalData?.logger.info('request: ', config);
// getApp().globalData?.logger.info('request: ', config);
return config;
},
(
@@ -53,7 +53,10 @@ function responseInterceptors() {
return data;
}
getApp().globalData?.logger.info('response: ', data);
getApp().globalData?.logger.info(response.config.url, {
'request': response.config,
'response': data
});
// 请求成功则返回结果
if(data.code === 200 || data?.retcode == 0) {