Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
f20fa55c
U
uni-app
项目概览
DCloud
/
uni-app
2 个月 前同步成功
通知
717
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f20fa55c
编写于
4月 02, 2022
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: build app
上级
23a820e9
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
109 addition
and
11 deletion
+109
-11
packages/uni-app-plus/dist/uni.runtime.esm.js
packages/uni-app-plus/dist/uni.runtime.esm.js
+109
-11
未找到文件。
packages/uni-app-plus/dist/uni.runtime.esm.js
浏览文件 @
f20fa55c
...
...
@@ -11473,6 +11473,23 @@ const SaveFileProtocol = {
},
};
const API_GET_SAVED_LIST = 'getSavedFileList';
const API_REMOVE_SAVED_FILE = 'removeSavedFile';
const RemoveSavedFileOptions = {
formatArgs: {
filePath(filePath, params) {
params.filePath = getRealPath(filePath);
},
},
};
const RemoveSavedFileProtocol = {
filePath: {
type: String,
required: true,
},
};
const API_GET_FILE_INFO = 'getFileInfo';
const GetFileInfoOptions = {
formatArgs: {
...
...
@@ -11488,6 +11505,21 @@ const GetFileInfoProtocol = {
},
};
const API_GET_SAVED_FILE_INFO = 'getSavedFileInfo';
const GetSavedFileInfoOptions = {
formatArgs: {
filePath(filePath, params) {
params.filePath = getRealPath(filePath);
},
},
};
const GetSavedFileInfoProtocol = {
filePath: {
type: String,
required: true,
},
};
const API_OPEN_DOCUMENT = 'openDocument';
const OpenDocumentOptions = {
formatArgs: {
...
...
@@ -12845,19 +12877,14 @@ const getFileInfo$1 = defineAsyncApi(API_GET_FILE_INFO, (options, { resolve, rej
}));
}, GetFileInfoProtocol, GetFileInfoOptions);
const openDocument = defineAsyncApi(API_OPEN_DOCUMENT, ({ filePath, fileType }, { resolve, reject }) => {
const errorCallback = warpPlusErrorCallback(reject);
plus.runtime.openDocument(getRealPath(filePath), undefined, resolve, errorCallback);
}, OpenDocumentProtocol, OpenDocumentOptions);
let index$1 = 0;
const SAVED_DIR = 'uniapp_save';
const SAVE_PATH = `_doc/${SAVED_DIR}`;
function getSavedFileDir(success, fail) {
const SAVED_DIR
$1
= 'uniapp_save';
const SAVE_PATH = `_doc/${SAVED_DIR
$1
}`;
function getSavedFileDir
$1
(success, fail) {
fail = fail || function () { };
plus.io.requestFileSystem(plus.io.PRIVATE_DOC, (fs) => {
// 请求_doc fs
fs.root.getDirectory(SAVED_DIR, {
fs.root.getDirectory(SAVED_DIR
$1
, {
// 获取文件保存目录对象
create: true,
}, success, fail);
...
...
@@ -12868,7 +12895,7 @@ const saveFile = defineAsyncApi(API_SAVE_FILE, ({ tempFilePath }, { resolve, rej
const fileName = `${Date.now()}${index$1++}${getExtName(tempFilePath)}`;
plus.io.resolveLocalFileSystemURL(tempFilePath, (entry) => {
// 读取临时文件 FileEntry
getSavedFileDir((dir) => {
getSavedFileDir
$1
((dir) => {
entry.copyTo(dir, fileName, () => {
// 复制临时文件 FileEntry,为了避免把相册里的文件删除,使用 copy,微信中是要删除临时文件的
const savedFilePath = SAVE_PATH + '/' + fileName;
...
...
@@ -12880,6 +12907,74 @@ const saveFile = defineAsyncApi(API_SAVE_FILE, ({ tempFilePath }, { resolve, rej
}, errorCallback);
}, SaveFileProtocol, SaveFileOptions);
const SAVED_DIR = 'uniapp_save';
function getSavedFileDir(success, fail) {
fail = fail || function () { };
plus.io.requestFileSystem(plus.io.PRIVATE_DOC, (fs) => {
// 请求_doc fs
fs.root.getDirectory(SAVED_DIR, {
// 获取文件保存目录对象
create: true,
}, success, fail);
}, fail);
}
const getSavedFileList = (defineAsyncApi(API_GET_SAVED_LIST, (_, { resolve, reject }) => {
const errorCallback = warpPlusErrorCallback(reject);
getSavedFileDir((entry) => {
var reader = entry.createReader();
var fileList = [];
reader.readEntries((entries) => {
if (entries && entries.length) {
entries.forEach((entry) => {
entry.getMetadata((meta) => {
fileList.push({
filePath: plus.io.convertAbsoluteFileSystem(entry.fullPath),
createTime: meta.modificationTime.getTime(),
size: meta.size,
});
if (fileList.length === entries.length) {
resolve({
fileList,
});
}
}, errorCallback, false);
});
}
else {
resolve({
fileList,
});
}
}, errorCallback);
}, errorCallback);
}));
const getSavedFileInfo = defineAsyncApi(API_GET_SAVED_FILE_INFO, ({ filePath }, { resolve, reject }) => {
const errorCallback = warpPlusErrorCallback(reject);
plus.io.resolveLocalFileSystemURL(filePath, (entry) => {
entry.getMetadata((meta) => {
resolve({
createTime: meta.modificationTime.getTime(),
size: meta.size,
});
}, errorCallback, false);
}, errorCallback);
}, GetSavedFileInfoProtocol, GetSavedFileInfoOptions);
const removeSavedFile = defineAsyncApi(API_REMOVE_SAVED_FILE, ({ filePath }, { resolve, reject }) => {
const errorCallback = warpPlusErrorCallback(reject);
plus.io.resolveLocalFileSystemURL(filePath, (entry) => {
entry.remove(() => {
resolve();
}, errorCallback);
}, errorCallback);
}, RemoveSavedFileProtocol, RemoveSavedFileOptions);
const openDocument = defineAsyncApi(API_OPEN_DOCUMENT, ({ filePath, fileType }, { resolve, reject }) => {
const errorCallback = warpPlusErrorCallback(reject);
plus.runtime.openDocument(getRealPath(filePath), undefined, resolve, errorCallback);
}, OpenDocumentProtocol, OpenDocumentOptions);
const isIOS = plus.os.name === 'iOS';
let config;
/**
...
...
@@ -18847,8 +18942,11 @@ var uni$1 = {
getStorageInfoSync: getStorageInfoSync,
getStorageInfo: getStorageInfo,
getFileInfo: getFileInfo$1,
openDocument: openDocument,
saveFile: saveFile,
getSavedFileList: getSavedFileList,
getSavedFileInfo: getSavedFileInfo,
removeSavedFile: removeSavedFile,
openDocument: openDocument,
getSystemInfoSync: getSystemInfoSync,
getSystemInfo: getSystemInfo,
onCompassChange: onCompassChange,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录