|
|
@@ -61,7 +61,7 @@
|
|
61
|
61
|
<script setup lang="ts">
|
|
62
|
62
|
|
|
63
|
63
|
import { IonPage, IonHeader, IonToolbar, IonTitle, IonContent, IonIcon, onIonViewWillEnter, IonButton,
|
|
64
|
|
- onIonViewWillLeave, IonItem, IonLabel, IonThumbnail, IonCol, IonGrid, IonRow, IonCard, IonCardContent, IonCardHeader, IonCardSubtitle, IonCardTitle, onIonViewDidEnter, IonButtons, IonImg } from '@ionic/vue';
|
|
|
64
|
+ onIonViewWillLeave, IonItem, IonLabel, IonThumbnail, IonCol, IonGrid, IonRow, IonCard, IonCardContent, IonCardHeader, IonCardSubtitle, IonCardTitle, onIonViewDidEnter, IonButtons, IonImg, useIonRouter } from '@ionic/vue';
|
|
65
|
65
|
|
|
66
|
66
|
import ExploreContainer from '@/components/ExploreContainer.vue';
|
|
67
|
67
|
import CourseSchedule from '@/components/CourseSchedule.vue'
|
|
|
@@ -72,7 +72,7 @@ import SearchEngine from '@/components/SearchEngine.vue'
|
|
72
|
72
|
import { CapacitorHttp } from '@capacitor/core';
|
|
73
|
73
|
import { ref } from 'vue';
|
|
74
|
74
|
import { TOKEN, getProducts, setToken, getObject, getToken, getTrainers, listMats, storeAPNToken,
|
|
75
|
|
-getTodayProgs, getLive, getPosts, initAPI} from '@/composable/settings';
|
|
|
75
|
+getTodayProgs, getLive, getPosts, initAPI, clearPref, isLogin} from '@/composable/settings';
|
|
76
|
76
|
//import VueCoreVideoPlayer from 'vue-core-video-player'
|
|
77
|
77
|
import { vueVimeoPlayer } from 'vue-vimeo-player'
|
|
78
|
78
|
|
|
|
@@ -105,6 +105,8 @@ const scrollToBottom = () => {
|
|
105
|
105
|
};
|
|
106
|
106
|
const items = ref([{msg: 'foo'}, {msg: 'bar2'}])
|
|
107
|
107
|
|
|
|
108
|
+const ionRouter = useIonRouter();
|
|
|
109
|
+
|
|
108
|
110
|
const options = {
|
|
109
|
111
|
id: 59777392,
|
|
110
|
112
|
width: 640,
|
|
|
@@ -117,6 +119,11 @@ const options = {
|
|
117
|
119
|
const liveObj = ref()
|
|
118
|
120
|
const modules = [Autoplay, Keyboard, Pagination, Scrollbar, Zoom]
|
|
119
|
121
|
onIonViewWillEnter(async () => {
|
|
|
122
|
+ let v = await isLogin()
|
|
|
123
|
+ console.log("v === ", v)
|
|
|
124
|
+ if( v == false ) {
|
|
|
125
|
+ ionRouter.navigate('/tabs/tab4', 'forward', 'replace');
|
|
|
126
|
+ }
|
|
120
|
127
|
//console.log("video " ,video)
|
|
121
|
128
|
//console.log("video id", video.value.id)
|
|
122
|
129
|
//const player = new Player(video.value.id, options);
|
|
|
@@ -134,9 +141,15 @@ const modules = [Autoplay, Keyboard, Pagination, Scrollbar, Zoom]
|
|
134
|
141
|
//console.log('u ', u)
|
|
135
|
142
|
await initAPI()
|
|
136
|
143
|
token.value = await getToken()
|
|
137
|
|
- getTrainers().then( (data) => {
|
|
138
|
|
- trainers.value = data
|
|
139
|
|
- })
|
|
|
144
|
+
|
|
|
145
|
+ try{
|
|
|
146
|
+ trainers.value = await getTrainers()
|
|
|
147
|
+ }catch(error){
|
|
|
148
|
+ console.log("trainers ", error)
|
|
|
149
|
+ await clearPref()
|
|
|
150
|
+ token.value = await getToken()
|
|
|
151
|
+ }
|
|
|
152
|
+
|
|
140
|
153
|
listMats().then( (data) => {
|
|
141
|
154
|
mats.value = data
|
|
142
|
155
|
})
|
|
|
@@ -157,7 +170,7 @@ const modules = [Autoplay, Keyboard, Pagination, Scrollbar, Zoom]
|
|
157
|
170
|
if( liveObj.value == null || liveObj.value.result == false ) {
|
|
158
|
171
|
liveObj.value = await getLive()
|
|
159
|
172
|
}
|
|
160
|
|
- }, 10000)
|
|
|
173
|
+ }, 100000)
|
|
161
|
174
|
})
|
|
162
|
175
|
|
|
163
|
176
|
onIonViewWillLeave(() => {
|