-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
101 lines (88 loc) · 3.01 KB
/
app.js
1
2
3
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
const forteeUri = "https://fortee.jp/phperkaigi-2019/";
const trackId = {
'Track A' : 0,
'Track B' : 1
};
const hashTag = {
'Track A' : '#phperkaigi #a',
'Track B' : '#phperkaigi #b'
};
function createUrl (path) {
return forteeUri + path
}
const router = new VueRouter({
mode: 'history',
routes: [],
})
const app = new Vue({
router,
el: '#app',
data: {
results: [],
isSingle: true,
loading: true,
isMovie: false
},
mounted() {
this.getProposals()
},
methods: {
getProposals() {
let url = createUrl('api/proposals/accepted')
axios.get(url).then(response => {
this.results = response.data.proposals
this.loading = false
})
.catch(error => {
console.log(error)
});
}
},
computed: {
processedProposals() {
this.isMovie = (this.$route.query.is_movie == 1)
let proposals = []
//時間順にソート
this.results = _.orderBy(this.results, ['timetable.starts_at'], ['asc'])
this.results.forEach(proposal => {
//現在時刻
let now = moment().add(this.$route.query.add_min, 'minutes').toISOString()
//let now = moment('2019-03-31T14:39:00+09:00').toISOString()
//終了時間
proposal.timetable.end_at = moment(proposal.timetable.starts_at).add(proposal.timetable.length_min, 'minutes')
let addMin = (proposal.title == 'ランチセッション') ? 40 : 10
//is_movieがtrueだったら現在のセッションを表示
//falseだったら次のセッションを表示
if (
(this.isMovie && moment(proposal.timetable.end_at).add(addMin, 'minutes').isAfter(now) ) ||
(! this.isMovie && moment(proposal.timetable.starts_at).isAfter(now))
) {
//url
proposal.url = createUrl('proposal/' + proposal.uuid)
proposal.hashTag = hashTag[proposal.timetable.track]
//ルームチェック
if (this.$route.query.room) {
if (proposals.length == 0 && proposal.timetable.track == this.$route.query.room)
{
this.isSingle = true;
proposals.push(proposal)
}
}
else {
if (proposals.length < 2) proposals.push(proposal)
}
}
})
this.isSingle = proposals.length < 2
return proposals
}
},
filters: {
moment_time: function (date) {
return moment(date).format('HH:mm')
},
moment_day: function (date) {
return moment(date).format('M/D (ddd)')
}
}
})