Browse Source

添加处理判断显示

lex-xin 3 years ago
parent
commit
20a4c31ba3

+ 7 - 1
src/App.vue

@@ -13,12 +13,18 @@
 
 
 <script>
+import { queryUserInfo } from '@/api/app'
 export default {
     name: 'app',
-    mounted() {
+    async mounted() {
       if(document.querySelector('#m_loading')) {
         document.querySelector('#m_loading').remove()
       }
+      await queryUserInfo().then(res => {
+        const result = res.data || null
+        const tenantId = result.tenantId || 0
+        sessionStorage.setItem('tenantId', tenantId)
+      })
     }
 }
 </script>

+ 5 - 0
src/common/axios.js

@@ -43,6 +43,11 @@ _axios.interceptors.request.use(
         config.headers['Authorization'] = auth
       }
     }
+    const tenantId = sessionStorage.getItem('tenantId')
+    if(tenantId && tenantId != 'undefined') {
+      config.headers['tenantId'] = tenantId
+    }
+
     // config.headers['Authorization'] = 'bearer 5848d682-f5a3-4ce1-b86d-5b5f466ae665'
     return config;
   },

+ 4 - 0
src/helpers/request.js

@@ -25,6 +25,10 @@ instance.interceptors.request.use(config => {
       Authorization,
     }
   }
+  const tenantId = sessionStorage.getItem('tenantId')
+  if(tenantId && tenantId != 'undefined') {
+    config.headers['tenantId'] = tenantId
+  }
   return config
 })
 

+ 10 - 5
src/views/audition/CourseEvaluation.vue

@@ -173,18 +173,21 @@ export default {
       subjectNames: null,
       // isReset: false,
       isInside: false,
+      tenantId: null, // 当前机构编号
       isAssignHomework: 0, // 是否有布置作业,0 => 否 1 => 是
       enableAssignHomework: 0, // 是否要布置作业  0 否  1 是
       memberStatus: 0, // 是否有学生或者乐团是会员
     };
   },
+  created() {
+		this.tenantId = sessionStorage.getItem('tenantId') || null
+	},
   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)
     this.courseId = params.id;
     this.reviewId = parseInt(params.reviewId);
     this.isInside = params.isInside;
@@ -280,7 +283,8 @@ export default {
   },
   methods: {
     submitReview() {
-      if(!this.isAssignHomework && this.enableAssignHomework) {
+      // 不是大雅机构则作业非必填
+      if(!this.isAssignHomework && this.enableAssignHomework && this.tenantId == 1) {
         this.$toast('请布置课后训练')
         return
       }
@@ -316,7 +320,8 @@ export default {
         updateReviewInfo(obj).then((res) => {
           this.$toast("修改成功");
           setTimeout((res) => {
-            if (this.isInside) {
+            // 硬编码,判断是否是大雅机构,其它机构则可以不用布置作业
+            if (this.isInside && this.tenantId == 1) {
               this.$router.replace({ path: "/manageEvaluation" });
             } else {
               this.onAppBack();
@@ -328,7 +333,7 @@ export default {
           if (res.data.code == 200) {
             this.$toast("提交成功");
             setTimeout((res) => {
-              if (this.isInside) {
+              if (this.isInside && this.tenantId == 1) {
                 this.$router.push({ path: "/manageEvaluation" });
               } else {
                 this.onAppBack();
@@ -403,7 +408,7 @@ export default {
     },
     onClose() {
       // 关闭弹窗
-      if (this.isInside) {
+      if (this.isInside && this.tenantId == 1) {
         this.$router.replace({ path: "/manageEvaluation" });
       } else {
         this.onAppBack();

+ 1 - 1
src/views/teacher/VIP00Apply.vue

@@ -524,7 +524,7 @@ export default {
   },
   watch: {
     'statusList.hasOffline'() {
-      console.log(this.statusList.hasOffline)
+      // console.log(this.statusList.hasOffline)
     }
   },
   data() {

+ 26 - 16
src/views/teacher/VIPApply.vue

@@ -1,19 +1,24 @@
 <template>
-	 <van-tabs v-model="active" swipe-threshold="3" sticky class="vanTabs" @change="onChange" color="#01C1B5"> 
-		<van-tab title="VIP申请" :name="1">
-			<vip-00-apply v-if="active === 1" />
-		</van-tab>
-		<van-tab title="双十一排课" :name="2">
-			<vip-11-apply v-if="active === 2" />
-		</van-tab>
-		<van-tab title="考级VIP排课" :name="3">
-			<vip-course v-if="active === 3" />
-		</van-tab>
-		<van-tab title="考级乐理排课" :name="4">
-			<theory-course v-if="active === 4" />
-		</van-tab>
-	</van-tabs> 
-	<!-- <vip-00-apply /> -->
+	<!-- 判断是否是大雅机构 -->
+	<div v-if="tenantId == 1">
+		<van-tabs v-model="active" swipe-threshold="3" sticky class="vanTabs" @change="onChange" color="#01C1B5"> 
+			<van-tab title="VIP申请" :name="1">
+				<vip-00-apply v-if="active === 1" />
+			</van-tab>
+			<van-tab title="双十一排课" :name="2">
+				<vip-11-apply v-if="active === 2" />
+			</van-tab>
+			<van-tab title="考级VIP排课" :name="3">
+				<vip-course v-if="active === 3" />
+			</van-tab>
+			<van-tab title="考级乐理排课" :name="4">
+				<theory-course v-if="active === 4" />
+			</van-tab>
+		</van-tabs>
+	</div>
+	<div v-else>
+		<vip-00-apply />
+	</div>
 </template>
 
 <script>
@@ -30,9 +35,14 @@ export default {
 	},
 	data() {
 		return {
-			active: 1
+			active: 1,
+			tenantId: null,
 		}
 	},
+	created() {
+		this.tenantId = sessionStorage.getItem('tenantId') || null
+		console.log(this.tenantId)
+	},
 	mounted() {
 		let params = this.$route.query;
     if (params.Authorization) {

+ 4 - 1
src/views/trainStatistics/index.vue

@@ -1,6 +1,6 @@
 <template>
     <div class="visitList">
-        <van-sticky>
+        <van-sticky v-if="tenantId == 1">
             <m-header v-if="headerStatus" :isFixed="false" />
             <van-tabs v-model="active" @change="tabChange" title-active-color="#000000" title-inactive-color="#808080" color="#01C1B5" class="van-hairline--bottom">
                 <van-tab title="全部学员" name="all">
@@ -86,6 +86,9 @@ export default {
             playTime: 0,
         };
     },
+    created() {
+		this.tenantId = sessionStorage.getItem('tenantId') || null
+	},
     async mounted() {
         let params = this.$route.query;
         if (params.Authorization) {

+ 3 - 4
src/views/trainStatistics/trainModel.vue

@@ -74,11 +74,11 @@ export default {
             default: 0
         },
         trainNum: {
-            type: String || Number,
+            type: [Number, String],
             default: 0
         },
         playTime: {
-            type: String || Number,
+            type: [Number, String],
             default: 0
         },
     },
@@ -99,8 +99,7 @@ export default {
                 trainNum: null,
                 trainDay: null,
                 recordNum: null,
-            },
-            
+            }
         }
     },
     async mounted() {