|
| 1 | +<template> |
| 2 | + <div> |
| 3 | + <h1>All Settings</h1> |
| 4 | + <p>What speech recognition engine would you like to use: |
| 5 | + </br> |
| 6 | + <i-switch |
| 7 | + :disabled="engineDisabled" |
| 8 | + @on-change="changeEngine" |
| 9 | + class="switch-engine" |
| 10 | + size="large" |
| 11 | + v-model="switchEngine" |
| 12 | + > |
| 13 | + <span slot="open">Sphinx</span> |
| 14 | + <span slot="close">Watson</span> |
| 15 | + </i-switch> |
| 16 | + </p> |
| 17 | + <p>Would you like to use mobile Jack entry: |
| 18 | + </br> |
| 19 | + <i-switch |
| 20 | + :disabled="entryDisabled" |
| 21 | + @on-change="changeEntry" |
| 22 | + class="switch-engine" |
| 23 | + size="large" |
| 24 | + v-model="switchEntry" |
| 25 | + > |
| 26 | + <span slot="open">Mobile</span> |
| 27 | + <span slot="close">Raw</span> |
| 28 | + </i-switch> |
| 29 | + </p> |
| 30 | + </div> |
| 31 | +</template> |
| 32 | + |
| 33 | +<script> |
| 34 | + export default { |
| 35 | +
|
| 36 | + name: 'configuration-page', |
| 37 | +
|
| 38 | + data() { |
| 39 | + return { |
| 40 | + switchEngine: false, |
| 41 | + switchEntry: false, |
| 42 | + engineDisabled: false, |
| 43 | + entryDisabled: false, |
| 44 | + }; |
| 45 | + }, |
| 46 | + methods: { |
| 47 | + changeEngine() { |
| 48 | + const body = { |
| 49 | + engine: this.switchEngine ? 'sphinx' : 'watson', |
| 50 | + }; |
| 51 | + const option = { emulateJSON: true }; |
| 52 | +
|
| 53 | + this.engineDisabled = true; |
| 54 | + this.$http.post('http://localhost:8001/config', body, option).then(() => { |
| 55 | + this.engineDisabled = false; |
| 56 | + }).catch((err) => { |
| 57 | + this.engineDisabled = false; |
| 58 | + /* eslint no-console: ["error", { allow: ["warn", "error", "log"] }] */ |
| 59 | + console.log(err); |
| 60 | + }); |
| 61 | + }, |
| 62 | + changeEntry() { |
| 63 | + const body = { |
| 64 | + STT: this.switchEntry ? 'mobile' : 'raw', |
| 65 | + }; |
| 66 | + const option = { emulateJSON: true }; |
| 67 | +
|
| 68 | + this.engineDisabled = true; |
| 69 | + this.$http.post('http://localhost:8001/config', body, option).then(() => { |
| 70 | + this.engineDisabled = false; |
| 71 | + }).catch((err) => { |
| 72 | + this.engineDisabled = false; |
| 73 | + /* eslint no-console: ["error", { allow: ["warn", "error", "log"] }] */ |
| 74 | + console.log(err); |
| 75 | + }); |
| 76 | + }, |
| 77 | + }, |
| 78 | + }; |
| 79 | +</script> |
| 80 | + |
| 81 | +<style> |
| 82 | + .switch-engine { |
| 83 | + width: 78px; |
| 84 | + } |
| 85 | +
|
| 86 | + .switch-engine.ivu-switch-checked::after { |
| 87 | + left: 54px; |
| 88 | + } |
| 89 | +
|
| 90 | + .switch-engine.ivu-switch-checked { |
| 91 | + border-color: #EE578A; |
| 92 | + background-color: #EE578A; |
| 93 | + } |
| 94 | +</style> |
0 commit comments