AlertformData.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <div class="container-box">
  3. <div class="control-btn" v-if="hasPermisson()">
  4. <div class="btn" :class="{ 'btn-active': activeName === 'default' }" @click="activeName = 'default'">默认数据</div>
  5. <div class="btn" :class="{ 'btn-active': activeName === 'show' }" @click="activeName = 'show'">展示数据</div>
  6. </div>
  7. <Default class="content-box" v-if="activeName === 'default'" />
  8. <Show class="content-box" v-else />
  9. </div>
  10. </template>
  11. <script setup lang="ts">
  12. import { ref } from 'vue';
  13. import Default from './components/default/Default.vue';
  14. import Show from './components/show/Show.vue';
  15. import { useUserStore } from '@/store/modules/user';
  16. const activeName = ref('default');
  17. const userStore = useUserStore();
  18. const hasPermisson = () => {
  19. return userStore.checkPermission("question_mock_edit_admin");
  20. };
  21. </script>
  22. <style scoped lang="scss">
  23. .container-box {
  24. width: 100%;
  25. height: 100%;
  26. display: flex;
  27. flex-direction: column;
  28. min-height: calc(100vh - 90px);
  29. padding: 21px;
  30. background-color: rgba(255, 255, 255, 1);
  31. border-radius: 10px;
  32. }
  33. .control-btn {
  34. display: flex;
  35. margin-bottom: 20px;
  36. .btn {
  37. display: flex;
  38. justify-content: center;
  39. align-items: center;
  40. width: 188px;
  41. height: 38px;
  42. font-size: 14px;
  43. font-weight: 400;
  44. color: rgba(0, 0, 0, 0.88);
  45. border: 1px solid #D9D9D9;
  46. background: rgba(0, 0, 0, 0.02);
  47. cursor: pointer;
  48. }
  49. :first-child {
  50. border-radius: 8px 0px 0px 8px;
  51. }
  52. :last-child {
  53. border-radius: 0px 8px 8px 0px;
  54. }
  55. .btn-active {
  56. font-weight: 500;
  57. color: #1890FF;
  58. border: 1px solid #1890FF;
  59. background-color: rgba(24, 144, 255, 0.15);
  60. }
  61. }
  62. .content-box {
  63. flex: 1;
  64. }
  65. </style>