|
@@ -14,8 +14,14 @@
|
14
|
14
|
<swiper @change="swipeChange" :current="cur" class="swipe">
|
15
|
15
|
<swiper-item @touchmove.stop>
|
16
|
16
|
<view class="btn-check-group padding">
|
17
|
|
- <checkbox-group @change="checkboxChange" class="flex justify-between" style="flex-wrap: wrap;" id="week">
|
18
|
|
- <label class="btn-check-label margin" :class="{ 'bg-light-green': params.week.includes(item.key + '') }" v-for="item in days" :key="item.key">
|
|
17
|
+ <checkbox-group @change="checkboxChange" class="flex justify-between border-bottom" style="flex-wrap: wrap;" id="week">
|
|
18
|
+ <label class="btn-check-label margin" :class="{ 'bg-light-green': params.week.includes(item.key + '') }" v-for="item in days.week" :key="item.key">
|
|
19
|
+ <checkbox :value="item.key" />
|
|
20
|
+ {{ item.value }}
|
|
21
|
+ </label>
|
|
22
|
+ </checkbox-group>
|
|
23
|
+ <checkbox-group @change="checkboxChange" class="flex justify-between" style="flex-wrap: wrap;" id="tuoguan">
|
|
24
|
+ <label class="btn-check-label margin" :class="{ 'bg-light-green': params.week.includes(item.key + '') }" v-for="item in days.tuoguan" :key="item.key">
|
19
|
25
|
<checkbox :value="item.key" />
|
20
|
26
|
{{ item.value }}
|
21
|
27
|
</label>
|
|
@@ -27,8 +33,11 @@
|
27
|
33
|
</swiper-item>
|
28
|
34
|
<swiper-item @touchmove.stop>
|
29
|
35
|
<view class="btn-check-group padding">
|
30
|
|
- <view class="margin">
|
31
|
|
- <input v-model="serachKey" placeholder="输入兴趣内容 如:画画" class="margin-top input-border" @confirm="search" />
|
|
36
|
+ <view class="margin-bottom">
|
|
37
|
+ <view class="flex align-center">
|
|
38
|
+ <input v-model="serachKey" placeholder="输入兴趣内容 如:画画" class="margin-top input-border" @confirm="search" />
|
|
39
|
+ <text class="cuIcon-search margin-left" style="font-size: 36rpx;" @tap="search"></text>
|
|
40
|
+ </view>
|
32
|
41
|
<view class="flex margin-top-sm">
|
33
|
42
|
<view v-for="(h, i) in params.hobbyOther" :key="i" class="hobby"
|
34
|
43
|
>{{ h }}
|
|
@@ -72,11 +81,6 @@
|
72
|
81
|
</view>
|
73
|
82
|
<view v-else>
|
74
|
83
|
<view class="VerticalBox">
|
75
|
|
- <scroll-view class="VerticalNav nav" scroll-y scroll-with-animation :scroll-top="verticalNavTop" :style="'height:calc(100vh - 70px - 40px - ' + topHeader + 'px)'">
|
76
|
|
- <view class="cu-item" :class="index == tabCur ? 'text-green cur' : ''" v-for="(item, index) in attends" :key="index" @tap="TabSelect" :data-id="index">
|
77
|
|
- {{ weekList[index] }}
|
78
|
|
- </view>
|
79
|
|
- </scroll-view>
|
80
|
84
|
<scroll-view
|
81
|
85
|
class="VerticalMain padding-sm"
|
82
|
86
|
scroll-y
|
|
@@ -85,17 +89,17 @@
|
85
|
89
|
:scroll-into-view="'main-' + mainCur"
|
86
|
90
|
@scroll="VerticalMain"
|
87
|
91
|
>
|
88
|
|
- <radio-group @change="changeClass" style="width: 100%;" v-for="(attend, i) in attends" :key="i">
|
89
|
|
- <view class="cu-item bg-white padding margin-bottom-sm" v-for="(item, index) in attend.list" v-show="i == mainCur" :key="index" :id="'main-' + index">
|
|
92
|
+ <checkbox-group style="width: 100%;" v-model="checked">
|
|
93
|
+ <view class="cu-item bg-white padding margin-bottom-sm" v-for="(item, i) in attends" :key="i">
|
90
|
94
|
<view class="cu-bar solid-bottom">
|
91
|
95
|
<view>
|
92
|
|
- <label>
|
|
96
|
+ <label @tap="classChange(item.class_attend_id, i)">
|
93
|
97
|
<view class="flex justify-between align-center">
|
94
|
98
|
<view
|
95
|
99
|
><text>{{ item.attend_name }}</text></view
|
96
|
100
|
>
|
97
|
101
|
<view>
|
98
|
|
- <radio :value="item.class_attend_id" :checked="checked.includes(item.class_attend_id)" class="cyan" style="transform: scale(0.7);" />
|
|
102
|
+ <checkbox :value="item.class_attend_id" :checked="checked.includes(item.class_attend_id)" class="round cyan" style="transform: scale(0.7);" />
|
99
|
103
|
</view>
|
100
|
104
|
</view>
|
101
|
105
|
</label>
|
|
@@ -108,15 +112,15 @@
|
108
|
112
|
<checkbox
|
109
|
113
|
:value="prop.id"
|
110
|
114
|
class="cyan"
|
111
|
|
- :checked="checked_props[mainCur].class_attend_id === item.class_attend_id && checked_props[mainCur].prop.includes(prop.id + '')"
|
112
|
115
|
style="transform: scale(0.7);"
|
|
116
|
+ :checked="checked_props[i].class_attend_id === item.class_attend_id && checked_props[i].prop.includes(prop.id)"
|
113
|
117
|
/>{{ prop.name }}<text>¥{{ prop.money }}</text>
|
114
|
118
|
</view>
|
115
|
119
|
</label>
|
116
|
120
|
</checkbox-group>
|
117
|
121
|
</view>
|
118
|
122
|
</view>
|
119
|
|
- </radio-group>
|
|
123
|
+ </checkbox-group>
|
120
|
124
|
</scroll-view>
|
121
|
125
|
</view>
|
122
|
126
|
<view class="static shadow">
|
|
@@ -141,7 +145,7 @@
|
141
|
145
|
</template>
|
142
|
146
|
|
143
|
147
|
<script>
|
144
|
|
-import { _intelligentDates, _intelligentInterests, _intelligentCourses, _joinShops } from '@/api/course'
|
|
148
|
+import { _intelligentDates, _intelligentInterests, _intelligentCourses, _intelligentGetKeys, _joinShops } from '@/api/course'
|
145
|
149
|
import shopCart from '@/components/shop-cart.vue'
|
146
|
150
|
import { mapGetters } from 'vuex'
|
147
|
151
|
export default {
|
|
@@ -168,7 +172,8 @@ export default {
|
168
|
172
|
days: [], //周期
|
169
|
173
|
interests: [], //兴趣
|
170
|
174
|
attends: [], //课程
|
171
|
|
- weekList: [], //日期
|
|
175
|
+ week: [], //记录日期
|
|
176
|
+ tuoguan: [], //记录托管
|
172
|
177
|
params: {
|
173
|
178
|
week: [],
|
174
|
179
|
hobby: [],
|
|
@@ -211,14 +216,33 @@ export default {
|
211
|
216
|
getHobbyConfig() {
|
212
|
217
|
_intelligentInterests().then(res => {
|
213
|
218
|
// this.interests = res.data
|
214
|
|
- const choose = res.data[5]
|
|
219
|
+ const choose = res.data[res.data.length - 1]
|
215
|
220
|
this.params.hobby = [choose.id]
|
216
|
221
|
this.keys = choose.names
|
217
|
222
|
})
|
218
|
223
|
},
|
219
|
224
|
search() {
|
|
225
|
+ if (!this.serachKey) {
|
|
226
|
+ uni.showToast({
|
|
227
|
+ title: '请输入关键字',
|
|
228
|
+ icon: 'none'
|
|
229
|
+ })
|
|
230
|
+ return false
|
|
231
|
+ }
|
220
|
232
|
this.interests = this.keys.filter(item => item.includes(this.serachKey))
|
221
|
233
|
},
|
|
234
|
+ check_key(key) {
|
|
235
|
+ const params = { week: this.params.week.join(','), student_id: this.kid, keywords: key }
|
|
236
|
+ _intelligentGetKeys(params).then(res => {
|
|
237
|
+ if (res.data.length < 1) {
|
|
238
|
+ uni.showToast({
|
|
239
|
+ title: '未找到相关课程',
|
|
240
|
+ icon: 'none',
|
|
241
|
+ duration: 2000
|
|
242
|
+ })
|
|
243
|
+ }
|
|
244
|
+ })
|
|
245
|
+ },
|
222
|
246
|
get_options() {
|
223
|
247
|
const params = Object.assign({}, this.params)
|
224
|
248
|
params.week = params.week.join(',')
|
|
@@ -227,13 +251,14 @@ export default {
|
227
|
251
|
_intelligentCourses(params).then(res => {
|
228
|
252
|
this.attends = res.data
|
229
|
253
|
this.checked = [] //初始化选项
|
230
|
|
- Object.keys(this.attends).forEach(item => {
|
231
|
|
- const class_attend_id = this.attends[item].list[0].class_attend_id
|
232
|
|
- const prop = this.attends[item].list[0].prop.length > 0 ? [this.attends[item].list[0].prop[0].id + ''] : []
|
233
|
|
- this.$set(this.checked, item, class_attend_id)
|
234
|
|
- this.$set(this.checked_props, item, { class_attend_id: class_attend_id, prop: prop })
|
235
|
|
- })
|
236
|
|
- this.weekList = this.attends.map(item => item.week)
|
|
254
|
+ if (this.attends.length > 0) {
|
|
255
|
+ this.attends.map((item, index) => {
|
|
256
|
+ const class_attend_id = item.class_attend_id
|
|
257
|
+ this.$set(this.checked, index, class_attend_id)
|
|
258
|
+ const prop = item.prop.length > 0 ? [item.prop[0].id] : []
|
|
259
|
+ this.$set(this.checked_props, index, { class_attend_id: class_attend_id, prop: prop })
|
|
260
|
+ })
|
|
261
|
+ }
|
237
|
262
|
})
|
238
|
263
|
},
|
239
|
264
|
delHobby(key) {
|
|
@@ -244,6 +269,7 @@ export default {
|
244
|
269
|
this.params.hobbyOther = this.params.hobbyOther.filter(item => item != key)
|
245
|
270
|
} else {
|
246
|
271
|
this.params.hobbyOther.push(key)
|
|
272
|
+ this.check_key(key)
|
247
|
273
|
}
|
248
|
274
|
},
|
249
|
275
|
checkboxChange(e) {
|
|
@@ -251,7 +277,12 @@ export default {
|
251
|
277
|
const values = e.detail.value
|
252
|
278
|
switch (type) {
|
253
|
279
|
case 'week':
|
254
|
|
- this.params.week = values
|
|
280
|
+ this.week = values
|
|
281
|
+ this.params.week = this.tuoguan.concat(this.week)
|
|
282
|
+ break
|
|
283
|
+ case 'tuoguan':
|
|
284
|
+ this.tuoguan = values
|
|
285
|
+ this.params.week = this.week.concat(this.tuoguan)
|
255
|
286
|
break
|
256
|
287
|
case 'hobby':
|
257
|
288
|
this.params.hobby = values
|
|
@@ -265,7 +296,7 @@ export default {
|
265
|
296
|
uni.showToast({ title: '请先选择周期', icon: 'none' })
|
266
|
297
|
return false
|
267
|
298
|
}
|
268
|
|
- if (index === 2 && this.params.hobby.length < 1) {
|
|
299
|
+ if (index === 2 && this.params.hobbyOther.length < 1) {
|
269
|
300
|
uni.showToast({ title: '请先选择兴趣', icon: 'none' })
|
270
|
301
|
return false
|
271
|
302
|
}
|
|
@@ -282,21 +313,24 @@ export default {
|
282
|
313
|
changeDisableBtn() {
|
283
|
314
|
this.disableBtn = true
|
284
|
315
|
},
|
285
|
|
- changeClass(e) {
|
286
|
|
- const value = Number(e.detail.value)
|
287
|
|
- this.checked[this.mainCur] = value
|
288
|
|
- this.$set(this.checked, this.mainCur, value)
|
289
|
|
- this.$set(this.checked_props, this.mainCur, { class_attend_id: value, prop: [] })
|
290
|
|
- console.log(this.checked_props)
|
|
316
|
+ classChange(class_attend_id, i) {
|
|
317
|
+ if (this.checked.includes(class_attend_id)) {
|
|
318
|
+ this.$set(this.checked, i, null)
|
|
319
|
+ this.$set(this.checked_props, i, { class_attend_id: null, prop: [] })
|
|
320
|
+ } else {
|
|
321
|
+ this.$set(this.checked, i, class_attend_id)
|
|
322
|
+ this.$set(this.checked_props, i, { class_attend_id: class_attend_id, prop: [] })
|
|
323
|
+ }
|
291
|
324
|
},
|
292
|
325
|
propChange(e) {
|
293
|
326
|
const parentId = e.target.dataset.id
|
294
|
|
- const values = e.detail.value
|
295
|
|
- if (!this.checked.includes(parentId)) {
|
296
|
|
- this.$set(this.checked, this.mainCur, parentId)
|
|
327
|
+ const values = e.detail.value.map(item => Number(item))
|
|
328
|
+ if (values.length > 0 && !this.checked.includes(parentId)) {
|
|
329
|
+ this.$set(this.checked, this.checked.length, parentId)
|
297
|
330
|
}
|
|
331
|
+ let index = this.checked.findIndex(e => e == parentId)
|
298
|
332
|
const item = { class_attend_id: parentId, prop: values }
|
299
|
|
- this.$set(this.checked_props, this.mainCur, item)
|
|
333
|
+ this.$set(this.checked_props, index, item)
|
300
|
334
|
},
|
301
|
335
|
TabSelect(e) {
|
302
|
336
|
this.tabCur = e.currentTarget.dataset.id
|
|
@@ -396,6 +430,7 @@ export default {
|
396
|
430
|
}
|
397
|
431
|
}
|
398
|
432
|
.input-border {
|
|
433
|
+ width: 80%;
|
399
|
434
|
height: 80rpx;
|
400
|
435
|
border-radius: 4px;
|
401
|
436
|
border: 1px solid #eee;
|