Passport.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <script setup>
  2. import { ref, reactive } from "vue";
  3. import { useMainStore } from "@/stores/store";
  4. import axios from "axios";
  5. import moment from "moment";
  6. const store = useMainStore();
  7. let token = store.token;
  8. console.log("學習護照", store.token);
  9. let register = reactive({
  10. list: [],
  11. });
  12. (async () => {
  13. try {
  14. const response = await axios.get(
  15. `https://cmm.ai:8088/api/get_registration?access_token=${token}`
  16. );
  17. register.list = response.data.registrations;
  18. console.log("response", response.data.registrations);
  19. } catch (error) {
  20. console.error(error);
  21. }
  22. })();
  23. </script>
  24. <template>
  25. <v-card class="h-100">
  26. <div class="title">
  27. <h4>學習護照</h4>
  28. </div>
  29. <p class="text-center">
  30. 凡在平台選擇「學習時數課程」並報名 <br />
  31. 即可累積點數,兌換精美好禮-工藝材料包
  32. </p>
  33. <v-row class="main-info mt-10">
  34. <v-col cols="12" lg="6" class="d-flex flex-column align-center">
  35. <h5>累積學習<span>時數</span></h5>
  36. <div class="d-flex align-center position-relative">
  37. <p>
  38. 自 2023 年起至今 <br />
  39. 完成課程時數
  40. </p>
  41. <img src="@/assets/img/passport/icon-01.png" alt="" class="icon" />
  42. </div>
  43. <div class="record-item">
  44. <img src="@/assets/img/passport/icon-03.png" alt="" />
  45. <p>
  46. 總共 <br />
  47. <strong> 102 </strong> <small>小時</small>
  48. </p>
  49. </div>
  50. </v-col>
  51. <v-col cols="12" lg="6" class="d-flex flex-column align-center">
  52. <h5>累積學習<span>點數</span></h5>
  53. <div class="d-flex align-center position-relative">
  54. <p>
  55. 累積 20 點即可兌換 1 份 <br />
  56. 工藝材料包
  57. </p>
  58. <img src="@/assets/img/passport/icon-02.png" alt="" class="icon" />
  59. </div>
  60. <div class="record-item">
  61. <img src="@/assets/img/passport/icon-03.png" alt="" />
  62. <p>
  63. 總共 <br />
  64. <strong> 33 </strong> <small>點</small>
  65. </p>
  66. </div>
  67. </v-col>
  68. <v-col cols="12" class="my-16">
  69. <div class="main-table">
  70. <h6 class="table-title">報名中課程</h6>
  71. <table>
  72. <thead>
  73. <tr>
  74. <th>名稱</th>
  75. <th width="30%">日期</th>
  76. <th width="15%">時數</th>
  77. <th width="15%">報名完成</th>
  78. </tr>
  79. </thead>
  80. <tbody v-if="register.list.length">
  81. <!-- <tr v-if="!register.list.length">
  82. <p class="hint-item">
  83. 目前沒有報名紀錄喔!點擊開始探索您的專屬課程!
  84. </p>
  85. </tr> -->
  86. <tr v-for="(item, index) in register.list" :key="index">
  87. <td>{{ item.class_name }}</td>
  88. <td>
  89. {{ moment(`${item.start_time}`).format("YYYY/MM/DD H:mm") }}
  90. <br />
  91. ~ <br />
  92. {{ moment(`${item.end_time}`).format("YYYY/MM/DD H:mm") }}
  93. </td>
  94. <td>3 小時</td>
  95. <td>
  96. <span class="finish-icon" v-if="item.reg_confirm">
  97. <v-icon icon="mdi-check" class="pb-1"></v-icon>
  98. </span>
  99. </td>
  100. </tr>
  101. </tbody>
  102. </table>
  103. </div>
  104. <router-link
  105. v-if="!register.list.length"
  106. to="/course-list"
  107. class="hint-item"
  108. >
  109. 目前沒有報名紀錄喔! <br />
  110. 點擊開始探索您的專屬課程!
  111. </router-link>
  112. </v-col>
  113. <v-col cols="12" class="my-16">
  114. <div class="main-table">
  115. <h6 class="table-title">上課紀錄</h6>
  116. <table>
  117. <thead>
  118. <tr>
  119. <th>名稱</th>
  120. <th width="30%">日期</th>
  121. <th width="15%">時數</th>
  122. <th width="15%">報名完成</th>
  123. </tr>
  124. </thead>
  125. <tbody>
  126. <tr></tr>
  127. </tbody>
  128. </table>
  129. </div>
  130. </v-col>
  131. <div class="dot-item">
  132. <span class="t-dot"></span>
  133. <span class="r-dot"></span>
  134. <span class="b-dot"></span>
  135. <span class="l-dot"></span>
  136. </div>
  137. </v-row>
  138. </v-card>
  139. </template>
  140. <style lang="scss" scoped>
  141. p {
  142. line-height: 30px;
  143. }
  144. .main-info {
  145. margin: 30px;
  146. padding: 50px;
  147. position: relative;
  148. border: 2px solid var(--blue);
  149. border-radius: 20px;
  150. @media (max-width: 600px) {
  151. margin: 0;
  152. padding: 50px 20px 100px;
  153. }
  154. h5 {
  155. display: flex;
  156. flex-direction: column;
  157. align-items: center;
  158. font-size: 20px;
  159. font-weight: 500;
  160. letter-spacing: 1px;
  161. span {
  162. display: block;
  163. margin: 5px 0 15px;
  164. font-size: 36px;
  165. }
  166. }
  167. p {
  168. text-align: center;
  169. line-height: 22px;
  170. @media (max-width: 490px) {
  171. font-size: 14px;
  172. }
  173. }
  174. .icon {
  175. width: 50px;
  176. position: absolute;
  177. right: -50px;
  178. }
  179. .record-item {
  180. margin-top: 20px;
  181. position: relative;
  182. p {
  183. width: 100%;
  184. position: absolute;
  185. z-index: 100;
  186. top: 50%;
  187. left: 50%;
  188. transform: translate(-50%, -50%);
  189. color: #fff;
  190. font-size: 30px;
  191. }
  192. strong {
  193. display: inline-block;
  194. margin: 25px 0;
  195. font-size: 56px;
  196. font-weight: 500;
  197. @media (max-width: 600px) {
  198. font-size: 50px;
  199. }
  200. }
  201. small {
  202. font-size: 20px;
  203. }
  204. img {
  205. max-width: 260px;
  206. @media (max-width: 600px) {
  207. max-width: 220px;
  208. }
  209. }
  210. }
  211. }
  212. .table-title {
  213. background-color: var(--blue);
  214. }
  215. table {
  216. thead {
  217. border-bottom: 2px solid var(--blue);
  218. }
  219. tbody {
  220. td {
  221. border-bottom: 1px solid var(--blue);
  222. line-height: 24px;
  223. padding: 15px;
  224. }
  225. }
  226. .finish-icon {
  227. padding: 8px;
  228. border: 2px solid var(--blue);
  229. border-radius: 100px;
  230. .v-icon {
  231. color: var(--blue);
  232. }
  233. }
  234. }
  235. </style>