فهرست منبع

Merge branch 'master' of http://git.cc-lotus.info/ball-court/ball-applet

YY 2 سال پیش
والد
کامیت
31485b3485

+ 1 - 1
app.json

@@ -41,7 +41,6 @@
         "pages/soneapply/list",
         "pages/soneapply/info",
         "pages/sonecoachstat/list",
-
         "pages/stuAdmin/archives/list",
         "pages/stuAdmin/coach/list",
         "pages/stuAdmin/coach/info",
@@ -49,6 +48,7 @@
         "pages/stuAdmin/school/info",
         "pages/stuAdmin/open/list",
         "pages/stuAdmin/open/info",
+        "pages/stuAdmin/open/sign",
         "pages/stuAdmin/private/list",
         "pages/stuAdmin/private/info",
         "pages/stuAdmin/study/list",

+ 6 - 0
pages/school/info.js

@@ -47,6 +47,12 @@ Page({
             }
         });
     },
+    //报名
+    toSign: function (e) {
+        const that = this;
+        const { item } = e.currentTarget.dataset;
+        wx.navigateTo({ url: `/pages/stuAdmin/open/sign?id=${item._id}` })
+    },
     /**
      * 生命周期函数--监听页面加载
      */

+ 1 - 1
pages/school/info.wxml

@@ -15,7 +15,7 @@
                 <view class="cList" wx:for="{{openList}}" wx:key="index">
                     <view class="name">{{item.title}}</view>
                     <view class="btn">
-                        <button type="primary" size="mini">报名</button>
+                        <button type="primary" size="mini" bindtap="toSign" data-item="{{item}}">报名</button>
                     </view>
                 </view>
             </view>

+ 1 - 1
pages/stuAdmin/open/info.js

@@ -40,7 +40,7 @@ Page({
                     const arr = await app.$get(`/lessonPublic/${that.data.id}`);
                     if (arr.errcode == '0') {
                         let status = statusList.find(i => i.value == arr.data.status)
-                        if (status) arr.data.zhStatus = level.label;
+                        if (status) arr.data.zhStatus = status.label;
                         that.setData({ form: arr.data })
                     } else {
                         wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })

+ 5 - 0
pages/stuAdmin/open/info.less

@@ -27,6 +27,11 @@
                 width: 15vw;
                 height: 15vw;
             }
+
+            .name {
+                display: flex;
+                flex-direction: column;
+            }
         }
     }
 }

+ 6 - 6
pages/stuAdmin/open/info.wxml

@@ -29,16 +29,16 @@
                 <text class="text">简介:</text>
                 <text class="text1">{{form.brief||'暂无'}}</text>
             </view>
-            <view class="one_1">
+            <view class="one_1" wx:if="{{form.coach_id&&form.coach_id.length>0}}">
                 <text class="text">教练人员:</text>
-                <view class="name" wx:if="{{form.coach_id&&item.coach_id.length>0}}" wx:for="{{form.coach_id}}" wx:key="item">
-                    <text class="text1">姓名:{{item.name||'暂无'}}</text>
+                <view class="name">
+                    <text wx:for="{{form.coach_id}}" wx:key="item" class="text1 textOver">姓名:{{item.name||'暂无'}} 金额:¥{{item.money||'0'}}元</text>
                 </view>
             </view>
-            <view class="one_1">
+            <view class="one_1" wx:if="{{form.student&&form.student.length>0}}">
                 <text class="text">学生人员:</text>
-                <view class="name" wx:if="{{form.student&&item.student.length>0}}" wx:for="{{form.student}}" wx:key="item">
-                    <text class="text1">姓名:{{item.name||'暂无'}}</text>
+                <view class="name">
+                    <text wx:for="{{form.student}}" wx:key="item" class="text1 textOver">姓名:{{item.name||'暂无'}}</text>
                 </view>
             </view>
         </view>

+ 4 - 0
pages/stuAdmin/open/info.wxss

@@ -25,3 +25,7 @@
   width: 15vw;
   height: 15vw;
 }
+.main .one .one_1 .name {
+  display: flex;
+  flex-direction: column;
+}

+ 1 - 1
pages/stuAdmin/open/list.js

@@ -74,7 +74,7 @@ Page({
                 let arr = await app.$get(`/lessonPublic`, { ...info });
                 if (arr.errcode == '0') {
                     for (const val of arr.data) {
-                        if (val.student.length > 0) {
+                        if (val.student) {
                             let student = val.student.find(i => i._id == res.data.info.id);
                             if (student) {
                                 let status = statusList.find(i => i.value == val.status); if (status) val.zhStatus = status.label;

+ 1 - 1
pages/stuAdmin/open/list.wxml

@@ -10,7 +10,7 @@
                         <view class="list_1">
                             <view class="name textOver">{{item.title||'暂无'}}</view>
                             <view class="other">
-                                <view class="other_1 textOver"><text>金额:</text><text>¥{{item.money||'暂无'}}元</text></view>
+                                <!-- <view class="other_1 textOver"><text>金额:</text><text>¥{{item.money||'暂无'}}元</text></view> -->
                                 <view class="other_1 textOver"><text>状态:</text><text>{{item.zhStatus||'暂无'}}</text></view>
                                 <view class="other_1 textOver"><text>人数上限:</text><text>{{item.limit||'暂无'}}人</text></view>
                                 <view class="other_1 textOver"><text>上课时间:</text><text>{{item.time_start||'暂无'}}-{{item.time_end||'暂无'}}</text></view>

+ 115 - 0
pages/stuAdmin/open/sign.js

@@ -0,0 +1,115 @@
+const app = getApp()
+Page({
+    data: {
+        frameStyle: { useTop: true, name: '公开课信息', leftArrow: true, useBar: false },
+        id: '',
+        form: {},
+        //状态
+        statusList: []
+    },
+    // 跳转菜单
+    back(e) {
+        wx.navigateBack({ delta: 1 })
+    },
+    //提交
+    onSubmit: async function (e) {
+        const that = this;
+        const form = that.data.form;
+        const params = e.detail.value;
+        params.icon = form.icon;
+        params.school_id = that.data.school_id;
+        if (!this.WxValidate.checkForm(params)) {
+            const error = this.WxValidate.errorList[0];
+            wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+            return false
+        } else {
+            let arr;
+            if (form._id) arr = await app.$post(`/student/${form._id}`, params);
+            else arr = await app.$post(`/student`, params)
+            if (arr.errcode == '0') { wx.showToast({ title: `维护信息完成`, icon: 'success', duration: 2000 }); that.back(); }
+            else wx.showToast({ title: `${errmsg}`, icon: 'error', duration: 2000 })
+        }
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: async function (options) {
+        const that = this;
+        await that.setData({ id: options.id || null })
+        // 查询其他信息
+        await that.searchOther();
+        // 监听用户是否登录
+        await that.watchLogin();
+    },
+    searchOther: async function () {
+        const that = this;
+        let arr;
+        // 状态
+        arr = await app.$get(`/dict`, { code: 'lesson_status' });
+        if (arr.errcode == '0' && arr.total > 0) that.setData({ statusList: arr.data[0].list });
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        let statusList = that.data.statusList;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                if (that.data.id) {
+                    const arr = await app.$get(`/lessonPublic/${that.data.id}`);
+                    if (arr.errcode == '0') {
+                        let status = statusList.find(i => i.value == arr.data.status)
+                        if (status) arr.data.zhStatus = status.label;
+                        that.setData({ form: arr.data })
+                    } else {
+                        wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
+                    }
+                }
+            },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () { },
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 6 - 0
pages/stuAdmin/open/sign.json

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

+ 37 - 0
pages/stuAdmin/open/sign.less

@@ -0,0 +1,37 @@
+.main {
+    background-color: var(--mainColor);
+
+    .one {
+        width: 96vw;
+        padding: 0 2vw;
+
+        .one_1 {
+            display: flex;
+            flex-direction: row;
+            justify-content: space-between;
+            border: 1px dashed var(--f85Color);
+            border-radius: 5px;
+            margin: 0 0 10px 0;
+            padding: 10px;
+
+            .text {
+                color: var(--f85Color);
+                font-size: var(--font16Size);
+            }
+
+            .text1 {
+                font-size: var(--font16Size);
+            }
+
+            .image {
+                width: 15vw;
+                height: 15vw;
+            }
+
+            .name {
+                display: flex;
+                flex-direction: column;
+            }
+        }
+    }
+}

+ 49 - 0
pages/stuAdmin/open/sign.wxml

@@ -0,0 +1,49 @@
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        <view class="one" catchsubmit="onSubmit">
+            <view class="one_1">
+                <text class="text">课程标题:</text>
+                <text class="text1">{{form.title||'暂无'}}</text>
+            </view>
+            <view class="one_1">
+                <text class="text">学校名称:</text>
+                <text class="text1">{{form.school_id_name||'暂无'}}</text>
+            </view>
+            <view class="one_1">
+                <text class="text">人数上限:</text>
+                <text class="text1">{{form.limit||'暂无'}}人</text>
+            </view>
+            <view class="one_1">
+                <text class="text">开始时间:</text>
+                <text class="text1">{{form.time_start||'暂无'}}</text>
+            </view>
+            <view class="one_1">
+                <text class="text">结束时间:</text>
+                <text class="text1">{{form.time_end||'暂无'}}</text>
+            </view>
+            <view class="one_1">
+                <text class="text">状态:</text>
+                <text class="text1">{{form.zhStatus||'暂无'}}</text>
+            </view>
+            <view class="one_1">
+                <text class="text">简介:</text>
+                <text class="text1">{{form.brief||'暂无'}}</text>
+            </view>
+            <view class="one_1" wx:if="{{form.coach_id&&form.coach_id.length>0}}">
+                <text class="text">教练人员:</text>
+                <view class="name">
+                    <text wx:for="{{form.coach_id}}" wx:key="item" class="text1 textOver">姓名:{{item.name||'暂无'}} 金额:¥{{item.money||'0'}}元</text>
+                </view>
+            </view>
+            <view class="one_1" wx:if="{{form.student&&form.student.length>0}}">
+                <text class="text">学生人员:</text>
+                <view class="name">
+                    <text wx:for="{{form.student}}" wx:key="item" class="text1 textOver">姓名:{{item.name||'暂无'}}</text>
+                </view>
+            </view>
+            <view class="btn">
+                <button type="primary" size="mini" formType="submit">提交保存</button>
+            </view>
+        </view>
+    </view>
+</mobile-main>

+ 31 - 0
pages/stuAdmin/open/sign.wxss

@@ -0,0 +1,31 @@
+.main {
+  background-color: var(--mainColor);
+}
+.main .one {
+  width: 96vw;
+  padding: 0 2vw;
+}
+.main .one .one_1 {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  border: 1px dashed var(--f85Color);
+  border-radius: 5px;
+  margin: 0 0 10px 0;
+  padding: 10px;
+}
+.main .one .one_1 .text {
+  color: var(--f85Color);
+  font-size: var(--font16Size);
+}
+.main .one .one_1 .text1 {
+  font-size: var(--font16Size);
+}
+.main .one .one_1 .image {
+  width: 15vw;
+  height: 15vw;
+}
+.main .one .one_1 .name {
+  display: flex;
+  flex-direction: column;
+}

+ 10 - 2
pages/stuAdmin/private/info.js

@@ -37,10 +37,18 @@ Page({
             key: 'user',
             success: async res => {
                 if (that.data.id) {
-                    const arr = await app.$get(`/lessonPublic/${that.data.id}`);
+                    const arr = await app.$get(`/lessonPrivate/${that.data.id}`);
                     if (arr.errcode == '0') {
                         let status = statusList.find(i => i.value == arr.data.status)
-                        if (status) arr.data.zhStatus = level.label;
+                        if (status) arr.data.zhStatus = status.label;
+                        if (arr.data.coach_id) {
+                            const coach = await app.$get(`/coach/${arr.data.coach_id}`);
+                            if (coach.errcode == '0') arr.data.zhCoach = coach.data.name;
+                        }
+                        if (arr.data.school_id) {
+                            const school = await app.$get(`/school/${arr.data.school_id}`)
+                            if (school.errcode == '0') arr.data.zhSchool = school.data.name;
+                        }
                         that.setData({ form: arr.data })
                     } else {
                         wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })

+ 5 - 7
pages/stuAdmin/private/info.wxml

@@ -7,7 +7,7 @@
             </view>
             <view class="one_1">
                 <text class="text">学校名称:</text>
-                <text class="text1">{{form.school_id_name||'暂无'}}</text>
+                <text class="text1">{{form.zhSchool||'暂无'}}</text>
             </view>
             <view class="one_1">
                 <text class="text">人数上限:</text>
@@ -31,14 +31,12 @@
             </view>
             <view class="one_1">
                 <text class="text">教练人员:</text>
-                <view class="name" wx:if="{{form.coach_id&&item.coach_id.length>0}}" wx:for="{{form.coach_id}}" wx:key="item">
-                    <text class="text1">姓名:{{item.name||'暂无'}}</text>
-                </view>
+                <text class="text1">{{form.zhCoach||'暂无'}}</text>
             </view>
-            <view class="one_1">
+            <view class="one_1" wx:if="{{form.student&&form.student.length>0}}">
                 <text class="text">学生人员:</text>
-                <view class="name" wx:if="{{form.student&&item.student.length>0}}" wx:for="{{form.student}}" wx:key="item">
-                    <text class="text1">姓名:{{item.name||'暂无'}}</text>
+                <view class="name">
+                    <text wx:for="{{form.student}}" wx:key="item" class="text1 textOver">姓名:{{item.name||'暂无'}}</text>
                 </view>
             </view>
         </view>