|
@@ -38,7 +38,7 @@
|
38
|
38
|
<input v-model="serachKey" placeholder="输入兴趣内容 如:画画" class="margin-top input-border" @confirm="search" />
|
39
|
39
|
<text class="cuIcon-search margin-left" style="font-size: 36rpx;" @tap="search"></text>
|
40
|
40
|
</view>
|
41
|
|
- <view class="flex margin-top-sm">
|
|
41
|
+ <view class="margin-top-sm">
|
42
|
42
|
<view v-for="(h, i) in params.hobbyOther" :key="i" class="hobby"
|
43
|
43
|
>{{ h }}
|
44
|
44
|
<text class="cuIcon-close del-hobby text-red" @tap="delHobby(h)"></text>
|
|
@@ -59,7 +59,7 @@
|
59
|
59
|
class="btn-check-label margin"
|
60
|
60
|
:style="{
|
61
|
61
|
color: params.hobbyOther.includes(item) ? '#fff' : '#000',
|
62
|
|
- backgroundColor: params.hobbyOther.includes(item) ? colors[index % 4] : '#f0f0f0'
|
|
62
|
+ backgroundColor: params.hobbyOther.includes(item) ? colors[3] : '#f0f0f0'
|
63
|
63
|
}"
|
64
|
64
|
>
|
65
|
65
|
<checkbox :value="item" />
|
|
@@ -91,34 +91,37 @@
|
91
|
91
|
>
|
92
|
92
|
<checkbox-group style="width: 100%;" v-model="checked">
|
93
|
93
|
<view class="cu-item bg-white padding margin-bottom-sm" v-for="(item, i) in attends" :key="i">
|
94
|
|
- <view class="cu-bar solid-bottom">
|
95
|
|
- <view>
|
96
|
|
- <label @tap="classChange(item.class_attend_id, i)">
|
97
|
|
- <view class="flex justify-between align-center">
|
98
|
|
- <view
|
99
|
|
- ><text>{{ item.attend_name }}</text></view
|
100
|
|
- >
|
|
94
|
+ <view>{{ item.week }}</view>
|
|
95
|
+ <view v-for="(course, c) in item.list" :key="c">
|
|
96
|
+ <view class="cu-bar solid-bottom">
|
|
97
|
+ <view>
|
|
98
|
+ <label @tap="classChange(course.class_attend_id, i)">
|
|
99
|
+ <view class="flex justify-between align-center">
|
|
100
|
+ <view
|
|
101
|
+ ><text>{{ course.attend_name }}</text></view
|
|
102
|
+ >
|
|
103
|
+ <view>
|
|
104
|
+ <checkbox :value="course.class_attend_id" :checked="checked.includes(course.class_attend_id)" class="round cyan" style="transform: scale(0.7);" />
|
|
105
|
+ </view>
|
|
106
|
+ </view>
|
|
107
|
+ </label>
|
|
108
|
+ </view>
|
|
109
|
+ </view>
|
|
110
|
+ <view v-if="course.prop.length > 0">
|
|
111
|
+ <checkbox-group class="checkbox-group margin-top-xs" :data-id="course.class_attend_id" @change="e => propChange(e, i)">
|
|
112
|
+ <label v-for="prop in course.prop" :key="prop.id">
|
101
|
113
|
<view>
|
102
|
|
- <checkbox :value="item.class_attend_id" :checked="checked.includes(item.class_attend_id)" class="round cyan" style="transform: scale(0.7);" />
|
|
114
|
+ <checkbox
|
|
115
|
+ :value="prop.id"
|
|
116
|
+ class="cyan"
|
|
117
|
+ style="transform: scale(0.7);"
|
|
118
|
+ :checked="checked_props[i].class_attend_id === course.class_attend_id && checked_props[i].prop.includes(prop.id)"
|
|
119
|
+ />{{ prop.name }}<text>¥{{ prop.money }}</text>
|
103
|
120
|
</view>
|
104
|
|
- </view>
|
105
|
|
- </label>
|
|
121
|
+ </label>
|
|
122
|
+ </checkbox-group>
|
106
|
123
|
</view>
|
107
|
124
|
</view>
|
108
|
|
- <view v-if="item.prop.length > 0">
|
109
|
|
- <checkbox-group class="checkbox-group margin-top-xs" :data-id="item.class_attend_id" @change="propChange">
|
110
|
|
- <label v-for="prop in item.prop" :key="prop.id">
|
111
|
|
- <view>
|
112
|
|
- <checkbox
|
113
|
|
- :value="prop.id"
|
114
|
|
- class="cyan"
|
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)"
|
117
|
|
- />{{ prop.name }}<text>¥{{ prop.money }}</text>
|
118
|
|
- </view>
|
119
|
|
- </label>
|
120
|
|
- </checkbox-group>
|
121
|
|
- </view>
|
122
|
125
|
</view>
|
123
|
126
|
</checkbox-group>
|
124
|
127
|
</scroll-view>
|
|
@@ -218,7 +221,8 @@ export default {
|
218
|
221
|
// this.interests = res.data
|
219
|
222
|
const choose = res.data[res.data.length - 1]
|
220
|
223
|
this.params.hobby = [choose.id]
|
221
|
|
- this.keys = choose.names
|
|
224
|
+ this.keys = [...new Set(choose.names)].filter(e => e)
|
|
225
|
+ if (this.interests.length < 1) this.interests = this.keys.slice(0, 5)
|
222
|
226
|
})
|
223
|
227
|
},
|
224
|
228
|
search() {
|
|
@@ -249,10 +253,11 @@ export default {
|
249
|
253
|
params.hobby = params.hobby.join(',')
|
250
|
254
|
params.hobbyOther = params.hobbyOther.join(',')
|
251
|
255
|
_intelligentCourses(params).then(res => {
|
252
|
|
- this.attends = res.data
|
|
256
|
+ this.attends = res.data.filter(t => t.list.length > 0)
|
253
|
257
|
this.checked = [] //初始化选项
|
254
|
258
|
if (this.attends.length > 0) {
|
255
|
|
- this.attends.map((item, index) => {
|
|
259
|
+ this.attends.map((course, index) => {
|
|
260
|
+ const item = course.list[0]
|
256
|
261
|
const class_attend_id = item.class_attend_id
|
257
|
262
|
this.$set(this.checked, index, class_attend_id)
|
258
|
263
|
const prop = item.prop.length > 0 ? [item.prop[0].id] : []
|
|
@@ -322,15 +327,14 @@ export default {
|
322
|
327
|
this.$set(this.checked_props, i, { class_attend_id: class_attend_id, prop: [] })
|
323
|
328
|
}
|
324
|
329
|
},
|
325
|
|
- propChange(e) {
|
|
330
|
+ propChange(e, i) {
|
326
|
331
|
const parentId = e.target.dataset.id
|
327
|
332
|
const values = e.detail.value.map(item => Number(item))
|
328
|
333
|
if (values.length > 0 && !this.checked.includes(parentId)) {
|
329
|
|
- this.$set(this.checked, this.checked.length, parentId)
|
|
334
|
+ this.$set(this.checked, i, parentId)
|
330
|
335
|
}
|
331
|
|
- let index = this.checked.findIndex(e => e == parentId)
|
332
|
336
|
const item = { class_attend_id: parentId, prop: values }
|
333
|
|
- this.$set(this.checked_props, index, item)
|
|
337
|
+ this.$set(this.checked_props, i, item)
|
334
|
338
|
},
|
335
|
339
|
TabSelect(e) {
|
336
|
340
|
this.tabCur = e.currentTarget.dataset.id
|
|
@@ -394,13 +398,28 @@ export default {
|
394
|
398
|
}
|
395
|
399
|
.hobby {
|
396
|
400
|
position: relative;
|
|
401
|
+ display: inline-block;
|
397
|
402
|
margin-left: 20rpx;
|
|
403
|
+ padding: 10rpx 40rpx;
|
|
404
|
+ border-radius: 100rpx;
|
|
405
|
+ border: 1px solid #eee;
|
|
406
|
+ color: #fff;
|
|
407
|
+ background-color: #09e294;
|
398
|
408
|
.del-hobby {
|
399
|
409
|
position: absolute;
|
400
|
410
|
top: -6rpx;
|
401
|
411
|
right: -20rpx;
|
402
|
412
|
}
|
403
|
413
|
}
|
|
414
|
+.week-card {
|
|
415
|
+ width: 160rpx;
|
|
416
|
+ height: 100rpx;
|
|
417
|
+ text-align: center;
|
|
418
|
+ line-height: 100rpx;
|
|
419
|
+ border-radius: 20rpx;
|
|
420
|
+ color: #333;
|
|
421
|
+ background-color: #fff;
|
|
422
|
+}
|
404
|
423
|
.interests {
|
405
|
424
|
position: relative;
|
406
|
425
|
.interest {
|