zs před 2 roky
rodič
revize
4ecb9df040

+ 11 - 5
pagesSchool/coaAdmin/course/list.js

@@ -32,21 +32,27 @@ Page({
         const that = this;
         that.setData({ list: [], skip: 0, limit: 6, page: 0 })
     },
+    // 详细信息
+    toView(e) {
+        const that = this;
+        let { item } = e.currentTarget.dataset;
+        that.clearPage();
+        wx.navigateTo({ url: `/pagesSchool/common/lessoninfo?id=${item.lesson_id}` })
+    },
     // 学员管理
     toManage(e) {
         const that = this;
         let { item } = e.currentTarget.dataset;
         that.clearPage();
         wx.navigateTo({
-            url: `/pagesSchool/common/lessonstudent`,
+            url: `/pagesSchool/common/lessonstudent?id=${item.lesson_id}`,
         })
     },
-    // 详细信息
-    toView(e) {
+    // 临时上课学员
+    toTem(e) {
         const that = this;
         let { item } = e.currentTarget.dataset;
-        that.clearPage();
-        wx.navigateTo({ url: `/pagesSchool/common/lessoninfo?id=${item.lesson_id}` })
+        console.log(item);
     },
     /**
      * 生命周期函数--监听页面加载

+ 1 - 0
pagesSchool/coaAdmin/course/list.wxml

@@ -25,6 +25,7 @@
                         <view class="btn">
                             <button type="primary" size="mini" bindtap="toView" data-item="{{item}}">详细信息</button>
                             <button type="primary" size="mini" bindtap="toManage" data-item="{{item}}">学员管理</button>
+                            <button type="primary" size="mini" bindtap="toTem" data-item="{{item}}">临时上课学员</button>
                         </view>
                     </view>
                 </view>

+ 79 - 16
pagesSchool/common/lessonstudent.js

@@ -1,66 +1,129 @@
-// pagesSchool/common/lessonstudent.js
+const app = getApp();
 Page({
-
     /**
      * 页面的初始数据
      */
     data: {
-
+        frameStyle: { useTop: true, name: '学员信息', leftArrow: true, useBar: false },
+        id: '',
+        // 查询
+        search: {},
+        list: [],
+        total: 0,
+        skip: 0,
+        limit: 6,
+        page: 0,
+    },
+    // 跳转菜单
+    back(e) {
+        wx.navigateBack({ delta: 1 })
+    },
+    // 查询
+    toInput(e) {
+        const that = this;
+        let value = e.detail.value;
+        if (value) that.setData({ 'search.student_id_name': value })
+        else that.setData({ search: {} })
+        that.clearPage(); that.watchLogin();
+    },
+    // 清空列表
+    clearPage() {
+        const that = this;
+        that.setData({ list: [], skip: 0, limit: 6, page: 0 })
+    },
+    // 签到
+    toSign(e) {
+        const that = this;
+        let { item } = e.currentTarget.dataset;
+        console.log(item);
     },
-
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad(options) {
-
+    onLoad: async function (options) {
+        const that = this;
+        await that.setData({ id: options.id || '' })
+        // 监听用户是否登录
+        await that.watchLogin();
+    },
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                let info = { skip: that.data.skip, limit: that.data.limit, lesson_id: that.data.id };
+                const arr = await app.$get(`/lessonStudent`, { ...info, ...that.data.search });
+                if (arr.errcode == '0') {
+                    let list = [...that.data.list, ...arr.data];
+                    that.setData({ list });
+                    that.setData({ total: arr.total })
+                }
+                else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }); }
+            },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
+    },
+    // 分页
+    toPage: function () {
+        const that = this;
+        let list = that.data.list;
+        let limit = that.data.limit;
+        if (that.data.total > list.length) {
+            wx.showLoading({ title: '加载中', mask: true })
+            let page = that.data.page + 1;
+            that.setData({ page: page })
+            let skip = page * limit;
+            that.setData({ skip: skip })
+            that.watchLogin();
+            wx.hideLoading()
+        } else { wx.showToast({ title: '没有更多数据了', icon: 'none', duration: 2000 }) }
     },
-
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
-    onReady() {
+    onReady: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面显示
      */
-    onShow() {
-
-    },
+    onShow: async function () { },
 
     /**
      * 生命周期函数--监听页面隐藏
      */
-    onHide() {
+    onHide: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面卸载
      */
-    onUnload() {
+    onUnload: function () {
 
     },
 
     /**
      * 页面相关事件处理函数--监听用户下拉动作
      */
-    onPullDownRefresh() {
+    onPullDownRefresh: function () {
 
     },
 
     /**
      * 页面上拉触底事件的处理函数
      */
-    onReachBottom() {
+    onReachBottom: function () {
 
     },
 
     /**
      * 用户点击右上角分享
      */
-    onShareAppMessage() {
+    onShareAppMessage: function () {
 
     }
 })

+ 4 - 1
pagesSchool/common/lessonstudent.json

@@ -1,3 +1,6 @@
 {
-    "usingComponents": {}
+    "component": true,
+    "usingComponents": {
+        "mobile-main": "/commpents/mobile-frame/index"
+    }
 }

+ 93 - 0
pagesSchool/common/lessonstudent.less

@@ -0,0 +1,93 @@
+@import (css) "/app.wxss";
+
+.main {
+    height: 91vh;
+
+    .one {
+        padding: 2vw;
+        border-bottom: 1px solid #858585;
+        margin: 0 0 2vw 0;
+
+        input {
+            padding: 2vw;
+            font-size: 12px;
+            border-radius: 5px;
+            background-color: #fff;
+        }
+    }
+
+    .two {
+        position: relative;
+        flex-grow: 1;
+        width: 96vw;
+        margin: 0 2vw;
+
+        .list {
+            display: flex;
+            align-items: center;
+            padding: 2vw;
+            margin: 0 0 2vw 0;
+            border: 1px dashed #858585;
+            border-radius: 5px;
+
+            .list_1 {
+                width: 20vw;
+                height: 20vw;
+
+                .image {
+                    width: 100%;
+                    height: 100%;
+                    border-radius: 90px;
+                }
+            }
+
+            .list_2 {
+                width: 60vw;
+                padding: 0 0 0 2vw;
+
+                .name {
+                    font-size: 16px;
+                    font-weight: bold;
+                    margin: 0 0 2vw 0;
+                }
+
+                .other_1 {
+                    font-size: 14px;
+                    color: #858585;
+                    margin: 0 0 1vw 0;
+
+                    text:last-child {
+                        color: #000000;
+                    }
+                }
+            }
+
+            .btn {
+                width: 20vw;
+                text-align: center;
+
+                button {
+                    margin: 0 2vw 2vw 2vw;
+                    font-size: 14px;
+                }
+            }
+        }
+
+        .list:last-child {
+            margin: 0;
+        }
+    }
+}
+
+.scroll-view {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+
+    .list-scroll-view {
+        display: flex;
+        flex-direction: column;
+    }
+}

+ 32 - 2
pagesSchool/common/lessonstudent.wxml

@@ -1,2 +1,32 @@
-<!--pagesSchool/common/lessonstudent.wxml-->
-<text>pagesSchool/common/lessonstudent.wxml</text>
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        <view class="one">
+            <input type="text" value="{{search.title}}" bindconfirm="toInput" placeholder="请输入关键词" />
+        </view>
+        <view class="two">
+            <scroll-view scroll-y="true" class="scroll-view" bindscrolltolower="toPage">
+                <view class="list-scroll-view">
+                    <view class="list" wx:for="{{list}}" wx:key="index">
+                        <view class="list_1">
+                            <image class="image" src="{{item.student_id_icon.length>0?item.student_id_icon[0].url:iconUrl}}"></image>
+                        </view>
+                        <view class="list_2">
+                            <view class="name">{{item.student_id_name}}</view>
+                            <view class="other_1">
+                                <text>联系电话:</text>
+                                <text>{{item.student_id_phone||'暂无'}}</text>
+                            </view>
+                            <view class="other_1">
+                                <text>是否签到:</text>
+                                <text>{{item.is_sign=='0'?'未签到':'已签到'}}</text>
+                            </view>
+                        </view>
+                        <view class="btn">
+                            <button type="primary" size="mini" bindtap="toSign" data-item="{{item}}">签到</button>
+                        </view>
+                    </view>
+                </view>
+            </scroll-view>
+        </view>
+    </view>
+</mobile-main>

+ 77 - 1
pagesSchool/common/lessonstudent.wxss

@@ -1 +1,77 @@
-/* pagesSchool/common/lessonstudent.wxss */
+@import "/app.wxss";
+.main {
+  height: 91vh;
+}
+.main .one {
+  padding: 2vw;
+  border-bottom: 1px solid #858585;
+  margin: 0 0 2vw 0;
+}
+.main .one input {
+  padding: 2vw;
+  font-size: 12px;
+  border-radius: 5px;
+  background-color: #fff;
+}
+.main .two {
+  position: relative;
+  flex-grow: 1;
+  width: 96vw;
+  margin: 0 2vw;
+}
+.main .two .list {
+  display: flex;
+  align-items: center;
+  padding: 2vw;
+  margin: 0 0 2vw 0;
+  border: 1px dashed #858585;
+  border-radius: 5px;
+}
+.main .two .list .list_1 {
+  width: 20vw;
+  height: 20vw;
+}
+.main .two .list .list_1 .image {
+  width: 100%;
+  height: 100%;
+  border-radius: 90px;
+}
+.main .two .list .list_2 {
+  width: 60vw;
+  padding: 0 0 0 2vw;
+}
+.main .two .list .list_2 .name {
+  font-size: 16px;
+  font-weight: bold;
+  margin: 0 0 2vw 0;
+}
+.main .two .list .list_2 .other_1 {
+  font-size: 14px;
+  color: #858585;
+  margin: 0 0 1vw 0;
+}
+.main .two .list .list_2 .other_1 text:last-child {
+  color: #000000;
+}
+.main .two .list .btn {
+  width: 20vw;
+  text-align: center;
+}
+.main .two .list .btn button {
+  margin: 0 2vw 2vw 2vw;
+  font-size: 14px;
+}
+.main .two .list:last-child {
+  margin: 0;
+}
+.scroll-view {
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+}
+.scroll-view .list-scroll-view {
+  display: flex;
+  flex-direction: column;
+}