seamwang 2 anos atrás
pai
commit
e1e4e90b07
2 arquivos alterados com 93 adições e 92 exclusões
  1. 56 49
      src/pages/class/gift.vue
  2. 37 43
      src/pages/mine/mine.vue

+ 56 - 49
src/pages/class/gift.vue

@@ -2,13 +2,14 @@
2 2
   <view class="page">
3 3
     <cu-custom :isBack="true" title="智能报课"></cu-custom>
4 4
     <view class="steps padding-tb">
5
+      <view class="text-center"><text class="text-red">点击切换下一步</text></view>
5 6
       <view class="cu-steps">
6 7
         <view class="cu-item" :class="index > cur ? '' : 'text-student'" v-for="(item, index) in numList" :key="index" @tap="changeStep(index)">
7 8
           <text class="num" :data-index="index + 1"></text> {{ item.name }}
8 9
         </view>
9 10
       </view>
10 11
     </view>
11
-    <view class="main bg-white" :style="[{ height: 'calc(100vh - 92px - ' + topHeader + 'px)' }]">
12
+    <view class="main bg-white" :style="[{ height: 'calc(100vh - 110px - ' + topHeader + 'px)' }]">
12 13
       <swiper @change="swipeChange" :current="cur" class="swipe">
13 14
         <swiper-item @touchmove.stop>
14 15
           <view class="btn-check-group padding">
@@ -34,58 +35,63 @@
34 35
           </view>
35 36
         </swiper-item>
36 37
         <swiper-item>
37
-          <view class="VerticalBox">
38
-            <scroll-view class="VerticalNav nav" scroll-y scroll-with-animation :scroll-top="verticalNavTop" :style="'height:calc(100vh - 70px - 90px - ' + topHeader + 'px)'">
39
-              <view class="cu-item" :class="index == tabCur ? 'text-green cur' : ''" v-for="(item, index) in attends" :key="index" @tap="TabSelect" :data-id="index">
40
-                {{ weekList[index] }}
41
-              </view>
42
-            </scroll-view>
43
-            <scroll-view
44
-              class="VerticalMain padding-sm"
45
-              scroll-y
46
-              scroll-with-animation
47
-              :style="'height:calc(100vh - 70px - 90px - ' + topHeader + 'px)'"
48
-              :scroll-into-view="'main-' + mainCur"
49
-              @scroll="VerticalMain"
50
-            >
51
-              <radio-group @change="changeClass" style="width: 100%;" v-for="(attend, i) in attends" :key="i">
52
-                <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">
53
-                  <view class="cu-bar solid-bottom">
54
-                    <view>
55
-                      <label>
56
-                        <view class="flex justify-between align-center">
57
-                          <view
58
-                            ><text>{{ item.attend_name }}</text></view
59
-                          >
38
+          <view v-if="attends.length === 0" class="padding text-center text-lg">
39
+            没有找到相关课程!
40
+          </view>
41
+          <view v-else>
42
+            <view class="VerticalBox">
43
+              <scroll-view class="VerticalNav nav" scroll-y scroll-with-animation :scroll-top="verticalNavTop" :style="'height:calc(100vh - 70px - 90px - ' + topHeader + 'px)'">
44
+                <view class="cu-item" :class="index == tabCur ? 'text-green cur' : ''" v-for="(item, index) in attends" :key="index" @tap="TabSelect" :data-id="index">
45
+                  {{ weekList[index] }}
46
+                </view>
47
+              </scroll-view>
48
+              <scroll-view
49
+                class="VerticalMain padding-sm"
50
+                scroll-y
51
+                scroll-with-animation
52
+                :style="'height:calc(100vh - 70px - 90px - ' + topHeader + 'px)'"
53
+                :scroll-into-view="'main-' + mainCur"
54
+                @scroll="VerticalMain"
55
+              >
56
+                <radio-group @change="changeClass" style="width: 100%;" v-for="(attend, i) in attends" :key="i">
57
+                  <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">
58
+                    <view class="cu-bar solid-bottom">
59
+                      <view>
60
+                        <label>
61
+                          <view class="flex justify-between align-center">
62
+                            <view
63
+                              ><text>{{ item.attend_name }}</text></view
64
+                            >
65
+                            <view>
66
+                              <radio :value="item.class_attend_id" :checked="checked.includes(item.class_attend_id)" class="cyan" style="transform: scale(0.7);" />
67
+                            </view>
68
+                          </view>
69
+                        </label>
70
+                      </view>
71
+                    </view>
72
+                    <view v-if="item.prop.length > 0">
73
+                      <checkbox-group class="checkbox-group margin-top-xs" :data-id="item.class_attend_id" @change="propChange">
74
+                        <label v-for="prop in item.prop" :key="prop.id">
60 75
                           <view>
61
-                            <radio :value="item.class_attend_id" :checked="checked.includes(item.class_attend_id)" class="cyan" style="transform: scale(0.7);" />
76
+                            <checkbox
77
+                              :value="prop.id"
78
+                              class="cyan"
79
+                              :checked="checked_props[mainCur].class_attend_id === item.class_attend_id && checked_props[mainCur].prop.includes(prop.id + '')"
80
+                              style="transform: scale(0.7);"
81
+                            />{{ prop.name }}<text>¥{{ prop.money }}</text>
62 82
                           </view>
63
-                        </view>
64
-                      </label>
83
+                        </label>
84
+                      </checkbox-group>
65 85
                     </view>
66 86
                   </view>
67
-                  <view v-if="item.prop.length > 0">
68
-                    <checkbox-group class="checkbox-group margin-top-xs" :data-id="item.class_attend_id" @change="propChange">
69
-                      <label v-for="prop in item.prop" :key="prop.id">
70
-                        <view>
71
-                          <checkbox
72
-                            :value="prop.id"
73
-                            class="cyan"
74
-                            :checked="checked_props[mainCur].class_attend_id === item.class_attend_id && checked_props[mainCur].prop.includes(prop.id + '')"
75
-                            style="transform: scale(0.7);"
76
-                          />{{ prop.name }}<text>¥{{ prop.money }}</text>
77
-                        </view>
78
-                      </label>
79
-                    </checkbox-group>
80
-                  </view>
81
-                </view>
82
-              </radio-group>
83
-            </scroll-view>
84
-          </view>
85
-          <view class="static shadow">
86
-            <view class="static-order flex">
87
-              <shop-cart :class_attend_id="attend_id" @changeDisableBtn="changeDisableBtn"></shop-cart>
88
-              <button class="cu-btn round bg-student text-white margin-left-xs" @tap="addCart">报课</button>
87
+                </radio-group>
88
+              </scroll-view>
89
+            </view>
90
+            <view class="static shadow">
91
+              <view class="static-order flex">
92
+                <shop-cart :class_attend_id="attend_id" @changeDisableBtn="changeDisableBtn"></shop-cart>
93
+                <button class="cu-btn round bg-student text-white margin-left-xs" @tap="addCart">报课</button>
94
+              </view>
89 95
             </view>
90 96
           </view>
91 97
         </swiper-item>
@@ -170,6 +176,7 @@ export default {
170 176
       params.hobby = params.hobby.join(',')
171 177
       _intelligentCourses(params).then(res => {
172 178
         this.attends = res.data
179
+        this.checked = [] //初始化选项
173 180
         Object.keys(this.attends).forEach(item => {
174 181
           this.$set(this.checked_props, item, { prop: [] })
175 182
         })

+ 37 - 43
src/pages/mine/mine.vue

@@ -4,69 +4,67 @@
4 4
     <view class="main">
5 5
       <view class="main-top">
6 6
         <view class="title flex justify-between">
7
-          <view>{{user.nickName||'未更新用户信息'}}</view>
7
+          <view>{{ user.nickName || '未更新用户信息' }}</view>
8 8
           <text class="cuIcon-settings lg text-gray" @tap="goto('setting')"></text>
9 9
         </view>
10 10
         <view class="user">
11 11
           <view class="user-info flex">
12
-            <image mode="scaleToFill" :src="user.avatarUrl||defaultAvatar" class="avatar"></image>
12
+            <image mode="scaleToFill" :src="user.avatarUrl || defaultAvatar" class="avatar"></image>
13 13
             <view class="study-info">
14
-              <view class="user-name" @tap="switchStudent" v-if="isLogin&&user.nickName">
14
+              <view class="user-name" @tap="switchStudent" v-if="isLogin && user.nickName">
15 15
                 {{ kid_info.name + '-' + kid_info.school_name }}
16
-                <text class="iconfont margin-left-xs" style="font-size:18px;">&#xe600;</text>
16
+                <text class="iconfont margin-left-xs" style="font-size: 18px;">&#xe600;</text>
17 17
               </view>
18 18
               <view class="user-name" @tap="login" v-else>
19 19
                 切换学生
20
-                <text class="iconfont margin-left-xs" style="font-size:18px;">&#xe716;</text>
20
+                <text class="iconfont margin-left-xs" style="font-size: 18px;">&#xe716;</text>
21 21
               </view>
22
-              <view class="user-learn">已学习{{info.parent_data.learn_day}}天</view>
22
+              <view class="user-learn">已学习{{ info.parent_data.learn_day }}天</view>
23 23
             </view>
24 24
           </view>
25 25
           <view class="user-relative flex justify-between" v-if="isLogin">
26
-            <view v-for="(relate,index) in courseRelates" :key="index" class="course-item"
27
-              :style="'background:'+relate.background" @tap="goto(relate.page)">
28
-              <text class="iconfont back-img" style="font-size:32px;">{{relate.icon}}</text>
29
-              <view class="text-df">{{relate.name}}</view>
26
+            <view v-for="(relate, index) in courseRelates" :key="index" class="course-item" :style="'background:' + relate.background" @tap="goto(relate.page)">
27
+              <text class="iconfont back-img" style="font-size: 32px;">{{ relate.icon }}</text>
28
+              <view class="text-df">{{ relate.name }}</view>
30 29
             </view>
31 30
           </view>
32 31
           <view class="user-relative flex justify-between" v-else>
33
-            <view class="course-item relate-item" v-for="(course,index) in courses" :key="index"
34
-              :style="'background:'+course.background">
35
-              <text class="iconfont back-img" style="font-size:40px;">{{course.icon}}</text>
36
-              <view class="text-lg">{{course.title}}</view>
37
-              <view class="text-xxl margin-top-xs">{{course.name}}</view>
32
+            <view class="course-item relate-item" v-for="(course, index) in courses" :key="index" :style="'background:' + course.background">
33
+              <text class="iconfont back-img" style="font-size: 40px;">{{ course.icon }}</text>
34
+              <view class="text-lg">{{ course.title }}</view>
35
+              <view class="text-xxl margin-top-xs">{{ course.name }}</view>
38 36
             </view>
39 37
           </view>
40 38
         </view>
41 39
         <view class="order">
42 40
           <view class="order-title solid-bottom">我的订单</view>
43 41
           <view class="order-info flex justify-between">
44
-            <view v-for="(order,index) in menuList" :key="index" @tap="toOrder(index)">
42
+            <view v-for="(order, index) in menuList" :key="index" @tap="toOrder(index)">
45 43
               <view class="order-image">
46
-                <text class="iconfont text-student" style="font-size:32px;">{{order.icon}}</text>
44
+                <text class="iconfont text-student" style="font-size: 32px;">{{ order.icon }}</text>
47 45
               </view>
48
-              {{order.title}}
46
+              {{ order.title }}
49 47
             </view>
50 48
           </view>
51 49
         </view>
52 50
       </view>
53 51
       <view class="margin cu-list box-shadow menu margin-top-lg bg-white">
54 52
         <view class="cu-item arrow" @tap="goto('classCart')">
55
-          <text class="cuIcon-cart lg text-gray" style="font-size:18px;"></text>
53
+          <text class="cuIcon-cart lg text-gray" style="font-size: 18px;"></text>
56 54
           <view class="content margin-left-sm">
57 55
             <text class="text-black">购物车</text>
58 56
           </view>
59 57
           <view class="action"></view>
60 58
         </view>
61 59
         <view class="cu-item arrow" @tap="goto('message')">
62
-          <text class="cuIcon-message lg text-gray" style="font-size:18px;"></text>
60
+          <text class="cuIcon-message lg text-gray" style="font-size: 18px;"></text>
63 61
           <view class="content margin-left-sm">
64 62
             <text class="text-black">消息中心</text>
65 63
           </view>
66 64
           <view class="action"></view>
67 65
         </view>
68 66
         <view class="cu-item arrow" @tap="goto('onlineService')">
69
-          <text class="iconfont text-gray" style="font-size:18px;">&#xe726;</text>
67
+          <text class="iconfont text-gray" style="font-size: 18px;">&#xe726;</text>
70 68
           <view class="content margin-left-sm">
71 69
             <text class="text-black">在线客服</text>
72 70
           </view>
@@ -74,22 +72,17 @@
74 72
       </view>
75 73
     </view>
76 74
     <mp-tabbar :outerSelected="2" />
77
-    <view class="cu-modal drawer-modal justify-start" :class="modalName=='showStudent'?'show':''" @tap="hideModal">
78
-      <scroll-view :scroll-y="true" class="cu-dialog basis-lg" @tap.stop=""
79
-        :style="[{top:topHeader+'px',height:'calc(100vh - 48px - ' + topHeader + 'px)'}]">
75
+    <view class="cu-modal drawer-modal justify-start" :class="modalName == 'showStudent' ? 'show' : ''" @tap="hideModal">
76
+      <scroll-view :scroll-y="true" class="cu-dialog basis-lg" @tap.stop="" :style="[{ top: topHeader + 'px', height: 'calc(100vh - 48px - ' + topHeader + 'px)' }]">
80 77
         <view class="student-list padding-left">
81
-          <view class="student margin-top-sm" v-for="(student,index) in students" :key="index"
82
-            @tap="chooseKid(student.id)">
78
+          <view class="student margin-top-sm" v-for="(student, index) in students" :key="index" @tap="chooseKid(student.id)">
83 79
             <view class="flex align-center">
84 80
               <image mode="scaleToFill" :src="defaultAvatar" class="avatar md"></image>
85
-              <view class="margin-left-sm">{{student.name}}</view>
86
-              <text class="cuIcon-check text-student margin-left" style="font-size:22px;"
87
-                v-if="kid===student.id"></text>
81
+              <view class="margin-left-sm">{{ student.name }}</view>
82
+              <text class="cuIcon-check text-student margin-left" style="font-size: 22px;" v-if="kid === student.id"></text>
88 83
             </view>
89 84
             <view class="flex">
90
-              <view class="cu-tag line-green margin-top-xs">
91
-                {{student.school_name ? student.school_name : ''}}-{{student.grade_name}}-{{student.class_name}}
92
-              </view>
85
+              <view class="cu-tag line-green margin-top-xs"> {{ student.school_name ? student.school_name : '' }}-{{ student.grade_name }}-{{ student.class_name }} </view>
93 86
             </view>
94 87
           </view>
95 88
         </view>
@@ -102,7 +95,7 @@
102 95
 import { mapGetters } from 'vuex'
103 96
 import { _getStudents, _getUserInfo } from '@/api/auth'
104 97
 export default {
105
-  data () {
98
+  data() {
106 99
     return {
107 100
       topHeader: this.globalCustomBarHeight,
108 101
       info: {},
@@ -189,20 +182,20 @@ export default {
189 182
       kid: 'kid'
190 183
     })
191 184
   },
192
-  onShow () {
185
+  onShow() {
193 186
     this.get_info()
194 187
   },
195 188
   methods: {
196
-    login () {
189
+    login() {
197 190
       this.globalNavigateTo('login')
198 191
     },
199
-    get_info () {
192
+    get_info() {
200 193
       _getUserInfo().then(res => {
201 194
         this.info = res.data
202 195
         this.get_students()
203 196
       })
204 197
     },
205
-    get_students () {
198
+    get_students() {
206 199
       _getStudents().then(res => {
207 200
         if (res.data.length < 1) {
208 201
           this.globalNavigateTo('myStudents')
@@ -217,26 +210,27 @@ export default {
217 210
         this.setkidInfo(kid)
218 211
       })
219 212
     },
220
-    hideModal (e) {
213
+    hideModal(e) {
221 214
       this.modalName = null
222 215
     },
223
-    setkidInfo (kid) { // 设置学生信息
216
+    setkidInfo(kid) {
217
+      // 设置学生信息
224 218
       this.kid_info = this.students.find(item => item.id === kid)
225 219
     },
226
-    switchStudent () {
220
+    switchStudent() {
227 221
       this.modalName = 'showStudent'
228 222
     },
229
-    goto (page) {
223
+    goto(page) {
230 224
       if (!this.isLogin) {
231 225
         this.globalNavigateTo('login')
232 226
       } else {
233 227
         this.globalNavigateTo(page)
234 228
       }
235 229
     },
236
-    toOrder (index) {
230
+    toOrder(index) {
237 231
       this.globalNavigateTo('order', { type: index })
238 232
     },
239
-    chooseKid (id) {
233
+    chooseKid(id) {
240 234
       uni.showModal({
241 235
         title: '',
242 236
         content: '确定选择该学生?',