roose 5 年之前
父節點
當前提交
8fe624a70c
共有 42 個文件被更改,包括 2076 次插入390 次删除
  1. 68 0
      components/image-upload/image-upload.js
  2. 4 0
      components/image-upload/image-upload.json
  3. 11 0
      components/image-upload/image-upload.wxml
  4. 1 0
      components/image-upload/image-upload.wxss
  5. 145 0
      components/my-video/scroll-video.js
  6. 6 0
      components/my-video/scroll-video.json
  7. 36 0
      components/my-video/scroll-video.wxml
  8. 35 0
      components/my-video/scroll-video.wxss
  9. 29 0
      components/my-video/video-button-bar.js
  10. 4 0
      components/my-video/video-button-bar.json
  11. 16 0
      components/my-video/video-button-bar.wxml
  12. 19 0
      components/my-video/video-button-bar.wxss
  13. 48 0
      components/region-picker/region-picker.js
  14. 4 0
      components/region-picker/region-picker.json
  15. 24 0
      components/region-picker/region-picker.wxml
  16. 1 0
      components/region-picker/region-picker.wxss
  17. 53 0
      components/text-input/text-input.js
  18. 4 0
      components/text-input/text-input.json
  19. 7 0
      components/text-input/text-input.wxml
  20. 1 0
      components/text-input/text-input.wxss
  21. 57 0
      components/text-picker/text-picker.js
  22. 4 0
      components/text-picker/text-picker.json
  23. 17 0
      components/text-picker/text-picker.wxml
  24. 1 0
      components/text-picker/text-picker.wxss
  25. 50 0
      components/text-time/text-time.js
  26. 4 0
      components/text-time/text-time.json
  27. 24 0
      components/text-time/text-time.wxml
  28. 1 0
      components/text-time/text-time.wxss
  29. 327 18
      pages/answerAfterclass/answerAfterclass.js
  30. 27 10
      pages/answerAfterclass/answerAfterclass.wxml
  31. 27 0
      pages/answerAfterclass/answerAfterclass.wxss
  32. 61 20
      pages/grade/grade.js
  33. 22 19
      pages/grade/grade.wxml
  34. 65 9
      pages/myClass/myClass.js
  35. 560 137
      pages/studentRegistration/studentRegistration.js
  36. 2 1
      pages/studentRegistration/studentRegistration.json
  37. 67 132
      pages/studentRegistration/studentRegistration.wxml
  38. 65 6
      pages/studentRegistration/studentRegistration.wxss
  39. 158 33
      pages/testAnswer/testAnswer.js
  40. 9 5
      pages/testAnswer/testAnswer.wxml
  41. 5 0
      pages/testAnswer/testAnswer.wxss
  42. 7 0
      pages/testAnswer/times.wxs

+ 68 - 0
components/image-upload/image-upload.js

@@ -0,0 +1,68 @@
+// components/image-upload/image-upload.js
+import util from '../../utils/util.js';
+Component({
+  /**
+   * 组件的属性列表
+   */
+  options: {
+    addGlobalClass: true,
+  },
+  properties: {
+    label: {
+      type: String,
+      value: '',
+    },
+    formid: {
+      type: String,
+      value: '',
+    },
+    forminfo: {
+      type: Object,
+      value: {}
+    }
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+     wx_back_image:'',
+     inputType:'upload',
+     input_text:'', //获取到上传成功以后的输入地址
+  },
+  behaviors: ['wx://component-export'],
+  export() {
+    return { 
+      input_text: this.data.input_text,
+      force: this.properties.forminfo.force,
+      role:this.properties.forminfo.role
+      }
+  },
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    uploadImage:function(){
+       wx.chooseImage({
+         count: 1,
+         sizeType: ['original','compressed'],
+         sourceType: ['album', 'camera'],
+         success: (res)=>{
+           console.log(res);
+           const { tempFilePaths} =res;
+           console.log('wx image path::::',tempFilePaths[0]);
+           this.setData({
+             wx_back_image: tempFilePaths[0]
+           });
+           util.wx_upload_image(tempFilePaths[0]).then((resp)=>{
+               console.log(resp);
+               this.setData({
+                 inputType: 'uploaded',
+                 input_text: resp,
+               });
+           });
+         },
+       })
+    },
+  }
+})

+ 4 - 0
components/image-upload/image-upload.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 11 - 0
components/image-upload/image-upload.wxml

@@ -0,0 +1,11 @@
+<!--components/image-upload/image-upload.wxml-->
+<view class='reports-form-box form-inner'>
+          <view class='reports-form-input input-all-width'>
+            <view class='form-inputname'>{{forminfo.label}}<text wx:if="{{forminfo.force}}" class="force_text">*</text></view>
+            <block wx:if="{{inputType==='upload'}}"><button bindtap='uploadImage' class='form-inputtext form-upload'></button></block>
+            <block wx:if="{{inputType==='uploaded'}}">
+               <input  bindtap='uploadImage' value='{{input_text}}' class='form-inputtext'></input>
+            </block>
+
+          </view>
+</view>

+ 1 - 0
components/image-upload/image-upload.wxss

@@ -0,0 +1 @@
+/* components/image-upload/image-upload.wxss */

+ 145 - 0
components/my-video/scroll-video.js

@@ -0,0 +1,145 @@
+// components/scroll-video.js
+Component({
+  options: {
+    multipleSlots: true // 在组件定义时的选项中启用多slot支持
+  },
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    //父组件传入的视频列表
+    videoList:{
+      type: Array,
+      value: [],
+      observer: function(newVal, oldVal){
+        this.setData({
+          videoSize: newVal.length
+        });
+      }
+    },
+    //视频或者直播适配页面方式
+    fitType:{
+      type: String,
+      value: 'contain',
+    },
+    //滑动距离的设置 超过该距离回出现页面下滑或者上滑的情况
+    thresholdValue:{
+      type: Number,
+      value: 100,
+      observer: function (newVal, oldVal) {
+        console.log(newVal,oldVal);
+      }
+    },
+    //播放器类型
+    playerType:{
+      type: String,
+      value: 'video',
+      observer: function (newVal, oldVal) {
+      }
+    }
+    
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+    startY: 0,//开始y点
+    screenHeight:0,//获取当前屏幕高度
+    screenWidth:0,
+    scrollAnimate:0,
+    videoidx:0,//保存切换下标
+    videoSize:0,//视频列表的长度
+  },
+  ready:function(){
+   this.animation = wx.createAnimation({
+     duration:600,
+     timingFunction:'linear',
+   });
+    let that = this;
+    wx.getSystemInfo({
+      success: function (res) {
+        that.setData({
+          screenHeight: res.windowHeight,
+          screenWidth: res.windowWidth
+        })
+      }
+    })
+    console.log(this.properties.videoList.length);
+    this.setData({
+      videoSize:this.properties.videoList.length
+    });
+  },
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    buttonhandle:function(e){
+      const { buttontype, buttonname, itemid } = e.detail;
+      this.triggerEvent('menuTap', { buttontype, buttonname, itemid });
+    },
+    onTouchStart: function (e) {
+      const {pageY } = e.changedTouches[0]; //记录手指位置
+      this.setData({
+        startY: pageY
+      });
+    },
+    onTouchEnd: function (e) {
+      let { videoidx } = e.currentTarget.dataset;
+      videoidx = parseInt(videoidx)
+      console.log(videoidx);
+      let thresholdValue = this.properties.thresholdValue;
+      const {startY } = this.data;
+      let movey = e.changedTouches[0].pageY;
+      let changeY = movey - startY;
+      if (changeY > 0) {
+        if (changeY >= thresholdValue) {
+          if (videoidx===0){
+            this.triggerEvent('swipeToStart', {
+              oldindex: 0,
+              newindex: videoidx,
+              playerType: this.properties.playerType
+            });
+            return false;
+          }
+          let top_height = -((videoidx - 1) * this.data.screenHeight);
+          console.log('手指向下滑动,往上切换视频');
+          this.triggerEvent('swipeDown',{
+            oldindex: videoidx,
+            newindex: videoidx-1,
+            playerType: this.properties.playerType
+          });
+          this.animation.translateY(top_height).step();
+          this.setData({
+            scrollAnimate: this.animation.export(),
+            videoidx: videoidx,
+          });
+        }
+      }else{
+        let abschangeY = Math.abs(changeY);
+        if (abschangeY >= thresholdValue) {
+          if (videoidx+1 === this.data.videoSize) {
+            this.triggerEvent('swipeToEnd', { 
+              oldindex: videoidx + 1,
+              newindex:videoidx,
+              playerType: this.properties.playerType
+              });
+            return false;
+          }
+          let btm_height = -((videoidx + 1) * this.data.screenHeight);
+          this.triggerEvent('swipeUpper', {
+            oldindex: videoidx,
+            newindex: videoidx +1,
+            playerType: this.properties.playerType
+          });
+          this.animation.translateY(btm_height).step();
+          console.log('向上滑动,往下切换视频');
+          this.setData({
+            scrollAnimate:this.animation.export(),
+            videoidx: videoidx,
+          });
+        }
+      }
+    },
+  }
+})

+ 6 - 0
components/my-video/scroll-video.json

@@ -0,0 +1,6 @@
+{
+  "component": true,
+  "usingComponents": {
+    "video-button-bar": "../../components/video-button-bar"
+  }
+}

+ 36 - 0
components/my-video/scroll-video.wxml

@@ -0,0 +1,36 @@
+<!--components/scroll-video.wxml-->
+<view class='video-container'>
+  <view class='video-scroll-container' animation="{{scrollAnimate}}">
+    <view class='video-scroll-item'
+          bindtouchstart='onTouchStart'
+          bindtouchend='onTouchEnd'
+          wx:for-item="items"
+          wx:for-index="idx"
+          data-videoidx="{{idx}}"
+          wx:key="{{items.typeid}}"
+          wx:for="{{videoList}}"
+    >
+    <block wx:if="{{items.video_is_player}}">
+     <block wx:if="{{playerType==='video'}}">
+     <video-button-bar></video-button-bar>
+      <video class='video-player' 
+              controls='{{false}}'
+              autoplay='{{false}}'
+              poster='{{items.videoimg}}'
+              src="{{items.videourl}}"
+              show-fullscreen-btn="{{false}}"
+              show-play-btn="{{false}}" object-fit="{{fitType}}"></video>
+      </block>
+      <block wx:if="{{playerType==='live'}}">
+        <live-player class='video-player'
+        style="width:{{screenWidth}}px"
+        src="{{items.videourl}}"
+        object-fit="{{fitType}}"
+        autoplay   mode="RTC">
+         <video-button-bar bind:buttonhandle="buttonhandle"></video-button-bar>
+        </live-player>
+      </block>
+    </block>
+    </view>
+    </view>
+</view>

+ 35 - 0
components/my-video/scroll-video.wxss

@@ -0,0 +1,35 @@
+/* components/scroll-video.wxss */
+.video-container{
+  position: relative;
+  height: 100%;
+  width: 100%;
+  background-color: #000;
+  overflow: hidden;
+}
+.video-scroll-container{
+  position: absolute;
+  width: 100%;
+  left: 0;
+  top: 0;
+  height: 100%;
+  z-index: 366;
+}
+.video-scroll-item{
+  width: 100%;
+  height: 100%;
+  overflow: hidden;
+  z-index: 333;
+}
+.video-player{
+  display: inline-block;
+  width: 100%;
+  height: 100%;
+}
+.message-container{
+  width: 100%;
+  height: 100%;
+  position: absolute;
+  left: 0;
+  top: 0;
+  background-color: #000;
+}

+ 29 - 0
components/my-video/video-button-bar.js

@@ -0,0 +1,29 @@
+// components/video-button-bar.js
+Component({
+  options: {
+    multipleSlots: true // 在组件定义时的选项中启用多slot支持
+  },
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    toolBarButton: function (e) {
+      const { buttontype, buttonname, itemid } = e.currentTarget.dataset;
+      this.triggerEvent('buttonhandle', { buttontype, buttonname, itemid });
+    }
+  }
+})

+ 4 - 0
components/my-video/video-button-bar.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 16 - 0
components/my-video/video-button-bar.wxml

@@ -0,0 +1,16 @@
+<!--components/video-button-bar.wxml-->
+ <cover-view  class="icon-container">
+
+                  <cover-view class="cover-view-item" bindtap='toolBarButton' data-buttontype="1" data-buttonname="收藏" data-itemid="{{items.videoid}}">
+                    <cover-image class="video-icon" src='../images/fav.png'/>
+                  </cover-view>
+                
+                  <cover-view class="cover-view-item"  bindtap='toolBarButton' data-buttontype="2" data-buttonname="消息" data-itemid="{{items.videoid}}">
+                    <cover-image   class="video-icon" src='../images/msg.png'/>
+                  </cover-view>
+
+                  <cover-view class="cover-view-item"  bindtap='toolBarButton' data-buttontype="3" data-buttonname="分享" data-itemid="{{items.videoid}}">
+                    <cover-image   class="video-icon" src='../images/share.png'/>
+                  </cover-view>
+                  
+</cover-view>

+ 19 - 0
components/my-video/video-button-bar.wxss

@@ -0,0 +1,19 @@
+/* components/video-button-bar.wxss */
+.icon-container{
+  height: 100%;
+  position: absolute;
+  right:40rpx;
+  display:flex;
+  flex-direction:column;
+  justify-content:flex-end;
+  z-index:999;
+}
+.cover-view-item{
+  height: 64rpx;width: 64rpx;
+  margin-bottom:100rpx;
+}
+
+.video-icon{
+  width: 64rpx;height: 64rpx;
+  display:inline-block; 
+}

+ 48 - 0
components/region-picker/region-picker.js

@@ -0,0 +1,48 @@
+// components/region-picker/region-picker.js
+Component({
+  /**
+   * 组件的属性列表
+   */
+  options: {
+    addGlobalClass: true,
+  },
+  properties: {
+    label: {
+      type: String,
+      value: '',
+    },
+    formid: {
+      type: String,
+      value: '',
+    },
+    forminfo: {
+      type: Object,
+      value: {}
+    }
+  },
+  behaviors: ['wx://component-export'],
+  /**
+   * 组件的初始数据
+   */
+  data: {
+    input_text: '',
+  },
+  //组件最终对外导出的数据
+  export() {
+    return {
+      input_text: this.data.input_text,
+      force: this.properties.forminfo.force,
+      role: this.properties.forminfo.role }
+  },
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    bindPickerChange: function (e) {
+      console.log(e);
+      this.setData({   //给变量赋值
+        input_text: e.detail.value
+      })
+    }
+  }
+})

+ 4 - 0
components/region-picker/region-picker.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 24 - 0
components/region-picker/region-picker.wxml

@@ -0,0 +1,24 @@
+<!--components/region-picker/region-picker.wxml-->
+<view class='reports-form-box form-inner'>
+          <view class='reports-form-input input-all-width'>
+            <view class='form-inputname'>{{forminfo.label}}<text wx:if="{{forminfo.force}}" class="force_text">*</text></view>
+           
+
+            <picker mode="region"
+            class='form-inputtext'
+            bindchange="bindPickerChange" 
+            value="{{input_text}}"
+            custom-item="{{customItem}}">
+            <view class="picker">
+              {{input_text[0]}}-{{input_text[1]}}-{{input_text[2]}}
+            </view>
+          </picker>
+
+      
+
+
+
+
+          </view>
+</view>
+

+ 1 - 0
components/region-picker/region-picker.wxss

@@ -0,0 +1 @@
+/* components/region-picker/region-picker.wxss */

+ 53 - 0
components/text-input/text-input.js

@@ -0,0 +1,53 @@
+// components/my-form/my-input.js
+Component({
+  /**
+   * 组件的初始数据
+   */
+  options:{
+    addGlobalClass: true,
+  },
+  properties:{
+     label:{
+       type:String,
+       value:'',
+     },
+     formid:{
+       type: String,
+       value: '',
+     },
+    forminfo:{
+      type:Object,
+      value:{}
+    },
+    role:{
+       type:Object,
+       value:{}
+    }
+  },
+  data: {
+     input_text:'',
+  },
+  behaviors: ['wx://component-export'],
+  //组件最终对外导出的数据
+  export() {
+    return {
+      input_text: this.data.input_text,
+      force: this.properties.forminfo.force,
+      role: this.properties.forminfo.role
+      }
+  },
+  /**
+   * 组件的方法列表
+   */
+  ready:function(){
+    console.log(this.properties);
+  },
+  methods: {
+    enterValue:function(e){
+       console.log(e.detail.value);
+       this.setData({
+         input_text: e.detail.value
+       });
+    }
+  }
+})

+ 4 - 0
components/text-input/text-input.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 7 - 0
components/text-input/text-input.wxml

@@ -0,0 +1,7 @@
+<!--components/my-form/my-input.wxml-->
+<view class='reports-form-box form-inner'>
+          <view class='reports-form-input input-all-width'>
+            <view class='form-inputname'>{{forminfo.label}}<text wx:if="{{forminfo.force}}" class="force_text">*</text></view>
+            <input bindinput='enterValue' class='form-inputtext'></input>
+          </view>
+</view>

+ 1 - 0
components/text-input/text-input.wxss

@@ -0,0 +1 @@
+/* components/my-form/my-input.wxss */

+ 57 - 0
components/text-picker/text-picker.js

@@ -0,0 +1,57 @@
+// components/text-picker/text-picker.js
+Component({
+  /**
+   * 组件的属性列表
+   */
+  options: {
+    addGlobalClass: true,
+  },
+  properties: {
+    label: {
+      type: String,
+      value: '',
+    },
+    formid: {
+      type: String,
+      value: '',
+    },
+    forminfo: {
+      type: Object,
+      value: {}
+    }
+  },
+  behaviors: ['wx://component-export'],
+  /**
+   * 组件的初始数据
+   */
+  data: {
+    input_text:'',
+    hx_index:0,
+  },
+  //组件最终对外导出的数据
+  export() {
+    return {
+      input_text: this.data.input_text,
+      force: this.properties.forminfo.force,
+      role: this.properties.forminfo.role }
+  },
+  ready:function(){
+     let ops=this.properties.forminfo.data;
+     this.setData({
+        input_text:ops[0].name
+     });
+  },
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    bindPickerChange:function(e){
+      let lists=this.properties.forminfo.data;
+      console.log(lists[e.detail.value].name)
+      this.setData({   //给变量赋值
+        hx_index: e.detail.value,
+        input_text: lists[e.detail.value].name
+      })
+    }
+  }
+})

+ 4 - 0
components/text-picker/text-picker.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 17 - 0
components/text-picker/text-picker.wxml

@@ -0,0 +1,17 @@
+<!--components/text-picker/text-picker.wxml-->
+<view class='reports-form-box form-inner'>
+          <view class='reports-form-input input-all-width'>
+            <view class='form-inputname'>{{forminfo.label}}<text wx:if="{{forminfo.force}}" class="force_text">*</text></view>
+            <picker class='form-inputtext'
+             bindchange="bindPickerChange"
+             value="{{forminfo.data[hx_index].id}}" 
+             data-selecthx="{{forminfo.data[hx_index].name}}"
+             range-key="{{'name'}}"  
+             value="{{index}}" 
+             range="{{forminfo.data}}">
+              <view class="picker">
+                {{forminfo.data[hx_index].name}}
+              </view>
+            </picker>
+          </view>
+</view>

+ 1 - 0
components/text-picker/text-picker.wxss

@@ -0,0 +1 @@
+/* components/text-picker/text-picker.wxss */

+ 50 - 0
components/text-time/text-time.js

@@ -0,0 +1,50 @@
+// components/my-form/my-input.js
+Component({
+  /**
+   * 组件的初始数据
+   */
+  options: {
+    addGlobalClass: true,
+  },
+  properties: {
+    label: {
+      type: String,
+      value: '',
+    },
+    formid: {
+      type: String,
+      value: '',
+    },
+    forminfo: {
+      type: Object,
+      value: {}
+    }
+  },
+  data: {
+    input_text: '',
+  },
+  behaviors: ['wx://component-export'],
+  //组件最终对外导出的数据
+  export() {
+    return {
+      input_text: this.data.input_text,
+      force: this.properties.forminfo.force,
+      role: this.properties.forminfo.role }
+  },
+  /**
+   * 组件的方法列表
+   */
+  
+  ready: function () {
+   
+    console.log(this.properties.forminfo);
+  },
+  
+  methods: {
+    bindPickerChange: function (e) {
+      this.setData({
+        input_text: e.detail.value
+      });
+    }
+  }
+})

+ 4 - 0
components/text-time/text-time.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 24 - 0
components/text-time/text-time.wxml

@@ -0,0 +1,24 @@
+<!--components/text-time/text-time.wxml-->
+<view class='reports-form-box form-inner'>
+          <view class='reports-form-input input-all-width'>
+            <view class='form-inputname'>{{forminfo.label}}<text wx:if="{{forminfo.force}}" class="force_text">*</text></view>
+        
+            <picker class='form-inputtext picker-add'
+             bindchange="bindPickerChange"
+             mode="{{forminfo.timeType}}"
+             start="{{forminfo.startTime}}"
+             end="{{forminfo.endTime}}"
+             value="{{input_text}}">
+              <view class="picker">
+                  {{input_text}}
+              </view>
+            </picker>
+          
+
+             <!-- <picker mode="time" value="{{time}}" start="09:01" end="21:01" bindchange="bindTimeChange">
+    <view class="picker">
+      当前选择: {{time}}
+    </view>
+  </picker> -->
+          </view>
+</view>

+ 1 - 0
components/text-time/text-time.wxss

@@ -0,0 +1 @@
+/* components/text-time/text-time.wxss */

+ 327 - 18
pages/answerAfterclass/answerAfterclass.js

@@ -1,29 +1,338 @@
+const app = require('../../utils/util.js');
+const tools = require('../../utils/tools.js');
 Page({
   data: {
-    parameter: [{ id: 1, name: 'A. 同培育、同孵化、同年检、同评估' }, 
-    { id: 2, name: 'B. 同培育、同孵化、换届' },{ id: 3, name: 'C. 同培检、同评估、同换届' },
-    { id: 4, name: 'D. 同培育、同孵化、同年检、同换届' }, 
-  ],
-  },
-  submitAnswer(){
-    wx.navigateTo({
-      url: '/pages/grade/grade',
+    index: 0, // 题目序列
+    chooseValue: [], // 选择的答案序列
+    questionList: [
+      // {
+      //   id: 10,
+      //   "QuestStem": "以下属于传统协同办公应用开发的典型问题的是?",
+      //   'QuestChoice': [{
+      //       name: 'a',
+      //       value: 'aaaaaaa',
+      //       checked: false
+      //     },
+      //     {
+      //       name: 'aa',
+      //       value: 'sdsdsd',
+      //       checked: false
+      //     },
+      //     {
+      //       name: 'a3',
+      //       value: 'ewewewe',
+      //       checked: false
+      //     },
+      //   ],
+      //   "QuestType": 1,
+      //   "checked": false
+      // },
+      // {
+      //   id: 12,
+      //   "QuestStem": "企业微信建立开放办公应用生态的主要策略是000?",
+      //   "QuestChoice": ['A', 'B'],
+      //   "QuestType": 2,
+      //   "scores": 10,
+      //   "checked": false
+      // },
+
+      // {
+      //   id: 123,
+      //   "QuestStem": "企业微信建立开放办公应用生态的主要策略是?",
+      //   "QuestType": 3,
+      //   "scores": 10,
+      //   "checked": false
+      // },
+    ],
+    totalScore: 0,
+    id: '', //考试主键id(可取list接口中id)
+    paperId: '', //试卷id(可取list接口中paperId)
+    answersId: '', // 提交答案
+    sessionKey: '',
+  },
+  /*
+   * 单选事件
+   */
+  radioChange: function (e) {
+    console.log('checkbox发生change事件,携带value值为:', e.detail.value)
+    let json = {};
+    json.currentAnswer = e.detail.value;
+    json.id = e.currentTarget.dataset.idx;
+    json.questType = e.currentTarget.dataset.questtypes;
+    console.log("题目", this.data.questionList)
+    this.data.chooseValue[this.data.index] = json;
+    this.data.questionList[this.data.index].checked = e.detail.value;
+
+    this.setData({
+      questionList: this.data.questionList
     })
+
+    wx.setStorageSync('questionList'+wx.getStorageSync('answersId'), this.data.questionList);
+    wx.setStorageSync('titleINDEX'+wx.getStorageSync('answersId'), this.data.index);
+    wx.setStorageSync('chooseValue'+wx.getStorageSync('answersId'), this.data.chooseValue);
+
   },
-   // 参数点击响应事件
-  parameterTap:function(e){//e是获取e.currentTarget.dataset.id所以是必备的,跟前端的data-id获取的方式差不多
-    let this_checked = e.currentTarget.dataset.id
-    let parameterList = this.data.parameter//获取Json数组
-    for (let i = 0; i < parameterList.length;i++){
-      if (parameterList[i].id == this_checked){
-        parameterList[i].checked = true;//当前点击的位置为true即选中
+  /*
+   * 多选事件
+   */
+  checkboxChange: function (e) {
+    console.log('checkbox发生change事件,携带value值为:', e.detail.value)
+    let json = {};
+    let aa = e.detail.value.join("||")
+    json.currentAnswer = aa;
+    json.questType = e.currentTarget.dataset.questtypes;
+    json.id = e.currentTarget.dataset.idx;
+    this.data.chooseValue[this.data.index] = json;
+    const items = this.data.questionList[this.data.index].QuestChoice
+    const values = e.detail.value
+    for (let i = 0, lenI = items.length; i < lenI; ++i) {
+      items[i].checked = false
+      for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
+        if (items[i].value === values[j]) {
+          items[i].checked = true
+          break
+        }
       }
-      else{
-        parameterList[i].checked = false;//其他的位置为false
+    }
+    this.setData({
+      questionList: this.data.questionList
+    })
+    console.log(this.data.questionList,"7878787878");
+    
+    wx.setStorageSync('questionList'+wx.getStorageSync('answersId'), this.data.questionList);
+    wx.setStorageSync('titleINDEX'+wx.getStorageSync('answersId'), this.data.index);
+    wx.setStorageSync('chooseValue'+wx.getStorageSync('answersId'), this.data.chooseValue);
+
+  
+
+  },
+  /*
+   * 解答事件
+   */
+  bindTextAreaBlur(e) {
+    console.log(e.detail.value);
+    let json = {};
+    json.currentAnswer = e.detail.value;
+    json.id = e.currentTarget.dataset.idx;
+    json.questType = e.currentTarget.dataset.questtypes;
+    this.data.chooseValue[this.data.index] = json;
+    this.data.questionList[this.data.index].currentAnswer = e.detail.value;
+    this.setData({
+      questionList: this.data.questionList
+    })
+    wx.setStorageSync('questionList'+wx.getStorageSync('answersId'), this.data.questionList);
+    wx.setStorageSync('titleINDEX'+wx.getStorageSync('answersId'), this.data.index);
+    wx.setStorageSync('chooseValue'+wx.getStorageSync('answersId'), this.data.chooseValue);
+
+  },
+  /*
+   * 下一题/提交 按钮
+   */
+  nextSubmit: function () {
+    // 判断是不是最后一题
+    if (this.data.index < this.data.questionList.length - 1) {
+      // 渲染下一题
+      this.setData({
+        index: this.data.index + 1
+      })
+      wx.setStorageSync('titleINDEX'+wx.getStorageSync('answersId'), this.data.index);
+    } else {
+      console.log(this.data.chooseValue);
+      if (wx.getStorageSync('chooseValue'+this.data.answersId)) {
+        this.setData({
+          chooseValue: wx.getStorageSync('chooseValue'+this.data.answersId)
+        })
       }
+      this.submitAll(this.data.chooseValue);
+    }
+  },
+  upSubmit() {
+    this.setData({
+      index: this.data.index - 1
+    })
+    wx.setStorageSync('titleINDEX'+wx.getStorageSync('answersId'), this.data.index);
+    console.log(this.data.chooseValue, "88888888888888888888888888");
+    console.log(this.data.chooseValue[this.data.index]);
+
+    //this.data.chooseValue[this.data.index].currentAnswer
+
+  },
+  // onLoad: function (options) {
+  //   let a = [{
+  //       "QuestType": "3",
+  //       "QuestStem": "子类从父类那里继承什么方法和状态?",
+  //       "QuestAnswer": "",
+  //       "QuestChoice": "",
+  //       "Id": 39
+  //     },
+  //     {
+  //       "QuestType": "0",
+  //       "QuestStem": "MyObject 的什么方法会对if表达式的正确性产生影响\n     List l = new LinkedList();\n     l.add(new MyObject(\"A\"));\n    if(l.contains(new MyObject(\"A\"))){}",
+  //       "QuestAnswer": "equals ()",
+  //       "QuestChoice": "toString()||equals ()||hashCode()||clone()",
+  //       "Id": 36
+  //     },
+  //     {
+  //       "QuestType": "1",
+  //       "QuestStem": "MyObject 的什么方法会对if表达式的正确性产生影响(多选)   Map m = new HashMap;    m.add(new MyObject(\"A\"));    if(m.contains(new MyObject(\"A\"))){}",
+  //       "QuestAnswer": "equals ()||\nhashCode()||",
+  //       "QuestChoice": "toString()||\nequals ()||\nhashCode()||\nclone()||",
+  //       "Id": 38
+  //     },
+  //     {
+  //       "QuestType": "2",
+  //       "QuestStem": "1+1=2",
+  //       "QuestAnswer": "是",
+  //       "QuestChoice": "是||否",
+  //       "Id": 42
+  //     },
+
+  //   ];
+  //   let jsonArr = a.map(item => {
+  //     let json = {};
+  //     json.QuestType = item.QuestType;
+  //     json.id = item.Id;
+  //     json.QuestAnswer = item.QuestAnswer;
+  //     json.QuestStem = item.QuestStem;
+  //     if (item.QuestChoice) {
+  //       let arr = item.QuestChoice.split('||');
+  //       json.QuestChoice = arr;
+  //     }
+  //     return json;
+  //   })
+  //   this.setData({
+  //     questionList: jsonArr
+  //   })
+
+  // }
+  onShow: function () {
+    console.log("show0000000000000000000000000000000000000000000000000000000000000000000000");
+    console.log(wx.getStorageSync('answersId'),"onshow  的 answeid");
+    // console.log(wx.getStorageSync('questionList'+((wx.getStorageSync('answersId'))),"78978978979877777");
+    if (wx.getStorageSync('questionList'+wx.getStorageSync('answersId'))) {
+      console.log("缓村了锕");
+      const questionList = wx.getStorageSync('questionList'+wx.getStorageSync('answersId'));
+      this.setData({
+        questionList: questionList,
+        index: wx.getStorageSync('titleINDEX'+wx.getStorageSync('answersId')),
+        answersId: wx.getStorageSync('answersId'+wx.getStorageSync('answersId')),
+        chooseValue:wx.getStorageSync('chooseValue'+wx.getStorageSync('answersId')),
+      })
+      console.log(this.data.questionList,"show 缓存的数据");
+    }else{
+      this.allShi(this.data.id, this.data.paperId, this.data.sessionKey);
+      console.log(this.data.questionList,"show 没有缓存");
     }
+  },
+  async onLoad(options) {
+    //const sessionKey = await tools.checkSessionAndLogin();
+    console.log("onload..................................");
+    wx.setStorageSync('answersId', options.answersId);
+    console.log(options.answersId,"传值的缓冲answersId");
+    console.log(wx.getStorageSync('answersId'),"1111111111111111111");
+    
+    const sessionKey = 'yoa0rZTt2bAiTVDsiRjysw==';
     this.setData({
-      parameter: parameterList
+      sessionKey: sessionKey,
+      paperId:options.paperId,
+      answersId:options.answersId,
+      id:options.id,
+    })
+    console.log(wx.getStorageSync('answersId'),"onload中  的 answeid");
+    
+    //....................  
+    console.log(wx.getStorageSync('questionList'+wx.getStorageSync('answersId')),"111111111111111111111");
+    if (wx.getStorageSync('questionList'+wx.getStorageSync('answersId'))) {
+      this.setData({
+        questionList: wx.getStorageSync('questionList'+wx.getStorageSync('answersId')),
+        index: wx.getStorageSync('titleINDEX'+wx.getStorageSync('answersId')),
+        answersId: wx.getStorageSync('answersId'+wx.getStorageSync('answersId')),
+        chooseValue:wx.getStorageSync('chooseValue'+wx.getStorageSync('answersId')),
+      })
+      console.log("onload  有缓存");
+      console.log(this.data.questionList,"onload  有缓存的数据");
+    } else {
+      console.log("onload  没有缓存");
+      
+      this.allShi(options.id, options.paperId, sessionKey);
+    }
+    //....................
+  },
+ 
+  allShi(id, paperId, sessionKey) {
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/paper/detail',
+      method: "post",
+      data: {
+        sessionKey: sessionKey,
+        id: id,
+        paperId: paperId
+      },
+      success: (res) => {
+        let jsonArr = JSON.parse(res.data.paperContent).map(item => {
+          let json = {};
+          json.QuestType = item.QuestType;
+          json.id = item.Id;
+          json.QuestAnswer = item.QuestAnswer;
+          json.QuestStem = item.QuestStem;
+          if (item.QuestChoice) {
+            let arr = item.QuestChoice.split('||');
+            json.QuestChoice = arr;
+          }
+          if (item.QuestType == '1') {
+            let arr = item.QuestChoice.split('||');
+            let arrJson = arr.map(item => {
+              let json1 = {};
+              json1.name = item;
+              json1.value = item;
+              json1.checked = false;
+              return json1
+            });
+            json.QuestChoice = arrJson;
+          }
+          return json;
+        })
+        this.setData({
+          questionList: jsonArr
+        })
+        wx.setStorageSync('questionList'+wx.getStorageSync('answersId'), this.data.questionList);
+      }
+    })
+  },
+  submitAll(currentAnswerTemp) {
+    console.log();
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/paper/commit',
+      method: "post",
+      data: {
+        sessionKey: this.data.sessionKey,
+        currentAnswerTemp: currentAnswerTemp,
+        answersId: wx.getStorageSync('answersId')
+      },
+      success: (res) => {
+        console.log(res);
+        if(res.data.msg=='请勿重复提交'){
+          wx.showModal({
+            showCancel: false,
+            content: '当前老师批阅中,'+res.data.msg,
+            success(res) {}
+          })
+        }else{
+          if (res.data.code == 0) {
+            console.log(res, "为我么我们微妙"); // 提交答案是后
+            // this.setData({
+            //   answersId: res.data.answersId
+            // })
+            // this.allShi(id, paperId, sessionKey);
+            wx.navigateTo({
+              url: '/pages/testAnswer/testAnswer',
+            })
+          }
+        }
+  
+     
+      }
     })
   }
+
 })

+ 27 - 10
pages/answerAfterclass/answerAfterclass.wxml

@@ -1,11 +1,10 @@
 <view class='home'>
 	<view class="box">
-		<view> 共<view class="ti">10</view>/10题</view>
+		<view> 共<view class="ti">{{index+1}}</view>/{{questionList.length}}题</view>
 	</view>
 	<view class="question">
-		深入贯彻习近平总书记关于加大社会组织党建工作
-		力度的重要批示精神,坚决落实社会组织与社会组
-		织党组织“五个同步”,五个同步是以下哪一个?
+		{{questionList[index].QuestStem}}
+		{{questionList[index].QuestType == 0?'【单选】':questionList[index].QuestType == 1?'【多选】':questionList[index].QuestType == 2?'【判断】':'【解答】'}}
 	</view>
 </view>
 <view class="qiu-box">
@@ -38,9 +37,27 @@
 	<view class="qiu"></view>
 	<view class="qiu"></view>
 </view>
-<view class='parameter-wrap'>
-	<block wx:for="{{parameter}}" wx:key="parameter">
-		<text class='parameter-info text-over {{item.checked?"checked_parameter":""}}' data-id='{{item.id}}' bindtap='parameterTap'>{{item.name}}</text>
-	</block>
-</view>
-<van-button  round type="default" bindtap="submitAnswer">提交答案</van-button>
+<radio-group class="parameter-wrap" data-questTypes='{{questionList[index].QuestType}}' data-idx='{{questionList[index].id}}' bindchange="radioChange" wx:if="{{questionList[index].QuestType == 0}}">
+	<label class=" radio my-choosebox  {{ questionList[index].checked == item?'checkboxbox':''}}" wx:for-index="idx" wx:for="{{questionList[index].QuestChoice}}">
+		<radio value="{{item}}" />{{item}}
+	</label>
+</radio-group>
+<!-- questionList[index].item.checked  -->
+<checkbox-group class="parameter-wrap" data-questTypes='{{questionList[index].QuestType}}' data-idx='{{questionList[index].id}}' bindchange="checkboxChange" wx:if="{{questionList[index].QuestType == 1}}">
+	<label class="checkbox my-choosebox {{ item.checked?'checkboxbox':''}}" wx:for-index="idx" wx:key="{{item.value}}" wx:for="{{questionList[index].QuestChoice}}">
+		<checkbox value="{{item.value}}" checked="{{item.checked}}" />{{item.name}}
+	</label>
+</checkbox-group>
+<radio-group class="parameter-wrap " data-questTypes='{{questionList[index].QuestType}}' data-idx='{{questionList[index].id}}' bindchange="radioChange" wx:if="{{questionList[index].QuestType == 2}}">
+	<label class=" radio my-choosebox   {{ questionList[index].checked == item?'checkboxbox':''}}" wx:for-index="idx" wx:for="{{questionList[index].QuestChoice}}">
+		<radio value="{{item}}" checked="{{questionList[index].checked == item}}" />{{item}}
+	</label>
+</radio-group>
+<view wx:if="{{questionList[index].QuestType == 3}}" data-idx='{{questionList[index].id}}'>
+	<textarea data-questTypes='{{questionList[index].QuestType}}' data-idx='{{questionList[index].id}}' bindinput='bindTextAreaBlur' value="{{questionList[index].currentAnswer}}" placeholder="请输入答案" />
+	</view>
+
+
+<van-button bindtap='nextSubmit' wx:if="{{index == questionList.length-1}}" round type="default">提交答案</van-button>
+<van-button wx:else round type="default" bindtap='nextSubmit'>下一题</van-button>
+<van-button wx:if='{{index !=0}}' round type="default" bindtap='upSubmit'>上一题</van-button>

+ 27 - 0
pages/answerAfterclass/answerAfterclass.wxss

@@ -65,4 +65,31 @@ button:not([size='mini']) {
   margin-left: 10% !important;
   margin-top: 5% !important ;
   }
+  /* .my-choosebox radio{
+    display: none
+  } */
+  .my-choosebox {
+    color: rgba(51, 51, 51, 1);
+    border: 1px solid rgba(235,63,51,1);
+    border-radius: 40rpx;
+    padding: 20rpx 50rpx;
+    margin: 15rpx 50rpx;
+  }
+  .checkboxbox{
+    background:#EB3F33;
+    color: white;
+  }
+  .parameter-wrap radio {
+    display: none;
+  }
+  .parameter-wrap checkbox {
+    display: none;
+  }
+
+  textarea {
+    border: 1px solid rgba(217, 217, 217, 1);
+    margin: 0 auto;
+    height: 200rpx;
+    margin-top: 50rpx;
+  }
   

+ 61 - 20
pages/grade/grade.js

@@ -1,6 +1,7 @@
 //index.js
 //获取应用实例
 const app = require('../../utils/util.js');
+const tools = require('../../utils/tools.js');
 Page({
   data: {
     // 课程轮播
@@ -20,29 +21,69 @@ Page({
       "zbf": "xx委员会",
       "starttime": "2020年6月"
     }],
-    gridArr: [{
-      "num": "1",
-      "qusetion": "深入贯彻习近平总书记关于加大社会组织党建工作 力度的重要批示精神,坚决落实社会组织与社会组 织党组织“五个同步”,五个同步是以下哪一个?",
-      'daanTrue': 'B. 同培育、同孵化',
-      'daanFalse': 'A. 同培育、同孵化、同年检、同评估',
-    }, 
-    {
-      "num": "2",
-      "qusetion": "深入贯彻习近平总书记关于加大社会组织党建工作 力度的重要批示精神,坚决落实社会组织与社会组 织党组织“五个同步”,五个同步是以下哪一个?",
-      'daanTrue': 'B. 同培育、同孵化、同年检',
-      'daanFalse': 'A. 同培育、同孵化、同年检、同评估',
-    }, 
-    {
-      "num": "3",
-      "qusetion": "深入贯彻习近平总书记关于加大社会组织党建工作 力度的重要批示精神,坚决落实社会组织与社会组 织党组织“五个同步”,五个同步是以下哪一个?",
-      'daanTrue': 'B. 同培育、同孵化、同年检',
-      'daanFalse': 'A. 同培育、同孵化、同年检、同评估',
-    }, 
-  ],
+    gridArr: [
+      // {
+      //   "num": "1",
+      //   "qusetion": "深入贯彻习近平总书记关于加大社会组织党建工作 力度的重要批示精神,坚决落实社会组织与社会组 织党组织“五个同步”,五个同步是以下哪一个?",
+      //   'daanTrue': 'B. 同培育、同孵化',
+      //   'daanFalse': 'A. 同培育、同孵化、同年检、同评估',
+      // },
+      // {
+      //   "num": "2",
+      //   "qusetion": "深入贯彻习近平总书记关于加大社会组织党建工作 力度的重要批示精神,坚决落实社会组织与社会组 织党组织“五个同步”,五个同步是以下哪一个?",
+      //   'daanTrue': 'B. 同培育、同孵化、同年检',
+      //   'daanFalse': 'A. 同培育、同孵化、同年检、同评估',
+      // },
+      // {
+      //   "num": "3",
+      //   "qusetion": "深入贯彻习近平总书记关于加大社会组织党建工作 力度的重要批示精神,坚决落实社会组织与社会组 织党组织“五个同步”,五个同步是以下哪一个?",
+      //   'daanTrue': 'B. 同培育、同孵化、同年检',
+      //   'daanFalse': 'A. 同培育、同孵化、同年检、同评估',
+      // },
+    ],
 
   },
+  chengji(sessionKey, answersId) {
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/answer/detail',
+      method: "post",
+      data: {
+        sessionKey: sessionKey,
+        answersId: answersId
+      },
+      success: (res) => {
+        if (res.data.code == 0) {
+          console.log(res, "suoyoude");
+          this.setData({
+            gridArr:res.data.list
+          })
+          console.log(this.data.gridArr);
+          
+          // res.data.list.forEach(item=>{
+          //   if(item.answerScore){
+          //      this.setData({
+          //       gridArr:res.data.list
+          //      }) 
+          //   }else{
+          //     wx.showModal({
+          //       showCancel: false,
+          //       content: '当前老师批阅中,请耐心等待',
+          //       success(res) {}
+          //     })
+          //   }
+          // })
+        }
+      }
+    })
+  },
   onReady: function () {},
-  onLoad: function () {
+  async onLoad(options) {
+    console.log(options.answersId);
+    console.log("onload..................................");
+    let answersId = options.answersId;
+    const sessionKey = 'yoa0rZTt2bAiTVDsiRjysw==';
+    //const sessionKey = await tools.checkSessionAndLogin();  
+    this.chengji(sessionKey, answersId);
 
   },
 

+ 22 - 19
pages/grade/grade.wxml

@@ -1,27 +1,30 @@
 <view class="home">
-		<view class="yuan">
-			<view class="nei">
-				<view class="fen">89</view>
+	<view class="yuan">
+		<view class="nei">
+			<view class="fen">{{gridArr[0].answerScore}}</view>
 			<view class="title">分</view>
-			</view>
 		</view>
-		<view class="box">
-			<view class="redk"></view>我的错题
-			<view class="cuoti-box" wx:for="{{gridArr}}">
-				<view class="number">
-					{{item.num}}
+	</view>
+	<view class="box">
+		<view class="redk"></view>我的答题
+		<view class="cuoti-box" wx:for="{{gridArr}}">
+			<view class="number">
+				{{index+1}}
+			</view>
+			<view class="wenti">
+				<view style=" margin-right: 20rpx;">
+					{{item.questStem}}
+				</view>
+				<view class="daan">
+					正确答案: <view class="zhengquedaan">{{item.correctAnswer}}</view>
+				</view>
+				<view class="daan">
+					我的答案: <view class="wodedaan">{{item.currentAnswer}}</view>
 				</view>
-				<view class="wenti">
-					<view style=" margin-right: 20rpx;">
-					{{item.qusetion}}
-					</view>
-					<view class="daan">
-						正确答案: <view class="zhengquedaan">{{item.daanTrue}}</view>
-					</view>
-					<view class="daan">
-						我的答案: <view class="wodedaan">{{item.daanFalse}}</view>
-					</view>
+				<view class="daan">
+					分数: <view class="wodedaan">{{item.score}}</view>
 				</view>
 			</view>
 		</view>
+	</view>
 </view>

+ 65 - 9
pages/myClass/myClass.js

@@ -5,7 +5,7 @@ Page({
     showMore: false, //更多
     showzs: false,
     show: false,
-    SessionKey: "",
+    sessionKey: "",
     notice: "暂无未读通知",
     classInfo: {},
     kcArr: [],
@@ -121,14 +121,66 @@ Page({
       success(res) {}
     })
   },
+  // 学员登记表的
   goWrite() {
     // wx.showModal({
     //   showCancel: false,
     //   content: "敬请期待",
     //   success(res) {}
     // })
+    this.getBanner();
+    // wx.navigateTo({
+    //   url: '../studentRegistration/studentRegistration'
+    // })
+  },
+  // 学员登记表 、、、、、、
+  getBanner() {
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/exam/list',
+      method: "post",
+      data: {
+        sessionKey: this.data.sessionKey,
+        questSub: '0'
+      },
+      success: (res) => {
+        if (res.data.code == 0) {
+          console.log(res.data);
+          //let answersId =  res.data.list[0].answersId ;
+          console.log(res.data.list.length);
+          if (res.data.list[0]) {
+            if (res.data.list[0].answersId) {
+              this.toPath(res.data.list[0].id, res.data.list[0].paperId, res.data.list[0].answersId);
+            } else {
+              console.log('777777');
+              this.beginKao(res.data.list[0].id, res.data.list[0].paperId, this.data.sessionKey);
+            }
+          }
+        }
+      }
+    })
+  },
+  toPath(id, paperId, answersId) {
     wx.navigateTo({
-      url: '../studentRegistration/studentRegistration'
+      url: '/pages/studentRegistration/studentRegistration?id=' + id + '&paperId=' + paperId + '&answersId=' + answersId,
+    })
+  },
+  beginKao(id, paperId, sessionKey) {
+    console.log(paperId, "8888888");
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/exam/begin',
+      method: "post",
+      data: {
+        sessionKey: sessionKey,
+        id: id,
+        paperId: paperId
+      },
+      success: (res) => {
+        console.log(res);
+        if (res.data.code == 0) {
+          console.log(res, "为我么我们微妙"); // 提交答案是后
+          this.toPath(id, paperId, res.data.answersId);
+        }
+      }
     })
   },
   goWrite2() {
@@ -176,7 +228,7 @@ Page({
       data: {
         sessionKey: sessionKey
       },
-      success:  (res) =>{
+      success: (res) => {
         console.log(res.data.code, "我是返回是否有班级")
         if (res.data.code == 0) {
           this.setData({
@@ -209,7 +261,7 @@ Page({
       data: {
         sessionKey: sessionKey
       },
-      success:  (res) =>{
+      success: (res) => {
         console.log(res, "查询学员信息")
         if (res.data.code == 0 && res.data.data) {
           if (res.data.data.isAgree == 0) {
@@ -239,7 +291,7 @@ Page({
         isSee: 1,
         isNotice: 0
       },
-      success:  (res) =>{
+      success: (res) => {
         console.log(res, "333333333")
         if (res.data.code == 0) {
           if (res.data.list && res.data.list.length !== 0)
@@ -266,7 +318,7 @@ Page({
       data: {
         sessionKey: sessionKey
       },
-      success:  (res)=> {
+      success: (res) => {
         console.log(res, "kckckc")
         this.setData({
           kcArr: res.data.list
@@ -314,9 +366,13 @@ Page({
     const hoursValue = hours % 60; //小时
     return `${hoursValue}时${minutesValue}分${secondValue}秒`;
   },
-  async onShow(){
-    const sessionKey = await tools.checkSessionAndLogin();
-    this.isClass(sessionKey);
+  async onShow() {
+    //const sessionKey = await tools.checkSessionAndLogin();
+    const sessionKey = 'BqQROCKCxn7R2NXdQLud9Q==';
+    this.setData({
+      sessionKey: sessionKey
+    })
+    //this.isClass(sessionKey);
     this.getMycourse(sessionKey);
     this.getMynotice(sessionKey);
   }

+ 560 - 137
pages/studentRegistration/studentRegistration.js

@@ -1,6 +1,7 @@
 //index.js
 //获取应用实例
-// const app = require('../../utils/util.js');
+const app = require('../../utils/util.js');
+const tools = require('../../utils/tools.js');
 Page({
   data: {
     nameIsTrue: false, //名字是否填写
@@ -8,31 +9,24 @@ Page({
     graduationIsTrue: false, //毕业学校
     majorIsTrue: false, //所有专业
     postIsTrue: false, //现任职务
-    renzhishijianIsTrue :false,
+    renzhishijianIsTrue: false,
     phoneIsTrue: false, //电话
-    peixunshijianTrue :false,  // 培训时间
+    peixunshijianTrue: false, // 培训时间
     nameMessage: '',
-    zaizhiTime:'',//在线时间
-    peixunTime:'',  //培训时间
-    headmasterText: '请选择任职时间', // 
-    peixunText:'请选择培训时间',
+    zaizhiTime: [], //在线时间
+    peixunTime: '', //培训时间
+    headmasterText: [], // 
+    names: [],
+    timeIndex: '',
+    chooseValue: [], // 选择的答案序列
     radio: '1',
-    parameter: [{
-      id: 1,
-      name: '男',
-      checked: false
-    }, {
-      id: 2,
-      name: '女',
-      checked: false
-    }],
     renzhiDate: '',
-    postshow: false,
+    postshow: [],
     postshow1: false,
     errorIsTrue: false,
     currentDate: new Date().getTime(),
     currentDate1: new Date().getTime(),
-    minDate: new Date().getTime ,
+    minDate: new Date().getTime,
     formatter(type, value) {
       if (type === 'year') {
         return `${value}年`;
@@ -41,22 +35,260 @@ Page({
       }
       return value;
     },
+    questionList: [{
+        "QuestType": "6",
+        "Id": 11,
+        name: 'ccccc',
+        QuestStem: '时间选择',
+        QuestAnswer: ''
+      },
+      {
+        "QuestType": "5",
+        "Id": 11,
+        name: 'dddd',
+        QuestStem: '姓名输入',
+        QuestAnswer: ''
+      },
+      {
+        "QuestType": "6",
+        "Id": 11,
+        name: 'username111',
+        QuestStem: '时间2',
+        QuestAnswer: ''
+      },
+      {
+        "QuestType": "5",
+        "Id": 11,
+        name: 'address',
+        QuestStem: '姓名输入',
+        QuestAnswer: ''
+      },
+      {
+        "QuestType": "0",
+        "QuestChoice": [{
+            value: 'USA',
+            name: '美国'
+          },
+          {
+            value: 'CHN',
+            name: '中国',
+            checked: 'true'
+          },
+          {
+            value: 'BRA',
+            name: '巴西'
+          },
+          {
+            value: 'JPN',
+            name: '日本'
+          },
+          {
+            value: 'ENG',
+            name: '英国'
+          },
+          {
+            value: 'FRA',
+            name: '法国'
+          },
+        ],
+        "Id": 36,
+        name: 'sex',
+        QuestStem: '性别单选'
+      },
+      {
+        "QuestType": "0",
+        "QuestChoice": [{
+            value: '男',
+            name: '男',
+            checked: false,
+          },
+          {
+            value: '女',
+            name: '女',
+            checked: false,
+          },
+        ],
+        "Id": 36,
+        name: 'sex111',
+        QuestStem: '性别单选2222'
+      },
+      {
+        "QuestType": "1",
+        "QuestAnswer": "equals ()||\nhashCode()||",
+        "QuestChoice": [{
+            value: 'USA',
+            name: '美国'
+          },
+          {
+            value: 'CHN',
+            name: '中国',
+            checked: false
+          },
+          {
+            value: 'FRA',
+            name: '法国'
+          }
+        ],
+        "Id": 38,
+        name: 'alls',
+        QuestStem: '多选'
+      },
+
+      {
+        "QuestType": "2",
+        "QuestStem": "1+1=2",
+        "QuestAnswer": "是",
+        "QuestChoice": [{
+            value: 'USA',
+            name: '是'
+          },
+          {
+            value: 'CHN',
+            name: '中国',
+            checked: false
+          },
+        ],
+        "Id": 42,
+        name: 'lllll',
+        QuestStem: '判断1'
+      },
+      {
+        "QuestType": "2",
+        "QuestStem": "1+1=2",
+        "QuestAnswer": "是",
+        "QuestChoice": [{
+            value: 'USA',
+            name: '是'
+          },
+          {
+            value: 'CHN',
+            name: '中国',
+            checked: false
+          },
+        ],
+        "Id": 42,
+        name: 'lllll',
+        QuestStem: '判断2'
+      },
+      {
+        "QuestType": "2",
+        "QuestStem": "1+1=2",
+        "QuestAnswer": "是",
+        "QuestChoice": [{
+            value: 'USA',
+            name: '是'
+          },
+          {
+            value: 'CHN',
+            name: '中国',
+            checked: false
+          },
+        ],
+        "Id": 42,
+        name: 'lllll',
+        QuestStem: '判断3'
+      },
+      {
+        "QuestType": "3",
+        "QuestStem": "世纪大厦的萨科技的哈市(解答)",
+        "QuestAnswer": "",
+        "QuestChoice": "",
+        "Id": 39,
+        name: 'textarea',
+      },
+
+    ],
+    answersId: '', // 提交答案用到
+    sessionKey: '',
+    paperId: '',
+    answersId: '',
+    id: '',
   },
   onChange(event) {
     this.setData({
       radio: event.detail,
     });
   },
+  radioChange(e) {
+    console.log(e);
+    const items = this.data.questionList[e.currentTarget.dataset.index].QuestChoice
+    for (let i = 0, len = items.length; i < len; ++i) {
+      items[i].checked = items[i].value === e.detail.value
+    }
+
+    let json = {};
+    json.currentAnswer = e.detail.value;
+    json.id = e.currentTarget.dataset.idx;
+    json.questType = e.currentTarget.dataset.questtypes;
+    this.data.chooseValue[e.currentTarget.dataset.index] = json;
+    this.setData({
+      questionList: this.data.questionList
+    })
+    wx.setStorageSync('questionList' + wx.getStorageSync('answersId'), this.data.questionList);
+    wx.setStorageSync('chooseValue' + wx.getStorageSync('answersId'), this.data.chooseValue);
+    console.log(this.data.questionList);
+
+    // this.data.questionList[this.data.index].checked = e.detail.value;
+
+    // this.setData({
+    //   questionList: this.data.questionList
+    // })
+    // const items = this.data.items
+    // for (let i = 0, len = items.length; i < len; ++i) {
+    //   items[i].checked = items[i].value === e.detail.value
+    // }
 
+    // this.setData({
+    //   items
+    // })
+  },
+  checkboxChange(e) {
+    const items = this.data.questionList[e.currentTarget.dataset.index].QuestChoice
+    const values = e.detail.value
+    for (let i = 0, lenI = items.length; i < lenI; ++i) {
+      items[i].checked = false
+      for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
+        if (items[i].value === values[j]) {
+          items[i].checked = true
+          break
+        }
+      }
+    }
+    let json = {};
+    let aa = e.detail.value.join("||")
+    json.currentAnswer = aa;
+    json.id = e.currentTarget.dataset.idx;
+    json.questType = e.currentTarget.dataset.questtypes;
+    this.data.chooseValue[e.currentTarget.dataset.index] = json;
+    this.setData({
+      questionList: this.data.questionList
+    })
+    wx.setStorageSync('questionList' + wx.getStorageSync('answersId'), this.data.questionList);
+    wx.setStorageSync('chooseValue' + wx.getStorageSync('answersId'), this.data.chooseValue);
+  },
+  bindTextAreaBlur(e) {
+    console.log(e, "hhhhh");
+    console.log(e.detail.value);
+    let json = {};
+    json.currentAnswer = e.detail.value;
+    json.id = e.currentTarget.dataset.idx;
+    json.questType = e.currentTarget.dataset.questtypes;
+    this.data.chooseValue[e.currentTarget.dataset.index] = json;
+    this.data.questionList[e.currentTarget.dataset.index].QuestAnswer = e.detail.value;
+    this.setData({
+      questionList: this.data.questionList
+    })
+    wx.setStorageSync('questionList' + wx.getStorageSync('answersId'), this.data.questionList);
+    wx.setStorageSync('chooseValue' + wx.getStorageSync('answersId'), this.data.chooseValue);
+  },
   share() {
     this.setData({
       show: true
     });
   },
   onClose() {
-    console.log("11111111111111");
     this.setData({
-      postshow: false
+      ['postshow[' + this.data.timeIndex + ']']: false,
     });
   },
   onClose1() {
@@ -66,7 +298,9 @@ Page({
     });
   },
   onInput(event) {
-    console.log("000");
+    console.log(event, "8888888");
+
+    console.log("点击了");
     this.setData({
       currentDate: event.detail,
     });
@@ -83,10 +317,22 @@ Page({
     return `${date.getFullYear()-1}/${date.getMonth() + 1}/${date.getDate()}`;
   },
 
-  share1() {
+  share1(e) {
+    console.log(e);
+    console.log(e.currentTarget.dataset.index);
+    console.log(e.currentTarget.dataset.names, "8520852085208520");
+    console.log(this.data.postshow[e.currentTarget.dataset.index]);
+    this.data.postshow[e.currentTarget.dataset.index] = true;
+    this.data.names[e.currentTarget.dataset.index] = e.currentTarget.dataset.names;
     this.setData({
-      postshow: true
-    });
+      postshow: this.data.postshow,
+      timeIndex: e.currentTarget.dataset.index
+    })
+    console.log(this.data.postshow, "打印下锕啊啊啊啊锕锕锕");
+
+    // this.setData({
+    //   postshow: true
+    // });
   },
   share() {
     this.setData({
@@ -98,21 +344,34 @@ Page({
     return `${date.getFullYear()-1}/${date.getMonth() + 1}/${date.getDate()}`;
   },
   onConfirm(event) {
-    console.log(event, "0000");
+    console.log(event, "1111111");
     let timeValue = this.timeFormat(new Date(event.detail), "yyyy-MM-dd");
+    let json = {};
+    json.currentAnswer = timeValue;
+    json.id = event.currentTarget.dataset.idx;
+    json.questType = event.currentTarget.dataset.questtypes;
+    let aa = this.data.chooseValue[event.currentTarget.dataset.index] = json;
+    this.data.questionList[event.currentTarget.dataset.index].QuestAnswer = timeValue;
     this.setData({
-      zaizhiTime: timeValue,
-      postshow :false,
-      headmasterText :''
+      questionList: this.data.questionList,
+      ['chooseValue[' + event.currentTarget.dataset.index + ']']: aa,
+      ['postshow[' + this.data.timeIndex + ']']: false,
+      ['headmasterText[' + this.data.timeIndex + ']']: '',
     });
+    wx.setStorageSync('questionList' + wx.getStorageSync('answersId'), this.data.questionList);
+    wx.setStorageSync('chooseValue' + wx.getStorageSync('answersId'), this.data.chooseValue);
+    console.log(this.data.chooseValue, "确定后的值锕");
+    console.log( this.data.questionList,"789789798789");
+    
+
   },
   onConfirm1(event) {
     console.log(event, "0000");
     let timeValue = this.timeFormat(new Date(event.detail), "yyyy-MM-dd");
     this.setData({
       peixunTime: timeValue,
-      postshow1 :false,
-      peixunText :''
+      postshow1: false,
+      peixunText: ''
     });
   },
   parameterTap: function (e) { //e是获取e.currentTarget.dataset.id所以是必备的,跟前端的data-id获取的方式差不多
@@ -130,124 +389,190 @@ Page({
       parameter: parameterList
     })
   },
+  submitForm() {
+    // let arr1 = this.data.chooseValue.filter(d => d);
+    //console.log(arr1,"打印下提交");
+    console.log(this.data.chooseValue, "打印下提交");
+    this.data.chooseValue.forEach(item => {
+      console.log(item,"123123");
+      
+      if (item.currentAnswer) {
+
+      } else {
+        console.log(item.QuestStem);
+        
+        wx.showModal({
+          showCancel: false,
+          content: item.QuestStem + "不能为空",
+          success(res) {}
+        })
+      }
+    })
 
+    // wx.request({
+    //   url: app.globalData.publicUrl + '/wx/paper/commit',
+    //   method: "post",
+    //   data: {
+    //     sessionKey: this.data.sessionKey,
+    //     currentAnswerTemp: arr1,
+    //     answersId: wx.getStorageSync('answersId')
+    //   },
+    //   success: (res) => {
+    //     console.log(res);
+    //   }
+    // })
+  },
   formSubmit(e) {
     console.log(e.detail.value, "000000000000000");
-    if (!e.detail.value.username) {
-      this.setData({
-        nameIsTrue: true
-      })
-    } else {
-      this.setData({
-        nameIsTrue: false
-      })
+    let arr1 = this.data.zaizhiTime.filter(d => d);
+    let arr = this.data.names.filter(d => d);
+    var activeSubjectsArr = [];
+    for (var i = 0; i < arr.length; i++) {
+      var activeSubjectsObject = {};
+      for (var j = 0; j < arr1.length; j++) {
+        if (i == j) {
+          activeSubjectsObject[arr[i]] = arr1[j];
+          activeSubjectsArr.push(activeSubjectsObject);
+        }
+      }
     }
-    let sex = '';
-    if (this.data.parameter[0].checked) {
-      sex = this.data.parameter[0].name
-      this.setData({
-        errorIsTrue: false
-      })
-    } else if (this.data.parameter[1].checked) {
-      sex = this.data.parameter[1].name
-      this.setData({
-        errorIsTrue: false
-      })
-    } else {
-      this.setData({
-        errorIsTrue: true
-      })
+    console.log(activeSubjectsArr, "7777777");
+    let count = 0;
+    let data = {};
+    for (let a in e.detail.value) {
+      count += 1;
+      if (count = 1) {
+        data[a] = e.detail.value[a]
+      }
     }
+    activeSubjectsArr.forEach(item => {
+      Object.assign(data, item)
+    })
+    console.log(data, "888888888888888888888888");
+    // Object.keys(data).forEach(function (key) {
+    //   if (!data[key]) {
+    //     wx.showModal({
+    //       showCancel: false,
+    //       content: key + "不能为空"
+    //     })
+    //     return;
+    //   }
 
-    if (!e.detail.value.work) {
-      this.setData({
-        workIsTrue: true
-      })
-    } else {
-      this.setData({
-        workIsTrue: false
-      })
-    }
+    // });
+    // if (!e.detail.value.username) {
+    //   this.setData({
+    //     nameIsTrue: true
+    //   })
+    // } else {
+    //   this.setData({
+    //     nameIsTrue: false
+    //   })
+    // }
+    // let sex = '';
+    // if (this.data.parameter[0].checked) {
+    //   sex = this.data.parameter[0].name
+    //   this.setData({
+    //     errorIsTrue: false
+    //   })
+    // } else if (this.data.parameter[1].checked) {
+    //   sex = this.data.parameter[1].name
+    //   this.setData({
+    //     errorIsTrue: false
+    //   })
+    // } else {
+    //   this.setData({
+    //     errorIsTrue: true
+    //   })
+    // }
 
-    if (!e.detail.value.culture) {
-      this.setData({
-        cultureIsTrue: true
-      })
-    } else {
-      this.setData({
-        cultureIsTrue: false
-      })
-    }
+    // if (!e.detail.value.work) {
+    //   this.setData({
+    //     workIsTrue: true
+    //   })
+    // } else {
+    //   this.setData({
+    //     workIsTrue: false
+    //   })
+    // }
 
-    if (!e.detail.value.graduation) {
-      this.setData({
-        graduationIsTrue: true
-      })
-    } else {
-      this.setData({
-        graduationIsTrue: false
-      })
-    }
+    // if (!e.detail.value.culture) {
+    //   this.setData({
+    //     cultureIsTrue: true
+    //   })
+    // } else {
+    //   this.setData({
+    //     cultureIsTrue: false
+    //   })
+    // }
 
-    if (!e.detail.value.major) {
-      this.setData({
-        majorIsTrue: true
-      })
-    } else {
-      this.setData({
-        majorIsTrue: false
-      })
-    }
+    // if (!e.detail.value.graduation) {
+    //   this.setData({
+    //     graduationIsTrue: true
+    //   })
+    // } else {
+    //   this.setData({
+    //     graduationIsTrue: false
+    //   })
+    // }
 
-    if (!e.detail.value.post) {
-      this.setData({
-        postIsTrue: true
-      })
-    } else {
-      this.setData({
-        postIsTrue: false
-      })
-    }
-    if (!e.detail.value.phone) {
-      this.setData({
-        phoneIsTrue: true
-      })
-    } else {
-      this.setData({
-        phoneIsTrue: false
-      })
-    }
-    if (!this.data.zaizhiTime) {
-      this.setData({
-        renzhishijianIsTrue: true
-      })
-    } else {
-      this.setData({
-        renzhishijianIsTrue: false
-      })
-    }
-    if (!this.data.peixunTime) {
-      this.setData({
-        peixunshijianTrue: true
-      })
-    } else {
-      this.setData({
-        peixunshijianTrue: false
-      })
-    }
-    
-    console.log(this.data.zaizhiTime,"在职时间000");
-    console.log(this.data.peixunTime,"培训时间000");
-    console.log(sex,"性别的");
-    e.detail.value.zaizhiTime = this.data.zaizhiTime;
-    e.detail.value.peixunTime = this.data.peixunTime;
-    e.detail.value.sex = sex;
-    console.log(e.detail.value,"我是合并后的锕");
-    
+    // if (!e.detail.value.major) {
+    //   this.setData({
+    //     majorIsTrue: true
+    //   })
+    // } else {
+    //   this.setData({
+    //     majorIsTrue: false
+    //   })
+    // }
 
-    
-  },
+    // if (!e.detail.value.post) {
+    //   this.setData({
+    //     postIsTrue: true
+    //   })
+    // } else {
+    //   this.setData({
+    //     postIsTrue: false
+    //   })
+    // }
+    // if (!e.detail.value.phone) {
+    //   this.setData({
+    //     phoneIsTrue: true
+    //   })
+    // } else {
+    //   this.setData({
+    //     phoneIsTrue: false
+    //   })
+    // }
+    // if (!this.data.zaizhiTime) {
+    //   this.setData({
+    //     renzhishijianIsTrue: true
+    //   })
+    // } else {
+    //   this.setData({
+    //     renzhishijianIsTrue: false
+    //   })
+    // }
+    // if (!this.data.peixunTime) {
+    //   this.setData({
+    //     peixunshijianTrue: true
+    //   })
+    // } else {
+    //   this.setData({
+    //     peixunshijianTrue: false
+    //   })
+    // }
 
+    // console.log(this.data.zaizhiTime, "在职时间000");
+    // console.log(this.data.peixunTime, "培训时间000");
+    // console.log(sex, "性别的");
+    // e.detail.value.zaizhiTime = this.data.zaizhiTime;
+    // e.detail.value.peixunTime = this.data.peixunTime;
+    // e.detail.value.sex = sex;
+    // console.log(e.detail.value, "我是合并后的锕");
+
+
+
+  },
   timeFormat(date, fmt) {
     let o = {
       "M+": date.getMonth() + 1, //月份   
@@ -267,8 +592,106 @@ Page({
 
   },
   onReady: function () {},
-  onLoad: function () {
+  onLoad: function (options) {
+    //const sessionKey = await tools.checkSessionAndLogin();
+    const sessionKey = 'yoa0rZTt2bAiTVDsiRjysw==';
+    console.log("onloading.....................");
 
+
+    let chooceArr = this.data.questionList.map(item => {
+      let json = {};
+      json.currentAnswer = '';
+      json.questType = '';
+      json.id = item.Id;
+      json.QuestStem = item.QuestStem;
+      return json
+    })
+    console.log(chooceArr);
+    this.setData({
+      chooseValue: chooceArr
+    })
+
+
+    wx.setStorageSync('answersId', options.paperId);
+    this.setData({
+      sessionKey: sessionKey,
+      paperId: options.paperId,
+      answersId: options.answersId,
+      id: options.id,
+    })
+    if (wx.getStorageSync('questionList' + wx.getStorageSync('answersId'))) {
+      console.log("缓村了锕");
+      const questionList = wx.getStorageSync('questionList' + wx.getStorageSync('answersId'));
+      this.setData({
+        questionList: questionList,
+        answersId: wx.getStorageSync('answersId' + wx.getStorageSync('answersId')),
+        chooseValue: wx.getStorageSync('chooseValue' + wx.getStorageSync('answersId')),
+      })
+      console.log(this.data.questionList, "show 缓存的数据");
+    } else {
+      console.log("无缓存");
+      this.allShi(this.data.id, this.data.paperId, this.data.sessionKey);
+    }
   },
+  allShi(id, paperId, sessionKey) {
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/paper/detail',
+      method: "post",
+      data: {
+        sessionKey: sessionKey,
+        id: id,
+        paperId: paperId
+      },
+      success: (res) => {
+        let jsonArr = JSON.parse(res.data.paperContent).map(item => {
+          let json = {};
+          json.QuestType = item.QuestType;
+          json.Id = item.Id;
+          json.QuestAnswer = item.QuestAnswer;
+          json.QuestStem = item.QuestStem;
+          // if (item.QuestChoice) {
+          //   let arr = item.QuestChoice.split('||');
+          //   json.QuestChoice = arr;
+          // }
+          if (item.QuestType == '1' || item.QuestType == '0') {
+            let arr = item.QuestChoice.split('||');
+            let arrJson = arr.map(item => {
+              let json1 = {};
+              json1.name = item;
+              json1.value = item;
+              json1.checked = false;
+              return json1
+            });
+            json.QuestChoice = arrJson;
+          }
+          return json;
+        })
+
+        // for(let i = 0 ; i<jsonArr.length; i++){
+        //    let json = {};
+        //    json.currentAnswer = '';
+        //    json.questType = '';
+        //    json.id = '';
+
+        // }
 
+        //  答案锕 
+        let chooceArr = jsonArr.map(item => {
+          let json = {};
+          json.currentAnswer = '';
+          json.questType = '';
+          json.id = item.Id;
+          json.QuestStem = item.QuestStem;
+          return json
+        })
+        this.setData({
+          questionList: jsonArr,
+          chooseValue: chooceArr
+        })
+        console.log(this.data.questionList, "00000");
+        wx.setStorageSync('questionList' + wx.getStorageSync('answersId'), this.data.questionList);
+        wx.setStorageSync('chooseValue' + wx.getStorageSync('answersId'), this.data.chooseValue);
+      }
+    })
+  },
 })

+ 2 - 1
pages/studentRegistration/studentRegistration.json

@@ -1,4 +1,5 @@
 {
   "usingComponents": {},
-  "navigationBarTitleText":"学员登记表"
+  "navigationBarTitleText":"学员登记表",
+  "text-time": "../../components/text-time/text-time"
 }

+ 67 - 132
pages/studentRegistration/studentRegistration.wxml

@@ -1,154 +1,89 @@
 <view class="home">
-	<form bindsubmit="formSubmit">
-			<!-- <van-field name="username" value="{{ username }}" label="姓名" placeholder="请输入姓名" error-message="{{nameMessage}}" /> -->
-			<view class='fwb'>
-				<!-- <van-icon name="circle" /> -->
-				<view class="red-image">
-					<image src="/images/quan.png" style="width:20rpx;height:20rpx"> </image>
-				</view>
-				<view class="xingbie">姓名</view>
-				<view class='weui-input'>
-					<input name="username" value="{{ username }}" placeholder="请输入姓名" placeholder-style="font-size:25rpx" />
-					<view class="{{nameIsTrue?'error':'noerror'}}">请输入姓名</view>
-				</view>
+	<view wx:for="{{questionList}}">
+		<view class='fwb' wx:if="{{ item.QuestType == 5}}">
+			<view class="red-image">
+				<image src="/images/quan.png" style="width:20rpx;height:20rpx"> </image>
 			</view>
-			<!-- <van-field
-    value="{{ password }}"
-    label="密码"
-    placeholder="请输入密码"
-    required
-    border="{{ false }}"
-  /> -->
-			<!-- <van-radio-group value="{{ radio }}" bind:change="onChange">
-				<van-radio name="1">单选框 1</van-radio>
-				<van-radio name="2">单选框 2</van-radio>
-			</van-radio-group> -->
-			<view class='fwb'>
-				<view class="red-image">
-					<image src="/images/quan.png" style="width:20rpx;height:20rpx"> </image>
-				</view>
-				<view class="xingbie">性别</view>
-				<view class='parameter-wrap'>
-					<block wx:for="{{parameter}}" wx:key="parameter">
-						<view class='parameter-info text-over {{item.checked?"checked_parameter":""}}' data-id='{{item.id}}' bindtap='parameterTap'>{{item.name}}</view>
-					</block>
-					<view class="{{errorIsTrue?'error':'noerror'}}">请选择性别</view>
-				</view>
+			<view class="xingbie">{{item.QuestStem}}</view>
+			<view class='weui-input'>
+				<input name="{{item.name}}" value="{{item.QuestAnswer}}" data-index='{{index}}' data-questTypes='{{item.QuestType}}' data-idx='{{item.Id}}' bindinput='bindTextAreaBlur' placeholder="请输入" />
+				<!-- <view class="{{nameIsTrue?'error':'noerror'}}">请输入姓名</view> -->
 			</view>
-			<!-- <van-field name="gongzuoName" value="{{ gongzuoName }}" label="工作单位" placeholder="请输入工作单位" error-message="{{nameMessage}}" />
-			<van-field name="gongzuoName" value="{{ gongzuoName }}" label="文化程度" placeholder="请输入文化程度" error-message="{{nameMessage}}" />
-			<van-field name="gongzuoName" value="{{ gongzuoName }}" label="毕业学校" placeholder="请输入最后毕业学校" error-message="{{nameMessage}}" />
-			<van-field name="gongzuoName" value="{{ gongzuoName }}" label="所学专业" placeholder="请输入所学专业" error-message="{{nameMessage}}" />
-			<van-field name="gongzuoName" value="{{ gongzuoName }}" label="现任职务" placeholder="请输入现任职务" error-message="{{nameMessage}}" /> -->
-			<!-- <van-cell title="任职时间" value="{{ date }}" bind:click="onDisplay" /> -->
-			<view class='fwb'>
-				<view class="red-image">
-					<image src="/images/quan.png" style="width:20rpx;height:20rpx"> </image>
-				</view>
-				<view class="xingbie">工作单位</view>
-				<view class='weui-input'>
-					<input class="" name="work" value="{{ work }}" placeholder="请输入工作单位" placeholder-style="font-size:25rpx"/>
-					<view class="{{workIsTrue?'error':'noerror'}}">请输入工作单位</view>
-				</view>
+		</view>
+		<view class='fwb' wx:if="{{ item.QuestType == 0}}">
+			<view class="red-image">
+				<image src="/images/quan.png" style="width:20rpx;height:20rpx"> </image>
 			</view>
-
-			<view class='fwb'>
-				<view class="red-image">
-					<image src="/images/quan.png" style="width:20rpx;height:20rpx"> </image>
-				</view>
-				<view class="xingbie">文化程度</view>
-				<view class='weui-input'>
-					<input class="" name="culture" value="{{culture }}" placeholder="请输入文化程度" placeholder-style="font-size:25rpx"/>
-					<view class="{{ cultureIsTrue?'error':'noerror'}}">请输入文化程度</view>
-				</view>
+			<view class="xingbie">{{item.QuestStem}}</view>
+			<view class='weui-input' style=" background: white">
+				<radio-group name="{{item.name}}" data-index='{{index}}' data-idx='{{item.Id}}' data-questTypes='{{item.QuestType}}' bindchange="radioChange">
+					<label class="checkbox my-choosebox {{ item.checked?'checkboxbox':''}}" wx:for-index="idx" wx:for="{{item.QuestChoice}}">
+						<radio value="{{ item.value }}" />{{item.name}}
+					</label>
+				</radio-group>
+				<!-- <view class="{{nameIsTrue?'error':'noerror'}}">请输入姓名</view> -->
 			</view>
+		</view>
 
-			<view class='fwb'>
-				<view class="red-image">
-					<image src="/images/quan.png" style="width:20rpx;height:20rpx"> </image>
-				</view>
-				<view class="xingbie">毕业学校</view>
-				<view class='weui-input'>
-					<input class="" name="graduation" value="{{ graduation }}" placeholder="请输入毕业学校" placeholder-style="font-size:25rpx"/>
-					<view class="{{graduationIsTrue?'error':'noerror'}}">请输入毕业学校</view>
-				</view>
+		<view class='fwb' wx:if="{{ item.QuestType == 1}}">
+			<view class="red-image">
+				<image src="/images/quan.png" style="width:20rpx;height:20rpx"> </image>
 			</view>
-
-			<view class='fwb'>
-				<view class="red-image">
-					<image src="/images/quan.png" style="width:20rpx;height:20rpx"> </image>
-				</view>
-				<view class="xingbie">所学专业</view>
-				<view class='weui-input'>
-					<input class="" name="major" value="{{ major }}" placeholder="请输入所学专业" placeholder-style="font-size:25rpx"/>
-					<view class="{{majorIsTrue?'error':'noerror'}}">请输入所学专业</view>
-				</view>
+			<view class="xingbie">{{item.QuestStem}}</view>
+			<view class='weui-input' style=" background: white">
+				<checkbox-group name="{{item.name}}" data-index='{{index}}' data-idx='{{item.Id}}' data-questTypes='{{item.QuestType}}' bindchange="checkboxChange">
+					<label class="checkbox my-choosebox {{ item.checked?'checkboxbox':''}}" wx:for-index="idx" wx:for="{{item.QuestChoice}}">
+						<checkbox value="{{ item.value }}" />{{item.name}}
+					</label>
+				</checkbox-group>
+				<!-- <view class="{{nameIsTrue?'error':'noerror'}}">请输入姓名</view> -->
 			</view>
+		</view>
 
-
-			<view class='fwb'>
-				<view class="red-image">
-					<image src="/images/quan.png" style="width:20rpx;height:20rpx"> </image>
-				</view>
-				<view class="xingbie">现任职务</view>
-				<view class='weui-input'>
-					<input class="" name="post" value="{{ post }}" placeholder="请输入现任职务" placeholder-style="font-size:25rpx"/>
-					<view class="{{postIsTrue?'error':'noerror'}}">请输入现任职务</view>
-				</view>
+		<view class='fwb' wx:if="{{ item.QuestType == 2}}">
+			<view class="red-image">
+				<image src="/images/quan.png" style="width:20rpx;height:20rpx"> </image>
 			</view>
-			<view class='fwb'>
-				<view class="red-image">
-					<image src="/images/quan.png" style="width:20rpx;height:20rpx;"> </image>
-				</view>
-				<view class="xingbie">任职时间</view>
-				<view class='weui-input' catchtap="share1">
-					{{zaizhiTime}}<view style="color:#808080;display: inline-block;height:60rpx;line-height:60rpx;font-size:25rpx" >{{headmasterText}}</view>
-					<view class="{{renzhishijianIsTrue?'error':'noerror'}}">请输入任职时间</view>
-				</view>
-				<van-popup show="{{ postshow }}" position="bottom" custom-style="height: 50%;">
-					<van-datetime-picker bind:confirm="onConfirm" bind:cancel='onClose' type="date" value="{{ currentDate }}" bind:input="onInput" min-date="{{ minDate }}" formatter="{{ formatter }}" />
-				</van-popup>
+			<view class="xingbie">{{item.QuestStem}}</view>
+			<view class='weui-input' style=" background: white">
+				<radio-group name="{{item.name}}" data-index='{{index}}' data-idx='{{item.Id}}' data-questTypes='{{item.QuestType}}' bindchange="radioChange">
+					<label class="checkbox my-choosebox {{ item.checked?'checkboxbox':''}}" wx:for-index="idx" wx:for="{{item.QuestChoice}}">
+						<radio value="{{ item.value }}" />{{item.name}}
+					</label>
+				</radio-group>
+				<!-- <view class="{{nameIsTrue?'error':'noerror'}}">请输入姓名</view> -->
 			</view>
-			<view class='fwb'>
-				<view class="red-image">
-					<image src="/images/quan.png" style="width:20rpx;height:20rpx"> </image>
-				</view>
-				<view class="xingbie">联系电话</view>
-				<view class='weui-input'>
-					<input class="" name="phone" value="{{ phone }}" placeholder="请输入联系电话" placeholder-style="font-size:25rpx"/>
-					<view class="{{phoneIsTrue?'error':'noerror'}}">请输入联系电话</view>
+		</view>
+		<view class='fwt' wx:if="{{ item.QuestType == 3}}">
+			<view class="red-image">
+				<image src="/images/quan.png" style="width:20rpx;height:20rpx"> </image>
+			</view>
+			<view class="flex-flex">
+				<view class=" xingbie moreTitle">{{item.QuestStem}}</view>
+				<textarea value="{{item.QuestAnswer}}" name="{{item.name}}" data-index='{{index}}' data-questTypes='{{item.QuestType}}' data-idx='{{item.Id}}' bindinput='bindTextAreaBlur' placeholder="请输入" maxlength='500' />
 				</view>
 			</view>
-			<view class='fwb'>
+
+
+				<view class='fwb' wx:if="{{ item.QuestType == 6}}"> 
 				<view class="red-image">
-					<image src="/images/quan.png" style="width:20rpx;height:20rpx"> </image>
+					<image src="/images/quan.png" style="width:20rpx;height:20rpx;"> </image>
 				</view>
-				<view class="xingbie">培训时间</view>
-				<view class='weui-input' catchtap="share">
-					{{peixunTime}}<view  style="color:#808080;display: inline-block;height:60rpx;line-height:60rpx;font-size:25rpx">{{peixunText}}</view>
-					<view class="{{peixunshijianTrue?'error':'noerror'}}">请选择培训时间</view>
+				<view class="xingbie">{{item.QuestStem}}</view>
+				<view class='weui-input' style="font-size: 26rpx;  line-height: 56rpx;"  data-index = '{{index}}' data-names='{{item.name}}'  catchtap="share1" name="{{item.name}}">
+					<!-- QuestAnswer   chooseValue[index].currentAnswer -->
+			{{questionList[index].QuestAnswer}}<view wx:if='{{!questionList[index].QuestAnswer}}' style="color:#808080;display: inline-block;height:60rpx;line-height:60rpx;font-size:25rpx" >请选择</view>
+					<!-- <view class="{{renzhishijianIsTrue?'error':'noerror'}}">请输入任职时间</view> -->
 				</view>
-				<van-popup show="{{ postshow1 }}" position="bottom" custom-style="height: 50%;">
-					<van-datetime-picker bind:confirm="onConfirm1" bind:cancel='onClose1' type="date" value="{{ currentDate1 }}" bind:input="onInput1" min-date="{{ minDate }}" formatter="{{ formatter }}" />
+				 <cover-view>
+					<van-popup  show="{{ postshow[index] }}" position="bottom" custom-style="height: 50%;">
+					<van-datetime-picker  data-index='{{index}}' data-questTypes='{{item.QuestType}}' data-idx = '{{item.Id}}'  bind:confirm="onConfirm" bind:cancel='onClose'  type="date" value="{{ currentDate }}" bind:input="onInput" min-date="{{ minDate }}" formatter="{{ formatter }}" />
 				</van-popup>
+					 </cover-view>
 			</view>
-			<!-- <view class='fwb'>
-				<view class="red-image">
-					<image src="/images/quan.png" style="width:20rpx;height:20rpx"> </image>
-				</view>
-				<view class="xingbie">培训时间</view>
-				<view class='time' catchtap="">
-					请选择培训时间
-				</view>
-			</view> -->
 
-
-
-
-		<!-- <button formType="submit">提交表单</button> -->
+		</view>
 		<view style="margin-top: 100rpx;margin-bottom:100rpx">
-			<van-button round formType="submit">提交表单</van-button>
+			<van-button round bindtap="submitForm">提交表单</van-button>
 		</view>
-
-	</form>
 </view>

+ 65 - 6
pages/studentRegistration/studentRegistration.wxss

@@ -67,12 +67,12 @@ button:not([size='mini']) {
   font-size: 24rpx;
   color: #EE0A24;
   background: white;
-  
+
 }
 
 .noerror {
-  display: none!important;
-  
+  display: none !important;
+
 }
 
 .time {
@@ -88,11 +88,13 @@ button:not([size='mini']) {
   margin-left: 20rpx;
   background: #F4F4F4;
   width: 474rpx;
-  
+
 }
-.weui-input input{
+
+.weui-input input {
   height: 60rpx;
 }
+
 .van-icon-circle {
   color: #EE0A24;
   /* margin-top: 30rpx; */
@@ -104,10 +106,67 @@ button:not([size='mini']) {
   width: 130rpx;
   line-height: 60rpx;
 }
+
 .red-image {
   vertical-align: text-bottom;
   margin-top: 10rpx;
 }
+
 input {
-  height: 40rpx; 
+  height: 40rpx;
+}
+
+.moreTitle {
+  width: 600rpx;
+
+}
+
+textarea {
+  background: rgba(244, 244, 244, 1);
+  border-radius: 10px;
+  border: 1rpx solid rgba(244, 244, 244, 1);
+  width: 100%;
+  height: 194rpx;
+  margin-top: 20rpx;
+}
+
+.fwt {
+  display: flex;
+  font-size: 28rpx;
+  margin-top: 40rpx;
+}
+
+.flex-flex {
+  display: flex;
+  flex-direction: column;
+}
+
+.big-vover {
+  z-index: 999;
+}
+
+.weui-input radio {
+  display: none;
+
+}
+
+.weui-input checkbox {
+  display: none;
+}
+
+.checkboxbox {
+  background: linear-gradient(90deg, rgba(215, 47, 29, 1), rgba(249, 157, 48, 1)) !important;
+  color: white !important;
+ 
+}
+
+.my-choosebox {
+  color: rgba(51, 51, 51, 1);
+  width: 200rpx;
+  padding: 10rpx 80rpx;
+  background: #FFF0ED;
+  margin: 10rpx;
+  line-height: 80rpx;
+  border-radius: 10rpx;
+
 }

+ 158 - 33
pages/testAnswer/testAnswer.js

@@ -1,43 +1,168 @@
 //logs.js
 // const util = require('../../utils/util.js')
-
+const tools = require('../../utils/tools.js');
+const app = require('../../utils/util.js');
 Page({
   data: {
-    dataArr:[
-      {
-        "url": "/images/scdj1.jpg",
-        "name": "长春市社区工作者线上培训班",
-        "zbdw": "李老师",
-        "time": "2020年07月10日"
-      },{
-        "url": "/images/scdj2.jpg",
-        "name": "长春市专职党务工作者线上培训班",
-        "zbdw": "刘老师",
-        "time": "2020年07月12日"
-      },{
-        "url": "/images/scdj4.jpg",
-        "name": "区域党建联盟",
-        "zbdw": "王老师",
-        "time": "2020年07月15日"
-      },{
-        "url": "/images/scdj3.jpg",
-        "name": "小区党组织建设",
-        "zbdw": "张老师",
-        "time": "2020年07月30日"
+    dataArr: [
+      // {
+      //   "image": "/images/scdj1.jpg",
+      //   "name": "长春市社区工作者线上培训班",
+      //   "lecturer": "李老师",
+      //   "examBegin": "2020年07月10日",
+      //   examBegin:'2020202020222222'
+      // },{
+      //   "image": "/images/scdj2.jpg",
+      //   "name": "长春市专职党务工作者线上培训班",
+      //   "lecturer": "刘老师",
+      //   "examBegin": "2020年07月12日"
+      // },{
+      //   "image": "/images/scdj4.jpg",
+      //   "name": "区域党建联盟",
+      //   "lecturer": "王老师",
+      //   "examBegin": "2020年07月15日"
+      // },{
+      //   "image": "/images/scdj3.jpg",
+      //   "name": "小区党组织建设",
+      //   "lecturer": "张老师",
+      //   "examBegin": "2020年07月30日"
+      // }
+    ],
+    sessionKey: '',
+  },
+  checkboxChange() {
+
+  },
+  startAnswer(e) {
+    let id = e.currentTarget.dataset.idx;
+    let paperId = e.currentTarget.dataset.paperid;
+    let answersId = e.currentTarget.dataset.answersid;
+    console.log(this.data.sessionKey, "787878");
+
+    if (answersId) {
+      this.toPath(id, paperId, answersId);
+    } else {
+      // 获取answerid
+      this.beginKao(id, paperId, this.data.sessionKey);
+    }
+  },
+  toPath(id, paperId, answersId) {
+    wx.navigateTo({
+      url: '/pages/answerAfterclass/answerAfterclass?id=' + id + '&paperId=' + paperId + '&answersId=' + answersId,
+    })
+  },
+  beginKao(id, paperId, sessionKey) {
+    console.log(paperId, "8888888");
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/exam/begin',
+      method: "post",
+      data: {
+        sessionKey: sessionKey,
+        id: id,
+        paperId: paperId
+      },
+      success: (res) => {
+        console.log(res);
+        if (res.data.code == 0) {
+          console.log(res, "为我么我们微妙"); // 提交答案是后
+          this.toPath(id, paperId, res.data.answersId);
+        }
       }
-    ]
+    })
   },
-  checkboxChange(){
+  lookAnswer(e) {
+    console.log("00000");
+    let answersId = e.currentTarget.dataset.answersid;
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/answer/detail',
+      method: "post",
+      data: {
+        sessionKey: this.data.sessionKey,
+        answersId: answersId
+      },
+      success: (res) => {
+        console.log(res);
+        
+        if (res.data.code == 0) {
+          console.log(res, "suoyoude");
+          // wx.navigateTo({
+          //   url: '/pages/grade/grade?answersId=' + answersId,
+          // })
+          if (res.data.list[0].answerScore) {
+            wx.navigateTo({
+              url: '/pages/grade/grade?answersId=' + answersId,
+            })
+          } else {
+            wx.showModal({
+              title: '提示',
+              content: '当前老师批阅中,请耐心等待',
+              showCancel: false,
+
+            })
+          }
+          // res.data.list[0].forEach(item => {
+          //   if (item.answerScore) {
+          //     wx.navigateTo({
+          //       url: '/pages/grade/grade?answersId=' + answersId,
+          //     })
+          //   } else {
+          //     wx.showModal({
+          //       showCancel: false,
+          //       content: '当前老师批阅中,请耐心等待',
+          //       success(res) {}
+          //     })
+          //     // wx.showModal({
+          //     //   title: '提示',
+          //     //   content: '当前老师批阅中,请耐心等待',
+          //     //   showCancel: false,
+
+          //     // })
+          //   }
+          // })
+        }
+      }
+    })
 
   },
-  startAnswer(){
-    wx.showModal({
-      showCancel: false,
-      content: "此功能暂时还未开放哦",
-      success(res) {}
+  async onLoad() {
+    //const sessionKey = await tools.checkSessionAndLogin();
+    const sessionKey = 'yoa0rZTt2bAiTVDsiRjysw==';
+    this.setData({
+      sessionKey: sessionKey
+    })
+    //....................
+    // if (wx.getStorageSync('questionList')) {
+    //   console.log("缓存锕锕66666666666666666666666666666666666666666666666666666");
+    //   this.setData({
+    //     questionList: wx.getStorageSync('questionList'),
+    //     index: wx.getStorageSync('titleINDEX'),
+    //     answersId:wx.getStorageSync('answersId'),
+    //     chooseValue:wx.getStorageSync('chooseValue'),
+    //   })
+    // } else {
+    //   console.log("请求了锕66666666666666666666666666666666666666666666666666666");
+
+    // }
+    this.getBanner(sessionKey);
+    //....................
+  },
+  getBanner(sessionKey) {
+    console.log(sessionKey, "sessionKey");
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/exam/list',
+      method: "post",
+      data: {
+        sessionKey: sessionKey,
+      },
+      success: (res) => {
+        if (res.data.code == 0) {
+          console.log(res, "suoyoude");
+          this.setData({
+            dataArr: res.data.list
+          })
+          console.log(this.data.dataArr, ":000000");
+        }
+      }
     })
   },
-  onLoad: function () {
-    
-  }
-})
+})

+ 9 - 5
pages/testAnswer/testAnswer.wxml

@@ -1,11 +1,15 @@
 <view class="container">
 	<view class="class_box" wx:for="{{dataArr}}" wx:for-index="idx" wx:for-item="item">
-		<image src="{{item.url}}" mode='aspectFill' class="scimg"></image>
+		<image src="{{item.img}}" mode='aspectFill' class="scimg"></image>
 		<view class="sctext">
-			<view class="t1">{{item.name}}</view>
-			<view class="t2">主讲人: {{item.zbdw}} <text style="margin-left:20rpx">{{item.time}}</text></view>
-			<view class="t3" bindtap="startAnswer">开始答题</view>
+			<view class="t1">{{item.examName}}</view>
+			<!-- {{ times(item.examBegin)}} -->
+			<view class="t2">主讲人: {{item.lecturer}} <text style="margin-left:20rpx"></text>{{ item.examBegin}}</view>
+			<view wx:if='{{item.status == 0}}' class="t3" bindtap="startAnswer" data-answersId='{{item.answersId}}' data-idx='{{item.id}}' data-paperId='{{item.paperId}}'>开始答题</view>
+			<view  wx:if='{{item.status == 1}}' class="t3"  bindtap="lookAnswer" data-answersId='{{item.answersId}}'>查看答案</view>
+			<!-- <view class="t3" bindtap="startAnswer" data-idx='{{item.id}}' data-paperId='{{item.paperId}}'>继续答题</view> -->
 		</view>
-    <view class="isanswertag">未答题</view>
+		<view wx:if='{{item.status == 0}}' class="isanswertag">未答题</view>
+		<view wx:else class="isanswertag" class="isanswertag isanswertag1">已答题</view>
 	</view>
 </view>

+ 5 - 0
pages/testAnswer/testAnswer.wxss

@@ -42,6 +42,8 @@ width: 530rpx;
   border-radius: 20rpx;
   background-color: rgba(255,125,127);
   text-align: center;
+  display: inline-block;
+ 
 }
 .isanswertag{
   width: 140rpx;
@@ -55,4 +57,7 @@ width: 530rpx;
   color: #fff;
   font-size: 24rpx;
   text-align: center;
+}
+.isanswertag1 {
+  background-color: #EC725D;
 }

+ 7 - 0
pages/testAnswer/times.wxs

@@ -0,0 +1,7 @@
+var times = function (val) {
+  console.log(val);
+  
+  return val.substring(0,8);
+}
+//exports: 通过该属性,对外共享本模块的私有变量与函数。
+module.exports.times = times;