Bläddra i källkod

成长足迹,学员订单对接

zhangshuling 3 år sedan
förälder
incheckning
b4b6b6bd9f
4 ändrade filer med 360 tillägg och 51 borttagningar
  1. 190 40
      pages/growUp/growUp.js
  2. 55 7
      pages/growUp/growUp.wxml
  3. 94 0
      pages/growUp/growUp.wxss
  4. 21 4
      pages/orderClassDetail/orderClassDetail.wxml

+ 190 - 40
pages/growUp/growUp.js

@@ -1,48 +1,104 @@
 // pages/growUp/growUp.js
+const app = getApp()
+const util = require("../../utils/util")
+const urlDef = require("../../utils/urls")
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
-    src:'http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400',
-    list:[
-      {
-        time: '2021-02-01 11:11',
-        name: '报名课程:小象钢琴 1',
-        desc: '来自我的足迹',
-      },
-      {
-        time: '2021-02-02 11:11',
-        name: '报名课程:小象钢琴 2',
-        desc: '来自我的足迹',
-      },
-      {
-        time: '2021-02-03 11:11',
-        name: '发布新动态',
-        desc: '来自我的足迹',
-        type: '2'
-      },
-      {
-        time: '2021-02-04 11:11',
-        name: '取得新成绩:二月调考 88 分',
-        desc: '来自我的足迹',
-        type: '1'
-      },
-      {
-        time: '2021-02-05 11:11',
-        name: '报名课程:小象钢琴 3',
-        desc: '来自我的足迹',
-      },
-    ]
-  },
-
-  getImg:function(e){
-    // const list = [e.currentTarget.dataset.url]
-    const list = ['https://file.schoolwisdoms.com/image/26cf1980-5b25-4c2e-af7f-376677d76033.jpg']
+    studentId: null,
+    orgId: null,
+    curVideo: '',
+    videoFlag: 0,
+    videoContext: '',
+    curAudio: '',
+    curAudioIndex: -1,
+    audioPause: 0,
+    list: [
+    ],
+    loading: '上拉加载',
+    flag: 0,
+    pageNum: 0,
+    hasNextPage: true,
+  },
+
+  bindfullscreenchange: function () {
+    if (this.data.videoFlag == 0) {
+      this.setData({
+        videoFlag: 1
+      })
+    } else {
+      this.setData({
+        videoFlag: 0,
+        curVideo: ""
+      })
+    }
+  },
+
+  videoShow: function (e) {
+    this.setData({
+      curVideo: e.currentTarget.dataset.url
+    })
+    this.videoContext.requestFullScreen({	// 设置全屏时视频的方向,不指定则根据宽高比自动判断。
+      direction: 90						// 屏幕逆时针90度
+    });
+  },
+
+  showImg: function (e) {
+    let id = e.currentTarget.dataset.id
+    var images = [];
+    this.data.list.map(it => {
+      if (it.id == id) {
+        let imgs = it.images
+        imgs.map(i => {
+          images.push(i.url)
+        })
+      }
+    })
     wx.previewImage({
-      current: list[0],
-      urls: list,
+      urls: images
+    })
+  },
+  audioShow: function (e) {
+    if (this.data.audioPause == 0 && this.data.curAudioIndex != e.currentTarget.dataset.index) {//播放语音,切换
+      this.setData({
+        curAudio: ""
+      })
+      this.setData({
+        curAudioIndex: e.currentTarget.dataset.index,
+        curAudio: e.currentTarget.dataset.url,
+
+      })
+      this.audioContext.play()
+      this.setData({
+        audioPause: 0
+      })
+    } else if (this.data.audioPause == 1 && this.data.curAudioIndex == e.currentTarget.dataset.index) {//暂停后恢复播放
+      this.audioContext.play()
+      this.setData({
+        audioPause: 0
+      })
+    } else if (this.data.audioPause == 0 && this.data.curAudioIndex == e.currentTarget.dataset.index) {//暂停播放
+      this.audioContext.pause()
+      this.setData({
+        audioPause: 1
+      })
+    }
+  },
+
+  bindended: function () {
+    this.setData({
+      audioPause: 0,
+      curAudioIndex: -1,
+      curAudio: ''
+    })
+  },
+
+  bindpause: function () {
+    this.setData({
+      audioPause: 1
     })
   },
 
@@ -50,7 +106,17 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-
+    let sid = options.studentId
+    let oid = options.orgId
+    if (sid == null || oid == null) {
+      let stu = wx.getStorageSync('student')
+      sid = stu.studentId
+      oid = stu.orgId
+    }
+    this.audioContext = wx.createAudioContext('audio-play')
+    this.videoContext = wx.createVideoContext('play-video');// 	创建 video 上下文 VideoContext 对象。
+    this.setData({ studentId: sid, orgId: oid })
+    this.queryList()
   },
 
   /**
@@ -92,13 +158,97 @@ Page({
    * 页面上拉触底事件的处理函数
    */
   onReachBottom: function () {
-
+    if (this.data.hasNextPage) {
+      let pn = this.data.pageNum
+      this.setData({ loading: '加载中', 'pageNum': ++pn })
+      this.queryList()
+    }
   },
 
   /**
    * 用户点击右上角分享
    */
   onShareAppMessage: function () {
-
+    return {
+      title: '成长足迹',
+      path: '/pages/growUp/growUp?studentId=' + this.data.studentId + '&orgId=' + this.data.orgId,
+    }
+  },
+  queryList: function () {
+    const urls = urlDef.urls;
+    let params = { 'q.studentId': this.data.studentId, 'q.orgId': this.data.orgId }
+    params.pageNum = this.data.pageNum
+    util.apiPost(urls.query_student_evaluate, params).then(rs => {
+      let list = rs.list
+      list.map(it => {
+        if (it.beginTime) {
+          it.beginTime = it.beginTime.replace('T', ' ').substring(0, 16)
+        }
+        if (it.type === '1') {
+          util.apiPost(urls.query_student_star + '&q.orgId=' + this.data.orgId + '&q.studentId='
+            + this.data.studentId + '&q.headId=' + it.id).then((st) => {
+              it.star = st;
+            }, e => {
+              console.log(e);
+            });
+
+          let attachs;
+          try {
+            if (it.evaluateAttach) {
+              attachs = JSON.parse(it.evaluateAttach);
+            } else {
+              attachs = {};
+            }
+          } catch (e) {
+            console.error(JSON.stringify(e));
+          }
+          if (attachs) {
+            it.images = attachs.images ? attachs.images : [];
+            it.videos = attachs.videos ? attachs.videos : [];
+            it.records = attachs.records ? attachs.records : [];
+
+            it.images.forEach(rs => {
+              rs.url = urls.oss_file + 'image/' + rs.url
+            });
+
+            it.records.forEach(rs => {
+              rs.url = urls.oss_file + 'file/' + rs.url
+            });
+
+            // 加载视频封面
+            it.videos.forEach(r => {
+              util.apiPost(urls.video_loadInfo + r.url).then((rs) => {
+                r.imgUrl = rs.img;
+                r.playUrl = rs.url;
+                this.reloadVideos(it)
+              });
+            });
+
+          }
+        } else if (it.type === '4') {
+          util.apiPost(urls.video_loadInfo + it.evaluateAttach).then((rs) => {
+            it.imgUrl = rs.img;
+            it.playUrl = rs.url;
+            this.reloadVideos(it)
+          });
+
+        }
+      })
+
+      this.setData({
+        'hasNextPage': rs.hasNextPage,
+        'loading': rs.hasNextPage ? '下拉刷新' : '没有更多数据',
+        'list': this.data.list.concat(list)
+      })
+    })
+  },
+  reloadVideos: function (t) {
+    let list = this.data.list;
+    list.map(it => {
+      if (it.id == t.id) {
+        it = t;
+      }
+    })
+    this.setData({ list: list })
   }
 })

+ 55 - 7
pages/growUp/growUp.wxml

@@ -3,17 +3,65 @@
     <view class="grow-list">
       <view class="grow-box" wx:for="{{list}}" wx:key="index">
         <view class="line-index"></view>
-        <view class="grow-title">
-          <view class="grow-time">{{item.time}}</view>
-          <view class="grow-name">{{item.name}}</view>
+
+        <view class="grow-title" wx:if="{{item.type == '1'}}">
+          <view class="grow-time">{{item.beginTime}}</view>
+          <view class="grow-name">{{item.classesName}} : {{item.name}}</view>
+          <view class="grow-content">{{item.evaluateContent}}</view>
+
+          <view class="task-content">
+            <view class="title">图片</view>
+            <view class="img-list">
+              <image  wx:for="{{item.images}}" wx:for-item="img" src="{{img.url}}" mode="aspectFill" wx:key="index" bindtap="showImg" data-url="{{img.url}}"  data-id="{{item.id}}"></image>
+            </view>
+
+            <view class="title">视频</view>
+            <view class="video-list">
+              <view wx:for="{{item.videos}}" wx:key="index" class="video-img-view" data-url="{{item.playUrl}}" bindtap="videoShow">
+                <image class="videoImg" src="{{item.imgUrl}}" mode="aspectFill"  ></image>
+                <image class="playImg" src="/images/play.png"></image>
+              </view>
+            </view>
+            <video id="play-video" bindfullscreenchange="bindfullscreenchange" wx:if="{{curVideo != ''}}" autoplay="true" src="{{curVideo}}" controls="true" downloadlist></video>
+
+            <view class="title">语音</view>
+            <view class="audio-list">
+              <image  wx:for="{{item.records}}"  bindtap="audioShow" src="{{index == curAudioIndex ? '/images/cur-audio.png' : '/images/audio.png'}}" class="{{index == curAudioIndex ? 'curAudioStyle' : ''}}" wx:key="index" data-index="{{index}}" data-url="{{item.url}}"></image>
+            </view>
+            <audio id="audio-play" bindpause="bindpause" bindended="bindended" src="{{curAudio}}"></audio>
+           </view>
+          <view class="grow-desc">来自课后点评</view>
+        </view>
+        
+        <view class="grow-title" wx:if="{{item.type == '2'}}">
+          <view class="grow-time">{{item.beginTime}}</view>
+          <view class="grow-name">报名课程: {{item.classesName}}</view>
+          <view class="grow-content"></view>
+          <view class="grow-desc">来自我的足迹</view>
+        </view>
+
+        <view class="grow-title" wx:if="{{item.type == '3'}}">
+          <view class="grow-time">{{item.beginTime}}</view>
+          <view class="grow-name">取得新成绩: {{item.name}}, {{item.evaluateContent}}分</view>
+          <view class="grow-content"></view>
+          <view class="grow-desc">来自我的成绩</view>
+        </view>
+
+        <view class="grow-title" wx:if="{{item.type == '4'}}">
+          <view class="grow-time">{{item.beginTime}}</view>
+          <view class="grow-name">发布新动态</view>
           <view class="grow-content">
-            <image wx:if="{{item.type == 1}}" mode="aspectFill" src="/images/logo.png" bindtap="getImg" data-url="/images/logo.png"></image>
-            <video wx:if="{{item.type == 2}}"
-              src="http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400"></video>
+              <view  class="video-img-view" data-url="{{item.playUrl}}" bindtap="videoShow">
+                <image class="videoImg" src="{{item.imgUrl}}" mode="aspectFill"  ></image>
+                <image class="playImg" src="/images/play.png"></image>
+              </view>
+              <audio id="audio-play" bindpause="bindpause" bindended="bindended" src="{{curAudio}}"></audio>
           </view>
-          <view class="grow-desc">{{item.desc}}</view>
+          <view class="grow-desc">来自学生秀</view>
         </view>
+
       </view>
     </view>
   </view>
+  <view class="loading">{{loading}}</view> 
 </view>

+ 94 - 0
pages/growUp/growUp.wxss

@@ -49,4 +49,98 @@
 }
 .grow-content{
   margin: 20rpx 0;
+}
+.loading {
+  height: 200rpx;
+  line-height: 100rpx;
+  background: #f1f1f1;
+  color: #999;
+  text-align: center;
+}
+
+.img-list,
+.video-list,
+.audio-list {
+  display: grid;
+  justify-content: space-between;
+  grid-template-columns: repeat(auto-fill, 150rpx);
+  grid-gap: auto;
+}
+
+.audio-list {
+  display: grid;
+  justify-content: space-between;
+  grid-template-columns: repeat(auto-fill, 120rpx);
+  grid-gap: auto;
+}
+
+.img-list image,
+.video-list image {
+  width: 150rpx;
+  height: 150rpx;
+  border-radius: 20rpx;
+  margin-bottom: 20rpx;
+  margin: 10rpx auto;
+  border: 0.55rpx #f5f5f5 solid;
+}
+
+.video-img-view {
+  position: relative;
+}
+
+.videoImg {
+  opacity: 0.9;
+}
+
+.playImg {
+  width: 48rpx !important;
+  height: 48rpx !important;
+  position: absolute;
+  z-index: 2;
+  left: 50%;
+  margin-left: -24rpx !important;
+  top: 50%;
+  margin-top: -24rpx !important;
+}
+
+.audio-list image {
+  height: 30rpx;
+  width: 50rpx;
+  border: 1px solid #eee;
+  box-shadow: 0 0 20rpx #ccc;
+  padding: 10rpx;
+  margin-top: 20rpx;
+  padding: 0 25rpx;
+  border-radius: 10rpx;
+}
+
+.curAudioStyle {
+  box-shadow: 0 0 20rpx #cc6031 !important;
+  border: none;
+}
+
+.toTask {
+  width: 400rpx;
+  height: 80rpx;
+  text-align: center;
+  line-height: 80rpx;
+  color: #FFF;
+  background: #cc6031;
+  border-radius: 50rpx;
+  font-size: 36rpx;
+  position: fixed;
+  bottom: 40rpx;
+  left: 50%;
+  margin-left: -200rpx;
+}
+
+.done-title {
+  font-size: 36rpx;
+  margin-top: 60rpx;
+}
+
+#play-video{
+  position: absolute;
+  top: 40rpx;
+  left: 100rpx;
 }

+ 21 - 4
pages/orderClassDetail/orderClassDetail.wxml

@@ -25,12 +25,29 @@
   </view>
   <view class="money-detail">
     <view class="money-title">课程总价:</view>
-    <view class="money-price detail">¥ 6000.00</view>
+    <view class="money-price detail">¥ {{order.classesPayableAmount}}</view>
     <view class="money-title">物品总价:</view>
-    <view class="money-price detail">¥ 0.00</view>
+    <view class="money-price detail">¥ {{order.goodsPayableAmount}}</view>
     <view class="money-title">活动折扣:</view>
-    <view class="money-price detail">-¥ 0.00</view>
+    <view class="money-price detail">-¥ {{order.discountPrice }}</view>
+
+    <view class="money-title" wx:if="{{order.couponPrice > 0}}">优惠券:</view>
+    <view class="money-price detail"  wx:if="{{order.couponPrice > 0}}">-¥ {{order.couponPrice}}</view>
+
     <view class="money-title-other">实付金额:</view>
-    <view class="money-price-other">¥ 6000.00</view>
+    <view class="money-price-other">¥ {{order.actualAmount}}</view>
+  </view>
+
+  <view class="order-detail" wx:if="{{order.refundId && order.refundId.length > 0}}">
+    <view class="order-title">退款原因:</view>
+    <view class="order-num detail">{{order.refundReason}}</view>
+    <view class="order-title">退款时间:</view>
+    <view class="order-payTime detail">{{order.refundDate}}</view>
+    <view class="money-title-other">课程消耗金额:</view>
+    <view class="money-price-other">¥ {{order.classesConsumeAmount}}</view>
+    <view class="money-title-other">物品消耗金额:</view>
+    <view class="money-price-other">¥ {{order.goodsConsumeAmount}}</view>
+    <view class="money-title-other">已退金额:</view>
+    <view class="money-price-other">¥ {{order.refundAmount}}</view>
   </view>
 </view>