-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.txt
220 lines (210 loc) · 7.22 KB
/
demo.txt
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<template>
<div class="main-body">
<div>
<img :src="main_bk_img" class="main_img" />
<dropdownMenu @reverse="reverse" />
<!-- <div class="go-title">
<div class="col-xs-6 go-title-margin" style="background: #eb5557">
<span style="color: #f4a1a2">GQ</span>
<span style="color: white">Pool</span>
</div>
<div class="col-xs-8 col-xs-offset-2 go-title-margin" style="padding: 3px">
<span style="color: #eb5557">GQ</span>
<span>Experiences</span>
</div>
<div class="col-xs-8 go-title-margin">
<span style="color: #eb5557">GQ</span>
<span>FIFA 22</span>
</div>
</div> -->
<!-- search area -->
<div class="searchArea" :style="reserveFlag? 'margin-top: 45px; box-shadow: 0px -6px 10px #d9e7e5;': ''">
<span class="search-title">
Where do you want to go?
</span>
<span class="trips-head">
Popular trips
</span>
<!-- popular trips area -->
<div class="trips-area">
<!-- posted trips -->
<VueSlickCarousel :bind="settings">
<div v-for="post in postTrips" class="amman" :style="{'background': 'url(' + post.image + ')'}">
<div class="trip-area-title">
<span>
{{ post.points[0].json_address.province }}
</span>
<arrowIcon :size="10" :color="'#707070'" />
<span>
{{ post.points[1].json_address.province }}
</span>
<span style="color: #9CD076; float: right; font-weight: bold;">
JD {{ post.payment }}
</span>
</div>
</div>
</VueSlickCarousel>
</div>
<!-- search body -->
<div class="search-body">
<span class="some-span">Somewhere else?</span>
<tripSearch @searchResult="result" />
</div>
<!-- button areas -->
<div class="button-area">
<button class="search-btn" @click="searchNewTrip">
<span>
Search
</span>
<arrowUpIcon />
</button>
<button class="offer-ride" @click="offerRide">
<carIcon :size="20" :color="'#D5E9E8'" style="margin-top: -3px;" />
<span>Offer ride</span>
</button>
</div>
</div>
</div>
<img v-if="loading_flag" class="loading-img" :src="loading_img" />
</div>
</template>
<script>
import { mapActions, mapGetters } from 'vuex';
import VueSlickCarousel from 'vue-slick-carousel';
import 'vue-slick-carousel/dist/vue-slick-carousel.css';
// optional style for arrows & dots
import 'vue-slick-carousel/dist/vue-slick-carousel-theme.css';
import moment from 'moment';
// import components for this
import arrowIcon from '../../icon/ArrowIcon';
import tripSearch from '../sections/TripSearch';
import arrowUpIcon from '../../icon/ArrowUpIcon';
import dropdownMenu from '../../icon/DropdownMenu';
import ratingStarIcon from '../../icon/RatingStarIcon';
import carIcon from '../../icon/CarIcon.vue';
export default {
name: 'main',
data () {
return {
main_bk_img: '/static/img/landing-bg.png',
loading_img: process.env.ROUTE_BASE + 'static/svg/loading.gif',
test_img: process.env.ROUTE_BASE + 'static/img/amman.jpg',
from_town: '',
to_town: '',
date: '',
reserveFlag: false,
postTrips: null,
loading_flag: true,
settings: {
'dots': true,
// 'autoplay': true,
// 'autoplaySpeed': 1000,
// 'pauseOnDotsHover': true,
// 'pauseOnFocus': true,
// 'pauseOnHover': true,
'variableWidth': true,
'arrows': true
}
};
},
components: {
arrowIcon,
tripSearch,
arrowUpIcon,
dropdownMenu,
ratingStarIcon,
carIcon,
VueSlickCarousel
},
methods: {
...mapActions({
getAllUsers: 'auth/getAllUsers',
tripAsDriver: 'myTrips/tripAsDriver',
tripAsPassenger: 'myTrips/tripAsPassenger',
deleteAllTrips: 'userTrips/deleteAllTrips',
review: 'rates/vote'
}),
offerRide: function () {
this.$router.push({name: 'setCarAndId'});
},
searchNewTrip: function () {
let data = {
from_town: this.from_town,
to_town: this.to_town,
date: this.date
};
this.$router.push({name: 'searchResult', params: {data}});
},
result: function (obj) {
this.from_town = obj.from_town;
this.to_town = obj.to_town;
this.date = obj.date;
},
reverse: function () {
this.reserveFlag = !this.reserveFlag;
}
},
computed: {
...mapGetters({
trips: 'myTrips/myTrips',
passengerTrips: 'myTrips/passengerTrips',
getOtherUsersTripsAsDriver: 'userTrips/driverTrip'
})
},
async mounted () {
await this.deleteAllTrips();
await this.getAllUsers();
await this.tripAsDriver();
await this.tripAsPassenger();
this.loading_flag = false;
// save image for each trip
let postTripsData = this.getOtherUsersTripsAsDriver;
console.log('getOtherUsersTripsAsDriver', this.getOtherUsersTripsAsDriver);
postTripsData.forEach(trip => {
trip['image'] = this.test_img;
});
this.postTrips = postTripsData;
console.log('postTrips', this.postTrips);
}
};
</script>
<style>
.main-body {
position: relative;
}
.main-body img {
width: 100%;
height: auto;
}
.go-title {
padding: 8px;
background: #dad8d8;
border: none;
border-radius: 20px;
position: absolute;
bottom: 6vh;
left: 5%;
width: 90%;
opacity: .9;
}
.go-title-margin {
border-radius: 20px;
text-align: center;
color: #000000;
padding: 3px;
font-weight: bold;
}
.go-title> :last-child {
margin-right: 0;
padding-left: 0;
}
.searchArea {
margin-top: -20px;
background: white;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
z-index: 3;
position: absolute;
width: 100%;
}
</style>