Browse Source

Merge branch 'develop5.0-tmd' of http://106.12.23.251:10000/TEAMMODEL/TEAMModelOS into develop5.0-tmd

OnePsycho 4 years ago
parent
commit
4dfed5076f

+ 73 - 9
TEAMModelOS/ClientApp/src/api/blob.js

@@ -1,10 +1,26 @@
 import { fetch, post } from '@/api/http'
+import { GLOBAL } from '@/static/Global.js';
+//获取文件后缀和类型
+function getExAndType(fileName) {
+    let ex = fileName.substring(fileName.lastIndexOf('.') + 1)
+    let type = 'other'
+    ex = ex.toUpperCase()
+    for (let key in GLOBAL.CONTENT_TYPES) {
+        if (GLOBAL.CONTENT_TYPES[key].indexOf(ex) != -1) {
+            type = key
+            break
+        }
+    }
+    return {
+        ex, type
+    }
+}
 export default {
-    getBlobSAS: function(data) {
+    getBlobSAS: function (data) {
         return post('/api/File/getBlobSAS', data)
     },
     //最开始使用的blob授权API
-    getContainerSAS: function(data) {
+    getContainerSAS: function (data) {
         return post('/api/File/getContainerSAS', data)
     },
     //获取blob容器读写创建
@@ -12,31 +28,79 @@ export default {
         return post('/blob/sas-rcwld', data)
     },
     //获取blob容器只读创建
-    blobSasR: function(data) {
+    blobSasR: function (data) {
         return post('/blob/sas-r', data)
     },
     //单文件只读权限
-    urlSasR: function(data) {
+    urlSasR: function (data) {
         return post('/blob/sas-url-r', data)
     },
     //获取容器空间
     getContainerSize: function (data) {
         return post('/blob/get-blobsize', data)
     },
-	// 删除blob指定目录下的所有文件
-	deletePrefix: function (data) {
+    // 删除blob指定目录下的所有文件
+    deletePrefix: function (data) {
         return post('/blob/delete-prefix', data)
     },
     // 批量删除blob
-	deleteBlobs: function (data) {
+    deleteBlobs: function (data) {
         return post('/blob/delete-blobs', data)
     },
     // 上传文件之前需要先检查文件是否存在
-	checkBlobs: function (data) {
+    checkBlobs: function (data) {
         return post('/blob/check-blobsize', data)
     },
     // 上传文件之后需要更新blob空间
-	updateSize: function (data) {
+    updateSize: function (data) {
         return post('/blob/update-blobsize', data)
+    },
+    /**
+     * 上传文件之后保存文件的描述信息
+     * opt: add 更新
+     * opt: del 删除
+     **/
+    upsertBlobInfo: function (data) {
+        return post('/blob/bloblog-opt', data)
+    },
+    /**
+     * 查询资源信息
+     * 这里统一将返回数据处理成原来前端直接listBlob返回的数据格式
+     * @returns 
+     */
+    listBlobInfo: function (data, host, container) {
+        return new Promise((r, j) => {
+            post('/blob/bloblog-list', data).then(
+                res => {
+                    console.log(res)
+                    let blobs = []
+                    res.bloblogs.forEach(item => {
+                        let blobName = item.url
+                        let info = getExAndType(item.url)
+                        let i = {
+                            url: host + '/' +container + '/' + item.url,
+                            blob: '/' + item.url,
+                            name: blobName.substring(blobName.lastIndexOf('/') + 1),
+                            size: item.size,
+                            createTime: item.time,
+                            extension: info.ex,
+                            type: info.type,
+                            periodId: item.periodId,
+                            subjectId: item.subjectId,
+                            gradeId: item.gradeId,
+                            id: item.id
+                        }
+                        blobs.push(i)
+                    })
+                    r(blobs)
+                },
+                err => {
+                    j(err)
+                }
+            )
+
+        })
+
+        // return post('/blob/bloblog-list', data)
     }
 }

+ 4 - 4
TEAMModelOS/ClientApp/src/common/BaseLayout.less

@@ -128,14 +128,14 @@
     width: 100%;
     text-align: right;
     cursor: pointer;
-    transition: background 1s;
+    transition: background 0.5s;
     padding-right: 5px;
-    padding-top: 5px;
-    padding-bottom: 5px;
+    padding-top: 1px;
+    padding-bottom: 1px;
     background:var(--side-bg);
     &:hover {
         background: #404040;
-        transition: background 1s;
+        transition: background 0.5s;
     }
 
     &:hover .collapse-icon {

+ 12 - 11
TEAMModelOS/ClientApp/src/common/BaseLayout.vue

@@ -38,7 +38,7 @@
                                     <Icon v-show="!isCollapsed" class="sub-menu-icon" :custom="menuItem.icon" size="16" />
                                     <span>
                                         {{menuItem.name}}
-                                        <span style="color: aqua;margin-left: 2px;font-size: 12px;vertical-align: text-top;margin-top:3px">
+                                        <span style="color: aqua;margin-left: 2px;font-size: 12px;vertical-align: text-top;">
                                             {{menuItem.tag}}
                                         </span>
                                     </span>
@@ -51,7 +51,7 @@
                                 <Icon v-show="!isCollapsed" :custom="item.icon" :class="isCollapsed ? 'collapse-icon-size':''" size="16" />
                                 <span>
                                     {{item.name}}
-                                    <span style="color: aqua;margin-left: 2px;font-size: 12px;vertical-align: text-top;margin-top:3px">
+                                    <span style="color: aqua;margin-left: 2px;font-size: 12px;vertical-align: text-top;">
                                         {{item.tag}}
                                     </span>
                                 </span>
@@ -77,7 +77,7 @@
                                 <Icon v-show="!isCollapsed" class="sub-menu-icon" :custom="menuItem.icon" size="16" />
                                 <span>
                                     {{menuItem.name}}
-                                    <span style="color: aqua;margin-left: 2px;font-size: 12px;vertical-align: text-top;margin-top:3px">
+                                    <span style="color: aqua;margin-left: 2px;font-size: 12px;vertical-align: text-top;">
                                         {{menuItem.tag}}
                                     </span>
                                 </span>
@@ -567,7 +567,7 @@ export default {
 }
 .biz-menu .ivu-menu-vertical .ivu-menu-item-group::after {
     content: "";
-    width: 90%;
+    width: 100%;
     height: 1px;
     background: #303030;
     position: absolute;
@@ -575,10 +575,6 @@ export default {
     bottom: -10px;
     box-shadow:0px 12px 8px -12px #000;
 }
-
-.biz-menu .collapsed-menu .ivu-menu-item-group::after {
-    width: 100% !important;
-}
 .biz-menu  .ivu-menu-item-group:nth-child(2)::after {
     background: transparent;
 }
@@ -625,7 +621,7 @@ export default {
     display: inline-block;
     white-space: nowrap;
     font-size: 15px;
-    position: absolute;
+    // position: absolute;
     width: ~"calc(100% - 50px)";
     max-width: 150px;
     vertical-align: top;
@@ -638,7 +634,6 @@ export default {
     margin-right: 10px;
     transform: translateX(0px);
     transition: font-size 0.5s ease, transform 0.5s ease;
-    vertical-align: sub;
     font-size: 16px;
 }
 
@@ -647,10 +642,14 @@ export default {
 }
 .menu-item .ivu-menu-item {
     color: hsla(0, 0%, 100%, 0.7);
+    display: flex;
+    align-items: center;
 }
 
 .menu-item .ivu-menu-submenu-title {
     color: hsla(0, 0%, 100%, 0.7);
+    display: flex;
+    align-items: center;
 }
 
 .collapsed-menu i {
@@ -698,10 +697,12 @@ export default {
 
 .biz-menu .ivu-menu-vertical .ivu-menu-item,
 .biz-menu .ivu-menu-vertical .ivu-menu-submenu-title {
-    padding: 14px 24px;
+    padding: 13px 24px;
 }
 .biz-menu .ivu-menu-submenu .ivu-menu-item {
     background: #101117;
+    display: flex;
+    align-items: center;
 }
 
 .biz-menu

+ 63 - 8
TEAMModelOS/ClientApp/src/common/UploadModal.vue

@@ -1,18 +1,22 @@
 <template>
-    <Modal v-model="uploadStatus" :ok-text="textLoading ? $t('updModal.uploading') : isComplete ? $t('updModal.complete'):$t('updModal.comfirmUpd')" :cancel-text="$t('updModal.cancelUpd')" :title="$t('teachContent.btnUpload')" class="upload-modal dark-iview-modal" width="800" :mask-closable="false" :closable="false" @on-ok="modalOk" @on-cancel="modalCancel" :loading="modalLoading">
+    <Modal v-model="uploadStatus" :ok-text="textLoading ? $t('updModal.uploading') : isComplete ? $t('updModal.complete'):$t('updModal.comfirmUpd')" :cancel-text="$t('updModal.cancelUpd')" :title="$t('teachContent.btnUpload')" class="upload-modal dark-iview-modal" width="900" :mask-closable="false" :closable="false" @on-ok="modalOk" @on-cancel="modalCancel" :loading="modalLoading">
         <div class="upload-file-box">
-            <!-- <p>上传到:{{pdInfo.filterPeriodName}}</p> -->
-            <ResBelong v-show="routerScope == 'school'" showLabel class="upd-to-pd" :pdId="pdId"></ResBelong>
+            <ResBelong @tag-change="getResTags" v-show="routerScope == 'school'" showLabel class="upd-to-pd" :pdId="pdId"></ResBelong>
             <Upload type="drag" action="" :show-upload-list="false" multiple :before-upload="customUpload" class="upload-wrap" :disabled="textLoading">
                 <Icon class="upload-icon" custom="iconfont icon-upload" v-show="!uploadedList.length" />
                 <p class="upload-text" :style="{marginTop: uploadedList.length ? '25px':'0px'}">
                     <Icon size="24" style="font-size: 22px;vertical-align: baseline;margin-right: 5px;" custom="iconfont icon-upload" v-show="uploadedList.length" />
                     {{$t('teachContent.uploadText')}}
                 </p>
-                <p class="upload-text" style="font-size:12px;">{{$t('updModal.tips1')}}</p>
-                <p class="upload-text" :style="{fontSize:'12px',marginBottom: uploadedList.length ? '25px':'50px'}">
+                <p class="upload-text" style="font-size:12px;">
+                    {{$t('updModal.tips1')}}
+                </p>
+                <p class="upload-text" style="font-size:12px;">
                     {{$t('updModal.tips3')}}
                 </p>
+                <p class="upload-text" :style="{fontSize:'12px',marginBottom: uploadedList.length ? '25px':'50px'}">
+                    {{$t('updModal.tips2')}}
+                </p>
             </Upload>
             <div class="upload-file-box">
                 <div class="upload-file-item" v-for="(item,index) in uploadedList" :key="index">
@@ -80,7 +84,12 @@ export default {
             textLoading: false,
             modalLoading: false,
             isComplete: false, //是否完成上传
-            loadingCount: 0
+            loadingCount: 0,
+            tags: {
+                period: '',
+                gradeId: [],
+                subjectId: []
+            }
         }
     },
     props: {
@@ -132,6 +141,13 @@ export default {
         }
     },
     methods: {
+        //资源标签:学段、学科、年级
+        getResTags(data) {
+            console.log(data)
+            this.tags.period = data.period
+            this.tags.subjectId = data.subjects
+            this.tags.gradeId = data.grades
+        },
         //删除文件
         deleteFile(index) {
             this.containerClient.deleteBlob(this.uploadedList[index].blob).then(
@@ -268,6 +284,40 @@ export default {
         modalOk() {
             //已完成上传操作,关闭对话框、emit
             if (this.isComplete) {
+                //保存Blob描述信息
+                //API设计可以优化,如果API参数为对象数据,这里可以避免for循环里面发起请求影响性能
+                if (this.routerScope == 'school') {
+                    this.uploadedList.forEach(item => {
+                        item.periodId = this.tags.period
+                        item.gradeId = this.tags.gradeId.map(item => item + '')
+                        item.subjectId = this.tags.subjectId
+                        let requestData = {
+                            periodId: this.tags.period,
+                            gradeId: this.tags.gradeId.map(item => item + ''),
+                            subjectId: this.tags.subjectId,
+                            scope: 'school',
+                            name: this.$store.state.userInfo.schoolCode,
+                            url: item.blob.substring(1, item.blob.length),
+                            opt: 'add'
+                        }
+                        this.$api.blob.upsertBlobInfo(requestData)
+                    })
+                }
+                //个人资源不用关联学段、学科、年级等信息
+                else {
+                    this.uploadedList.forEach(item => {
+                        let requestData = {
+                            periodId: [],
+                            gradeId: [],
+                            subjectId: [],
+                            scope: 'private',
+                            name: this.$store.state.userInfo.TEAMModelId,
+                            url: item.blob.substring(1, item.blob.length),
+                            opt: 'add'
+                        }
+                        this.$api.blob.upsertBlobInfo(requestData)
+                    })
+                }
                 this.$emit("successData", this.uploadedList)
                 this.uploadedList = []
             } else { //还未上传文件,则上传文件
@@ -362,7 +412,6 @@ export default {
                 this.textLoading = false
                 this.isComplete = true
                 this.modalLoading = false
-
             }
         },
         //处理图片缩略图
@@ -409,12 +458,18 @@ export default {
             }
         }
         // 使用组件接收的值
-        else{
+        else {
             this.routerScope = this.scope
         }
 
     },
     watch: {
+        pdId: {
+            handler(n, o) {
+                this.tags.period = this.pdId
+            },
+            immediate: true
+        },
         urlString: {
             handler(v, o) {
                 if (this.urlString && this.containerName && this.sasString) {

+ 3 - 1
TEAMModelOS/ClientApp/src/locale/lang/en-US/teachContent.js

@@ -52,6 +52,8 @@ export default {
   delBatchTips2:'请先选择需要删除的文件!',
   specialChart:'不能包含特殊字符',
   noData:'暂无数据',
-  uploadTo:'上传至:',
+  applyPd:'适用学段:',
+  applySub:'适用学科:',
+   applyGrade:'适用年级:',
   public:'公共资源'
 }

+ 1 - 1
TEAMModelOS/ClientApp/src/locale/lang/en-US/updModal.js

@@ -4,7 +4,7 @@
     comfirmUpd:'确认上传',
     cancelUpd:'取消上传',
     tips1:'* 上传相同名字的文件会自动覆盖',
-    tips2:'* 勾选',
+    tips2:'您可以为资源设置适用学段、学科和年级',
     tips3:'支持PPTX文档转换成HTEX教材',
     fileType1:'教材',
     fileType2:'图片',

+ 3 - 1
TEAMModelOS/ClientApp/src/locale/lang/zh-CN/teachContent.js

@@ -52,6 +52,8 @@ export default {
   delBatchTips2:'请先选择需要删除的文件!',
   specialChart:'不能包含特殊字符',
   noData:'暂无数据',
-  uploadTo:'上传至:',
+  applyPd:'适用学段:',
+  applySub:'适用学科:',
+  applyGrade:'适用年级:',
   public:'公共资源'
 }

+ 1 - 1
TEAMModelOS/ClientApp/src/locale/lang/zh-CN/updModal.js

@@ -4,7 +4,7 @@
     comfirmUpd:'确认上传',
     cancelUpd:'取消上传',
     tips1:'* 上传相同名字的文件会自动覆盖',
-    tips2:'* 勾选',
+    tips2:'您可以为资源设置适用学段、学科和年级',
     tips3:'支持PPTX文档转换成HTEX教材',
     fileType1:'教材',
     fileType2:'图片',

+ 3 - 1
TEAMModelOS/ClientApp/src/locale/lang/zh-TW/teachContent.js

@@ -52,6 +52,8 @@ export default {
   delBatchTips2: '請先選擇需要刪除的檔案!',
   specialChart: '不能包含特殊字元',
   noData: '暫無資料',
-  uploadTo:'上傳至:',
+  applyPd:'適用學段:',
+  applySub:'適用學科:',
+  applyGrade:'適用年級:',
   public:'公共資源'
 }

+ 1 - 1
TEAMModelOS/ClientApp/src/locale/lang/zh-TW/updModal.js

@@ -4,7 +4,7 @@
     comfirmUpd:'確認上傳',
     cancelUpd:'取消上傳',
     tips1:'*上傳相同名字的檔案會自動覆蓋',
-    tips2:'*勾選',
+    tips2:'您可以为资源设置适用学段、学科和年级',
     tips3:'支援PPTX檔案轉換成HTEX教材',
     fileType1:'教材',
     fileType2:'圖片',

+ 103 - 47
TEAMModelOS/ClientApp/src/view/teachcontent/ResBelong.vue

@@ -1,18 +1,23 @@
 <template>
-    <div class="pd-select-wrap">
-        <Dropdown class="sort-dropdown" trigger="click" placement="bottom-start" @on-click="function(e){ filterPeriod = e }" @on-visible-change="dropdownStates" v-if="$store.state.user.schoolProfile.school_base">
-            <span style="cursor: pointer;">
-                <span v-show="showLabel">{{$t('teachContent.uploadTo')}}</span>
-                <b class="title">{{ filterPeriodName }}</b>
-                <Icon type="ios-arrow-down" style="margin-left:8px;"></Icon>
-            </span>
-            <DropdownMenu slot="list" v-for="(item,index) in periods" :value="item.id" :key="index">
-                <DropdownItem :name="item.id">{{ item.name }}</DropdownItem>
-            </DropdownMenu>
-            <DropdownMenu slot="list">
-                <DropdownItem name="public">{{$t('teachContent.public')}}</DropdownItem>
-            </DropdownMenu>
-        </Dropdown>
+    <div class="apply-select-wrap dark-iview-select">
+        <div class="apply-item">
+            <span v-show="showLabel">{{$t('teachContent.applyPd')}}</span>
+            <Select v-model="filterPeriod" multiple style="width:200px" @on-change="pdChange" :max-tag-count="2">
+                <Option v-for="item in periods" :value="item.id" :key="item.id">{{ item.name }}</Option>
+            </Select>
+        </div>
+        <div class="apply-item">
+            <span v-show="showLabel">{{$t('teachContent.applySub')}}</span>
+            <Select v-model="filterSubject" multiple style="width:200px" @on-change="tagChange" :max-tag-count="2">
+                <Option v-for="item in subjects" :value="item.id" :key="item.id">{{ item.name }}</Option>
+            </Select>
+        </div>
+        <div class="apply-item" style="margin-right:0px">
+            <span v-show="showLabel">{{$t('teachContent.applyGrade')}}</span>
+            <Select v-model="filterGrade" multiple style="width:200px" @on-change="tagChange" :max-tag-count="2">
+                <Option v-for="(item,index) in grades" :value="index" :key="index">{{ item }}</Option>
+            </Select>
+        </div>
     </div>
 </template>
 
@@ -21,27 +26,37 @@ import { mapGetters } from 'vuex'
 export default {
     name: 'BasePdSelect',
     props: {
-        pdId:{
-            type:String,
-            default:''
+        pdId: {
+            type: String,
+            default: ''
         },
-        showLabel:{
-            type:Boolean,
-            default:false
+        showLabel: {
+            type: Boolean,
+            default: false
+        },
+        onlyPd: {
+            type: Boolean,
+            default: true
         }
     },
     data() {
         return {
-            filterPeriod: '',
+            filterGrade: [],
+            filterPeriod: [],
+            filterSubject: [],
+            schoolBase: {
+                period: []
+            }
         }
     },
     created() {
         this.$store.dispatch('user/getSchoolProfile').then(
             (res) => {
                 if (res) {
+                    this.schoolBase = res.school_base
                     if (this.periods && !this.pdId) {
                         this.filterPeriod = this.periods[0].id
-                    }else{
+                    } else {
                         this.filterPeriod = this.pdId
                     }
                 }
@@ -52,50 +67,76 @@ export default {
         )
     },
     methods: {
-        dropdownStates(flag) {
-            // if (!flag) this.filterByPeriod()
+        pdChange(data) {
+            //处理学段单选 (如果学段多选,学科和年级不知道对应的是哪个学段)
+            if (data.length) {
+                this.filterPeriod = [data[data.length - 1]]
+            }else{
+                this.filterPeriod = []
+            }
+            this.$emit('tag-change', {
+                period: this.filterPeriod,
+                grades: this.filterGrade,
+                subjects: this.filterSubject
+            })
+        },
+        tagChange() {
+            this.$emit('tag-change', {
+                period: this.filterPeriod,
+                grades: this.filterGrade,
+                subjects: this.filterSubject
+            })
         }
     },
     computed: {
         ...mapGetters({
             periods: 'user/getPeriods', // 學制s
         }),
-        filterPeriodName(){
-            let data = this.periods
-            let pId = this.filterPeriod
-            let name = ''
-            if (pId !== '') {
-                let temp = data.find(item => {
-                    return pId == item.id
+        subjects() {
+            if (this.schoolBase.period && this.filterPeriod) {
+                let pdData = this.schoolBase.period.find(item => {
+                    return item.id == this.filterPeriod
                 })
-                if (temp) {
-                    name = temp.name
-                }else{
-                    name = this.$t('teachContent.public')
+                if (pdData) {
+                    return pdData.subjects
+                } else {
+                    return []
                 }
+            } else {
+                return []
             }
-            return name
         },
+        grades() {
+            if (this.schoolBase.period && this.filterPeriod) {
+                let pdData = this.schoolBase.period.find(item => {
+                    return item.id == this.filterPeriod
+                })
+                if (pdData) {
+                    return pdData.grades
+                } else {
+                    return []
+                }
+            } else {
+                return []
+            }
+        }
     },
     watch: {
-        filterPeriod() {
-            this.$emit('pd-change', this.filterPeriod)
-        },
-        pdId:{
-            handler(){
-                this.filterPeriod = this.pdId
-            }, 
-            immediate:true
+        pdId: {
+            handler() {
+                this.filterPeriod = [this.pdId]
+            },
+            immediate: true
         }
     }
 }
 </script>
-<style lang="less">
-.pd-select-wrap {
-    display: inline-block;
+<style scope lang="less">
+.apply-select-wrap {
     color: #a5a5a5;
 }
 .sort-dropdown {
+    margin-right: 30px;
     .title {
         color: white;
         font-size: 14px;
@@ -115,4 +156,19 @@ export default {
         }
     }
 }
+.apply-item {
+    margin-bottom: 6px;
+    display: inline-block;
+    margin-right: 15px;
+}
 </style>
+<style lang="less">
+.apply-item .ivu-tag {
+    background: #1fb06d;
+    border-color: #1fb06d;
+}
+.apply-item .ivu-tag-text,
+.apply-item .ivu-tag .ivu-icon-ios-close {
+    color: white;
+}
+</style>

+ 17 - 2
TEAMModelOS/ClientApp/src/view/teachcontent/index.less

@@ -516,7 +516,22 @@
 }
 .content-filter-wrap{
     position: absolute;
-    left: 120px;
+    left: 180px;
     display: flex;
-    margin-top: 12px;
+    top: 12px;
+}
+.table-file-name{
+    text-overflow:ellipsis; 
+    overflow:hidden; 
+    white-space:nowrap; 
+    width: ~"calc(100% - 30px)";
+    display: inline-block;
+    vertical-align: top;
+}
+.text-ellipsis{
+    text-overflow:ellipsis; 
+    overflow:hidden; 
+    white-space:nowrap; 
+    width: 100%;
+    display: inline-block;
 }

+ 239 - 31
TEAMModelOS/ClientApp/src/view/teachcontent/index.vue

@@ -81,8 +81,17 @@
             <div class="content-file-list-box">
                 <!--筛选、操作域-->
                 <div class="content-file-filter">
-                    <ResBelong class="pd-filter-wrap" v-show="routerScope == 'school'" @pd-change="(data)=>{filterPeriod = data}"></ResBelong>
-                    <div class="content-filter-wrap">
+                    <!-- 学段筛选条件 -->
+                    <Dropdown class="sort-dropdown" trigger="click" placement="bottom-start" @on-click="function(e){ filterPeriod = e }" @on-visible-change="dropdownStates" v-if="schoolBase && schoolBase.period && routerScope == 'school'">
+                        <span style="cursor: pointer;">
+                            <b class="title">{{ filterPeriodName }}</b>
+                            <Icon type="ios-arrow-down" style="margin-left:8px;"></Icon>
+                        </span>
+                        <DropdownMenu slot="list" v-for="(item,index) in schoolBase.period" :value="item.id" :key="index">
+                            <DropdownItem :name="item.id">{{ item.name }}</DropdownItem>
+                        </DropdownMenu>
+                    </Dropdown>
+                    <div class="content-filter-wrap" :style="{left: routerScope == 'school' ? '180px':'30px'}">
                         <Input v-model="keyWord" search size="small" :placeholder="$t('teachContent.searchText')" class="key-word-search" @on-change="searchKeyWord" @on-search="searchKeyWord" />
                         <CheckboxGroup v-model="extFilter" @on-change="filterFileByExtension">
                             <Checkbox :label="item" v-for="(item ,index) in extensions" :key="index">
@@ -119,7 +128,20 @@
                                     {{formatDate(row.createTime)}}
                                 </div>
                             </template>
+                            <!-- 适用学科 -->
+                            <template slot-scope="{ row, index }" slot="subject">
+                                <span class="text-ellipsis">
+                                    {{getSubjects(row.subjectId)}}
+                                </span>
+                            </template>
+                            <!-- 适用年级 -->
+                            <template slot-scope="{ row, index }" slot="grade">
+                                <span class="text-ellipsis">
+                                    {{getGrades(row.gradeId)}}
+                                </span>
+                            </template>
                             <template slot-scope="{ row, index }" slot="name">
+                                <!-- 文件图标 -->
                                 <div class="dark-iview-input disabled-iview-input teach-file-name">
                                     <div class="file-icon">
                                         <img v-if="row.extension == 'PPT' || row.extension == 'PPTX'" src="../../assets/icon/ppt50.png" width="15" />
@@ -132,7 +154,7 @@
                                         <img v-else-if="row.type == 'res'" src="../../assets/icon/htex.png" width="15" />
                                         <img v-else src="../../assets/icon/prelearn50.png" width="15" />
                                     </div>
-                                    <span v-show="editIndex !== index">{{row.name}}</span>
+                                    <span class="table-file-name" v-show="editIndex !== index">{{row.name}}</span>
                                     <Input v-model="fileListShow[index].name" v-show="editIndex == index" style="width: 300px;" @on-change="checkName" />
                                     <span style="color:#ed4014" v-show="editIndex == index && formatErr">{{$t('teachContent.specialChart')}}(?*:"<>\/|)</span>
                                     <Icon type="md-checkmark" v-show="editIndex == index && !formatErr" @click="confirmRename" class="rename-action-icon" />
@@ -206,6 +228,9 @@ export default {
     },
     data() {
         return {
+            schoolBase: {
+                period: []
+            },
             filterPeriod: '',
             formatErr: false,
             sizeLoading: false,
@@ -257,6 +282,50 @@ export default {
         }
     },
     methods: {
+        //根据学科id换取名称
+        getSubjects(ids) {
+            if (this.schoolBase && this.schoolBase.period && this.filterPeriod && ids) {
+                let pdDada = this.schoolBase.period.find(item => {
+                    return item.id == this.filterPeriod
+                })
+                if (pdDada) {
+                    let subjects = pdDada.subjects.filter(item => {
+                        return ids.includes(item.id)
+                    })
+                    return subjects.map(item => {
+                        return item.name
+                    }).join(',')
+                } else {
+                    return ''
+                }
+            } else {
+                return ''
+            }
+        },
+        // 根据年级index换取名称
+        getGrades(ids) {
+            if (this.schoolBase && this.schoolBase.period && this.filterPeriod && ids) {
+                let pdDada = this.schoolBase.period.find(item => {
+                    return item.id == this.filterPeriod
+                })
+                if (pdDada) {
+                    let grades = []
+                    ids.forEach(item => {
+                        if (pdDada.grades[item]) {
+                            grades.push(pdDada.grades[item])
+                        }
+                    })
+                    return grades.join(',')
+                } else {
+                    return ''
+                }
+            } else {
+                return ''
+            }
+        },
+        dropdownStates(status) {
+
+        },
         //检查文件特殊字符
         checkName(data) {
             let reg = new RegExp('[?*:"<>\/|]')
@@ -482,13 +551,14 @@ export default {
                     title: this.$t('teachContent.tableC1'),
                     slot: 'name',
                     key: 'name',
-                    sortable: true
+                    sortable: true,
+                    minWidth: 180
                 },
                 {
                     title: this.$t('teachContent.tableC4'),
                     slot: 'size',
                     key: 'size',
-                    width: 120,
+                    width: 110,
                     align: 'center',
                     sortable: true
                 },
@@ -496,17 +566,46 @@ export default {
                     title: this.$t('teachContent.tableC6'),
                     slot: 'createTime',
                     key: 'createTime',
-                    width: 150,
+                    width: 120,
                     sortable: true,
                     align: 'center'
                 },
                 {
                     title: this.$t('teachContent.tableC2'),
                     slot: 'action',
-                    width: 160,
+                    width: 150,
                     align: 'center'
                 }
             ]
+            if (this.routerScope == 'school') {
+                // 获取当前学科做筛选条件
+                let subFilters = []
+                let gradeFilters = []
+
+                // 获取当前年级做筛选条件
+
+                let arr = [
+                    {
+                        title: '适用学科',
+                        slot: 'subject',
+                        width: 150,
+                        filters: subFilters,
+                        filterMethod: (value, row) => {
+                            return !row.subjectId || !row.subjectId.length || row.subjectId.includes(value)
+                        }
+                    },
+                    {
+                        title: '适用年级',
+                        slot: 'grade',
+                        width: 150,
+                        filters: gradeFilters,
+                        filterMethod: (value, row) => {
+                            return !row.gradeId || !row.gradeId.length || row.gradeId.includes(value)
+                        }
+                    }
+                ]
+                this.fileColumns.splice(2, 0, ...arr)
+            }
             this.contentTypeList = [
                 {
                     label: '最近',
@@ -867,41 +966,76 @@ export default {
         findFileList() {
             if (this.containerClient) {
                 this.isLoading = true
-                let option = {
-                    //maxPageSize: 290
-                }
-                if (this.mk[this.activeType]) {
-                    option.continuationToken = this.mk[this.activeType]
+                let rd = {
+                    "name": this.routerScope == 'school' ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId,
+                    "type": this.activeType,
+                    "scope": this.routerScope,
+                    "periodId": this.filterPeriod
                 }
-                let prefix = this.activeType
-                this.containerClient.listBlob({ prefix }, option).then(
-                    (res) => {
-                        this.mk[this.activeType] = res.continuationToken
-                        //拼接授权字符串
-                        for (let i in res.blobList) {
-                            res.blobList[i].url = res.blobList[i].url + this.sasString
-                            if (res.blobList[i].type == 'image') {
-                                res.blobList[i].thum = res.blobList[i].url.replace('/image/', '/thum/')
-                            } else if (res.blobList[i].type == 'video') {
-                                let n = res.blobList[i].blob
+                this.$api.blob.listBlobInfo(rd, this.urlString, this.containerName).then(
+                    res => {
+                        console.log('转化之后的数据格式:', res)
+                        for (let i in res) {
+                            res[i].url = res[i].url + this.sasString
+                            if (res[i].type == 'image') {
+                                res[i].thum = res[i].url.replace('/image/', '/thum/')
+                            } else if (res[i].type == 'video') {
+                                let n = res[i].blob
                                 n = n.replace('/video/', '/thum/')
-                                n = n.replace(res.blobList[i].name, res.blobList[i].name.slice(0, res.blobList[i].name.lastIndexOf('.'))) + '.png'
-                                res.blobList[i]['thum'] = res.blobList[i].url.replace(res.blobList[i].blob, n)
+                                n = n.replace(res[i].name, res[i].name.slice(0, res[i].name.lastIndexOf('.'))) + '.png'
+                                res[i]['thum'] = res[i].url.replace(res[i].blob, n)
                             }
                         }
-                        this.fileList[this.activeType] = res.blobList
+                        this.fileList[this.activeType] = res
                         this.fileListShow = this._.cloneDeep(this.fileList[this.activeType])
                         this.searchBefore = this.fileList[this.activeType]
                         this.getFilesExtension()
                     },
-                    (err) => {
-
+                    err => {
+                        console.log('error')
                     }
                 ).finally(() => {
                     setTimeout(() => {
                         this.isLoading = false
                     }, 500)
                 })
+
+                //原来由前端直接listblob的逻辑
+                // let option = {
+                //     //maxPageSize: 290
+                // }
+                // if (this.mk[this.activeType]) {
+                //     option.continuationToken = this.mk[this.activeType]
+                // }
+                // let prefix = this.activeType
+                // this.containerClient.listBlob({ prefix }, option).then(
+                //     (res) => {
+                //         this.mk[this.activeType] = res.continuationToken
+                //         //拼接授权字符串
+                //         for (let i in res.blobList) {
+                //             res.blobList[i].url = res.blobList[i].url + this.sasString
+                //             if (res.blobList[i].type == 'image') {
+                //                 res.blobList[i].thum = res.blobList[i].url.replace('/image/', '/thum/')
+                //             } else if (res.blobList[i].type == 'video') {
+                //                 let n = res.blobList[i].blob
+                //                 n = n.replace('/video/', '/thum/')
+                //                 n = n.replace(res.blobList[i].name, res.blobList[i].name.slice(0, res.blobList[i].name.lastIndexOf('.'))) + '.png'
+                //                 res.blobList[i]['thum'] = res.blobList[i].url.replace(res.blobList[i].blob, n)
+                //             }
+                //         }
+                //         this.fileList[this.activeType] = res.blobList
+                //         this.fileListShow = this._.cloneDeep(this.fileList[this.activeType])
+                //         this.searchBefore = this.fileList[this.activeType]
+                //         this.getFilesExtension()
+                //     },
+                //     (err) => {
+
+                //     }
+                // ).finally(() => {
+                //     setTimeout(() => {
+                //         this.isLoading = false
+                //     }, 500)
+                // })
             }
         },
 
@@ -981,14 +1115,41 @@ export default {
                 this.extensions.push(ext.toUpperCase())
             }
             this.extensions = [...new Set(this.extensions)]
+        },
+        //根据学段筛选资源
+        filterByPeriod() {
+            // let files = this.fileList[this.activeType] || []
+            // this.fileListShow = files.filter(item => {
+            //     return !item.periodId || !item.periodId.length || item.periodId.includes(this.filterPeriod)
+            // })
+            this.fileList = {}
+            this.findFileList()
         }
+
+    },
+    computed: {
+        filterPeriodName() {
+            if (this.schoolBase && this.schoolBase.period) {
+                let data = this.schoolBase.period
+                let pId = this.filterPeriod
+                let name = ''
+                if (pId !== '') {
+                    let temp = data.filter(item => {
+                        return pId == item.id
+                    })
+                    if (temp.length > 0) name = temp[0].name
+                }
+                return name
+            } else {
+                return ''
+            }
+
+        },
     },
     mounted() {
         let box = document.getElementById('card-box')
         this.waterfallWidth = box.clientWidth - 60
-        Date.prototype.toLocaleString = function () {
-            return this.getFullYear() + '/' + (this.getMonth() + 1) + '/' + this.getDate()
-        }
+
         //处理瀑布流组件宽度
         this.erd = elementResizeDetectorMaker()
         this.erd.listenTo(document.getElementById("card-box"), () => {
@@ -1003,6 +1164,20 @@ export default {
         })
     },
     created() {
+        this.$store.dispatch('user/getSchoolProfile').then(
+            (res) => {
+                if (res) {
+                    this.schoolBase = res.school_base
+                    if (this.schoolBase.period.length) this.filterPeriod = this.schoolBase.period[0].id
+                }
+            },
+            (err) => {
+                this.$Message.error('API error!')
+            }
+        )
+        Date.prototype.toLocaleString = function () {
+            return this.getFullYear() + '/' + (this.getMonth() + 1) + '/' + this.getDate()
+        }
         this.initData()
         let cont = ''
         if (this.$route.name == 'schoolcontent') {
@@ -1040,12 +1215,45 @@ export default {
                 this.getSasStr()
             },
             immediate: true
+        },
+        filterPeriod: {
+            handler(n, o) {
+                this.filterByPeriod()
+                // 获取当前学科做筛选条件
+                let subFilters = []
+                let gradeFilters = []
+                if (this.schoolBase && this.schoolBase.period && this.filterPeriod) {
+                    let pdData = this.schoolBase.period.find(item => {
+                        return this.filterPeriod == item.id
+                    })
+                    if (pdData) {
+                        subFilters = pdData.subjects.map(item => {
+                            return {
+                                label: item.name,
+                                value: item.id
+                            }
+                        })
+                        gradeFilters = pdData.grades.map((item, index) => {
+                            return {
+                                label: item,
+                                value: index + ''
+                            }
+                        })
+                    }
+                }
+                this.fileColumns[2].filters = subFilters
+                this.fileColumns[3].filters = gradeFilters
+            }
         }
     }
 }
 </script>
 <style scoped lang="less">
 @import "./index.less";
+.sort-dropdown {
+    margin-left: 15px;
+    padding-top: 15px;
+}
 </style>
 <style>
 .content-file-filter .ivu-input {