tanyanfei il y a 4 ans
Parent
commit
c1b32a0ea6

+ 21 - 19
app.js

@@ -8,29 +8,31 @@ App({
       success: function(res) {
         openid=res.data
         _this.globalData.openid = openid
-        if (!openid) {
-          // 登录
-          wx.login({
-            success: res => {
-              console.log(res)
-              // 发送 res.code 到后台换取 openId, sessionKey, unionId
-              wx.request({
-                url: 'https://www.scxjc.club/api/wx/openid',
-                method: 'GET',
-                data: {
-                  code: res.code
-                },
-                success: res => {
+      },
+      fail:res=>{
+        // 登录
+        wx.login({
+          success: res => {
+            console.log(res)
+            // 发送 res.code 到后台换取 openId, sessionKey, unionId
+            wx.request({
+              url: 'https://www.scxjc.club/api/wx/openid',
+              method: 'GET',
+              data: {
+                code: res.code
+              },
+              success: res => {
+                if (res.data.data.openid){
                   wx.setStorage({
                     key: 'openid',
                     data: res.data.data.openid,
                   })
-                }
-              })
-            }
-          })
-        }
-      },
+                } 
+              }
+            })
+          }
+        })
+      }
     })   
     // 获取用户信息
     wx.getSetting({

+ 6 - 4
app.json

@@ -1,10 +1,12 @@
 {
   "pages":[ 
+    
     "pages/index/index",
-    "pages/apply/apply",
+    "pages/plan/plan",
     "pages/user/user",
     "pages/online/online",
-    "pages/plan/plan",
+    "pages/pay/pay",
+    "pages/apply/apply",
     "pages/post/post",
     "pages/intro/intro",
     "pages/upload/upload",
@@ -40,12 +42,12 @@
       "pagePath": "pages/apply/apply",
       "text": "报名",
       "iconPath": "images/baoming.png",
-      "selectedIconPath": "images/baoming.png"
+      "selectedIconPath": "images/baoming-xz.jpg"
     },{
       "pagePath": "pages/message/message",
       "text": "消息",
       "iconPath": "images/xiaoxi.png",
-      "selectedIconPath": "images/xiaoxi.png"
+      "selectedIconPath": "images/xiaoxi-xz.jpg"
     },{
       "pagePath": "pages/mine/mine",
       "text": "我的",

+ 15 - 5
app.wxss

@@ -14,7 +14,7 @@ view,navigator{
   left: 0;
   top: 0;
 }
-.login view{
+.login>view{
   width: 80%;
   background: #fff;
   border-radius: 4px;
@@ -25,17 +25,18 @@ view,navigator{
   left: 0;
   right: 0;
   margin: auto;
-  height: 100px;
+  height: 150px;
+  padding-top: 20px;
 }
-.login text{
+.login .xx{
   display: block;
-  padding: 20px;
+  padding: 0px 20px 20px;
 }
 .login button{
   width: 100% !important;
   height: 48px;
   color: #fff;
-  background-color: #fa5151;
+  background-color: #358BFF;
   border-top-left-radius: 0;
   border-top-right-radius: 0;
   padding: 0;
@@ -43,4 +44,13 @@ view,navigator{
 }
 image{
   max-height: 100%;
+}
+.login image{
+  width: 100rpx;
+  height: 100rpx;
+}
+.slogen{
+  position: relative;
+  top: -20px;
+  padding-left: 5px;
 }

BIN
images/baoming-xz.jpg


BIN
images/xiaoxi-xz.jpg


+ 1 - 1
pages/apply/apply.js

@@ -71,7 +71,7 @@ Page({
    * 页面相关事件处理函数--监听用户下拉动作
    */
   onPullDownRefresh: function () {
-
+    this.getData();
   },
 
   /**

+ 4 - 3
pages/apply/apply.wxml

@@ -1,12 +1,13 @@
 <view class="content">
-    <navigator class="list" wx:for="{{list}}" wx:key='*this' url="../post/post?id={{item.id}}">
+    <navigator class="list" wx:for="{{list}}" wx:key='*this' open-type="navigateTo" url="../post/post?type=2&&id={{item.id}}">
         <view class="status">
+        <text wx:if="{{item.order_status == -1}}">待提交资料</text> 
         <text wx:if="{{item.order_status == 0}}">待审核</text> 
         <text wx:if="{{item.order_status == 1}}">已审核立即支付</text> 
         <text wx:if="{{item.order_status == 2}}">学习中</text> 
         <text wx:if="{{item.order_status == 3}}">已完成</text> 
         <text style="color:green;">{{item.train_type}}</text></view>
-        <view class="title">{{item.relaname}}   {{item.phone}}  <text>{{item.class_name}}({{item.ctime}})</text></view>
+        <view class="title">{{item.name}}   {{item.phone}}  <text>{{item.class_name}}({{item.ctime}})</text></view>
         <view class="info">
             <text>{{item.subject_item_1[0]}}</text>
             <text decode="{{true}}">作业类别  &nbsp;&nbsp; {{item.subject_item_1[1]}}</text>
@@ -14,7 +15,7 @@
             <text wx:if="{{item.order_status == 2||item.order_status == 3}}" style="color:#358BFF;" decode="{{true}}">学时情况  &nbsp;&nbsp;已学习{{item.class_hour_finished}}/{{item.class_hour}}学时</text>
             <text style="color:#999;margin-top:12px;">{{item.ctime}}</text>
         </view>
-        <navigator wx:if="{{item.order_status == 1}}" class="study">立即支付</navigator>
+        <navigator url="../pay/pay" wx:if="{{item.order_status == 1}}" class="study">立即支付</navigator>
         <navigator url="../online/online" wx:if="{{item.order_status == 2}}" class="study">立即学习</navigator>
     </navigator>
 

+ 17 - 1
pages/index/index.js

@@ -7,7 +7,9 @@ Page({
     act:6,
     openid:'',
     show:1,
-    data:[]
+    data:[],
+    news: ['国家安全生产监督管理总局30号令'],
+    animationData:{}
   },
   //事件处理函数
   bindViewTap: function() {
@@ -33,6 +35,20 @@ Page({
         }
       },
     })
+
+
+    var animation = wx.createAnimation({
+      duration: 1000,
+      timingFunction: 'ease',
+    })
+
+    this.animation = animation
+
+    animation.translateX(100).step()
+
+    this.setData({
+      animationData: animation.export()
+    })
   },
   onGotUserInfo: function (e) {
     wx.setStorage({

+ 17 - 6
pages/index/index.wxml

@@ -42,10 +42,17 @@
     <text>联系我们</text>
     <image src="../../images/联系我们.png" mode="widthFix"></image>
   </navigator> -->
-  <view class="news">
-      <image src="../../images/tt.png" mode="widthFix"></image>
-      国家安全生产监督管理总局30号令
-  </view>
+  <!-- <view class="news"> -->
+      <!-- <image src="../../images/tt.png" mode="widthFix"></image>
+      <text wx:for="{{news}}">{{item}}</text> -->
+  <!-- </view> -->
+
+<view wx:if="{{data.length>0}}" class="marquee_container" style="--marqueeWidth--:-12em">
+  <view class="zd"></view>
+  <image src="../../images/tt.png" mode="widthFix"></image>
+    <view class="marquee_text">国家安全生产监督管理总局30号令</view>
+</view>
+
 </view>
 
 <view class="bottom">
@@ -56,7 +63,7 @@
         <!-- <text bindtap='tabchange' data-id='2' class="{{act==2 ? 'active':''}}">咨询文章</text> -->
     </view>
     <view wx:for="{{data}}" wx:key='*this' wx:if="{{item.type=='article' && act == index}}" class="article">
-        <navigator url="../article/article?id={{list.id}}" class="list" wx:for="{{item.list}}" wx:for-item="list" wx:key='*this'>
+        <navigator url="../intro/intro?id={{list.id}}" class="list" wx:for="{{item.list}}" wx:for-item="list" wx:key='*this'>
             <view>{{list.title}}</view>
             <text>{{list.ctime}}</text>
         </navigator>
@@ -65,7 +72,11 @@
 
 <view class="login" wx:if='{{show}}'>
     <view>
-        <text>获取用户信息(头像、昵称等)!</text>
+        <view>
+          <image src="../../images/logo.png" mode="widthFix"></image>
+          <text class="slogen">巴中逸沣安全培训</text>
+        </view>
+        <text class="xx">申请获取您的用户信息(头像、昵称等)</text>
         <button bindgetuserinfo="onGotUserInfo" open-type="getUserInfo">确定</button>
     </view>
 </view>

+ 55 - 2
pages/index/index.wxss

@@ -67,10 +67,18 @@ page{
   margin-top: 12px;
   box-shadow:0px 4px 12px 0px rgba(0,0,0,0.08);
   border-radius:4px;
+  white-space: nowrap;
+  overflow: hidden;
 }
-.news image{
+.news text{
+  padding-left: 20px;
+}
+.marquee_container image{
   width: 53px;
   max-height: 30px;
+  position: absolute;
+  left: 10px;
+  top: 15px;
 }
 
 .bottom{
@@ -102,4 +110,49 @@ page{
 .list text{
   color: #999;
   font-size: 24rpx;
-}
+}
+
+/*首页跑马灯效果*/
+@keyframes around {
+  from {
+   margin-left: 90%;
+  }
+  to {
+   /* var接受传入的变量 */
+   margin-left: var(--marqueeWidth--);
+  }
+ }
+ .zd{
+   width: 80px;
+   height: 100%;
+   position: absolute;
+   left: 0;
+   top: 0;
+   background: #fff;
+
+ }
+ 
+.marquee_container{
+  width: 100%;
+  background: #fff;
+  margin-top: 12px;
+  box-shadow:0px 4px 12px 0px rgba(0,0,0,0.08);
+  border-radius:4px;
+  padding: 10px 12px;
+  position: relative;
+  overflow: hidden;
+}
+.marquee_container:hover{
+  /* 不起作用 */
+  animation-play-state: paused;
+}
+.marquee_text{
+  color:#333;
+  font-size: 28rpx;
+  display: inline-block;
+  white-space: nowrap;
+  animation-name: around;
+  animation-duration: 10s;  /*过渡时间*/
+  animation-iteration-count: infinite;
+  animation-timing-function:linear;
+}

+ 2 - 2
pages/intro/intro.wxml

@@ -1,5 +1,5 @@
 <view class="content">
-    <view class="title">{{data.title}}</view>
-    <editor read-only="{{true}}" id="editor"  class="ql-container">
+    <!-- <view class="title">{{data.title}}</view> -->
+    <editor style="height:100vh;" read-only="{{true}}" id="editor"  class="ql-container">
     </editor>
 </view>

+ 1 - 1
pages/onlinePost/onlinePost.js

@@ -32,7 +32,7 @@ Page({
   gotoForm:function(e){
     let id = e.target.dataset.id, name = e.target.dataset.name
     wx.navigateTo({
-      url: '../post/post?name='+name+'&&s_id='+id,
+      url: '../post/post?type=1&&s_id='+id,
     })
   },
   /**

+ 94 - 0
pages/pay/pay.js

@@ -0,0 +1,94 @@
+// pages/pay/pay.js
+const app = getApp()
+const host = app.globalData.host;
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    accountArray: ["个人发票", "公司发票"],    
+    accountTypeArray: ["纸质发票", "电子发票"], 
+    account:0,
+    account_type:0,
+    data:{}
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+      options.id=9
+      wx.request({
+        url: host + '/api/wx/signup',
+        method: 'GET',
+        data: { id: options.id },
+        success:res=>{
+          this.setData({
+            data:res.data.data
+          })
+        }
+      })
+  },
+  pickerChange:function(){
+    if (e.target.dataset.name == 'account') {
+      this.setData({
+        account: e.detail.value
+      })
+    };
+    if (e.target.dataset.name == 'account_type') {
+      this.setData({
+        account_type: e.detail.value
+      })
+    };
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 3 - 0
pages/pay/pay.json

@@ -0,0 +1,3 @@
+{
+  "navigationBarTitleText": "报名详情"
+}

+ 65 - 0
pages/pay/pay.wxml

@@ -0,0 +1,65 @@
+<form>
+  <view class="item">
+      <label>单位全称</label>
+      <input name='company' placeholder="请输入您的单位名称"></input>
+  </view>
+  <view class="item">
+      <label>发票类型</label>
+      <picker name='account' data-name='account' bindchange="pickerChange"  range="{{accountArray}}">
+        <view class="picker">
+          {{accountArray[account]}}
+        </view>
+      </picker>
+      <image src="../../images/arrow-bottom.png" mode="widthFix"></image>
+  </view>
+  <view class="item">
+      <label>发票方式</label>
+      <picker name='account_type' data-name='account_type' bindchange="pickerChange"  range="{{accountTypeArray}}">
+        <view class="picker">
+          {{accountTypeArray[account_type]}}
+        </view>
+      </picker>
+      <image src="../../images/arrow-bottom.png" mode="widthFix"></image>
+  </view>
+
+  <view class="item fee" style="margin-top:12px;padding-bottom:0;">
+      <label>培训费用</label><text>¥{{data.price}}</text>
+  </view>
+  <view class="item fee" style="margin-bottom:12px;">
+      <label>总金额</label><text>¥{{data.price}}</text>
+  </view>
+
+  <view class="item">
+      <label>状态</label>
+      <text>审核通过,代付款</text>
+  </view>
+  <view class="item">
+      <label>报名身份</label>
+      <text>{{data.subject_item}}</text>
+  </view>
+  <view class="item">
+      <label>姓名</label>
+      <text>{{data.name}}</text>
+  </view>
+  <view class="item">
+      <label>性别</label>
+      <text>{{data.sex}}</text>
+  </view>
+  <view class="item">
+      <label>身份证号</label>
+      <text>{{sex.idno}}</text>
+  </view>
+  <view class="item">
+      <label>文化程度</label>
+      <text>{{data.education}}</text>
+  </view>
+  <view class="item">
+      <label>手机号</label>
+      <text>{{data.phone}}</text>
+  </view>
+
+  <view class="bottom">
+    实付款  <text>¥{{data.price}}</text>
+    <view>立即支付</view>
+  </view>
+</form>

+ 80 - 0
pages/pay/pay.wxss

@@ -0,0 +1,80 @@
+/* pages/pay/pay.wxss */
+page{
+  background: #F4F7F9;
+}
+form{
+  margin-top: 12px;
+  display: block;
+  padding-bottom: 70px;
+}
+.item{
+  border-bottom: 1px solid #F2F3F4;
+  padding: 15px;
+  position: relative;
+  background: #fff;
+}
+.item label{
+  color: #222;
+  display: inline-block;
+  width: 60px;
+  vertical-align: middle;
+  text-align: right;
+}
+.item input,.item picker{
+  display: inline-block;
+  width: 70%;
+  border: none;
+  padding-left: 20px;
+  vertical-align: middle;
+}
+.item image{
+  position: absolute;
+  right: 12px;
+  width: 16px;
+  top:20px;
+}
+.fee{
+  border: none;
+}
+
+.item text{
+  padding-left: 20px;
+  position: relative;
+  top: 1px;
+  color: #333;
+}
+.fee text{
+  float: right;
+  color: #E85546;
+}
+
+.bottom{
+  position: fixed;
+  width: 100%;
+  padding: 16px;
+  background: #fff;
+  z-index: 99;
+  color: #222;
+  font-size: 32rpx;
+  left: 0;
+  bottom: 0;
+}
+.bottom text{
+  color: #E85546;
+  margin-left: 12px;
+}
+.bottom view{
+  width:100px;
+  height:40px;
+  background:rgba(232,85,70,1);
+  border-radius:20px;
+  position: absolute;
+  top: 0;
+  bottom: 0;
+  right: 16px;
+  margin: auto;
+  color: #fff;
+  text-align: center;
+  line-height: 40px;
+  font-size: 32rpx;
+}

+ 1 - 1
pages/plan/plan.wxml

@@ -32,7 +32,7 @@
           <text decode="{{true}}">开班时间&nbsp;&nbsp;&nbsp;{{class.class_time}}  </text>
           <text decode="{{true}}">开班人数&nbsp;&nbsp;&nbsp;{{class.thresh_count}}</text>
           <text decode="{{true}}">&nbsp;&nbsp;&nbsp;已报名&nbsp;&nbsp;&nbsp;{{class.signuped_count}}</text>
-          <navigator url="../post/post?class_id={{class.id}}&price={{class.price}}"  class="apply">报名</navigator>
+          <navigator url="../post/post?class_id={{class.id}}&price={{class.price_new}}_{{class.price_re}}_{{class.price_change}}&&type=3"  class="apply">报名</navigator>
       </view>
   </view>
 </view>

+ 16 - 0
pages/plan/plan.wxss

@@ -8,8 +8,24 @@ page{
   padding: 12px;
   background: #fff;
 }
+.section picker{
+  width: 33%;
+  position: relative;
+  
+}
+.section .picker{
+  padding-right: 32rpx;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  text-align: center;
+  font-size: 24rpx;
+}
 .section image{
   width: 32rpx;
+  position: absolute;
+  right: 0;
+  top:2px;
 }
 
 .content{

+ 135 - 53
pages/post/post.js

@@ -27,53 +27,114 @@ Page({
     classList:[],
     class_:-1,
     class_id:0,
-    data:{}
+    data:{},
+    type:0
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    if(options.id){
+    this.setData({
+      type: options.type
+    })
+    var sub_list=[]
+    wx.request({
+      url: host + '/api/wx/sujectitem',
+      success: res => {
+        sub_list = res.data.data      
+      }
+    })
+    // options:s_name  分类名称    s_id 分类id  class_id  班级id
+    //新增报名
+    if (options.type == 1){
+      //班级列表
+      wx.request({
+        url: host + '/api/wx/class/list?subject_item0=' + options.s_id,
+        method: 'GET',
+        success: res => {
+          // 过滤分类
+          let list = sub_list.filter(item => item.id == options.s_id)
+          this.setData({
+            categoryArray: list[0].children,
+            z_type: list[0].name,     //提交时拼接subject_item
+            classList: res.data.data[0].classes
+          })
+        }
+      })
+    }
+    //修改报名
+    if(options.type == 2){
         wx.request({
           url: host+'/api/wx/signup',
           method:'GET',
           data:{id:options.id},
           success:res=>{
+            let data = res.data.data, subject_item = data.subject_item.split('|')
+            let list = sub_list.filter(item => item.name == subject_item[0])
+            let categoryArray = list[0].children, subject = 0,
+                 subjectArray = [], category = 0, train=0
+            //定位分类下拉选项
+            for(let i=0;i<categoryArray.length;i++){
+              if (categoryArray[i].name == subject_item[1]){
+                category=i
+                subjectArray = categoryArray[i].children
+                for(let j=0;j<subjectArray.length;j++){
+                  if (subjectArray[j].name == subject_item[2]){
+                        subject=j
+                    }
+                }
+                }
+            }
+            for(let i=0;i<this.data.trainArray.length;i++){
+              if (this.data.trainArray[i].name == data.train_type){
+                train=i
+                }
+            }
+            //获取班级列表
+            wx.request({
+              url: host + '/api/wx/class/list?subject_item0=' + list[0].id,
+              method: 'GET',
+              success: res => {
+                let classes = res.data.data[0].classes, class_=0
+                for(let i=0;i<classes.length;i++){
+                  if (classes[i].cid == data.class_id){
+                    class_=i
+                    }
+                }
+                this.setData({
+                  classList: classes,
+                  class_: class_
+                })
+              }
+            })
+            this.setData({
+              z_type: subject_item[0],
+              sex:data.sex=='男' ? 0 :1,
+              record: this.data.recordArray.indexOf(data.education),
+              receive: data.receive_card == '自取' ? 0 : 1,
+              categoryArray: categoryArray,
+              subjectArray: subjectArray,
+              category: category,
+              subject: subject,
+              train: train,
+              area:data.area.split(' ')
+
+            })
+            
             this.setData({
               data: res.data.data
             })
           }
         })
     }
-    if(options.class_id){
+    //班级报名
+    if(options.type == 3){
       this.setData({
-        class_id: options.class_id,
-        price: options.price
+        parice_list: options.price.split('_'),
+        class_id: options.class_id
       })
-    }else{
-      wx.request({
-        url: host + '/api/wx/sujectitem',
-        success: res => {
-          let list = res.data.data.filter(item => item.name == options.name)
-          this.setData({
-            categoryArray: list[0].children,
-            z_type: options.name
-          })
-        }
-      })
-      wx.request({
-        url: host + '/api/wx/class/list?subject_item0=' + options.s_id,
-        method: 'GET',
-        success: res => {
-          // let list = res.data.data.filter(item => item.type == options.name)
-          this.setData({
-            classList: res.data.data[0].classes
-          })
-        }
-      })
-    }
-      
+    } 
       
   },
   pickerChange:function(e){
@@ -109,7 +170,9 @@ Page({
     };
     if (e.target.dataset.name == 'train') {
       var price=this.data.price
-      if(!this.data.class_id && this.data.category>=0 && this.data.subject>=0){
+      if(this.data.type == 3){
+        price = this.data.parice_list[e.detail.value]
+      }else if(this.data.category>=0 && this.data.subject>=0){
         if (e.detail.value == 0){
           price = this.data.categoryArray[this.data.category].price_new
         }
@@ -168,7 +231,7 @@ Page({
       })
       return false
     }
-    if(!this.data.class_id){
+    if(data.type != 3){
       if (this.data.category == -1) {
         wx.showToast({
           title: '请选择作业类别',
@@ -185,14 +248,6 @@ Page({
         })
         return false
       }
-      if (this.data.train == -1) {
-        wx.showToast({
-          title: '请选择培训类型',
-          icon: 'none',
-          duration: 2000
-        })
-        return false
-      }
       if (this.data.class_ == -1) {
         wx.showToast({
           title: '请选择班级',
@@ -201,35 +256,62 @@ Page({
         })
         return false
       }
-    }
-    if (!this.data.class_id) {
-      formData.subject_item = data.z_type+"|"+data.categoryArray[data.category].name+"|"+data.subjectArray[data.subject].name
-      formData.subject_id = data.subjectArray[data.subject].id    
-      formData.sex=data.sexArray[data.sex]
-      formData.education = data.recordArray[data.record]
-      formData.receive_card = data.receiveArray[data.receive]
-      formData.class_id = data.classList[data.class_].id
+      formData.subject_item = data.z_type + "|" + data.categoryArray[data.category].name + "|" + data.subjectArray[data.subject].name
+      formData.subject_id = data.subjectArray[data.subject].id   
+      formData.class_id = data.classList[data.class_].cid
     }else{
-      formData.class_id = this.data.class_id
+      formData.class_id = data.class_id
     }
+    if (this.data.train == -1) {
+      wx.showToast({
+        title: '请选择培训类型',
+        icon: 'none',
+        duration: 2000
+      })
+      return false
+    }
+    formData.sex=data.sexArray[data.sex]
+    formData.education = data.recordArray[data.record]
+    formData.receive_card = data.receiveArray[data.receive]  
     formData.train_type = data.trainArray[data.train].name
     formData.price=this.data.price
-    formData.area=this.data.area.join('')
+    formData.area=this.data.area.join(' ')
+    var method = 'POST', post_data = formData
+    if (this.data.type == 2) { 
+      method = 'PUT' 
+      var new_data=this.data.data
+      for(let key in formData){
+        new_data[key]=formData[key]
+      }
+      post_data = new_data
+    }
+
+
     wx.showLoading({
       title: '',
     })
+    
     wx.request({
       url: host + '/api/wx/signup',
-      method: 'POST',
+      method: method,
       header: {
         openid: this.data.openid
       },
-      data: formData,
+      data: post_data,
       success: res => {
         wx.hideLoading()
-        wx.navigateTo({
-          url: '../upload/upload?id='+res.data.data.id,
-        })
+        if(res.data.status == 'suc'){
+          let id = (data.type == 2) ? new_data.id : res.data.data.id
+          wx.navigateTo({
+            url: '../upload/upload?id='+id,
+          })
+        }else{
+          wx.showToast({
+            title: res.data.message,
+            icon: 'none',
+            duration: 2000
+          })
+        }
       }
     })
     

+ 16 - 16
pages/post/post.wxml

@@ -1,4 +1,4 @@
-<form wx:if="{{!id}}" catchsubmit="next">
+<form wx:if="{{type != 2}}" catchsubmit="next">
   <view class="item">
       <label>姓名</label>
       <input  name='name' placeholder="请输入您的姓名"></input>
@@ -39,7 +39,7 @@
       <input name='company' placeholder="请输入您的单位名称"></input>
   </view>
 
-  <view class="item" wx:if="{{!class_id}}">
+  <view class="item" wx:if="{{type != 3}}">
       <label>作业类别</label>
       <picker  data-name='category'  bindchange="pickerChange" value="{{category}}" range="{{categoryArray}}" range-key="name">
         <view class="picker">
@@ -52,7 +52,7 @@
       <view wx:if="{{category>=0}}" class="intro">{{categoryArray[category].intro}}</view>
   </view>
 
-  <view class="item" wx:if="{{!class_id}}">
+  <view class="item" wx:if="{{type != 3}}">
       <label wx:if="{{z_type == '特种作业'}}">准操项目</label>
       <label wx:else>资格类型</label>
       <picker  data-name='subject'  bindchange="pickerChange" value="{{subject}}" range="{{subjectArray}}" range-key="name">
@@ -77,12 +77,12 @@
       <view wx:if="{{train>=0}}" class="intro">{{trainArray[train].intro}}</view>
   </view>
 
-  <view class="item" wx:if="{{!class_id}}">
+  <view class="item" wx:if="{{type != 3}}">
       <label>班级</label>
-      <picker  data-name='class_'  bindchange="pickerChange" value="{{class_}}" range="{{classList}}" range-key="class_name">
+      <picker  data-name='class_'  bindchange="pickerChange" value="{{class_}}" range="{{classList}}" range-key="name">
         <view class="picker">
         <text wx:if="{{class_<0}}">请选择</text>
-          {{classList[class_].class_name}}
+          {{classList[class_].name}}
         </view>
       </picker>
       <image src="../../images/arrow-bottom.png" mode="widthFix"></image>
@@ -140,7 +140,7 @@
 <form wx:else catchsubmit="next">
   <view class="item">
       <label>姓名</label>
-      <input value="data.name" name='name' placeholder="请输入您的姓名"></input>
+      <input value="{{data.name}}" name='name' placeholder="请输入您的姓名"></input>
   </view>
 
   <view class="item">
@@ -155,7 +155,7 @@
 
   <view class="item">
       <label>身份证</label>
-      <input name='idno' type="idcard" placeholder="请输入您的身份证"></input>
+      <input name='idno' value="{{data.idno}}" type="idcard" placeholder="请输入您的身份证"></input>
   </view>
 
   <view class="item">
@@ -170,12 +170,12 @@
 
   <view class="item">
       <label>手机号</label>
-      <input name='phone' type="number" placeholder="请输入您的手机号"></input>
+      <input name='phone' value="{{data.phone}}" type="number" placeholder="请输入您的手机号"></input>
   </view>
 
   <view class="item">
       <label>单位全称</label>
-      <input name='company' placeholder="请输入您的单位名称"></input>
+      <input name='company' value="{{data.company}}"  placeholder="请输入您的单位名称"></input>
   </view>
 
   <view class="item" wx:if="{{!class_id}}">
@@ -218,10 +218,10 @@
 
   <view class="item" wx:if="{{!class_id}}">
       <label>班级</label>
-      <picker  data-name='class_'  bindchange="pickerChange" value="{{class_}}" range="{{classList}}" range-key="class_name">
+      <picker  data-name='class_'  bindchange="pickerChange" value="{{class_}}" range="{{classList}}" range-key="name">
         <view class="picker">
         <text wx:if="{{class_<0}}">请选择</text>
-          {{classList[class_].class_name}}
+          {{classList[class_].name}}
         </view>
       </picker>
       <image src="../../images/arrow-bottom.png" mode="widthFix"></image>
@@ -258,19 +258,19 @@
   </view>
   <view class="item" wx:if="{{receive==1}}">
       <label>详细地址</label>
-      <input name='address' placeholder="请输入您的详细地址"></input>
+      <input name='address' value="{{data.address}}"  placeholder="请输入您的详细地址"></input>
   </view>
 
   <view class="item">
       <label>备注</label>
-      <input name='remark' placeholder="请输入您的备注"></input>
+      <input name='remark' value="{{data.remark}}" placeholder="请输入您的备注"></input>
   </view>
 
   <view class="fee">
-    <label>培训费用</label>¥{{price}}
+    <label>培训费用</label>¥{{data.price}}
   </view>
   <view class="fee">
-    <label>审核后需支付费用</label>¥{{price}}
+    <label>审核后需支付费用</label>¥{{data.price}}
   </view>
 
   <view class="post"><button formType="submit">下一步,上传资料</button></view>

+ 35 - 23
pages/subject/subject.js

@@ -81,29 +81,41 @@ Page({
     })
   },
   post:function(){
-      wx.request({
-        url: host+'/api/wx/postpaper',
-        data:{
-          paper_id:this.data.id,
-          questions:this.data.ans
-        },
-        method:'POST',
-        success:res=>{
-          console.log(res.data)
-          if(res.data.status == 'suc'){
-            wx.showToast({
-              title: '提交成功',
-              icon: 'success',
-              duration: 2000
-            })
-            setTimeout(function () {
-              wx.navigateTo({
-                url: '../online/online',
-              })
-            }, 2000)
-          }
-        }
-      })
+    var _this=this
+    wx.showModal({
+      title: '交卷确认',
+      content: '您确认要交卷吗?',   
+      success(res) {
+        if (res.confirm) {
+          wx.request({
+            url: host + '/api/wx/postpaper',
+            data: {
+              paper_id: _this.data.id,
+              questions: _this.data.ans
+            },
+            method: 'POST',
+            success: res => {
+              console.log(res.data)
+              if (res.data.status == 'suc') {
+                wx.showModal({
+                  title: res.data.data.mark+'分',
+                  content: '您本次考试得分',
+                  showCancel: false,
+                  success(res) {
+                    if (res.confirm) {
+                      wx.navigateTo({
+                        url: '../online/online',
+                      })
+                    }
+                  }
+                })
+              }
+            }
+          })
+        } 
+      }
+    })
+      
   },
   /**
    * 生命周期函数--监听页面初次渲染完成

+ 14 - 0
pages/upload/upload.js

@@ -23,6 +23,20 @@ Page({
       id:JSON.parse(options.id),
       openid: app.globalData.openid
     })
+    wx.request({
+      url: host + '/api/wx/signup',
+      method: 'GET',
+      data: { id: options.id },
+      success:res=>{
+        this.setData({
+          idnoimg_face: res.data.data.idnoimg_face, //正面照
+          idnoimg_back: res.data.data.idnoimg_back, //反面照
+          halfbody_img: res.data.data.halfbody_img, //半身照
+          education_img: res.data.data.education_img, //学历照
+        })
+      }
+    })
+
   },
   post:function(){
     var formData ={}

+ 7 - 3
pages/video/video.js

@@ -6,7 +6,8 @@ Page({
    */
   data: {
     title:'',
-    url:''
+    url:'',
+    time:0
   },
 
   /**
@@ -14,13 +15,16 @@ Page({
    */
   onLoad: function (options) {
     console.log(options)
+    let time = options.time.split(':')
     this.setData({
       title: options.title,
       url: options.url,
-      time: options.options
+      time: time[0]*60+time[1]
     })
   },
-
+  pause: function (event){
+    console.log(event)
+  },
   /**
    * 生命周期函数--监听页面初次渲染完成
    */

+ 1 - 1
pages/video/video.wxml

@@ -1 +1 @@
-<video src='{{url}}' title="{{title}}" initial-time='{{time}}'></video>
+<video src='{{url}}' title="{{title}}" initial-time='{{time}}' bindpause='pause'></video>