SelectionCourse.vue
7.79 KB
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
// 精选课程
<template>
<div id="SelectionCourse">
<!-- <van-search v-model="searchValue" placeholder="请输入课程关键词" @search="reloadData" /> -->
<!-- <van-tabs v-model="active" @click="tabChange">
<van-tab :title="item.text" v-for="(item, index) in typeOption" :key="index"></van-tab>
</van-tabs> -->
<van-tabs v-model="provinceActive" :ellipsis="false" ref="tabs" color="#4092FF" @change="provinceTabChange">
<van-tab :title="item.label" v-for="(item, index) in provinceTabList" :key="index"> </van-tab>
</van-tabs>
<van-list v-if="CourseData.length > 0" v-model="loading" :finished="finished" finished-text="没有更多了"
:immediate-check="false" @load="getCourseData">
<ServiceListSecond :list="CourseData" :courseTypeLableId="typeOption[active].id"></ServiceListSecond>
</van-list>
<van-empty v-if="finished && CourseData.length == 0" :image="require('@/assets/empty.png')" description="暂无活动" />
<van-icon name="back-top" class="backtop" @click="backTop" />
</div>
</template>
<script>
import ServiceListSecond from '@/views/Service/component/ServiceListSecond.vue'
export default {
data () {
return {
pageLoading: true,
pageSize: 10,
pageNum: 1,
loading: false,
finished: false,
searchValue: '',
CourseData: [],
typeOption: [],
active: 0,
provinceTabList: [
{ label: '推荐', text: '', value: 0, id: '' },
{ label: '越城', text: '越城区', value: 2, id: '' },
{ label: '柯桥', text: '柯桥区', value: 1, id: '' },
{ label: '上虞', text: '上虞区', value: 4, id: '' },
{ label: '诸暨', text: '诸暨市', value: 3, id: '' },
{ label: '嵊州', text: '嵊州市', value: 5, id: '' },
{ label: '新昌', text: '新昌县', value: 5, id: '' },
],
provinceActive: 0,
}
},
mounted () {
let userInfo = localStorage.getItem('userInfo')
if (userInfo) {
userInfo = JSON.parse(userInfo)
this.centerNo = userInfo.centerNo
}
// this.getCourseData()
this.getType()
},
methods: {
// 下拉刷新
onRefresh () {
this.pageNum = 1
this.reloadData()
},
reloadData () {
console.log('reloadData')
this.pageNum = 1
this.CourseData = []
this.getCourseData()
},
// 精选活动
getCourseData () {
if (this.pageNum == 1) {
this.$toast.loading({
message: '加载中...',
duration: 0,
forbidClick: true,
})
}
let labelIdList = []
// 频道标签
labelIdList.push(this.typeOption[this.active].id)
let areaName = ''
let startPrice = '-1',
endPrice = '-1'
this.yxAxios
.post(`${this.yanxueUrlNew}/course/getCourseByArea`, {
page: this.pageNum,
pageSize: this.pageSize,
provinceName: '浙江省',
cityName: '绍兴市',
areaName: this.provinceTabList[this.provinceActive].text,
})
// .post(`${this.yanxueUrl}/api/SchoolManage/SchoolCourseListV2`, {
// labelIdList: labelIdList,
// ageType: 0, //适应对象
// days: 0, //线路天数
// isSelfSupport: null, //是否支持定制
// // "provinceName":provinceName,//省份
// // "cityName":cityName,//城市
// areaName: areaName, //区
// startPrice: startPrice,
// endPrice: endPrice,
// courseName: this.searchValue,
// stype:1,
// pageIndex: this.pageNum,
// pageSize: this.pageSize,
// })
.then((res) => {
this.$toast.clear()
if (res.data.code == 200) {
this.loading = false
let CourseData = res.data.rows || []
console.log('活动数据:', CourseData)
if (this.pageSize * this.pageNum >= res.data.total) {
this.finished = true
} else {
this.pageNum++
}
for (let i in CourseData) {
CourseData[i].courseLabels = CourseData[i].courseLabels?.split(',')
if (CourseData[i].startDate) {
CourseData[i].week = this.formatWeek(this.Moment(CourseData[i].startDate).format('d'))
CourseData[i].startDate = this.Moment(CourseData[i].startDate).format('YYYY.M.D')
CourseData[i].endDate = this.Moment(CourseData[i].endDate).format('YYYY.M.D')
}
}
this.CourseData = this.CourseData.concat(CourseData)
} else {
this.finished = true
this.$toast(res.data.msg)
}
})
},
// 获取研学类型
getType () {
// this.yxAxios.post(`http://121.40.30.78:9000/StudyLabelDetail/List`, {
this.yxAxios
.post(`${this.yanxueUrl}/StudyLabelDetail/List`, {
labelGroupId: 11,
belongStation: '浙江省教育厅',
platform: '电脑端',
pageIndex: 1,
pageSize: 10,
})
.then((res) => {
if (res.data.status == 1) {
let data = res.data.data.data
// let typeOption = [{ text: '不限', value: 0, id: '' }]
let typeOption = []
for (let i in data) {
typeOption.push({
text: data[i].labelName,
id: data[i].id,
value: Number(i) + 1,
})
}
console.log('研学类型:', typeOption)
this.typeOption = typeOption
this.getCourseData()
} else {
this.$toast(res.data.message)
}
})
},
// 返回顶部
backTop () {
document.getElementById('SelectionCourse').scrollIntoView()
},
// 格式化星期
formatWeek (week) {
return week == 1
? '周一'
: week == 2
? '周二'
: week == 3
? '周三'
: week == 4
? '周四'
: week == 5
? '周五'
: week == 6
? '周六'
: week == 0
? '周日'
: ''
},
// 改变地区
provinceTabChange () {
this.pageNum = 1
this.CourseData = []
this.getCourseData()
},
tabChange () {
this.pageNum = 1
this.CourseData = []
this.getCourseData()
},
},
components: {
ServiceListSecond,
},
}
</script>
<style lang="scss">
#SelectionCourse {
width: 100%;
min-height: 100%;
background: #fff;
padding-bottom: 40px;
.drop_down_box {
display: flex;
justify-content: space-between;
align-items: center;
.filter {
flex-shrink: 0;
font-size: 28px;
padding: 0 30px;
}
}
.characteristic_label {
white-space: nowrap;
overflow-x: auto;
padding: 0 30px;
padding-top: 20px;
&::-webkit-scrollbar {
display: none;
}
span {
display: inline-block;
padding: 10px;
font-size: 24px;
background: #f5f6fa;
border-radius: 8px;
border: 1px solid #f5f6fa;
margin-right: 12px;
&.active {
background: #ebf4ff;
color: #1373ea;
border-color: #1373ea;
}
}
}
.page_loading {
font-size: 24px;
text-align: center;
padding-top: 40px;
}
.backtop {
position: fixed;
bottom: 100px;
right: 40px;
font-size: 60px;
background: #eee;
border-radius: 10px;
padding: 10px;
}
// .van-tab {
// font-size: 32px;
// }
// .van-dropdown-menu__bar {
// box-shadow: none;
// }
// .van-dropdown-menu__item {
// flex: none;
// width: 180px;
// }
// .van-dropdown-menu__title {
// font-size: 28px;
// color: #999;
// }
// .van-cell {
// color: #999;
// }
}
</style>