3 Commits 859fa17ff8 ... 31ec884af9

Author SHA1 Message Date
  seamwang 31ec884af9 no message 1 year ago
  seamwang 9ada72a4c7 no message 1 year ago
  seamwang 7d9adc80a5 no message 1 year ago

+ 27 - 23
src/api/course.js

@@ -12,27 +12,31 @@ export function _intelligentDates () {
12 12
 export function _intelligentInterests () {
13 13
 	return fetch('/parents/Intelligent/getLigentCategory')
14 14
 }
15
+//智能报课关键词检索
16
+export function _intelligentGetKeys (params) {
17
+	return fetch('/parents/Intelligent/getKeywords', params)
18
+}
15 19
 //智能报课获取课程
16 20
 export function _intelligentCourses (params) {
17 21
 	return fetch('/parents/Intelligent/pickLigentCourse', params)
18 22
 }
19
-// 获取课程筛选选项 parents/Mycourses/advanced_filter
23
+// 获取课程筛选选项
20 24
 export function _filter (params) {
21 25
 	return fetch('/parents/Mycourses/advanced_filter', params)
22 26
 }
23
-// 课程详情 parents/Mycourses/course_details
27
+// 课程详情
24 28
 export function _detail (params) {
25 29
 	return fetch('/parents/Mycourses/course_details', params)
26 30
 }
27
-// 课程套餐详情 parents/Mycourses/course_gift
31
+// 课程套餐详情
28 32
 export function _gift (params) {
29 33
 	return fetch('/parents/Mycourses/course_gift', params)
30 34
 }
31
-// 课程评价 parents/Mycourses/now_details_comment
35
+// 课程评价
32 36
 export function _comments (params) {
33 37
 	return fetch('/parents/Mycourses/now_details_comment', params, 'POST', false)
34 38
 }
35
-// 添加购物车 parents/Commit/join_shop
39
+// 添加购物车
36 40
 export function _joinShop (params, showFail = true) {
37 41
 	return fetch('/parents/Commit/join_shop', params, 'POST', showFail)
38 42
 }
@@ -40,23 +44,23 @@ export function _joinShop (params, showFail = true) {
40 44
 export function _joinShops (params) {
41 45
 	return fetch('/parents/Commit/joinShopMulti', params)
42 46
 }
43
-// 购物车列表 /parents/Shopping/index
47
+// 购物车列表
44 48
 export function _shopList (params) {
45 49
 	return fetch('/parents/Shopping/index', params)
46 50
 }
47
-// 删除购物车 /parents/Shopping/del_shopping
51
+// 删除购物车
48 52
 export function _delShop (params) {
49 53
 	return fetch('/parents/Shopping/del_shopping', params)
50 54
 }
51
-// 生成订单 parents/Commit/order
55
+// 生成订单
52 56
 export function _createOrder (params) {
53 57
 	return fetch('/parents/Commit/order', params)
54 58
 }
55
-// 订单列表 parents/Ordercentre/index
59
+// 订单列表
56 60
 export function _orderCenter (params) {
57 61
 	return fetch('/parents/Ordercentre/index', params)
58 62
 }
59
-// 退课数据 get_dropcourse_byorder
63
+// 退课数据
60 64
 export function _dropList (params) {
61 65
 	return fetch('/parents/dropcourse/get_dropcourse_byorder', params)
62 66
 }
@@ -64,43 +68,43 @@ export function _dropList (params) {
64 68
 export function _payOrder (params) {
65 69
 	return fetch('/parents/pay/payment', params)
66 70
 }
67
-// 取消订单 /parents/Ordercentre/del_order
71
+// 取消订单
68 72
 export function _cancelOrder (params) {
69 73
 	return fetch('/parents/Ordercentre/del_order', params)
70 74
 }
71
-// 进行退课 /parents/dropcourse/to_drop_course
75
+// 进行退课
72 76
 export function _dropCourse (params) {
73 77
 	return fetch('/parents/dropcourse/to_drop_course', params)
74 78
 }
75
-// 历史课程 /parents/Mycourses/course_history
79
+// 历史课程
76 80
 export function _courseHistory (params) {
77 81
 	return fetch('/parents/Mycourses/course_history', params)
78 82
 }
79
-// 我的课程 /parents/Mycourses/course_history
83
+// 我的课程
80 84
 export function _nowCourse (params) {
81 85
 	return fetch('/parents/Mycourses/now_course', params)
82 86
 }
83
-// 课程表 /parents/Mycourses/date_course
87
+// 课程表
84 88
 export function _dateCourse (params) {
85 89
 	return fetch('/parents/Mycourses/date_course', params)
86 90
 }
87
-// 考勤记录 /parents/attendance/get_attendance
91
+// 考勤记录
88 92
 export function _attendance (params) {
89 93
 	return fetch('/parents/attendance/get_attendance', params)
90 94
 }
91
-// 课堂详情 /parents/dailyclass/get_dailyclass_details
95
+// 课堂详情
92 96
 export function _dailiClass (params) {
93 97
 	return fetch('/parents/dailyclass/get_dailyclass_details', params)
94 98
 }
95
-// 安全交接情况 /parents/sign/get_sign
99
+// 安全交接情况
96 100
 export function _getSignIn (params) {
97 101
 	return fetch('/parents/sign/get_sign', params)
98 102
 }
99
-// 进行安全交接 /parents/sign/to_sign
103
+// 进行安全交接
100 104
 export function _toSignIn (params) {
101 105
 	return fetch('/parents/sign/to_sign', params)
102 106
 }
103
-// 进行评价 /parents/Todayclass/comment
107
+// 进行评价
104 108
 export function _tocomment (params) {
105 109
 	return fetch('/parents/Todayclass/comment', params)
106 110
 }
@@ -122,13 +126,13 @@ export function _getStudentFiles (params) {
122 126
 }
123 127
 //获取年级
124 128
 export function _getGrades () {
125
-	return fetch('/parents/init/get_grades')
129
+	return fetch('/parents/student/grade_list')
126 130
 }
127 131
 //获取班级
128 132
 export function _getClasses (params) {
129
-	return fetch('/parents/init/get_classes', params)
133
+	return fetch('/parents/student/class_list', params)
130 134
 }
131 135
 //修改信息
132 136
 export function _fixStudent (params) {
133
-	return fetch('/parents/init/edit_student', params)
137
+	return fetch('/parents/student/update', params)
134 138
 }

+ 113 - 54
src/components/calendar.vue

@@ -1,19 +1,19 @@
1 1
 <template>
2
-<view class='wrap'>
3
-  <view class='header-cal'>
4
-    <view  v-for="(item,index) in date" :key="index">{{item}}<view></view>
2
+  <view class="wrap">
3
+    <view class="header-cal">
4
+      <view v-for="(item, index) in date" :key="index">{{ item }}<view></view> </view>
5 5
     </view>
6
-  </view>
7
-  <view class='date-box'>
8
-    <view v-for="(item,index) in dateArr"  :key="index"   @tap="calendarTap(item,index)">
9
-      <view class="date-head1" :class="[todayIndex===index ? 'operationInProgress' : (showBusiness?item.styleClass:''), {'showOverdue':item.showOverdue}]">
10
-        <view >{{item.dateNum}}</view>
6
+    <view class="date-box">
7
+      <view v-for="(item, index) in dateArr" :key="index" @tap="calendarTap(item, index)">
8
+        <view
9
+          class="date-head1"
10
+          :class="[todayIndex === index ? 'operationInProgress' : showBusiness ? item.styleClass : '', { showOverdue: item.showOverdue, 'date-class': item.dateClass }]"
11
+        >
12
+          <view>{{ item.dateNum }}</view>
13
+        </view>
11 14
       </view>
12 15
     </view>
13
-
14 16
   </view>
15
-</view>
16
-
17 17
 </template>
18 18
 
19 19
 <script>
@@ -27,7 +27,8 @@ export default {
27 27
       type: Number,
28 28
       value: 0
29 29
     },
30
-    showBusiness: { // 是否显示业务标记
30
+    showBusiness: {
31
+      // 是否显示业务标记
31 32
       type: Boolean,
32 33
       default: false
33 34
     }
@@ -36,11 +37,10 @@ export default {
36 37
     return {
37 38
       date: ['日', '一', '二', '三', '四', '五', '六'],
38 39
       dateArr: [],
39
-      todayIndex: -1// 操作索引,默认指向当天
40
+      todayIndex: -1 // 操作索引,默认指向当天
40 41
     }
41 42
   },
42
-  onLoad(options) {
43
-  },
43
+  onLoad(options) {},
44 44
   methods: {
45 45
     calendarTap(item, index) {
46 46
       this.todayIndex = index
@@ -49,7 +49,8 @@ export default {
49 49
     selCalendar(year, month) {
50 50
       this.dateInit(year, month - 1)
51 51
     },
52
-    setAttendance(attendance) { // 设置日历考勤
52
+    setAttendance(attendance) {
53
+      // 设置日历考勤
53 54
       const start = this.dateArr.findIndex(item => item.dateNum)
54 55
       attendance.map((item, index) => {
55 56
         if (item !== 'stateless') {
@@ -60,6 +61,12 @@ export default {
60 61
         }
61 62
       })
62 63
     },
64
+    setClass(days) {
65
+      //区分有课日期
66
+      this.dateArr.map(item => {
67
+        this.$set(item, 'dateClass', days.includes(item.dateNum))
68
+      })
69
+    },
63 70
     dateInit(setYear, setMonth) {
64 71
       // 1.获取当前时间
65 72
       var date = new Date()
@@ -74,7 +81,7 @@ export default {
74 81
       const year = setYear || now.getFullYear()
75 82
       let nextYear = 0
76 83
       const month = setMonth || now.getMonth() // 没有+1方便后面计算当月总天数
77
-      const nextMonth = (month + 1) > 11 ? 1 : (month + 1)
84
+      const nextMonth = month + 1 > 11 ? 1 : month + 1
78 85
       const startWeek = new Date(year + '/' + (month + 1) + '/' + 1).getDay() // 目标月1号对应的星期
79 86
       let dayNums = new Date(year, nextMonth, 0).getDate() // 获取目标月有多少天
80 87
       let obj = {}
@@ -115,7 +122,7 @@ export default {
115 122
 </script>
116 123
 
117 124
 <style lang="scss" scoped>
118
-.date-show{
125
+.date-show {
119 126
   position: relative;
120 127
   width: 250rpx;
121 128
   font-family: PingFang-SC-Regular;
@@ -124,28 +131,30 @@ export default {
124 131
   text-align: center;
125 132
   margin: 59rpx auto 10rpx;
126 133
 }
127
-.lt-arrow,.rt-arrow{
134
+.lt-arrow,
135
+.rt-arrow {
128 136
   position: absolute;
129 137
   top: 1rpx;
130 138
   width: 60rpx;
131 139
   height: 60rpx;
132 140
 }
133
-.lt-arrow image,.rt-arrow image{
141
+.lt-arrow image,
142
+.rt-arrow image {
134 143
   width: 14rpx;
135 144
   height: 26rpx;
136 145
 }
137
-.lt-arrow{
146
+.lt-arrow {
138 147
   left: -110rpx;
139 148
   transform: rotate(180deg);
140 149
 }
141
-.rt-arrow{
150
+.rt-arrow {
142 151
   right: -100rpx;
143 152
 }
144
-.header-cal{
153
+.header-cal {
145 154
   font-size: 0;
146 155
   /* padding: 0 24rpx;  */
147 156
 }
148
-.header-cal>view{
157
+.header-cal > view {
149 158
   display: inline-block;
150 159
   width: 14.285%;
151 160
   color: #5fd0e4;
@@ -154,21 +163,21 @@ export default {
154 163
   /* border-bottom: 1px solid #D0D0D0;  */
155 164
   padding: 39rpx 0;
156 165
 }
157
-.weekMark{
166
+.weekMark {
158 167
   position: relative;
159 168
 }
160
-.weekMark view{
169
+.weekMark view {
161 170
   position: absolute;
162 171
   bottom: 0;
163 172
   left: 0;
164 173
   width: 100%;
165
-  border-bottom: 1px solid #22A7F6;
174
+  border-bottom: 1px solid #22a7f6;
166 175
 }
167
-.date-box{
176
+.date-box {
168 177
   font-size: 0;
169 178
   padding: 10rpx 0;
170 179
 }
171
-.date-box>view{
180
+.date-box > view {
172 181
   position: relative;
173 182
   display: inline-block;
174 183
   width: 14.285%;
@@ -178,56 +187,106 @@ export default {
178 187
   vertical-align: middle;
179 188
   margin: 15rpx 0;
180 189
 }
181
-.date-head1{
190
+.date-head1 {
191
+  position: relative;
182 192
   height: 60rpx;
183 193
   line-height: 60rpx;
184 194
   font-size: 26rpx;
185 195
   border-radius: 12rpx;
196
+  color: #ccc;
186 197
 }
187
-.date-head2{
188
-  background: #20BA96;
198
+.date-head2 {
199
+  background: #20ba96;
189 200
   color: #fff;
190 201
   height: 60rpx;
191 202
   line-height: 60rpx;
192 203
   font-size: 26rpx;
193 204
   border-radius: 12rpx;
194 205
 }
195
-.date-weight{
206
+.date-class {
207
+  color: #000;
208
+}
209
+.date-weight {
196 210
   font-size: 22rpx;
197 211
   padding: 15rpx 0;
198 212
 }
199
-.nowDay .date-weight{
200
-  color: #22A7F6;
213
+.nowDay .date-weight {
214
+  color: #22a7f6;
201 215
 }
202 216
 /* 过期样式*/
203
-.showOverdue{
217
+.showOverdue {
204 218
   color: #5fd0e4;
205 219
 }
206 220
 /* 正在操作样式*/
207
-.operationInProgress{
208
-  background: #20BA96;
209
-  color: #fff;
221
+.operationInProgress {
222
+  // background: #20ba96;
223
+  // color: #fff;
224
+  color: #20ba96;
210 225
 }
211 226
 /* 正常样式*/
212
-.normal{
213
-  background:  #4DB8E4;
214
-  color: #fff;
227
+.normal {
228
+  // background: #4db8e4;
229
+  // color: #fff;
230
+  &:after {
231
+    content: '';
232
+    position: absolute;
233
+    bottom: 0;
234
+    right: 0;
235
+    width: 0;
236
+    height: 0;
237
+    border-color: #39b54a transparent;
238
+    border-width: 0 0 12px 12px;
239
+    border-style: solid;
240
+  }
215 241
 }
216 242
 /* 异常样式*/
217
-.abnormal{
218
-  background:  #FF7361;
219
-  color: #fff;
243
+.abnormal {
244
+  // background: #ff7361;
245
+  // color: #fff;
246
+  &:after {
247
+    content: '';
248
+    position: absolute;
249
+    bottom: 0;
250
+    right: 0;
251
+    width: 0;
252
+    height: 0;
253
+    border-color: #ff7361 transparent;
254
+    border-width: 0 0 12px 12px;
255
+    border-style: solid;
256
+  }
220 257
 }
221
-.leave{
222
-	background:#3390F5;
223
-	color: #fff;
258
+.leave {
259
+  // background: #3390f5;
260
+  // color: #fff;
261
+  &:after {
262
+    content: '';
263
+    position: absolute;
264
+    bottom: 0;
265
+    right: 0;
266
+    width: 0;
267
+    height: 0;
268
+    border-color: #3390f5 transparent;
269
+    border-width: 0 0 12px 12px;
270
+    border-style: solid;
271
+  }
224 272
 }
225
-.late{
226
-	background:#fbbd08;
227
-	color: #fff;
273
+.late {
274
+  // background: #fbbd08;
275
+  // color: #fff;
276
+  &:after {
277
+    content: '';
278
+    position: absolute;
279
+    bottom: 0;
280
+    right: 0;
281
+    width: 0;
282
+    height: 0;
283
+    border-color: #fbbd08 transparent;
284
+    border-width: 0 0 12px 12px;
285
+    border-style: solid;
286
+  }
228 287
 }
229
-.absenteeism{
230
-	background:#e54d42;
231
-	color: #fff;
288
+.absenteeism {
289
+  background: #e54d42;
290
+  color: #fff;
232 291
 }
233 292
 </style>

+ 162 - 68
src/pages/class/gift.vue

@@ -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,22 +33,37 @@
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="params.hobbyOther" placeholder="输入兴趣内容  如:画画" class="margin-top input-border" />
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>
41
+              <view class="margin-top-sm">
42
+                <view v-for="(h, i) in params.hobbyOther" :key="i" class="hobby"
43
+                  >{{ h }}
44
+                  <text class="cuIcon-close del-hobby text-red" @tap="delHobby(h)"></text>
45
+                </view>
46
+              </view>
32 47
             </view>
33
-            <view class="interests">
48
+            <view class="interests" v-if="interests.length > 0">
34 49
               <img src="/static/imgs/intelligent-bg.png" mode="widthFix" alt="" />
35
-              <checkbox-group @change="checkboxChange" id="hobby">
36
-                <view v-for="(item, index) in interests" :key="item.id" :style="[{ top: index * 80 + 'rpx', left: (index % 2) * 320 + index * 40 + 'rpx' }]" class="interest">
50
+              <checkbox-group id="hobby">
51
+                <view
52
+                  v-for="(item, index) in interests"
53
+                  :key="index"
54
+                  :style="[{ top: index * 80 + 'rpx', left: (index % 2) * 320 + index * 40 + 'rpx' }]"
55
+                  @tap="chooseInterest(item)"
56
+                  class="interest"
57
+                >
37 58
                   <label
38 59
                     class="btn-check-label margin"
39 60
                     :style="{
40
-                      color: params.hobby.includes(item.id + '') ? '#fff' : '#000',
41
-                      backgroundColor: params.hobby.includes(item.id + '') ? colors[index % 4] : '#f0f0f0'
61
+                      color: params.hobbyOther.includes(item) ? '#fff' : '#000',
62
+                      backgroundColor: params.hobbyOther.includes(item) ? colors[3] : '#f0f0f0'
42 63
                     }"
43 64
                   >
44
-                    <checkbox :value="item.id" />
45
-                    {{ item.name }}
65
+                    <checkbox :value="item" />
66
+                    {{ item }}
46 67
                   </label>
47 68
                   <text class="cuIcon-title" :style="[{ color: colors[index % 4] }]"></text>
48 69
                 </view>
@@ -60,11 +81,6 @@
60 81
           </view>
61 82
           <view v-else>
62 83
             <view class="VerticalBox">
63
-              <scroll-view class="VerticalNav nav" scroll-y scroll-with-animation :scroll-top="verticalNavTop" :style="'height:calc(100vh - 70px - 40px - ' + topHeader + 'px)'">
64
-                <view class="cu-item" :class="index == tabCur ? 'text-green cur' : ''" v-for="(item, index) in attends" :key="index" @tap="TabSelect" :data-id="index">
65
-                  {{ weekList[index] }}
66
-                </view>
67
-              </scroll-view>
68 84
               <scroll-view
69 85
                 class="VerticalMain padding-sm"
70 86
                 scroll-y
@@ -73,38 +89,41 @@
73 89
                 :scroll-into-view="'main-' + mainCur"
74 90
                 @scroll="VerticalMain"
75 91
               >
76
-                <radio-group @change="changeClass" style="width: 100%;" v-for="(attend, i) in attends" :key="i">
77
-                  <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">
78
-                    <view class="cu-bar solid-bottom">
79
-                      <view>
80
-                        <label>
81
-                          <view class="flex justify-between align-center">
82
-                            <view
83
-                              ><text>{{ item.attend_name }}</text></view
84
-                            >
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">
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">
85 113
                             <view>
86
-                              <radio :value="item.class_attend_id" :checked="checked.includes(item.class_attend_id)" class="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>
87 120
                             </view>
88
-                          </view>
89
-                        </label>
121
+                          </label>
122
+                        </checkbox-group>
90 123
                       </view>
91 124
                     </view>
92
-                    <view v-if="item.prop.length > 0">
93
-                      <checkbox-group class="checkbox-group margin-top-xs" :data-id="item.class_attend_id" @change="propChange">
94
-                        <label v-for="prop in item.prop" :key="prop.id">
95
-                          <view>
96
-                            <checkbox
97
-                              :value="prop.id"
98
-                              class="cyan"
99
-                              :checked="checked_props[mainCur].class_attend_id === item.class_attend_id && checked_props[mainCur].prop.includes(prop.id + '')"
100
-                              style="transform: scale(0.7);"
101
-                            />{{ prop.name }}<text>¥{{ prop.money }}</text>
102
-                          </view>
103
-                        </label>
104
-                      </checkbox-group>
105
-                    </view>
106 125
                   </view>
107
-                </radio-group>
126
+                </checkbox-group>
108 127
               </scroll-view>
109 128
             </view>
110 129
             <view class="static shadow">
@@ -129,7 +148,7 @@
129 148
 </template>
130 149
 
131 150
 <script>
132
-import { _intelligentDates, _intelligentInterests, _intelligentCourses, _joinShops } from '@/api/course'
151
+import { _intelligentDates, _intelligentInterests, _intelligentCourses, _intelligentGetKeys, _joinShops } from '@/api/course'
133 152
 import shopCart from '@/components/shop-cart.vue'
134 153
 import { mapGetters } from 'vuex'
135 154
 export default {
@@ -151,15 +170,18 @@ export default {
151 170
         }
152 171
       ],
153 172
       cur: 0,
173
+      serachKey: '', //关键字搜素
174
+      keys: [], //兴趣选项
154 175
       days: [], //周期
155 176
       interests: [], //兴趣
156 177
       attends: [], //课程
157
-      weekList: [], //日期
178
+      week: [], //记录日期
179
+      tuoguan: [], //记录托管
158 180
       params: {
159 181
         week: [],
160 182
         hobby: [],
161 183
         student_id: '',
162
-        hobbyOther: ''
184
+        hobbyOther: []
163 185
       },
164 186
       tabCur: 0,
165 187
       mainCur: 0,
@@ -196,31 +218,76 @@ export default {
196 218
     },
197 219
     getHobbyConfig() {
198 220
       _intelligentInterests().then(res => {
199
-        this.interests = res.data
221
+        // this.interests = res.data
222
+        const choose = res.data[res.data.length - 1]
223
+        this.params.hobby = [choose.id]
224
+        this.keys = [...new Set(choose.names)].filter(e => e)
225
+        if (this.interests.length < 1) this.interests = this.keys.slice(0, 5)
226
+      })
227
+    },
228
+    search() {
229
+      if (!this.serachKey) {
230
+        uni.showToast({
231
+          title: '请输入关键字',
232
+          icon: 'none'
233
+        })
234
+        return false
235
+      }
236
+      this.interests = this.keys.filter(item => item.includes(this.serachKey))
237
+    },
238
+    check_key(key) {
239
+      const params = { week: this.params.week.join(','), student_id: this.kid, keywords: key }
240
+      _intelligentGetKeys(params).then(res => {
241
+        if (res.data.length < 1) {
242
+          uni.showToast({
243
+            title: '未找到相关课程',
244
+            icon: 'none',
245
+            duration: 2000
246
+          })
247
+        }
200 248
       })
201 249
     },
202 250
     get_options() {
203 251
       const params = Object.assign({}, this.params)
204 252
       params.week = params.week.join(',')
205 253
       params.hobby = params.hobby.join(',')
254
+      params.hobbyOther = params.hobbyOther.join(',')
206 255
       _intelligentCourses(params).then(res => {
207
-        this.attends = res.data
256
+        this.attends = res.data.filter(t => t.list.length > 0)
208 257
         this.checked = [] //初始化选项
209
-        Object.keys(this.attends).forEach(item => {
210
-          const class_attend_id = this.attends[item].list[0].class_attend_id
211
-          const prop = this.attends[item].list[0].prop.length > 0 ? [this.attends[item].list[0].prop[0].id + ''] : []
212
-          this.$set(this.checked, item, class_attend_id)
213
-          this.$set(this.checked_props, item, { class_attend_id: class_attend_id, prop: prop })
214
-        })
215
-        this.weekList = this.attends.map(item => item.week)
258
+        if (this.attends.length > 0) {
259
+          this.attends.map((course, index) => {
260
+            const item = course.list[0]
261
+            const class_attend_id = item.class_attend_id
262
+            this.$set(this.checked, index, class_attend_id)
263
+            const prop = item.prop.length > 0 ? [item.prop[0].id] : []
264
+            this.$set(this.checked_props, index, { class_attend_id: class_attend_id, prop: prop })
265
+          })
266
+        }
216 267
       })
217 268
     },
269
+    delHobby(key) {
270
+      this.params.hobbyOther = this.params.hobbyOther.filter(item => item != key)
271
+    },
272
+    chooseInterest(key) {
273
+      if (this.params.hobbyOther.includes(key)) {
274
+        this.params.hobbyOther = this.params.hobbyOther.filter(item => item != key)
275
+      } else {
276
+        this.params.hobbyOther.push(key)
277
+        this.check_key(key)
278
+      }
279
+    },
218 280
     checkboxChange(e) {
219 281
       const type = e.target.id
220 282
       const values = e.detail.value
221 283
       switch (type) {
222 284
         case 'week':
223
-          this.params.week = values
285
+          this.week = values
286
+          this.params.week = this.tuoguan.concat(this.week)
287
+          break
288
+        case 'tuoguan':
289
+          this.tuoguan = values
290
+          this.params.week = this.week.concat(this.tuoguan)
224 291
           break
225 292
         case 'hobby':
226 293
           this.params.hobby = values
@@ -234,7 +301,7 @@ export default {
234 301
         uni.showToast({ title: '请先选择周期', icon: 'none' })
235 302
         return false
236 303
       }
237
-      if (index === 2 && this.params.hobby.length < 1) {
304
+      if (index === 2 && this.params.hobbyOther.length < 1) {
238 305
         uni.showToast({ title: '请先选择兴趣', icon: 'none' })
239 306
         return false
240 307
       }
@@ -251,21 +318,23 @@ export default {
251 318
     changeDisableBtn() {
252 319
       this.disableBtn = true
253 320
     },
254
-    changeClass(e) {
255
-      const value = Number(e.detail.value)
256
-      this.checked[this.mainCur] = value
257
-      this.$set(this.checked, this.mainCur, value)
258
-      this.$set(this.checked_props, this.mainCur, { class_attend_id: value, prop: [] })
259
-      console.log(this.checked_props)
321
+    classChange(class_attend_id, i) {
322
+      if (this.checked.includes(class_attend_id)) {
323
+        this.$set(this.checked, i, null)
324
+        this.$set(this.checked_props, i, { class_attend_id: null, prop: [] })
325
+      } else {
326
+        this.$set(this.checked, i, class_attend_id)
327
+        this.$set(this.checked_props, i, { class_attend_id: class_attend_id, prop: [] })
328
+      }
260 329
     },
261
-    propChange(e) {
330
+    propChange(e, i) {
262 331
       const parentId = e.target.dataset.id
263
-      const values = e.detail.value
264
-      if (!this.checked.includes(parentId)) {
265
-        this.$set(this.checked, this.mainCur, parentId)
332
+      const values = e.detail.value.map(item => Number(item))
333
+      if (values.length > 0 && !this.checked.includes(parentId)) {
334
+        this.$set(this.checked, i, parentId)
266 335
       }
267 336
       const item = { class_attend_id: parentId, prop: values }
268
-      this.$set(this.checked_props, this.mainCur, item)
337
+      this.$set(this.checked_props, i, item)
269 338
     },
270 339
     TabSelect(e) {
271 340
       this.tabCur = e.currentTarget.dataset.id
@@ -327,6 +396,30 @@ export default {
327 396
     }
328 397
   }
329 398
 }
399
+.hobby {
400
+  position: relative;
401
+  display: inline-block;
402
+  margin-left: 20rpx;
403
+  padding: 10rpx 40rpx;
404
+  border-radius: 100rpx;
405
+  border: 1px solid #eee;
406
+  color: #fff;
407
+  background-color: #09e294;
408
+  .del-hobby {
409
+    position: absolute;
410
+    top: -6rpx;
411
+    right: -20rpx;
412
+  }
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
+}
330 423
 .interests {
331 424
   position: relative;
332 425
   .interest {
@@ -356,6 +449,7 @@ export default {
356 449
   }
357 450
 }
358 451
 .input-border {
452
+  width: 80%;
359 453
   height: 80rpx;
360 454
   border-radius: 4px;
361 455
   border: 1px solid #eee;

+ 0 - 229
src/pages/class/gift1.vue

@@ -1,229 +0,0 @@
1
-<template>
2
-  <view>
3
-    <cu-custom :isBack="true" title="一键报课"></cu-custom>
4
-    <view class="VerticalBox">
5
-      <scroll-view class="VerticalNav nav" scroll-y scroll-with-animation :scroll-top="verticalNavTop" :style="'height:calc(100vh - 70px - ' + topHeader + 'px)'">
6
-        <view class="cu-item" :class="index == tabCur ? 'text-green cur' : ''" v-for="(item, index) in attends" :key="index" @tap="TabSelect" :data-id="index">
7
-          {{ weekList[index] }}
8
-        </view>
9
-      </scroll-view>
10
-      <scroll-view
11
-        class="VerticalMain padding-sm"
12
-        scroll-y
13
-        scroll-with-animation
14
-        :style="'height:calc(100vh - 70px - ' + topHeader + 'px)'"
15
-        :scroll-into-view="'main-' + mainCur"
16
-        @scroll="VerticalMain"
17
-      >
18
-        <radio-group @change="changeClass" style="width: 100%;" v-for="(attend, i) in attends" :key="i">
19
-          <view class="cu-item bg-white padding margin-bottom-sm" v-for="(item, index) in attend" v-show="i == mainCur" :key="index" :id="'main-' + index">
20
-            <view class="cu-bar solid-bottom">
21
-              <view>
22
-                <label>
23
-                  <view class="flex justify-between align-center">
24
-                    <view
25
-                      ><text>{{ item.attend_name }}</text></view
26
-                    >
27
-                    <view>
28
-                      <radio
29
-                        :value="item.class_attend_id"
30
-                        :disabled="!item.enable"
31
-                        :class="{ disabled: !item.enable }"
32
-                        :checked="checked.includes(item.class_attend_id)"
33
-                        class="cyan"
34
-                        style="transform: scale(0.7);"
35
-                      />
36
-                    </view>
37
-                  </view>
38
-                </label>
39
-              </view>
40
-            </view>
41
-            <view v-if="item.prop.length > 0">
42
-              <checkbox-group class="checkbox-group margin-top-xs" :data-id="item.class_attend_id" @change="propChange">
43
-                <label v-for="prop in item.prop" :key="prop.id">
44
-                  <view>
45
-                    <checkbox
46
-                      :value="prop.id"
47
-                      :disabled="!item.enable"
48
-                      :class="{ disabled: !item.enable }"
49
-                      :checked="checked_props[mainCur].class_attend_id === item.class_attend_id && checked_props[mainCur].prop.includes(prop.id + '')"
50
-                      class="cyan"
51
-                      style="transform: scale(0.7);"
52
-                    />{{ prop.name }}<text>¥{{ prop.money }}</text>
53
-                  </view>
54
-                </label>
55
-              </checkbox-group>
56
-            </view>
57
-          </view>
58
-        </radio-group>
59
-      </scroll-view>
60
-    </view>
61
-    <view class="static shadow">
62
-      <view class="static-order flex">
63
-        <shop-cart :class_attend_id="attend_id" @changeDisableBtn="changeDisableBtn"></shop-cart>
64
-        <button class="cu-btn round bg-student text-white margin-left-xs" @tap="addCart">报课</button>
65
-      </view>
66
-    </view>
67
-  </view>
68
-</template>
69
-
70
-<script>
71
-import { _gift, _joinShops } from '@/api/course'
72
-import { mapGetters } from 'vuex'
73
-import shopCart from '@/components/shop-cart.vue'
74
-export default {
75
-  components: {
76
-    shopCart
77
-  },
78
-  data() {
79
-    return {
80
-      topHeader: this.globalCustomBarHeight,
81
-      package_id: 0,
82
-      attends: [],
83
-      weekList: [],
84
-      attend_id: 0, // 添加成功课程
85
-      checked: [], // 选中
86
-      checked_props: [], // 选中工具
87
-      tabCur: 1,
88
-      mainCur: 1,
89
-      verticalNavTop: 0,
90
-      disableBtn: false // 避免多次重复点击
91
-    }
92
-  },
93
-  computed: {
94
-    ...mapGetters(['kid'])
95
-  },
96
-  onLoad(options) {
97
-    const id = decodeURIComponent(options.package_id)
98
-    this.package_id = id
99
-    this.init()
100
-  },
101
-  onShow() {
102
-    this.disableBtn = false
103
-  },
104
-  methods: {
105
-    init() {
106
-      _gift({ class_package_id: this.package_id }).then(res => {
107
-        this.attends = res.data.attends
108
-        Object.keys(this.attends).forEach(item => {
109
-          this.$set(this.checked_props, item, { prop: [] })
110
-        })
111
-        this.weekList = res.data.week_list
112
-      })
113
-    },
114
-    changeDisableBtn() {
115
-      this.disableBtn = true
116
-    },
117
-    addCart() {
118
-      if (this.disableBtn) return false
119
-      this.disableBtn = true
120
-      const _self = this
121
-      const list = this.checked_props
122
-        .filter(item => item.class_attend_id)
123
-        .map(item => {
124
-          return {
125
-            class_attend_id: item.class_attend_id,
126
-            prop: item.prop.join(','),
127
-            student_id: this.kid
128
-          }
129
-        })
130
-      if (list.length < 1) {
131
-        uni.showToast({ title: '请先选择课程', icon: 'none' })
132
-        this.disableBtn = false
133
-        return false
134
-      }
135
-      _joinShops({ list }).then(res => {
136
-        if (res.code === 1) {
137
-          _self.globalNavigateTo('classCart')
138
-        } else {
139
-          this.disableBtn = false
140
-        }
141
-      })
142
-    },
143
-    TabSelect(e) {
144
-      this.tabCur = e.currentTarget.dataset.id
145
-      this.mainCur = e.currentTarget.dataset.id
146
-      this.verticalNavTop = (e.currentTarget.dataset.id - 1) * 50
147
-    },
148
-    changeClass(e) {
149
-      const value = Number(e.detail.value)
150
-      this.checked[this.mainCur] = value
151
-      this.$set(this.checked, this.mainCur, value)
152
-      this.$set(this.checked_props, this.mainCur, { class_attend_id: value, prop: [] })
153
-    },
154
-    propChange(e) {
155
-      const parentId = e.target.dataset.id
156
-      const values = e.detail.value
157
-      if (!this.checked.includes(parentId)) {
158
-        this.$set(this.checked, this.mainCur, parentId)
159
-      }
160
-      const item = { class_attend_id: parentId, prop: values }
161
-      this.$set(this.checked_props, this.mainCur, item)
162
-    },
163
-    VerticalMain(e) {}
164
-  }
165
-}
166
-</script>
167
-
168
-<style lang="scss" scoped>
169
-::v-deep radio.disabled::before,
170
-::v-deep checkbox.disabled::before {
171
-  color: #e1e1e1 !important;
172
-}
173
-.static {
174
-  position: fixed;
175
-  left: 0;
176
-  right: 0;
177
-  bottom: 0;
178
-  display: flex;
179
-  background: #fff;
180
-  height: 70px;
181
-  align-items: center;
182
-  padding: 0 0.8rem;
183
-  justify-content: flex-end;
184
-}
185
-.fixed {
186
-  position: fixed;
187
-  z-index: 99;
188
-}
189
-.VerticalNav.nav {
190
-  width: 200upx;
191
-  white-space: initial;
192
-}
193
-
194
-.VerticalNav.nav .cu-item {
195
-  width: 100%;
196
-  text-align: center;
197
-  background-color: #fff;
198
-  margin: 0;
199
-  border: none;
200
-  height: 50px;
201
-  position: relative;
202
-}
203
-
204
-.VerticalNav.nav .cu-item.cur {
205
-  background-color: #f1f1f1;
206
-}
207
-
208
-.VerticalNav.nav .cu-item.cur::after {
209
-  content: '';
210
-  width: 8upx;
211
-  height: 30upx;
212
-  border-radius: 10upx 0 0 10upx;
213
-  position: absolute;
214
-  background-color: currentColor;
215
-  top: 0;
216
-  right: 0upx;
217
-  bottom: 0;
218
-  margin: auto;
219
-}
220
-
221
-.VerticalBox {
222
-  display: flex;
223
-}
224
-
225
-.VerticalMain {
226
-  background-color: #f1f1f1;
227
-  flex: 1;
228
-}
229
-</style>

+ 1 - 0
src/pages/index/index.vue

@@ -206,6 +206,7 @@ export default {
206 206
         }
207 207
       ],
208 208
       price: [],
209
+      page_size: 10,
209 210
       params: {
210 211
         page_num: 1,
211 212
         course_name: '',

+ 12 - 6
src/pages/mine/courseFiles.vue

@@ -40,12 +40,18 @@ export default {
40 40
       })
41 41
     },
42 42
     goto(page, file) {
43
-      const ability = this.ability.filter(item => {
44
-        if (file.ability_total[item.id]) {
45
-          this.$set(item, 'score', file.ability_total[item.id])
46
-          return true
47
-        }
48
-      })
43
+      let ability = file.ability
44
+        .split(',')
45
+        .filter(s => s)
46
+        .map(item => {
47
+          const ab = this.ability.find(e => Number(e.id) === Number(item))
48
+          const score = file.ability_total[item] || 0
49
+          return {
50
+            id: item,
51
+            name: ab.name,
52
+            score: score
53
+          }
54
+        })
49 55
       this.$set(file, 'ability', ability)
50 56
       this.globalNavigateTo(page, { file: JSON.stringify(file) })
51 57
     }

+ 2 - 2
src/pages/myStudents/myStudents.vue

@@ -148,7 +148,7 @@ export default {
148 148
         school_name: ''
149 149
       },
150 150
       info: {
151
-        id: '',
151
+        student_id: '',
152 152
         name: '',
153 153
         school_id: '',
154 154
         grade_id: '',
@@ -232,7 +232,7 @@ export default {
232 232
       })
233 233
     },
234 234
     fixStudent(item) {
235
-      this.info.id = item.id
235
+      this.info.student_id = item.id
236 236
       this.info.name = item.name
237 237
       this.info.school_id = item.school
238 238
       this.gradeIndex = this.grades.findIndex(e => e.name === item.grade_name)

+ 28 - 16
src/pages/studentcenter/classVideo.vue

@@ -1,12 +1,11 @@
1 1
 <template>
2 2
   <view class="page">
3 3
     <cu-custom :isBack="true" title="课堂视频"></cu-custom>
4
-    <scroll-view scroll-y="true" :style="[{height:'calc(100vh - '+ topHeader+'px)'}]">
4
+    <scroll-view scroll-y="true" :style="[{ height: 'calc(100vh - ' + topHeader + 'px)' }]">
5 5
       <view class="content">
6 6
         <view class="course-img">
7
-          <swiper class="swiper" :indicator-dots="swiper.indicatorDots" :autoplay="swiper.autoplay"
8
-            :interval="swiper.interval" :duration="swiper.duration">
9
-            <swiper-item v-for="(item,index) in detail.course_data.image" :key="index">
7
+          <swiper class="swiper" :indicator-dots="swiper.indicatorDots" :autoplay="swiper.autoplay" :interval="swiper.interval" :duration="swiper.duration">
8
+            <swiper-item v-for="(item, index) in detail.course_data.image" :key="index">
10 9
               <view class="swiper-item">
11 10
                 <image :src="item" mode="widthFix"></image>
12 11
               </view>
@@ -14,16 +13,14 @@
14 13
           </swiper>
15 14
         </view>
16 15
         <view>
17
-          <view class="title flex align-center">
18
-            <text class="iconfont" style="font-size:24px;">&#xe76d;</text>课堂视频
19
-          </view>
20
-          <view class="list" v-if='detail.moments_data'>
21
-            <view class="cu-card case" v-for="(video,index) in detail.moments_data.data" :key="index">
16
+          <view class="title flex align-center"> <text class="iconfont" style="font-size: 24px;">&#xe76d;</text>课堂视频 </view>
17
+          <view class="list" v-if="detail.moments_data">
18
+            <view class="cu-card case" v-for="(video, index) in detail.moments_data.data" :key="index">
22 19
               <view class="cu-item shadow">
23 20
                 <view class="image">
24
-                  <image :src="video.images" v-if="checkTypes(video.images,'imgs')" style="width:100%;"></image>
25
-                  <video :src="video.images" v-if="checkTypes(video.images,'video')" style="width:100%;"></video>
26
-                  <view class="padding-xs">{{video.content}}</view>
21
+                  <image :src="video.images" v-if="checkTypes(video.images, 'imgs')" style="width: 100%;"></image>
22
+                  <video :src="video.images" v-if="checkTypes(video.images, 'video')" style="width: 100%;"></video>
23
+                  <view class="padding-xs">{{ video.content }}</view>
27 24
                 </view>
28 25
               </view>
29 26
             </view>
@@ -37,7 +34,7 @@
37 34
 <script>
38 35
 import { checkTypes } from '@/common/utils/index'
39 36
 export default {
40
-  data () {
37
+  data() {
41 38
     return {
42 39
       topHeader: this.globalCustomBarHeight,
43 40
       detail: {},
@@ -49,12 +46,27 @@ export default {
49 46
       }
50 47
     }
51 48
   },
52
-  onLoad () {
53
-    this.init()
49
+  // 配置分享
50
+  onShareAppMessage(res) {
51
+    if (res.from === 'button') {
52
+      // 来自页面内分享按钮
53
+      console.log(res.target)
54
+    }
55
+    return {
56
+      title: '课程视频',
57
+      path: `/pages/studentcenter/classVideo?detail=${JSON.stringify(this.detail)}`
58
+    }
59
+  },
60
+  onLoad(options) {
61
+    if (options.detail) {
62
+      this.detail = JSON.parse(options.detail)
63
+    } else {
64
+      this.init()
65
+    }
54 66
   },
55 67
   methods: {
56 68
     checkTypes,
57
-    init () {
69
+    init() {
58 70
       this.detail = JSON.parse(uni.getStorageSync('daily_class'))
59 71
     }
60 72
   }

+ 92 - 87
src/pages/studentcenter/index.vue

@@ -1,98 +1,85 @@
1 1
 <template>
2 2
   <view class="page">
3 3
     <cu-custom :isBack="false"></cu-custom>
4
-    <view class="header" :style="[{top:topHeader + 'px'}]">
4
+    <view class="header" :style="[{ top: topHeader + 'px' }]">
5 5
       <view class="header-title header-switch">
6
-        <view class="header-title-main" @tap="changeTab('schedule')" :class="{'cur':type==='schedule'}">
6
+        <view class="header-title-main" @tap="changeTab('schedule')" :class="{ cur: type === 'schedule' }">
7 7
           <view class="margin-bottom-xs">日程表</view>
8 8
           <view class="point"></view>
9 9
         </view>
10
-        <view class="header-title-main margin-left-lg" @tap="changeTab('mine')" :class="{'cur':type==='mine'}">
10
+        <view class="header-title-main margin-left-lg" @tap="changeTab('mine')" :class="{ cur: type === 'mine' }">
11 11
           <view class="margin-bottom-xs">我的</view>
12 12
           <view class="point"></view>
13 13
         </view>
14 14
       </view>
15
-      <view style="width:120px;" v-if="type==='mine'">
15
+      <view style="width: 120px;" v-if="type === 'mine'">
16 16
         <swiper-tab :menuList="menuList" @changeTab="swipe" :activeTab="currentIndex"></swiper-tab>
17 17
       </view>
18 18
     </view>
19 19
     <!-- 日程表 -->
20
-    <view v-if="type==='schedule'">
21
-      <scroll-view scroll-y="true" :style="[{marginTop:'56px',height:'calc(100vh - 114px - '+ topHeader+'px)'}]">
20
+    <view v-if="type === 'schedule'">
21
+      <scroll-view scroll-y="true" :style="[{ marginTop: '56px', height: 'calc(100vh - 114px - ' + topHeader + 'px)' }]">
22 22
         <view class="calendar padding-tb solid-bottom bg-white">
23 23
           <view class="calendar-header flex justify-between padding-lr-sm">
24 24
             <view>
25
-              <picker mode="date" :value="info.chooseDate" :fields="info.fields" @change="bindDateChange"
26
-                :start="info.start" :end="info.end">
25
+              <picker mode="date" :value="info.chooseDate" :fields="info.fields" @change="bindDateChange" :start="info.start" :end="info.end">
27 26
                 <view class="picker text-student text-xl">
28
-                  {{info.chooseDate}}
27
+                  {{ info.chooseDate }}
29 28
                   <text class="cuIcon-right lg"></text>
30 29
                 </view>
31 30
               </picker>
32 31
             </view>
33
-            <view>
34
-              共{{present.attendance_data.length}}天
35
-            </view>
32
+            <view> 共{{ present.attendance_data.length }}天 </view>
36 33
           </view>
37 34
           <view class="calendar-main">
38
-            <calendar :year="year" :month="month" :showBusiness="true" @changeDate="chooseDay" ref="calendar">
39
-            </calendar>
35
+            <calendar :year="year" :month="month" :showBusiness="true" @changeDate="chooseDay" ref="calendar"> </calendar>
40 36
           </view>
41 37
           <view class="calendar-marks flex justify-end padding-lr-sm">
42
-            <view class="margin-left-sm">
43
-              <view class="cu-tag bg-blue margin-right-sm"></view><text class="text-sm">请假</text>
44
-            </view>
45
-            <view class="margin-left-sm">
46
-              <view class="cu-tag bg-yellow margin-right-sm"></view><text class="text-sm">迟到</text>
47
-            </view>
48
-            <view class="margin-left-sm">
49
-              <view class="cu-tag bg-normal margin-right-sm"></view><text class="text-sm">正常</text>
50
-            </view>
51
-            <view class="margin-left-sm">
52
-              <view class="cu-tag bg-red margin-right-sm"></view><text class="text-sm">旷课</text>
53
-            </view>
38
+            <view class="margin-left-sm"> <view class="cu-tag bg-blue margin-right-sm"></view><text class="text-sm">请假</text> </view>
39
+            <view class="margin-left-sm"> <view class="cu-tag bg-yellow margin-right-sm"></view><text class="text-sm">迟到</text> </view>
40
+            <view class="margin-left-sm"> <view class="cu-tag bg-normal margin-right-sm"></view><text class="text-sm">正常</text> </view>
41
+            <view class="margin-left-sm"> <view class="cu-tag bg-red margin-right-sm"></view><text class="text-sm">旷课</text> </view>
54 42
           </view>
55 43
         </view>
56 44
         <view class="cu-card margin-top-xs padding-xs">
57 45
           <view class="cu-item day-info">
58 46
             <view class="day-title flex justify-between solid-bottom padding text-lg">
59
-              <view>应到上课节数:{{present.be_section_num}}节</view>
60
-              <view>实际上课节数: {{present.actual_section_num}}节</view>
47
+              <view>应到上课节数:{{ present.be_section_num }}节</view>
48
+              <view>实际上课节数: {{ present.actual_section_num }}节</view>
61 49
             </view>
62 50
             <view class="day-chart flex justify-between padding">
63
-              <view v-for="(chart,key) in attendance" :key="key" class="flex-sub">
64
-                <canvas :canvas-id="key" style="margin:0 auto;width:100%;height:80px;"></canvas>
65
-                <view style="margin-left:18px;">{{chart.title}}</view>
51
+              <view v-for="(chart, key) in attendance" :key="key" class="flex-sub">
52
+                <canvas :canvas-id="key" style="margin: 0 auto; width: 100%; height: 80px;"></canvas>
53
+                <view style="margin-left: 18px;">{{ chart.title }}</view>
66 54
               </view>
67 55
             </view>
68 56
           </view>
69 57
         </view>
70 58
         <view class="list margin-top-xs">
71
-          <view class="cu-card margin-top margin-bottom shadow" v-for="(item,index) in classList" :key="index">
72
-            <view class="cu-item" v-for="(mark,i) in item.mark" :key="i">
59
+          <view class="cu-card margin-top margin-bottom shadow" v-for="(item, index) in classList" :key="index">
60
+            <view class="cu-item" v-for="(mark, i) in item.mark" :key="i">
73 61
               <view class="card-header flex justify-end solid-bottom">
74 62
                 <view class="text-student course-status">
75
-                  {{mark.status_desc}}
63
+                  {{ mark.status_desc }}
76 64
                 </view>
77 65
               </view>
78 66
               <view class="card flex">
79 67
                 <view class="card-left">
80
-                  <img mode="scaleToFill" :src="mark.avatar" alt="" class="card-image">
68
+                  <img mode="scaleToFill" :src="mark.avatar" alt="" class="card-image" />
81 69
                 </view>
82 70
                 <view class="card-right margin-left-sm">
83
-                  <view class="card-title">{{mark.course_name}}</view>
71
+                  <view class="card-title">{{ mark.course_name }}</view>
84 72
                   <view class="card-item margin-top-xs">
85
-                    <text class="card-text">{{mark.start_at}}</text>
73
+                    <text class="card-text">{{ mark.start_at }}</text>
86 74
                   </view>
87 75
                   <view class="card-item margin-top-xs">
88
-                    <text class="card-text">{{mark.end_at}}</text>
76
+                    <text class="card-text">{{ mark.end_at }}</text>
89 77
                   </view>
90 78
                   <view class="card-item margin-top-xs">
91 79
                     <button class="cu-btn round line-cyan button-hover" @tap="classOperation(mark.class_plan_id)">
92
-                      {{mark.status==-1?'查看':'去上课'}}
80
+                      {{ mark.status == -1 ? '查看' : '去上课' }}
93 81
                     </button>
94
-                    <button class="cu-btn round line-red button-hover margin-left" @tap="askLeave(mark.class_plan_id)"
95
-                      v-if="mark.status!==-1">去请假</button>
82
+                    <button class="cu-btn round line-red button-hover margin-left" @tap="askLeave(mark.class_plan_id)" v-if="mark.status !== -1">去请假</button>
96 83
                   </view>
97 84
                 </view>
98 85
               </view>
@@ -102,34 +89,33 @@
102 89
       </scroll-view>
103 90
     </view>
104 91
     <!-- 我的 -->
105
-    <view v-if="type==='mine'">
106
-      <scroll-view scroll-y="true" @scrolltolower="loadMore" class="scroll-main"
107
-        :style="[{height:'calc(100vh - 114px - '+ topHeader+'px)'}]">
92
+    <view v-if="type === 'mine'">
93
+      <scroll-view scroll-y="true" @scrolltolower="loadMore" class="scroll-main" :style="[{ height: 'calc(100vh - 114px - ' + topHeader + 'px)' }]">
108 94
         <view class="list">
109
-          <view class="cu-card margin-top margin-bottom shadow" v-for="(item,index) in list" :key="index">
95
+          <view class="cu-card margin-top margin-bottom shadow" v-for="(item, index) in list" :key="index">
110 96
             <view class="cu-item">
111 97
               <view class="card-header flex justify-between solid-bottom">
112
-                <view v-if="item.day">{{item.day}}</view>
98
+                <view v-if="item.day">{{ item.day }}</view>
113 99
                 <view class="text-student course-status" v-if="item.status">
114
-                  {{item.status}}
100
+                  {{ item.status }}
115 101
                 </view>
116
-                <view class="text-student course-status" v-if="currentIndex===1">
102
+                <view class="text-student course-status" v-if="currentIndex === 1">
117 103
                   已完结
118 104
                 </view>
119 105
               </view>
120 106
               <view class="card flex">
121 107
                 <view class="card-left">
122
-                  <img mode="scaleToFill" :src="item.image" alt="" class="card-image">
108
+                  <img mode="scaleToFill" :src="item.image" alt="" class="card-image" />
123 109
                 </view>
124 110
                 <view class="card-right margin-left-sm">
125
-                  <view class="card-title">{{item.attend_name}}</view>
111
+                  <view class="card-title">{{ item.attend_name }}</view>
126 112
                   <view class="card-item margin-top-xs">
127 113
                     <text class="card-label">机构:</text>
128
-                    <text class="card-text">{{item.agency_name||'-'}}</text>
114
+                    <text class="card-text">{{ item.agency_name || '-' }}</text>
129 115
                   </view>
130 116
                   <view class="card-item margin-top-xs">
131 117
                     <text class="card-label">老师:</text>
132
-                    <text class="card-text">{{item.teacher||'-'}}</text>
118
+                    <text class="card-text">{{ item.teacher || '-' }}</text>
133 119
                   </view>
134 120
                 </view>
135 121
               </view>
@@ -150,9 +136,10 @@ import { getDate, deepClone } from '@/common/utils'
150 136
 import swiperTab from '@/components/swiper-tab.vue'
151 137
 export default {
152 138
   components: {
153
-    swiperTab, calendar
139
+    swiperTab,
140
+    calendar
154 141
   },
155
-  data () {
142
+  data() {
156 143
     return {
157 144
       topHeader: this.globalCustomBarHeight,
158 145
       type: 'schedule',
@@ -163,7 +150,8 @@ export default {
163 150
       list: [],
164 151
       classList: [], // 日程表当天
165 152
       courses: [], // 日程表全部
166
-      info: { // 日历数据
153
+      info: {
154
+        // 日历数据
167 155
         chooseDate: '', // 选中日期
168 156
         year: '',
169 157
         month: '',
@@ -181,57 +169,68 @@ export default {
181 169
         leave_num: 0,
182 170
         normal_num: 0
183 171
       }, // 实际出席情况
184
-      attendance: { // 出席统计数据
172
+      attendance: {
173
+        // 出席统计数据
185 174
         leave_num: {
186
-          title: '请假', times: 2, color: '#3390F5'
175
+          title: '请假',
176
+          times: 2,
177
+          color: '#3390F5'
187 178
         },
188 179
         late_num: {
189
-          title: '迟到', times: 1, color: '#fbbd08'
180
+          title: '迟到',
181
+          times: 1,
182
+          color: '#fbbd08'
190 183
         },
191 184
         normal_num: {
192
-          title: '正常', times: 3, color: '#4DB8E4'
185
+          title: '正常',
186
+          times: 3,
187
+          color: '#39b54a'
193 188
         },
194 189
         absenteeism_num: {
195
-          title: '旷课', times: 0, color: '#e54d42'
190
+          title: '旷课',
191
+          times: 0,
192
+          color: '#e54d42'
196 193
         }
197 194
       }
198 195
     }
199 196
   },
200
-  onShow () {
197
+  onShow() {
201 198
     const today = getDate(new Date(), 0)
202 199
     this.info.year = this.info.year || today.year
203 200
     this.info.month = this.info.month || today.month
204 201
     this.info.day = this.info.day || today.date
205 202
     this.info.chooseDate = this.info.chooseDate || today.fullMonth
206
-    this.info.start = (this.info.year - 1) + '-' + '01-01'
203
+    this.info.start = this.info.year - 1 + '-' + '01-01'
207 204
     this.info.end = this.info.year + '-' + (Number(this.info.month) + 1) + '-' + this.info.day
208 205
     this.init()
209 206
   },
210 207
   methods: {
211
-    init () {
208
+    init() {
212 209
       if (this.type === 'mine') {
213 210
         this.get_list()
214 211
       } else {
215 212
         this.getSehedule()
216 213
       }
217 214
     },
218
-    getSehedule () {
215
+    getSehedule() {
219 216
       this.setCalendar()
220 217
       this.get_attend().then(res => {
221 218
         this.present = res.data
222
-        this.fix_attend(res.data)// 出席统计
223
-        this.setAttendance(res.data.attendance_data)// 日历显示出席日期
219
+        this.fix_attend(res.data) // 出席统计
220
+        this.setAttendance(res.data.attendance_data) // 日历显示出席日期
224 221
         this.drawChart()
225
-        this.get_dateCourse()// 获取日期课程列表
222
+        this.get_dateCourse() // 获取日期课程列表
226 223
       })
227 224
     },
228
-    classOperation (id) { // 上课
225
+    classOperation(id) {
226
+      // 上课
229 227
       this.globalNavigateTo('studentOperation', { id })
230 228
     },
231
-    askLeave (id) { // 请假
229
+    askLeave(id) {
230
+      // 请假
232 231
       this.globalNavigateTo('studentAbsent', { id })
233 232
     },
234
-    loadMore () {
233
+    loadMore() {
235 234
       if (this.noMore) {
236 235
         uni.showToast({ title: '没有更多了', icon: 'none' })
237 236
         return false
@@ -239,18 +238,18 @@ export default {
239 238
       this.page_num++
240 239
       this.get_list()
241 240
     },
242
-    get_list () {
241
+    get_list() {
243 242
       if (this.currentIndex === 0) {
244 243
         this.get_course()
245 244
       } else {
246 245
         this.get_history()
247 246
       }
248 247
     },
249
-    chooseDay (day) {
250
-      this.classList = this.courses.filter(item => item.date.replace(/-/g, '') === day)// 匹配当天数据
248
+    chooseDay(day) {
249
+      this.classList = this.courses.filter(item => item.date.replace(/-/g, '') === day) // 匹配当天数据
251 250
       this.classList = this.classList.length > 0 ? this.classList : deepClone(this.courses)
252 251
     },
253
-    get_course () {
252
+    get_course() {
254 253
       _nowCourse({ page_num: this.page_num }).then(res => {
255 254
         if (this.page_num > 1) {
256 255
           if (res.data.length < this.page_size) this.noMore = true
@@ -261,7 +260,7 @@ export default {
261 260
         }
262 261
       })
263 262
     },
264
-    get_history () {
263
+    get_history() {
265 264
       _courseHistory({ page_num: this.page_num }).then(res => {
266 265
         if (this.page_num > 1) {
267 266
           if (res.data.length < this.page_size) this.noMore = true
@@ -272,23 +271,23 @@ export default {
272 271
         }
273 272
       })
274 273
     },
275
-    drawChart () {
274
+    drawChart() {
276 275
       for (var key in this.attendance) {
277 276
         this.draw(this.attendance[key], key)
278 277
       }
279 278
     },
280
-    changeTab (type) {
279
+    changeTab(type) {
281 280
       this.type = type
282 281
       this.$nextTick(() => {
283 282
         this.init()
284 283
       })
285 284
     },
286
-    swipe (index) {
285
+    swipe(index) {
287 286
       this.currentIndex = index
288 287
       this.page_num = 1
289 288
       this.get_list()
290 289
     },
291
-    bindDateChange (e) {
290
+    bindDateChange(e) {
292 291
       const value = e.detail.value
293 292
       const [year, month] = value.split('-')
294 293
       this.info.year = year
@@ -296,36 +295,42 @@ export default {
296 295
       this.info.chooseDate = value
297 296
       this.getSehedule()
298 297
     },
299
-    setCalendar () {
298
+    setCalendar() {
300 299
       this.$refs.calendar.selCalendar(this.info.year, this.info.month)
301 300
     },
302
-    setAttendance (attendance) { // 补充出席情况
301
+    setAttendance(attendance) {
302
+      // 补充出席情况
303 303
       if (!attendance) return
304 304
       this.$refs.calendar.setAttendance(attendance)
305 305
     },
306
-    get_attend () { // 获取出席情况
306
+    get_attend() {
307
+      // 获取出席情况
307 308
       const date = this.info.year + '-' + this.info.month
308 309
       return new Promise((resolve, reject) => {
309 310
         const info = _attendance({ date })
310 311
         resolve(info)
311 312
       })
312 313
     },
313
-    fix_attend (info) { // 补充出席实际数据
314
+    fix_attend(info) {
315
+      // 补充出席实际数据
314 316
       Object.keys(this.attendance).forEach(key => {
315 317
         this.attendance[key].times = info[key]
316 318
       })
317 319
     },
318
-    get_dateCourse () { // 获取对应日期数据
320
+    get_dateCourse() {
321
+      // 获取对应日期数据
319 322
       _dateCourse({ year: this.info.year, month: this.info.month }).then(res => {
320 323
         this.classList = res.data
321 324
         this.courses = res.data
325
+        const days = this.courses.map(item => parseInt(item.day))
326
+        this.$refs.calendar.setClass(days)
322 327
       })
323 328
     },
324
-    draw (ele, key) {
329
+    draw(ele, key) {
325 330
       const ctx = uni.createCanvasContext(key)
326
-      const value = NP.divide(ele.times, this.present.be_section_num) * 100// 次数转化对应百分比值
331
+      const value = NP.divide(ele.times, this.present.be_section_num) * 100 // 次数转化对应百分比值
327 332
       const startAngle = 1.5
328
-      const endAngle = 1.5 + value * 2 / 100
333
+      const endAngle = 1.5 + (value * 2) / 100
329 334
       // 画圆环
330 335
       ctx.beginPath()
331 336
       ctx.arc(34, 40, 28, 0, 2 * Math.PI)