guhongwei 2 éve
szülő
commit
5cd00206cb

+ 0 - 1
commpents/upload/index.js

@@ -69,7 +69,6 @@ Component({
                 current: '',
                 urls: [item.url]
             })
-
         }
     }
 })

+ 64 - 21
pagesSchool/common/coachinfo.js

@@ -1,38 +1,88 @@
-const app = getApp();
+const app = getApp()
 Page({
-    /**
-     * 页面的初始数据
-     */
     data: {
-        frameStyle: { useTop: true, name: '教练详细信息', leftArrow: true, useBar: false },
+        frameStyle: { useTop: true, name: '教练信息', leftArrow: true, useBar: false },
+        id: '',
+        form: {},
+        // 性别
+        genderList: [],
+        //教练等级
+        levelList: [],
     },
     // 跳转菜单
     back(e) {
         wx.navigateBack({ delta: 1 })
     },
-
+    // 预览
+    toView(e) {
+        const { item } = e.currentTarget.dataset;
+        wx.previewImage({
+            current: '',
+            urls: [item.url]
+        })
+    },
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad: function (options) {
-
+    onLoad: async function (options) {
+        const that = this;
+        that.setData({ id: options.id || '' })
+        // 查询其他信息
+        await that.searchOther();
+        // 监听用户是否登录
+        await that.watchLogin();
+    },
+    searchOther: async function () {
+        const that = this;
+        let arr;
+        // 性别
+        arr = await app.$get(`/dict`, { code: 'gender' });
+        if (arr.errcode == '0' && arr.total > 0) that.setData({ genderList: arr.data[0].list });
+        // 教练等级
+        arr = await app.$get(`/dict`, { code: 'coach_grade' });
+        if (arr.errcode == '0' && arr.total > 0) that.setData({ levelList: arr.data[0].list });
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        let genderList = that.data.genderList;
+        let levelList = that.data.levelList;
+        let id = that.data.id;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                if (id) {
+                    let arr = await app.$get(`/coach/${id}`);
+                    if (arr.errcode == '0') {
+                        let gender = genderList.find(i => i.value == arr.data.gender)
+                        if (gender) arr.data.zhGender = gender.label;
+                        let level = levelList.find(i => i.value == arr.data.level)
+                        if (level) arr.data.zhLevel = level.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 () {
-
-    },
-
+    onReady: function () { },
     /**
      * 生命周期函数--监听页面显示
      */
     onShow: function () {
-        const that = this;
 
     },
 
-
+    /**
+     * 页面上拉触底事件的处理函数
+     */
     /**
      * 生命周期函数--监听页面隐藏
      */
@@ -54,13 +104,6 @@ Page({
 
     },
 
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom: function () {
-
-    },
-
     /**
      * 用户点击右上角分享
      */

+ 2 - 2
pagesSchool/common/coachinfo.json

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

+ 33 - 1
pagesSchool/common/coachinfo.less

@@ -1 +1,33 @@
-@import (css) "/app.wxss";
+@import (css) "/app.wxss";
+.main {
+    background-color: var(--mainColor);
+
+    .one {
+        width: 96vw;
+        padding: 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;
+            }
+        }
+    }
+}

+ 38 - 1
pagesSchool/common/coachinfo.wxml

@@ -1,5 +1,42 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
     <view slot="info" class="container main">
-        <view>教练详细信息</view>
+        <view class="one">
+            <view class="one_1">
+                <text class="text">头像:</text>
+                <image class="image" src="{{form.icon&&form.icon.length>0?form.icon[0].url:''}}" bindtap="toView" data-item="{{form.icon[0]}}"></image>
+            </view>
+            <view class="one_1">
+                <text class="text">姓名:</text>
+                <text class="text1">{{form.name||'暂无昵称'}}</text>
+            </view>
+            <view class="one_1">
+                <text class="text">性别:</text>
+                <text class="text1">{{form.zhGender||'暂无'}}</text>
+            </view>
+            <view class="one_1">
+                <text class="text">年龄:</text>
+                <text class="text1">{{form.age||'暂无'}}</text>
+            </view>
+            <view class="one_1">
+                <text class="text">电话:</text>
+                <text class="text1">{{form.phone||'暂无'}}</text>
+            </view>
+            <view class="one_1">
+                <text class="text">等级:</text>
+                <text class="text1">{{form.zhLevel||'暂无'}}</text>
+            </view>
+            <view class="one_1">
+                <text class="text">简介:</text>
+                <text class="text1">{{form.brief||'暂无'}}</text>
+            </view>
+            <view class="one_1">
+                <text class="text">荣誉:</text>
+                <text class="text1">{{form.honor||'暂无'}}</text>
+            </view>
+            <view class="one_1">
+                <text class="text">教学经历:</text>
+                <text class="text1">{{form.exp||'暂无'}}</text>
+            </view>
+        </view>
     </view>
 </mobile-main>

+ 27 - 0
pagesSchool/common/coachinfo.wxss

@@ -1 +1,28 @@
 @import "/app.wxss";
+.main {
+  background-color: var(--mainColor);
+}
+.main .one {
+  width: 96vw;
+  padding: 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;
+}

+ 53 - 23
pagesSchool/common/lessoninfo.js

@@ -1,38 +1,75 @@
-const app = getApp();
+const app = getApp()
 Page({
-    /**
-     * 页面的初始数据
-     */
     data: {
         frameStyle: { useTop: true, name: '课程详细信息', leftArrow: true, useBar: false },
+        id: '',
+        form: {},
+        user: {},
+        //状态
+        statusList: [],
     },
     // 跳转菜单
     back(e) {
         wx.navigateBack({ delta: 1 })
     },
-
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad: function (options) {
-
+    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 => {
+                that.setData({ user: res.data })
+                if (that.data.id) {
+                    const arr = await app.$get(`/lesson/${that.data.id}`);
+                    if (arr.errcode == '0') {
+                        // 课程状态
+                        let status = statusList.find(i => i.value == arr.data.status)
+                        if (status) arr.data.zhStatus = status.label;
+                        // 学校名称
+                        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 }) }
+                }
+            },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
     },
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
-    onReady: function () {
-
-    },
-
+    onReady: function () { },
     /**
      * 生命周期函数--监听页面显示
      */
-    onShow: function () {
-        const that = this;
-
-    },
-
+    onShow: function () {},
 
+    /**
+     * 页面上拉触底事件的处理函数
+     */
     /**
      * 生命周期函数--监听页面隐藏
      */
@@ -54,13 +91,6 @@ Page({
 
     },
 
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom: function () {
-
-    },
-
     /**
      * 用户点击右上角分享
      */

+ 2 - 2
pagesSchool/common/lessoninfo.json

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

+ 49 - 1
pagesSchool/common/lessoninfo.less

@@ -1 +1,49 @@
-@import (css) "/app.wxss";
+@import (css) "/app.wxss";
+
+.main {
+    height: var(--twoHeight);
+    background-color: var(--mainColor);
+
+    .one {
+        width: 96vw;
+        margin: 2vw 0 0 0;
+        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);
+            }
+
+            .name {
+                display: flex;
+                flex-direction: column;
+            }
+        }
+    }
+}
+
+.scroll-view {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+
+    .list-scroll-view {
+        display: flex;
+        flex-direction: column;
+    }
+}

+ 42 - 1
pagesSchool/common/lessoninfo.wxml

@@ -1,5 +1,46 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
     <view slot="info" class="container main">
-        <view>课程详细信息</view>
+        <scroll-view scroll-y="true" class="scroll-view">
+            <view class="list-scroll-view">
+                <form 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.zhSchool||'暂无'}}</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.money||'暂无'}}</text>
+                    </view>
+                    <view class="one_1">
+                        <text class="text">退款期限:</text>
+                        <text class="text1">{{form.refund_hour||'暂无'}}</text>
+                    </view>
+                    <view class="one_1">
+                        <text class="text">简介:</text>
+                        <text class="text1">{{form.brief||'暂无'}}</text>
+                    </view>
+                </form>
+            </view>
+        </scroll-view>
     </view>
 </mobile-main>

+ 40 - 0
pagesSchool/common/lessoninfo.wxss

@@ -1 +1,41 @@
 @import "/app.wxss";
+.main {
+  height: var(--twoHeight);
+  background-color: var(--mainColor);
+}
+.main .one {
+  width: 96vw;
+  margin: 2vw 0 0 0;
+  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 .name {
+  display: flex;
+  flex-direction: column;
+}
+.scroll-view {
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+}
+.scroll-view .list-scroll-view {
+  display: flex;
+  flex-direction: column;
+}

+ 1 - 1
pagesSchool/schAdmin/coach/add.js

@@ -82,7 +82,7 @@ Page({
      */
     onLoad: function (options) {
         const that = this;
-        that.setData({ id: options.id || '6355feb5cb0f85380e83533c' })
+        that.setData({ id: options.id || '' })
         //验证规则函数
         that.initValidate();
         // 监听用户是否登录

+ 2 - 2
pagesSchool/school/info.js

@@ -46,8 +46,8 @@ Page({
     },
     // 公共跳转
     toCommon(e) {
-        const { route, item } = e.currentTarget.dataset;
-        wx.navigateTo({ url: `/pagesSchool/${route}?id=${item._id}` })
+        const { route, id } = e.currentTarget.dataset;
+        wx.navigateTo({ url: `/pagesSchool/${route}?id=${id}` })
     },
     /**
      * 生命周期函数--监听页面加载

+ 2 - 2
pagesSchool/school/info.wxml

@@ -38,7 +38,7 @@
                 <scroll-view scroll-y="true" class="scroll-view">
                     <view class="list-scroll-view">
                         <view class="b_1">
-                            <view class="list" wx:for="{{teacherList}}" wx:key="index" bindtap="toCommon" data-route="common/coachinfo" data-item="{{item}}">
+                            <view class="list" wx:for="{{teacherList}}" wx:key="index" bindtap="toCommon" data-route="common/coachinfo" data-id="{{item.coach_id}}">
                                 <view class="list_1">
                                     <image class="image" src="{{item.coach_id_icon[0].url}}"></image>
                                 </view>
@@ -60,7 +60,7 @@
                 <scroll-view scroll-y="true" class="scroll-view">
                     <view class="list-scroll-view">
                         <view class="c_1">
-                            <view class="list" wx:for="{{lessonList}}" wx:key="index" bindtap="toCommon" data-route="common/lessoninfo" data-item="{{item}}">
+                            <view class="list" wx:for="{{lessonList}}" wx:key="index" bindtap="toCommon" data-route="common/lessoninfo" data-id="{{item._id}}">
                                 <view class="name">{{item.title}}</view>
                                 <view class="other_1">
                                     <text>{{item.time_start}}至{{item.time_end}}</text>

+ 4 - 0
project.config.json

@@ -46,6 +46,10 @@
         "minifyWXML": true,
         "showES6CompileOption": false,
         "useCompilerPlugins": false,
+<<<<<<< HEAD
+=======
+        "useStaticServer": true,
+>>>>>>> 2ed9f469602b4098ae93acdd19f54c90a7e4c7d5
         "ignoreUploadUnusedFiles": true
     },
     "compileType": "miniprogram",