Browse Source

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

yukangzhe 4 years ago
parent
commit
f6d6755210

+ 2 - 1
app.json

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

+ 19 - 2
pages/Components/classList/classList.js

@@ -4,14 +4,26 @@ Component({
    * 组件的属性列表
    */
   properties: {
-    showLeaveNum: {
+    showLeaveNum: { //是否显示请假余额
       type: Boolean,
       value: false
     },
-    showFlag:{
+    showTime:{ //是否显示上课时间
       type: Boolean,
       value: true
     },
+    showFlag:{ //是否显示上课状态
+      type: Boolean,
+      value: true
+    },
+    showBtn:{ //是否显示功能按钮
+      type:Boolean,
+      value: false,
+    },
+    showRadio:{ //是否显示单选按钮
+      type:Boolean,
+      value: false,
+    },
     date: {
       type: String
     },
@@ -32,6 +44,11 @@ Component({
    * 组件的方法列表
    */
   methods: {
+    toPages:function(e){
+      wx.navigateTo({
+        url: e.currentTarget.dataset.url,
+      })
+    },
     getLeaveNumList: function () {
       wx.navigateTo({
         url: '/pages/leaveRecord/leaveRecord',

+ 47 - 28
pages/Components/classList/classList.wxml

@@ -1,42 +1,61 @@
 <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">
-      <view class="class-box" wx:for="{{3}}" wx:key="index">
-        
-        <view class="class-name"><text class="class-type">1v1</text>小鹏钢琴课</view>
-        <view class="class-time">09:00 ~ 11:00</view>
-        <view class="get-box" wx:if="{{!showFlag}}">
-          <radio value="{{index}}" checked="" color="#cc6031"/>
+        <view class="class-box" wx:for="{{3}}" wx:key="index">
+
+          <view class="class-name" style="{{!showTime ? 'width: 700rpx;' : ''}}"><text
+              class="class-type">1v1</text>小鹏钢琴课</view>
+          <view class="class-time" wx:if="{{showTime}}">09:00 ~ 11:00</view>
+          <view class="get-box" wx:if="{{showRadio}}">
+            <radio value="{{index}}" checked="" color="#cc6031" />
+          </view>
+          <view class="class-detail-box">
+            <view class="class-room">钢琴教室01</view>
+            <view class="class-teacher">张老师</view>
+          </view>
+          <view class="class-flag" wx:if="{{showFlag}}">已上课</view>
+          <view class="class-btn-box" wx:if="{{showBtn}}">
+            <view class="add-btn class-btn" bindtap="toPages" data-url="/pages/targetList/targetList">申请加课</view>
+          </view>
+          <view wx:if="{{showLeaveNum}}" class="last-leave-num" bindtap="getLeaveNumList">本课程请假余额 6 次</view>
         </view>
-        <view class="class-room">钢琴教室01</view>
-        <view class="class-flag" wx:if="{{showFlag}}">已上课</view>
-        <view class="class-teacher" style="{{!showFlag ? 'margin-left:54rpx' : ''}}">张老师</view>
-        <view wx:if="{{showLeaveNum}}" class="last-leave-num" bindtap="getLeaveNumList">本课程请假余额 6 次</view>
-     
-      </view>
-    </radio-group>
+      </radio-group>
     </view>
-  </view>-->
+  </view> -->
 
   <view class="class-view">
     <view class="class-date">{{date}} {{week}}</view>
     <view class="class-list">
-      <view class="class-box" wx:for="{{list}}" wx:key="index">
-        <view class="class-name"><text class="class-type">{{item.kindId == 1 ? '1v1':'集体'}}</text>{{item.classesName}}</view>
-        <view class="class-time">{{item.bt}} ~ {{item.et}}</view>
-        <view class="class-room">{{item.roomName}}</view>
-        <view class="class-flag">
-          <span wx:if="{{item.status == 0 || item.status == 11 || item.status == 12 || item.status == 4}}">{{item.isAttend == 1 ?'已' : '待'}}上课</span>
-          <span wx:if="{{item.status == 2}}">已请假</span>
-          <span wx:if="{{item.status == 3}}">已调出</span>
-          <span wx:if="{{item.status == 11 || item.status == 12}}">加课</span>
-          <span wx:if="{{item.status == 5}}">补课</span>
+      <radio-group bindchange="radioChange">
+        <view class="class-box" wx:for="{{list}}" wx:key="index">
+          <view class="class-name" style="{{!showTime ? 'width: 700rpx;' : ''}}"><text
+              class="class-type">{{item.kindId == 1 ? '1v1':'集体'}}</text>{{item.classesName}}
+          </view>
+          <view class="class-time" wx:if="{{showTime}}">{{item.bt}} ~ {{item.et}}</view>
+          <view class="get-box" wx:if="{{showRadio}}">
+            <radio value="{{index}}" checked="" color="#cc6031" />
+          </view>
+          <view class="class-detail-box">
+            <view class="class-room">{{item.roomName}}</view>
+            <view class="class-teacher">老师:{{item.teacherName}}</view>
+          </view>
+          <view class="class-flag" wx:if="{{showFlag}}">
+            <span
+              wx:if="{{item.status == 0 || item.status == 11 || item.status == 12 || item.status == 4}}">{{item.isAttend == 1 ?'已' : '待'}}上课</span>
+            <span wx:if="{{item.status == 2}}">已请假</span>
+            <span wx:if="{{item.status == 3}}">已调出</span>
+            <span wx:if="{{item.status == 11 || item.status == 12}}">加课</span>
+            <span wx:if="{{item.status == 5}}">补课</span>
+          </view>
+          <view class="class-btn-box" wx:if="{{showBtn}}">
+            <view class="add-btn class-btn" bindtap="toPages" data-url="/pages/targetList/targetList">申请加课</view>
+          </view>
+
+          <view wx:if="{{showLeaveNum}}" class="last-leave-num" bindtap="getLeaveNumList">本课程请假余额 6 次</view>
         </view>
-        <view class="class-teacher">老师:{{item.teacherName}}</view>
-      </view>
+      </radio-group>
     </view>
   </view>
 </view>

+ 16 - 0
pages/Components/classList/classList.wxss

@@ -53,5 +53,21 @@
   color: #005033;
   width: 100%;
 }
+.class-detail-box{
+  height: auto !important;
+}
+.class-btn-box{
+  margin-left: auto;
+}
+
+.class-btn{
+  width: 178rpx;
+    border: 2rpx solid #cc6031;
+    color: #cc6031;
+    text-align: center;
+    font-size: 28rpx;
+    border-radius: 50rpx;
+    margin-top: 30rpx;
+}
 
 /* end */

+ 106 - 0
pages/addClass/addClass.js

@@ -0,0 +1,106 @@
+// pages/addClass/addClass.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    list:[
+      {
+        
+      }
+    ],
+    loading: '上拉加载',
+    flag: 0,
+  },
+
+  getTip: function () {
+    wx.showModal({
+      title: '加课说明',
+      content: '1。加课课时将从剩余课时中划扣',
+      showCancel: false, //是否显示取消按钮
+      cancelText: "否", //默认是“取消”
+      cancelColor: '#999999', //取消文字的颜色
+      confirmText: "我知道了", //默认是“确定”
+      confirmColor: 'skyblue', //确定文字的颜色
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+    if (this.data.flag == 0) {
+      this.setData({
+        loading: '加载中',
+        flag: 1
+      })
+      setTimeout(() => {
+        this.setData({
+          list: [{},
+            {},
+            {},
+            {},
+            {},
+            {},
+            {},
+            {},
+            {},
+            {},
+          ],
+          loading: '没有更多数据',
+          flag: 2
+        })
+      }, 2000);
+    }
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 6 - 0
pages/addClass/addClass.json

@@ -0,0 +1,6 @@
+{
+  "navigationBarTitleText": "加课",
+  "usingComponents": {
+    "classList":"/pages/Components/classList/classList"
+  }
+}

+ 13 - 0
pages/addClass/addClass.wxml

@@ -0,0 +1,13 @@
+<view class="container">
+
+  <!-- 说明 -->
+  <view class="tip-view" bindtap="getTip">说明</view>
+  <!-- end -->
+
+  <!-- 加课列表 -->
+  <classList showBtn="{{true}}" showFlag="{{false}}" showTime="{{false}}" list="{{list}}"></classList>
+  <!-- end -->
+
+  <view class="loading">{{loading}}</view>
+
+</view>

+ 25 - 0
pages/addClass/addClass.wxss

@@ -0,0 +1,25 @@
+.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;
+}
+
+.loading {
+  height: 200rpx;
+  line-height: 100rpx;
+  background: #f1f1f1;
+  color: #999;
+  text-align: center;
+}

+ 1 - 1
pages/index/index.js

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

+ 6 - 1
pages/targetList/targetList.js

@@ -5,7 +5,12 @@ Page({
    * 页面的初始数据
    */
   data: {
-
+    list:[
+      {},
+      {},
+      {},
+      {},
+    ]
   },
 
   /**

+ 1 - 1
pages/targetList/targetList.wxml

@@ -1,6 +1,6 @@
 <view class="container">
   <view class="classList">
-    <classList showFlag="{{false}}"></classList>
+    <classList showFlag="{{false}}" showRadio="{{true}}" list="{{list}}"></classList>
   </view>
 
   <view class="submit-btn">确定</view>