7 Commits d46bfb934e ... 859fa17ff8

Author SHA1 Message Date
  seamwang 859fa17ff8 Merge branch 'master' into dev_seam_intelligent 1 year ago
  seamwang f92ae6281c no message 1 year ago
  seamwang 892d8dba35 no message 1 year ago
  seamwang 5b00e0734f no message 1 year ago
  seamwang 56ffd847c5 Merge branch 'master' into dev_seam_intelligent 2 years ago
  seamwang fa1f4f0845 Merge branch 'master' into dev_seam_intelligent 2 years ago
  seamwang e1e4e90b07 no message 2 years ago

+ 5 - 1
src/api/course.js

@@ -112,10 +112,14 @@ export function _commentDetail (params) {
112
 export function _leaveType (params) {
112
 export function _leaveType (params) {
113
 	return fetch('/teacher/leave/get_leave_type', params)
113
 	return fetch('/teacher/leave/get_leave_type', params)
114
 }
114
 }
115
-// 申请请假 parents/schedule/student_leave
115
+// 申请请假
116
 export function _askLeave (params) {
116
 export function _askLeave (params) {
117
 	return fetch('/parents/schedule/student_leave', params)
117
 	return fetch('/parents/schedule/student_leave', params)
118
 }
118
 }
119
+//获取学生课程档案
120
+export function _getStudentFiles (params) {
121
+	return fetch('/parents/courseFiles/get_list', params)
122
+}
119
 //获取年级
123
 //获取年级
120
 export function _getGrades () {
124
 export function _getGrades () {
121
 	return fetch('/parents/init/get_grades')
125
 	return fetch('/parents/init/get_grades')

+ 44 - 43
src/common/commonMethods.js

@@ -2,55 +2,56 @@
2
 import urlMap from '@/common/urlMap'
2
 import urlMap from '@/common/urlMap'
3
 
3
 
4
 const encodeParam = function (params) {
4
 const encodeParam = function (params) {
5
-  let url = ''
6
-  for (const k in params) {
7
-    const value = params[k] !== undefined ? params[k] : ''
8
-    url += '&' + k + '=' + encodeURIComponent(value)
9
-  }
10
-  return url ? url.substring(1) : ''
5
+	let url = ''
6
+	for (const k in params) {
7
+		const value = params[k] !== undefined ? params[k] : ''
8
+		url += '&' + k + '=' + encodeURIComponent(value)
9
+	}
10
+	return url ? url.substring(1) : ''
11
 }
11
 }
12
 
12
 
13
 const routerToFail = function (err) {
13
 const routerToFail = function (err) {
14
-  console.log(err, '跳转新页面失败')
14
+	console.log(err, '跳转新页面失败')
15
 }
15
 }
16
 
16
 
17
 const commonMethods = {
17
 const commonMethods = {
18
-  /**
19
-   * 保留当前页面,跳转到应用内的某个页面,使用uni.navigateBack可以返回到原页面
20
-   * 页面跳转路径有层级限制,不能无限制跳转新页面
21
-   * @param {*} type 路径唯一类型
22
-   * @param {*} params 路径参数
23
-   * @returns {*} null
24
-   */
25
-  globalNavigateTo: function (type, params) {
26
-    if (urlMap.has(type)) {
27
-      let url = urlMap.get(type)
28
-      if (params) {
29
-        url += (url.indexOf('?') < 0 && params ? '?' : '&') + encodeParam(params)
30
-      }
31
-      uni.navigateTo({ url, fail: routerToFail })
32
-    }
33
-  },
34
-  // 关闭当前页面,跳转到应用内的某个页面
35
-  globalRedirectTo: function (type, params) {
36
-    if (urlMap.has(type)) {
37
-      let url = urlMap.get(type)
38
-      if (params) {
39
-        url += (url.indexOf('?') < 0 && params ? '?' : '&') + encodeParam(params)
40
-      }
41
-      uni.redirectTo({ url, fail: routerToFail })
42
-    }
43
-  },
44
-  // 关闭所有页面,打开应用内的某个页面
45
-  globalReLaunch: function (type, params) {
46
-    if (urlMap.has(type)) {
47
-      let url = urlMap.get(type)
48
-      if (params) {
49
-        url += (url.indexOf('?') < 0 && params ? '?' : '&') + encodeParam(params)
50
-      }
51
-      uni.reLaunch({ url, fail: routerToFail })
52
-    }
53
-  }
18
+	encodeParam,
19
+	/**
20
+	 * 保留当前页面,跳转到应用内的某个页面,使用uni.navigateBack可以返回到原页面
21
+	 * 页面跳转路径有层级限制,不能无限制跳转新页面
22
+	 * @param {*} type 路径唯一类型
23
+	 * @param {*} params 路径参数
24
+	 * @returns {*} null
25
+	 */
26
+	globalNavigateTo: function (type, params) {
27
+		if (urlMap.has(type)) {
28
+			let url = urlMap.get(type)
29
+			if (params) {
30
+				url += (url.indexOf('?') < 0 && params ? '?' : '&') + encodeParam(params)
31
+			}
32
+			uni.navigateTo({ url, fail: routerToFail })
33
+		}
34
+	},
35
+	// 关闭当前页面,跳转到应用内的某个页面
36
+	globalRedirectTo: function (type, params) {
37
+		if (urlMap.has(type)) {
38
+			let url = urlMap.get(type)
39
+			if (params) {
40
+				url += (url.indexOf('?') < 0 && params ? '?' : '&') + encodeParam(params)
41
+			}
42
+			uni.redirectTo({ url, fail: routerToFail })
43
+		}
44
+	},
45
+	// 关闭所有页面,打开应用内的某个页面
46
+	globalReLaunch: function (type, params) {
47
+		if (urlMap.has(type)) {
48
+			let url = urlMap.get(type)
49
+			if (params) {
50
+				url += (url.indexOf('?') < 0 && params ? '?' : '&') + encodeParam(params)
51
+			}
52
+			uni.reLaunch({ url, fail: routerToFail })
53
+		}
54
+	}
54
 }
55
 }
55
 
56
 
56
 export default commonMethods
57
 export default commonMethods

+ 11 - 0
src/common/css/common.css

@@ -122,6 +122,13 @@ input{
122
 .bg-student{
122
 .bg-student{
123
 	background-color:#5fd0e4;
123
 	background-color:#5fd0e4;
124
 }
124
 }
125
+.bg-teacher{
126
+	background-color:#37CAA0;
127
+}
128
+.bg-light-green{
129
+	color:#fff;
130
+	background-color:#09e294;
131
+}
125
 .bg-normal{
132
 .bg-normal{
126
 	background-color: #4DB8E4;
133
 	background-color: #4DB8E4;
127
 }
134
 }
@@ -172,6 +179,10 @@ input{
172
 	width:128rpx;
179
 	width:128rpx;
173
 	height:128rpx;
180
 	height:128rpx;
174
 }
181
 }
182
+.avatar.xl{
183
+	width:180rpx;
184
+	height:180rpx;
185
+}
175
 .avatar.md{
186
 .avatar.md{
176
 	width:96rpx;
187
 	width:96rpx;
177
 	height:96rpx;
188
 	height:96rpx;

+ 2 - 0
src/common/urlMap.js

@@ -25,5 +25,7 @@ urlMap.set('classCart', '/pages/class/shoppingCart')
25
 urlMap.set('bindPhone', '/pages/class/bindPhone')
25
 urlMap.set('bindPhone', '/pages/class/bindPhone')
26
 urlMap.set('order', '/pages/order/index')
26
 urlMap.set('order', '/pages/order/index')
27
 urlMap.set('agreement', '/pages/agreement/index')
27
 urlMap.set('agreement', '/pages/agreement/index')
28
+urlMap.set('courseFiles', '/pages/mine/courseFiles')
29
+urlMap.set('fileDetail', '/pages/mine/fileDetail')
28
 
30
 
29
 export default urlMap
31
 export default urlMap

+ 105 - 0
src/components/star-rating.vue

@@ -0,0 +1,105 @@
1
+<template>
2
+  <view class="star-rating">
3
+    <view class="star-rating-box" @touchstart="fun" @touchmove.stop.prevent="fun">
4
+      <image v-for="(item, i) in max" :key="i" class="icon-start" :src="(i + 1) | getSrc(score)" mode=""></image>
5
+    </view>
6
+    <text class="star-rating-title">{{ title }}</text>
7
+  </view>
8
+</template>
9
+
10
+<script>
11
+export default {
12
+  name: 'star-rating',
13
+  data() {
14
+    return {
15
+      iconStartSrcList: [
16
+        '/static/imgs/star-rating/delivery_icon_star_empty.png',
17
+        '/static/imgs/star-rating/delivery_icon_star_disable.png',
18
+        '/static/imgs/star-rating/delivery_icon_star_active.png'
19
+      ],
20
+      title: '',
21
+      width: 0
22
+    }
23
+  },
24
+  props: {
25
+    max: {
26
+      type: Number,
27
+      default: 5
28
+    },
29
+    name: {
30
+      type: String,
31
+      default: ''
32
+    },
33
+    score: {
34
+      type: Number,
35
+      default: 0
36
+    }
37
+  },
38
+  methods: {
39
+    fun(e) {
40
+      let score = Math.ceil(((e.changedTouches[0].pageX - e.currentTarget.offsetLeft) / this.width) * 5)
41
+      if (score >= 5) score = 5
42
+      if (score <= 0) score = 0
43
+      this.$emit('changeScore', {
44
+        name: this.name,
45
+        score
46
+      })
47
+    },
48
+    getDescBox() {
49
+      uni
50
+        .createSelectorQuery()
51
+        .in(this)
52
+        .select('.star-rating-box')
53
+        .boundingClientRect(result => {
54
+          if (result) {
55
+            this.width = result.width
56
+          } else {
57
+            this.getDescBox()
58
+          }
59
+        })
60
+        .exec()
61
+    }
62
+  },
63
+  mounted() {
64
+    this.$nextTick(() => {
65
+      this.getDescBox()
66
+    })
67
+  },
68
+  filters: {
69
+    getSrc: function (i, score) {
70
+      if (score == 0) return '/static/imgs/star-rating/delivery_icon_star_empty.png'
71
+      if (score < i) return '/static/imgs/star-rating/delivery_icon_star_disable.png'
72
+      if (score >= i) return '/static/imgs/star-rating/delivery_icon_star_active.png'
73
+    }
74
+  },
75
+  watch: {
76
+    score(val) {
77
+      if (val == 0) this.title = ''
78
+      if (val == 1) this.title = '非常差'
79
+      if (val == 2) this.title = '差'
80
+      if (val == 3) this.title = '一般'
81
+      if (val == 4) this.title = '满意'
82
+      if (val == 5) this.title = '非常满意'
83
+    }
84
+  }
85
+}
86
+</script>
87
+
88
+<style lang="scss">
89
+.star-rating {
90
+  display: flex;
91
+  align-items: center;
92
+
93
+  .icon-start {
94
+    width: 30rpx;
95
+    height: 30rpx;
96
+    margin: 0 6rpx;
97
+  }
98
+
99
+  .star-rating-title {
100
+    padding-left: 30rpx;
101
+    color: #999;
102
+    font-size: 24rpx;
103
+  }
104
+}
105
+</style>

+ 9 - 1
src/pages.json

@@ -95,11 +95,19 @@
95
     {
95
     {
96
       "path": "pages/agreement/index",
96
       "path": "pages/agreement/index",
97
       "style": {}
97
       "style": {}
98
+    },
99
+    {
100
+      "path": "pages/mine/courseFiles",
101
+      "style": {}
102
+    },
103
+    {
104
+      "path": "pages/mine/fileDetail",
105
+      "style": {}
98
     }
106
     }
99
   ],
107
   ],
100
   "globalStyle": {
108
   "globalStyle": {
101
     "navigationBarBackgroundColor": "#FFFFFF",
109
     "navigationBarBackgroundColor": "#FFFFFF",
102
-    "navigationBarTitleText": "1212",
110
+    "navigationBarTitleText": "课后百科",
103
     "navigationStyle": "custom",
111
     "navigationStyle": "custom",
104
     "navigationBarTextStyle": "black",
112
     "navigationBarTextStyle": "black",
105
     "animationType": "slide-out-right"
113
     "animationType": "slide-out-right"

+ 59 - 65
src/pages/class/detail.vue

@@ -1,22 +1,20 @@
1
 <template>
1
 <template>
2
   <view class="page">
2
   <view class="page">
3
     <cu-custom :isBack="true"></cu-custom>
3
     <cu-custom :isBack="true"></cu-custom>
4
-    <view class="header" :style="[{top:topHeader + 'px'}]">
4
+    <view class="header" :style="[{ top: topHeader + 'px' }]">
5
       <view class="header-title">
5
       <view class="header-title">
6
         <view class="header-title-main">
6
         <view class="header-title-main">
7
-          <view class="margin-bottom-xs">{{tabList[cate_type].title}}</view>
7
+          <view class="margin-bottom-xs">{{ tabList[cate_type].title }}</view>
8
           <view class="point"></view>
8
           <view class="point"></view>
9
         </view>
9
         </view>
10
       </view>
10
       </view>
11
       <swiper-tab :menuList="tabList[cate_type].list" @changeTab="changeTab"></swiper-tab>
11
       <swiper-tab :menuList="tabList[cate_type].list" @changeTab="changeTab"></swiper-tab>
12
     </view>
12
     </view>
13
-    <scroll-view v-if="currentIndex===0" :scroll-y="true" :style="[{height:'calc(100vh - 70px - '+ topHeader+'px)'}]"
14
-      class="scroll-main">
13
+    <scroll-view v-if="currentIndex === 0" :scroll-y="true" :style="[{ height: 'calc(100vh - 70px - ' + topHeader + 'px)' }]" class="scroll-main">
15
       <view class="content">
14
       <view class="content">
16
         <view class="course-img">
15
         <view class="course-img">
17
-          <swiper class="swiper" :indicator-dots="swiper.indicatorDots" :autoplay="swiper.autoplay"
18
-            :interval="swiper.interval" :duration="swiper.duration">
19
-            <swiper-item v-for="(item,index) in detail.image" :key="index">
16
+          <swiper class="swiper" :indicator-dots="swiper.indicatorDots" :autoplay="swiper.autoplay" :interval="swiper.interval" :duration="swiper.duration">
17
+            <swiper-item v-for="(item, index) in detail.image" :key="index">
20
               <view class="swiper-item">
18
               <view class="swiper-item">
21
                 <image :src="item" mode="widthFix"></image>
19
                 <image :src="item" mode="widthFix"></image>
22
               </view>
20
               </view>
@@ -25,66 +23,67 @@
25
         </view>
23
         </view>
26
         <!-- 详情 -->
24
         <!-- 详情 -->
27
         <view class="detail">
25
         <view class="detail">
28
-          <view class="detail-title">{{detail.name}}</view>
26
+          <view class="detail-title">{{ detail.name }}</view>
29
           <view class="detail-item">
27
           <view class="detail-item">
30
             <view class="detail-item-point"></view>
28
             <view class="detail-item-point"></view>
31
             <view class="detail-label">周期</view>
29
             <view class="detail-label">周期</view>
32
-            <view class="detail-text">{{detail.period}}<text class="text-gray">({{detail.time[0]}})</text></view>
30
+            <view class="detail-text"
31
+              >{{ detail.period }}<text class="text-gray">({{ detail.time[0] }})</text></view
32
+            >
33
           </view>
33
           </view>
34
           <view class="detail-item">
34
           <view class="detail-item">
35
             <view class="detail-item-point"></view>
35
             <view class="detail-item-point"></view>
36
             <view class="detail-label">适用年级</view>
36
             <view class="detail-label">适用年级</view>
37
-            <view class="detail-text">{{detail.grade}}年级通用</view>
37
+            <view class="detail-text">{{ detail.grade }}年级通用</view>
38
           </view>
38
           </view>
39
           <view class="detail-item">
39
           <view class="detail-item">
40
             <view class="detail-item-point"></view>
40
             <view class="detail-item-point"></view>
41
             <view class="detail-label">课时</view>
41
             <view class="detail-label">课时</view>
42
-            <view class="detail-text">{{detail.class_total}}课时</view>
42
+            <view class="detail-text">{{ detail.class_total }}课时</view>
43
           </view>
43
           </view>
44
           <view class="detail-item">
44
           <view class="detail-item">
45
             <view class="detail-item-point"></view>
45
             <view class="detail-item-point"></view>
46
             <view class="detail-label">单课时价</view>
46
             <view class="detail-label">单课时价</view>
47
-            <view class="detail-text">¥{{detail.single_money}}</view>
47
+            <view class="detail-text">¥{{ detail.single_money }}</view>
48
           </view>
48
           </view>
49
           <view class="detail-item">
49
           <view class="detail-item">
50
             <view class="detail-item-point"></view>
50
             <view class="detail-item-point"></view>
51
             <view class="detail-label">补贴</view>
51
             <view class="detail-label">补贴</view>
52
-            <view class="detail-text">¥{{detail.subsidy}}/节课</view>
52
+            <view class="detail-text">¥{{ detail.subsidy }}/节课</view>
53
           </view>
53
           </view>
54
           <view class="detail-item">
54
           <view class="detail-item">
55
             <view class="detail-item-point"></view>
55
             <view class="detail-item-point"></view>
56
             <view class="detail-label">培养目标</view>
56
             <view class="detail-label">培养目标</view>
57
-            <view class="detail-text">{{detail.tenet}}</view>
57
+            <view class="detail-text">{{ detail.tenet }}</view>
58
           </view>
58
           </view>
59
         </view>
59
         </view>
60
       </view>
60
       </view>
61
       <!-- 老师介绍 -->
61
       <!-- 老师介绍 -->
62
-      <view class="teacher flex margin-top-sm shadow" v-if="cate_type===0">
62
+      <view class="teacher flex margin-top-sm shadow" v-if="cate_type === 0">
63
         <image mode="scaleToFill" :src="defaultTeacher" class="avatar lg"></image>
63
         <image mode="scaleToFill" :src="defaultTeacher" class="avatar lg"></image>
64
         <view class="flex-sub margin-left">
64
         <view class="flex-sub margin-left">
65
-          <view class="teacher-title">{{detail.teachers.username||''}}老师授课</view>
66
-          <view class="teacher-item">毕业于{{detail.teachers.agency_name||''}}</view>
67
-          <view class="teacher-item">所属机构:{{detail.teachers.orz||''}}</view>
65
+          <view class="teacher-title">{{ detail.teachers.username || '' }}老师授课</view>
66
+          <view class="teacher-item">毕业于{{ detail.teachers.agency_name || '' }}</view>
67
+          <view class="teacher-item">所属机构:{{ detail.teachers.orz || '' }}</view>
68
           <view class="teacher-exp flex">
68
           <view class="teacher-exp flex">
69
-            <view class="exp-item">{{detail.teachers.honor||''}}</view>
70
-            <view class="exp-item">{{detail.teachers.introduce||''}}</view>
69
+            <view class="exp-item">{{ detail.teachers.honor || '' }}</view>
70
+            <view class="exp-item">{{ detail.teachers.introduce || '' }}</view>
71
           </view>
71
           </view>
72
         </view>
72
         </view>
73
       </view>
73
       </view>
74
       <!-- 道具选择 -->
74
       <!-- 道具选择 -->
75
-      <view class="shop margin-top-sm shadow" v-if="detail.prop&&detail.prop.length>0">
75
+      <view class="shop margin-top-sm shadow" v-if="detail.prop && detail.prop.length > 0">
76
         <view class="shop-title">请选择课程所需要的道具</view>
76
         <view class="shop-title">请选择课程所需要的道具</view>
77
         <radio-group @change="radioChange" class="margin-top-xs">
77
         <radio-group @change="radioChange" class="margin-top-xs">
78
           <label v-for="radio in radios" :key="radio.value" class="tool-choose margin-right-sm">
78
           <label v-for="radio in radios" :key="radio.value" class="tool-choose margin-right-sm">
79
-            <radio :value="radio.value" class="cyan" :checked="radio.checked" style="transform:scale(0.7)" />
80
-            {{radio.name}}
79
+            <radio :value="radio.value" class="cyan" :checked="radio.checked" style="transform: scale(0.7);" />
80
+            {{ radio.name }}
81
           </label>
81
           </label>
82
         </radio-group>
82
         </radio-group>
83
-        <checkbox-group @change="checkboxChange" v-if="needTool==='1'" class="checkbox-group margin-top-xs">
83
+        <checkbox-group @change="checkboxChange" v-if="needTool === '1'" class="checkbox-group margin-top-xs">
84
           <label v-for="prop in detail.prop" :key="prop.id">
84
           <label v-for="prop in detail.prop" :key="prop.id">
85
             <view class="tool-choose-item">
85
             <view class="tool-choose-item">
86
-              <checkbox :value="prop.id" class="cyan" style="transform:scale(0.7)"
87
-                :checked="goods.props.includes(prop.id)" />{{prop.name}}<text>¥{{prop.money}}</text>
86
+              <checkbox :value="prop.id" class="cyan" style="transform: scale(0.7);" :checked="goods.props.includes(prop.id)" />{{ prop.name }}<text>¥{{ prop.money }}</text>
88
             </view>
87
             </view>
89
           </label>
88
           </label>
90
         </checkbox-group>
89
         </checkbox-group>
@@ -95,18 +94,17 @@
95
       </view>
94
       </view>
96
     </scroll-view>
95
     </scroll-view>
97
     <!-- 评价页 -->
96
     <!-- 评价页 -->
98
-    <scroll-view :style="[{height:'calc(100vh - 70px - '+ topHeader+'px)'}]" class="scroll-main"
99
-      v-if="currentIndex===1">
97
+    <scroll-view :style="[{ height: 'calc(100vh - 70px - ' + topHeader + 'px)' }]" class="scroll-main" v-if="currentIndex === 1">
100
       <view class="cu-list menu-avatar comment">
98
       <view class="cu-list menu-avatar comment">
101
-        <view class="cu-item" v-for="(comment,index) in comments" :key="index">
99
+        <view class="cu-item" v-for="(comment, index) in comments" :key="index">
102
           <image mode="scaleToFill" :src="comment.img" class="avatar md left"></image>
100
           <image mode="scaleToFill" :src="comment.img" class="avatar md left"></image>
103
           <view class="content">
101
           <view class="content">
104
-            <view class="text-grey">{{comment.name}}</view>
102
+            <view class="text-grey">{{ comment.name }}</view>
105
             <view class="text-gray text-content text-df">
103
             <view class="text-gray text-content text-df">
106
-              {{comment.content}}
104
+              {{ comment.content }}
107
             </view>
105
             </view>
108
             <view class="margin-top-sm flex justify-between">
106
             <view class="margin-top-sm flex justify-between">
109
-              <view class="text-gray text-df">{{comment.date}}</view>
107
+              <view class="text-gray text-df">{{ comment.date }}</view>
110
               <!-- <view>
108
               <!-- <view>
111
 									<text class="cuIcon-appreciatefill text-red"></text>
109
 									<text class="cuIcon-appreciatefill text-red"></text>
112
 									<text class="cuIcon-messagefill text-gray margin-left-sm"></text>
110
 									<text class="cuIcon-messagefill text-gray margin-left-sm"></text>
@@ -117,44 +115,40 @@
117
       </view>
115
       </view>
118
     </scroll-view>
116
     </scroll-view>
119
     <!-- 视频页 -->
117
     <!-- 视频页 -->
120
-    <scroll-view :style="[{height:'calc(100vh - 70px - '+ topHeader+'px)'}]" class="scroll-main"
121
-      v-if="currentIndex===2">
118
+    <scroll-view :style="[{ height: 'calc(100vh - 70px - ' + topHeader + 'px)' }]" class="scroll-main" v-if="currentIndex === 2">
122
       <view class="list">
119
       <view class="list">
123
-        <view class="cu-card case" v-for="(video,index) in detail.video" :key="index">
120
+        <view class="cu-card case" v-for="(video, index) in detail.video" :key="index">
124
           <view class="cu-item shadow">
121
           <view class="cu-item shadow">
125
             <view class="image">
122
             <view class="image">
126
-              <video :src="video" style="width:100%;"></video>
123
+              <video :src="video" style="width: 100%;"></video>
127
             </view>
124
             </view>
128
           </view>
125
           </view>
129
         </view>
126
         </view>
130
       </view>
127
       </view>
131
     </scroll-view>
128
     </scroll-view>
132
     <!-- 大纲页 -->
129
     <!-- 大纲页 -->
133
-    <scroll-view :scroll-y="true" :style="[{height:'calc(100vh - 70px - '+ topHeader+'px)'}]" class="scroll-main"
134
-      v-if="currentIndex===3">
130
+    <scroll-view :scroll-y="true" :style="[{ height: 'calc(100vh - 70px - ' + topHeader + 'px)' }]" class="scroll-main" v-if="currentIndex === 3">
135
       <view class="cu-bar bg-white">
131
       <view class="cu-bar bg-white">
136
         <view class="action border-title">
132
         <view class="action border-title">
137
           <text class="cuIcon-title text-student"></text>
133
           <text class="cuIcon-title text-student"></text>
138
-          <text class="text-xl text-bold">{{tabList[cate_type].list[currentIndex]}}</text>
134
+          <text class="text-xl text-bold">{{ tabList[cate_type].list[currentIndex] }}</text>
139
         </view>
135
         </view>
140
       </view>
136
       </view>
141
       <view class="bg-white padding-lr">
137
       <view class="bg-white padding-lr">
142
-        <view class="text-content text-lg" v-for="(outline,index) in detail.out_line" :key="index">
143
-          {{outline.course_content}}
138
+        <view class="text-content text-lg" v-for="(outline, index) in detail.out_line" :key="index">
139
+          {{ outline.course_content }}
144
         </view>
140
         </view>
145
       </view>
141
       </view>
146
     </scroll-view>
142
     </scroll-view>
147
     <view class="static flex shadow">
143
     <view class="static flex shadow">
148
       <view class="static-price">
144
       <view class="static-price">
149
         <text class="satic-label text-lg">小计:</text>
145
         <text class="satic-label text-lg">小计:</text>
150
-        <text class="text-price text-red text-lg">{{goods.sum_money}}</text>
146
+        <text class="text-price text-red text-lg">{{ goods.sum_money }}</text>
151
       </view>
147
       </view>
152
-      <view class="static-choose text-ellipsis" v-if="goods.choose.length>0">(已选:{{goods.choose.join(',')}})</view>
148
+      <view class="static-choose text-ellipsis" v-if="goods.choose.length > 0">(已选:{{ goods.choose.join(',') }})</view>
153
       <view class="static-order flex align-center">
149
       <view class="static-order flex align-center">
154
-        <shop-cart :class_attend_id="attend_id" :disableBtn="disableBtn" @changeDisableBtn="changeDisableBtn">
155
-        </shop-cart>
156
-        <button class="cu-btn round bg-student text-white margin-left-xs"
157
-          :class="{'disabled':carts.includes(attend_id)||!detail.enable}" @tap="addCart">报课</button>
150
+        <shop-cart :class_attend_id="attend_id" :disableBtn="disableBtn" @changeDisableBtn="changeDisableBtn"> </shop-cart>
151
+        <button class="cu-btn round bg-student text-white margin-left-xs" :class="{ disabled: carts.includes(attend_id) || !detail.enable }" @tap="addCart">报课</button>
158
       </view>
152
       </view>
159
     </view>
153
     </view>
160
   </view>
154
   </view>
@@ -168,9 +162,10 @@ import NP from 'number-precision'
168
 import { mapGetters } from 'vuex'
162
 import { mapGetters } from 'vuex'
169
 export default {
163
 export default {
170
   components: {
164
   components: {
171
-    swiperTab, shopCart
165
+    swiperTab,
166
+    shopCart
172
   },
167
   },
173
-  data () {
168
+  data() {
174
     return {
169
     return {
175
       topHeader: this.globalCustomBarHeight,
170
       topHeader: this.globalCustomBarHeight,
176
       swiper: {
171
       swiper: {
@@ -192,10 +187,11 @@ export default {
192
         { value: '1', name: '需要道具', checked: true },
187
         { value: '1', name: '需要道具', checked: true },
193
         { value: '2', name: '不需要道具', checked: false }
188
         { value: '2', name: '不需要道具', checked: false }
194
       ],
189
       ],
195
-      goods: { // 动态选中值
190
+      goods: {
191
+        // 动态选中值
196
         props: [], // 选中值
192
         props: [], // 选中值
197
         choose: [], // 选中名称
193
         choose: [], // 选中名称
198
-        sum_money: 0// 金额总计
194
+        sum_money: 0 // 金额总计
199
       }, // 选中课程
195
       }, // 选中课程
200
       tabList: [
196
       tabList: [
201
         {
197
         {
@@ -244,12 +240,10 @@ export default {
244
     }
240
     }
245
   },
241
   },
246
   computed: {
242
   computed: {
247
-    ...mapGetters([
248
-      'carts'
249
-    ])
243
+    ...mapGetters(['carts'])
250
   },
244
   },
251
   // 配置分享
245
   // 配置分享
252
-  onShareAppMessage (res) {
246
+  onShareAppMessage(res) {
253
     if (res.from === 'button') {
247
     if (res.from === 'button') {
254
       // 来自页面内分享按钮
248
       // 来自页面内分享按钮
255
       console.log(res.target)
249
       console.log(res.target)
@@ -259,10 +253,10 @@ export default {
259
       path: `/pages/class/detail?attend_id=${this.attend_id}`
253
       path: `/pages/class/detail?attend_id=${this.attend_id}`
260
     }
254
     }
261
   },
255
   },
262
-  onShow () {
256
+  onShow() {
263
     this.disableBtn = false
257
     this.disableBtn = false
264
   },
258
   },
265
-  onLoad (option) {
259
+  onLoad(option) {
266
     this.attend_id = Number(decodeURIComponent(option.attend_id))
260
     this.attend_id = Number(decodeURIComponent(option.attend_id))
267
     if (this.attend_id === 0) {
261
     if (this.attend_id === 0) {
268
       uni.navigateBack()
262
       uni.navigateBack()
@@ -271,7 +265,7 @@ export default {
271
     this.get_comments()
265
     this.get_comments()
272
   },
266
   },
273
   methods: {
267
   methods: {
274
-    get_detail () {
268
+    get_detail() {
275
       _detail({ class_attend_id: this.attend_id }).then(res => {
269
       _detail({ class_attend_id: this.attend_id }).then(res => {
276
         this.detail = res.data
270
         this.detail = res.data
277
         this.money = res.data.sum_money
271
         this.money = res.data.sum_money
@@ -283,10 +277,10 @@ export default {
283
         }
277
         }
284
       })
278
       })
285
     },
279
     },
286
-    changeDisableBtn () {
280
+    changeDisableBtn() {
287
       this.disableBtn = true
281
       this.disableBtn = true
288
     },
282
     },
289
-    addCart () {
283
+    addCart() {
290
       if (this.disableBtn) return false
284
       if (this.disableBtn) return false
291
       this.disableBtn = true
285
       this.disableBtn = true
292
       if (!this.detail.enable) {
286
       if (!this.detail.enable) {
@@ -303,20 +297,20 @@ export default {
303
         }
297
         }
304
       })
298
       })
305
     },
299
     },
306
-    setDefaultGoods (props) {
300
+    setDefaultGoods(props) {
307
       this.goods.props[0] = props[0].id
301
       this.goods.props[0] = props[0].id
308
       this.goods.sum_money = NP.plus(this.money, props[0].money)
302
       this.goods.sum_money = NP.plus(this.money, props[0].money)
309
       this.goods.choose[0] = props[0].name
303
       this.goods.choose[0] = props[0].name
310
     },
304
     },
311
-    get_comments () {
305
+    get_comments() {
312
       _comments({ class_attend_id: this.attend_id }).then(res => {
306
       _comments({ class_attend_id: this.attend_id }).then(res => {
313
         this.comemnts = res.data
307
         this.comemnts = res.data
314
       })
308
       })
315
     },
309
     },
316
-    changeTab (index) {
310
+    changeTab(index) {
317
       this.currentIndex = index
311
       this.currentIndex = index
318
     },
312
     },
319
-    radioChange (e) {
313
+    radioChange(e) {
320
       const value = e.detail.value
314
       const value = e.detail.value
321
       this.needTool = value
315
       this.needTool = value
322
       if (value === '1') {
316
       if (value === '1') {
@@ -327,7 +321,7 @@ export default {
327
         this.goods.choose = []
321
         this.goods.choose = []
328
       }
322
       }
329
     },
323
     },
330
-    checkboxChange (e) {
324
+    checkboxChange(e) {
331
       const values = e.detail.value
325
       const values = e.detail.value
332
       const choose = []
326
       const choose = []
333
       const props = []
327
       const props = []

+ 130 - 64
src/pages/class/gift.vue

@@ -1,91 +1,125 @@
1
 <template>
1
 <template>
2
-  <view class="page">
2
+  <view class="page" style="background-color: #fff;">
3
     <cu-custom :isBack="true" title="智能报课"></cu-custom>
3
     <cu-custom :isBack="true" title="智能报课"></cu-custom>
4
-    <view class="steps padding-tb">
4
+    <view class="steps solid-bottom flex justify-between">
5
+      <!-- <view class="text-center"><text class="text-red">点击切换下一步</text></view>
5
       <view class="cu-steps">
6
       <view class="cu-steps">
6
         <view class="cu-item" :class="index > cur ? '' : 'text-student'" v-for="(item, index) in numList" :key="index" @tap="changeStep(index)">
7
         <view class="cu-item" :class="index > cur ? '' : 'text-student'" v-for="(item, index) in numList" :key="index" @tap="changeStep(index)">
7
           <text class="num" :data-index="index + 1"></text> {{ item.name }}
8
           <text class="num" :data-index="index + 1"></text> {{ item.name }}
8
         </view>
9
         </view>
9
-      </view>
10
+      </view> -->
11
+      <view v-for="(item, index) in stepList" :key="index" class="step flex-sub text-center" :class="{ cur: cur === index }" @tap="changeStep(index)">{{ item.name }}</view>
10
     </view>
12
     </view>
11
-    <view class="main bg-white" :style="[{ height: 'calc(100vh - 92px - ' + topHeader + 'px)' }]">
13
+    <view class="main" :style="[{ height: 'calc(100vh - 40px - ' + topHeader + 'px)' }]">
12
       <swiper @change="swipeChange" :current="cur" class="swipe">
14
       <swiper @change="swipeChange" :current="cur" class="swipe">
13
         <swiper-item @touchmove.stop>
15
         <swiper-item @touchmove.stop>
14
           <view class="btn-check-group padding">
16
           <view class="btn-check-group padding">
15
             <checkbox-group @change="checkboxChange" class="flex justify-between" style="flex-wrap: wrap;" id="week">
17
             <checkbox-group @change="checkboxChange" class="flex justify-between" style="flex-wrap: wrap;" id="week">
16
-              <label class="btn-check-label margin" :class="{ 'bg-cyan': params.week.includes(item.key + '') }" v-for="item in days" :key="item.key">
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 :value="item.key" />
19
                 <checkbox :value="item.key" />
18
                 {{ item.value }}
20
                 {{ item.value }}
19
               </label>
21
               </label>
20
             </checkbox-group>
22
             </checkbox-group>
21
           </view>
23
           </view>
24
+          <view class="flex next-step padding-lr" style="width: 100%;">
25
+            <button class="cu-btn round lg bg-light-green flex-sub" @tap="changeStep(1)">下一步</button>
26
+          </view>
22
         </swiper-item>
27
         </swiper-item>
23
         <swiper-item @touchmove.stop>
28
         <swiper-item @touchmove.stop>
24
           <view class="btn-check-group padding">
29
           <view class="btn-check-group padding">
25
-            <checkbox-group @change="checkboxChange" class="flex justify-between" style="flex-wrap: wrap;" id="hobby">
26
-              <label class="btn-check-label margin" :class="{ 'bg-cyan': params.hobby.includes(item.id + '') }" v-for="item in interests" :key="item.id">
27
-                <checkbox :value="item.id" />
28
-                {{ item.name }}
29
-              </label>
30
-            </checkbox-group>
31
             <view class="margin">
30
             <view class="margin">
32
-              <input v-model="params.hobbyOther" placeholder="输入其它兴趣内容(选填)" class="margin-top input-border" />
31
+              <input v-model="params.hobbyOther" placeholder="输入兴趣内容  如:画画" class="margin-top input-border" />
33
             </view>
32
             </view>
33
+            <view class="interests">
34
+              <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">
37
+                  <label
38
+                    class="btn-check-label margin"
39
+                    :style="{
40
+                      color: params.hobby.includes(item.id + '') ? '#fff' : '#000',
41
+                      backgroundColor: params.hobby.includes(item.id + '') ? colors[index % 4] : '#f0f0f0'
42
+                    }"
43
+                  >
44
+                    <checkbox :value="item.id" />
45
+                    {{ item.name }}
46
+                  </label>
47
+                  <text class="cuIcon-title" :style="[{ color: colors[index % 4] }]"></text>
48
+                </view>
49
+              </checkbox-group>
50
+            </view>
51
+          </view>
52
+          <view class="flex next-step padding-lr" style="width: 100%;">
53
+            <button class="cu-btn round lg bg-light-green flex-sub margin-right-sm" @tap="changeStep(0)">上一步</button>
54
+            <button class="cu-btn round lg bg-light-green flex-sub" @tap="changeStep(2)">下一步</button>
34
           </view>
55
           </view>
35
         </swiper-item>
56
         </swiper-item>
36
         <swiper-item>
57
         <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
-                          >
58
+          <view v-if="attends.length === 0" class="padding text-center text-lg">
59
+            没有找到相关课程!
60
+          </view>
61
+          <view v-else>
62
+            <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
+              <scroll-view
69
+                class="VerticalMain padding-sm"
70
+                scroll-y
71
+                scroll-with-animation
72
+                :style="'height:calc(100vh - 70px - 40px - ' + topHeader + 'px)'"
73
+                :scroll-into-view="'main-' + mainCur"
74
+                @scroll="VerticalMain"
75
+              >
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
+                            >
85
+                            <view>
86
+                              <radio :value="item.class_attend_id" :checked="checked.includes(item.class_attend_id)" class="cyan" style="transform: scale(0.7);" />
87
+                            </view>
88
+                          </view>
89
+                        </label>
90
+                      </view>
91
+                    </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">
60
                           <view>
95
                           <view>
61
-                            <radio :value="item.class_attend_id" :checked="checked.includes(item.class_attend_id)" class="cyan" style="transform: scale(0.7);" />
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>
62
                           </view>
102
                           </view>
63
-                        </view>
64
-                      </label>
103
+                        </label>
104
+                      </checkbox-group>
65
                     </view>
105
                     </view>
66
                   </view>
106
                   </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>
107
+                </radio-group>
108
+              </scroll-view>
109
+            </view>
110
+            <view class="static shadow">
111
+              <view class="flex justify-between" style="width: 100%;">
112
+                <view>
113
+                  <button class="cu-btn round line-grey" @tap="changeStep(1)">
114
+                    <text class="cuIcon-back lg margin-right-sm"></text>
115
+                    重选
116
+                  </button>
81
                 </view>
117
                 </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>
118
+                <view class="static-order flex">
119
+                  <shop-cart :class_attend_id="attend_id" @changeDisableBtn="changeDisableBtn"></shop-cart>
120
+                  <button class="cu-btn round bg-student text-white margin-left-xs" @tap="addCart">报课</button>
121
+                </view>
122
+              </view>
89
             </view>
123
             </view>
90
           </view>
124
           </view>
91
         </swiper-item>
125
         </swiper-item>
@@ -105,7 +139,7 @@ export default {
105
   data() {
139
   data() {
106
     return {
140
     return {
107
       topHeader: this.globalCustomBarHeight,
141
       topHeader: this.globalCustomBarHeight,
108
-      numList: [
142
+      stepList: [
109
         {
143
         {
110
           name: '选周期'
144
           name: '选周期'
111
         },
145
         },
@@ -130,6 +164,7 @@ export default {
130
       tabCur: 0,
164
       tabCur: 0,
131
       mainCur: 0,
165
       mainCur: 0,
132
       verticalNavTop: 0,
166
       verticalNavTop: 0,
167
+      colors: ['#0CAAF4', '#082FCC', '#FDC534', '#09E294'],
133
       checked: [], // 选中
168
       checked: [], // 选中
134
       checked_props: [], // 选中工具
169
       checked_props: [], // 选中工具
135
       attend_id: 0, // 添加成功课程
170
       attend_id: 0, // 添加成功课程
@@ -170,8 +205,12 @@ export default {
170
       params.hobby = params.hobby.join(',')
205
       params.hobby = params.hobby.join(',')
171
       _intelligentCourses(params).then(res => {
206
       _intelligentCourses(params).then(res => {
172
         this.attends = res.data
207
         this.attends = res.data
208
+        this.checked = [] //初始化选项
173
         Object.keys(this.attends).forEach(item => {
209
         Object.keys(this.attends).forEach(item => {
174
-          this.$set(this.checked_props, item, { prop: [] })
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 })
175
         })
214
         })
176
         this.weekList = this.attends.map(item => item.week)
215
         this.weekList = this.attends.map(item => item.week)
177
       })
216
       })
@@ -217,6 +256,7 @@ export default {
217
       this.checked[this.mainCur] = value
256
       this.checked[this.mainCur] = value
218
       this.$set(this.checked, this.mainCur, value)
257
       this.$set(this.checked, this.mainCur, value)
219
       this.$set(this.checked_props, this.mainCur, { class_attend_id: value, prop: [] })
258
       this.$set(this.checked_props, this.mainCur, { class_attend_id: value, prop: [] })
259
+      console.log(this.checked_props)
220
     },
260
     },
221
     propChange(e) {
261
     propChange(e) {
222
       const parentId = e.target.dataset.id
262
       const parentId = e.target.dataset.id
@@ -271,6 +311,32 @@ export default {
271
     height: 100%;
311
     height: 100%;
272
   }
312
   }
273
 }
313
 }
314
+.step {
315
+  position: relative;
316
+  padding: 10px 0;
317
+  &.cur {
318
+    color: #09e294;
319
+    &:before {
320
+      content: '';
321
+      position: absolute;
322
+      bottom: 0;
323
+      background-color: #09e294;
324
+      width: 30px;
325
+      height: 2px;
326
+      transform: translateX(25%);
327
+    }
328
+  }
329
+}
330
+.interests {
331
+  position: relative;
332
+  .interest {
333
+    position: absolute;
334
+  }
335
+}
336
+.next-step {
337
+  position: fixed;
338
+  bottom: 60px;
339
+}
274
 .btn-check-group {
340
 .btn-check-group {
275
   checkbox {
341
   checkbox {
276
     display: none;
342
     display: none;
@@ -282,8 +348,8 @@ export default {
282
     display: inline-block;
348
     display: inline-block;
283
     margin-right: 10rpx;
349
     margin-right: 10rpx;
284
     position: relative;
350
     position: relative;
285
-    padding: 10rpx 30rpx;
286
-    line-height: 30px;
351
+    padding: 10rpx 40rpx;
352
+    // line-height: 30px;
287
     border-radius: 100rpx;
353
     border-radius: 100rpx;
288
     flex-wrap: nowrap;
354
     flex-wrap: nowrap;
289
     border: 1px solid #eee;
355
     border: 1px solid #eee;
@@ -312,7 +378,7 @@ export default {
312
   height: 70px;
378
   height: 70px;
313
   align-items: center;
379
   align-items: center;
314
   padding: 0 0.8rem;
380
   padding: 0 0.8rem;
315
-  justify-content: flex-end;
381
+  // justify-content: flex-end;
316
 }
382
 }
317
 .fixed {
383
 .fixed {
318
   position: fixed;
384
   position: fixed;

+ 16 - 11
src/pages/index/components/card.vue

@@ -1,16 +1,20 @@
1
 <template>
1
 <template>
2
   <view class="card flex" @tap="goDetail(item)">
2
   <view class="card flex" @tap="goDetail(item)">
3
-    <view class=card-left>
4
-      <img mode="aspectFill" :src="item.image" alt="">
3
+    <view class="card-left">
4
+      <img mode="aspectFill" :src="item.image" alt="" />
5
     </view>
5
     </view>
6
     <view class="card-right flex-sub">
6
     <view class="card-right flex-sub">
7
-      <view class="card-title flex justify-between"><text>{{item.attend_name}}</text><text
8
-          class="text-student text-light">¥{{item.money}}</text></view>
9
-      <view class="text-gray text-sm"><text>{{item.day}}</text></view>
10
-      <view class="text-gray text-sm">{{item.grade_desc}}</view>
7
+      <view class="card-title flex justify-between"
8
+        ><text>{{ item.attend_name }}</text
9
+        ><text class="text-student text-light">¥{{ item.money }}</text></view
10
+      >
11
+      <view class="text-gray text-sm"
12
+        ><text>{{ item.day }}</text></view
13
+      >
14
+      <view class="text-gray text-sm">{{ item.grade_desc }}</view>
11
       <view class="margin-top-sm">
15
       <view class="margin-top-sm">
12
-        <button class="cu-btn round  bg-student text-white button-hover" v-if="item.enable">报课</button>
13
-        <button class="cu-btn round  bg-grey button-hover text-white disabled" v-else>停止</button>
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>
14
       </view>
18
       </view>
15
     </view>
19
     </view>
16
   </view>
20
   </view>
@@ -21,18 +25,19 @@ export default {
21
   props: {
25
   props: {
22
     item: {
26
     item: {
23
       type: Object,
27
       type: Object,
24
-      default () {
28
+      default() {
25
         return {}
29
         return {}
26
       }
30
       }
27
     }
31
     }
28
   },
32
   },
29
-  data () {
33
+  data() {
30
     return {
34
     return {
31
       key: 1212
35
       key: 1212
32
     }
36
     }
33
   },
37
   },
34
   methods: {
38
   methods: {
35
-    goDetail (item) {
39
+    goDetail(item) {
40
+      console.log(111)
36
       if (!item.enable) {
41
       if (!item.enable) {
37
         uni.showToast({ title: '课程已停止!', icon: 'none' })
42
         uni.showToast({ title: '课程已停止!', icon: 'none' })
38
         return false
43
         return false

+ 91 - 69
src/pages/index/index.vue

@@ -1,8 +1,7 @@
1
-
2
 <template>
1
 <template>
3
   <view class="page">
2
   <view class="page">
4
     <cu-custom :isBack="false"></cu-custom>
3
     <cu-custom :isBack="false"></cu-custom>
5
-    <view class="header" :style="[{top:topHeader + 'px'}]">
4
+    <view class="header" :style="[{ top: topHeader + 'px' }]">
6
       <view class="header-box flex justify-end">
5
       <view class="header-box flex justify-end">
7
         <view class="header-title">
6
         <view class="header-title">
8
           <view class="header-title-main">
7
           <view class="header-title-main">
@@ -12,49 +11,50 @@
12
         </view>
11
         </view>
13
         <view class="header-search flex-sub">
12
         <view class="header-search flex-sub">
14
           <view class="flex justify-between">
13
           <view class="flex justify-between">
15
-            <input type="text" v-model="params.course_name" class="header-search-input flex-sub" placeholder="搜索课程"
16
-              @confirm="search">
14
+            <input type="text" v-model="params.course_name" class="header-search-input flex-sub" placeholder="搜索课程" @confirm="search" />
17
             <text class="cuIcon-search text-gray header-search-icon" @tap="search"></text>
15
             <text class="cuIcon-search text-gray header-search-icon" @tap="search"></text>
18
           </view>
16
           </view>
19
         </view>
17
         </view>
20
       </view>
18
       </view>
21
     </view>
19
     </view>
22
-    <scroll-view :scroll-y="true" :refresher-enabled="true" class="scroll-main" :refresher-triggered="triggered"
23
-      :style="[{height:'calc(100vh - 102px - '+ topHeader+'px)'}]" @refresherrefresh="onRefresh"
24
-      @scrolltolower="loadMore">
20
+    <scroll-view
21
+      :scroll-y="true"
22
+      :refresher-enabled="true"
23
+      class="scroll-main"
24
+      :refresher-triggered="triggered"
25
+      :style="[{ height: 'calc(100vh - 102px - ' + topHeader + 'px)' }]"
26
+      @refresherrefresh="onRefresh"
27
+      @scrolltolower="loadMore"
28
+    >
25
       <view class="main">
29
       <view class="main">
26
         <view class="main-title">活动和餐饮</view>
30
         <view class="main-title">活动和餐饮</view>
27
         <view class="flex justify-around course">
31
         <view class="flex justify-around course">
28
-          <course v-for="(item,index) in courses" :key="index" @tap="goCourse(item.type)" :course="item"
29
-            class="course-item flex-sub margin-xs"></course>
32
+          <course v-for="(item, index) in courses" :key="index" @tap="goCourse(item.type)" :course="item" class="course-item flex-sub margin-xs"></course>
30
         </view>
33
         </view>
31
         <view class="main-title margin-top-xs">一键报班</view>
34
         <view class="main-title margin-top-xs">一键报班</view>
32
         <view class="apply-class flex">
35
         <view class="apply-class flex">
33
-          <image mode="widthFix" @tap="goGift" src="/static/imgs/index/baoban.png"
34
-            class="flex-sub apply-class-img margin-xs" />
36
+          <image mode="widthFix" @tap="goGift" src="/static/imgs/index/baoban.png" class="flex-sub apply-class-img margin-xs" />
35
         </view>
37
         </view>
36
         <view class="recommend margin-top-xs">
38
         <view class="recommend margin-top-xs">
37
           <view class="recommend-title">推荐课程</view>
39
           <view class="recommend-title">推荐课程</view>
38
           <view class="recommend-filter margin-top-xs flex">
40
           <view class="recommend-filter margin-top-xs flex">
39
-            <view class="filter-item text-center flex-sub" @tap="sort('home')" :class="{'text-sort':sortCur==='home'}">
40
-              综合</view>
41
-            <view class="filter-item text-center flex-sub" @tap="sort('sales')"
42
-              :class="{'text-sort':sortCur==='sales'}">销量
43
-              <image mode="widthFix" class="sort-icon"
44
-                :src="sortCur==='sales'?(sortItem.sales===0?sortIcons.up:sortIcons.down):sortIcons.no"></image>
41
+            <view class="filter-item text-center flex-sub" @tap="sort('home')" :class="{ 'text-sort': sortCur === 'home' }"> 综合</view>
42
+            <view class="filter-item text-center flex-sub" @tap="sort('sales')" :class="{ 'text-sort': sortCur === 'sales' }"
43
+              >销量
44
+              <image mode="widthFix" class="sort-icon" :src="sortCur === 'sales' ? (sortItem.sales === 0 ? sortIcons.up : sortIcons.down) : sortIcons.no"></image>
45
             </view>
45
             </view>
46
-            <view class="filter-item text-center flex-sub" @tap="sort('money')"
47
-              :class="{'text-sort':sortCur==='money'}">价格
48
-              <image mode="widthFix" class="sort-icon"
49
-                :src="sortCur==='money'?(sortItem.money===0?sortIcons.up:sortIcons.down):sortIcons.no"></image>
46
+            <view class="filter-item text-center flex-sub" @tap="sort('money')" :class="{ 'text-sort': sortCur === 'money' }"
47
+              >价格
48
+              <image mode="widthFix" class="sort-icon" :src="sortCur === 'money' ? (sortItem.money === 0 ? sortIcons.up : sortIcons.down) : sortIcons.no"></image>
50
             </view>
49
             </view>
51
-            <view class="filter-item text-center flex-sub">{{grade_now}}</view>
52
-            <view class="filter-item text-right flex-sub" @tap="showModal" data-target="FilterModal">筛选
50
+            <view class="filter-item text-center flex-sub">{{ grade_now }}</view>
51
+            <view class="filter-item text-right flex-sub" @tap="showModal" data-target="FilterModal"
52
+              >筛选
53
               <text class="cuIcon-filter text-gray"></text>
53
               <text class="cuIcon-filter text-gray"></text>
54
             </view>
54
             </view>
55
           </view>
55
           </view>
56
           <view class="list">
56
           <view class="list">
57
-            <view class="cu-card" v-for="(item,index) in list" :key="index">
57
+            <view class="cu-card" v-for="(item, index) in list" :key="index">
58
               <view class="cu-item">
58
               <view class="cu-item">
59
                 <card :item="item"></card>
59
                 <card :item="item"></card>
60
               </view>
60
               </view>
@@ -63,9 +63,8 @@
63
         </view>
63
         </view>
64
       </view>
64
       </view>
65
     </scroll-view>
65
     </scroll-view>
66
-    <view class="cu-modal drawer-modal justify-end" :class="modalName=='FilterModal'?'show':''" @tap="hideModal">
67
-      <view class="cu-dialog basis-lg" @tap.stop=""
68
-        :style="[{top:topHeader+'px',height:'calc(100vh - ' + topHeader + 'px)'}]">
66
+    <view class="cu-modal drawer-modal justify-end" :class="modalName == 'FilterModal' ? 'show' : ''" @tap="hideModal">
67
+      <view class="cu-dialog basis-lg" @tap.stop="" :style="[{ top: topHeader + 'px', height: 'calc(100vh - ' + topHeader + 'px)' }]">
69
         <view class="filter-title">机构筛选</view>
68
         <view class="filter-title">机构筛选</view>
70
         <view class="btn-check-group padding-lr">
69
         <view class="btn-check-group padding-lr">
71
           <!-- <checkbox-group @change="checkboxChange" class="flex" style="flex-wrap: wrap;" id="agency">
70
           <!-- <checkbox-group @change="checkboxChange" class="flex" style="flex-wrap: wrap;" id="agency">
@@ -76,22 +75,30 @@
76
 							</label>
75
 							</label>
77
 						</checkbox-group> -->
76
 						</checkbox-group> -->
78
           <radio-group class="flex" style="flex-wrap: wrap;" id="agency">
77
           <radio-group class="flex" style="flex-wrap: wrap;" id="agency">
79
-            <label class="btn-check-label margin-top-sm padding-lr-xs text-sm text-ellipsis"
80
-              :class="{'bg-cyan':params.agency.includes(item.id)}" v-for="item in filters.agency" :key="item.id"
81
-              @tap="radioChange('agency',item.id)">
78
+            <label
79
+              class="btn-check-label margin-top-sm padding-lr-xs text-sm text-ellipsis"
80
+              :class="{ 'bg-cyan': params.agency.includes(item.id) }"
81
+              v-for="item in filters.agency"
82
+              :key="item.id"
83
+              @tap="radioChange('agency', item.id)"
84
+            >
82
               <radio :value="item.id" />
85
               <radio :value="item.id" />
83
-              {{item.name}}
86
+              {{ item.name }}
84
             </label>
87
             </label>
85
           </radio-group>
88
           </radio-group>
86
         </view>
89
         </view>
87
         <view class="filter-title">分类筛选</view>
90
         <view class="filter-title">分类筛选</view>
88
         <view class="btn-check-group padding-lr">
91
         <view class="btn-check-group padding-lr">
89
           <radio-group class="flex" style="flex-wrap: wrap;" id="category">
92
           <radio-group class="flex" style="flex-wrap: wrap;" id="category">
90
-            <label class="btn-check-label margin-top-sm padding-lr-xs text-sm text-ellipsis"
91
-              :class="{'bg-cyan':params.category.includes(item.id)}" v-for="item in filters.category" :key="item.id"
92
-              @tap="radioChange('category',item.id)">
93
+            <label
94
+              class="btn-check-label margin-top-sm padding-lr-xs text-sm text-ellipsis"
95
+              :class="{ 'bg-cyan': params.category.includes(item.id) }"
96
+              v-for="item in filters.category"
97
+              :key="item.id"
98
+              @tap="radioChange('category', item.id)"
99
+            >
93
               <radio :value="item.id" />
100
               <radio :value="item.id" />
94
-              {{item.name}}
101
+              {{ item.name }}
95
             </label>
102
             </label>
96
           </radio-group>
103
           </radio-group>
97
         </view>
104
         </view>
@@ -105,22 +112,30 @@
105
 							</label>
112
 							</label>
106
 						</checkbox-group> -->
113
 						</checkbox-group> -->
107
           <radio-group class="flex" style="flex-wrap: wrap;" id="day">
114
           <radio-group class="flex" style="flex-wrap: wrap;" id="day">
108
-            <label class="btn-check-label margin-top-sm padding-lr-xs text-sm"
109
-              :class="{'bg-cyan':params.day.includes(index+'')}" v-for="(item,index) in filters.week" :key="index"
110
-              @tap="radioChange('day',index)">
115
+            <label
116
+              class="btn-check-label margin-top-sm padding-lr-xs text-sm"
117
+              :class="{ 'bg-cyan': params.day.includes(index + '') }"
118
+              v-for="(item, index) in filters.week"
119
+              :key="index"
120
+              @tap="radioChange('day', index)"
121
+            >
111
               <radio :value="index" />
122
               <radio :value="index" />
112
-              {{item}}
123
+              {{ item }}
113
             </label>
124
             </label>
114
           </radio-group>
125
           </radio-group>
115
         </view>
126
         </view>
116
         <view class="filter-title">价格区间(元)</view>
127
         <view class="filter-title">价格区间(元)</view>
117
         <view class="btn-check-group padding-lr">
128
         <view class="btn-check-group padding-lr">
118
           <radio-group class="flex" style="flex-wrap: wrap;" id="price">
129
           <radio-group class="flex" style="flex-wrap: wrap;" id="price">
119
-            <label class="btn-check-label margin-top-sm padding-lr-xs text-sm"
120
-              :class="{'bg-cyan':params.price===item.name}" v-for="item in filters.price_list" :key="item.id"
121
-              @tap="radioChange('price',item.name)">
130
+            <label
131
+              class="btn-check-label margin-top-sm padding-lr-xs text-sm"
132
+              :class="{ 'bg-cyan': params.price === item.name }"
133
+              v-for="item in filters.price_list"
134
+              :key="item.id"
135
+              @tap="radioChange('price', item.name)"
136
+            >
122
               <radio :value="item.name" />
137
               <radio :value="item.name" />
123
-              {{item.name}}
138
+              {{ item.name }}
124
             </label>
139
             </label>
125
           </radio-group>
140
           </radio-group>
126
         </view>
141
         </view>
@@ -142,9 +157,10 @@ import { deepClone } from '@/common/utils'
142
 import { mapGetters } from 'vuex'
157
 import { mapGetters } from 'vuex'
143
 export default {
158
 export default {
144
   components: {
159
   components: {
145
-    course, card
160
+    course,
161
+    card
146
   },
162
   },
147
-  data () {
163
+  data() {
148
     return {
164
     return {
149
       topHeader: this.globalCustomBarHeight,
165
       topHeader: this.globalCustomBarHeight,
150
       modalName: '',
166
       modalName: '',
@@ -162,7 +178,8 @@ export default {
162
         sales: 0,
178
         sales: 0,
163
         money: 0
179
         money: 0
164
       },
180
       },
165
-      courses: [// 排序情况
181
+      courses: [
182
+        // 排序情况
166
         {
183
         {
167
           applying: true,
184
           applying: true,
168
           back: '/static/imgs/index/zmk.png',
185
           back: '/static/imgs/index/zmk.png',
@@ -197,9 +214,10 @@ export default {
197
         category: [],
214
         category: [],
198
         price: '',
215
         price: '',
199
         sort: '',
216
         sort: '',
200
-        list_type: 0// 0 课程,1 餐饮,2活动
217
+        list_type: 0 // 0 课程,1 餐饮,2活动
201
       },
218
       },
202
-      init: { // 初始化
219
+      init: {
220
+        // 初始化
203
         page_num: 1,
221
         page_num: 1,
204
         course_name: '',
222
         course_name: '',
205
         agency: [],
223
         agency: [],
@@ -207,7 +225,7 @@ export default {
207
         category: [],
225
         category: [],
208
         price: '',
226
         price: '',
209
         sort: '',
227
         sort: '',
210
-        list_type: 0// 0 课程,1 餐饮,2活动
228
+        list_type: 0 // 0 课程,1 餐饮,2活动
211
       },
229
       },
212
       list: [],
230
       list: [],
213
       noMore: false, // 还有没
231
       noMore: false, // 还有没
@@ -215,11 +233,9 @@ export default {
215
     }
233
     }
216
   },
234
   },
217
   computed: {
235
   computed: {
218
-    ...mapGetters([
219
-      'kid', 'token'
220
-    ])
236
+    ...mapGetters(['kid', 'token'])
221
   },
237
   },
222
-  onShow () {
238
+  onShow() {
223
     // 登录后才进入后续操作
239
     // 登录后才进入后续操作
224
     this.checkLogin().then(res => {
240
     this.checkLogin().then(res => {
225
       if (res) {
241
       if (res) {
@@ -227,14 +243,15 @@ export default {
227
           return this.globalNavigateTo('myStudents')
243
           return this.globalNavigateTo('myStudents')
228
         }
244
         }
229
         this.params = Object.assign({}, this.init)
245
         this.params = Object.assign({}, this.init)
230
-        this.get_list(true)// true初始化加载过滤项
246
+        this.get_list(true) // true初始化加载过滤项
231
       }
247
       }
232
     })
248
     })
233
   },
249
   },
234
   methods: {
250
   methods: {
235
-    checkLogin () {
251
+    checkLogin() {
236
       return new Promise((resolve, reject) => {
252
       return new Promise((resolve, reject) => {
237
-        if (this.token) { // 跳转至登录页
253
+        if (this.token) {
254
+          // 跳转至登录页
238
           resolve(true)
255
           resolve(true)
239
         } else {
256
         } else {
240
           uni.showModal({
257
           uni.showModal({
@@ -250,11 +267,12 @@ export default {
250
         }
267
         }
251
       })
268
       })
252
     },
269
     },
253
-    goCourse (type) {
270
+    goCourse(type) {
254
       this.params.list_type = type
271
       this.params.list_type = type
255
       this.search()
272
       this.search()
256
     },
273
     },
257
-    loadFilter () { // 加载筛选项
274
+    loadFilter() {
275
+      // 加载筛选项
258
       const params = {}
276
       const params = {}
259
       _filter(params).then(res => {
277
       _filter(params).then(res => {
260
         this.filters = res.data
278
         this.filters = res.data
@@ -262,13 +280,13 @@ export default {
262
         this.courses[2].applying = this.filters.is_catering
280
         this.courses[2].applying = this.filters.is_catering
263
       })
281
       })
264
     },
282
     },
265
-    showModal (e) {
283
+    showModal(e) {
266
       this.modalName = e.currentTarget.dataset.target
284
       this.modalName = e.currentTarget.dataset.target
267
     },
285
     },
268
-    hideModal (e) {
286
+    hideModal(e) {
269
       this.modalName = null
287
       this.modalName = null
270
     },
288
     },
271
-    radioChange (type, v) {
289
+    radioChange(type, v) {
272
       switch (type) {
290
       switch (type) {
273
         case 'agency':
291
         case 'agency':
274
           this.params.agency = this.params.agency[0] === v ? [] : [v]
292
           this.params.agency = this.params.agency[0] === v ? [] : [v]
@@ -286,7 +304,7 @@ export default {
286
           console.log('error')
304
           console.log('error')
287
       }
305
       }
288
     },
306
     },
289
-    checkboxChange (e) {
307
+    checkboxChange(e) {
290
       const type = e.target.id
308
       const type = e.target.id
291
       const values = e.detail.value
309
       const values = e.detail.value
292
       switch (type) {
310
       switch (type) {
@@ -303,16 +321,19 @@ export default {
303
           console.log('error')
321
           console.log('error')
304
       }
322
       }
305
     },
323
     },
306
-    search () { // 搜索课程
324
+    search() {
325
+      // 搜索课程
307
       this.params.page_num = 1
326
       this.params.page_num = 1
308
       this.get_list()
327
       this.get_list()
309
     },
328
     },
310
-    check_course () { // 筛选课程
329
+    check_course() {
330
+      // 筛选课程
311
       this.params.page_num = 1
331
       this.params.page_num = 1
312
       this.get_list()
332
       this.get_list()
313
       this.hideModal()
333
       this.hideModal()
314
     },
334
     },
315
-    onRefresh () { // 下拉刷新
335
+    onRefresh() {
336
+      // 下拉刷新
316
       this.triggered = true
337
       this.triggered = true
317
       this.params.page_num = 1
338
       this.params.page_num = 1
318
       this.params.list_type = 0
339
       this.params.list_type = 0
@@ -321,7 +342,7 @@ export default {
321
         this.triggered = false
342
         this.triggered = false
322
       }, 1000)
343
       }, 1000)
323
     },
344
     },
324
-    loadMore () {
345
+    loadMore() {
325
       if (this.noMore) {
346
       if (this.noMore) {
326
         uni.showToast({ title: '暂无更多课程数据', icon: 'none' })
347
         uni.showToast({ title: '暂无更多课程数据', icon: 'none' })
327
         return false
348
         return false
@@ -329,7 +350,8 @@ export default {
329
       this.params.page_num++
350
       this.params.page_num++
330
       this.get_list()
351
       this.get_list()
331
     },
352
     },
332
-    sort (type) { // 排序搜索
353
+    sort(type) {
354
+      // 排序搜索
333
       const sorts = {
355
       const sorts = {
334
         home: 0,
356
         home: 0,
335
         sales: 0,
357
         sales: 0,
@@ -347,7 +369,7 @@ export default {
347
       this.params.page_num = 1
369
       this.params.page_num = 1
348
       this.get_list()
370
       this.get_list()
349
     },
371
     },
350
-    get_list (init = false) {
372
+    get_list(init = false) {
351
       let params = deepClone(this.params)
373
       let params = deepClone(this.params)
352
       params = filterParams(params)
374
       params = filterParams(params)
353
       if (params.day.length > 0) {
375
       if (params.day.length > 0) {
@@ -380,7 +402,7 @@ export default {
380
         if (init) this.loadFilter()
402
         if (init) this.loadFilter()
381
       })
403
       })
382
     },
404
     },
383
-    goGift () {
405
+    goGift() {
384
       this.globalNavigateTo('classGift', { package_id: 0 })
406
       this.globalNavigateTo('classGift', { package_id: 0 })
385
     }
407
     }
386
   }
408
   }

+ 56 - 0
src/pages/mine/courseFiles.vue

@@ -0,0 +1,56 @@
1
+<template>
2
+  <view class="page">
3
+    <cu-custom :isBack="true" title="课程档案"></cu-custom>
4
+    <view class="cu-list box-shadow menu">
5
+      <view class="cu-item arrow margin-top-xs" v-for="file in list" :key="file.id" @tap="goto('fileDetail', file)">
6
+        <view class="content margin-left-sm">
7
+          <view>{{ file.course_name }}</view>
8
+          <star-rating name="serviceNum" :score="file.level" :max="file.max_level"></star-rating>
9
+        </view>
10
+      </view>
11
+    </view>
12
+  </view>
13
+</template>
14
+
15
+<script>
16
+import { _getStudentFiles } from '@/api/course'
17
+import starRating from '@/components/star-rating.vue'
18
+export default {
19
+  components: {
20
+    starRating
21
+  },
22
+  data() {
23
+    return {
24
+      key: '课程档案',
25
+      params: {
26
+        page: 1
27
+      },
28
+      list: [],
29
+      ability: []
30
+    }
31
+  },
32
+  onLoad() {
33
+    this.get_list()
34
+  },
35
+  methods: {
36
+    get_list() {
37
+      _getStudentFiles(this.params).then(res => {
38
+        this.list = res.data.list
39
+        this.ability = res.data.ability
40
+      })
41
+    },
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
+      })
49
+      this.$set(file, 'ability', ability)
50
+      this.globalNavigateTo(page, { file: JSON.stringify(file) })
51
+    }
52
+  }
53
+}
54
+</script>
55
+
56
+<style lang="scss" scoped></style>

+ 166 - 0
src/pages/mine/fileDetail.vue

@@ -0,0 +1,166 @@
1
+<template>
2
+  <view class="page">
3
+    <cu-custom :isBack="true" :title="key"></cu-custom>
4
+    <view class="card margin-sm padding-sm bg-white shadow">
5
+      <view class="text-center">
6
+        <image mode="scaleToFill" :src="student_avatar" class="avatar xl student-avatar"></image>
7
+      </view>
8
+      <view class="part">
9
+        <view class="title text-student">考核总评</view>
10
+        <view class="content margin-top">
11
+          <canvas
12
+            canvas-id="ability"
13
+            id="ability"
14
+            class="charts"
15
+            @touchstart="touchStart"
16
+            @touchmove="touchMove"
17
+            @touchend="touchEnd"
18
+            @error="error"
19
+            :style="{
20
+              width: cWidth * pixelRatio + 'px',
21
+              height: cHeight * pixelRatio + 'px',
22
+              transform: 'scale(' + 1 / pixelRatio + ')',
23
+              'margin-left': (-cWidth * (pixelRatio - 1)) / 2 + 'px',
24
+              'margin-top': (-cHeight * (pixelRatio - 1)) / 2 + 'px'
25
+            }"
26
+          ></canvas>
27
+        </view>
28
+      </view>
29
+      <view class="part">
30
+        <view class="title text-student">学期总评</view>
31
+        <view class="content margin-top">{{ file.term_summary }}</view>
32
+      </view>
33
+      <view class="part">
34
+        <view class="title text-student">下期预告</view>
35
+        <view class="content margin-top">{{ file.next_forecast }}</view>
36
+      </view>
37
+    </view>
38
+  </view>
39
+</template>
40
+
41
+<script>
42
+import UCharts from '@/components/u-charts/u-charts.js'
43
+var canvases = {}
44
+export default {
45
+  data() {
46
+    return {
47
+      key: '学生总评',
48
+      file: {},
49
+      pixelRatio: 1,
50
+      cWidth: '',
51
+      cHeight: '',
52
+      student_avatar: 'http://parent.kehoubaike.com/static/img/7f4e775d2e04234d1e1994b13146f6b.e5c47f3.png'
53
+    }
54
+  },
55
+  // 配置分享
56
+  onShareAppMessage(res) {
57
+    if (res.from === 'button') {
58
+      // 来自页面内分享按钮
59
+      console.log(res.target)
60
+    }
61
+    return {
62
+      title: '结业报告',
63
+      path: `/pages/mine/fileDetail?shareFile=${JSON.stringify(this.file)}`
64
+    }
65
+  },
66
+  onLoad(options) {
67
+    //跳转参数
68
+    if (options.file) {
69
+      this.file = JSON.parse(decodeURIComponent(options.file))
70
+    }
71
+    //分享页参数
72
+    if (options.shareFile) {
73
+      this.file = JSON.parse(options.shareFile)
74
+    }
75
+    this.cWidth = uni.upx2px(800) - 60
76
+    this.cHeight = uni.upx2px(400) // 图表配置
77
+    this.init()
78
+  },
79
+  methods: {
80
+    init() {
81
+      const ability = {
82
+        categories: this.file.ability.map(item => item.name),
83
+        series: [
84
+          {
85
+            name: '评分',
86
+            data: this.file.ability.map(item => item.score)
87
+          }
88
+        ]
89
+      }
90
+      this.showRadar('ability', ability)
91
+    },
92
+    showRadar(canvasId, chartData) {
93
+      canvases[canvasId] = new UCharts({
94
+        canvasId: canvasId,
95
+        type: 'radar',
96
+        legend: { show: true },
97
+        fontSize: 11,
98
+        width: 300,
99
+        height: this.cHeight * this.pixelRatio,
100
+        pixelRatio: this.pixelRatio,
101
+        animation: true,
102
+        categories: chartData.categories,
103
+        series: chartData.series
104
+      })
105
+    },
106
+    touchStart(e) {
107
+      const canvasId = e.target.id
108
+      canvases[canvasId].showToolTip(e, {
109
+        format: function (item, category) {
110
+          return category ? category + ' ' + item.name + ':' + item.data : item.name + ':' + item.data
111
+        }
112
+      })
113
+      // canvases[canvasId].scrollStart(e)
114
+    },
115
+    touchMove(e) {
116
+      // const canvasId = e.target.id
117
+      // canvases[canvasId].scroll(e)
118
+    },
119
+    touchEnd(e) {
120
+      // const canvasId = e.target.id
121
+      // canvases[canvasId].scrollEnd(e)
122
+    }
123
+  }
124
+}
125
+</script>
126
+
127
+<style lang="scss" scoped>
128
+.page {
129
+  background-color: #f3fffa;
130
+  min-height: 100vh;
131
+}
132
+.card {
133
+  margin-top: 90rpx;
134
+  border-radius: 10px;
135
+}
136
+.title {
137
+  position: relative;
138
+  text-align: center;
139
+  &:before {
140
+    position: absolute;
141
+    top: 50%;
142
+    transform: translateY(-50%);
143
+    left: 0;
144
+    content: '';
145
+    width: 32%;
146
+    height: 2px;
147
+    border-bottom: 1px solid #5fd0e4;
148
+  }
149
+  &:after {
150
+    position: absolute;
151
+    top: 50%;
152
+    transform: translateY(-50%);
153
+    right: 0;
154
+    content: '';
155
+    width: 32%;
156
+    height: 2px;
157
+    border-bottom: 1px solid #5fd0e4;
158
+  }
159
+}
160
+.content {
161
+  min-height: 120px;
162
+}
163
+.student-avatar {
164
+  transform: translateY(-50%);
165
+}
166
+</style>

+ 7 - 7
src/pages/mine/message.vue

@@ -3,14 +3,14 @@
3
     <cu-custom :isBack="true" title="消息中心"></cu-custom>
3
     <cu-custom :isBack="true" title="消息中心"></cu-custom>
4
     <view class="cu-list box-shadow menu">
4
     <view class="cu-list box-shadow menu">
5
       <view class="cu-item arrow margin-top-xs" v-for="message in list" :key="message.id">
5
       <view class="cu-item arrow margin-top-xs" v-for="message in list" :key="message.id">
6
-        <text class="cuIcon-notice lg text-gray" style="font-size:18px;"></text>
6
+        <text class="cuIcon-notice lg text-gray" style="font-size: 18px;"></text>
7
         <view class="content margin-left-sm">
7
         <view class="content margin-left-sm">
8
           <view>系统通知</view>
8
           <view>系统通知</view>
9
-          <text class="text-black">{{message.title}}</text>
9
+          <text class="text-black">{{ message.title }}</text>
10
         </view>
10
         </view>
11
       </view>
11
       </view>
12
       <view class="cu-item arrow margin-top-xs" @tap="report">
12
       <view class="cu-item arrow margin-top-xs" @tap="report">
13
-        <text class="cuIcon-notice lg text-gray" style="font-size:18px;"></text>
13
+        <text class="cuIcon-notice lg text-gray" style="font-size: 18px;"></text>
14
         <view class="content margin-left-sm">
14
         <view class="content margin-left-sm">
15
           <text class="text-black">学生综合素质报告</text>
15
           <text class="text-black">学生综合素质报告</text>
16
         </view>
16
         </view>
@@ -22,19 +22,19 @@
22
 <script>
22
 <script>
23
 import { _getNotice } from '@/api/auth'
23
 import { _getNotice } from '@/api/auth'
24
 export default {
24
 export default {
25
-  data () {
25
+  data() {
26
     return {
26
     return {
27
       list: []
27
       list: []
28
     }
28
     }
29
   },
29
   },
30
-  onLoad () {
30
+  onLoad() {
31
     this.get_list()
31
     this.get_list()
32
   },
32
   },
33
   methods: {
33
   methods: {
34
-    report () {
34
+    report() {
35
       uni.showToast({ title: '学期末才能领取对应的学生综合素质报告,敬请期待!', icon: 'none', duration: 2000 })
35
       uni.showToast({ title: '学期末才能领取对应的学生综合素质报告,敬请期待!', icon: 'none', duration: 2000 })
36
     },
36
     },
37
-    get_list () {
37
+    get_list() {
38
       _getNotice().then(res => {
38
       _getNotice().then(res => {
39
         this.list = res.data.notice_data
39
         this.list = res.data.notice_data
40
       })
40
       })

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

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

+ 156 - 15
src/pages/studentcenter/works.vue

@@ -3,7 +3,7 @@
3
     <cu-custom :isBack="true" title="课堂作品"></cu-custom>
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
       <view class="content">
5
       <view class="content">
6
-        <view class="course-img">
6
+        <view class="course-img padding-sm">
7
           <swiper class="swiper" :indicator-dots="swiper.indicatorDots" :autoplay="swiper.autoplay" :interval="swiper.interval" :duration="swiper.duration">
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">
8
             <swiper-item v-for="(item, index) in detail.course_data.image" :key="index">
9
               <view class="swiper-item">
9
               <view class="swiper-item">
@@ -12,34 +12,90 @@
12
             </swiper-item>
12
             </swiper-item>
13
           </swiper>
13
           </swiper>
14
         </view>
14
         </view>
15
-        <view>
16
-          <view class="title margin-top-sm">课堂作品</view>
17
-          <view class="list" v-if="detail.student_comment_data">
18
-            <view class="cu-card case" v-for="(item, index) in detail.student_comment_data.data" :key="index">
19
-              <view class="cu-item shadow">
20
-                <view class="image">
21
-                  <view v-for="(img, i) in item.images" :key="i">
22
-                    <image :src="img" v-if="checkTypes(img, 'imgs')" mode="aspectFit" style="width: 100%;"></image>
23
-                    <video :src="img" v-if="checkTypes(img, 'video')" style="width: 100%;"></video>
24
-                  </view>
25
-                  <view class="margin-bottom-xs">老师点评:{{ detail.teach_review_data.data[0].msg }}</view>
15
+        <!-- 课堂作品 -->
16
+        <view class="cu-card" v-if="detail.student_comment_data.data">
17
+          <view class="cu-item">
18
+            <view class="card-head bg-student text-center text-white text-lg padding-sm">课堂作品 </view>
19
+            <view class="card-main padding-sm">
20
+              <view class="cu-card case" v-for="(item, index) in detail.student_comment_data.data" :key="index">
21
+                <view v-for="(img, i) in item.images" :key="i">
22
+                  <image class="upload-item solid" :src="img" mode="aspectFit" v-if="checkTypes(img, 'imgs')" @tap="viewImage" :data-url="img"></image>
23
+                  <video
24
+                    class="upload-item solid"
25
+                    :src="img"
26
+                    v-if="checkTypes(img, 'video')"
27
+                    :autoplay="true"
28
+                    :controls="false"
29
+                    :show-fullscreen-btn="false"
30
+                    @tap="viewVideo"
31
+                    :data-url="img"
32
+                    data-target="videoModal"
33
+                  ></video>
26
                 </view>
34
                 </view>
27
               </view>
35
               </view>
28
             </view>
36
             </view>
29
           </view>
37
           </view>
30
         </view>
38
         </view>
39
+        <!-- 能力分析 -->
40
+        <view class="cu-card" v-if="detail.student_comment_data.ability">
41
+          <view class="cu-item">
42
+            <view class="card-head bg-student text-center text-white text-lg padding-sm">能力分析 </view>
43
+            <view class="card-main padding-sm">
44
+              <canvas
45
+                canvas-id="ability"
46
+                id="ability"
47
+                class="charts"
48
+                @touchstart="touchStart"
49
+                @touchmove="touchMove"
50
+                @touchend="touchEnd"
51
+                @error="error"
52
+                :style="{
53
+                  width: cWidth * pixelRatio + 'px',
54
+                  height: cHeight * pixelRatio + 'px',
55
+                  transform: 'scale(' + 1 / pixelRatio + ')',
56
+                  'margin-left': (-cWidth * (pixelRatio - 1)) / 2 + 'px',
57
+                  'margin-top': (-cHeight * (pixelRatio - 1)) / 2 + 'px'
58
+                }"
59
+              ></canvas>
60
+            </view>
61
+          </view>
62
+        </view>
63
+        <!-- 课堂评价 -->
64
+        <view class="cu-card" v-if="detail.teach_review_data.data">
65
+          <view class="cu-item">
66
+            <view class="card-head bg-student text-center text-white text-lg padding-sm">课堂评价 </view>
67
+            <view class="card-main padding-sm" style="min-height: 100px;">
68
+              <view class="margin-bottom-xs">老师点评:{{ detail.teach_review_data.data[0].msg }}</view>
69
+            </view>
70
+          </view>
71
+        </view>
31
       </view>
72
       </view>
32
     </scroll-view>
73
     </scroll-view>
74
+    <!-- 视频预览 -->
75
+    <view class="cu-modal" :class="modalName == 'videoModal' ? 'show' : ''" @tap="hideModal">
76
+      <view class="cu-dialog" @tap.stop="">
77
+        <video class="bg-img" :src="videoUrl" :autoplay="true" :controls="true" :show-fullscreen-btn="false" style="height: 200px;"></video>
78
+      </view>
79
+    </view>
33
   </view>
80
   </view>
34
 </template>
81
 </template>
35
 
82
 
36
 <script>
83
 <script>
37
 import { checkTypes } from '@/common/utils/index'
84
 import { checkTypes } from '@/common/utils/index'
85
+import UCharts from '@/components/u-charts/u-charts.js'
86
+var canvases = {}
38
 export default {
87
 export default {
39
   data() {
88
   data() {
40
     return {
89
     return {
41
       topHeader: this.globalCustomBarHeight,
90
       topHeader: this.globalCustomBarHeight,
42
-      detail: {},
91
+      modalName: null,
92
+      pixelRatio: 1,
93
+      isShare: false,
94
+      cWidth: '',
95
+      cHeight: '',
96
+      detail: {
97
+        student_comment_data: {}
98
+      },
43
       swiper: {
99
       swiper: {
44
         indicatorDots: true,
100
         indicatorDots: true,
45
         autoplay: true,
101
         autoplay: true,
@@ -48,13 +104,92 @@ export default {
48
       }
104
       }
49
     }
105
     }
50
   },
106
   },
51
-  onLoad() {
107
+  // 配置分享
108
+  onShareAppMessage(res) {
109
+    if (res.from === 'button') {
110
+      // 来自页面内分享按钮
111
+      console.log(res.target)
112
+    }
113
+    return {
114
+      title: '课程作品',
115
+      path: `/pages/studentcenter/works?detail=${JSON.stringify(this.detail)}`
116
+    }
117
+  },
118
+  onLoad(options) {
119
+    if (options.detail) {
120
+      this.detail = JSON.parse(options.detail)
121
+      this.ifShare = true
122
+    }
123
+    this.cWidth = uni.upx2px(800) - 60
124
+    this.cHeight = uni.upx2px(400) // 图表配置
52
     this.init()
125
     this.init()
53
   },
126
   },
54
   methods: {
127
   methods: {
55
     checkTypes,
128
     checkTypes,
56
     init() {
129
     init() {
57
-      this.detail = JSON.parse(uni.getStorageSync('daily_class'))
130
+      //分享的页面直接读取分享数据,跳过
131
+      if (!this.ifShare) {
132
+        this.detail = JSON.parse(uni.getStorageSync('daily_class'))
133
+        //匹配能力对应分数
134
+        if (!this.detail.student_comment_data.ability) return false
135
+        this.detail.student_comment_data.ability.map(item => {
136
+          this.$set(item, 'score', this.detail.student_comment_data.ability_score[item.id])
137
+        })
138
+      }
139
+      const ability = {
140
+        categories: this.detail.student_comment_data.ability.map(item => item.name),
141
+        series: [
142
+          {
143
+            name: '评分',
144
+            data: this.detail.student_comment_data.ability.map(item => item.score)
145
+          }
146
+        ]
147
+      }
148
+      this.showRadar('ability', ability)
149
+    },
150
+    viewImage(e) {
151
+      uni.previewImage({
152
+        urls: [e.currentTarget.dataset.url],
153
+        current: e.currentTarget.dataset.url
154
+      })
155
+    },
156
+    viewVideo(e) {
157
+      this.modalName = e.currentTarget.dataset.target
158
+      this.videoUrl = e.currentTarget.dataset.url
159
+    },
160
+    hideModal(e) {
161
+      this.modalName = null
162
+    },
163
+    showRadar(canvasId, chartData) {
164
+      canvases[canvasId] = new UCharts({
165
+        canvasId: canvasId,
166
+        type: 'radar',
167
+        legend: { show: true },
168
+        fontSize: 11,
169
+        width: 300,
170
+        height: this.cHeight * this.pixelRatio,
171
+        pixelRatio: this.pixelRatio,
172
+        animation: true,
173
+        categories: chartData.categories,
174
+        series: chartData.series
175
+      })
176
+    },
177
+    touchStart(e) {
178
+      const canvasId = e.target.id
179
+      canvases[canvasId].showToolTip(e, {
180
+        format: function (item, category) {
181
+          return category ? category + ' ' + item.name + ':' + item.data : item.name + ':' + item.data
182
+        }
183
+      })
184
+      // canvases[canvasId].scrollStart(e)
185
+    },
186
+    touchMove(e) {
187
+      // const canvasId = e.target.id
188
+      // canvases[canvasId].scroll(e)
189
+    },
190
+    touchEnd(e) {
191
+      // const canvasId = e.target.id
192
+      // canvases[canvasId].scrollEnd(e)
58
     }
193
     }
59
   }
194
   }
60
 }
195
 }
@@ -63,5 +198,11 @@ export default {
63
 <style lang="scss" scoped>
198
 <style lang="scss" scoped>
64
 .page {
199
 .page {
65
   height: 100vh;
200
   height: 100vh;
201
+  background-color: #f3fffa;
202
+}
203
+.upload-item {
204
+  margin-right: 20rpx;
205
+  width: 200rpx;
206
+  height: 200rpx;
66
 }
207
 }
67
 </style>
208
 </style>

BIN
src/static/imgs/intelligent-bg.png


BIN
src/static/imgs/star-rating/delivery_icon_star_active.png


BIN
src/static/imgs/star-rating/delivery_icon_star_disable.png


BIN
src/static/imgs/star-rating/delivery_icon_star_empty.png