|
@@ -546,6 +546,12 @@ export default {
|
|
document.addEventListener('focusin', this.onFocusIn, {
|
|
document.addEventListener('focusin', this.onFocusIn, {
|
|
passive: true,
|
|
passive: true,
|
|
})
|
|
})
|
|
|
|
+
|
|
|
|
+ this.$eventBus.$on('request-read', (text) => {
|
|
|
|
+ console.log('无障碍组件收到request-read消息:', text);
|
|
|
|
+ this.planToPlayAudio('', text)
|
|
|
|
+ })
|
|
|
|
+
|
|
},
|
|
},
|
|
destroyed() {
|
|
destroyed() {
|
|
window.removeEventListener('storage', this.loadStoredSettings, {
|
|
window.removeEventListener('storage', this.loadStoredSettings, {
|
|
@@ -565,7 +571,7 @@ export default {
|
|
})
|
|
})
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- planToPlayAudio: utils.debounce(function(taskId) {
|
|
|
|
|
|
+ planToPlayAudio: utils.debounce(function(taskId, text = '') {
|
|
let XHR = new XMLHttpRequest()
|
|
let XHR = new XMLHttpRequest()
|
|
const that = this
|
|
const that = this
|
|
XHR.onreadystatechange = function() {
|
|
XHR.onreadystatechange = function() {
|
|
@@ -595,7 +601,7 @@ export default {
|
|
XHR.open("POST", "http://192.168.0.245:8008/api/tts/toMp3")
|
|
XHR.open("POST", "http://192.168.0.245:8008/api/tts/toMp3")
|
|
XHR.setRequestHeader("Content-Type", "application/json;charset=UTF-8")
|
|
XHR.setRequestHeader("Content-Type", "application/json;charset=UTF-8")
|
|
XHR.send(JSON.stringify({
|
|
XHR.send(JSON.stringify({
|
|
- content: this.hoverElemDisc + this.hoverElemContent
|
|
|
|
|
|
+ content: text || this.hoverElemDisc + this.hoverElemContent
|
|
}))
|
|
}))
|
|
}, 500),
|
|
}, 500),
|
|
keyEventHandler(e) {
|
|
keyEventHandler(e) {
|