tanyanfei 4 år sedan
förälder
incheckning
462b6c770b

+ 3 - 1
app.js

@@ -23,6 +23,7 @@ App({
               },
               success: res => {
                 if (res.data.data.openid){
+                  _this.globalData.openid = res.data.data.openid
                   wx.setStorage({
                     key: 'openid',
                     data: res.data.data.openid,
@@ -64,6 +65,7 @@ App({
   globalData: {
     userInfo: null,
     host:'https://www.scxjc.club',
-    categoryArray:[]
+    categoryArray:[],
+    openid:''
   }
 })

+ 1 - 2
app.json

@@ -1,10 +1,9 @@
 {
   "pages":[ 
-    
     "pages/index/index",
-    "pages/plan/plan",
     "pages/user/user",
     "pages/online/online",
+    "pages/plan/plan",
     "pages/pay/pay",
     "pages/apply/apply",
     "pages/post/post",

+ 2 - 1
pages/index/index.js

@@ -58,13 +58,14 @@ Page({
       key: 'userInfo',
       data: e.detail.userInfo,
     })
+    console.log(app.globalData.openid)
     wx.request({
       url: host+'/api/wx/authinfo',
       method:'POST',
       data:{
         nickname: e.detail.userInfo.nickName, 
         avatar: e.detail.userInfo.avatarUrl, 
-        openid: this.data.openid, 
+        openid: app.globalData.openid, 
       },
       success:res=>{
           console.log(res)

+ 18 - 3
pages/online/online.js

@@ -11,7 +11,8 @@ Page({
     array1: ['特种作业'],
     index1: 0,
     papers:[],
-    videos:[]
+    videos:[],
+    show:0
   },
 
   /**
@@ -43,9 +44,23 @@ Page({
       },
       data:{},
       success:res=>{
+        
+        let video = res.data.data.videos, papers = res.data.data.papers;
+        let flag1=1,flag=1;
+        for(let i=0;i<video.length;i++){
+          if (!video[i].status){
+            flag1=0
+          }
+        };
+        for (let i = 0; i < papers.length; i++) {
+          if (!papers[i].status) {
+            flag2 = 0
+          }
+        };
         this.setData({
-          papers:res.data.data.papers,
-          videos: res.data.data.videos,
+          papers: papers,
+          videos: video,
+          show: flag1 || flag2
         })
       }
     })

+ 4 - 1
pages/online/online.wxml

@@ -36,7 +36,7 @@
         <view class="title">{{item.title}}</view>
         <view>{{item.class_hour}}学时</view>
         <text>{{item.finished_time}}/{{item.total_time}}</text>
-        <view class="check" style="color:#FF5E4E;" wx:if='{{item.status == 1}}'>未完成</view>
+        <view class="check" style="color:#FF5E4E;" wx:if='{{item.status != 1}}'>未完成</view>
         <view class="check" wx:else><image src="../../images/gou.png" mode="widthFix"></image>已完成</view>
       </view>
   </navigator>
@@ -53,3 +53,6 @@
         <navigator wx:else url="../subject/subject?id={{item.id}}">开始练习</navigator>
     </view>
 </view>
+
+
+<view wx:if="{{show}}" class="complete">已完成学习,立即生成学时证明</view>

+ 14 - 0
pages/online/online.wxss

@@ -2,9 +2,11 @@
 page{
   background: #F4F7F9;
 }
+
 .content{
   min-height: 90vh;
   background: #fff;
+  padding-bottom: 50px;
 }
 .tab{
   background: #fff;
@@ -143,3 +145,15 @@ page{
 .section image{
   width: 32rpx;
 }
+
+.complete{
+  width: calc(100% - 24px);
+  line-height: 38px;
+  color: #fff;
+  text-align: center;
+  position: fixed;
+  left: 12px;
+  bottom: 10px;
+  background: #07c160;
+  border-radius: 4px;
+}

+ 23 - 2
pages/plan/plan.js

@@ -9,7 +9,8 @@ Page({
     index1:-1,
     index2: -1,
     index3: -1,
-    list:[]
+    list:[],
+    show:1
   },
   onLoad: function (options) {
     
@@ -48,9 +49,29 @@ Page({
         index3: e.detail.value
       })
     };
-    this.getData();
+    // this.getData();
+  },
+  show:function(){
+    this.setData({
+      show: 1
+    })
+  },
+  sure:function(){
+    if(this.data.index1<0){
+      wx.showToast({
+        title: '请选择培训项目',
+        icon: 'none',
+        duration: 2000
+      })
+    }else{
+      this.setData({
+        show: 0
+      })
+      this.getData()
+    }
   },
   getData:function(){
+    
     wx.showLoading({
       title: '',
     })

+ 38 - 22
pages/plan/plan.wxml

@@ -1,29 +1,45 @@
-<view class="section">
-  <picker data-id='1' bindchange="bindPickerChange" value="{{index1}}" range="{{array1}}" range-key="name">
-    <view class="picker">
-    <text wx:if="{{index1<0}}">请选择</text>
-      {{array1[index1].name}}
-      <image src="../../images/arrow-bottom.png" mode="widthFix"></image>
-    </view>
-  </picker>
+<view class="section" bindtap="show">
+  请选择培训项目
+</view>
 
-  <picker data-id='2' bindchange="bindPickerChange" value="{{index2}}" range="{{array2}}" range-key="name">
-    <view class="picker">
-    <text wx:if="{{index2<0}}">请选择</text>
-      {{array2[index2].name}}
-      <image src="../../images/arrow-bottom.png" mode="widthFix"></image>
-    </view>
-  </picker>
+<view class="model" wx:if="{{show}}">
+    <view class="model_view">
+        <view class="item">
+              <label>培训项目</label>
+              <picker data-id='1' bindchange="bindPickerChange" value="{{index1}}" range="{{array1}}" range-key="name">
+                <view class="picker">
+                <text wx:if="{{index1<0}}">请选择</text>
+                  {{array1[index1].name}}
+                  <image src="../../images/arrow-bottom.png" mode="widthFix"></image>
+                </view>
+              </picker>
+        </view>
 
-  <picker data-id='3' bindchange="bindPickerChange" value="{{index3}}" range="{{array3}}" range-key="name">
-    <view class="picker">
-    <text wx:if="{{index3<0}}">请选择</text>
-      {{array3[index3].name}}
-      <image src="../../images/arrow-bottom.png" mode="widthFix"></image>
+        <view class="item">
+              <label>作业类别</label>
+              <picker data-id='2' bindchange="bindPickerChange" value="{{index2}}" range="{{array2}}" range-key="name">
+              <view class="picker">
+              <text wx:if="{{index2<0}}">请选择</text>
+                {{array2[index2].name}}
+                <image src="../../images/arrow-bottom.png" mode="widthFix"></image>
+              </view>
+            </picker>
+        </view>
+
+        <view class="item">
+              <label>准操项目</label>
+              <picker data-id='3' bindchange="bindPickerChange" value="{{index3}}" range="{{array3}}" range-key="name">
+              <view class="picker">
+              <text wx:if="{{index3<0}}">请选择</text>
+                {{array3[index3].name}}
+                <image src="../../images/arrow-bottom.png" mode="widthFix"></image>
+              </view>
+            </picker>
+        </view>
+
+        <view bindtap="sure" class="btn">确定</view>
     </view>
-  </picker>
 </view>
-
 <view class="content">
   <view class="list" wx:for="{{list}}" wx:key="*this">
       <view class="title">{{item.type}}培训班</view>

+ 74 - 21
pages/plan/plan.wxss

@@ -3,34 +3,40 @@ page{
   background: #F4F7F9;
 }
 .section{
-  display: flex;
-  justify-content: space-between;
-  padding: 12px;
-  background: #fff;
+  background:rgba(53,139,255,1);
   position: fixed;
-  left: 0;
-  top: 0;
-  z-index: 99;
-  width: 100%;
+  left: 12px;
+  top: 10px;
+  z-index: 9;
+  width: calc(100% - 24px);
+  line-height: 38px;
+  color: #fff;
+  text-align: center;
+  border-radius: 4px;
+  box-shadow:0px 2px 12px 0px rgba(0,0,0,0.08);
 }
-.section picker{
-  width: 33%;
+.item picker{
+  width: 70%;
   position: relative;
-  
+  /* text-align: right; */
+  border: 1px solid #d7d7d7;
+  line-height: 30px;
+  border-radius: 4px;
+  color: #999;
+  padding-left: 10px;
 }
-.section .picker{
-  padding-right: 32rpx;
-  overflow: hidden;
-  text-overflow: ellipsis;
-  white-space: nowrap;
-  text-align: center;
-  font-size: 24rpx;
+.item .picker{
+  font-size: 26rpx;
+}
+.item text{
+  color: #999;
 }
-.section image{
+
+.item image{
   width: 32rpx;
   position: absolute;
-  right: 0;
-  top:2px;
+  right: 5px;
+  top:7px;
 }
 
 .content{
@@ -78,4 +84,51 @@ page{
   right: 12px;
   bottom: 12px;
   line-height: 32px;
+}
+
+.model{
+  position: fixed;
+  width: 100%;
+  height: 100vh;
+  background: rgba(0,0,0,.5);
+  left: 0;
+  top: 0;
+  z-index: 9;
+  transition: all .3s linear;
+}
+.model_view{
+  width: 80%;
+  height: 235px;
+  background: #fff;
+  position: absolute;
+  top: 0;
+  bottom: 0;
+  margin: auto;
+  left: 0;
+  right: 0;
+  padding: 30px 20px;
+  border-radius: 4px;
+  
+}
+
+.item label{
+  font-size: 30rpx;
+  line-height: 30px;
+}
+.item{
+  display: flex;
+  justify-content: space-between;
+  margin-bottom: 12px;
+}
+.btn{
+  height:40px;
+  background:rgba(53,139,255,1);
+  border-radius:4px;
+  text-align: center;
+  line-height: 40px;
+  color: #fff;
+  margin-top: 20px;
+}
+.hide{
+  top: -100%;
 }

+ 8 - 0
pages/upload/upload.js

@@ -12,6 +12,7 @@ Page({
     idnoimg_back: "", //反面照
     halfbody_img: "", //半身照
     education_img: "", //学历照
+    oldcard_img:'',
     id:'',
     train_type:''
   },
@@ -34,6 +35,7 @@ Page({
           idnoimg_back: res.data.data.idnoimg_back, //反面照
           halfbody_img: res.data.data.halfbody_img, //半身照
           education_img: res.data.data.education_img, //学历照
+          oldcard_img: res.data.data.oldcard_img,
           train_type: res.data.data.train_type
         })
         if (!res.data.data.idnoimg_face){
@@ -48,6 +50,7 @@ Page({
                 idnoimg_back: res.data.data.idnoimg_back, //反面照
                 halfbody_img: res.data.data.halfbody_img, //半身照
                 education_img: res.data.data.education_img, //学历照
+                oldcard_img: res.data.data.oldcard_img
               })
             }
           })
@@ -175,6 +178,11 @@ Page({
                 education_img: data.data.url
               })
             }
+            if (id == 5) {
+              _this.setData({
+                oldcard_img: data.data.url
+              })
+            }
           }
         })
       },

+ 1 - 1
pages/upload/upload.wxml

@@ -33,7 +33,7 @@
   </view>
 
     <view class="item" wx:if="{{train_type == '换证'}}">
-      <image wx:if='{{data.education_img}}' data-id='5' bindtap="takePhoto" src="{{data.education_img}}" mode="widthFix"></image>
+      <image wx:if='{{data.oldcard_img}}' data-id='5' bindtap="takePhoto" src="{{data.education_img}}" mode="widthFix"></image>
       <image wx:else data-id='5' bindtap="takePhoto" src="../../images/upload.png" mode="widthFix"></image>
       <view class="title">复审/换证证件照,务必保持清晰</view>
       <text>注意:拍完整不能斜着拍,和复印效果一样!</text>

+ 16 - 0
pages/user/user.js

@@ -57,11 +57,23 @@ Page({
       })
     };
   },
+  preview:function(){
+    var _this=this;
+    wx.previewImage({
+      current: _this.data.data.idnoimg_face, // 当前显示图片的http链接
+      urls: [_this.data.data.idnoimg_face] // 需要预览的图片http链接列表
+    })
+  },
   showImg: function (e) {
     this.setData({
       show: true,
       img: '../../images/zj' + e.target.dataset.id + '.jpg'
     })
+    // var _this = this;
+    // wx.previewImage({
+    //   current: '../../images/zj' + e.target.dataset.id + '.jpg', // 当前显示图片的http链接
+    //   urls: ['../../images/zj' + e.target.dataset.id + '.jpg'] // 需要预览的图片http链接列表
+    // })
   },
   hideImg: function (e) {
     this.setData({
@@ -102,6 +114,10 @@ Page({
             if (id == 4) {  //学历照
               _data.education_img = data.data.url
             }
+            if (id == 5) {  
+              _data.oldcard_img = data.data.url
+            }
+            
             _this.setData({
               data:_data,
               

+ 6 - 2
pages/user/user.wxml

@@ -35,7 +35,11 @@
       <label>单位全称</label>
       <input bindinput="inputChange" data-name='company'  value="{{data.company}}" placeholder="请输入您的单位名称"></input>
   </view>
-
+  
+  <view class="item xs">
+      <label>学时证明</label>
+      <image bindtap="preview" wx:if='{{data.idnoimg_face}}' src="{{data.idnoimg_face}}" mode="widthFix"></image>
+  </view>
 </form>
 
 <view class="content">
@@ -72,7 +76,7 @@
   </view>
 
   <view class="item">
-      <image wx:if='{{data.education_img}}' data-id='5' bindtap="takePhoto" src="{{data.education_img}}" mode="widthFix"></image>
+      <image wx:if='{{data.oldcard_img}}' data-id='5' bindtap="takePhoto" src="{{data.oldcard_img}}" mode="widthFix"></image>
       <image wx:else data-id='5' bindtap="takePhoto" src="../../images/upload.png" mode="widthFix"></image>
       <view class="title">复审/换证证件照,务必保持清晰</view>
       <text>注意:拍完整不能斜着拍,和复印效果一样!</text>

+ 8 - 0
pages/user/user.wxss

@@ -95,4 +95,12 @@ form .item image{
   bottom: 0;
   right: 0;
   margin: auto;
+}
+form .xs image{
+  position: static;
+  width: 100px;
+  margin-left: 30px;
+}
+form .xs label{
+  vertical-align: top;
 }

+ 1 - 0
pages/video/video.wxml

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

+ 6 - 0
pages/video/video.wxss

@@ -1,4 +1,10 @@
 /* pages/video/video.wxss */
 video{
   width: 100%;
+}
+view{
+  font-size: 32rpx;
+  font-weight: 600;
+  margin-top: 12px;
+  padding: 0 12px;
 }

+ 1 - 1
project.config.json

@@ -14,7 +14,7 @@
 	},
 	"compileType": "miniprogram",
 	"libVersion": "2.11.0",
-	"appid": "wxecaa5147d8564e89",
+	"appid": "wx2938132b773c7b5a",
 	"projectname": "yifeng",
 	"debugOptions": {
 		"hidedInDevtools": []