guhongwei 2 lat temu
rodzic
commit
22ffc9064a

+ 1 - 0
pages/index/index.js

@@ -65,6 +65,7 @@ Page({
                 // /pagesSchool/common/lessoninfo
                 // /pagesSchool/schAdmin/course/coachlist
                 // /pagesSchool/stuAdmin/money/list
+                // /pagesSchool/stuAdmin/course/list
             },
             fail: async res => {
                 wx.login({

+ 9 - 13
pagesSchool/stuAdmin/course/list.less

@@ -1,35 +1,31 @@
 @import (css) "/app.wxss";
 
 .main {
-    height: var(--twoHeight);
-    background-color: var(--mainColor);
-
+    height: 91vh;
 
     .one {
-        width: 96vw;
         padding: 2vw;
-        border-bottom: 1px solid var(--f1Color);
+        border-bottom: 1px solid #858585;
+        margin: 0 0 2vw 0;
 
         input {
-            padding: 1vw 0 2vw 2vw;
-            background-color: var(--f1Color);
+            padding: 2vw;
+            font-size: 12px;
             border-radius: 5px;
+            background-color: #fff;
         }
     }
 
     .two {
         position: relative;
         flex-grow: 1;
-        background-color: var(--whiteColor);
-        padding: 0 2vw;
 
         .list {
-            background-color: var(--f9Color);
-            margin: 0 0 2vw 0;
-            padding: 2vw;
+            text-align: center;
             margin: 0 2vw 2vw 2vw;
+            padding: 2vw;
+            background-color: #fff;
             border-radius: 5px;
-            text-align: center;
 
             .name {
                 font-size: var(--font16Szie);

+ 9 - 12
pagesSchool/stuAdmin/course/list.wxss

@@ -1,31 +1,28 @@
 @import "/app.wxss";
 .main {
-  height: var(--twoHeight);
-  background-color: var(--mainColor);
+  height: 91vh;
 }
 .main .one {
-  width: 96vw;
   padding: 2vw;
-  border-bottom: 1px solid var(--f1Color);
+  border-bottom: 1px solid #858585;
+  margin: 0 0 2vw 0;
 }
 .main .one input {
-  padding: 1vw 0 2vw 2vw;
-  background-color: var(--f1Color);
+  padding: 2vw;
+  font-size: 12px;
   border-radius: 5px;
+  background-color: #fff;
 }
 .main .two {
   position: relative;
   flex-grow: 1;
-  background-color: var(--whiteColor);
-  padding: 0 2vw;
 }
 .main .two .list {
-  background-color: var(--f9Color);
-  margin: 0 0 2vw 0;
-  padding: 2vw;
+  text-align: center;
   margin: 0 2vw 2vw 2vw;
+  padding: 2vw;
+  background-color: #fff;
   border-radius: 5px;
-  text-align: center;
 }
 .main .two .list .name {
   font-size: var(--font16Szie);

+ 72 - 3
pagesSchool/stuAdmin/school/list.js

@@ -5,12 +5,41 @@ Page({
      */
     data: {
         frameStyle: { useTop: true, name: '羽校信息', leftArrow: true, useBar: false },
+        user: {},
+        // 查询
+        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.name': value })
+        else that.setData({ search: {} })
+        that.clearPage(); that.watchLogin();
+    },
+    // 清空列表
+    clearPage() {
+        const that = this;
+        that.setData({ list: [], skip: 0, limit: 6, page: 0 })
+    },
+    // 详细信息
+    toView: function (e) {
+        const that = this;
+        const { item } = e.currentTarget.dataset;
+        that.clearPage()
+        wx.navigateTo({
+            url: `/pagesSchool/school/info?id=${item.school_id}`,
+        })
+    },
     /**
      * 生命周期函数--监听页面加载
      */
@@ -27,9 +56,49 @@ Page({
     /**
      * 生命周期函数--监听页面显示
      */
-    onShow: function () {
+    onShow: async function () {
         const that = this;
-
+        // 监听用户是否登录
+        await that.watchLogin();
+    },
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                that.setData({ user: res.data });
+                that.search()
+            },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
+    },
+    async search() {
+        const that = this;
+        let user = that.data.user;
+        let info = { skip: that.data.skip, limit: that.data.limit, student_id: user.info.id };
+        let arr = await app.$get(`/rss`, { ...info });
+        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' }) }
+    },
+    // 分页
+    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.search();
+            wx.hideLoading()
+        } else { wx.showToast({ title: '没有更多数据了', icon: 'none', duration: 2000 }) }
     },
 
 

+ 95 - 1
pagesSchool/stuAdmin/school/list.less

@@ -1 +1,95 @@
-@import (css) "/app.wxss";
+@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;
+
+
+        .list {
+            margin: 0 2vw 2vw 2vw;
+            padding: 2vw;
+            background-color: #fff;
+            border-radius: 5px;
+
+            .list_1 {
+                display: flex;
+                margin: 0 0 1vw 0;
+
+                .img {
+                    width: 20vw;
+                    height: 20vw;
+
+                    .image {
+                        width: 100%;
+                        height: 100%;
+                        border: 1px solid #f1f1f1;
+                        border-radius: 90px;
+                    }
+                }
+
+                .info {
+                    width: 70vw;
+                    padding: 0 0 0 2vw;
+
+                    .name {
+                        font-size: 16px;
+                        margin: 0 0 1vw 0;
+                        font-weight: bold;
+                    }
+
+                    .other_1 {
+                        font-size: 14px;
+                        margin: 0 0 1vw 0;
+                        color: #858585;
+
+                        text:last-child {
+                            color: #000000;
+                        }
+                    }
+                }
+            }
+
+            .btn {
+                text-align: center;
+
+                button {
+                    margin: 0 2vw;
+                    font-size: 14px;
+                }
+            }
+        }
+
+        .list:last-child {
+            margin: 0 2vw 0 2vw;
+        }
+    }
+}
+
+.scroll-view {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+
+    .list-scroll-view {
+        display: flex;
+        flex-direction: column;
+    }
+}

+ 28 - 1
pagesSchool/stuAdmin/school/list.wxml

@@ -1,5 +1,32 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
     <view slot="info" class="container main">
-        <view>羽校信息</view>
+        <view class="one">
+            <input type="text" value="{{search.name}}" 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">
+                            <view class="img">
+                                <image class="image" src="{{item.school_id_yyzz.length>0?item.school_id_yyzz[0].url:''}}"></image>
+                            </view>
+                            <view class="info">
+                                <view class="name">{{item.school_id_name}}</view>
+                                <view class="other_1">
+                                    <text>联系电话:{{item.school_id_phone||'暂无'}}</text>
+                                </view>
+                                <view class="other_1">
+                                    <text>通讯地址:{{item.school_id_address||'暂无'}}</text>
+                                </view>
+                            </view>
+                        </view>
+                        <view class="btn">
+                            <button type="primary" size="mini" bindtap="toView" data-item="{{item}}">详细信息</button>
+                        </view>
+                    </view>
+                </view>
+            </scroll-view>
+        </view>
     </view>
 </mobile-main>

+ 77 - 1
pagesSchool/stuAdmin/school/list.wxss

@@ -1 +1,77 @@
-@import "/app.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;
+}
+.main .two .list {
+  margin: 0 2vw 2vw 2vw;
+  padding: 2vw;
+  background-color: #fff;
+  border-radius: 5px;
+}
+.main .two .list .list_1 {
+  display: flex;
+  margin: 0 0 1vw 0;
+}
+.main .two .list .list_1 .img {
+  width: 20vw;
+  height: 20vw;
+}
+.main .two .list .list_1 .img .image {
+  width: 100%;
+  height: 100%;
+  border: 1px solid #f1f1f1;
+  border-radius: 90px;
+}
+.main .two .list .list_1 .info {
+  width: 70vw;
+  padding: 0 0 0 2vw;
+}
+.main .two .list .list_1 .info .name {
+  font-size: 16px;
+  margin: 0 0 1vw 0;
+  font-weight: bold;
+}
+.main .two .list .list_1 .info .other_1 {
+  font-size: 14px;
+  margin: 0 0 1vw 0;
+  color: #858585;
+}
+.main .two .list .list_1 .info .other_1 text:last-child {
+  color: #000000;
+}
+.main .two .list .btn {
+  text-align: center;
+}
+.main .two .list .btn button {
+  margin: 0 2vw;
+  font-size: 14px;
+}
+.main .two .list:last-child {
+  margin: 0 2vw 0 2vw;
+}
+.scroll-view {
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+}
+.scroll-view .list-scroll-view {
+  display: flex;
+  flex-direction: column;
+}