Merge branch 'master' of github.com:gcpaas/DataRoom

main
liu.tao3 2 years ago
commit 7de0f23d4d

@ -112,6 +112,7 @@ import linkageMixins from 'data-room-ui/js/mixins/linkageMixins'
import { settingToTheme } from 'data-room-ui/js/utils/themeFormatting' import { settingToTheme } from 'data-room-ui/js/utils/themeFormatting'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
import IconSvg from 'data-room-ui/SvgIcon' import IconSvg from 'data-room-ui/SvgIcon'
import { get } from 'sortablejs'
export default { export default {
name: 'Marquee', name: 'Marquee',
props: { props: {
@ -127,6 +128,7 @@ export default {
data () { data () {
return { return {
showVoiceSwitch: false, showVoiceSwitch: false,
visibilityState: false,
voiceSwitchValue: true, voiceSwitchValue: true,
customClass: {}, customClass: {},
attributeName: { attributeName: {
@ -159,6 +161,7 @@ export default {
// //
speech: null, speech: null,
isInit: false, isInit: false,
firstSpeech: true,
numberBroadcasts: 0 numberBroadcasts: 0
} }
}, },
@ -167,16 +170,19 @@ export default {
speechText () { speechText () {
return this.config.customize.title || '' return this.config.customize.title || ''
}, },
isPreview () { audioSrc: {
return (this.$route.path === window?.BS_CONFIG?.routers?.previewUrl) || (this.$route.path === '/big-screen/preview') get () {
}, return this.config?.option?.data?.[this.config?.dataSource?.metricField] || ''
audioSrc () { },
return this.config?.option?.data?.[this.config?.dataSource?.metricField] || '' set (val) {
this.config.option.data[this.config.dataSource.metricField] = val
}
} }
}, },
watch: { watch: {
speechText (val) { speechText (val) {
if (!this.isPreview && this.config.customize.voiceBroadcast && !this.isInit) { if (!this.isPreview && this.config.customize.voiceBroadcast && !this.isInit && !this.firstSpeech) {
console.log(4)
this.speechBroadcast(val) this.speechBroadcast(val)
} else { } else {
if (this.speech) { if (this.speech) {
@ -236,6 +242,7 @@ export default {
this.audio.play() this.audio.play()
} else { } else {
this.speech = null this.speech = null
console.log(1)
this.speechBroadcast(this.config.customize.title) this.speechBroadcast(this.config.customize.title)
this.isInit = false this.isInit = false
} }
@ -271,7 +278,8 @@ export default {
config.option.data = [] config.option.data = []
} }
// visibilitychange // visibilitychange
if (this.voiceSwitchValue) { if (this.voiceSwitchValue && !this.visibilityState && this.isInit) {
console.log(6)
this.voiceBroadcast(config) this.voiceBroadcast(config)
} }
return config return config
@ -294,6 +302,7 @@ export default {
} else if (config.customize.title) { } else if (config.customize.title) {
// //
if (!this.isInit) { if (!this.isInit) {
console.log(2)
this.speechBroadcast(config.customize.title) this.speechBroadcast(config.customize.title)
} }
} }
@ -326,9 +335,13 @@ export default {
}, },
changeStyle (config) { changeStyle (config) {
config = { ...this.config, ...config } config = { ...this.config, ...config }
if (config.customize.voiceBroadcast && this.isInit && !this.audioSrc) { if (config.customize.voiceBroadcast && this.isInit && !config?.option?.data?.[this.config?.dataSource?.metricField]) {
this.isInit = false this.isInit = false
console.log(3)
this.speechBroadcast(config.customize.title) this.speechBroadcast(config.customize.title)
this.$nextTick(() => {
this.firstSpeech = false
})
} }
// //
config.theme = settingToTheme(cloneDeep(config), this.customTheme) config.theme = settingToTheme(cloneDeep(config), this.customTheme)
@ -340,6 +353,7 @@ export default {
// //
handleVisibilityChange () { handleVisibilityChange () {
if (document.visibilityState === 'hidden') { if (document.visibilityState === 'hidden') {
this.visibilityState = true
if (this.audio) { if (this.audio) {
this.audio.pause() this.audio.pause()
} }
@ -347,6 +361,7 @@ export default {
this.speech = null this.speech = null
} }
} else { } else {
this.visibilityState = false
if (this.audio) { if (this.audio) {
this.audio.play() this.audio.play()
} }

@ -57,7 +57,6 @@ export default {
}, },
computed: {}, computed: {},
mounted () { mounted () {
console.log(this.$refs)
// //
dataInit(this) dataInit(this)
}, },

Loading…
Cancel
Save