Commit 79d16dac by 李伟康

refactor(api): 优化错误处理和数据请求逻辑

- 移除了多余的 console.log 语句
- 优化了错误处理流程,提高了代码的健壮性
- 调整了数据请求逻辑,提高了代码的可读性和维护性
1 parent 5df5f0c1
...@@ -44,7 +44,6 @@ const getMockData = async (immediate = false) => { ...@@ -44,7 +44,6 @@ const getMockData = async (immediate = false) => {
} }
} }
} catch (error) { } catch (error) {
console.log(error)
if (serverConfig.mockTimer[key]) clearInterval(serverConfig.mockTimer[key]) if (serverConfig.mockTimer[key]) clearInterval(serverConfig.mockTimer[key])
serverConfig.mockRequestCount = null serverConfig.mockRequestCount = null
return Promise.reject(error) return Promise.reject(error)
...@@ -111,7 +110,6 @@ const getBoutiqueMockData = async (immediate = false) => { ...@@ -111,7 +110,6 @@ const getBoutiqueMockData = async (immediate = false) => {
} }
} }
} catch (error) { } catch (error) {
console.log(error)
if (boutiqueServerConfig.mockTimer[key]) clearInterval(boutiqueServerConfig.mockTimer[key]) if (boutiqueServerConfig.mockTimer[key]) clearInterval(boutiqueServerConfig.mockTimer[key])
boutiqueServerConfig.mockRequestCount = null boutiqueServerConfig.mockRequestCount = null
return Promise.reject(error) return Promise.reject(error)
...@@ -179,11 +177,11 @@ const getSoureData = async (shopMerchantId, sceneType, params = {}) => { ...@@ -179,11 +177,11 @@ const getSoureData = async (shopMerchantId, sceneType, params = {}) => {
id: res.id id: res.id
}) })
return Promise.resolve(data) return Promise.resolve(data)
} } else throw false
} } else throw false
} catch (error) { } catch (error) {
console.log(error) uni.hideLoading()
uni.showToast({ if (error) uni.showToast({
title: error, title: error,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
......
...@@ -99,9 +99,10 @@ export default { ...@@ -99,9 +99,10 @@ export default {
methods: { methods: {
getServerData () { getServerData () {
let { dataShow, tabIndex, pageData, sceneType, isHarmony, bussinessType } = this let { dataShow, tabIndex, pageData, sceneType, isHarmony, bussinessType } = this
/** /**
* (sceneType 0: 2.1场景, 1:1.1场景) (bussinessType 1:延保, 3:权益)
* 2.1场景 鸿蒙---问界/鸿蒙 [本月交付客单价] 改成 [整车延保成交数] * 2.1场景 鸿蒙---问界/鸿蒙 [本月交付客单价] 改成 [整车延保成交数]
* 2.1场景 非鸿蒙---选延保 [本月交付客单价] 改成 [整车延保成交数] (bussinessType 1:延保 3:权益) * 2.1场景 非鸿蒙---选延保 [本月交付客单价] 改成 [整车延保成交数]
* 2.1场景 非鸿蒙---权益 [本月交付成交率] 改为 [广联权益渗透率]; [本月交付客单价] 改成 [广联权益成交数] * 2.1场景 非鸿蒙---权益 [本月交付成交率] 改为 [广联权益渗透率]; [本月交付客单价] 改成 [广联权益成交数]
*/ */
if (sceneType == 0) { if (sceneType == 0) {
......
...@@ -156,6 +156,7 @@ export default { ...@@ -156,6 +156,7 @@ export default {
subBrandIdList subBrandIdList
}) })
if (requestData) this.setViewInfo(requestData) if (requestData) this.setViewInfo(requestData)
else this.loadComplete = true
}, },
errorImg (index) { errorImg (index) {
this.moduleList[index].showAlt = true this.moduleList[index].showAlt = true
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!