tools.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <div class="tools float-left">
  3. <button
  4. title="上一个"
  5. @click="changeItem('pre')"
  6. class="el-icon-d-arrow-left"
  7. ></button>
  8. <button
  9. title="下一个"
  10. @click="changeItem('next')"
  11. class="el-icon-d-arrow-right"
  12. ></button>
  13. <button
  14. title="拖拽"
  15. :class="[mode == 'drag' ? 'active' : '']"
  16. class="yficonfont icon-zhuashou"
  17. @click="mode = 'drag'"
  18. ></button>
  19. <button
  20. title="绘制"
  21. :class="[mode == 'draw' ? 'active' : '']"
  22. class="el-icon-edit-outline"
  23. @click="mode = 'draw'"
  24. ></button>
  25. <button
  26. title="保存标注"
  27. @click="saveLabel"
  28. class="el-icon-circle-check"
  29. ></button>
  30. <button title="下载" @click="saveImage" class="el-icon-download"></button>
  31. <button
  32. title="全屏"
  33. @click="fullScreen"
  34. class="el-icon-full-screen"
  35. ></button>
  36. </div>
  37. </template>
  38. <script>
  39. export default {
  40. props: {
  41. fullScreenHtml: ['fullScreenHtml']
  42. },
  43. data() {
  44. return {
  45. mode: 'draw'
  46. }
  47. },
  48. computed: {},
  49. created() {},
  50. mounted() {},
  51. watch: {},
  52. methods: {
  53. // 切换上一个下一个
  54. changeItem(type) {
  55. this.$emit('changeItem', type)
  56. },
  57. changeMode(type) {
  58. this.$emit('changeMode', type)
  59. },
  60. fullScreen() {
  61. const container = this.fullScreenHtml
  62. if (container.requestFullscreen) {
  63. container.requestFullscreen()
  64. } else if (container.mozRequestFullScreen) {
  65. container.mozRequestFullScreen()
  66. } else if (container.webkitRequestFullscreen) {
  67. container.webkitRequestFullscreen()
  68. } else if (container.msRequestFullscreen) {
  69. container.msRequestFullscreen()
  70. }
  71. },
  72. saveLabel() {
  73. this.$emit('saveLabel')
  74. }
  75. },
  76. components: {}
  77. }
  78. </script>
  79. <style scoped lang="less">
  80. @primary-color: #018b3f;
  81. .controls {
  82. position: absolute;
  83. top: 0;
  84. left: 0;
  85. padding: 3px 15px;
  86. width: 70%;
  87. box-sizing: border-box;
  88. // background: rgba(0, 0, 0, 0.3);
  89. }
  90. .info {
  91. width: 100%;
  92. // color: #ffffff;
  93. overflow: hidden;
  94. .tools {
  95. display: flex;
  96. background-color: rgba(0, 0, 0, 0.3);
  97. // gap: 10px;
  98. .active {
  99. background: @primary-color;
  100. }
  101. }
  102. .float-right {
  103. line-height: 24px;
  104. }
  105. }
  106. .info span {
  107. white-space: nowrap;
  108. .active {
  109. color: @primary-color;
  110. margin-right: 5px;
  111. }
  112. }
  113. .info button {
  114. font-size: 16px;
  115. padding: 4px 8px;
  116. background: none;
  117. color: white;
  118. border: none;
  119. border-radius: 3px;
  120. cursor: pointer;
  121. white-space: nowrap;
  122. }
  123. .info button:disabled {
  124. cursor: not-allowed;
  125. }
  126. </style>