Browse Source

Signed-off-by: yukangzhe <382985154@qq.com>

yukangzhe 3 years atrás
parent
commit
f5da8d26ac
5 changed files with 47 additions and 34 deletions
  1. 1 1
      app.js
  2. 0 2
      pages/index/index.js
  3. 1 1
      pages/index/index.wxml
  4. 44 29
      pages/makePiano/makePiano.js
  5. 1 1
      pages/makePiano/makePiano.wxml

+ 1 - 1
app.js

@@ -68,7 +68,7 @@ App({
   },
 
   globalData: {
-    ver:'1.0.9',
+    ver:'1.1.0',
     userInfo: null,
     openId: '',
     imageUrl: 'https://app.schoolwisdoms.com/static/wx/images/',

+ 0 - 2
pages/index/index.js

@@ -514,6 +514,4 @@ Page({
       }
     })
   }
-
-
 })

+ 1 - 1
pages/index/index.wxml

@@ -4,7 +4,7 @@
     <view class="head-left">
       <view class="head-img-view" wx:for="{{userItems}}" wx:key="index" data-id="{{item.studentId}}" bindtap="changeStu" wx:if="{{curStu.orgId == item.orgId}}">
         <image class="{{curStu.studentId == item.studentId ? 'curStu' : 'stuHead'}}" src="{{item.imageUrl}}"></image>
-      </view>
+      </view> 
     </view>
     <view class="head-right">
       <view class="section">

+ 44 - 29
pages/makePiano/makePiano.js

@@ -41,17 +41,17 @@ Page({
     yFlag: false
   },
 
-  getTimeDate:function(e){
-    if(e.currentTarget.dataset.value == this.data.index){
+  getTimeDate: function (e) {
+    if (e.currentTarget.dataset.value == this.data.index) {
       this.setData({
         index: -1,
       })
-    } else{
+    } else {
       this.setData({
         index: e.currentTarget.dataset.value,
       })
     }
-   
+
   },
 
   getWeek: function (e) {
@@ -90,6 +90,7 @@ Page({
     this.setData({
       timeScope,
       index: -1,
+      schoolList: []
     })
     this.showSelect()
     this.queryList()
@@ -224,20 +225,23 @@ Page({
         this.selectCity()
       }
     }
-    if(this.data.refreshFlag == 1){
+    if (this.data.refreshFlag == 1) {
       this.setData({
         schoolList: [],
         refreshFlag: 0
       })
       this.queryList()
     }
-    
+
   },
 
   selectCity: function () {
     wx.navigateTo({
       url: `plugin://citySelector/index?key=${key}&referer=${referer}&hotCitys=${hotCitys}`,
     })
+    this.setData({
+      refreshFlag: 1
+    })
   },
 
   /**
@@ -301,13 +305,12 @@ Page({
       params['q.regionId'] = countyCode.substring(0, 4) + '00'
       params.pageNum = this.data.pageNum
       util.apiPost(urls.get_near_school, params).then(rs => {
-
         let list = rs.list;
         list.map(s => {
           s.dist = this.showDist(s.distance)
         })
 
-        const schoolNum = "("+list.length+")"
+        const schoolNum = "(" + list.length + ")"
         this.setData({
           'hasNextPage': rs.hasNextPage,
           'loading': rs.hasNextPage ? '上拉加载' : '没有更多数据',
@@ -339,14 +342,14 @@ Page({
     //   'schoolIndex': index
     // })
     // this.queryClassesList(id)
-    let moreFlag = 'schoolList['+index+'].moreFlag'
-    if(this.data.schoolList[index].moreFlag){
+    let moreFlag = 'schoolList[' + index + '].moreFlag'
+    if (this.data.schoolList[index].moreFlag) {
       this.setData({
-        [moreFlag] : false
+        [moreFlag]: false
       })
     } else {
       this.setData({
-        [moreFlag] : true
+        [moreFlag]: true
       })
     }
 
@@ -382,23 +385,34 @@ Page({
         'q.timeScope': this.data.timeScope
       }
       // params['q.timeScope'] = ''; 时段
-      util.apiPost(urls.query_school_attence, params).then(rs => {
-        for (var j in rs) {
-          if (rs[j].studentVisitNum > 0 || rs[j].studentWaitNum > 0) {
+      if (i == 0) {
+        util.apiPost(urls.query_school_attence, params).then(rs => {
+          s.moreFlag = true
+          s.items = rs
+          this.setData({
+            schoolList: sl
+          })
+        })
+      } else {
+        util.apiPost(urls.query_school_attence, params).then(rs => {
+          for (var j in rs) {
+            if (rs[j].studentVisitNum > 0 || rs[j].studentWaitNum > 0) {
+              s.moreFlag = true
+              break
+            } else {
+              s.moreFlag = false
+            }
+          }
+          if (s.collect == 1) {
             s.moreFlag = true
-            break
-          } else {
-            s.moreFlag = false
           }
-        }
-        if(s.collect == 1){
-          s.moreFlag = true
-        }
-        s.items = rs
-        this.setData({
-          schoolList: sl
+
+          s.items = rs
+          this.setData({
+            schoolList: sl
+          })
         })
-      })
+      }
     }
   },
   doAppointment: function (e) {
@@ -425,7 +439,7 @@ Page({
 
     const urls = urlDef.urls;
     let w = this.data.weekList[this.data.curIndex];
-    let sid = this.data.schoolList[this.data.schoolIndex].id
+    let sid = this.data.schoolList[index].id
     util.apiPost(urls.do_appointment + '?q.studentId=' + this.data.curStu.studentId + '&q.planId=' + id + '&q.orgId=' + sid + '&q.visitDate=' + w.ds).then(rs => {
       if (rs.success > 0) {
         wx.showToast({
@@ -436,8 +450,9 @@ Page({
         wx.showToast({
           title: rs.msg,
           icon: 'none',
+          duration: 3000
         })
-        this.queryList()
+        // this.queryList()
       }
     });
   },
@@ -446,7 +461,7 @@ Page({
     let index = e.currentTarget.dataset.index
     let w = this.data.weekList[this.data.curIndex];
     let sid = this.data.schoolList[index].id
-    
+
     wx.navigateTo({
       url: '/pages/queue/queue?planId=' + id + '&orgId=' + sid + '&visitDate=' + w.ds
     })

+ 1 - 1
pages/makePiano/makePiano.wxml

@@ -106,6 +106,6 @@
   </view>
   <!-- end -->
 
-  <view class="loading">{{loading}}</view>
+  <!-- <view class="loading">{{loading}}</view> -->
 
 </view>