|
|
@@ -23,6 +23,11 @@ const props = defineProps({
|
|
|
textColor: {
|
|
|
type: String,
|
|
|
default: '#97A1C0'
|
|
|
+ },
|
|
|
+ // 事件来源标识,用于区分不同组件的事件监听
|
|
|
+ eventSource: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
}
|
|
|
})
|
|
|
|
|
|
@@ -87,7 +92,11 @@ const applySystemList = (data: any[]) => {
|
|
|
|
|
|
async function getSystemList(type = false) {
|
|
|
const cached = getCache()
|
|
|
- console.log(1)
|
|
|
+ console.log('system',type,props.form)
|
|
|
+ // top-window组件中,没有token不去请求接口
|
|
|
+ if (props.eventSource === 'top') {
|
|
|
+ if (!userToken.value) return
|
|
|
+ }
|
|
|
if (!type){
|
|
|
if (cached && cached.timestamp && Date.now() - cached.timestamp < CACHE_DURATION) {
|
|
|
applySystemList(cached.data || [])
|
|
|
@@ -95,7 +104,7 @@ async function getSystemList(type = false) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- console.log('qingqiule')
|
|
|
+ // console.log('qingqiule')
|
|
|
try {
|
|
|
const res: any = await customApi.getSystemList({})
|
|
|
if (res && res.code === Code.StatusOK) {
|
|
|
@@ -167,7 +176,10 @@ onMounted(() => {
|
|
|
|
|
|
getSystemList()
|
|
|
|
|
|
- uni.$on('updateSystemList', () => {
|
|
|
+ uni.$on('updateSystemList', (source) => {
|
|
|
+ // console.log(source)
|
|
|
+ // 如果指定了事件来源,只处理来自该来源的事件
|
|
|
+ if (props.eventSource && source !== props.eventSource) return
|
|
|
getSystemList(true)
|
|
|
})
|
|
|
})
|
|
|
@@ -192,7 +204,7 @@ onUnmounted(() => {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
cursor: pointer;
|
|
|
- width: 80px;
|
|
|
+ width: px2rpx(80);
|
|
|
gap: px2rpx(4);
|
|
|
}
|
|
|
|