@saooti/octopus-sdk 31.0.26 → 31.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/package.json +2 -1
- package/src/components/display/podcasts/PodcastImage.vue +15 -9
- package/src/components/display/podcasts/PodcastInlineList.vue +43 -309
- package/src/components/display/podcasts/PodcastInlineListClassic.vue +246 -0
- package/src/components/display/podcasts/PodcastInlineListTemplate.vue +158 -0
- package/src/components/display/podcasts/PodcastModuleBox.vue +3 -26
- package/src/components/display/podcasts/PodcastSwiperList.vue +209 -0
- package/src/components/display/sharing/SharePlayer.vue +42 -81
- package/src/components/display/sharing/SharePlayerColors.vue +17 -15
- package/src/components/display/sharing/SharePlayerTypes.vue +15 -32
- package/src/components/display/sharing/SubscribeButtons.vue +44 -200
- package/src/components/form/ClassicCheckbox.vue +8 -8
- package/src/components/form/ClassicRadio.vue +9 -9
- package/src/components/form/ClassicSearch.vue +29 -29
- package/src/components/form/ClassicSelect.vue +12 -15
- package/src/components/misc/ErrorMessage.vue +6 -8
- package/src/components/misc/Footer.vue +63 -95
- package/src/components/misc/LeftMenu.vue +41 -89
- package/src/components/misc/Snackbar.vue +1 -1
- package/src/components/misc/TopBar.vue +41 -82
- package/src/components/misc/modal/ClipboardModal.vue +1 -8
- package/src/components/misc/modal/MessageModal.vue +1 -2
- package/src/components/misc/modal/QrCodeModal.vue +1 -11
- package/src/components/mixins/orgaComputed.ts +15 -0
- package/src/components/pages/Emission.vue +43 -86
- package/src/components/pages/Emissions.vue +27 -73
- package/src/components/pages/Home.vue +5 -12
- package/src/components/pages/Lives.vue +1 -6
- package/src/components/pages/Participant.vue +34 -48
- package/src/components/pages/Participants.vue +10 -28
- package/src/components/pages/Playlist.vue +20 -31
- package/src/components/pages/Playlists.vue +5 -15
- package/src/components/pages/Podcast.vue +95 -115
- package/src/components/pages/Podcasts.vue +34 -93
- package/src/components/pages/Rubrique.vue +6 -17
- package/src/components/pages/Search.vue +16 -36
- package/src/store/paramStore.ts +13 -11
package/README.md
CHANGED
|
@@ -581,6 +581,10 @@ See [Configuration Reference](https://cli.vuejs.org/config/).
|
|
|
581
581
|
* 30.0.82 Cherry pick Color Qr code
|
|
582
582
|
* 30.0.83 Locales parlement
|
|
583
583
|
* 30.0.84 Une émission non visible n'apparaît pas dans la page émission
|
|
584
|
+
* 30.0.85 PB en cliquant sur le bouton "tous les épisodes de l'organisation" dans la page d'un épisode
|
|
585
|
+
* 30.0.86 Podcastmaker newest
|
|
586
|
+
* 30.0.87 Podcastmaker newest (swiper list)
|
|
587
|
+
* 30.0.88 Podcastmaker newest (swiper list)
|
|
584
588
|
|
|
585
589
|
* 31.0.0 Passage en 31
|
|
586
590
|
* 31.0.1 Ajout pocket casts
|
|
@@ -609,4 +613,4 @@ See [Configuration Reference](https://cli.vuejs.org/config/).
|
|
|
609
613
|
* 31.0.24 Amélioration accessibilité
|
|
610
614
|
* 31.0.25 Erreur audioUrl
|
|
611
615
|
* 31.0.26 Erreur 403 page expose
|
|
612
|
-
|
|
616
|
+
* 31.0.27 Snackbar chose holdtime
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saooti/octopus-sdk",
|
|
3
|
-
"version": "31.0.
|
|
3
|
+
"version": "31.0.27",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Javascript SDK for using octopus",
|
|
6
6
|
"author": "Saooti",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"qrcode.vue": "^3.3.3",
|
|
29
29
|
"sass": "^1.49.11",
|
|
30
30
|
"sass-loader": "^12.6.0",
|
|
31
|
+
"swiper": "^8.1.5",
|
|
31
32
|
"v-calendar": "^3.0.0-alpha.8",
|
|
32
33
|
"vue": "^3.2.31",
|
|
33
34
|
"vue-i18n": "^9.2.0-beta.34",
|
|
@@ -237,6 +237,9 @@ export default defineComponent({
|
|
|
237
237
|
'PENDING' === this.fetchConference.status)
|
|
238
238
|
);
|
|
239
239
|
},
|
|
240
|
+
clickPlayGoPage():boolean{
|
|
241
|
+
return (state.podcastPage.clickPlayGoPage as boolean);
|
|
242
|
+
},
|
|
240
243
|
},
|
|
241
244
|
watch: {
|
|
242
245
|
arrowDirection(): void {
|
|
@@ -265,16 +268,19 @@ export default defineComponent({
|
|
|
265
268
|
}
|
|
266
269
|
if (!this.recordingLive) {
|
|
267
270
|
this.$store.commit('playerPlayPodcast', this.podcast);
|
|
268
|
-
|
|
271
|
+
}else{
|
|
272
|
+
this.$store.commit('playerPlayPodcast', {
|
|
273
|
+
title: this.podcast.title,
|
|
274
|
+
audioUrl: this.podcast.audioUrl,
|
|
275
|
+
duration: this.podcast.duration,
|
|
276
|
+
conferenceId: this.fetchConference ? this.fetchConference.conferenceId : undefined,
|
|
277
|
+
livePodcastId: this.podcast.podcastId,
|
|
278
|
+
organisation: this.podcast.organisation,
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
if(this.clickPlayGoPage){
|
|
282
|
+
this.$router.push('/main/pub/podcast/'+this.podcast.podcastId);
|
|
269
283
|
}
|
|
270
|
-
this.$store.commit('playerPlayPodcast', {
|
|
271
|
-
title: this.podcast.title,
|
|
272
|
-
audioUrl: this.podcast.audioUrl,
|
|
273
|
-
duration: this.podcast.duration,
|
|
274
|
-
conferenceId: this.fetchConference ? this.fetchConference.conferenceId : undefined,
|
|
275
|
-
livePodcastId: this.podcast.podcastId,
|
|
276
|
-
organisation: this.podcast.organisation,
|
|
277
|
-
});
|
|
278
284
|
},
|
|
279
285
|
showDescription(): void {
|
|
280
286
|
if (this.isDescription) {
|
|
@@ -1,108 +1,52 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
v-if="
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<button
|
|
37
|
-
class="btn admin-button m-1"
|
|
38
|
-
:class="{ disabled: !nextAvailable }"
|
|
39
|
-
:title="$t('Display next')"
|
|
40
|
-
@click="displayNext()"
|
|
41
|
-
>
|
|
42
|
-
<div class="saooti-right fw-bold" />
|
|
43
|
-
</button>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
<ClassicLoading
|
|
47
|
-
:loading-text="loading?$t('Loading podcasts ...'):undefined"
|
|
48
|
-
/>
|
|
49
|
-
<transition-group
|
|
50
|
-
v-show="loaded"
|
|
51
|
-
:name="transitionName"
|
|
52
|
-
class="element-list-inline"
|
|
53
|
-
tag="ul"
|
|
54
|
-
:class="[
|
|
55
|
-
alignLeft ? 'justify-content-start' : '',
|
|
56
|
-
overflowScroll ? 'overflowScroll' : '',
|
|
57
|
-
]"
|
|
58
|
-
:css="isInlineAnimation"
|
|
59
|
-
>
|
|
60
|
-
<PodcastItem
|
|
61
|
-
v-for="p in podcasts"
|
|
62
|
-
:key="p.podcastId"
|
|
63
|
-
class="flex-shrink-0 item-phone-margin"
|
|
64
|
-
:podcast="p"
|
|
65
|
-
:class="[alignLeft ? 'me-3' : '']"
|
|
66
|
-
/>
|
|
67
|
-
</transition-group>
|
|
68
|
-
<router-link
|
|
69
|
-
class="btn btn-link align-self-center width-fit-content m-4"
|
|
70
|
-
:to="refTo"
|
|
71
|
-
@click="handleSeeMoreButton"
|
|
72
|
-
>
|
|
73
|
-
{{ buttonText }}
|
|
74
|
-
<div
|
|
75
|
-
v-if="buttonPlus"
|
|
76
|
-
class="ms-1 saooti-more"
|
|
77
|
-
/>
|
|
78
|
-
</router-link>
|
|
79
|
-
</div>
|
|
2
|
+
<PodcastInlineListClassic
|
|
3
|
+
v-if="listTypeClassic"
|
|
4
|
+
:organisation-id="organisationId"
|
|
5
|
+
:emission-id="emissionId"
|
|
6
|
+
:iab-id="iabId"
|
|
7
|
+
:title="title"
|
|
8
|
+
:href="href"
|
|
9
|
+
:button-text="buttonText"
|
|
10
|
+
:is-arrow="isArrow"
|
|
11
|
+
:require-popular-sort="requirePopularSort"
|
|
12
|
+
:button-plus="buttonPlus"
|
|
13
|
+
:rubrique-id="rubriqueId"
|
|
14
|
+
:rubriquage-id="rubriquageId"
|
|
15
|
+
:no-rubriquage-id="noRubriquageId"
|
|
16
|
+
:query="query"
|
|
17
|
+
@update:isArrow="$emit('update:isArrow',$event)"
|
|
18
|
+
/>
|
|
19
|
+
<PodcastSwiperList
|
|
20
|
+
v-else
|
|
21
|
+
:organisation-id="organisationId"
|
|
22
|
+
:emission-id="emissionId"
|
|
23
|
+
:iab-id="iabId"
|
|
24
|
+
:title="title"
|
|
25
|
+
:href="href"
|
|
26
|
+
:button-text="buttonText"
|
|
27
|
+
:is-arrow="isArrow"
|
|
28
|
+
:require-popular-sort="requirePopularSort"
|
|
29
|
+
:button-plus="buttonPlus"
|
|
30
|
+
:rubrique-id="rubriqueId"
|
|
31
|
+
:rubriquage-id="rubriquageId"
|
|
32
|
+
:no-rubriquage-id="noRubriquageId"
|
|
33
|
+
:query="query"
|
|
34
|
+
@update:isArrow="$emit('update:isArrow',$event)"
|
|
35
|
+
/>
|
|
80
36
|
</template>
|
|
81
37
|
|
|
82
38
|
<script lang="ts">
|
|
83
|
-
import { handle403 } from '../../mixins/handle403';
|
|
84
|
-
import octopusApi from '@saooti/octopus-api';
|
|
85
|
-
import domHelper from '../../../helper/dom';
|
|
86
|
-
import PodcastItem from './PodcastItem.vue';
|
|
87
|
-
import ClassicLoading from '../../form/ClassicLoading.vue';
|
|
88
|
-
const PHONE_WIDTH = 960;
|
|
89
39
|
import { state } from '../../../store/paramStore';
|
|
90
|
-
import {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
import { RouteLocationRaw } from 'vue-router';
|
|
94
|
-
import { AxiosError } from 'axios';
|
|
95
|
-
import { Rubrique } from '@/store/class/rubrique/rubrique';
|
|
40
|
+
import { defineAsyncComponent, defineComponent } from 'vue';
|
|
41
|
+
const PodcastInlineListClassic = defineAsyncComponent(() => import('./PodcastInlineListClassic.vue'));
|
|
42
|
+
const PodcastSwiperList = defineAsyncComponent(() => import('./PodcastSwiperList.vue'));
|
|
96
43
|
export default defineComponent({
|
|
97
44
|
name: 'PodcastInlineList',
|
|
98
45
|
|
|
99
46
|
components: {
|
|
100
|
-
|
|
101
|
-
|
|
47
|
+
PodcastInlineListClassic,
|
|
48
|
+
PodcastSwiperList,
|
|
102
49
|
},
|
|
103
|
-
|
|
104
|
-
mixins: [handle403],
|
|
105
|
-
|
|
106
50
|
props: {
|
|
107
51
|
organisationId: { default: undefined, type: String},
|
|
108
52
|
emissionId: { default: undefined, type: Number},
|
|
@@ -119,220 +63,10 @@ export default defineComponent({
|
|
|
119
63
|
query: { default: undefined, type: String},
|
|
120
64
|
},
|
|
121
65
|
emits: ['update:isArrow'],
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
loading: true as boolean,
|
|
126
|
-
loaded: true as boolean,
|
|
127
|
-
index: 0 as number,
|
|
128
|
-
first: 0 as number,
|
|
129
|
-
size: 5 as number,
|
|
130
|
-
totalCount: 0 as number,
|
|
131
|
-
popularSort: false as boolean,
|
|
132
|
-
allPodcasts: [] as Array<Podcast>,
|
|
133
|
-
direction: 1 as number,
|
|
134
|
-
alignLeft: false as boolean,
|
|
135
|
-
};
|
|
136
|
-
},
|
|
137
|
-
computed: {
|
|
138
|
-
podcasts(): Array<Podcast> {
|
|
139
|
-
return this.allPodcasts.slice(this.index, this.index + this.size);
|
|
140
|
-
},
|
|
141
|
-
sizeItem(): number {
|
|
142
|
-
return state.generalParameters.podcastItem ? (state.generalParameters.podcastItem as number): 13;
|
|
143
|
-
},
|
|
144
|
-
overflowScroll(): boolean {
|
|
145
|
-
return (state.emissionPage.overflowScroll as boolean);
|
|
146
|
-
},
|
|
147
|
-
isInlineAnimation(): boolean {
|
|
148
|
-
return (state.generalParameters.isInlineAnimation as boolean);
|
|
149
|
-
},
|
|
150
|
-
filterOrga(): string {
|
|
151
|
-
return this.$store.state.filter.organisationId;
|
|
152
|
-
},
|
|
153
|
-
organisation(): string|undefined {
|
|
154
|
-
if (this.organisationId) return this.organisationId;
|
|
155
|
-
if (this.filterOrga) return this.filterOrga;
|
|
156
|
-
return undefined;
|
|
66
|
+
computed:{
|
|
67
|
+
listTypeClassic(): boolean {
|
|
68
|
+
return (state.podcastPage.listTypeClassic as boolean);
|
|
157
69
|
},
|
|
158
|
-
|
|
159
|
-
if(this.$store.state.filter && this.$store.state.filter.rubriqueFilter && this.$store.state.filter.rubriqueFilter.length){
|
|
160
|
-
return this.$store.state.filter.rubriqueFilter.map((value: RubriquageFilter) => value.rubriquageId+':'+value.rubriqueId).join();
|
|
161
|
-
}
|
|
162
|
-
return undefined;
|
|
163
|
-
},
|
|
164
|
-
refTo(): string | RouteLocationRaw {
|
|
165
|
-
if (this.href) return this.href;
|
|
166
|
-
if(this.iabId){
|
|
167
|
-
return {
|
|
168
|
-
name: 'category',
|
|
169
|
-
params:{ 'iabId': this.iabId },
|
|
170
|
-
query: { productor: this.$store.state.filter.organisationId },
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
return {
|
|
174
|
-
name: 'podcasts',
|
|
175
|
-
query: { productor: this.$store.state.filter.organisationId,
|
|
176
|
-
iabId: this.$store.state.filter.iab ? this.$store.state.filter.iab.id : undefined,
|
|
177
|
-
rubriquesId: this.rubriqueQueryParam },
|
|
178
|
-
};
|
|
179
|
-
},
|
|
180
|
-
previousAvailable(): boolean {
|
|
181
|
-
return this.index > 0;
|
|
182
|
-
},
|
|
183
|
-
nextAvailable(): boolean {
|
|
184
|
-
return this.index + this.size < this.totalCount;
|
|
185
|
-
},
|
|
186
|
-
transitionName(): string {
|
|
187
|
-
return this.direction > 0 ? 'out-left' : 'out-right';
|
|
188
|
-
},
|
|
189
|
-
watchVariable():string{
|
|
190
|
-
return `${this.emissionId}|${this.organisationId}|${this.filterOrga}|${this.iabId}|${this.rubriqueId}|${this.rubriquageId}|${this.query}`;
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
|
-
watch: {
|
|
194
|
-
watchVariable(): void {
|
|
195
|
-
this.reset();
|
|
196
|
-
this.fetchNext();
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
|
|
200
|
-
created() {
|
|
201
|
-
if (undefined !== this.requirePopularSort) {
|
|
202
|
-
this.popularSort = this.requirePopularSort;
|
|
203
|
-
}
|
|
204
|
-
if (undefined !== this.isArrow) {
|
|
205
|
-
this.$emit('update:isArrow', true);
|
|
206
|
-
}
|
|
207
|
-
window.addEventListener('resize', this.handleResize);
|
|
208
|
-
},
|
|
209
|
-
|
|
210
|
-
unmounted() {
|
|
211
|
-
window.removeEventListener('resize', this.handleResize);
|
|
212
|
-
},
|
|
213
|
-
|
|
214
|
-
mounted() {
|
|
215
|
-
this.handleResize();
|
|
216
|
-
this.fetchNext();
|
|
217
|
-
},
|
|
218
|
-
methods: {
|
|
219
|
-
handleSeeMoreButton(event: { preventDefault: () => void; }){
|
|
220
|
-
if(!this.rubriqueId || this.noRubriquageId.length){
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
event.preventDefault();
|
|
224
|
-
const rubriqueChosenId = this.rubriqueId[this.rubriqueId.length - 1];
|
|
225
|
-
let filterToAdd: RubriquageFilter = {
|
|
226
|
-
rubriquageId: 0,
|
|
227
|
-
rubriqueId: rubriqueChosenId,
|
|
228
|
-
nameRubriquage: '',
|
|
229
|
-
nameRubrique: ''
|
|
230
|
-
};
|
|
231
|
-
if(this.$store.state.filter.rubriquageArray.length){
|
|
232
|
-
const rubriqueChosen = this.$store.state.filter.rubriquageArray[this.rubriqueId.length - 1].rubriques.find((element: Rubrique) => element.rubriqueId === rubriqueChosenId);
|
|
233
|
-
filterToAdd = {
|
|
234
|
-
rubriquageId: this.$store.state.filter.rubriquageArray[this.rubriqueId.length - 1].rubriquageId,
|
|
235
|
-
rubriqueId: rubriqueChosenId,
|
|
236
|
-
nameRubriquage: this.$store.state.filter.rubriquageArray[this.rubriqueId.length - 1].title,
|
|
237
|
-
nameRubrique: rubriqueChosen.name
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
const newFilter: Array<RubriquageFilter> = Array.from(this.$store.state.filter.rubriqueFilter);
|
|
241
|
-
newFilter.push(filterToAdd);
|
|
242
|
-
this.$store.commit('filterRubrique', newFilter);
|
|
243
|
-
const queries = this.$route.query;
|
|
244
|
-
const queryString = newFilter.map(value => value.rubriquageId+':'+value.rubriqueId).join();
|
|
245
|
-
this.$router.push({ name: 'podcasts',query: { ...queries, ...{ rubriquesId: queryString }} });
|
|
246
|
-
},
|
|
247
|
-
async fetchNext(): Promise<void> {
|
|
248
|
-
try {
|
|
249
|
-
const data = await octopusApi.fetchPodcasts({
|
|
250
|
-
first: this.first,
|
|
251
|
-
size: this.size + 1,
|
|
252
|
-
organisationId: this.organisation,
|
|
253
|
-
emissionId: this.emissionId,
|
|
254
|
-
iabId: this.iabId,
|
|
255
|
-
rubriqueId: this.rubriqueId.length ?this.rubriqueId:undefined,
|
|
256
|
-
rubriquageId: this.rubriquageId.length ?this.rubriquageId : undefined,
|
|
257
|
-
noRubriquageId: this.noRubriquageId.length ? this.noRubriquageId : undefined,
|
|
258
|
-
sort: this.popularSort ? 'POPULARITY' : 'DATE',
|
|
259
|
-
query: this.query,
|
|
260
|
-
});
|
|
261
|
-
this.loading = false;
|
|
262
|
-
this.loaded = true;
|
|
263
|
-
this.totalCount = data.count;
|
|
264
|
-
if (this.allPodcasts.length + data.result.length < this.totalCount) {
|
|
265
|
-
const nexEl = data.result.pop() as Podcast;
|
|
266
|
-
this.preloadImage(nexEl.imageUrl?nexEl.imageUrl:'');
|
|
267
|
-
}
|
|
268
|
-
this.allPodcasts = this.allPodcasts.concat(
|
|
269
|
-
data.result.filter((pod: Podcast|null) => null !== pod)
|
|
270
|
-
);
|
|
271
|
-
if (this.allPodcasts.length <= 3) {
|
|
272
|
-
this.alignLeft = true;
|
|
273
|
-
} else {
|
|
274
|
-
this.alignLeft = false;
|
|
275
|
-
}
|
|
276
|
-
this.first += this.size;
|
|
277
|
-
} catch (error) {
|
|
278
|
-
this.handle403((error as AxiosError));
|
|
279
|
-
}
|
|
280
|
-
},
|
|
281
|
-
displayPrevious(): void {
|
|
282
|
-
this.direction = -1;
|
|
283
|
-
if (this.previousAvailable) {
|
|
284
|
-
this.index -= 1;
|
|
285
|
-
}
|
|
286
|
-
},
|
|
287
|
-
displayNext(): void {
|
|
288
|
-
this.direction = 1;
|
|
289
|
-
if (!this.nextAvailable) return;
|
|
290
|
-
if (
|
|
291
|
-
this.first - (this.index + this.size) < 2 &&
|
|
292
|
-
this.allPodcasts.length < this.totalCount
|
|
293
|
-
) {
|
|
294
|
-
this.fetchNext();
|
|
295
|
-
}
|
|
296
|
-
this.index += 1;
|
|
297
|
-
},
|
|
298
|
-
handleResize(): void {
|
|
299
|
-
if (!this.$el) return;
|
|
300
|
-
if (this.overflowScroll) {
|
|
301
|
-
this.size = 20;
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
|
-
if (window.innerWidth <= PHONE_WIDTH) {
|
|
305
|
-
this.size = 10;
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
const width = (this.$el as HTMLElement).offsetWidth;
|
|
309
|
-
const sixteen = domHelper.convertRemToPixels(this.sizeItem + 0.7);
|
|
310
|
-
this.size = Math.floor(width / sixteen);
|
|
311
|
-
},
|
|
312
|
-
sortPopular(): void {
|
|
313
|
-
if (this.popularSort) return;
|
|
314
|
-
this.popularSort = true;
|
|
315
|
-
this.reset();
|
|
316
|
-
this.fetchNext();
|
|
317
|
-
},
|
|
318
|
-
sortChrono(): void {
|
|
319
|
-
if (!this.popularSort) return;
|
|
320
|
-
this.popularSort = false;
|
|
321
|
-
this.reset();
|
|
322
|
-
this.fetchNext();
|
|
323
|
-
},
|
|
324
|
-
reset(): void {
|
|
325
|
-
this.loading = true;
|
|
326
|
-
this.loaded = true;
|
|
327
|
-
this.index = 0;
|
|
328
|
-
this.first = 0;
|
|
329
|
-
this.totalCount = 0;
|
|
330
|
-
this.allPodcasts.length = 0;
|
|
331
|
-
},
|
|
332
|
-
preloadImage(url: string): void {
|
|
333
|
-
const img = new Image();
|
|
334
|
-
img.src = url;
|
|
335
|
-
},
|
|
336
|
-
},
|
|
70
|
+
}
|
|
337
71
|
})
|
|
338
72
|
</script>
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<PodcastInlineListTemplate
|
|
3
|
+
v-if="loading || (!loading && 0 !== allPodcasts.length)"
|
|
4
|
+
:display-arrow="true"
|
|
5
|
+
:popular-sort="popularSort"
|
|
6
|
+
:button-text="buttonText"
|
|
7
|
+
:button-plus="buttonPlus"
|
|
8
|
+
:title="title"
|
|
9
|
+
:href="href"
|
|
10
|
+
:iab-id="iabId"
|
|
11
|
+
:rubrique-id="rubriqueId"
|
|
12
|
+
:previous-available="previousAvailable"
|
|
13
|
+
:next-available="nextAvailable"
|
|
14
|
+
:no-rubriquage-id="noRubriquageId"
|
|
15
|
+
@sortChrono="sortChrono"
|
|
16
|
+
@sortPopular="sortPopular"
|
|
17
|
+
@displayPrevious="displayPrevious"
|
|
18
|
+
@displayNext="displayNext"
|
|
19
|
+
>
|
|
20
|
+
<template #list-inline>
|
|
21
|
+
<ClassicLoading
|
|
22
|
+
:loading-text="loading?$t('Loading podcasts ...'):undefined"
|
|
23
|
+
/>
|
|
24
|
+
<transition-group
|
|
25
|
+
v-show="loaded"
|
|
26
|
+
:name="transitionName"
|
|
27
|
+
class="element-list-inline"
|
|
28
|
+
tag="ul"
|
|
29
|
+
:class="[
|
|
30
|
+
alignLeft ? 'justify-content-start' : '',
|
|
31
|
+
overflowScroll ? 'overflowScroll' : '',
|
|
32
|
+
]"
|
|
33
|
+
:css="isInlineAnimation"
|
|
34
|
+
>
|
|
35
|
+
<PodcastItem
|
|
36
|
+
v-for="p in podcasts"
|
|
37
|
+
:key="p.podcastId"
|
|
38
|
+
class="flex-shrink-0 item-phone-margin"
|
|
39
|
+
:podcast="p"
|
|
40
|
+
:class="[alignLeft ? 'me-3' : '']"
|
|
41
|
+
/>
|
|
42
|
+
</transition-group>
|
|
43
|
+
</template>
|
|
44
|
+
</PodcastInlineListTemplate>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script lang="ts">
|
|
48
|
+
import PodcastInlineListTemplate from './PodcastInlineListTemplate.vue';
|
|
49
|
+
import octopusApi from '@saooti/octopus-api';
|
|
50
|
+
import domHelper from '../../../helper/dom';
|
|
51
|
+
import PodcastItem from './PodcastItem.vue';
|
|
52
|
+
import ClassicLoading from '../../form/ClassicLoading.vue';
|
|
53
|
+
const PHONE_WIDTH = 960;
|
|
54
|
+
import { state } from '../../../store/paramStore';
|
|
55
|
+
import { Podcast } from '@/store/class/general/podcast';
|
|
56
|
+
import { defineComponent } from 'vue'
|
|
57
|
+
export default defineComponent({
|
|
58
|
+
name: 'PodcastInlineListClassic',
|
|
59
|
+
|
|
60
|
+
components: {
|
|
61
|
+
PodcastItem,
|
|
62
|
+
ClassicLoading,
|
|
63
|
+
PodcastInlineListTemplate
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
props: {
|
|
67
|
+
organisationId: { default: undefined, type: String},
|
|
68
|
+
emissionId: { default: undefined, type: Number},
|
|
69
|
+
iabId: { default: undefined, type: Number},
|
|
70
|
+
title: { default: '', type: String},
|
|
71
|
+
href: { default: undefined, type: String},
|
|
72
|
+
buttonText: { default: undefined, type: String},
|
|
73
|
+
isArrow: { default: false, type: Boolean},
|
|
74
|
+
requirePopularSort: { default:undefined, type: Boolean},
|
|
75
|
+
buttonPlus: { default:false, type: Boolean},
|
|
76
|
+
rubriqueId: { default: () => [], type: Array as ()=> Array<number> },
|
|
77
|
+
rubriquageId:{ default: () => [], type: Array as ()=> Array<number> },
|
|
78
|
+
noRubriquageId: { default: () => [], type: Array as ()=> Array<number> },
|
|
79
|
+
query: { default: undefined, type: String},
|
|
80
|
+
},
|
|
81
|
+
emits: ['update:isArrow'],
|
|
82
|
+
|
|
83
|
+
data() {
|
|
84
|
+
return {
|
|
85
|
+
loading: true as boolean,
|
|
86
|
+
loaded: true as boolean,
|
|
87
|
+
index: 0 as number,
|
|
88
|
+
first: 0 as number,
|
|
89
|
+
size: 5 as number,
|
|
90
|
+
totalCount: 0 as number,
|
|
91
|
+
popularSort: false as boolean,
|
|
92
|
+
allPodcasts: [] as Array<Podcast>,
|
|
93
|
+
direction: 1 as number,
|
|
94
|
+
alignLeft: false as boolean,
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
computed: {
|
|
98
|
+
podcasts(): Array<Podcast> {
|
|
99
|
+
return this.allPodcasts.slice(this.index, this.index + this.size);
|
|
100
|
+
},
|
|
101
|
+
sizeItem(): number {
|
|
102
|
+
return state.generalParameters.podcastItem ? (state.generalParameters.podcastItem as number): 13;
|
|
103
|
+
},
|
|
104
|
+
overflowScroll(): boolean {
|
|
105
|
+
return (state.emissionPage.overflowScroll as boolean);
|
|
106
|
+
},
|
|
107
|
+
isInlineAnimation(): boolean {
|
|
108
|
+
return (state.generalParameters.isInlineAnimation as boolean);
|
|
109
|
+
},
|
|
110
|
+
filterOrga(): string {
|
|
111
|
+
return this.$store.state.filter.organisationId;
|
|
112
|
+
},
|
|
113
|
+
organisation(): string|undefined {
|
|
114
|
+
if (this.organisationId) return this.organisationId;
|
|
115
|
+
if (this.filterOrga) return this.filterOrga;
|
|
116
|
+
return undefined;
|
|
117
|
+
},
|
|
118
|
+
previousAvailable(): boolean {
|
|
119
|
+
return this.index > 0;
|
|
120
|
+
},
|
|
121
|
+
nextAvailable(): boolean {
|
|
122
|
+
return this.index + this.size < this.totalCount;
|
|
123
|
+
},
|
|
124
|
+
transitionName(): string {
|
|
125
|
+
return this.direction > 0 ? 'out-left' : 'out-right';
|
|
126
|
+
},
|
|
127
|
+
watchVariable():string{
|
|
128
|
+
return `${this.emissionId}|${this.organisationId}|${this.filterOrga}|${this.iabId}|${this.rubriqueId}|${this.rubriquageId}|${this.query}`;
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
watch: {
|
|
132
|
+
watchVariable(): void {
|
|
133
|
+
this.reset();
|
|
134
|
+
this.fetchNext();
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
created() {
|
|
139
|
+
if (undefined !== this.requirePopularSort) {
|
|
140
|
+
this.popularSort = this.requirePopularSort;
|
|
141
|
+
}
|
|
142
|
+
if (undefined !== this.isArrow) {
|
|
143
|
+
this.$emit('update:isArrow', true);
|
|
144
|
+
}
|
|
145
|
+
window.addEventListener('resize', this.handleResize);
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
unmounted() {
|
|
149
|
+
window.removeEventListener('resize', this.handleResize);
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
mounted() {
|
|
153
|
+
this.handleResize();
|
|
154
|
+
this.fetchNext();
|
|
155
|
+
},
|
|
156
|
+
methods: {
|
|
157
|
+
async fetchNext(): Promise<void> {
|
|
158
|
+
const data = await octopusApi.fetchPodcasts({
|
|
159
|
+
first: this.first,
|
|
160
|
+
size: this.size + 1,
|
|
161
|
+
organisationId: this.organisation,
|
|
162
|
+
emissionId: this.emissionId,
|
|
163
|
+
iabId: this.iabId,
|
|
164
|
+
rubriqueId: this.rubriqueId.length ?this.rubriqueId:undefined,
|
|
165
|
+
rubriquageId: this.rubriquageId.length ?this.rubriquageId : undefined,
|
|
166
|
+
noRubriquageId: this.noRubriquageId.length ? this.noRubriquageId : undefined,
|
|
167
|
+
sort: this.popularSort ? 'POPULARITY' : 'DATE',
|
|
168
|
+
query: this.query,
|
|
169
|
+
});
|
|
170
|
+
this.loading = false;
|
|
171
|
+
this.loaded = true;
|
|
172
|
+
this.totalCount = data.count;
|
|
173
|
+
if (this.allPodcasts.length + data.result.length < this.totalCount) {
|
|
174
|
+
const nexEl = data.result.pop() as Podcast;
|
|
175
|
+
if(nexEl){
|
|
176
|
+
this.preloadImage(nexEl.imageUrl?nexEl.imageUrl:'');
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
this.allPodcasts = this.allPodcasts.concat(
|
|
180
|
+
data.result.filter((pod: Podcast|null) => null !== pod)
|
|
181
|
+
);
|
|
182
|
+
if (this.allPodcasts.length <= 3) {
|
|
183
|
+
this.alignLeft = true;
|
|
184
|
+
} else {
|
|
185
|
+
this.alignLeft = false;
|
|
186
|
+
}
|
|
187
|
+
this.first += this.size;
|
|
188
|
+
},
|
|
189
|
+
displayPrevious(): void {
|
|
190
|
+
this.direction = -1;
|
|
191
|
+
if (this.previousAvailable) {
|
|
192
|
+
this.index -= 1;
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
displayNext(): void {
|
|
196
|
+
this.direction = 1;
|
|
197
|
+
if (!this.nextAvailable) return;
|
|
198
|
+
if (
|
|
199
|
+
this.first - (this.index + this.size) < 2 &&
|
|
200
|
+
this.allPodcasts.length < this.totalCount
|
|
201
|
+
) {
|
|
202
|
+
this.fetchNext();
|
|
203
|
+
}
|
|
204
|
+
this.index += 1;
|
|
205
|
+
},
|
|
206
|
+
handleResize(): void {
|
|
207
|
+
if (!this.$el) return;
|
|
208
|
+
if (this.overflowScroll) {
|
|
209
|
+
this.size = 20;
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
if (window.innerWidth <= PHONE_WIDTH) {
|
|
213
|
+
this.size = 10;
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const width = (this.$el as HTMLElement).offsetWidth;
|
|
217
|
+
const sixteen = domHelper.convertRemToPixels(this.sizeItem + 0.7);
|
|
218
|
+
this.size = Math.floor(width / sixteen);
|
|
219
|
+
},
|
|
220
|
+
sortPopular(): void {
|
|
221
|
+
if (this.popularSort) return;
|
|
222
|
+
this.popularSort = true;
|
|
223
|
+
this.reset();
|
|
224
|
+
this.fetchNext();
|
|
225
|
+
},
|
|
226
|
+
sortChrono(): void {
|
|
227
|
+
if (!this.popularSort) return;
|
|
228
|
+
this.popularSort = false;
|
|
229
|
+
this.reset();
|
|
230
|
+
this.fetchNext();
|
|
231
|
+
},
|
|
232
|
+
reset(): void {
|
|
233
|
+
this.loading = true;
|
|
234
|
+
this.loaded = true;
|
|
235
|
+
this.index = 0;
|
|
236
|
+
this.first = 0;
|
|
237
|
+
this.totalCount = 0;
|
|
238
|
+
this.allPodcasts.length = 0;
|
|
239
|
+
},
|
|
240
|
+
preloadImage(url: string): void {
|
|
241
|
+
const img = new Image();
|
|
242
|
+
img.src = url;
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
})
|
|
246
|
+
</script>
|