Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
basic-uniapp-v3
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-uniapp-v3
Commits
2a77a7b1
提交
2a77a7b1
authored
11月 07, 2025
作者:
宇宙超人
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
app选择文件插件
上级
005e1fbe
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
38 行增加
和
9 行删除
+38
-9
save-dialog.vue
src/pages/resource/components/save-dialog.vue
+38
-9
没有找到文件。
src/pages/resource/components/save-dialog.vue
浏览文件 @
2a77a7b1
...
@@ -58,6 +58,8 @@
...
@@ -58,6 +58,8 @@
import
{
useUserStore
}
from
'@/store/modules/user'
import
{
useUserStore
}
from
'@/store/modules/user'
import
{
useGlobSetting
}
from
'/@/hooks/setting'
import
{
useGlobSetting
}
from
'/@/hooks/setting'
import
*
as
WodeAPI
from
'@/api/model/wode'
import
*
as
WodeAPI
from
'@/api/model/wode'
const
lemonjkFileSelect
=
uni
.
requireNativePlugin
(
'lemonjk-FileSelect'
)
// 定义Props
// 定义Props
interface
Props
{
interface
Props
{
show
:
boolean
show
:
boolean
...
@@ -179,11 +181,12 @@
...
@@ -179,11 +181,12 @@
const
uplpoadFile
=
ref
(
null
)
const
uplpoadFile
=
ref
(
null
)
// 选择文件
// 选择文件
const
chooseFile
=
()
=>
{
const
chooseFile
=
()
=>
{
// #ifdef H5
uni
.
chooseFile
({
uni
.
chooseFile
({
count
:
1
,
count
:
1
,
extension
:
[
'*'
],
extension
:
[
'*'
],
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
uplpoadFile
.
value
=
res
uplpoadFile
.
value
=
res
.
tempFilePaths
[
0
]
const
tempFilePaths
=
res
.
tempFilePaths
const
tempFilePaths
=
res
.
tempFilePaths
const
tempFiles
=
res
.
tempFiles
const
tempFiles
=
res
.
tempFiles
console
.
log
(
tempFiles
)
console
.
log
(
tempFiles
)
...
@@ -212,6 +215,31 @@
...
@@ -212,6 +215,31 @@
uploading
.
value
=
false
uploading
.
value
=
false
},
},
})
})
// #endif
// #ifndef H5
lemonjkFileSelect
.
showNativePicker
(
{
//各属性配置见下方【showPicker可配置参数说明】
pathScope
:
'/Download'
,
mimeType
:
'*/*'
,
utisType
:
[
'public.data'
],
},
(
result
)
=>
{
// 返回值说明见下方【showPicker返回值说明】
const
tempFiles
=
result
.
files
console
.
log
(
tempFiles
[
0
])
uplpoadFile
.
value
=
tempFiles
[
0
].
filePath
// 根据文件扩展名设置文件类型
const
fileName
=
tempFiles
[
0
].
fileRealName
||
''
const
fileType
=
getFileTypeByExt
(
tempFiles
[
0
].
fileExtension
)
formData
.
fileName
=
fileName
formData
.
file
=
{
name
:
fileName
}
formData
.
fileType
=
fileType
.
value
formData
.
fileTypeText
=
fileType
.
text
},
)
// #endif
}
}
// 移除文件
// 移除文件
...
@@ -251,7 +279,6 @@
...
@@ -251,7 +279,6 @@
}
}
const
userStore
=
useUserStore
()
const
userStore
=
useUserStore
()
const
globSetting
=
useGlobSetting
()
const
globSetting
=
useGlobSetting
()
const
toastRef
=
ref
()
// 提交表单
// 提交表单
const
handleSubmit
=
async
()
=>
{
const
handleSubmit
=
async
()
=>
{
try
{
try
{
...
@@ -287,7 +314,7 @@
...
@@ -287,7 +314,7 @@
console
.
log
(
'上传资源数据:'
,
submitData
)
console
.
log
(
'上传资源数据:'
,
submitData
)
uni
.
uploadFile
({
uni
.
uploadFile
({
url
:
globSetting
.
apiUrl
+
globSetting
.
urlPrefix
+
'/sys/common/upload'
,
// 直接使用上传接口URL
url
:
globSetting
.
apiUrl
+
globSetting
.
urlPrefix
+
'/sys/common/upload'
,
// 直接使用上传接口URL
filePath
:
uplpoadFile
.
value
.
tempFilePaths
[
0
]
,
filePath
:
uplpoadFile
.
value
,
name
:
'file'
,
name
:
'file'
,
formData
:
{
formData
:
{
biz
:
'temp'
,
biz
:
'temp'
,
...
@@ -302,9 +329,10 @@
...
@@ -302,9 +329,10 @@
submitData
.
fileSrc
=
data
.
message
submitData
.
fileSrc
=
data
.
message
WodeAPI
.
addResource
(
submitData
)
WodeAPI
.
addResource
(
submitData
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
toastRef
.
value
.
show
({
uni
.
showToast
({
type
:
'success'
,
title
:
'上传成功'
,
text
:
`上传成功`
,
icon
:
'success'
,
duration
:
2000
,
})
})
// emit('update:show', false)
// emit('update:show', false)
emit
(
'submitSuccess'
)
emit
(
'submitSuccess'
)
...
@@ -323,9 +351,10 @@
...
@@ -323,9 +351,10 @@
}
}
},
},
fail
:
()
=>
{
fail
:
()
=>
{
toastRef
.
value
.
show
({
uni
.
showToast
({
type
:
'error'
,
title
:
'上传失败'
,
text
:
'上传失败'
,
icon
:
'none'
,
duration
:
2000
,
})
})
},
},
})
})
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论