|
|
@@ -27,12 +27,29 @@
|
|
|
</div>
|
|
|
</el-card>
|
|
|
</el-row>
|
|
|
+ <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
|
|
|
+ <el-card class="box-card">
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
+ <span>文件信息</span>
|
|
|
+ </div>
|
|
|
+ <div class="text item">
|
|
|
+ <el-form ref="form" :model="uploadedFile" label-width="80px">
|
|
|
+ <el-form-item label="UploadId">
|
|
|
+ <el-input v-model="uploadedFile.uploadId" style="width: 70%; padding-right: 10px" readonly />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="URL">
|
|
|
+ <el-input v-model="uploadedFile.url" type="textarea" style="width: 70%; padding-right: 10px" readonly />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
+ </el-row>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getVideoChannelInfo } from '@/api/file'
|
|
|
+import { getFileChannelInfo } from '@/api/file'
|
|
|
import { hashFile } from '@/utils/functions'
|
|
|
|
|
|
export default {
|
|
|
@@ -43,11 +60,15 @@ export default {
|
|
|
options: null,
|
|
|
attrs: {
|
|
|
accept: '*'
|
|
|
+ },
|
|
|
+ uploadedFile: {
|
|
|
+ uploadId: 'null',
|
|
|
+ url: ''
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- getVideoChannelInfo().then(res => {
|
|
|
+ getFileChannelInfo().then(res => {
|
|
|
if (res.code === 0) {
|
|
|
const resData = res.data
|
|
|
this.options = {
|
|
|
@@ -61,11 +82,11 @@ export default {
|
|
|
// 服务器分片校验函数, 秒传及断点续传基础
|
|
|
checkChunkUploadedByResponse: function(chunk, message) {
|
|
|
const objMessage = JSON.parse(message)
|
|
|
- if (objMessage.skipUpload) {
|
|
|
+ const respData = objMessage.data
|
|
|
+ if (respData.skipUpload) {
|
|
|
return true
|
|
|
}
|
|
|
-
|
|
|
- return (objMessage.uploaded || []).indexOf(chunk.offset + 1) >= 0
|
|
|
+ return (respData.uploaded || []).indexOf(chunk.offset + 1) >= 0
|
|
|
},
|
|
|
query: (file, chunk) => {
|
|
|
return {
|
|
|
@@ -113,7 +134,6 @@ export default {
|
|
|
|
|
|
file.pause()
|
|
|
hashFile(file.file).then(result => {
|
|
|
- console.log(result.sha256sum)
|
|
|
this.startUpload(result.sha256sum, file)
|
|
|
})
|
|
|
},
|
|
|
@@ -127,7 +147,8 @@ export default {
|
|
|
onFileSuccess(rootFile, file, response, chunk) {
|
|
|
const resp = JSON.parse(response)
|
|
|
if (resp.code === 0) {
|
|
|
- console.log(resp.data)
|
|
|
+ this.uploadedFile.uploadId = resp.data.uploadId
|
|
|
+ this.uploadedFile.url = resp.data.url
|
|
|
this.$notify({
|
|
|
title: '提示',
|
|
|
message: '文件已上传',
|
|
|
@@ -144,7 +165,6 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
onFileError(rootFile, file, response, chunk) {
|
|
|
- console.log(response)
|
|
|
// const res = JSON.parse(response)
|
|
|
this.$notify({
|
|
|
title: '提示',
|