lex-xin пре 3 година
родитељ
комит
7c55763275
3 измењених фајлова са 56 додато и 22 уклоњено
  1. 15 9
      src/App.vue
  2. 10 1
      src/api/teacher.js
  3. 31 12
      src/views/teacher/VIP00Apply.vue

+ 15 - 9
src/App.vue

@@ -16,19 +16,25 @@
 import { queryUserInfo } from '@/api/app'
 export default {
     name: 'app',
-    async mounted() {
-      if(document.querySelector('#m_loading')) {
-        document.querySelector('#m_loading').remove()
-      }
+    async created() {
       let params = this.$route.query
       if(params.Authorization) {
           localStorage.setItem('Authorization', decodeURI(params.Authorization))
           localStorage.setItem('userInfo', decodeURI(params.Authorization))
-          await queryUserInfo().then(res => {
-            const result = res.data || null
-            const tenantId = result.tenantId || 0
-            sessionStorage.setItem('tenantId', tenantId)
-          })
+      }
+      const Authorization = localStorage.getItem('Authorization')
+      const userInfo = localStorage.getItem('userInfo')
+      if(userInfo || Authorization) {
+        await queryUserInfo().then(res => {
+          const result = res.data || null
+          const tenantId = result.tenantId || 0
+          sessionStorage.setItem('tenantId', tenantId)
+        })
+      }
+    },
+    async mounted() {
+      if(document.querySelector('#m_loading')) {
+        document.querySelector('#m_loading').remove()
       }
     }
 }

+ 10 - 1
src/api/teacher.js

@@ -505,6 +505,14 @@ const practiceGroupApply = (data) => {
   })
 }
 
+const tenantConfigGet = (data) => {
+  return axios({
+    url: api + '/tenantConfig/get',
+    method: 'get',
+    params: data
+  })
+}
+
 export {
   queryMyCreatedList,
   queryWaitList,
@@ -561,5 +569,6 @@ export {
   queryPracticeGroupSellPrice,
   practiceGroupApply,
   getPracticeGroupCostCount,
-  queryStudentsWithTeacherByOrganId
+  queryStudentsWithTeacherByOrganId,
+  tenantConfigGet
 }

+ 31 - 12
src/views/teacher/VIP00Apply.vue

@@ -115,7 +115,7 @@
         该活动最小课时数:<span>{{loadData.vipGroupActivitySelect.minCourseNum}}</span>节 最大课时数:<span>{{loadData.vipGroupActivitySelect.maxCourseNum}}</span>节
       </div>
       <van-field
-        v-if="statusList.hasOnline"
+        v-if="statusList.hasOnline && studentMaxStatus"
         v-model="form.onlineClassesNums"
         @keyup="onClassKeyUp"
         label="线上课"
@@ -259,7 +259,7 @@
         @keyup="getCalcClass"
         :readonly="true"
         placeholder="金额(每课时)"
-        v-if="statusList.hasOnline"
+        v-if="statusList.hasOnline && studentMaxStatus"
       />
       <van-field
         v-model="form.offlineClassesUnitPrice"
@@ -507,7 +507,8 @@ import {
   queryStudentsWithTeacherByOrganId,
   queryPracticeGroupSellPrice,
   getPracticeGroupCostCount,
-  practiceGroupApply
+  practiceGroupApply,
+  tenantConfigGet
 } from "@/api/teacher";
 import setLoading from "@/utils/loading";
 import dayjs from "dayjs";
@@ -661,20 +662,31 @@ export default {
       salaryStatus: true, // 是否跳过课酬二次确认
       singleClassMinutesPrice: 0, //网管课单价
       singleClassMinutesSalary: 0, // 网管课课酬
+      studentMaxLimit: 0, // 线上课最大人数
+      studentMaxStatus: true, // 是否显示线上课
     };
   },
-  mounted() {
-   
+  async mounted() {
     let params = this.$route.query;
     if (params.Authorization) {
       localStorage.setItem("Authorization", decodeURI(params.Authorization));
       localStorage.setItem("userInfo", decodeURI(params.Authorization));
     }
-     console.log(params.Authorization)
     document.title = "VIP课程申请";
     if (browser().android) {
       this.headerStatus = true;
     }
+
+    try {
+      setLoading(true)
+      const res = await tenantConfigGet()
+      const result = res.data
+      let tempObj = result.data.config ? JSON.parse(result.data.config) : {}
+      this.studentMaxLimit = tempObj.cloud_room_rule.cloud_room_up_limit -1
+      setLoading(false)
+    } catch(e) {
+      setLoading(false)
+    }
   },
   methods: {
     dayjs,
@@ -852,12 +864,12 @@ export default {
       });
     },
     onSheetConfirm(value, index) {
-      console.log({...value})
       // 上拉弹窗
       let sheetForm = this.sheetForm,
         form = this.form,
         formName = this.formName,
         loadData = this.loadData;
+      console.log(sheetForm.currentType)
       if (sheetForm.currentType == "subjectList") {
         // 科目名称赋值
         form.subjectIdList = value.value;
@@ -893,6 +905,13 @@ export default {
           });
         });
 
+        // 判断是否超过机构设置的限制
+        if(value.studentNum > this.studentMaxLimit) {
+          this.studentMaxStatus = false
+        } else {
+          this.studentMaxStatus = true
+        }
+
         // 重置上课学生
         this.checkboxSelect = [];
         this.checkboxSelectIds = [];
@@ -1525,7 +1544,7 @@ export default {
       let offlineClassesStatus =
         !form.offlineClassesNums && form.offlineClassesNums <= 0 ? true : false;
 
-      if (statusList.hasOnline) {
+      if (statusList.hasOnline && this.studentMaxStatus) {
         if (onlineClassesStatus) {
           this.$toast("请输入线上课次数");
           return false;
@@ -1547,7 +1566,7 @@ export default {
 
       if (
           statusList.hasOffline &&
-          statusList.hasOnline &&
+          statusList.hasOnline && this.studentMaxStatus &&
           parseFloat(form.onlineClassesNums || 0) + parseFloat(form.offlineClassesNums || 0) != this.form.totalClassTime
       ) {
           this.$toast('线上课次数+线下课次数不等于总课次数')
@@ -1596,7 +1615,7 @@ export default {
       this.setTimeTable();
 
       // 如果线上和线下课酬都为0时
-      if (statusList.hasOnline && statusList.hasOffline) {
+      if (statusList.hasOnline && this.studentMaxStatus && statusList.hasOffline) {
         if (
           form.onlineClassesNums > 0 &&
           form.onlineTeacherSalary <= 0 &&
@@ -1616,7 +1635,7 @@ export default {
         }
       }
 
-      if (statusList.hasOnline) {
+      if (statusList.hasOnline && this.studentMaxStatus) {
         if (!form.onlineClassesUnitPrice) {
           this.$toast("请输入线上课单价");
           return false;
@@ -1828,7 +1847,7 @@ export default {
         !form.onlineClassesNums && form.onlineClassesNums <= 0 ? true : false;
       let offlineClassesStatus =
         !form.offlineClassesNums && form.offlineClassesNums <= 0 ? true : false;
-      if (statusList.hasOnline) {
+      if (statusList.hasOnline && this.studentMaxStatus) {
         if (onlineClassesStatus) {
           if (isShowToast) {
             this.$toast("请输入线上课次数");