MarkHeader.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <div
  3. class="
  4. tw-flex tw-gap-4 tw-justify-between tw-items-center
  5. header-container
  6. tw-px-1
  7. "
  8. v-if="store.setting"
  9. >
  10. <ul class="tw-flex tw-gap-2 tw-mb-0">
  11. <li @click="upScale" title="放大">
  12. <ZoomInOutlined
  13. class="icon-font icon-font-size-20 tw-cursor-pointer"
  14. :style="{
  15. color: greaterThanOneScale ? 'red' : 'white',
  16. }"
  17. />
  18. </li>
  19. <li @click="downScale" title="缩小">
  20. <ZoomOutOutlined
  21. class="icon-font icon-font-size-20 tw-cursor-pointer"
  22. :style="{
  23. color: lessThanOneScale ? 'red' : 'white',
  24. }"
  25. />
  26. </li>
  27. <li @click="normalScale" title="适应">
  28. <FullscreenOutlined
  29. class="icon-font icon-font-size-20 tw-cursor-pointer"
  30. />
  31. </li>
  32. </ul>
  33. <div
  34. class="tw-flex tw-place-items-center tw-cursor-pointer"
  35. @click="closeWindow"
  36. >
  37. <PoweroffOutlined class="icon-font icon-with-text" />关闭
  38. </div>
  39. </div>
  40. </template>
  41. <script lang="ts">
  42. import { computed, defineComponent } from "vue";
  43. import { store } from "./store";
  44. import {
  45. ZoomInOutlined,
  46. ZoomOutOutlined,
  47. FullscreenOutlined,
  48. HistoryOutlined,
  49. UserOutlined,
  50. PoweroffOutlined,
  51. AlertOutlined,
  52. QuestionCircleOutlined,
  53. } from "@ant-design/icons-vue";
  54. import { useRoute } from "vue-router";
  55. export default defineComponent({
  56. name: "MarkHeader",
  57. components: {
  58. ZoomInOutlined,
  59. ZoomOutOutlined,
  60. FullscreenOutlined,
  61. HistoryOutlined,
  62. UserOutlined,
  63. PoweroffOutlined,
  64. AlertOutlined,
  65. QuestionCircleOutlined,
  66. },
  67. setup() {
  68. const route = useRoute();
  69. const upScale = () => {
  70. const s = store.setting.uiSetting["answer.paper.scale"];
  71. if (s < 3)
  72. store.setting.uiSetting["answer.paper.scale"] = +(s + 0.2).toFixed(1);
  73. };
  74. const downScale = () => {
  75. const s = store.setting.uiSetting["answer.paper.scale"];
  76. if (s > 0.2)
  77. store.setting.uiSetting["answer.paper.scale"] = +(s - 0.2).toFixed(1);
  78. };
  79. const normalScale = () => {
  80. store.setting.uiSetting["answer.paper.scale"] = 1;
  81. };
  82. const greaterThanOneScale = computed(() => {
  83. return store.setting.uiSetting["answer.paper.scale"] > 1;
  84. });
  85. const lessThanOneScale = computed(() => {
  86. return store.setting.uiSetting["answer.paper.scale"] < 1;
  87. });
  88. const closeWindow = async () => {
  89. window.close();
  90. };
  91. return {
  92. store,
  93. upScale,
  94. downScale,
  95. normalScale,
  96. greaterThanOneScale,
  97. lessThanOneScale,
  98. closeWindow,
  99. };
  100. },
  101. });
  102. </script>
  103. <style scoped>
  104. .header-container {
  105. /* z-index: 10000; */
  106. position: relative;
  107. font-size: 16px;
  108. height: 40px;
  109. background-color: #5d6d7d;
  110. color: white;
  111. }
  112. .highlight-text {
  113. color: #ffe400;
  114. }
  115. .icon-font {
  116. display: block;
  117. }
  118. .icon-font-size-20 {
  119. font-size: 20px;
  120. }
  121. .icon-with-text {
  122. font-size: 18px;
  123. line-height: 18px;
  124. }
  125. </style>