feat: 联调对话功能

This commit is contained in:
王天骄
2026-06-09 17:00:23 +08:00
parent 3414d0662c
commit 2192b855a1
77 changed files with 1082 additions and 487 deletions
+34
View File
@@ -1,6 +1,8 @@
import { getCurrentInstance } from 'vue'
type OpenProfileEmit = (event: 'open-profile') => void
type OpenSettingsEmit = (event: 'open-settings') => void
type GoHomeEmit = (event: 'go-home') => void
export function createProfileOpener(emit: OpenProfileEmit) {
const instance = getCurrentInstance()
@@ -17,3 +19,35 @@ export function createProfileOpener(emit: OpenProfileEmit) {
})
}
}
export function createSettingsOpener(emit: OpenSettingsEmit) {
const instance = getCurrentInstance()
const hasOpenSettingsListener = Boolean(instance?.vnode.props?.onOpenSettings)
return function openSettings() {
if (hasOpenSettingsListener) {
emit('open-settings')
return
}
uni.navigateTo({
url: '/pages/config/config'
})
}
}
export function createHomeNavigator(emit: GoHomeEmit) {
const instance = getCurrentInstance()
const hasGoHomeListener = Boolean(instance?.vnode.props?.onGoHome)
return function goHome() {
if (hasGoHomeListener) {
emit('go-home')
return
}
uni.reLaunch({
url: '/pages/home/home'
})
}
}