Browse Source

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

yukangzhe 4 years ago
parent
commit
2eab4bb3a8

+ 2 - 1
app.json

@@ -15,7 +15,8 @@
     "pages/lessons/lessons",
     "pages/lessonsDetail/lessonsDetail",
     "pages/targetList/targetList",
-    "pages/addClass/addClass"
+    "pages/addClass/addClass",
+    "pages/theClasses/theClasses"
   ],
   "window": {
     "backgroundTextStyle": "dark",

+ 4 - 4
pages/Components/classList/classList.wxml

@@ -1,5 +1,5 @@
 <view class="class-container">
-  <!-- <view class="class-view">
+  <view class="class-view">
     <view class="class-date">2021-02-22 星期一</view>
     <view class="class-list">
       <radio-group bindchange="radioChange">
@@ -23,9 +23,9 @@
         </view>
       </radio-group>
     </view>
-  </view> -->
+  </view>
 
-  <view class="class-view">
+  <!-- <view class="class-view">
     <view class="class-date">{{date}} {{week}}</view>
     <view class="class-list">
       <radio-group bindchange="radioChange">
@@ -57,5 +57,5 @@
         </view>
       </radio-group>
     </view>
-  </view>
+  </view> -->
 </view>

+ 1 - 1
pages/index/index.js

@@ -24,7 +24,7 @@ Page({
       { img: '/images/qj.png', title: '请假',url:"/pages/leave/leave" },
       { img: '/images/bk.png', title: '补课',url:"/pages/lessons/lessons" },
       { img: '/images/jk.png', title: '加课' ,url: "/pages/addClass/addClass"},
-      { img: '/images/dk.png', title: '调课' },
+      { img: '/images/dk.png', title: '调课' ,url: "/pages/theClasses/theClasses"},
     ],
     bannerList: [],
     userList: [],

+ 137 - 0
pages/theClasses/theClasses.js

@@ -0,0 +1,137 @@
+// pages/theClasses/theClasses.js
+const app = getApp()
+const util = require("../../utils/util")
+const urlDef = require("../../utils/urls")
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    curStu: null,
+    aheadTime: 0,
+    eventList: [],
+    holidayList: [],
+    dateList: [],
+    date: null,
+    week: 0,
+    weekMap: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
+    tipList:[
+      '1.每月仅有2次调课机会。如撤销,默认是为使用一次调整机会\r\n\r\n',
+      '2.允许调课至原课程前后一周内。例如:今天11-30日,可调整到11.23到12-07之间的课程\r\n\r\n',
+      '3.可提前7天进行调课\r\n\r\n',
+      '4.调入后的课程,不可再调及请假'
+    ]
+  },
+
+  getTip:function(){
+    var str = ''
+    for(var i in this.data.tipList){
+      str+= this.data.tipList[i]
+      console.log(str)
+    }
+    wx.showModal({
+        title: '调课说明',
+         content: str,
+         showCancel: false,//是否显示取消按钮
+         cancelText:"否",//默认是“取消”
+         cancelColor:'#999999',//取消文字的颜色
+         confirmText:"我知道了",//默认是“确定”
+         confirmColor: 'skyblue',//确定文字的颜色
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    const urls = urlDef.urls;
+    let stu = wx.getStorageSync('student');
+    if (stu) {
+      this.setData('curStu', stu);
+      util.apiPost(urls.get_sys_params, { 'q.orgId': stu.orgId, 'q.id': 'f8158acabeeb44ec9ff651aade6b295f' }).then((rs) => {
+        if (rs && rs.length > 0) {
+          // 将分钟转为毫秒
+          this.setData({ 'aheadTime': parseInt(rs[0].sysVal, 10) * 60 * 1000 })
+        }
+      });
+      util.apiPost(urls.get_schedule_month, { 'q.studentId': stu.studentId }).then((rs) => {
+        if (rs && rs.length > 0) {
+          this.setData({ 'eventList': rs })
+        }
+      });
+      util.apiPost(urls.get_holidays, { 'q.companyId': stu.orgId }).then((rs) => {
+        if (rs && rs.length > 0) {
+          this.setData({ 'holidayList': rs })
+        }
+      });
+    }
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  },
+  selectDate: function (d) {
+    console.log('selectDate ' + d)
+  },
+  callSelectDate: function (d) {
+    let v = d.detail.dateString;
+    let vd = new Date(v);
+    let week = this.data.weekMap[vd.getDay()];
+
+
+    let list = this.data.eventList.filter(o => {
+      return o.attenceDate == v;
+    });
+    list.map(o => {
+      o.bt = o.beginTime.substring(11, 16);
+      o.et = o.endTime.substring(11, 16);
+    })
+    this.setData({ 'date': v, 'week': week, 'dateList': list });
+  }
+})

+ 7 - 0
pages/theClasses/theClasses.json

@@ -0,0 +1,7 @@
+{
+  "navigationBarTitleText": "调课",
+  "usingComponents": {
+    "calendar":"/pages/Components/calendar/calendar",
+    "classList":"/pages/Components/classList/classList"
+  }
+}

+ 15 - 0
pages/theClasses/theClasses.wxml

@@ -0,0 +1,15 @@
+<view class="container">
+
+    <!-- 说明 -->
+    <view class="tip-view" bindtap="getTip">说明</view>
+  <!-- end -->
+
+<!-- 日历组件 -->
+<calendar spot="{{eventList}}" bind:change="callSelectDate"></calendar>
+<!-- end -->
+
+<!-- 课表列表 -->
+ <classList date="{{date}}" list="{{dateList}}"></classList>
+<!-- end -->
+
+</view>

+ 19 - 0
pages/theClasses/theClasses.wxss

@@ -0,0 +1,19 @@
+.container{
+  padding: 0;
+  margin: 0;
+}
+
+page{
+  background: #f1f1f1;
+}
+
+.tip-view{
+  height: 60rpx;
+  line-height: 60rpx;
+  width: 750rpx;
+  color: #FFF;
+  background: #cc6031;
+  text-align: center;
+  font-size: 36rpx;
+}
+