阿里云oss

dev_review
yujialong 1 year ago
parent f1c6f571f8
commit 4597a8919e
  1. 4
      src/components/upload/index.vue
  2. 100
      src/views/course/contentSettings.vue
  3. 3
      src/views/match/list/index.vue
  4. 1720
      src/views/theoreticalCourse/contentSettings/index.vue

@ -111,7 +111,7 @@ export default {
}); });
this.uploading = false this.uploading = false
const url = 'http://huoran.oss-cn-shenzhen.aliyuncs.com/' + name const url = 'https://huoran.oss-cn-shenzhen.aliyuncs.com/' + name
this.changeFileList && this.$emit('update:fileList', [ this.changeFileList && this.$emit('update:fileList', [
...this.fileList, ...this.fileList,
{ {
@ -124,7 +124,7 @@ export default {
this.$emit('onSuccess', { this.$emit('onSuccess', {
format: util.getFileExt(file.name), format: util.getFileExt(file.name),
name: file.name, name: file.name,
url: url, url,
size: file.size, size: file.size,
}) })
} catch (error) { } } catch (error) { }

@ -169,25 +169,6 @@
<p>视频请上传MP4格式大小不超过150Moffice文件大小不要超过10M</p> <p>视频请上传MP4格式大小不超过150Moffice文件大小不要超过10M</p>
</template> </template>
</Upload> </Upload>
<!-- <el-upload :before-upload="beforeUpload"
:on-remove="handleRemove"
:on-error="uploadError"
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
:action="this.api.fileupload"
:file-list="uploadList"
:headers="headers"
:http-request="handleRequest"
name="file">
<el-button size="small"><img src="@/assets/img/upload.png"
alt=""> 上传资源</el-button>
<div slot="tip"
class="el-upload__tip">视频请上传MP4格式大小不超过150Moffice文件大小不要超过10M</div>
</el-upload>
<el-progress v-if="showProgress"
:stroke-width="3"
:percentage="progressPercent"></el-progress> -->
</el-form-item> </el-form-item>
<el-form-item label="小节名称"> <el-form-item label="小节名称">
<el-input placeholder="请输入小节名称" <el-input placeholder="请输入小节名称"
@ -216,24 +197,6 @@
@onSuccess="uploadSuccess"> @onSuccess="uploadSuccess">
<div slot="tip"></div> <div slot="tip"></div>
</Upload> </Upload>
<!-- <el-upload :before-upload="beforeUpload"
:on-remove="handleRemove"
:on-error="uploadError"
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
:action="this.api.fileupload"
:file-list="uploadList"
:headers="headers"
:http-request="handleRequest"
name="file">
<el-button size="small"><img src="@/assets/img/upload.png"
alt=""> 上传资源</el-button>
</el-upload>
<el-progress v-if="showProgress"
:stroke-width="3"
:percentage="progressPercent"></el-progress> -->
</div> </div>
<span slot="footer" <span slot="footer"
class="dialog-footer"> class="dialog-footer">
@ -277,7 +240,7 @@
style="transform: scale(1) rotate(0deg);margin-top: -1px; max-height: 100%; max-width: 100%;"> style="transform: scale(1) rotate(0deg);margin-top: -1px; max-height: 100%; max-width: 100%;">
</div> </div>
</div> </div>
<div v-show="iframeSrc" <div v-show="iframeSrc || videoSrc"
class="el-image-viewer__wrapper" class="el-image-viewer__wrapper"
:class="{active: iframeSrc}" :class="{active: iframeSrc}"
style="z-index: 2000"> style="z-index: 2000">
@ -293,6 +256,16 @@
id="fileIframe" id="fileIframe"
:src="iframeSrc" :src="iframeSrc"
frameborder="0"></iframe> frameborder="0"></iframe>
<video v-if="videoSrc"
class="video"
width="1200"
height="600"
autoplay
controls>
<source :src="videoSrc"
type="video/mp4">
您的浏览器不支持 video 标签
</video>
<template v-if="showMask"> <template v-if="showMask">
<div class="mask" <div class="mask"
style="width: 200px;height: 30px;top: 53px;right: 320px"></div> style="width: 200px;height: 30px;top: 53px;right: 320px"></div>
@ -412,6 +385,7 @@ export default {
fileUrl: "", fileUrl: "",
originalFileName: "", originalFileName: "",
fileType: "", fileType: "",
videoSrc: '',
playAuth: "", playAuth: "",
player: null, player: null,
previewImg: "", previewImg: "",
@ -548,6 +522,7 @@ export default {
}, },
uploadSuccess (file) { uploadSuccess (file) {
this.uploading = false this.uploading = false
this.fileId = ''
this.fileType = file.format this.fileType = file.format
this.fileUrl = file.url this.fileUrl = file.url
this.fileName = file.name this.fileName = file.name
@ -802,18 +777,18 @@ export default {
}, },
// //
download (row) { download (row) {
const { fileType } = row const { fileType, fileId } = row
// ppt // ppt
if (fileType === 'pptx') { if (fileType === 'pptx') {
this.downloadFile(row.name, row.fileUrl) this.downloadFile(row.name, row.fileUrl)
} else if (fileType === 'mp4') { } else if (fileId) {
// //
this.$get(`${this.api.getPlayAuth}/${row.fileId}`).then(res => { this.$get(`${this.api.getPlayAuth}/${fileId}`).then(res => {
const player = new Aliplayer({ new Aliplayer({
id: "playerDownload", id: "playerDownload",
width: "100%", width: "100%",
autoplay: false, autoplay: false,
vid: row.fileId, vid: fileId,
playauth: res.data.playAuth, playauth: res.data.playAuth,
encryptType: 1 // encryptType: 1 //
}, player => { }, player => {
@ -826,22 +801,26 @@ export default {
}, },
preview (row) { preview (row) {
if (this.transferType(row.fileType) == "视频") { if (this.transferType(row.fileType) == "视频") {
this.$get(`${this.api.getPlayAuth}/${row.fileId}`).then(res => { //
this.playAuth = res.data.playAuth; if (row.fileId) {
if (this.player) { this.$get(`${this.api.getPlayAuth}/${row.fileId}`).then(res => {
this.player.replayByVidAndPlayAuth(row.fileId, this.playAuth); this.playAuth = res.data.playAuth;
} else { if (this.player) {
this.player = new Aliplayer({ this.player.replayByVidAndPlayAuth(row.fileId, this.playAuth);
id: "player", } else {
width: "100%", this.player = new Aliplayer({
autoplay: false, id: "player",
vid: row.fileId, width: "100%",
playauth: this.playAuth, autoplay: false,
encryptType: 1 // vid: row.fileId,
}); playauth: this.playAuth,
} encryptType: 1 //
}).catch(res => { });
}); }
}).catch(res => { });
} else {
this.videoSrc = row.fileUrl
}
} else if (this.transferType(row.fileType) == "图片") { } else if (this.transferType(row.fileType) == "图片") {
this.previewImg = row.fileUrl; this.previewImg = row.fileUrl;
} else if (row.fileType == "pdf") { } else if (row.fileType == "pdf") {
@ -984,6 +963,7 @@ export default {
}, },
closeIframe () { closeIframe () {
this.iframeSrc = ""; this.iframeSrc = "";
this.videoSrc = ''
this.showMask = false; this.showMask = false;
this.showMask1 = false; this.showMask1 = false;
this.showMask2 = false; this.showMask2 = false;

@ -423,7 +423,8 @@ export default {
}) })
this.$post(this.api.editCompetitionContent, { this.$post(this.api.editCompetitionContent, {
competitionContents: data competitionContents: data
}).then(res => { }).then(async res => {
await this.$post(`${this.api.refreshPageNotification}?content=1`)
util.successMsg('修改成功') util.successMsg('修改成功')
this.modifyVisible = false this.modifyVisible = false
this.getData() this.getData()

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save