tanyanfei 4 éve
szülő
commit
7f6da62d42
6 módosított fájl, 116 hozzáadás és 19 törlés
  1. 2 0
      pages/apply/apply.wxml
  2. 6 0
      pages/apply/apply.wxss
  3. 49 11
      pages/post/post.js
  4. 24 7
      pages/post/post.wxml
  5. 34 0
      pages/post/post.wxss
  6. 1 1
      project.config.json

+ 2 - 0
pages/apply/apply.wxml

@@ -44,6 +44,8 @@
         <navigator url="../online/online?id={{item.id}}" wx:if="{{item.order_status == 2}}" class="study">立即学习</navigator>
     </navigator>
 </block>
+<view class="nope" wx:if="{{list.length==0}}">暂无报名信息...</view>
+
     <navigator url="../onlinePost/onlinePost" class="post">立即报名</navigator>
 </view>
 

+ 6 - 0
pages/apply/apply.wxss

@@ -2,6 +2,12 @@
 page{
   background: #F4F7F9;
 }
+.nope{
+  text-align: center;
+  color: #999;
+  font-size: 36rpx;
+  padding: 20px 0;
+}
 .content{
   padding: 12px;
   padding-bottom: 60px;

+ 49 - 11
pages/post/post.js

@@ -28,7 +28,10 @@ Page({
     class_:-1,
     class_id:0,
     data:{},
-    type:0
+    type:0,
+    device_cats:[],
+    dev:[],
+    show_dev:false
   },
 
   /**
@@ -47,8 +50,7 @@ Page({
       },
       success: res => {
         user = res.data.data
-        console.log(user)
-        if(options.type != 2){
+        if (options.type != 2 && user){
             this.setData({
               name:user.name,
               company: user.company,
@@ -97,7 +99,6 @@ Page({
                 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]){
@@ -120,7 +121,7 @@ Page({
                   url: host + '/api/wx/class/list?subject_item0=' + list[0].name,
                   method: 'GET',
                   success: res => {
-                    let classes = res.data.data, class_=0
+                    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
@@ -142,8 +143,9 @@ Page({
                   category: category,
                   subject: subject,
                   train: train,
-                  area:data.area.split(' ')
-
+                  area:data.area.split(' '),
+                  device_cats: categoryArray[category].device_cats,
+                  dev: data.device_cats ? data.device_cats.join(' , '):''
                 })
                 
                 this.setData({
@@ -163,6 +165,32 @@ Page({
     })
       
   },
+  sure:function(){
+    if(this.data.dev==''){
+      wx.showToast({
+        title: '请选择设备种类!',
+        icon: 'none',
+        duration: 2000
+      })
+      return false
+    }
+    this.setData({
+      show_dev: false,
+    })
+  },
+  checkboxChange:function(e){
+      console.log('checkbox发生change事件,携带value值为:', e.detail.value)
+      const values = e.detail.value
+      this.setData({
+        dev: e.detail.value.join(' , ')
+      })
+    
+  },
+  open:function(){
+    this.setData({
+      show_dev: true,
+    })
+  },
   pickerChange:function(e){
     if(e.target.dataset.name == 'sex'){
       this.setData({
@@ -180,8 +208,15 @@ Page({
         category: e.detail.value,
         subjectArray: list,
         subject:-1,
-        train:-1
+        train:-1,
+        device_cats: this.data.categoryArray[e.detail.value].device_cats,
+        dev: ''
       })
+      if (this.data.categoryArray[e.detail.value].device_cats.length>0){
+        this.setData({
+          show_dev: true
+        })
+      }
     };
     if (e.target.dataset.name == 'subject') {
       this.setData({
@@ -233,6 +268,9 @@ Page({
   },
   next:function(e){
     var formData = e.detail.value,data=this.data
+    if (this.data.dev != ''){
+      formData.device_cats = this.data.dev.split(' , ')
+    }
     if (formData.name == '') {
       wx.showToast({
         title: '姓名不能为空!',
@@ -274,9 +312,9 @@ Page({
         })
         return false
       }
-      console.log(this.data.class_)
-      console.log(this.data.z_type)
-      if (this.data.class_ == -1&&this.data.z_type != '特种作业人员') {
+      // console.log(this.data.class_)
+      // console.log(this.data.z_type)
+      if (this.data.classList.length>0&&this.data.class_ == -1&&this.data.z_type != '特种作业人员') {
         wx.showToast({
           title: '请选择班级',
           icon: 'none',

+ 24 - 7
pages/post/post.wxml

@@ -52,7 +52,9 @@
 
       <view wx:if="{{categoryArray[category].intro}}" class="intro">{{categoryArray[category].intro}}</view>
   </view>
-
+ <view class="item" wx:if='{{dev!=""}}' bindtap="open">
+    <label>设备种类</label> {{dev}}
+  </view>
   <view class="item" wx:if="{{type != 3}}">
       <label wx:if="{{z_type == '特种作业'}}">准操项目</label>
       <label wx:else>资格类型</label>
@@ -77,7 +79,7 @@
       <image src="../../images/arrow-bottom.png" mode="widthFix"></image>
       <view wx:if="{{train>=0}}" class="intro">{{trainArray[train].intro}}</view>
   </view>
-  <view class="item" wx:if="{{type != 3&&z_type!='特种作业人员'}}">
+  <view class="item" wx:if="{{type != 3&&z_type!='特种作业人员'&&classList.length>0}}">
       <label>班级</label>
       <picker  data-name='class_'  bindchange="pickerChange" value="{{class_}}" range="{{classList}}" range-key="name">
         <view class="picker">
@@ -191,10 +193,13 @@
 
       <view wx:if="{{categoryArray[category].intro}}" class="intro">{{categoryArray[category].intro}}</view>
   </view>
-
+  <view class="item" wx:if='{{dev!=""}}' bindtap="open">
+    <label>设备种类</label> {{dev}}
+  </view>
   <view class="item" wx:if="{{!class_id}}">
       <label wx:if="{{z_type == '特种作业'}}">准操项目</label>
-      <label wx:else>资格类型</label>
+      <label wx:if="{{z_type != '特种作业' && device_cats.length==0}}">资格类型</label>
+      <label wx:else>项目代码</label>
       <picker  data-name='subject'  bindchange="pickerChange" value="{{subject}}" range="{{subjectArray}}" range-key="name">
         <view class="picker">
         <text wx:if="{{subject<0}}">请选择</text>
@@ -217,8 +222,8 @@
       <view wx:if="{{train>=0}}" class="intro">{{trainArray[train].intro}}</view>
   </view>
 
-  <view class="item" wx:if="{{!class_id&&z_type!='特种作业人员'}}">
-      <label>班级111</label>
+  <view class="item" wx:if="{{!class_id&&z_type!='特种作业人员'&&classList.length>0}}">
+      <label>班级</label>
       <picker  data-name='class_'  bindchange="pickerChange" value="{{class_}}" range="{{classList}}" range-key="name">
         <view class="picker">
         <text wx:if="{{class_<0}}">请选择</text>
@@ -276,4 +281,16 @@
   </view>
 
   <view class="post"><button formType="submit">下一步,上传资料</button></view>
-</form>
+</form>
+
+<view class="bg_dev" style="display:{{show_dev?'block':'none'}}"> 
+  <view class="dev">
+  <view>设备种类</view>
+  <checkbox-group bindchange="checkboxChange">
+    <label class="checkbox" wx:for="{{device_cats}}" wx:key='*this'> 
+        <checkbox value="{{item}}"/>{{item}}
+      </label>
+    </checkbox-group>
+      <button bindtap="sure">确定</button>
+  </view>
+</view>

+ 34 - 0
pages/post/post.wxss

@@ -65,4 +65,38 @@ form{
   margin-top: 12px;
   color: #358BFF;
   font-size: 24rpx;
+}
+.bg_dev{
+  position: absolute;
+  width: 100%;
+  height: 100vh;
+  background: rgba(0,0,0,.5);
+  z-index: 999;
+  top: 0;
+  left: 0;
+}
+.dev{
+  position: absolute;
+  width: 80%;
+  padding: 20px 10px;
+  top: 0;
+  bottom: 0;
+  left: 0;
+  right: 0;
+  margin: auto;
+  height: 60vh;
+  background: #fff;
+  border-radius: 4px;
+}
+.dev view{
+  margin-bottom: 10px;
+  font-size: 36rpx;
+}
+.dev label{
+  margin: 10px;
+  display: inline-block;
+}
+.dev button{
+  display: block;
+  margin-top: 20px;
 }

+ 1 - 1
project.config.json

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