index.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <div class="result-container">
  3. <div class="result-bg-img">
  4. <component :is="dynamicComponent"></component>
  5. </div>
  6. <div class="result-title">{{ title }}</div>
  7. <div class="result-tip">{{ tip }}</div>
  8. <slot />
  9. </div>
  10. </template>
  11. <script lang="ts">
  12. import Vue from 'vue';
  13. import Result403Icon from '@/assets/assets-result-403.svg';
  14. import Result404Icon from '@/assets/assets-result-404.svg';
  15. import Result500Icon from '@/assets/assets-result-500.svg';
  16. import ResultIeIcon from '@/assets/assets-result-ie.svg';
  17. import ResultWifiIcon from '@/assets/assets-result-wifi.svg';
  18. import ResultMaintenanceIcon from '@/assets/assets-result-maintenance.svg';
  19. export default Vue.extend({
  20. name: 'Result',
  21. props: {
  22. bgUrl: {
  23. type: String,
  24. default: '',
  25. },
  26. title: {
  27. type: String,
  28. default: '',
  29. },
  30. tip: {
  31. type: String,
  32. default: '',
  33. },
  34. type: {
  35. type: String,
  36. default: '',
  37. },
  38. },
  39. computed: {
  40. dynamicComponent() {
  41. switch (this.type) {
  42. case '403':
  43. return Result403Icon;
  44. case '404':
  45. return Result404Icon;
  46. case '500':
  47. return Result500Icon;
  48. case 'ie':
  49. return ResultIeIcon;
  50. case 'wifi':
  51. return ResultWifiIcon;
  52. case 'maintenance':
  53. return ResultMaintenanceIcon;
  54. default:
  55. return Result403Icon;
  56. }
  57. },
  58. },
  59. });
  60. </script>
  61. <style lang="less" scoped>
  62. @import '@/style/variables';
  63. .result {
  64. &-link {
  65. color: var(--td-brand-color);
  66. text-decoration: none;
  67. cursor: pointer;
  68. &:hover {
  69. color: var(--td-brand-color);
  70. }
  71. &:active {
  72. color: var(--td-brand-color);
  73. }
  74. &--active {
  75. color: var(--td-brand-color);
  76. }
  77. &:focus {
  78. text-decoration: none;
  79. }
  80. }
  81. &-container {
  82. min-height: 400px;
  83. height: 75vh;
  84. display: flex;
  85. flex-direction: column;
  86. align-items: center;
  87. justify-content: center;
  88. padding: 24px;
  89. }
  90. &-bg-img {
  91. width: 200px;
  92. color: var(--td-brand-color);
  93. }
  94. &-title {
  95. color: var(--td-text-color-primary);
  96. font: var(--td-font-title-large);
  97. font-weight: 500;
  98. font-style: normal;
  99. margin-top: 8px;
  100. }
  101. &-tip {
  102. margin: 8px 0 32px;
  103. font: var(--td-font-body-medium);
  104. color: var(--td-text-color-secondary);
  105. }
  106. }
  107. </style>