Bladeren bron

Merge branch 'master' of http://118.190.145.217:3000/xiaojincai/yifengxcx

xjc 4 jaren geleden
bovenliggende
commit
2a416a6ed0
5 gewijzigde bestanden met toevoegingen van 52 en 12 verwijderingen
  1. 2 2
      app.js
  2. 8 2
      pages/apply/apply.wxml
  3. 5 0
      pages/apply/apply.wxss
  4. 36 7
      pages/post/post.js
  5. 1 1
      project.config.json

+ 2 - 2
app.js

@@ -46,7 +46,7 @@ App({
             console.log(res)
             // 发送 res.code 到后台换取 openId, sessionKey, unionId
             wx.request({
-              url: 'https://www.scxjc.club/api/wx/openid',
+              url: 'https://wxapi.yifeng2016.com/api/wx/openid',
               method: 'GET',
               data: {
                 code: res.code
@@ -68,7 +68,7 @@ App({
   },
   globalData: {
     userInfo: null,
-    host:'https://www.scxjc.club',
+    host:'https://wxapi.yifeng2016.com',
     categoryArray:[],
     openid:''
   }

+ 8 - 2
pages/apply/apply.wxml

@@ -11,7 +11,10 @@
         <text wx:if="{{item.order_status == 7}}">考试完成</text> 
         <text wx:if="{{item.order_status == 3}}">已培训,待考试</text> 
         <text style="color:green;">{{item.train_type}}</text></view>
-        <view class="title">{{item.name}}   {{item.phone}}  <text>{{item.class_name}}</text></view>
+        <view class="title">{{item.name}}   {{item.phone}}  
+          <text wx:if="{{item.class_name}}">{{item.class_name}}</text>
+          <text class="signup_count" wx:if="{{item.class_name}}">计划{{item.signup_limit}}人/已报名{{item.signup_count}}人</text>
+        </view>
         <view class="info">
             <text>{{item.subject_item_1[0]}}</text>
             <text decode="{{true}}">作业类别  &nbsp;&nbsp; {{item.subject_item_1[1]}}</text>
@@ -34,7 +37,10 @@
         <text wx:if="{{item.order_status == 7}}">考试完成</text> 
         <text wx:if="{{item.order_status == 3}}">已培训,待考试</text> 
         <text style="color:green;">{{item.train_type}}</text></view>
-        <view class="title">{{item.name}}   {{item.phone}}  <text>{{item.class_name}}</text></view>
+        <view class="title">{{item.name}}   {{item.phone}}  
+          <text>{{item.class_name}}</text>
+          <text class="signup_count" wx:if="{{item.class_name}}">计划{{item.signup_limit}}人/已报名{{item.signup_count}}人</text>
+        </view>
         <view class="info">
             <text>{{item.subject_item_1[0]}}</text>
             <text decode="{{true}}">作业类别  &nbsp;&nbsp; {{item.subject_item_1[1]}}</text>

+ 5 - 0
pages/apply/apply.wxss

@@ -32,6 +32,11 @@ page{
   font-size: 28rpx;
   font-weight: 400;
 }
+.title .signup_count{
+  color: #E85546;
+  font-size: 28rpx;
+  font-weight: 400;
+}
 .info text{
   display: block;
   color: #222;

+ 36 - 7
pages/post/post.js

@@ -118,14 +118,22 @@ Page({
                 }
                 //获取班级列表
                 wx.request({
-                  url: host + '/api/wx/class/list?subject_item0=' + list[0].name,
+                  url: host + '/api/wx/class/list' ,
                   method: 'GET',
+                  data:{
+                    subject_item0: subject_item[0],
+                    subject_item1: subject_item[1],
+                    subject_item2: subject_item[2]
+                  },
                   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
-                        }
+                    let class_ = 0;
+                    if (res.data.data.length>0){
+                      let classes = res.data.data[0].classes;
+                      for(let i=0;i<classes.length;i++){
+                        if (classes[i].cid == data.class_id){
+                          class_=i
+                          }
+                      }
                     }
                     this.setData({
                       classList: classes,
@@ -165,6 +173,25 @@ Page({
     })
       
   },
+  getClass(){
+    let category = this.data.category>=0 ? this.data.categoryArray[this.data.category].name:'',
+      subject = this.data.subject >= 0 ? this.data.subjectArray[this.data.subject].name : ''
+    wx.request({
+      url: host + '/api/wx/class/list?signup=1',
+      method: 'GET',
+      data:{
+        subject_item0: this.data.z_type,
+        subject_item1: category,
+        subject_item2: subject
+      },
+      success: res => {
+        // 过滤分类
+        this.setData({
+          classList: res.data.data
+        })
+      }
+    })
+  },
   sure:function(){
     if(this.data.dev==''){
       wx.showToast({
@@ -221,12 +248,14 @@ Page({
           dev: ''
         })
       }
+      this.getClass()
     };
     if (e.target.dataset.name == 'subject') {
       this.setData({
         subject: e.detail.value,
         train: -1
       })
+      this.getClass()
     };
     if (e.target.dataset.name == 'time') {
       this.setData({
@@ -318,7 +347,7 @@ Page({
       }
       // console.log(this.data.class_)
       // console.log(this.data.z_type)
-      if (this.data.classList.length>0) {
+      if (this.data.classList.length > 0 && this.data.class_<0) {
         wx.showToast({
           title: '请选择班级',
           icon: 'none',

+ 1 - 1
project.config.json

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