修改阿里云上传视频文件名称,修改上传成功后的url

This commit is contained in:
YeMingfei666 2024-12-04 11:22:01 +08:00
parent 408f0eaa29
commit 00280e133a
4 changed files with 27 additions and 7 deletions

View File

@ -25,6 +25,7 @@
"gulp-load-plugins": "1.5.0",
"gulp-replace": "0.6.1",
"hls.js": "^1.5.17",
"js-md5": "^0.8.3",
"lodash": "4.17.5",
"mockjs": "^1.1.0",
"npm": "^6.9.0",

View File

@ -10,7 +10,7 @@ const $urlMap={
product:'https://video.hnsiyao.cn/sqx_fast/',
test:'https://video.hnsiyao.cn/sqx_fast/',
}
const $env='local'
const $env='product'
const http = axios.create({
timeout: 1000 * 300,
// withCredentials: true,

View File

@ -919,9 +919,13 @@ export default {
};
},
methods: {
returnTypeName(){
const type = ['']
return ''
returnTypeName(type){
const $types = {
'1':'谢谢惠顾',
'2':'现金红包',
'3':'物品',
}
return $types[type]?$types[type]:''
},
// show
refAddZhuanpanOpen(){

View File

@ -1726,7 +1726,9 @@
<script>
import OSS from "@/utils/oss-upload.js";
import { $getCredentials } from "@/api/oss.js";
import md5 from "js-md5";
// aa888a86dca6e9d5ae216c23070e8c47
import { quillEditor } from "vue-quill-editor";
import "quill/dist/quill.core.css";
import "quill/dist/quill.snow.css";
@ -1735,6 +1737,8 @@ import quillConfig from "../locality/quill-config.js";
// import videojs from "video.js";
// import "video.js/dist/video-js.css";
import Hls from "hls.js";
import { getUUID } from "@/utils";
export default {
components: {
quillEditor,
@ -2134,7 +2138,16 @@ export default {
methods: {
async onVideoFileCHange(data) {
console.log(data);
const fileRes = await this.ossClient.partUpload(data.name, data.raw, (p) => {
const date = new Date();
const start =
date.getFullYear() +
"" +
(date.getMonth() * 1 + 1) +
"" +
date.getDate();
const houzhui = "." + data.name.substr(data.name.lastIndexOf(".") + 1);
const name = start + "/" + getUUID() + houzhui;
const fileRes = await this.ossClient.partUpload(name, data.raw, (p) => {
this.percentage = Math.floor(p * 100);
// UI
});
@ -2151,8 +2164,10 @@ export default {
if (fileRes.name == "cancel") {
return;
}
this.url=fileRes
this.url = fileRes.replace(
"https://djvideo.oss-cn-shanghai.aliyuncs.com/",
"https://duanju.hnsiyao.cn/"
);
},
onVideoFileSubmit(data) {
console.log("data");