hookehuyr

refactor(config, tabbar): 调整API环境baseURL并优化tabbar回退逻辑

- 更新生产和本地Mock环境的API基础URL为 https://juelin.onwall.cn
- 重构tabbar工具函数,将默认回退导航项改为仅包含首页的项,并更新所有相关引用
...@@ -2,7 +2,7 @@ import { defineStore } from 'pinia' ...@@ -2,7 +2,7 @@ import { defineStore } from 'pinia'
2 import { getTabbarConfigAPI } from '@/api/tabbar' 2 import { getTabbarConfigAPI } from '@/api/tabbar'
3 import { 3 import {
4 getDefaultTabbarItem, 4 getDefaultTabbarItem,
5 - getDefaultTabbarItems, 5 + getHomeOnlyTabbarItems,
6 normalizeTabbarKey, 6 normalizeTabbarKey,
7 normalizeTabbarPayload, 7 normalizeTabbarPayload,
8 } from '@/utils/tabbar' 8 } from '@/utils/tabbar'
...@@ -11,7 +11,7 @@ let tabbarRequestPromise = null ...@@ -11,7 +11,7 @@ let tabbarRequestPromise = null
11 11
12 export const useTabbarStore = defineStore('tabbar', { 12 export const useTabbarStore = defineStore('tabbar', {
13 state: () => ({ 13 state: () => ({
14 - tabItems: getDefaultTabbarItems(), 14 + tabItems: getHomeOnlyTabbarItems(),
15 loaded: false, 15 loaded: false,
16 loading: false, 16 loading: false,
17 }), 17 }),
...@@ -41,11 +41,11 @@ export const useTabbarStore = defineStore('tabbar', { ...@@ -41,11 +41,11 @@ export const useTabbarStore = defineStore('tabbar', {
41 if (response?.code === 1) { 41 if (response?.code === 1) {
42 this.tabItems = normalizeTabbarPayload(response?.data) 42 this.tabItems = normalizeTabbarPayload(response?.data)
43 } else { 43 } else {
44 - this.tabItems = getDefaultTabbarItems() 44 + this.tabItems = getHomeOnlyTabbarItems()
45 } 45 }
46 } catch (error) { 46 } catch (error) {
47 console.error('获取底部导航配置失败:', error) 47 console.error('获取底部导航配置失败:', error)
48 - this.tabItems = getDefaultTabbarItems() 48 + this.tabItems = getHomeOnlyTabbarItems()
49 } finally { 49 } finally {
50 this.loaded = true 50 this.loaded = true
51 this.loading = false 51 this.loading = false
......
...@@ -10,7 +10,7 @@ export const API_ENVIRONMENTS = { ...@@ -10,7 +10,7 @@ export const API_ENVIRONMENTS = {
10 production: { 10 production: {
11 key: 'production', 11 key: 'production',
12 label: '正式环境', 12 label: '正式环境',
13 - baseURL: 'https://oa.onwall.cn', 13 + baseURL: 'https://juelin.onwall.cn',
14 requestDefaultParams: { 14 requestDefaultParams: {
15 f: F, 15 f: F,
16 client_id: CLIENT_ID, 16 client_id: CLIENT_ID,
...@@ -20,7 +20,7 @@ export const API_ENVIRONMENTS = { ...@@ -20,7 +20,7 @@ export const API_ENVIRONMENTS = {
20 mock: { 20 mock: {
21 key: 'mock', 21 key: 'mock',
22 label: '本地 Mock 环境', 22 label: '本地 Mock 环境',
23 - baseURL: 'https://oa.onwall.cn', 23 + baseURL: 'https://juelin.onwall.cn',
24 requestDefaultParams: { 24 requestDefaultParams: {
25 f: F, 25 f: F,
26 client_id: CLIENT_ID, 26 client_id: CLIENT_ID,
......
...@@ -98,6 +98,8 @@ export const getDefaultTabbarItems = () => ( ...@@ -98,6 +98,8 @@ export const getDefaultTabbarItems = () => (
98 .filter(Boolean) 98 .filter(Boolean)
99 ) 99 )
100 100
101 +export const getHomeOnlyTabbarItems = () => [getDefaultTabbarItem('home')]
102 +
101 const buildTabbarPageUrl = (key, webviewUrl, webviewTitle, rawPageUrl = '') => { 103 const buildTabbarPageUrl = (key, webviewUrl, webviewTitle, rawPageUrl = '') => {
102 if (key === 'home') { 104 if (key === 'home') {
103 return rawPageUrl || '/pages/index/index' 105 return rawPageUrl || '/pages/index/index'
...@@ -203,14 +205,14 @@ const normalizeTabbarObjectItems = (rawMap = {}) => { ...@@ -203,14 +205,14 @@ const normalizeTabbarObjectItems = (rawMap = {}) => {
203 205
204 export const normalizeTabbarItems = (rawItems = []) => { 206 export const normalizeTabbarItems = (rawItems = []) => {
205 if (!Array.isArray(rawItems) || !rawItems.length) { 207 if (!Array.isArray(rawItems) || !rawItems.length) {
206 - return getDefaultTabbarItems() 208 + return getHomeOnlyTabbarItems()
207 } 209 }
208 210
209 const normalizedItems = rawItems 211 const normalizedItems = rawItems
210 .map((item) => normalizeTabbarItem(item)) 212 .map((item) => normalizeTabbarItem(item))
211 .filter(Boolean) 213 .filter(Boolean)
212 214
213 - return normalizedItems.length ? normalizedItems : getDefaultTabbarItems() 215 + return normalizedItems.length ? normalizedItems : getHomeOnlyTabbarItems()
214 } 216 }
215 217
216 export const normalizeTabbarPayload = (rawPayload = null) => { 218 export const normalizeTabbarPayload = (rawPayload = null) => {
...@@ -226,5 +228,5 @@ export const normalizeTabbarPayload = (rawPayload = null) => { ...@@ -226,5 +228,5 @@ export const normalizeTabbarPayload = (rawPayload = null) => {
226 const objectPayload = rawPayload?.tab_items || rawPayload?.tabs || rawPayload?.menus || rawPayload 228 const objectPayload = rawPayload?.tab_items || rawPayload?.tabs || rawPayload?.menus || rawPayload
227 const normalizedItems = normalizeTabbarObjectItems(objectPayload) 229 const normalizedItems = normalizeTabbarObjectItems(objectPayload)
228 230
229 - return normalizedItems.length ? normalizedItems : getDefaultTabbarItems() 231 + return normalizedItems.length ? normalizedItems : getHomeOnlyTabbarItems()
230 } 232 }
......