Selaa lähdekoodia

Merge branch 'develop' of http://52.130.252.100:10000/TEAMMODEL/TEAMModelOS into develop

CrazyIter_Bin 2 vuotta sitten
vanhempi
commit
8f396241dd

+ 2 - 0
TEAMModelOS/ClientApp/public/lang/en-US.js

@@ -449,6 +449,8 @@ const LANG_EN_US = {
     },
     // 授权相关
     auth: {
+        checkTip1: 'Note: Insufficient personal space!',
+        checkTip2: 'Your space is insufficient, please contact the school administrator or purchase your own space.',
         authTab1: 'Service Authorization Management',
         authTab2: 'Smarter Classroom Authorization Management',
         spaceLabel: 'Cloud Space Status',

+ 2 - 0
TEAMModelOS/ClientApp/public/lang/zh-CN.js

@@ -449,6 +449,8 @@ const LANG_ZH_CN = {
     },
     // 授权相关
     auth: {
+        checkTip1: '个人空间不足提示',
+        checkTip2: '您的空间已不足,请联系学校管理员或购买空间。',
         authTab1: '服务授权管理',
         authTab2: '智慧教室授权管理',
         spaceLabel: '云端空间状态',

+ 2 - 0
TEAMModelOS/ClientApp/public/lang/zh-TW.js

@@ -449,6 +449,8 @@ const LANG_ZH_TW = {
     },
     // 授权相关
     auth: {
+        checkTip1: '個人空間不足提示',
+        checkTip2: '您的空間已不足,請聯繫學校管理員或購買空間。',
         authTab1: '服務授權管理',
         authTab2: '智慧教室授權管理',
         spaceLabel: '雲端空間狀態',

+ 2 - 0
TEAMModelOS/ClientApp/src/store/module/user.js

@@ -207,6 +207,8 @@ export default {
             state.userProfile.syllabus = data.syllabus // 老師的個人課綱
             state.userProfile.lessonShow = data.lessonShow
             state.userProfile.lessonLimit = data.lessonLimit
+            state.userProfile.privateSpace = data.privateSpace
+            state.userProfile.schoolSpace = data.schoolSpace
         },
         setSchoolProfile(state, data) {
             state.schoolCode = data.school_base.id

+ 14 - 1
TEAMModelOS/ClientApp/src/utils/public.js

@@ -22,7 +22,7 @@ import {
 	app
 } from '@/boot-app.js'
 import {
-	Message, Modal
+	Message, Modal, Notice
 } from 'view-design'
 
 /**
@@ -345,6 +345,19 @@ export default {
 			document.webkitExitFullscreen();
 		}
 	},
+	/* 检查老师个人空间剩余情况 */
+	checkUserSpace() {
+		let userLeftSpace = store.state.user.userProfile.privateSpace?.surplus
+		if (userLeftSpace < 100 * 1024 * 1024) {
+			setTimeout(() => {
+				Notice.warning({
+					title: app.$t('auth.checkTip1'),
+					desc: app.$t('auth.checkTip2'),
+					duration: 10
+				});
+			}, 3000)
+		}
+	},
 	getFileThum(type, fileName) {
 		const docType = ['doc', 'docx']
 		const excelType = ['xls', 'csv', 'xlsx']

+ 4 - 1
TEAMModelOS/ClientApp/src/view/homepage/HomePage.vue

@@ -842,7 +842,10 @@ export default {
     }
   },
   created() {
-    console.error('============HomePageCreated============')
+    console.error('============HomePageCreated============', this.$store.state)
+
+    this.$tools.checkUserSpace()
+
     this.initData('created')
   },
   mounted() {

+ 194 - 193
TEAMModelOS/ClientApp/src/view/homepage/SpaceInfo.vue

@@ -1,213 +1,214 @@
 <template>
-    <div id="space-info"></div>
+  <div id="space-info"></div>
 </template>
 <script>
 import BlobTool from '@/utils/blobTool.js'
 import { mapGetters } from 'vuex'
 import elementResizeDetectorMaker from "element-resize-detector"
 export default {
-    name: 'SpaceInfo',
-    computed: {
-        ...mapGetters({
-            PRIVATE_SPACE: 'PRIVATE_SPACE'
-        }),
-    },
-    data() {
-        return {
-            warningPercent: 10,
-            content: ['res', 'image', 'video', 'doc', 'audio', 'other'],
-            itemAndPaperKey: ['item', 'paper'], //试题试卷
-            //与返回数据key对应的模块
-            spaceInfo: {
-                total: this.$t('auth.totalSpace'),
-                exam: this.$t('auth.exam'), //评测
-                vote: this.$t('auth.vote'), //投票
-                survey: this.$t('auth.survey'), //问卷
-                homework: this.$t('auth.homework'), //作业
-                train: this.$t('auth.train'), //研修
-                records: this.$t('auth.records'), //课堂记录
-                syllabus: this.$t('auth.syllabus'), //课纲
+  name: 'SpaceInfo',
+  computed: {
+    ...mapGetters({
+      PRIVATE_SPACE: 'PRIVATE_SPACE'
+    }),
+  },
+  data() {
+    return {
+      warningPercent: 10,
+      content: ['res', 'image', 'video', 'doc', 'audio', 'other'],
+      itemAndPaperKey: ['item', 'paper'], //试题试卷
+      //与返回数据key对应的模块
+      spaceInfo: {
+        total: this.$t('auth.totalSpace'),
+        exam: this.$t('auth.exam'), //评测
+        vote: this.$t('auth.vote'), //投票
+        survey: this.$t('auth.survey'), //问卷
+        homework: this.$t('auth.homework'), //作业
+        train: this.$t('auth.train'), //研修
+        records: this.$t('auth.records'), //课堂记录
+        syllabus: this.$t('auth.syllabus'), //课纲
+      },
+      formatData: [],
+      typeCountPie: undefined,
+      option: {
+        color: ['#cccccc', '#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'],
+        tooltip: {
+          trigger: 'item',
+          // formatter: '{b}({c})',
+          formatter: (params) => {
+            return `${params.name}:${this.$jsFn.formatBytes(params.value)}`
+          },
+          textStyle: {
+            color: '#000'
+          },
+          backgroundColor: '#fff',
+          extraCssText: 'box-shadow: 0px 0px 10px 0px rgba(19,83,88,0.2);'
+        },
+        title: [],
+        legend: {
+          data: [],
+          textStyle: {
+            color: '#757575',
+            padding: [5, 0, 5, 0]
+          },
+          icon: 'circle',
+          bottom: 15
+        },
+        series: [
+          {
+            type: 'pie',
+            center: ['50%', '35%'],
+            radius: ['48%', '60%'],
+            labelLine: {
+              show: false
             },
-            formatData: [],
-            typeCountPie: undefined,
-            option: {
-                color: ['#cccccc', '#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'],
-                tooltip: {
-                    trigger: 'item',
-                    // formatter: '{b}({c})',
-                    formatter: (params) => {
-                        return `${params.name}:${this.$jsFn.formatBytes(params.value)}`
-                    },
-                    textStyle: {
-                        color: '#000'
-                    },
-                    backgroundColor: '#fff',
-                    extraCssText: 'box-shadow: 0px 0px 10px 0px rgba(19,83,88,0.2);'
-                },
-                title: [],
-                legend: {
-                    data: [],
-                    textStyle: {
-                        color: '#757575',
-                        padding: [5, 0, 5, 0]
-                    },
-                    icon: 'circle',
-                    bottom: 15
-                },
-                series: [
-                    {
-                        type: 'pie',
-                        center: ['50%', '35%'],
-                        radius: ['48%', '60%'],
-                        labelLine: {
-                            show: false
-                        },
-                        label: {
-                            show: false
-                        },
-                        data: []
-                    }
-                ]
+            label: {
+              show: false
+            },
+            data: []
+          }
+        ]
+      }
+    }
+  },
+  mounted() {
+    if (!this.typeCountPie) this.typeCountPie = this.$echarts.init(document.getElementById('space-info'))
+    this.typeCountPie.setOption(this.option)
+    this.erd = elementResizeDetectorMaker()
+    this.erd.listenTo(document.getElementById("space-info"), () => {
+      this.$nextTick(() => {
+        //监听到事件后执行的业务逻辑
+        this.typeCountPie.resize()
+      })
+    })
+  },
+  methods: {
+    // 获取容器空间情况 
+    getSize() {
+      console.error('xxxxxxxxxxxxxxxxxxxx')
+      BlobTool.getContainerSize(this.$store.state.userInfo.TEAMModelId, 'private').then(
+        res => {
+          console.log(res)
+          this.sizeInfo = res
+          let formatData = []
+          let other = {
+            name: this.$t('auth.appData'),
+            value: 0
+          }
+          let content = {
+            name: this.$t('auth.content'),
+            value: 0
+          }
+          // 试题试卷
+          let itemAndPaper = {
+            name: this.$t('auth.itemAndPaper'),
+            value: 0
+          }
+          if (res) {
+            for (const key in res) {
+              if (key != 'total' && key != 'appData') {
+                if (this.spaceInfo[key]) {
+                  formatData.push({
+                    name: this.spaceInfo[key],
+                    value: res[key]
+                  })
+                } else if (this.content.includes(key)) {
+                  content.value += res[key]
+                }
+                else if (this.itemAndPaperKey.includes(key)) {
+                  itemAndPaper.value += res[key]
+                }
+                else {
+                  other.value += res[key]
+                }
+              }
             }
-        }
-    },
-    mounted() {
-        if (!this.typeCountPie) this.typeCountPie = this.$echarts.init(document.getElementById('space-info'))
-        this.typeCountPie.setOption(this.option)
-        this.erd = elementResizeDetectorMaker()
-        this.erd.listenTo(document.getElementById("space-info"), () => {
-            this.$nextTick(() => {
-                //监听到事件后执行的业务逻辑
-                this.typeCountPie.resize()
+          }
+          formatData.push(content)
+          formatData.push(itemAndPaper)
+          formatData.push(other)
+          let last = this.PRIVATE_SPACE * 1024 * 1024 * 1024 - res.teachSpace - res.total
+          if (last > 0) {
+            formatData.unshift({
+              name: this.$t('auth.over'),
+              value: last
             })
-        })
-    },
-    methods: {
-        // 获取容器空间情况 
-        getSize() {
-            BlobTool.getContainerSize(this.$store.state.userInfo.TEAMModelId, 'private').then(
-                res => {
-                    console.log(res)
-                    this.sizeInfo = res
-                    let formatData = []
-                    let other = {
-                        name: this.$t('auth.appData'),
-                        value: 0
-                    }
-                    let content = {
-                        name: this.$t('auth.content'),
-                        value: 0
-                    }
-                    // 试题试卷
-                    let itemAndPaper = {
-                        name: this.$t('auth.itemAndPaper'),
-                        value: 0
-                    }
-                    if (res) {
-                        for (const key in res) {
-                            if (key != 'total' && key != 'appData') {
-                                if (this.spaceInfo[key]) {
-                                    formatData.push({
-                                        name: this.spaceInfo[key],
-                                        value: res[key]
-                                    })
-                                } else if (this.content.includes(key)) {
-                                    content.value += res[key]
-                                } 
-                                else if (this.itemAndPaperKey.includes(key)) {
-                                    itemAndPaper.value += res[key]
-                                } 
-                                else {
-                                    other.value += res[key]
-                                }
-                            }
-                        }
-                    }
-                    formatData.push(content)
-                    formatData.push(itemAndPaper)
-                    formatData.push(other)
-                    let last = this.PRIVATE_SPACE * 1024 * 1024 * 1024 - res.teachSpace - res.total
-                    if (last > 0) {
-                        formatData.unshift({
-                            name: this.$t('auth.over'),
-                            value: last
-                        })
-                    }
-                    let percent = last * 100 / (this.PRIVATE_SPACE * 1024 * 1024 * 1024)
-                    // percent = 0
-                    console.log(percent)
-                    if (percent < this.warningPercent && percent > 0) {
-                        this.$emit('on-space-warning')
-                    } else if (percent <= 0) {
-                        this.$emit('on-space-error')
-                    }
-                    formatData = formatData.filter(item => !!item.value)
-                    this.option.legend.data = formatData.map(item => {
-                        return item.name
-                    })
-                    this.option.series[0].data = formatData
-                    this.option.title = []
-                    this.option.title.push({
-                        text: '{name|' + this.$t('auth.totalSpace') + ': ' + '}{val|' + this.PRIVATE_SPACE + 'G' + '}\n' + '{name|' + this.$t('auth.used') + '}{use|' + this.$jsFn.formatBytes(res.total + res.teachSpace) + '}',
-                        top: '22%',
-                        left: 'center',
-                        textStyle: {
-                            rich: {
-                                name: {
-                                    fontSize: 16,
-                                    fontWeight: 'normal',
-                                    color: '#757575',
-                                    padding: [10, 0],
-                                },
-                                val: {
-                                    fontSize: 20,
-                                    fontWeight: '600',
-                                    color: '#303030',
-                                },
-                                use: {
-                                    fontSize: 20,
-                                    fontWeight: '600',
-                                    color: '#ed4014',
-                                },
-                            },
-                        },
-                    })
-                    this.$nextTick(() => {
-                        if (!this.typeCountPie) {
-                            this.typeCountPie = this.$echarts.init(document.getElementById('space-info'))
-                        }
-                        this.typeCountPie.setOption(this.option)
-                    })
+          }
+          let percent = last * 100 / (this.PRIVATE_SPACE * 1024 * 1024 * 1024)
+          // percent = 0
+          console.log(percent)
+          if (percent < this.warningPercent && percent > 0) {
+            this.$emit('on-space-warning')
+          } else if (percent <= 0) {
+            this.$emit('on-space-error')
+          }
+          formatData = formatData.filter(item => !!item.value)
+          this.option.legend.data = formatData.map(item => {
+            return item.name
+          })
+          this.option.series[0].data = formatData
+          this.option.title = []
+          this.option.title.push({
+            text: '{name|' + this.$t('auth.totalSpace') + ': ' + '}{val|' + this.PRIVATE_SPACE + 'G' + '}\n' + '{name|' + this.$t('auth.used') + '}{use|' + this.$jsFn.formatBytes(res.total + res.teachSpace) + '}',
+            top: '22%',
+            left: 'center',
+            textStyle: {
+              rich: {
+                name: {
+                  fontSize: 16,
+                  fontWeight: 'normal',
+                  color: '#757575',
+                  padding: [10, 0],
                 },
-                err => {
-                    this.$Message.error(this.$t('teachContent.sizeErr'))
-                }
-            ).finally(() => {
-                this.sizeLoading = false
-            })
+                val: {
+                  fontSize: 20,
+                  fontWeight: '600',
+                  color: '#303030',
+                },
+                use: {
+                  fontSize: 20,
+                  fontWeight: '600',
+                  color: '#ed4014',
+                },
+              },
+            },
+          })
+          this.$nextTick(() => {
+            if (!this.typeCountPie) {
+              this.typeCountPie = this.$echarts.init(document.getElementById('space-info'))
+            }
+            this.typeCountPie.setOption(this.option)
+          })
         },
+        err => {
+          this.$Message.error(this.$t('teachContent.sizeErr'))
+        }
+      ).finally(() => {
+        this.sizeLoading = false
+      })
     },
-    mounted() {
-        this.getSize()
-    },
-    watch: {
-        // PRIVATE_SPACE: {
-        //     handler(n, o) {
-        //         console.log('空间', n)
-        //     },
-        //     immediate: true,
-        //     deep: true
-        // }
-    }
+  },
+  mounted() {
+    this.getSize()
+  },
+  watch: {
+    // PRIVATE_SPACE: {
+    //     handler(n, o) {
+    //         console.log('空间', n)
+    //     },
+    //     immediate: true,
+    //     deep: true
+    // }
+  }
 }
 </script>
 <style scoped lang="less">
 #space-info {
-    margin: auto;
-    margin-top: 10px;
-    width: 95%;
-    // max-width: 300px;
-    height: 300px;
+  margin: auto;
+  margin-top: 10px;
+  width: 95%;
+  // max-width: 300px;
+  height: 300px;
 }
 </style>
 <style>