ssfg 5 年之前
父节点
当前提交
ae3f313790

+ 1 - 2
app.json

@@ -1,8 +1,7 @@
 {
   "pages": [
-    "pages/pyip/pyip",
     "pages/welcome/welcome",
-    
+    "pages/pyip/pyip",
     "pages/userGuide/userGuide",
     "pages/studentList/studentList",
     "pages/groupsList/groupsList",

+ 4 - 0
pages/InteractiveQA/InteractiveQA.js

@@ -11,6 +11,10 @@ Page({
     wx.navigateTo({
       url: '../pyip/pyip'
     })
+    // wx.showModal({
+    //   showCancel: false,
+    //   content: '当前功能暂未开放'
+    // })
   },
   toWyiw(){
     wx.navigateTo({

+ 1 - 1
pages/groupsList/groupsList.wxml

@@ -1,5 +1,5 @@
 <view>
-	<view class="block" wx:for="{{Arr}}" wx:for-item="item">
+	<view class="block" wx:for="{{Arr}}" wx:for-item="item" wx:key="index">
 		<view class="h1">
 			<view class="name">
 				{{item.name}}

+ 18 - 18
pages/myClass/myClass.js

@@ -304,13 +304,13 @@ Page({
   },
   // 学员名单
   toAdd2() {
-    wx.showModal({
-      showCancel: false,
-      content: '当前功能暂未开放'
-    })
-    // wx.navigateTo({
-    //   url: '../studentList/studentList?id=' + this.data.classInfo.id
+    // wx.showModal({
+    //   showCancel: false,
+    //   content: '当前功能暂未开放'
     // })
+    wx.navigateTo({
+      url: '../studentList/studentList?id=' + this.data.classInfo.id
+    })
   },
   // 项目组名单
   toAdd3() {
@@ -590,15 +590,15 @@ Page({
         },
         success: (res) => {
           console.log(res.data.list[0].answerScore)
-          if (res.data.list[0].answerScore < 0 && (res.data.list[0].answerScore == null || res.data.list[0].answerScore == "")) {
+          if (res.data.list[0].answerScore >= 0 && res.data.list[0].answerScore != null) {
+            wx.navigateTo({
+              url: '/pages/grade/grade?answersId=' + e.currentTarget.dataset.item.isExamId,
+            })
+          } else {
             wx.showModal({
               showCancel: false,
               content: '当前老师批阅中,请耐心等待'
             })
-          } else {
-            wx.navigateTo({
-              url: '/pages/grade/grade?answersId=' + e.currentTarget.dataset.item.isExamId,
-            })
           }
         }
       })
@@ -641,6 +641,7 @@ Page({
         clasId: this.data.classInfo.id
       },
       success: (res) => {
+        console.log(res,"999999999999999999")
         if (res.data.code == 0) {
           if (res.data.list.length == 0) {
             wx.showModal({
@@ -657,17 +658,16 @@ Page({
                     answersId: res.data.list[0].answersId
                   },
                   success: (res1) => {
-                    // if (res1.data.list[0].answerScore) {
-                    if (res1.data.list[0].answerScore < 0 && (res1.data.list[0].answerScore == null || res1.data.list[0].answerScore == "")) {
+                    console.log(res1,"0000000000000")
+                    if (res1.data.list[0].answerScore >= 0 && res1.data.list[0].answerScore != null) {
+                      wx.navigateTo({
+                        url: '/pages/grade/grade?answersId=' + res.data.list[0].answersId,
+                      })
+                    } else {
                       wx.showModal({
                         showCancel: false,
                         content: '当前老师批阅中,请耐心等待'
                       })
-
-                    } else {
-                      wx.navigateTo({
-                        url: '/pages/grade/grade?answersId=' + res.data.list[0].answersId,
-                      })
                     }
                   }
                 })

+ 1 - 1
pages/myClass/myClass.wxml

@@ -76,7 +76,7 @@
 		<view class="layout_text2" wx:else>去填写</view>
 	</view>
 	<view class="qy_title" bindtap="goMyPoints">
-		<view class="redk"></view>我的积分:80积分
+		<view class="redk"></view>我的积分:0积分
 		<view class="more">></view>
 	</view>
 	<view class="lq">

+ 74 - 15
pages/myMission/myMission.js

@@ -132,6 +132,67 @@ Page({
       }
     })
   },
+  saveImg() {
+    wx.showLoading({
+      title: '保存中...'
+    })
+    wx.downloadFile({
+      url: this.data.classInfo.codeImg,
+      success: function (res) {
+        //图片保存到本地
+        wx.saveImageToPhotosAlbum({
+          filePath: res.tempFilePath,
+          success: function (data) {
+            wx.hideLoading()
+            wx.showModal({
+              title: '提示',
+              content: '保存成功',
+              showCancel: false,
+            })
+          },
+          fail: function (err) {
+            if (err.errMsg === "saveImageToPhotosAlbum:fail:auth denied" || err.errMsg === "saveImageToPhotosAlbum:fail auth deny") {
+              // 这边微信做过调整,必须要在按钮中触发,因此需要在弹框回调中进行调用
+              wx.showModal({
+                title: '提示',
+                content: '需要您授权保存相册',
+                showCancel: false,
+                success: modalSuccess => {
+                  wx.openSetting({
+                    success(settingdata) {
+                      console.log("settingdata", settingdata)
+                      if (settingdata.authSetting['scope.writePhotosAlbum']) {
+                        wx.showModal({
+                          title: '提示',
+                          content: '获取权限成功,再次点击图片即可保存',
+                          showCancel: false,
+                        })
+                      } else {
+                        wx.showModal({
+                          title: '提示',
+                          content: '获取权限失败,将无法保存到相册哦~',
+                          showCancel: false,
+                        })
+                      }
+                    },
+                    fail(failData) {
+                      console.log("failData", failData)
+                    },
+                    complete(finishData) {
+                      console.log("finishData", finishData)
+                    }
+                  })
+                }
+              })
+            }
+          },
+          complete(res) {
+            wx.hideLoading()
+          }
+        })
+      }
+    })
+  },
   // 检查第二个任务 学员登记表
   checkTaskList2(sessionKey) {
     wx.request({
@@ -194,7 +255,7 @@ Page({
         sessionKey: sessionKey
       },
       success: (res) => {
-        if (res.data.code == 0 &&res.data.data.graduation == 0 ) {
+        if (res.data.code == 0 && res.data.data.graduation == 0) {
           this.setData({
             istask6: true
           })
@@ -210,7 +271,7 @@ Page({
       data: {
         sessionKey: sessionKey
       },
-      success:  (res)=> {
+      success: (res) => {
         if (res.data.code == 0) {
           if (res.data.data !== null || res.data.data !== "") {
             this.isClass(sessionKey)
@@ -567,7 +628,7 @@ Page({
   //   })
   // },
   goQmks() {
-    if (!this.data.istask) {
+    if (!this.data.istask1) {
       wx.showModal({
         showCancel: false,
         content: "请先去扫描二维码加入班级群吧",
@@ -612,17 +673,15 @@ Page({
                     answersId: res.data.list[0].answersId
                   },
                   success: (res1) => {
-                    // if (res1.data.list[0].answerScore) {
-                    if (res1.data.list[0].answerScore < 0 && (res1.data.list[0].answerScore == null || res1.data.list[0].answerScore == "")) {
+                    if (res1.data.list[0].answerScore >= 0 && res1.data.list[0].answerScore != null) {
+                      wx.navigateTo({
+                        url: '/pages/grade/grade?answersId=' + res.data.list[0].answersId,
+                      })
+                    } else {
                       wx.showModal({
                         showCancel: false,
                         content: '当前老师批阅中,请耐心等待'
                       })
-
-                    } else {
-                      wx.navigateTo({
-                        url: '/pages/grade/grade?answersId=' + res.data.list[0].answersId,
-                      })
                     }
                   }
                 })
@@ -807,15 +866,15 @@ Page({
         },
         success: (res) => {
           console.log(res.data.list[0].answerScore)
-          if (res.data.list[0].answerScore < 0 && (res.data.list[0].answerScore == null || res.data.list[0].answerScore == "")) {
+          if (res.data.list[0].answerScore >= 0 && res.data.list[0].answerScore != null) {
+            wx.navigateTo({
+              url: '/pages/grade/grade?answersId=' + e.currentTarget.dataset.item.isExamId,
+            })
+          } else {
             wx.showModal({
               showCancel: false,
               content: '当前老师批阅中,请耐心等待'
             })
-          } else {
-            wx.navigateTo({
-              url: '/pages/grade/grade?answersId=' + e.currentTarget.dataset.item.isExamId,
-            })
           }
         }
       })

+ 6 - 6
pages/personInfo/personInfo.js

@@ -28,12 +28,12 @@ Page({
     })
   },
   toUser(){
-    wx.showModal({
-      showCancel: false,
-      content: '当前功能暂未开放'
-    })
-    // wx.navigateTo({
-    //   url: '/pages/userGuide/userGuide',
+    // wx.showModal({
+    //   showCancel: false,
+    //   content: '当前功能暂未开放'
     // })
+    wx.navigateTo({
+      url: '/pages/userGuide/userGuide',
+    })
   }
 })

+ 86 - 39
pages/pyip/pyip.js

@@ -1,13 +1,16 @@
 // pages/pyip/pyip.js
 const COS = require('../../utils/cos.js');
 const app = require('../../utils/util.js');
+const tools = require('../../utils/tools.js');
 Page({
   /**
    * 页面的初始数据
    */
   data: {
     carWin_img_hidden: true, //展示照片的view是否隐藏
-    carWin_img: '' //存放照片路径的
+    carWin_img: '', //存放照片路径的
+    carWin_img_type: 2, //是图片还是视频
+    cosPath: "" //腾讯云上传的路径
   },
   openCamera() {
     wx.chooseMedia({
@@ -17,12 +20,22 @@ Page({
       maxDuration: 30,
       camera: 'back',
       success: (res) => {
-        console.log(res.tempFiles[0].tempFilePath)
-        console.log(res.tempFiles[0].size)
-        this.setData({
-          carWin_img: res.tempFiles[0].tempFilePath,
-          carWin_img_hidden: false,
-        })
+        console.log(res, "9999999999999999")
+        let path = res.tempFiles[0].tempFilePath
+        let uploadType = path.substring(path.length - 3)
+        if (uploadType == "jpg" || uploadType == "png") {
+          this.setData({
+            carWin_img: path,
+            carWin_img_hidden: false,
+            carWin_img_type: 0
+          })
+        } else if (uploadType == "mp4") {
+          this.setData({
+            carWin_img: path,
+            carWin_img_hidden: false,
+            carWin_img_type: 1
+          })
+        }
       }
     })
   },
@@ -50,14 +63,14 @@ Page({
       prefix = 'https://cos.' + Region + '.myqcloud.com/' + Bucket + '/';
     }
     // 对更多字符编码的 url encode 格式
-    var camSafeUrlEncode = function (str) {
-      return encodeURIComponent(str)
-        .replace(/!/g, '%21')
-        .replace(/'/g, '%27')
-        .replace(/\(/g, '%28')
-        .replace(/\)/g, '%29')
-        .replace(/\*/g, '%2A');
-    };
+    // var camSafeUrlEncode = function (str) {
+    //   return encodeURIComponent(str)
+    //     .replace(/!/g, '%21')
+    //     .replace(/'/g, '%27')
+    //     .replace(/\(/g, '%28')
+    //     .replace(/\)/g, '%29')
+    //     .replace(/\*/g, '%2A');
+    // };
     // 获取临时密钥
     var stsCache;
     var getCredentials = function (callback) {
@@ -70,7 +83,6 @@ Page({
         url: app.globalData.publicUrl + '/wx/course/getSts', // 服务端签名,参考上文说的获取临时密钥
         // dataType: 'json',
         success: function (result) {
-          console.log(result, "000000000000")
           var credentials = result.data.credential.credentials;
           if (credentials) {
             stsCache = result.data.credential
@@ -124,41 +136,58 @@ Page({
         name: 'file',
         filePath: this.data.carWin_img,
         formData: {
-          'key': "paiyipai/"+Key,
+          'key': "paiyipai/" + Key,
           'success_action_status': 200,
           'Signature': AuthData.Authorization,
           'x-cos-security-token': AuthData.XCosSecurityToken,
           'Content-Type': '',
         },
         success: (res) => {
-          var url = prefix + camSafeUrlEncode(Key).replace(/%2F/g, '/');
-          console.log('prefix' + prefix);
-          console.log('Key' + Key);
-          console.log('4564564654654');
-          console.log(res.statusCode);
-          console.log(url);
+          console.log(res.header.Location, "11111111111111")
+          // var url = prefix + camSafeUrlEncode(Key).replace(/%2F/g, '/');
           if (/^2\d\d$/.test('' + res.statusCode)) {
-            wx.showModal({
-              title: '上传成功',
-              showCancel: false
+            wx.request({
+              method: 'PUT',
+              url: app.globalData.publicUrl + '/wx/shoot',
+              data: {
+                shootName: this.data.carWin_img,
+                shootCosName: Key,
+                sessionKey: this.data.sessionKey,
+                shootType: this.data.carWin_img_type
+              },
+              success: (res) => {
+                if (res.data.code == 0) {
+                  console.log(res, "我把照片路径传到服务器啦")
+                  wx.showModal({
+                    title: '上传成功',
+                    showCancel: false
+                  });
+                  this.setData({
+                    // cosPath: res.header.Location,
+                    carWin_img: "",
+                    carWin_img_type: 2,
+                    carWin_img_hidden: true
+                  })
+                  this.getArr(this.data.sessionKey)
+                } else {
+                  wx.showModal({
+                    title: "上传失败啦",
+                    showCancel: false
+                  });
+                }
+              }
             });
-            this.setData({
-              carWin_img: "",
-              carWin_img_hidden:true
-            })
           } else {
             wx.showModal({
               title: '上传失败',
-              // content: JSON.stringify(res),
               showCancel: false
             });
           }
         },
-        fail: function (res) {
+        fail: function () {
           wx.hideLoading();
           wx.showModal({
             title: '上传失败',
-            // content: JSON.stringify(res),
             showCancel: false
           });
         }
@@ -170,16 +199,35 @@ Page({
         }
       });
     });
-    // };
-    // }
+  },
+  getArr(sessionKey) {
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/shoot',
+      method: "get",
+      data: {
+        sessionKey
+      },
+      success: (res) => {
+        console.log(res.data.imgList, "我是查到的照片视频列表")
+        console.log(res.data.videoList, "我是查到的照片视频列表")
+        this.setData({
+          imgList: res.data.imgList,
+          videoList: res.data.videoList
+        })
+      }
+    })
   },
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad: function () {
-
+  async onLoad() {
+    const sessionKey = await tools.checkSessionAndLogin();
+    this.setData({
+      sessionKey
+    })
+    this.getArr(sessionKey)
+    // this.getArr(sessionKey);
   },
-
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
@@ -189,7 +237,6 @@ Page({
       carWin_img: ''
     });
   },
-
   /**
    * 生命周期函数--监听页面显示
    */

+ 20 - 5
pages/pyip/pyip.wxml

@@ -1,11 +1,26 @@
 <view>
 	<view class="pyp_box1">
 		<view class="add_text">添加图片或视频</view>
-		<image src="../../images/camera.png" class="xj" bindtap="openCamera" wx:if="{{carWin_img_hidden}}"></image>
-		<image src="{{carWin_img}}" class="xj" bindtap="openCamera" wx:if="{{!carWin_img_hidden}}"></image>
+		<image src="../../images/camera.png" class="xj" wx:if="{{carWin_img_hidden}}" bindtap="openCamera"></image>
+		<image src="{{carWin_img}}" class="xj" bindtap="openCamera" wx:if="{{carWin_img_type==0}}"></image>
+		<video class="xj" src="{{carWin_img}}" wx:if="{{carWin_img_type==1}}" show-center-play-btn='{{false}}' show-play-btn="{{true}}" controls></video>
 		<van-button type="primary" block color="#eb3f33" custom-style="width:614rpx;border-radius:10rpx;margin-top:20rpx;" bindtap="submitImgToTxy">提交</van-button>
+		<van-button type="primary" block color="#eb3f33" custom-style="width:614rpx;border-radius:10rpx;margin-top:20rpx;" bindtap="openCamera">重新拍摄</van-button>
+	</view>
+	<view class="pyp_box2" wx:if="{{imgList.length!= 0}}">
+		<view class="add_text">历史上传照片</view>
+		<view style="display:flex;flex-wrap:wrap">
+		<view wx:for="{{imgList}}" wx:for-item="item">
+			<image src="{{item.filePath}}" class="slt"></image>
+		</view>
+		</view>
+	</view>
+		<view class="pyp_box2" style="margin-bottom:50rpx" wx:if="{{videoList.length!= 0}}">
+		<view class="add_text">历史上传视频</view>
+		<view style="display:flex;flex-wrap:wrap">
+		<view wx:for="{{videoList}}" wx:for-item="item">
+			<video src="{{item.filePath}}" show-center-play-btn='{{false}}' show-play-btn="{{true}}" controls class="xj"></video>
+		</view>
+		</view>
 	</view>
-	<!-- <view class="pyp_box2">
-		<view class="add_text">历史上传</view>
-	</view> -->
 </view>

+ 8 - 1
pages/pyip/pyip.wxss

@@ -3,7 +3,7 @@ page {
 }
 .pyp_box1 {
   width: 680rpx;
-  height: 620rpx;
+  height: 760rpx;
   margin-left: 35rpx;
   margin-top: 20rpx;
   background-color: #fff;
@@ -27,4 +27,11 @@ page {
   margin-top: 20rpx;
   background-color: #fff;
   border-radius: 30rpx;
+}
+.slt{
+  width: 200rpx;
+  height: 200rpx;
+  margin-left: 20rpx;
+  padding-bottom: 30rpx;
+  margin-top: 20rpx;
 }

+ 7 - 30
pages/studentList/studentList.js

@@ -6,34 +6,10 @@ Page({
    * 页面的初始数据
    */
   data: {
-    Arr: [{
-      name: "周勉征",
-      sex: "男",
-      zw: "项目组长",
-      phone: "13843043033"
-    }, {
-      name: "刘占辉",
-      sex: "男",
-      zw: "项目副组长",
-      phone: "18643067799"
-    }, {
-      name: "常 茳",
-      sex: "男",
-      zw: "项目副组长",
-      phone: "13364646964"
-    }, {
-      name: "冯 爽",
-      sex: "男",
-      zw: "项目助理",
-      phone: "13944098768"
-    }, {
-      name: "吴琳琳",
-      sex: "男",
-      zw: "项目秘书",
-      phone: "18604413379"
-    }]
+    Arr: []
   },
   onLoad: function (options) {
+    console.log(options.id)
     wx.request({
       url: app.globalData.publicUrl + '/wx/student/selStudentList',
       method: "post",
@@ -41,10 +17,11 @@ Page({
         clasId: options.id
       },
       success: (res) => {
-        console.log(res)
-        // this.setData({
-        //   dataArr: res.data.data
-        // })
+        if (res.data.code == 0) {
+          this.setData({
+            Arr: res.data.data
+          })
+        }
       }
     })
   },

+ 5 - 5
pages/studentList/studentList.wxml

@@ -5,10 +5,10 @@
 		<van-col span="9">工作单位及职务</van-col>
 		<van-col span="8">联系方式</van-col>
 	</van-row>
-	<van-row class="text2" wx:for="{{Arr}}" wx:for-item="item">
-		<van-col span="4">{{item.name}}</van-col>
-		<van-col span="3">{{item.sex}}</van-col>
-		<van-col span="9">{{item.zw}}</van-col>
-		<van-col span="8">{{item.phone}}</van-col>
+	<van-row class="text2" wx:for="{{Arr}}" wx:for-item="item" wx:key="index">
+		<van-col span="4">{{item.studentName}}</van-col>
+		<van-col span="3">{{item.studentSex}}</van-col>
+		<van-col span="9">{{item.studentDuty}}</van-col>
+		<van-col span="8">{{item.studentPhone}}</van-col>
 	</van-row>
 </view>

+ 8 - 4
pages/userGuide/userGuide.js

@@ -6,12 +6,16 @@ Page({
   data: {
     Arr: [{
       num: "Q1",
-      question: "我是问题我是问题我是问题我是问题我是问题我是问题我是问题我是问题我是问题我是问题我是问题我是问题我是问题我是问题我是问题我是问题我是问题1",
-      answer: "我是回答我是回答我是回答我是回答我是回答我是回答我是回答我是回答我是回答我是回答我是回答我是回答我是回答我是回答我是回答我是回答我是回答1"
+      question: "小程序班级、任务页面功能为何不能正常使用",
+      answer: "1.请先去认证身份信息,确保已认证 2.确保您的身份信息已录入后台系统"
     }, {
       num: "Q2",
-      question: "我是问题我是问题我是问题我是问题我是问题我是问题我是问题我是问题我是问题我是问题我是问题我是问题我是问题我是问题我是问题我是问题我是问题2",
-      answer: "我是回答我是回答我是回答我是回答我是回答我是回答我是回答我是回答我是回答我是回答我是回答我是回答我是回答我是回答我是回答我是回答我是回答2"
+      question: "小程序班级、任务页面中。为什么不能去考试",
+      answer: "1.请您确保此课视频内容已按时学完,才可以去考试哦 2.您的老师可能还没有出题哦"
+    }, {
+      num: "Q3",
+      question: "小程序随手拍功能上传照片时为何失败",
+      answer: "目前图片仅支持JPG PNG格式,视频仅支持MP4格式。"
     }]
   },
   /**

+ 3 - 2
utils/util.js

@@ -1,8 +1,9 @@
 const globalData = {
-  publicUrl: 'https://sqpx.jiaxintech.com',
+  publicUrl: 'https://sqdx.jiaxintech.com'//测试地址
+  // publicUrl: 'https://sqpx.jiaxintech.com',
   // publicUrl:'http://10.16.10.139'
   // publicUrl:'http://10.16.4.19:80'
-  // publicUrl:'http://10.16.4.26:8090'
+  // publicUrl:'http://10.16.4.26:80'
 };
 module.exports = {
   globalData: globalData