401.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <div class="error layout-padding">
  3. <div class="layout-padding-auto layout-padding-view">
  4. <div class="error-flex">
  5. <div class="left">
  6. <div class="left-item">
  7. <div class="left-item-animation left-item-num">401</div>
  8. <div class="left-item-animation left-item-title">您未被授权,没有操作权限~</div>
  9. <div class="left-item-animation left-item-msg">您可以联系管理员帮您添加权限</div>
  10. <div class="left-item-animation left-item-btn">
  11. <el-button type="primary" round @click="onSetAuth">重新授权</el-button>
  12. </div>
  13. </div>
  14. </div>
  15. <div class="right">
  16. <img :src="getImageUrl('public/jurisdiction.png')" alt="" />
  17. </div>
  18. </div>
  19. </div>
  20. </div>
  21. </template>
  22. <script lang="ts">
  23. import { defineComponent } from 'vue';
  24. import { Session } from '/@/utils/storage';
  25. import { getImageUrl } from "/@/utils/tools";
  26. export default defineComponent({
  27. name: '401',
  28. setup() {
  29. const onSetAuth = () => {
  30. // https://gitee.com/lyt-top/vue-next-admin/issues/I5C3JS
  31. // 清除缓存/token等
  32. Session.clear();
  33. // 使用 reload 时,不需要调用 resetRoute() 重置路由
  34. window.location.reload();
  35. };
  36. return {
  37. onSetAuth,
  38. getImageUrl
  39. };
  40. },
  41. });
  42. </script>
  43. <style scoped lang="scss">
  44. .error {
  45. height: 100%;
  46. .error-flex {
  47. margin: auto;
  48. display: flex;
  49. height: 350px;
  50. width: 900px;
  51. .left {
  52. flex: 1;
  53. height: 100%;
  54. align-items: center;
  55. display: flex;
  56. .left-item {
  57. .left-item-animation {
  58. opacity: 0;
  59. animation-name: error-num;
  60. animation-duration: 0.5s;
  61. animation-fill-mode: forwards;
  62. }
  63. .left-item-num {
  64. color: var(--el-color-info);
  65. font-size: 55px;
  66. }
  67. .left-item-title {
  68. font-size: 20px;
  69. color: var(--el-text-color-primary);
  70. margin: 15px 0 5px 0;
  71. animation-delay: 0.1s;
  72. }
  73. .left-item-msg {
  74. color: var(--el-text-color-secondary);
  75. font-size: 12px;
  76. margin-bottom: 20px;
  77. animation-delay: 0.2s;
  78. }
  79. .left-item-btn {
  80. animation-delay: 0.2s;
  81. }
  82. }
  83. }
  84. .right {
  85. flex: 1;
  86. opacity: 0;
  87. animation-name: error-img;
  88. animation-duration: 2s;
  89. animation-fill-mode: forwards;
  90. display: flex;
  91. align-items: center;
  92. justify-content: center;
  93. }
  94. }
  95. }
  96. </style>