|
@@ -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 {
|