Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-boutique-work-wechat
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 90f4d11b
authored
Jun 16, 2026
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat tabmine组件修复
1 parent
9c2add61
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
48 deletions
components/TabMine/TabMine.js
config.js
packageEquity/services/tabRefreshService.js
packageEquity/tests/tabRefreshService.test.mjs
utils/tabRefreshService.js
components/TabMine/TabMine.js
View file @
90f4d11
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
import
api
from
'~/pages/tabMine/api'
import
api
from
'~/pages/tabMine/api'
const
app
=
getApp
()
const
app
=
getApp
()
import
constantData
from
'../../pages/constant/data'
import
constantData
from
'../../pages/constant/data'
import
{
withTabRefreshInFlight
}
from
'
../../packageEquity/service
s/tabRefreshService.js'
import
{
withTabRefreshInFlight
}
from
'
~/util
s/tabRefreshService.js'
const
IMG_URL
=
'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/mine/'
const
IMG_URL
=
'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/mine/'
Component
({
Component
({
/**
/**
...
...
config.js
View file @
90f4d11
...
@@ -18,12 +18,12 @@ export const appId = "wx570d9331f9ace0bd";
...
@@ -18,12 +18,12 @@ export const appId = "wx570d9331f9ace0bd";
* 4预发布
* 4预发布
* 5cdptest
* 5cdptest
*/
*/
let
index
=
3
;
let
index
=
2
;
const
accountInfo
=
wx
.
getAccountInfoSync
();
const
accountInfo
=
wx
.
getAccountInfoSync
();
const
systemInfo
=
wx
.
getSystemInfoSync
();
const
systemInfo
=
wx
.
getSystemInfoSync
();
const
envName
=
accountInfo
.
miniProgram
.
envVersion
;
const
envName
=
accountInfo
.
miniProgram
.
envVersion
;
//手动控制体验版环境的请求 true就依据下面index false就默认2
//手动控制体验版环境的请求 true就依据下面index false就默认2
const
manual
=
tru
e
;
const
manual
=
fals
e
;
const
release
=
false
;
const
release
=
false
;
// 判断小程序环境
// 判断小程序环境
...
...
packageEquity/services/tabRefreshService.js
View file @
90f4d11
/**
export
{
withTabRefreshInFlight
,
clearTabRefreshState
}
from
'../../utils/tabRefreshService.js'
* 权益 Tab 子页(Tab1–4)刷新 in-flight 合并。
*
* 设计原则:
* - **每次** `show=true` 都会执行刷新(与 Tab0 对齐)
* - 仅合并同一 key 下同一 tick 的并发调用(如 observer + 其它入口叠加)
* - **不做 TTL**,切走再切回应重新请求
*
* @module packageEquity/services/tabRefreshService
*/
/** @type {Map<string, Promise<void>>} key → 进行中的刷新 */
const
inFlightByKey
=
new
Map
()
/**
* 清空单测/调试用的 in-flight 状态。
*/
export
function
clearTabRefreshState
()
{
inFlightByKey
.
clear
()
}
/**
* 在 in-flight 去重下执行子 Tab 刷新。
*
* @param {'quotation'|'equityList'|'materials'|'mine'} key - Tab 业务隔离键
* @param {() => Promise<void>|void} fn - 实际刷新函数(如 refreshQuotationTab)
* @returns {Promise<void>}
*/
export
async
function
withTabRefreshInFlight
(
key
,
fn
)
{
if
(
inFlightByKey
.
has
(
key
))
{
return
inFlightByKey
.
get
(
key
)
}
const
promise
=
Promise
.
resolve
()
.
then
(
fn
)
.
finally
(()
=>
{
if
(
inFlightByKey
.
get
(
key
)
===
promise
)
{
inFlightByKey
.
delete
(
key
)
}
})
inFlightByKey
.
set
(
key
,
promise
)
return
promise
}
packageEquity/tests/tabRefreshService.test.mjs
View file @
90f4d11
...
@@ -3,7 +3,7 @@ import assert from 'node:assert/strict'
...
@@ -3,7 +3,7 @@ import assert from 'node:assert/strict'
import {
import {
withTabRefreshInFlight,
withTabRefreshInFlight,
clearTabRefreshState
clearTabRefreshState
} from '../
service
s/tabRefreshService.js'
} from '../
../util
s/tabRefreshService.js'
describe('tabRefreshService', () => {
describe('tabRefreshService', () => {
beforeEach(() => {
beforeEach(() => {
...
...
utils/tabRefreshService.js
0 → 100644
View file @
90f4d11
/**
* Tab 子页刷新 in-flight 合并(主包共享,供各场景 TabBar 子页使用)。
*
* 设计原则:
* - **每次** `show=true` 都会执行刷新(与 Tab0 对齐)
* - 仅合并同一 key 下同一 tick 的并发调用(如 observer + 其它入口叠加)
* - **不做 TTL**,切走再切回应重新请求
*
* @module utils/tabRefreshService
*/
/** @type {Map<string, Promise<void>>} key → 进行中的刷新 */
const
inFlightByKey
=
new
Map
()
/**
* 清空单测/调试用的 in-flight 状态。
*/
export
function
clearTabRefreshState
()
{
inFlightByKey
.
clear
()
}
/**
* 在 in-flight 去重下执行子 Tab 刷新。
*
* @param {'quotation'|'equityList'|'materials'|'mine'} key - Tab 业务隔离键
* @param {() => Promise<void>|void} fn - 实际刷新函数(如 refreshQuotationTab)
* @returns {Promise<void>}
*/
export
async
function
withTabRefreshInFlight
(
key
,
fn
)
{
if
(
inFlightByKey
.
has
(
key
))
{
return
inFlightByKey
.
get
(
key
)
}
const
promise
=
Promise
.
resolve
()
.
then
(
fn
)
.
finally
(()
=>
{
if
(
inFlightByKey
.
get
(
key
)
===
promise
)
{
inFlightByKey
.
delete
(
key
)
}
})
inFlightByKey
.
set
(
key
,
promise
)
return
promise
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment