SyuanYu il y a 1 an
Parent
commit
2d83d6fbbd

+ 22 - 12
src/router/index.js

@@ -108,28 +108,22 @@ const routes = [
     component: CollegeGroup,
     redirect: '/college-group/craft',
     children: [
-      {
-        path: 'craft',
-        name: 'Craft',
-        component: Craft,
-        meta: {
-          title: '技藝工藝',
-        },
-      },
       {
         path: 'future',
         name: 'Future',
         component: Future,
         meta: {
+          group_id: 1,
           title: '未來工藝',
         },
       },
       {
-        path: 'cross',
-        name: 'Cross',
-        component: Cross,
+        path: 'craft',
+        name: 'Craft',
+        component: Craft,
         meta: {
-          title: '跨域增能',
+          group_id: 2,
+          title: '技藝工藝',
         },
       },
       {
@@ -137,14 +131,25 @@ const routes = [
         name: 'Life',
         component: Life,
         meta: {
+          group_id: 3,
           title: '生活工藝',
         },
       },
+      {
+        path: 'cross',
+        name: 'Cross',
+        component: Cross,
+        meta: {
+          group_id: 7,
+          title: '跨域增能',
+        },
+      },
       {
         path: 'online',
         name: 'Online',
         component: Online,
         meta: {
+          group_id: 8,
           title: '線上工藝',
         },
       },
@@ -153,6 +158,7 @@ const routes = [
         name: 'Cfa',
         component: Cfa,
         meta: {
+          group_id: 9,
           title: '希望工程',
         },
       },
@@ -186,6 +192,7 @@ const routes = [
         redirect: 'life/apprentice/about',
         component: Apprentice,
         meta: {
+          group_id: 3,
           title: '生活工藝',
         },
         children: [
@@ -226,6 +233,7 @@ const routes = [
         name: 'Campus',
         component: Campus,
         meta: {
+          group_id: 3,
           title: '生活工藝',
         },
       },
@@ -234,6 +242,7 @@ const routes = [
         name: 'CraftJourney',
         component: CraftJourney,
         meta: {
+          group_id: 3,
           title: '生活工藝',
         },
       },
@@ -242,6 +251,7 @@ const routes = [
         name: 'Shop',
         component: Shop,
         meta: {
+          group_id: 3,
           title: '生活工藝',
         },
       },

+ 70 - 45
src/views/CollegeGroup/Main.vue

@@ -1,29 +1,18 @@
 <script setup>
 import { ref, reactive, computed, watch } from "vue";
 import { useRouter, useRoute } from "vue-router";
-import { useMainStore } from "@/stores/store";
 import axios from "axios";
-import moment from "moment";
 import Navbar from "@/components/Navbar.vue";
 
 const route = useRoute();
 const router = useRouter();
-const store = useMainStore();
-
-let title = ref("");
-title.value = route.meta.title;
-console.log("route.meta", route);
 
 let isLifeChildren = ref(false);
 
 router.beforeEach((to, from) => {
-  title.value = to.meta.title;
-  console.log("title.value", title.value);
-  console.log("to", to);
-  console.log(
-    "是否包含 /college-group/life/",
-    to.path.includes("/college-group/life/")
-  );
+  groupId.value = to.meta.group_id;
+  getGroup(groupId.value);
+
   // 判斷是否前往生活工藝內頁
   if (to.path.includes("/college-group/life/")) {
     isLifeChildren.value = true;
@@ -32,37 +21,73 @@ router.beforeEach((to, from) => {
   }
 });
 
-const description = computed(() => {
-  let text = "";
-  switch (title.value) {
-    case "未來工藝":
-      text =
-        "深入探索未來工藝的發展趨勢,以 Metacraft 為核心,專注於工藝領域的未來研究與設計。整合研發補助和研究報告等多項計畫。";
-      break;
-    case "技藝工藝":
-      text =
-        "技藝工藝旨在培養專業型、旗艦型工藝人才。我們提供專業工藝課程、修復工藝、青年培訓及國際交流。深掘台灣在地工藝智慧,並與國際接軌。";
-      break;
-    case "跨域增能":
-      text =
-        "您可以在跨域增能獲得多元知識的學習機會、培養工藝師傅的綜合能力,其中包括智財、法律、商業等全方位的領域。";
-      break;
-    case "線上工藝":
-      text =
-        "線上工藝包含中國古典文化的古老工藝、具有台灣在地特色的民俗工藝、工藝匠人的創作故事,是工藝家的影音寶庫!";
-      break;
-    case "希望工程":
-      text =
-        "希望工程以綠工藝精神結合人文關懷,串聯工藝、社會,我們希望以「One Community, One Craft」理念帶來「希望‧療癒‧陪伴」的力量、讓工藝治癒身心靈,促進社會共好。";
-      break;
-    case "生活工藝":
-      text =
-        "從精選綠色工藝品牌「旅物SHOP」,到深度工藝之旅「工藝行旅」。「一日學徒」帶您用一天的時間體會工藝師的一生。以及培養新一代工藝家啓發潛能的「校園扎根」。";
-      break;
+let groupId = ref(null);
+let groupName = ref("");
+let groupDescribe = ref("");
+
+groupId.value = route.meta.group_id;
+getGroup(groupId.value);
+
+// 取得學群介紹
+async function getGroup(id) {
+  console.log("getGroup", id);
+
+  if (id === 1) {
+    groupName = "未來工藝";
+  } else if (id === 2) {
+    groupName = "技藝工藝";
+  } else if (id === 3) {
+    groupName = "生活工藝";
+  } else if (id === 7) {
+    groupName = "跨域增能";
+  } else if (id === 8) {
+    groupName = "線上工藝";
+  } else if (id === 9) {
+    groupName = "希望工程";
   }
 
-  return text;
-});
+  try {
+    let response = await axios.get(
+      `https://cmm.ai:8088/api/get_group_name?id=${id}`
+    );
+    groupDescribe.value = response.data.school_groups[0].describe;
+    console.log("學群介紹", response.data.school_groups);
+  } catch (error) {
+    console.error(error);
+  }
+}
+
+// const description = computed(() => {
+//   let text = "";
+//   switch (title.value) {
+//     case "未來工藝":
+//       text =
+//         "深入探索未來工藝的發展趨勢,以 Metacraft 為核心,專注於工藝領域的未來研究與設計。整合研發補助和研究報告等多項計畫。";
+//       break;
+//     case "技藝工藝":
+//       text =
+//         "技藝工藝旨在培養專業型、旗艦型工藝人才。我們提供專業工藝課程、修復工藝、青年培訓及國際交流。深掘台灣在地工藝智慧,並與國際接軌。";
+//       break;
+//     case "跨域增能":
+//       text =
+//         "您可以在跨域增能獲得多元知識的學習機會、培養工藝師傅的綜合能力,其中包括智財、法律、商業等全方位的領域。";
+//       break;
+//     case "線上工藝":
+//       text =
+//         "線上工藝包含中國古典文化的古老工藝、具有台灣在地特色的民俗工藝、工藝匠人的創作故事,是工藝家的影音寶庫!";
+//       break;
+//     case "希望工程":
+//       text =
+//         "希望工程以綠工藝精神結合人文關懷,串聯工藝、社會,我們希望以「One Community, One Craft」理念帶來「希望‧療癒‧陪伴」的力量、讓工藝治癒身心靈,促進社會共好。";
+//       break;
+//     case "生活工藝":
+//       text =
+//         "從精選綠色工藝品牌「旅物SHOP」,到深度工藝之旅「工藝行旅」。「一日學徒」帶您用一天的時間體會工藝師的一生。以及培養新一代工藝家啓發潛能的「校園扎根」。";
+//       break;
+//   }
+
+//   return text;
+// });
 </script>
 
 <template>
@@ -81,9 +106,9 @@ const description = computed(() => {
           alt=""
         />
         <div class="description-item">
-          <h1>{{ title }}</h1>
+          <h1>{{ groupName }}</h1>
           <p>
-            {{ description }}
+            {{ groupDescribe }}
           </p>
         </div>
         <!-- <h1>{{ title }}</h1>

+ 7 - 2
src/views/CourseDetail.vue

@@ -114,7 +114,7 @@ async function getOtherClass() {
   // let number = Math.floor(Math.random() * 300) + 1; // 在 1-300 間取一個隨機正整數
   try {
     const response = await axios.get(
-      `https://cmm.ai:8088/api/get_class_name?category=${course.data.category}&page_num=1&page_amount=4`
+      `https://cmm.ai:8088/api/get_class_name?is_check=1&category=${course.data.category}&page_num=1&page_amount=4`
     );
     console.log("其他 response", response);
     other.classes = response.data.classes.filter(
@@ -227,6 +227,11 @@ async function signUpSubmit(id) {
       resultCard.icon = "mdi-information";
       resultCard.color = "info";
       step.value++;
+    } else if (response.data.msg === "class is full") {
+      resultCard.text = "報名已額滿";
+      resultCard.icon = "mdi-information";
+      resultCard.color = "info";
+      step.value++;
     } else if (response.data.code === 200) {
       resultCard.text = "報名成功!";
       resultCard.icon = "mdi-check-circle";
@@ -682,7 +687,7 @@ let currentTitle = computed(() => {
           </table>
         </div>
       </v-col>
-      <v-col cols="12" class="my-16">
+      <v-col v-if="other.classes.length" cols="12" class="my-16">
         <p class="other-title">其他推薦課程</p>
         <div class="d-flex justify-center mb-10" v-if="isLoading">
           <v-progress-circular

+ 67 - 15
src/views/Courses/Create.vue

@@ -256,7 +256,7 @@ let event = reactive({
   registration_way: "", // 報名方式
   registration_start: "", // 報名起始日
   registration_end: "", // 報名截止日
-  number_limit: "", // 人數限制
+  number_limit: "", // 課程名額
   remark: "", // 備註
   ATM_address: "", // 匯款帳號(銀行代碼+帳號)
   access_token: token,
@@ -461,8 +461,13 @@ let session = reactive({
 });
 
 let sessionTime = reactive({
-  start_week_time: "",
-  end_week_time: "",
+  start_week_time: [],
+  end_week_time: [],
+});
+
+watch(sessionTime, (val) => {
+  console.log("sessionTime start_week_time", val.start_week_time);
+  console.log("sessionTime end_week_time", val.end_week_time);
 });
 
 let sessionStartTimeList = ref(["", "", "", "", "", "", ""]);
@@ -473,34 +478,45 @@ async function insertSession() {
   const weekString = `[${selectedWeek.value.join(",")}]`;
   session.week_day_str = weekString;
 
+  console.log("weekString", weekString);
+
   selectedWeek.value.map((item, index) => {
     if (item) {
       console.log("index", index);
       // 開始時間
       sessionStartTimeList.value[index] = `"${
-        sessionTime.start_week_time.hours
-      }:${
-        sessionTime.start_week_time.minutes === 0
+        sessionTime.start_week_time[index].hours < 10 ? "0" : ""
+      }${sessionTime.start_week_time[index].hours}:${
+        sessionTime.start_week_time[index].minutes === 0
           ? "00"
-          : sessionTime.start_week_time.minutes
+          : sessionTime.start_week_time[index].minutes
       }:00"`;
 
       // 結束時間
-      sessionEndTimeList.value[index] = `"${sessionTime.end_week_time.hours}:${
-        sessionTime.end_week_time.minutes === 0
+      sessionEndTimeList.value[index] = `"${
+        sessionTime.end_week_time[index].hours
+      }:${
+        sessionTime.end_week_time[index].minutes === 0
           ? "00"
-          : sessionTime.end_week_time.minutes
+          : sessionTime.end_week_time[index].minutes
       }:00"`;
     } else {
       sessionStartTimeList.value[index] = '""';
       sessionEndTimeList.value[index] = '""';
     }
+
+    console.log(
+      "sessionStartTimeList.value[index]",
+      sessionStartTimeList.value[index]
+    );
   });
 
   session.start_week_time = `[${sessionStartTimeList.value}]`;
   session.end_week_time = `[${sessionEndTimeList.value}]`;
   session.class_event_id = eventId.value;
 
+  console.log("session >>", session);
+
   const formData = new FormData();
   for (const key in session) {
     formData.append(key, session[key]);
@@ -1026,7 +1042,7 @@ async function insertSession() {
                               </v-label>
                             </v-col>
 
-                            <v-col cols="12" class="py-0">
+                            <v-col cols="12" sm="6" class="py-0">
                               <v-label class="d-flex align-center py-2">
                                 <p class="pb-5 pe-3">
                                   聯絡資訊<span class="mark">*</span>
@@ -1040,6 +1056,22 @@ async function insertSession() {
                               </v-label>
                             </v-col>
 
+                            <v-col cols="12" sm="6" class="py-0">
+                              <v-label class="d-flex align-center py-2">
+                                <p class="pb-5 pe-3">
+                                  課程名額<span class="mark">*</span>
+                                </p>
+                                <v-text-field
+                                  v-model="event.number_limit"
+                                  :rules="[requiredRule]"
+                                  density="compact"
+                                  variant="outlined"
+                                  type="number"
+                                  hint="請設定報名人數上限"
+                                ></v-text-field>
+                              </v-label>
+                            </v-col>
+
                             <v-col cols="12" class="py-0">
                               <v-label class="d-flex align-center py-2">
                                 <p class="pb-5 pe-3">
@@ -1169,21 +1201,41 @@ async function insertSession() {
                                 重複週期<span class="mark pb-4">*</span>
                               </p>
 
-                              <ul class="d-flex week-list">
+                              <ul class="week-list">
                                 <li
                                   v-for="(item, index) in weekList"
                                   :key="index"
                                   @click="toggleSelected(index)"
                                   :class="{ active: selectedWeek[index] }"
+                                  class="d-flex"
                                 >
                                   <button>
                                     {{ item }}
                                   </button>
+
+                                  <div
+                                    v-if="selectedWeek[index]"
+                                    class="d-flex w-100 ms-5"
+                                  >
+                                    <VueDatePicker
+                                      v-model="
+                                        sessionTime.start_week_time[index]
+                                      "
+                                      time-picker
+                                    />
+                                    <span class="d-flex align-center mx-2"
+                                      >~</span
+                                    >
+                                    <VueDatePicker
+                                      v-model="sessionTime.end_week_time[index]"
+                                      time-picker
+                                    />
+                                  </div>
                                 </li>
                               </ul>
                             </v-col>
 
-                            <v-col
+                            <!-- <v-col
                               v-if="!isOneDay"
                               cols="12"
                               class="time-item pt-5 pb-7"
@@ -1202,7 +1254,7 @@ async function insertSession() {
                                   time-picker
                                 />
                               </div>
-                            </v-col>
+                            </v-col> -->
 
                             <v-col cols="12" class="py-0">
                               <v-label class="d-flex align-center py-2">
@@ -1565,7 +1617,7 @@ async function insertSession() {
   height: 70%;
   align-items: center;
   li {
-    margin: 0 5px;
+    margin: 15px 0;
     button {
       color: var(--purple);
       padding: 10px;

+ 596 - 42
src/views/User/Courses.vue

@@ -56,7 +56,8 @@ getClass();
 // 彈跳視窗狀態
 let schoolDialog = ref(false); // 據點
 let courseDialog = ref(false); // 課程
-let enrolledDialog = reactive([]); // 報名清單
+let studentListDialog = reactive([]); // 學員名單
+let enrolledDialog = reactive([]); // 出席清單
 let sessionsDialog = ref(false); // 場次
 
 watch(schoolDialog, () => {
@@ -330,6 +331,26 @@ const handleCoverImg = (event) => {
   }
 };
 
+let session = reactive({
+  list: [],
+});
+
+// 取得所有課堂
+// https://cmm.ai:8088/api/get_session?event_id=3723
+async function getAllSession(id) {
+  console.log("getAllSession id", id);
+
+  try {
+    const response = await axios.get(
+      `https://cmm.ai:8088/api/get_session?event_id=${id}`
+    );
+    session.list = response.data.classe_sessions;
+    console.log("課堂資料", session.list);
+  } catch (error) {
+    console.error(error);
+  }
+}
+
 // 取得場次
 async function getEvent(id) {
   console.log("getEvent id", id);
@@ -341,6 +362,7 @@ async function getEvent(id) {
     // event_id
     console.log("場次資料", response);
     let eventId = response.data.classes[0].event_id;
+    getAllSession(eventId);
     getEnrolledData(eventId);
   } catch (error) {
     console.error(error);
@@ -352,13 +374,13 @@ let registrations = reactive({
   list: [],
 });
 
-// 取得報名清單
+// 取得所有報名清單
 async function getEnrolledData(eventId) {
   enrolledLoading.value = true;
   console.log("getEnrolledData eventId", eventId);
   try {
     const response = await axios.get(
-      `https://cmm.ai:8088/api/get_registration_class?event_id=${eventId}`
+      `https://cmm.ai:8088/api/get_registration_class?event_id=${eventId}&access_token=${token}`
     );
     console.log("取得報名", response);
     registrations.list = response.data.registrations;
@@ -380,6 +402,50 @@ async function getEnrolledData(eventId) {
   }
 }
 
+let fiveDigitsInput = ref([]); // 是否輸入末五碼
+let showChip = ref([]);
+
+// 更新報名清單
+async function updateEnrolledData(item, index) {
+  console.log("更新報名清單", item);
+
+  const data = {
+    is_attend: item.is_attend,
+    payment_status: item.payment_status ? 1 : 0,
+    reg_confirm: item.reg_confirm,
+    five_digits: item.five_digits ? item.five_digits : "00000",
+  };
+
+  // 若取消付款狀態則清空末五碼欄位
+  if (!data.payment_status) {
+    data.five_digits = "00000";
+    registrations.list[index].five_digits = "";
+  }
+
+  console.log("data >", data);
+  const formData = new FormData();
+  for (const key in data) {
+    formData.append(key, data[key]);
+  }
+
+  try {
+    const response = await axios.post(
+      `https://cmm.ai:8088/api/update_registration_class?event_id=${item.event_id}&user_id=${item.user_id}&access_token=${token}`,
+      formData
+    );
+    console.log("更新", response);
+
+    fiveDigitsInput.value = [];
+    showChip.value[index] = true;
+
+    setTimeout(() => {
+      showChip.value[index] = false;
+    }, 2000);
+  } catch (error) {
+    console.error(error);
+  }
+}
+
 // 場次
 let eventData = reactive({
   list: [],
@@ -418,18 +484,95 @@ let date = reactive({
   registration_end_time: "", // 報名截止時間
 });
 
-let itemsPerPage = ref(5); // 每頁顯示筆數(查看出缺席)
+let itemsPerPage = ref(10); // 每頁顯示筆數(查看出缺席)
 let headers = reactive([
   {
     title: "姓名",
-    align: "start",
     key: "real_name",
   },
   { title: "電話", key: "phone" },
   { title: "信箱", key: "email" },
-  { title: "出席", key: "enrolled" },
   { title: "付款狀態", key: "payment" },
+  { title: "末五碼", key: "five_digits" },
 ]);
+
+let studentHeaders = reactive([
+  {
+    title: "姓名",
+    align: "start",
+    key: "real_name",
+  },
+  { title: "電話", key: "phone" },
+  { title: "信箱", key: "email" },
+  { title: "出席", key: "is_attend" },
+]);
+
+let sessionHeaders = reactive([
+  {
+    title: "課堂編號",
+    align: "center",
+    key: "sessions",
+  },
+  { title: "開始時間", align: "center", key: "start_time" },
+  { title: "結束時間", align: "center", key: "end_time" },
+  { title: "學員名單", align: "center", key: "student" },
+]);
+
+let studentDialog = ref(false);
+let record = reactive({
+  list: [],
+});
+
+// 取得課堂出席名單
+async function getAttendRecord(id) {
+  studentDialog.value = true;
+
+  try {
+    const response = await axios.get(
+      `https://cmm.ai:8088/api/get_attend_record?class_detail_id=${id}`
+    );
+
+    record.list = response.data.attend_record_list;
+    console.log("報名清單", record.list);
+
+    record.list.map((item) => {
+      if (item.is_attend) {
+        item.is_attend = true;
+      } else {
+        item.is_attend = false;
+      }
+    });
+  } catch (error) {
+    console.error(error);
+  }
+}
+
+// 更新課堂出席名單
+async function saveAttendRecord(item) {
+  const data = {
+    class_detail_id: item.raw.class_detail_id,
+    user_id: item.raw.user_id,
+    is_attend: item.raw.is_attend ? 1 : 0,
+  };
+
+  const formData = new FormData();
+  for (const key in data) {
+    formData.append(key, data[key]);
+  }
+
+  console.log("data", data);
+
+  try {
+    const response = await axios.post(
+      "https://cmm.ai:8088/api/add_attend_record",
+      formData
+    );
+
+    console.log("更新報名清單", response);
+  } catch (error) {
+    console.error(error);
+  }
+}
 </script>
 
 <template>
@@ -457,10 +600,10 @@ let headers = reactive([
         <thead>
           <tr>
             <th></th>
-            <th>名稱</th>
+            <th width="30%">名稱</th>
             <th>開課日期</th>
-            <th width="20%">狀態</th>
-            <th>出/缺席</th>
+            <th width="15%">狀態</th>
+            <th>管理</th>
             <th></th>
           </tr>
         </thead>
@@ -486,29 +629,312 @@ let headers = reactive([
               <!-- {{ item.state }} -->
             </td>
             <td>
+              <v-dialog
+                v-model="studentListDialog[index]"
+                width="1000px"
+                persistent
+              >
+                <template v-slot:activator="{ props }">
+                  <v-btn
+                    @click="getEvent(item.class_name_id)"
+                    v-bind="props"
+                    color="purple"
+                    variant="outlined"
+                    class="d-flex align-center"
+                  >
+                    <!-- <v-icon
+                      color="white"
+                      icon="mdi-text-box-edit-outline"
+                    ></v-icon> -->
+                    <!-- <p class="text-white">出席紀錄</p> -->
+                    <p>學員名單</p>
+                  </v-btn>
+                </template>
+
+                <v-card class="pa-5">
+                  <v-card-title class="d-flex justify-end">
+                    <v-btn
+                      variant="text"
+                      icon="mdi-close"
+                      size="large"
+                      @click="studentListDialog[index] = false"
+                    ></v-btn>
+                  </v-card-title>
+
+                  <v-card-text class="pa-3">
+                    <div
+                      class="d-flex justify-center mb-10"
+                      v-if="enrolledLoading"
+                    >
+                      <v-progress-circular
+                        color="grey-lighten-4"
+                        indeterminate
+                      ></v-progress-circular>
+                    </div>
+
+                    <v-data-table
+                      v-else
+                      v-model:items-per-page="itemsPerPage"
+                      :headers="headers"
+                      :items="registrations.list"
+                      item-value="name"
+                      class="courses-table"
+                    >
+                      <!-- <template v-slot:item.enrolled="{ item }">
+                        <v-checkbox hide-details></v-checkbox>
+                      </template> -->
+                      <template v-slot:item.payment="{ item }">
+                        <div class="d-flex align-center my-2">
+                          <v-checkbox
+                            v-model="item.selectable.payment_status"
+                            color="purple"
+                            hide-details
+                            label="已付款"
+                            @change="updateEnrolledData(item.raw, item.index)"
+                          ></v-checkbox>
+                          <!-- <v-text-field
+                            v-model="item.selectable.five_digits"
+                            density="compact"
+                            variant="outlined"
+                            hide-details
+                            label="帳號末五碼"
+                            class="account-item"
+                            :disabled="!item.selectable.payment_status"
+                            @input="fiveDigitsInput[item.index] = true"
+                          ></v-text-field>
+
+                          <div style="width: 95px">
+                            <div v-if="fiveDigitsInput[item.index]">
+                              <v-btn
+                                @click="
+                                  updateEnrolledData(item.raw, item.index)
+                                "
+                                variant="outlined"
+                                rounded
+                                color="success"
+                                size="xs-small"
+                                class="mx-3"
+                              >
+                                <v-icon icon="mdi-check" class="pa-4"></v-icon>
+                              </v-btn>
+                              <v-btn
+                                @click="
+                                  fiveDigitsInput[item.index] = false;
+                                  item.selectable.five_digits = '';
+                                "
+                                variant="outlined"
+                                rounded
+                                color="gray"
+                                size="xs-small"
+                              >
+                                <v-icon icon="mdi-close" class="pa-4"></v-icon>
+                              </v-btn>
+                            </div>
+                            <Transition>
+                              <v-chip
+                                v-if="showChip[item.index]"
+                                class="ms-3"
+                                color="success"
+                                variant="outlined"
+                              >
+                                儲存成功
+                              </v-chip>
+                            </Transition>
+                          </div> -->
+                        </div>
+                      </template>
+                      <template v-slot:item.five_digits="{ item }">
+                        <div class="d-flex align-center my-2">
+                          <!-- <v-checkbox
+                            v-model="item.selectable.payment_status"
+                            color="purple"
+                            hide-details
+                            label="已付款"
+                            @change="updateEnrolledData(item.raw, item.index)"
+                          ></v-checkbox> -->
+                          <v-text-field
+                            v-model="item.selectable.five_digits"
+                            density="compact"
+                            variant="outlined"
+                            hide-details
+                            label="帳號末五碼"
+                            class="account-item"
+                            :disabled="!item.selectable.payment_status"
+                            @input="fiveDigitsInput[item.index] = true"
+                          ></v-text-field>
+
+                          <div style="width: 95px">
+                            <div v-if="fiveDigitsInput[item.index]">
+                              <v-btn
+                                @click="
+                                  updateEnrolledData(item.raw, item.index)
+                                "
+                                variant="outlined"
+                                rounded
+                                color="success"
+                                size="xs-small"
+                                class="mx-3"
+                              >
+                                <v-icon icon="mdi-check" class="pa-4"></v-icon>
+                              </v-btn>
+                              <v-btn
+                                @click="
+                                  fiveDigitsInput[item.index] = false;
+                                  item.selectable.five_digits = '';
+                                "
+                                variant="outlined"
+                                rounded
+                                color="gray"
+                                size="xs-small"
+                              >
+                                <v-icon icon="mdi-close" class="pa-4"></v-icon>
+                              </v-btn>
+                            </div>
+                            <Transition>
+                              <v-chip
+                                v-if="showChip[item.index]"
+                                class="ms-3"
+                                color="success"
+                                variant="outlined"
+                              >
+                                儲存成功
+                              </v-chip>
+                            </Transition>
+                          </div>
+                        </div>
+                      </template>
+                    </v-data-table>
+
+                    <!-- <v-data-table
+                      v-else
+                      v-model:items-per-page="itemsPerPage"
+                      :headers="sessionHeaders"
+                      :items="session.list"
+                      item-value="name"
+                      class="elevation-1 courses-table elevation-0"
+                    >
+                      <template v-slot:item.start_time="{ item }">
+                        {{
+                          moment(`${item.selectable.start_time}`).format(
+                            "YYYY/MM/DD"
+                          )
+                        }}
+                      </template>
+                      <template v-slot:item.end_time="{ item }">
+                        {{
+                          moment(`${item.selectable.end_time}`).format(
+                            "YYYY/MM/DD"
+                          )
+                        }}
+                      </template>
+                      <template v-slot:item.student="{ item }">
+                        <v-btn
+                          density="default"
+                          color="blue"
+                          variant="outlined"
+                          class="ma-2"
+                          icon="mdi-format-list-bulleted-type"
+                          size="small"
+                          @click="getAttendRecord(item.selectable.session_id)"
+                        ></v-btn>
+                      </template>
+
+                      <template v-slot:item.enrolled="{ item }">
+                        <v-checkbox hide-details></v-checkbox>
+                      </template>
+                    </v-data-table> -->
+
+                    <!-- <v-dialog v-model="studentDialog" width="1000px" persistent>
+                      <v-card class="pa-5">
+                        <v-card-title> 學員名單 </v-card-title>
+                        <v-card-text>
+                          <v-data-table
+                            v-model:items-per-page="itemsPerPage"
+                            :headers="studentHeaders"
+                            :items="registrations.list"
+                            item-value="name"
+                            class="elevation-1 courses-table"
+                          >
+                            <template v-slot:item.enrolled="{ item }">
+                              <v-checkbox hide-details></v-checkbox>
+                            </template>
+                           
+                          </v-data-table>
+                        </v-card-text>
+                        <v-card-actions class="d-flex justify-center">
+                          <v-btn
+                            color="purple"
+                            variant="text"
+                            @click="studentDialog = false"
+                          >
+                            關閉
+                          </v-btn>
+                          <v-btn variant="flat" color="purple" class="px-6"
+                            >儲存修改</v-btn
+                          >
+                        </v-card-actions>
+                      </v-card>
+                    </v-dialog> -->
+                  </v-card-text>
+                  <!-- <v-card-actions class="d-flex justify-center mt-3">
+                    <v-btn
+                      color="purple"
+                      variant="outlined"
+                      class="me-3"
+                      @click="studentListDialog[index] = false"
+                      >關閉</v-btn
+                    >
+                    <v-btn
+                      @click="updateEnrolledData()"
+                      variant="flat"
+                      color="purple"
+                      class="px-6"
+                      >儲存修改</v-btn
+                    >
+                  </v-card-actions> -->
+                </v-card>
+              </v-dialog>
+
               <v-dialog v-model="enrolledDialog[index]" width="1000px">
                 <template v-slot:activator="{ props }">
                   <v-btn
                     @click="getEvent(item.class_name_id)"
                     v-bind="props"
-                    color="blue"
+                    color="purple"
                     variant="flat"
-                    rounded="xl"
-                    class="me-3"
+                    class="d-flex align-center mt-3"
                   >
-                    <p class="text-white">查看</p>
+                    <!-- <v-icon
+                      color="white"
+                      icon="mdi-text-box-edit-outline"
+                    ></v-icon> -->
+                    <!-- <p class="text-white">出席紀錄</p> -->
+                    <p>出席管理</p>
                   </v-btn>
                 </template>
 
                 <v-card class="pa-5">
-                  <v-card-text>
-                    <div class="d-flex justify-center" v-if="enrolledLoading">
+                  <v-card-title class="d-flex justify-end">
+                    <v-btn
+                      variant="text"
+                      icon="mdi-close"
+                      size="large"
+                      @click="enrolledDialog[index] = false"
+                    ></v-btn>
+                  </v-card-title>
+
+                  <v-card-text class="pa-3">
+                    <div
+                      class="d-flex justify-center mb-10"
+                      v-if="enrolledLoading"
+                    >
                       <v-progress-circular
                         color="grey-lighten-4"
                         indeterminate
                       ></v-progress-circular>
                     </div>
-                    <v-data-table
+
+                    <!-- <v-data-table
                       v-else
                       v-model:items-per-page="itemsPerPage"
                       :headers="headers"
@@ -520,13 +946,6 @@ let headers = reactive([
                         <v-checkbox hide-details></v-checkbox>
                       </template>
                       <template v-slot:item.payment="{ item }">
-                        <!-- <v-select
-                          :items="['已付款', '未付款']"
-                          density="compact"
-                          variant="outlined"
-                          hide-details
-                          class="my-3"
-                        ></v-select> -->
                         <div class="d-flex align-center my-2">
                           <v-checkbox
                             v-model="item.selectable.payment_status"
@@ -544,9 +963,101 @@ let headers = reactive([
                           ></v-text-field>
                         </div>
                       </template>
+                    </v-data-table> -->
+
+                    <v-data-table
+                      v-else
+                      v-model:items-per-page="itemsPerPage"
+                      :headers="sessionHeaders"
+                      :items="session.list"
+                      item-value="name"
+                      class="courses-table elevation-0"
+                    >
+                      <template v-slot:item.start_time="{ item }">
+                        {{
+                          moment(`${item.selectable.start_time}`).format(
+                            "YYYY/MM/DD"
+                          )
+                        }}
+                      </template>
+                      <template v-slot:item.end_time="{ item }">
+                        {{
+                          moment(`${item.selectable.end_time}`).format(
+                            "YYYY/MM/DD"
+                          )
+                        }}
+                      </template>
+                      <template v-slot:item.student="{ item }">
+                        <v-btn
+                          density="default"
+                          color="blue"
+                          variant="outlined"
+                          class="ma-2"
+                          icon="mdi-format-list-bulleted-type"
+                          size="small"
+                          @click="getAttendRecord(item.selectable.session_id)"
+                        ></v-btn>
+                      </template>
+
+                      <template v-slot:item.enrolled="{ item }">
+                        <v-checkbox hide-details></v-checkbox>
+                      </template>
                     </v-data-table>
+
+                    <v-dialog v-model="studentDialog" width="800px" persistent>
+                      <v-card class="pa-5">
+                        <v-card-title> 學員名單 </v-card-title>
+                        <v-card-text>
+                          <v-data-table
+                            v-model:items-per-page="itemsPerPage"
+                            :headers="studentHeaders"
+                            :items="record.list"
+                            item-value="name"
+                            class="elevation-1 courses-table"
+                          >
+                            <template v-slot:item.is_attend="{ item }">
+                              <v-checkbox
+                                @change="saveAttendRecord(item)"
+                                v-model="item.selectable.is_attend"
+                                hide-details
+                              ></v-checkbox>
+                            </template>
+                            <!-- <template v-slot:item.payment="{ item }">
+                              <div class="d-flex align-center my-2">
+                                <v-checkbox
+                                  v-model="item.selectable.payment_status"
+                                  color="purple"
+                                  hide-details
+                                  label="已付款"
+                                ></v-checkbox>
+                                <v-text-field
+                                  density="compact"
+                                  variant="outlined"
+                                  hide-details
+                                  label="帳號末五碼"
+                                  class="account-item"
+                                  :disabled="!item.selectable.payment_status"
+                                ></v-text-field>
+                              </div>
+                            </template> -->
+                          </v-data-table>
+                        </v-card-text>
+                        <v-card-actions class="d-flex justify-center">
+                          <v-btn
+                            color="purple"
+                            variant="text"
+                            @click="studentDialog = false"
+                          >
+                            關閉
+                          </v-btn>
+                          <!-- <v-btn variant="flat" color="purple" class="px-6"
+                            >儲存修改</v-btn
+                          > -->
+                        </v-card-actions>
+                      </v-card>
+                    </v-dialog>
                   </v-card-text>
-                  <v-card-actions class="d-flex justify-center mt-3">
+                  <!-- <v-card-actions class="d-flex justify-center mt-3">
                     <v-btn
                       color="purple"
                       variant="outlined"
@@ -557,29 +1068,44 @@ let headers = reactive([
                     <v-btn variant="flat" color="purple" class="px-6"
                       >儲存修改</v-btn
                     >
-                  </v-card-actions>
+                  </v-card-actions> -->
                 </v-card>
               </v-dialog>
             </td>
-            <td>
+            <td class="edit-item">
               <v-menu>
                 <template v-slot:activator="{ props }">
-                  <v-btn color="blue" v-bind="props" variant="outlined">
-                    <p>編輯</p>
-                  </v-btn>
+                  <div class="d-flex flex-column">
+                    <v-btn
+                      v-bind="props"
+                      color="blue"
+                      size="small"
+                      rounded="xl"
+                      variant="outlined"
+                    >
+                      <p>編輯</p>
+                    </v-btn>
 
-                  <v-btn color="blue" variant="outlined" class="ms-3">
-                    <a
-                      :href="
-                        $router.resolve(`/course-detail/${item.class_name_id}`)
-                          .href
-                      "
-                      class="text-blue"
-                      target="_blank"
-                      >前往課程</a
+                    <v-btn
+                      color="blue"
+                      size="small"
+                      rounded="xl"
+                      variant="outlined"
+                      class="mt-3"
                     >
-                    <!-- <router-link :to="class_name_id" class="text-white">前往課程</router-link> -->
-                  </v-btn>
+                      <a
+                        :href="
+                          $router.resolve(
+                            `/course-detail/${item.class_name_id}`
+                          ).href
+                        "
+                        class="text-blue"
+                        target="_blank"
+                        >前往</a
+                      >
+                      <!-- <router-link :to="class_name_id" class="text-white">前往課程</router-link> -->
+                    </v-btn>
+                  </div>
                 </template>
                 <v-list>
                   <v-list-item>
@@ -965,7 +1491,6 @@ let headers = reactive([
   p,
   a {
     font-size: 16px;
-    line-height: 30px;
   }
 
   .v-table {
@@ -1056,6 +1581,8 @@ let headers = reactive([
     }
     tbody {
       td {
+        padding: 20px 10px;
+        line-height: 22px;
         border-bottom: 1px solid var(--blue);
       }
     }
@@ -1070,9 +1597,32 @@ let headers = reactive([
   }
 }
 
+.edit-item {
+  p,
+  a {
+    font-size: 14px;
+  }
+}
+
 .courses-table {
+  tr {
+    &:hover {
+      transition: all 0.3s;
+      & > td {
+        cursor: pointer;
+        background-color: #f5f5f5 !important;
+      }
+    }
+    td {
+      text-align: center;
+    }
+  }
+
   .v-data-table-footer {
-    padding: 15px 0;
+    padding: 20px 0;
+  }
+  .v-selection-control {
+    justify-content: center;
   }
   .account-item {
     .v-field__input {
@@ -1083,4 +1633,8 @@ let headers = reactive([
     }
   }
 }
+
+.v-data-table-header__content {
+  justify-content: center;
+}
 </style>

+ 3 - 2
src/views/User/Passport.vue

@@ -12,6 +12,7 @@ let register = reactive({
   list: [],
 });
 
+console.log('profile',store.profile);
 (async () => {
   try {
     const response = await axios.get(
@@ -49,7 +50,7 @@ let register = reactive({
           <img src="@/assets/img/passport/icon-03.png" alt="" />
           <p>
             總共 <br />
-            <strong> 102 </strong> <small>小時</small>
+            <strong> {{ store.profile.points * 3 }} </strong> <small>小時</small>
           </p>
         </div>
       </v-col>
@@ -66,7 +67,7 @@ let register = reactive({
           <img src="@/assets/img/passport/icon-03.png" alt="" />
           <p>
             總共 <br />
-            <strong> 33 </strong> <small>點</small>
+            <strong> {{ store.profile.points }} </strong> <small>點</small>
           </p>
         </div>
       </v-col>