You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.0 KiB

3 years ago
  1. <template>
  2. <v-main>
  3. <v-container fluid>
  4. <v-row justify="center">
  5. <v-col cols="12" md="9">
  6. <audio
  7. controls
  8. src="~/assets/examples/speech_1.mp3"
  9. class="mt-2 mb-5"
  10. style="width:100%;"
  11. >
  12. Your browser does not support the
  13. <code>audio</code> element.
  14. </audio>
  15. <seq2seq-box
  16. :text="currentDoc.text"
  17. :annotations="currentDoc.annotations"
  18. @delete:annotation="_deleteAnnotation"
  19. @update:annotation="_updateAnnotation"
  20. @create:annotation="_createAnnotation"
  21. />
  22. </v-col>
  23. <v-col cols="12" md="3">
  24. <list-metadata :metadata="currentDoc.meta" />
  25. </v-col>
  26. </v-row>
  27. </v-container>
  28. </v-main>
  29. </template>
  30. <script>
  31. import ListMetadata from '@/components/tasks/metadata/ListMetadata'
  32. import Seq2seqBox from '~/components/tasks/seq2seq/Seq2seqBox'
  33. export default {
  34. components: {
  35. Seq2seqBox,
  36. ListMetadata
  37. },
  38. layout: 'demo',
  39. data() {
  40. return {
  41. currentDoc: {
  42. id: 8,
  43. text: '',
  44. annotations: [
  45. {
  46. id: 17,
  47. text: "Hi! Welcome to doccano!",
  48. user: 1,
  49. document: 8
  50. }
  51. ],
  52. meta: {
  53. url: 'https://github.com/doccano'
  54. },
  55. annotation_approver: null
  56. }
  57. }
  58. },
  59. methods: {
  60. _deleteAnnotation(annotationId) {
  61. this.currentDoc.annotations = this.currentDoc.annotations.filter(item => item.id !== annotationId)
  62. },
  63. _updateAnnotation(annotationId, text) {
  64. const index = this.currentDoc.annotations.findIndex(item => item.id === annotationId)
  65. this.currentDoc.annotations[index].text = text
  66. },
  67. _createAnnotation(text) {
  68. const payload = {
  69. id: Math.floor(Math.random() * Math.floor(Number.MAX_SAFE_INTEGER)),
  70. text
  71. }
  72. this.currentDoc.annotations.push(payload)
  73. }
  74. }
  75. }
  76. </script>