hookehuyr

fix: 移除重复的错误提示并优化API错误处理

移除提交、核销和删除操作中的重复错误提示
优化API错误处理逻辑,统一使用fn.js中的错误提示
1 /* 1 /*
2 * @Date: 2022-05-18 22:56:08 2 * @Date: 2022-05-18 22:56:08
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2026-01-06 20:56:55 4 + * @LastEditTime: 2026-01-16 15:51:34
5 - * @FilePath: /git/xyxBooking-weapp/src/api/fn.js 5 + * @FilePath: /xyxBooking-weapp/src/api/fn.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
8 import axios from '@/utils/request'; 8 import axios from '@/utils/request';
...@@ -18,11 +18,11 @@ export const fn = (api) => { ...@@ -18,11 +18,11 @@ export const fn = (api) => {
18 return api 18 return api
19 .then(res => { 19 .then(res => {
20 // 适配 H5 逻辑,code === 1 为成功 20 // 适配 H5 逻辑,code === 1 为成功
21 - if (res.data.code === 1) { 21 + if (res.data.code == 1) {
22 return res.data || true; 22 return res.data || true;
23 } else { 23 } else {
24 // tslint:disable-next-line: no-console 24 // tslint:disable-next-line: no-console
25 - console.warn(res); 25 + console.warn('API Error:', res);
26 if (res.data.show === false) return false; 26 if (res.data.show === false) return false;
27 Taro.showToast({ 27 Taro.showToast({
28 title: res.data.msg || '请求失败', 28 title: res.data.msg || '请求失败',
......
1 <!-- 1 <!--
2 * @Date: 2024-01-15 16:25:51 2 * @Date: 2024-01-15 16:25:51
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2026-01-16 15:12:09 4 + * @LastEditTime: 2026-01-16 16:13:44
5 * @FilePath: /xyxBooking-weapp/src/pages/submit/index.vue 5 * @FilePath: /xyxBooking-weapp/src/pages/submit/index.vue
6 * @Description: 预约人员信息 6 * @Description: 预约人员信息
7 --> 7 -->
...@@ -145,7 +145,6 @@ const submitBtn = async () => { ...@@ -145,7 +145,6 @@ const submitBtn = async () => {
145 Taro.hideLoading(); 145 Taro.hideLoading();
146 146
147 if (!code || code !== 1) { 147 if (!code || code !== 1) {
148 - Taro.showToast({ title: msg || '提交失败', icon: 'none' });
149 return; 148 return;
150 } 149 }
151 pay_id = data.pay_id; 150 pay_id = data.pay_id;
......
1 <!-- 1 <!--
2 * @Date: 2026-01-08 13:01:20 2 * @Date: 2026-01-08 13:01:20
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2026-01-15 16:49:25 4 + * @LastEditTime: 2026-01-16 16:14:06
5 * @FilePath: /xyxBooking-weapp/src/pages/verificationResult/index.vue 5 * @FilePath: /xyxBooking-weapp/src/pages/verificationResult/index.vue
6 * @Description: 核销结果页面 6 * @Description: 核销结果页面
7 --> 7 -->
...@@ -110,7 +110,6 @@ const verify_ticket = async (code) => { ...@@ -110,7 +110,6 @@ const verify_ticket = async (code) => {
110 } 110 }
111 verify_status.value = 'fail' 111 verify_status.value = 'fail'
112 msg.value = res?.msg || '核销失败' 112 msg.value = res?.msg || '核销失败'
113 - Taro.showToast({ title: msg.value, icon: 'none' })
114 } catch (e) { 113 } catch (e) {
115 verify_status.value = 'fail' 114 verify_status.value = 'fail'
116 msg.value = '核销失败' 115 msg.value = '核销失败'
......
...@@ -93,12 +93,10 @@ const removeItem = async (item) => { ...@@ -93,12 +93,10 @@ const removeItem = async (item) => {
93 const { confirm } = await Taro.showModal({ title: '提示', content: '确定删除该参观者吗?' }); 93 const { confirm } = await Taro.showModal({ title: '提示', content: '确定删除该参观者吗?' });
94 if (confirm) { 94 if (confirm) {
95 try { 95 try {
96 - const { code, msg } = await delPersonAPI({ person_id: item.id }); 96 + const res = await delPersonAPI({ person_id: item.id });
97 - if (code) { 97 + if (res && res.code) {
98 Taro.showToast({ title: '删除成功' }); 98 Taro.showToast({ title: '删除成功' });
99 loadList(); 99 loadList();
100 - } else {
101 - Taro.showToast({ title: msg || '删除失败', icon: 'none' });
102 } 100 }
103 } catch (error) { 101 } catch (error) {
104 console.error(error); 102 console.error(error);
......