guhongwei 2 years ago
parent
commit
8b66618542
2 changed files with 23 additions and 7 deletions
  1. 13 6
      pages/school/info.js
  2. 10 1
      pages/school/info.wxml

+ 13 - 6
pages/school/info.js

@@ -12,8 +12,12 @@ Page({
             menu: [
                 { title: '羽校信息', active: '0' },
                 { title: '师资信息', active: '1' },
+                { title: '公开课', active: '2' },
+                { title: '私教课', active: '3' },
             ]
         },
+        // 公开课
+        openList: []
     },
     // 跳转菜单
     back(e) {
@@ -60,12 +64,15 @@ Page({
             success: async res => {
                 that.setData({ user: res.data })
                 if (that.data.id) {
-                    const arr = await app.$get(`/school/${that.data.id}`)
-                    if (arr.errcode == '0') {
-                        that.setData({ form: arr.data })
-                    } else {
-                        wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
-                    }
+                    let arr;
+                    // 学校信息
+                    arr = await app.$get(`/school/${that.data.id}`)
+                    if (arr.errcode == '0') { that.setData({ form: arr.data }) }
+                    else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
+                    // 公开课
+                    arr = await app.$get(`/lessonPublic`, { school_id: that.data.id, status: '1' });
+                    if (arr.errcode == '0') { that.setData({ openList: arr.data }) }
+                    else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
                 }
             },
             fail: async res => {

+ 10 - 1
pages/school/info.wxml

@@ -10,7 +10,16 @@
                     <text class="school_txt" bindtap="toApply">申请入学</text>
                 </view>
             </view>
-            <view wx:elif="{{tabs.active=='1'}}" class="b">第二</view>
+            <view wx:elif="{{tabs.active=='1'}}" class="b">师资信息</view>
+            <view wx:elif="{{tabs.active=='2'}}" class="c">
+                <view class="cList" wx:for="{{openList}}" wx:key="index">
+                    <view class="name">{{item.title}}</view>
+                    <view class="btn">
+                        <button type="primary" size="mini">报名</button>
+                    </view>
+                </view>
+            </view>
+            <view wx:elif="{{tabs.active=='3'}}" class="d">私教课</view>
         </view>
     </view>
 </mobile-main>