index.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <div class="heroes-page">
  3. <div class="container">
  4. <h1 class="title">Course Heroes</h1>
  5. <table class="heroes-table table is-responsive">
  6. <thead>
  7. <tr class="main-table-row">
  8. <th>Image</th>
  9. <th>Title</th>
  10. <th>Subtitle</th>
  11. <th>Status</th>
  12. </tr>
  13. </thead>
  14. <tbody>
  15. <tr @click="openModal('1')" class="table-row">
  16. <td>Hero Image</td>
  17. <td>Hero Title</td>
  18. <td>Hero Subtitle</td>
  19. <td>Active/ Inactive</td>
  20. <td class="modal-td" v-show="false">
  21. <Modal
  22. ref="modal-1"
  23. :showButton="false"
  24. actionTitle="Make Active"
  25. openTitle="Favorite"
  26. title="Make Course Hero">
  27. <div>
  28. <div class="subtitle">
  29. Title: Some Title
  30. </div>
  31. <div class="subtitle">
  32. Subtitle: Some Subtitle
  33. </div>
  34. <figure class="image is-3by1">
  35. <img>
  36. </figure>
  37. </div>
  38. </Modal>
  39. </td>
  40. </tr>
  41. <tr @click="openModal('2')" class="table-row">
  42. <td>Hero Image</td>
  43. <td>Hero Title</td>
  44. <td>Hero Subtitle</td>
  45. <td>Active/ Inactive</td>
  46. <td class="modal-td" v-show="false">
  47. <Modal
  48. ref="modal-2"
  49. :showButton="false"
  50. actionTitle="Make Active"
  51. openTitle="Favorite"
  52. title="Make Course Hero">
  53. <div>
  54. <div class="subtitle">
  55. Title: Some Title 2
  56. </div>
  57. <div class="subtitle">
  58. Subtitle: Some Subtitle 2
  59. </div>
  60. <figure class="image is-3by1">
  61. <img>
  62. </figure>
  63. </div>
  64. </Modal>
  65. </td>
  66. </tr>
  67. </tbody>
  68. </table>
  69. </div>
  70. </div>
  71. </template>
  72. <script>
  73. import Modal from '~/components/shared/Modal'
  74. export default {
  75. middleware: 'admin',
  76. components: {
  77. Modal
  78. },
  79. computed: {
  80. heroes() {
  81. return this.$store.state.instructor.heroes
  82. }
  83. },
  84. async fetch({store}) {
  85. await store.dispatch('instructor/fetchHeroes')
  86. },
  87. methods: {
  88. openModal(modalId) {
  89. this.$refs[`modal-${modalId}`].openModal()
  90. }
  91. }
  92. }
  93. </script>
  94. <style scoped lang="scss">
  95. .heroes-page {
  96. max-width: 1000px;
  97. margin: 0 auto 5rem auto;
  98. margin-top: 40px;
  99. }
  100. .title {
  101. font-size: 45px;
  102. font-weight: bold;
  103. }
  104. .isActive {
  105. }
  106. .table-row {
  107. margin: 20px;
  108. &.isActive {
  109. background-color: #dfffe1
  110. }
  111. &:hover {
  112. cursor: pointer;
  113. background-color: #e4e4e4;
  114. }
  115. }
  116. </style>