Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica-admin-consultation
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
com.pica.cloud.education.frontend
pica-admin-consultation
提交
75451580
提交
75451580
编写于
4月 12, 2024
作者:
zhaosheng.zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 音频上传七牛
上级
4b151987
变更
1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
33 行增加
和
9 行删除
+33
-9
upload-music.vue
src/components/editor/upload-music.vue
+33
-9
未找到文件。
src/components/editor/upload-music.vue
浏览文件 @
75451580
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
class=
"upload-demo"
class=
"upload-demo"
:disabled=
"isDisable"
:disabled=
"isDisable"
:before-upload=
"beforeMusicUpload"
:before-upload=
"beforeMusicUpload"
:action=
"actionurl
"
action=
"#
"
:headers=
"headers"
:headers=
"headers"
:on-remove=
"handleRemove"
:on-remove=
"handleRemove"
:on-success=
"sucess"
:on-success=
"sucess"
...
@@ -48,7 +48,9 @@
...
@@ -48,7 +48,9 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
{
getBaseUrl
}
from
'@/utils/index'
;
import
{
doUpload
,
getFilePath
}
from
'@/utils/qiniu-util'
;
import
{
openLoading
,
closeLoading
}
from
'@/utils/utils'
;
let
_this
=
null
;
export
default
{
export
default
{
props
:
{
props
:
{
isDisable
:
{
isDisable
:
{
...
@@ -67,7 +69,6 @@
...
@@ -67,7 +69,6 @@
dialogImageUrl
:
''
,
dialogImageUrl
:
''
,
dialogVisible
:
false
,
dialogVisible
:
false
,
musicArr
:
[],
musicArr
:
[],
actionUrl
:
''
,
headers
:
{
headers
:
{
token
:
localStorage
.
getItem
(
'token'
),
token
:
localStorage
.
getItem
(
'token'
),
},
},
...
@@ -78,13 +79,18 @@
...
@@ -78,13 +79,18 @@
watch
:
{
watch
:
{
musicList
(
newv
)
{
musicList
(
newv
)
{
console
.
log
(
newv
);
console
.
log
(
newv
);
this
.
musicArr
=
newv
||
[];
const
newVideoList
=
newv
?.
filter
(
item
=>
{
const
suffixUrl
=
item
?.
url
.
substring
(
item
?.
url
.
lastIndexOf
(
'/'
)
+
1
);
// 接口不返回name,上传数据列表名称展示为截取url最后“/”后面的内容
item
.
name
=
suffixUrl
;
return
item
;
});
this
.
musicArr
=
newVideoList
||
[];
},
},
},
},
created
()
{
created
()
{
_this
=
this
;
this
.
musicArr
=
this
.
musicList
;
this
.
musicArr
=
this
.
musicList
;
console
.
log
(
console
.
log
(
'this.musicList'
,
this
.
musicArr
));
console
.
log
(
console
.
log
(
'this.musicList'
,
this
.
musicArr
));
this
.
actionurl
=
getBaseUrl
(
'/diagnose/illness/audio/upload'
);
},
},
methods
:
{
methods
:
{
musicUrl
(
item
)
{
musicUrl
(
item
)
{
...
@@ -114,14 +120,32 @@
...
@@ -114,14 +120,32 @@
this
.
loading
=
false
;
this
.
loading
=
false
;
},
},
// 上传mp3
// 上传mp3
beforeMusicUpload
()
{},
beforeMusicUpload
(
file
)
{
openLoading
(
_this
);
doUpload
(
_this
,
file
,
getFilePath
(
file
,
null
),
null
,
null
,
''
).
then
(
function
(
res
)
{
closeLoading
(
_this
);
const
fileItem
=
{
name
:
res
.
name
?
res
.
name
:
res
.
fullPath
,
size
:
res
.
size
,
status
:
'success'
,
url
:
res
.
fullPath
};
_this
.
musicArr
.
push
(
fileItem
);
_this
.
$message
.
success
(
'上传成功'
);
});
},
setNewArr
()
{
setNewArr
()
{
const
newArr
=
[];
const
newArr
=
[];
if
(
this
.
musicArr
&&
this
.
musicArr
.
length
)
{
if
(
this
.
musicArr
&&
this
.
musicArr
.
length
)
{
this
.
musicArr
.
forEach
((
item
)
=>
{
this
.
musicArr
.
forEach
((
item
)
=>
{
if
(
item
.
data
)
{
if
(
item
.
url
&&
item
.
status
===
'success'
)
{
newArr
.
push
(
item
.
data
.
domainPath
+
item
.
data
.
path
);
}
else
if
(
item
.
url
&&
item
.
from
)
{
newArr
.
push
(
item
.
url
);
newArr
.
push
(
item
.
url
);
}
}
});
});
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录