Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qianlong66
uni-app
提交
b34fdbe6
U
uni-app
项目概览
qianlong66
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b34fdbe6
编写于
4月 19, 2021
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(h5): filePath
上级
6047d964
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
54 addition
and
4 deletion
+54
-4
packages/uni-api/src/protocols/file/getFileInfo.ts
packages/uni-api/src/protocols/file/getFileInfo.ts
+10
-0
packages/uni-api/src/protocols/file/openDocument.ts
packages/uni-api/src/protocols/file/openDocument.ts
+10
-0
packages/uni-api/src/protocols/network/uploadFile.ts
packages/uni-api/src/protocols/network/uploadFile.ts
+7
-0
packages/uni-h5/dist/uni-h5.esm.js
packages/uni-h5/dist/uni-h5.esm.js
+21
-2
packages/uni-h5/src/service/api/file/getFileInfo.ts
packages/uni-h5/src/service/api/file/getFileInfo.ts
+3
-1
packages/uni-h5/src/service/api/file/openDocument.ts
packages/uni-h5/src/service/api/file/openDocument.ts
+3
-1
未找到文件。
packages/uni-api/src/protocols/file/getFileInfo.ts
浏览文件 @
b34fdbe6
import
{
getRealPath
}
from
'
@dcloudio/uni-platform
'
export
const
API_GET_FILE_INFO
=
'
getFileInfo
'
export
type
API_TYPE_GET_FILE_INFO
=
typeof
uni
.
getFileInfo
export
const
GetFileInfoOptions
:
ApiOptions
<
API_TYPE_GET_FILE_INFO
>
=
{
formatArgs
:
{
filePath
(
filePath
,
params
)
{
params
.
filePath
=
getRealPath
(
filePath
)
},
},
}
export
const
GetFileInfoProtocol
:
ApiProtocol
<
API_TYPE_GET_FILE_INFO
>
=
{
filePath
:
{
type
:
String
,
...
...
packages/uni-api/src/protocols/file/openDocument.ts
浏览文件 @
b34fdbe6
import
{
getRealPath
}
from
'
@dcloudio/uni-platform
'
export
const
API_OPEN_DOCUMENT
=
'
openDocument
'
export
type
API_TYPE_OPEN_DOCUMENT
=
typeof
uni
.
openDocument
export
const
OpenDocumentOptions
:
ApiOptions
<
API_TYPE_OPEN_DOCUMENT
>
=
{
formatArgs
:
{
filePath
(
filePath
,
params
)
{
params
.
filePath
=
getRealPath
(
filePath
)
},
},
}
export
const
OpenDocumentProtocol
:
ApiProtocol
<
API_TYPE_OPEN_DOCUMENT
>
=
{
filePath
:
{
type
:
String
,
...
...
packages/uni-api/src/protocols/network/uploadFile.ts
浏览文件 @
b34fdbe6
import
{
getRealPath
}
from
'
@dcloudio/uni-platform
'
export
const
API_UPLOAD_FILE
=
'
uploadFile
'
export
type
API_TYPE_UPLOAD_FILE
=
typeof
uni
.
uploadFile
export
const
UploadFileOptions
:
ApiOptions
<
API_TYPE_UPLOAD_FILE
>
=
{
formatArgs
:
{
filePath
(
filePath
,
params
)
{
if
(
filePath
)
{
params
.
filePath
=
getRealPath
(
filePath
)
}
},
header
(
value
:
Record
<
string
,
any
>
,
params
:
Record
<
string
,
any
>
)
{
params
.
header
=
value
||
{}
},
...
...
packages/uni-h5/dist/uni-h5.esm.js
浏览文件 @
b34fdbe6
...
...
@@ -4550,6 +4550,13 @@ const API_REMOVE_STORAGE = "removeStorage";
const
RemoveStorageProtocol
=
GetStorageProtocol
;
const
RemoveStorageSyncProtocol
=
GetStorageSyncProtocol
;
const
API_GET_FILE_INFO
=
"
getFileInfo
"
;
const
GetFileInfoOptions
=
{
formatArgs
:
{
filePath
(
filePath
,
params
)
{
params
.
filePath
=
getRealPath
(
filePath
);
}
}
};
const
GetFileInfoProtocol
=
{
filePath
:
{
type
:
String
,
...
...
@@ -4557,6 +4564,13 @@ const GetFileInfoProtocol = {
}
};
const
API_OPEN_DOCUMENT
=
"
openDocument
"
;
const
OpenDocumentOptions
=
{
formatArgs
:
{
filePath
(
filePath
,
params
)
{
params
.
filePath
=
getRealPath
(
filePath
);
}
}
};
const
OpenDocumentProtocol
=
{
filePath
:
{
type
:
String
,
...
...
@@ -4797,6 +4811,11 @@ const DownloadFileProtocol = {
const
API_UPLOAD_FILE
=
"
uploadFile
"
;
const
UploadFileOptions
=
{
formatArgs
:
{
filePath
(
filePath
,
params
)
{
if
(
filePath
)
{
params
.
filePath
=
getRealPath
(
filePath
);
}
},
header
(
value
,
params
)
{
params
.
header
=
value
||
{};
},
...
...
@@ -11078,11 +11097,11 @@ const getFileInfo = defineAsyncApi(API_GET_FILE_INFO, ({filePath}, {resolve, rej
}).
catch
((
err
)
=>
{
reject
(
String
(
err
));
});
},
GetFileInfoProtocol
);
},
GetFileInfoProtocol
,
GetFileInfoOptions
);
const
openDocument
=
defineAsyncApi
(
API_OPEN_DOCUMENT
,
({
filePath
},
{
resolve
})
=>
{
window
.
open
(
filePath
);
return
resolve
();
},
OpenDocumentProtocol
);
},
OpenDocumentProtocol
,
OpenDocumentOptions
);
function
getServiceAddress
()
{
return
window
.
location
.
protocol
+
"
//
"
+
window
.
location
.
host
;
}
...
...
packages/uni-h5/src/service/api/file/getFileInfo.ts
浏览文件 @
b34fdbe6
...
...
@@ -3,6 +3,7 @@ import {
API_GET_FILE_INFO
,
API_TYPE_GET_FILE_INFO
,
GetFileInfoProtocol
,
GetFileInfoOptions
,
}
from
'
@dcloudio/uni-api
'
import
{
urlToFile
}
from
'
../../../helpers/file
'
...
...
@@ -20,5 +21,6 @@ export const getFileInfo = defineAsyncApi<API_TYPE_GET_FILE_INFO>(
reject
(
String
(
err
))
})
},
GetFileInfoProtocol
GetFileInfoProtocol
,
GetFileInfoOptions
)
packages/uni-h5/src/service/api/file/openDocument.ts
浏览文件 @
b34fdbe6
...
...
@@ -3,6 +3,7 @@ import {
API_TYPE_OPEN_DOCUMENT
,
defineAsyncApi
,
OpenDocumentProtocol
,
OpenDocumentOptions
,
}
from
'
@dcloudio/uni-api
'
export
const
openDocument
=
defineAsyncApi
<
API_TYPE_OPEN_DOCUMENT
>
(
...
...
@@ -11,5 +12,6 @@ export const openDocument = defineAsyncApi<API_TYPE_OPEN_DOCUMENT>(
window
.
open
(
filePath
)
return
resolve
()
},
OpenDocumentProtocol
OpenDocumentProtocol
,
OpenDocumentOptions
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录