|
@@ -94,20 +94,20 @@
|
|
|
<div class="card-item animated fadeIn" v-for="(item,index) in fileListShow" :key="index">
|
|
|
<span class="file-name">{{item.fileName}}</span>
|
|
|
<img :src="item.compressUrl+sasString"
|
|
|
- width="300" />
|
|
|
+ width="300" style="border-radius:5px;"/>
|
|
|
<div class="item-tools">
|
|
|
<Icon type="md-download"
|
|
|
size="18"
|
|
|
color="white"
|
|
|
- title="下载文件" />
|
|
|
+ title="下载文件" @click="downloadFile(index)"/>
|
|
|
<Icon type="md-eye"
|
|
|
size="18"
|
|
|
color="white"
|
|
|
- title="预览文件" />
|
|
|
+ title="预览文件" @click="openPreviewFile(index)"/>
|
|
|
<Icon type="md-infinite" size="18" color="white" title="绑定知识点" />
|
|
|
- <Icon type="md-trash" size="18" color="white" title="删除文件" />
|
|
|
+ <Icon type="md-trash" size="18" color="white" title="删除文件" @click="delFile(index)"/>
|
|
|
<span style="color:white; float:right;">{{formatDate(item.createTime)}}</span>
|
|
|
- <span style="color:white; float:right;margin-right:10px;">{{item.size/1204 > 1024 ? (item.size/1204/1204).toFixed(1) + 'M': (item.size/1204).toFixed(1) + 'KB'}}</span>
|
|
|
+ <span style="color:white; float:right;margin-right:10px;">{{item.size/1024 > 1024 ? (item.size/1024/1024).toFixed(1) + 'M': (item.size/1024).toFixed(1) + 'KB'}}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -117,24 +117,21 @@
|
|
|
</div>
|
|
|
<Modal v-model="uploadStatus"
|
|
|
title="上传教学资源" class="upload-modal" @on-ok="confirmUpload" width="660" :mask-closable="false">
|
|
|
- <!--<Upload type="drag" :action="uploadUrl" multiple :on-success="getFileUrl" :before-upload="checkSize">
|
|
|
- <p style="margin:20px 0px;font-size:20px;">点击或者拖拽上传</p>
|
|
|
- <Icon type="ios-cloud-upload" size="50" style="margin-bottom:30px;" />
|
|
|
- </Upload>-->
|
|
|
- <UploadFile @successData="getFileUrl" :uploadUrl="uploadUrl" :pathName="demoLoginInfo.teamModelId.replace('#','')"></UploadFile>
|
|
|
+ <UploadFile @successData="getFileUrl" :uploadUrl="uploadUrl" :pathName="demoLoginInfo.TEAMModelId.replace('#','')" :quality="1"></UploadFile>
|
|
|
</Modal>
|
|
|
<Modal v-model="previewStatus"
|
|
|
- :title="previewFile.fileName" width="800px">
|
|
|
- <video v-if="previewFile.type == 'video'" :src="previewFile.blobUrl" width="780">
|
|
|
+ :title="previewFile.fileName" width="800px" class="upload-modal">
|
|
|
+ <video v-if="previewFile.type == 'video'" :src="previewFile.blobUrl+sasString" width="780" controls="controls">
|
|
|
您的浏览器不支持 video 标签。
|
|
|
</video>
|
|
|
- <img v-if="previewFile.type == 'picture'" :src="previewFile.blobUrl" width="780" />
|
|
|
- <embed v-if="previewFile.type == 'document'" :src="previewFile.blobUrl" width="780" height="600" />
|
|
|
+ <img v-if="previewFile.type == 'picture'" :src="previewFile.blobUrl+sasString" width="780" style="border-radius:5px;"/>
|
|
|
+ <embed v-if="previewFile.type == 'document'" :src="previewFile.blobUrl+sasString" width="780" height="600" />
|
|
|
<div slot="footer"></div>
|
|
|
</Modal>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+ import axios from 'axios'
|
|
|
import EditableLabel from '@/common/EditableLabel.vue'
|
|
|
import UploadFile from '@/common/UploadFile.vue'
|
|
|
export default {
|
|
@@ -196,7 +193,7 @@
|
|
|
],
|
|
|
previewFile: {
|
|
|
id: 'sha1Code+contentType+size',
|
|
|
- teamModelId: 'habook#0001',
|
|
|
+ TEAMModelId: 'habook#0001',
|
|
|
fileName: '测试文件类型列表PPT01',
|
|
|
extension: 'ppt',
|
|
|
contentType: 'image/jpeg',
|
|
@@ -216,7 +213,7 @@
|
|
|
keyWord: '',
|
|
|
demoLoginInfo: {
|
|
|
user: 'admin',
|
|
|
- teamModelId: 'habook#0001',
|
|
|
+ TEAMModelId: 'habook#0001',
|
|
|
school: '醍摩豆书院',
|
|
|
schoolCode: 'HBCN'
|
|
|
},
|
|
@@ -229,7 +226,7 @@
|
|
|
schoolFileList: [
|
|
|
{
|
|
|
id: 'sha1Code+contentType+size',
|
|
|
- teamModelId: 'habook#0001',
|
|
|
+ TEAMModelId: 'habook#0001',
|
|
|
fileName: '校本资源PPT01',
|
|
|
extension: 'ppt',
|
|
|
contentType: 'image/jpeg',
|
|
@@ -303,27 +300,37 @@
|
|
|
}
|
|
|
},
|
|
|
delFile(index) {
|
|
|
- this.$api.teachContent.deleteResource(
|
|
|
- {
|
|
|
- id: this.fileListShow[index].id
|
|
|
- }
|
|
|
- ).then(
|
|
|
- (res) => {
|
|
|
- if (res.error == null) {
|
|
|
- let originalIndex = this.fileList.indexOf(this.fileListShow[index])
|
|
|
- this.fileList.splice(originalIndex, 1)
|
|
|
- this.fileListShow.splice(index, 1)
|
|
|
- this.$Message.success('文件删除成功!');
|
|
|
- this
|
|
|
- } else {
|
|
|
- this.$Message.error('文件删除失败!');
|
|
|
- }
|
|
|
+ this.$Modal.confirm({
|
|
|
+ title: '确认删除',
|
|
|
+ content: "<p class='dialog-p'>" +this.fileListShow[index].fileName + "</p>",
|
|
|
+ onOk: () => {
|
|
|
+ this.$api.teachContent.deleteResource(
|
|
|
+ {
|
|
|
+ id: this.fileListShow[index].id
|
|
|
+ }
|
|
|
+ ).then(
|
|
|
+ (res) => {
|
|
|
+ if (res.error == null) {
|
|
|
+ let originalIndex = this.fileList.indexOf(this.fileListShow[index])
|
|
|
+ this.fileList.splice(originalIndex, 1)
|
|
|
+ this.fileListShow.splice(index, 1)
|
|
|
+ this.$Message.success('文件删除成功!');
|
|
|
+ this
|
|
|
+ } else {
|
|
|
+ this.$Message.error('文件删除失败!');
|
|
|
+ }
|
|
|
|
|
|
- },
|
|
|
- (err) => {
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
|
|
|
+ }
|
|
|
+ )
|
|
|
+ },
|
|
|
+ onCancel: () => {
|
|
|
+ this.$Message.info('取消删除!');
|
|
|
}
|
|
|
- )
|
|
|
+ })
|
|
|
+
|
|
|
},
|
|
|
handleEditFileName(val, index) {
|
|
|
if (this.rangeType == 1) {
|
|
@@ -343,24 +350,27 @@
|
|
|
}
|
|
|
},
|
|
|
setFileNameEdit(index) {
|
|
|
- console.log(this.$refs)
|
|
|
this.$refs['fileNameLabel' + index].handleEdit()
|
|
|
},
|
|
|
- previewOrDownloadFile(index) {
|
|
|
- if (this.fileListShow[index].type == 'video' || this.fileListShow[index].type == 'picture' || this.fileListShow[index].extension == 'pdf') {
|
|
|
- this.previewFile = this.fileListShow[index]
|
|
|
- this.previewStatus = true
|
|
|
- } else {
|
|
|
- window.location.href = this.fileListShow[index].blobUrl
|
|
|
- this.$Message.warning('抱歉,此文件不支持预览')
|
|
|
- }
|
|
|
- },
|
|
|
downloadFile(index) {
|
|
|
window.location.href = this.fileListShow[index].blobUrl + this.sasString
|
|
|
+ //axios.get(this.fileListShow[index].blobUrl + this.sasString,
|
|
|
+ // {
|
|
|
+ // //params: true,
|
|
|
+ // headers: {
|
|
|
+ // 'Content-Type': 'application/octet-stream'
|
|
|
+ // }
|
|
|
+ // }).then(
|
|
|
+ // res => {
|
|
|
+
|
|
|
+ // },
|
|
|
+ // err => {
|
|
|
+ // }
|
|
|
+ // )
|
|
|
},
|
|
|
openPreviewFile(index) {
|
|
|
this.previewFile = this.fileListShow[index]
|
|
|
- this.previewFile.blobUrl = this.previewFile.blobUrl + this.sasString
|
|
|
+ this.previewFile.blobUrl = this.previewFile.blobUrl
|
|
|
this.previewStatus = true
|
|
|
},
|
|
|
formatDate(timestamp) {
|
|
@@ -370,7 +380,7 @@
|
|
|
findFileList() {
|
|
|
this.$api.teachContent.findResourceByDict(
|
|
|
{
|
|
|
- teamModelId: this.demoLoginInfo.teamModelId
|
|
|
+ TEAMModelId: this.demoLoginInfo.TEAMModelId
|
|
|
}
|
|
|
).then(
|
|
|
(res) => {
|
|
@@ -393,7 +403,6 @@
|
|
|
)
|
|
|
},
|
|
|
confirmUpload() {
|
|
|
- console.log(this.uploadFileList)
|
|
|
this.$api.teachContent.saveOrUpdateResource(this.uploadFileList).then(
|
|
|
(res) => {
|
|
|
if (res.error == null) {
|
|
@@ -411,9 +420,11 @@
|
|
|
this.uploadStatus = !this.uploadStatus
|
|
|
},
|
|
|
getFileUrl(file) { //获取文件地址
|
|
|
+ console.log('-------')
|
|
|
+ console.log(file)
|
|
|
this.uploadFileList.push({
|
|
|
schoolCode: this.demoLoginInfo.schoolCode,
|
|
|
- teamModelId: this.demoLoginInfo.teamModelId,
|
|
|
+ TEAMModelId: this.demoLoginInfo.TEAMModelId,
|
|
|
fileName: file.fileName,
|
|
|
extension: file.extension,
|
|
|
contentType: file.contentType,
|
|
@@ -426,8 +437,6 @@
|
|
|
sha1Code: file.sha1Code,
|
|
|
compressUrl: file.compressUrl
|
|
|
})
|
|
|
- console.log('111111111111111')
|
|
|
- console.log(this.uploadFileList)
|
|
|
},
|
|
|
groupByKey(array, key) {
|
|
|
const groups = {}
|
|
@@ -505,7 +514,7 @@
|
|
|
mounted() {
|
|
|
this.findFileList()
|
|
|
//this.uploadUrl = '//' + window.location.host + '/api/File/uploadFile';
|
|
|
- this.uploadUrl = 'https://teammodelostest.blob.core.chinacloudapi.cn/spatest/' + this.demoLoginInfo.teamModelId.replace('#','')
|
|
|
+ this.uploadUrl = 'https://teammodelostest.blob.core.chinacloudapi.cn/spatest/' + this.demoLoginInfo.TEAMModelId.replace('#','')
|
|
|
let box = document.getElementsByClassName('content-file-list')
|
|
|
this.boxWidth = box[0].clientWidth
|
|
|
Date.prototype.toLocaleString = function () {
|
|
@@ -527,7 +536,9 @@
|
|
|
/*height:24px;*/
|
|
|
color: white;
|
|
|
}
|
|
|
-
|
|
|
+ .dialog-p {
|
|
|
+ word-wrap:break-word;
|
|
|
+ }
|
|
|
.key-word-search {
|
|
|
width: 240px;
|
|
|
float: right;
|