ソースを参照

fix:智能报课、新手教程等修改

seamwang 1 年間 前
コミット
dfd7096592
共有9 個のファイルを変更した131 個の追加47 個の削除を含む
  1. 8 0
      src/api/course.js
  2. 1 0
      src/common/urlMap.js
  3. 25 25
      src/common/webSocket.js
  4. 4 0
      src/pages.json
  5. 1 1
      src/pages/class/detail.vue
  6. 62 20
      src/pages/class/gift.vue
  7. 1 1
      src/pages/index/components/card.vue
  8. 6 0
      src/pages/mine/mine.vue
  9. 23 0
      src/pages/mine/video.vue

+ 8 - 0
src/api/course.js

@@ -68,6 +68,10 @@ export function _dropList (params) {
68 68
 export function _payOrder (params) {
69 69
 	return fetch('/parents/pay/payment', params)
70 70
 }
71
+//获取支付方式
72
+export function _getPayType (params) {
73
+	return fetch('/parents/pay/paytype ', params, 'POST', false)
74
+}
71 75
 // 取消订单
72 76
 export function _cancelOrder (params) {
73 77
 	return fetch('/parents/Ordercentre/del_order', params)
@@ -140,3 +144,7 @@ export function _fixStudent (params) {
140 144
 export function _checkConflict (params) {
141 145
 	return fetch('/parents/Intelligent/conflictcheck', params)
142 146
 }
147
+//检索已报订单
148
+export function _checkOrders () {
149
+	return fetch('/parents/Intelligent/checkOrders')
150
+}

+ 1 - 0
src/common/urlMap.js

@@ -28,4 +28,5 @@ urlMap.set('agreement', '/pages/agreement/index')
28 28
 urlMap.set('courseFiles', '/pages/mine/courseFiles')
29 29
 urlMap.set('fileDetail', '/pages/mine/fileDetail')
30 30
 urlMap.set('teachAims', '/pages/studentcenter/teachAims')
31
+urlMap.set('video', '/pages/mine/video')
31 32
 export default urlMap

+ 25 - 25
src/common/webSocket.js

@@ -3,31 +3,31 @@ import store from '@/store/index'
3 3
 import commonMethods from '@/common/commonMethods.js'
4 4
 import Vue from 'vue'
5 5
 const socket = {
6
-  initSocket: function() {
7
-    Vue.prototype.socket = Vue.prototype.socket || new WebSocket()
8
-    this.onMessage(Vue.prototype.socket)
9
-  },
10
-  onMessage: (ws) => {
11
-    ws.onMessage = message => {
12
-      if (typeof message !== 'object') {
13
-        return false
14
-      }
15
-      if (message.code === 400) {
16
-        uni.hideLoading()
17
-        store.dispatch('setConnect', true)
18
-        uni.showToast({ title: message.msg, icon: 'none', duration: 2000 })
19
-        return false
20
-      }
21
-      if (message.push_type === 'reload_order') {
22
-        store.dispatch('setReload', true)
23
-      }
24
-      if (message.push_type === 'order') {
25
-        uni.hideLoading()
26
-        store.dispatch('setConnect', true)
27
-        commonMethods.globalNavigateTo('order', { type: 1 })
28
-      }
29
-    }
30
-  }
6
+	initSocket: function () {
7
+		Vue.prototype.socket = Vue.prototype.socket || new WebSocket()
8
+		this.onMessage(Vue.prototype.socket)
9
+	},
10
+	onMessage: (ws) => {
11
+		ws.onMessage = message => {
12
+			if (typeof message !== 'object') {
13
+				return false
14
+			}
15
+			if (message.code === 400) {
16
+				uni.hideLoading()
17
+				store.dispatch('setConnect', true)
18
+				uni.showModal({ title: '提示', content: message.msg, showCancel: false })
19
+				return false
20
+			}
21
+			if (message.push_type === 'reload_order') {
22
+				store.dispatch('setReload', true)
23
+			}
24
+			if (message.push_type === 'order') {
25
+				uni.hideLoading()
26
+				store.dispatch('setConnect', true)
27
+				commonMethods.globalNavigateTo('order', { type: 1 })
28
+			}
29
+		}
30
+	}
31 31
 }
32 32
 
33 33
 export default socket

+ 4 - 0
src/pages.json

@@ -107,6 +107,10 @@
107 107
     {
108 108
       "path": "pages/studentcenter/teachAims",
109 109
       "style": {}
110
+    },
111
+    {
112
+      "path": "pages/mine/video",
113
+      "style": {}
110 114
     }
111 115
   ],
112 116
   "globalStyle": {

+ 1 - 1
src/pages/class/detail.vue

@@ -136,7 +136,7 @@
136 136
       </view>
137 137
       <view class="bg-white padding-lr">
138 138
         <view class="text-content text-lg" v-for="(outline, index) in detail.out_line" :key="index">
139
-          {{ outline.course_content }}
139
+          <rich-text :nodes="outline.course_content"></rich-text>
140 140
         </view>
141 141
       </view>
142 142
     </scroll-view>

+ 62 - 20
src/pages/class/gift.vue

@@ -85,7 +85,12 @@
85 85
                 <checkbox-group style="width: 100%;" v-model="checked">
86 86
                   <view class="cu-item bg-white padding margin-bottom-sm" v-for="(item, i) in attends" :key="i">
87 87
                     <view>{{ item.week }}</view>
88
-                    <view v-for="(course, c) in item.list" class="solid-bottom" :key="c" :class="course.status == 0 ? 'disabled-course' : ''">
88
+                    <view
89
+                      v-for="(course, c) in item.list"
90
+                      class="solid-bottom"
91
+                      :key="c"
92
+                      :class="course.status == 0 || payOrders.includes(course.class_attend_id) ? 'disabled-course' : ''"
93
+                    >
89 94
                       <view class="cu-bar">
90 95
                         <view>
91 96
                           <label @tap="classChange(course, i)">
@@ -96,7 +101,7 @@
96 101
                               <view>
97 102
                                 <checkbox
98 103
                                   :value="course.class_attend_id"
99
-                                  :disabled="course.status == 0"
104
+                                  :disabled="course.status == 0 || payOrders.includes(course.class_attend_id)"
100 105
                                   :checked="checked[i].includes(course.class_attend_id)"
101 106
                                   class="round cyan"
102 107
                                   style="transform: scale(0.7);"
@@ -114,7 +119,7 @@
114 119
                                 :checked="
115 120
                                   checked_props[i][c] ? checked_props[i][c].class_attend_id === course.class_attend_id && checked_props[i][c].prop.includes(prop.id) : false
116 121
                                 "
117
-                                :disabled="course.status == 0"
122
+                                :disabled="course.status == 0 || payOrders.includes(course.class_attend_id)"
118 123
                                 :value="prop.id"
119 124
                                 class="cyan"
120 125
                                 style="transform: scale(0.7);"
@@ -149,7 +154,7 @@
149 154
 </template>
150 155
 
151 156
 <script>
152
-import { _intelligentDates, _intelligentInterests, _intelligentCourses, _intelligentGetKeys, _joinShops, _checkConflict } from '@/api/course'
157
+import { _intelligentDates, _intelligentInterests, _intelligentCourses, _intelligentGetKeys, _joinShops, _checkConflict, _checkOrders } from '@/api/course'
153 158
 import { mapGetters } from 'vuex'
154 159
 import socket from '@/common/webSocket'
155 160
 export default {
@@ -173,6 +178,7 @@ export default {
173 178
       days: [], //周期
174 179
       daysMap: { 星期一: '1', 星期二: '2', 星期三: '3', 星期四: '4', 星期五: '5' },
175 180
       interests: [], //兴趣
181
+      interestMax: 5, //限定兴趣数量
176 182
       attends: [], //课程
177 183
       week: [], //记录日期
178 184
       tuoguan: [], //记录托管
@@ -190,6 +196,7 @@ export default {
190 196
       checked_props: [], // 选中工具
191 197
       checkedIds: [], //已选中选项
192 198
       conflictIds: [], //冲突选项
199
+      payOrders: [], //已付款订单
193 200
       attend_id: 0, // 添加成功课程
194 201
       disableBtn: false, // 避免多次重复点击
195 202
       action: 'stopmove'
@@ -208,15 +215,26 @@ export default {
208 215
     this.disableBtn = false
209 216
   },
210 217
   methods: {
211
-    init() {
218
+    async init() {
212 219
       this.getDateConfig()
213 220
       socket.initSocket()
221
+      await this.checkOrders() //获取支付订单
214 222
     },
215 223
     getDateConfig() {
216 224
       _intelligentDates().then(res => {
217 225
         this.days = res.data
218 226
       })
219 227
     },
228
+    //查询已付款订单
229
+    checkOrders() {
230
+      return new Promise((resolve, reject) => {
231
+        _checkOrders().then(res => {
232
+          this.payOrders = res.data
233
+          resolve(true)
234
+        })
235
+      })
236
+    },
237
+    //查询冲突判断
220 238
     checkConflict(id) {
221 239
       return new Promise((resolve, reject) => {
222 240
         if (this.checkedIds.length < 1) {
@@ -229,6 +247,7 @@ export default {
229 247
         }
230 248
         _checkConflict(params).then(res => {
231 249
           this.checkedIds = res.data.checked_list.map(item => item.class_attend_id)
250
+          this.checkedIds = [...new Set(this.checkedIds.concat(this.payOrders))]
232 251
           this.conflictIds = res.data.conflict_list.map(item => item.class_attend_id)
233 252
           resolve(res.data.checked_res)
234 253
         })
@@ -252,18 +271,23 @@ export default {
252 271
         return false
253 272
       }
254 273
       this.interests = this.keys.filter(item => item.includes(this.serachKey))
274
+      //兴趣选择数量补充
275
+      if (this.interests.length < this.interestMax) {
276
+        const others = this.keys.filter(item => !this.params.hobbyOther.includes(item) && !this.interests.includes(item))
277
+        const fixNum = this.interestMax - this.interests.length
278
+        this.interests = this.interests.concat(others.slice(0, fixNum))
279
+      }
255 280
     },
256 281
     check_key(key) {
257 282
       const params = { week: this.params.week.join(','), student_id: this.kid, keywords: key }
258
-      _intelligentGetKeys(params).then(res => {
259
-        if (res.data.length < 1) {
260
-          this.params.hobbyOther = this.params.hobbyOther.filter(k => k != key)
261
-          uni.showToast({
262
-            title: '未找到相关课程',
263
-            icon: 'none',
264
-            duration: 2000
265
-          })
266
-        }
283
+      return new Promise((resolve, reject) => {
284
+        _intelligentGetKeys(params).then(res => {
285
+          if (res.data.length < 1) {
286
+            resolve(false)
287
+          } else {
288
+            resolve(true)
289
+          }
290
+        })
267 291
       })
268 292
     },
269 293
     get_options() {
@@ -280,9 +304,9 @@ export default {
280 304
             const week = course.week
281 305
             const dayKey = this.daysMap[week]
282 306
             const item = list[0]
283
-            const class_attend_id = item.status == 0 || !this.params.week.includes(dayKey) ? null : item.class_attend_id
307
+            const class_attend_id = item.status == 0 || this.payOrders.includes(item.class_attend_id) || !this.params.week.includes(dayKey) ? null : item.class_attend_id
284 308
             this.$set(this.checked, index, [class_attend_id])
285
-            const prop = item.prop.length > 0 ? [item.prop[0].id] : []
309
+            const prop = class_attend_id && item.prop.length > 0 ? [item.prop[0].id] : []
286 310
             this.$set(this.checked_props, index, [{ class_attend_id: class_attend_id, prop: prop }])
287 311
           })
288 312
           this.checkedIds = this.getCheckedIds()
@@ -295,17 +319,25 @@ export default {
295 319
       this.checked.forEach(v => {
296 320
         arr = arr.concat(v)
297 321
       })
298
-      return arr.filter(e => e)
322
+      return [...new Set(arr.filter(e => e).concat(this.payOrders))]
299 323
     },
300 324
     delHobby(key) {
301 325
       this.params.hobbyOther = this.params.hobbyOther.filter(item => item != key)
302 326
     },
303
-    chooseInterest(key) {
327
+    async chooseInterest(key) {
304 328
       if (this.params.hobbyOther.includes(key)) {
305 329
         this.params.hobbyOther = this.params.hobbyOther.filter(item => item != key)
306 330
       } else {
307 331
         this.params.hobbyOther.push(key)
308
-        this.check_key(key)
332
+        const pass = await this.check_key(key)
333
+        if (!pass) {
334
+          this.params.hobbyOther = this.params.hobbyOther.filter(k => k != key)
335
+          uni.showToast({
336
+            title: '未找到相关课程',
337
+            icon: 'none',
338
+            duration: 2000
339
+          })
340
+        }
309 341
       }
310 342
     },
311 343
     checkboxChange(e) {
@@ -327,7 +359,7 @@ export default {
327 359
           console.log('error')
328 360
       }
329 361
     },
330
-    changeStep(index) {
362
+    async changeStep(index) {
331 363
       if (index === 1 && this.params.week.length < 1) {
332 364
         uni.showToast({ title: '请先选择周期', icon: 'none' })
333 365
         return false
@@ -338,6 +370,10 @@ export default {
338 370
       }
339 371
       if (index === 1) {
340 372
         this.getHobbyConfig()
373
+        const pass = await this.check_key('晚托')
374
+        if (pass) {
375
+          this.params.hobbyOther[0] = '晚托'
376
+        }
341 377
       }
342 378
       const step = Math.abs(index - this.cur)
343 379
       if (step > 1) return false
@@ -357,7 +393,13 @@ export default {
357 393
       if (course.status == 0) {
358 394
         return false
359 395
       }
396
+      //已报课程
397
+      if (this.payOrders.includes(course.class_attend_id)) {
398
+        uni.showToast({ title: '该课程已报,请重选!', icon: 'none', duration: 2000 })
399
+        return false
400
+      }
360 401
       const class_attend_id = course.class_attend_id
402
+
361 403
       if (this.checked[i].includes(class_attend_id)) {
362 404
         this.batchCancel([class_attend_id])
363 405
       } else {

+ 1 - 1
src/pages/index/components/card.vue

@@ -14,7 +14,7 @@
14 14
       <view class="text-gray text-sm">{{ item.grade_desc }}</view>
15 15
       <view class="margin-top-sm">
16 16
         <button class="cu-btn round bg-student text-white button-hover" v-if="item.enable">报课</button>
17
-        <button class="cu-btn round bg-grey button-hover text-white disabled" v-else>停止</button>
17
+        <button class="cu-btn round bg-grey button-hover text-white disabled" v-else>停止报课</button>
18 18
       </view>
19 19
     </view>
20 20
   </view>

+ 6 - 0
src/pages/mine/mine.vue

@@ -76,6 +76,12 @@
76 76
             <text class="text-black">在线客服</text>
77 77
           </view>
78 78
         </view>
79
+        <view class="cu-item arrow" @tap="goto('video')">
80
+          <text class="iconfont text-gray" style="font-size: 18px;">&#xe76d;</text>
81
+          <view class="content margin-left-sm">
82
+            <text class="text-black">新手教程</text>
83
+          </view>
84
+        </view>
79 85
       </view>
80 86
     </view>
81 87
     <mp-tabbar :outerSelected="2" />

+ 23 - 0
src/pages/mine/video.vue

@@ -0,0 +1,23 @@
1
+<template>
2
+  <view class="page">
3
+    <cu-custom :isBack="true"></cu-custom>
4
+    <video :src="url" :style="[{ width: '100%', height: 'calc(100vh - ' + topHeader + 'px)' }]"></video>
5
+  </view>
6
+</template>
7
+
8
+<script>
9
+export default {
10
+  data() {
11
+    return {
12
+      url: 'https://upload.kehoubaike.com/guide.MP4',
13
+      topHeader: this.globalCustomBarHeight
14
+    }
15
+  }
16
+}
17
+</script>
18
+
19
+<style lang="scss" scoped>
20
+.page {
21
+  height: 100vh;
22
+}
23
+</style>