zs 2 years ago
parent
commit
e2424faadd
1 changed files with 37 additions and 21 deletions
  1. 37 21
      pages/stuAdmin/course/sign.js

+ 37 - 21
pages/stuAdmin/course/sign.js

@@ -1,7 +1,7 @@
 const app = getApp()
 Page({
     data: {
-        frameStyle: { useTop: true, name: '报名', leftArrow: true, useBar: false },
+        frameStyle: { useTop: true, name: '详细信息', leftArrow: true, useBar: false },
         id: '',
         form: {},
         user: {},
@@ -131,28 +131,44 @@ Page({
             success: async res => {
                 that.setData({ user: res.data })
                 if (that.data.id) {
-                    const arr = await app.$post(`/lessonStudent/toComputed`, { lesson_id: that.data.id, student_id: res.data.info.id });
-                    if (arr.errcode == '0') {
-                        let status = statusList.find(i => i.value == arr.data.status)
-                        if (status) arr.data.zhStatus = status.label;
-                        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;
-                            const lesson = await app.$post(`/tryLessonApply/checkCanUse`, { school_id: arr.data.school_id, lesson_id: that.data.id, student_id: res.data.info.id })
-                            if (lesson.errcode == '0') arr.data.type_try = '0';
-                            else wx.showToast({ title: `${lesson.errmsg}`, icon: 'none', duration: 2000 })
-                            const lessonStudent = await app.$post(`/lessonStudent/checkCanUse`, { school_id: arr.data.school_id, student_id: res.data.info.id, lesson_id: that.data.id })
-                            if (lessonStudent.errcode == '0') arr.data.sign = '0';
-                            else arr.data.sign = '1';
+                    if (res.data.type == '3') {
+                        const arr = await app.$post(`/lessonStudent/toComputed`, { lesson_id: that.data.id, student_id: res.data.info.id });
+                        if (arr.errcode == '0') {
+                            let status = statusList.find(i => i.value == arr.data.status)
+                            if (status) arr.data.zhStatus = status.label;
+                            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;
+                                const lesson = await app.$post(`/tryLessonApply/checkCanUse`, { school_id: arr.data.school_id, lesson_id: that.data.id, student_id: res.data.info.id })
+                                if (lesson.errcode == '0') arr.data.type_try = '0';
+                                else wx.showToast({ title: `${lesson.errmsg}`, icon: 'none', duration: 2000 })
+                                const lessonStudent = await app.$post(`/lessonStudent/checkCanUse`, { school_id: arr.data.school_id, student_id: res.data.info.id, lesson_id: that.data.id })
+                                if (lessonStudent.errcode == '0') arr.data.sign = '0';
+                                else arr.data.sign = '1';
+                            }
+                            that.setData({ form: arr.data })
+                        } else {
+                            wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
+                        }
+                    }
+                    else {
+                        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;
+                            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 })
                         }
-                        const coach = await app.$get(`/lessonCoach`, { lesson_id: that.data.id })
-                        if (coach.errcode == '0') that.setData({ coach: coach.data })
-                        const student = await app.$get(`/lessonStudent`, { lesson_id: that.data.id, is_pay: '1' })
-                        if (student.errcode == '0') that.setData({ student: student.data })
-                        that.setData({ form: arr.data })
-                    } else {
-                        wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
                     }
+                    const coach = await app.$get(`/lessonCoach`, { lesson_id: that.data.id })
+                    if (coach.errcode == '0') that.setData({ coach: coach.data })
+                    const student = await app.$get(`/lessonStudent`, { lesson_id: that.data.id, is_pay: '1' })
+                    if (student.errcode == '0') that.setData({ student: student.data })
                 }
             },
             fail: async res => {