ClickMapPage.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <div ref="page" class="page">
  3. <div v-html="mapHtml"></div>
  4. </div>
  5. </template>
  6. <script>
  7. //-----------------------------------------------------------------------------
  8. import Vue from 'vue';
  9. import Component from 'vue-class-component';
  10. import {sleep} from '../../../share/utils';
  11. import {clickMap, clickMapText} from '../share/clickMap';
  12. export default @Component({
  13. })
  14. class ClickMapPage extends Vue {
  15. fontSize = '200%';
  16. created() {
  17. }
  18. get mapHtml() {
  19. let result = '<div style="display: flex; width: 100%; height: 100%; position: absolute;">';
  20. let px = 0;
  21. for (const x in clickMap) {
  22. let div = `<div style="display: flex; flex-direction: column; width: ${x - px}%;">`;
  23. let py = 0;
  24. for (const y in clickMap[x]) {
  25. const text = clickMapText[clickMap[x][y]].split(' ');
  26. let divText = '';
  27. for (const t of text)
  28. divText += `<span>${t}</span>`;
  29. div += `<div style="display: flex; flex-direction: column; justify-content: center; align-items: center; ` +
  30. `height: ${y - py}%; border: 1px solid white; font-size: ${this.fontSize}">${divText}</div>`;
  31. py = y;
  32. }
  33. div += '</div>';
  34. px = x;
  35. result += div;
  36. }
  37. result += '</div>';
  38. return result;
  39. }
  40. async slowDisappear() {
  41. const page = this.$refs.page;
  42. page.style.animation = 'click-map-disappear 5s ease-in 1';
  43. await sleep(5000);
  44. }
  45. }
  46. //-----------------------------------------------------------------------------
  47. </script>
  48. <style scoped>
  49. .page {
  50. position: absolute;
  51. width: 100%;
  52. height: 100%;
  53. z-index: 45;
  54. background-color: rgba(0, 0, 0, 0.9);
  55. color: white;
  56. display: flex;
  57. }
  58. </style>
  59. <style>
  60. @keyframes click-map-disappear {
  61. 0% { opacity: 0.9; }
  62. 100% { opacity: 0; }
  63. }
  64. </style>