tum преди 2 години
родител
ревизия
abb8106f99
променени са 1 файла, в които са добавени 36 реда и са изтрити 4 реда
  1. 36 4
      src/views/ProfilePage.vue

+ 36 - 4
src/views/ProfilePage.vue

@@ -21,9 +21,22 @@
21 21
             <ion-toggle v-model="newsNoti">Receive News Update</ion-toggle>
22 22
           </ion-item>
23 23
           <ion-list-header>
24
-            <ion-label>Martial Arts, I Love</ion-label>
24
+            <ion-label>Select Courses You like</ion-label>
25 25
           </ion-list-header>
26
+          <ion-item>
27
+          <ion-select aria-label="Fruit" placeholder="Select all fruits that apply" 
28
+              :compareWith="compareWith" @ionChange="handleChange($event)">
29
+            <ion-select-option :value="c" v-for="c in list_courses">{{ c.name }}</ion-select-option>
30
+          </ion-select>
31
+          </ion-item>
26 32
         </ion-list>
33
+        <div class='ion-padding'>
34
+          <h1>I love ...</h1>
35
+          <ion-chip v-for="s in selecteds">
36
+            <ion-label>{{ s }}</ion-label>
37
+            <ion-icon :icon="close" @click="removeItem(s)"></ion-icon>
38
+          </ion-chip>
39
+        </div>
27 40
       <ion-button @click='fbLogout' expand='full'>Logout</ion-button>
28 41
       </template>
29 42
       <template v-else>
@@ -54,13 +67,15 @@
54 67
 </template>
55 68
 
56 69
 <script setup lang="ts">
57
-import { IonPage, IonHeader, IonToolbar, IonTitle, IonContent, IonButton, onIonViewWillEnter, IonRow, IonCol, IonGrid, IonToggle, IonLabel } from '@ionic/vue';
70
+import { IonPage, IonHeader, IonToolbar, IonTitle, IonContent, IonButton, onIonViewWillEnter, IonRow, IonCol, IonGrid, IonToggle, IonLabel, IonChip, IonIcon, IonSelect, IonSelectOption } from '@ionic/vue';
58 71
 import ExploreContainer from '@/components/ExploreContainer.vue';
59 72
 import LoginForm from '@/components/LoginForm.vue';
60 73
 import { defineComponent, onMounted } from 'vue';
61 74
 import { GoogleAuth } from '@codetrix-studio/capacitor-google-auth';
62
-import { facebookLogin, setUserToken, logout, clearPref, BASE_URL } from '@/composable/settings';
75
+import { facebookLogin, setUserToken, logout, clearPref, BASE_URL, listCourses } from '@/composable/settings';
63 76
 import { InAppBrowser } from '@capgo/inappbrowser'
77
+import { close, closeCircle, pin } from 'ionicons/icons';
78
+
64 79
 
65 80
 
66 81
 
@@ -86,7 +101,9 @@ const isLogin = ref(false)
86 101
 const liveNoti = ref(true)
87 102
 const favCourseNoti = ref(true)
88 103
 const newsNoti = ref(true)
104
+const list_courses = ref([])
89 105
 
106
+const selecteds = ref([])
90 107
 
91 108
 const openReset = async () => {
92 109
   console.log("open Reset")
@@ -94,7 +111,12 @@ const openReset = async () => {
94 111
   console.info("bw ", browser)
95 112
   InAppBrowser.addListener("urlChangeEvent", urlChange)
96 113
 }
97
-
114
+const removeItem = (s) => {
115
+  let temp = selecteds.value 
116
+  temp = temp.filter( e => e !== s)
117
+  console.log(temp)
118
+  selecteds.value = temp
119
+}
98 120
 const urlChange = (event) => {
99 121
   console.info("url change ", event)
100 122
   if(event.url.includes("/accounts/password_reset/done/")) {
@@ -153,6 +175,8 @@ onIonViewWillEnter(async () => {
153 175
   }else {
154 176
     isLogin.value = false
155 177
   }
178
+
179
+  list_courses.value = await listCourses()
156 180
   ggCheckLogin()
157 181
 
158 182
 })
@@ -191,4 +215,12 @@ const userLogin = async (data) => {
191 215
     isLogin.value = true
192 216
   }
193 217
 }
218
+
219
+const compareWith = (o1, o2) =>  {
220
+  return o1 && o2 ? o1.id === o2.id : o1 === o2;
221
+}
222
+const handleChange = (ev) =>{
223
+  console.log('Current value:', ev.detail.value);
224
+  selecteds.value.push(ev.detail.value.name)
225
+}
194 226
 </script>