第一次打包失败

This commit is contained in:
2026-07-02 18:01:56 +08:00
parent 3544208baa
commit 879d2e350a
75 changed files with 7499 additions and 2267 deletions

View File

@@ -2,7 +2,7 @@
;(function(){
let u=void 0,isReady=false,onReadyCallbacks=[],isServiceReady=false,onServiceReadyCallbacks=[];
const __uniConfig = {"pages":[],"globalStyle":{"backgroundColor":"#F8F8F8","navigationBar":{"backgroundColor":"#F8F8F8","titleText":"uni-app","type":"default","titleColor":"#000000"},"isNVue":false},"nvue":{"compiler":"uni-app","styleCompiler":"uni-app","flex-direction":"column"},"renderer":"auto","appname":"test1","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":true},"compilerVersion":"5.07","entryPagePath":"pages/Login/Login","entryPageQuery":"","realEntryPagePath":"","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000},"locales":{},"darkmode":false,"themeConfig":{}};
const __uniRoutes = [{"path":"pages/Login/Login","meta":{"isQuit":true,"isEntry":true,"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"登录页面","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/Chat/Chat","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"聊天页面(主页面)","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/WorkSpace/WorkSpace","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"工作区文件管理","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/UserProfileModal/UserProfileModal","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/ContactPages/ContactPages","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/WorkSpace/TemplateSpace/TemplateSpace","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/text/text","meta":{"navigationBar":{"titleText":"","type":"default"},"isNVue":false}},{"path":"pages/text/text2","meta":{"navigationBar":{"type":"default"},"isNVue":false}}].map(uniRoute=>(uniRoute.meta.route=uniRoute.path,__uniConfig.pages.push(uniRoute.path),uniRoute.path='/'+uniRoute.path,uniRoute));
const __uniRoutes = [{"path":"pages/Login/Login","meta":{"isQuit":true,"isEntry":true,"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"登录页面","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/Chat/Chat","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"聊天页面(主页面)","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/WorkSpace/WorkSpace","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"工作区文件管理","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/UserProfileModal/UserProfileModal","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/ContactPages/ContactPages","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/WorkSpace/TemplateSpace/TemplateSpace","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/text/text","meta":{"navigationBar":{"titleText":"","type":"default"},"isNVue":false}},{"path":"pages/text/text2","meta":{"navigationBar":{"type":"default"},"isNVue":false}},{"path":"pages/CloudDatabase/CloudDatabase","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"云端数据","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/CloudDbDetail/CloudDbDetail","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"数据库详情","style":"custom","type":"default"},"isNVue":false}}].map(uniRoute=>(uniRoute.meta.route=uniRoute.path,__uniConfig.pages.push(uniRoute.path),uniRoute.path='/'+uniRoute.path,uniRoute));
__uniConfig.styles=[];//styles
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -7,7 +7,7 @@
"id": "__UNI__923FD9E",
"name": "test1",
"version": {
"name": "1.0.0",
"name": "1.1.1",
"code": "1"
},
"description": "",
@@ -17,6 +17,7 @@
"url": ""
},
"permissions": {
"Camera": {},
"UniNView": {
"description": "UniNView原生渲染"
}
@@ -45,6 +46,46 @@
"nvueStyleCompiler": "uni-app",
"compilerVersion": 3,
"distribute": {
"icons": {
"android": {
"hdpi": "unpackage/res/icons/72x72.png",
"xhdpi": "unpackage/res/icons/96x96.png",
"xxhdpi": "unpackage/res/icons/144x144.png",
"xxxhdpi": "unpackage/res/icons/192x192.png"
},
"ios": {
"appstore": "unpackage/res/icons/1024x1024.png",
"ipad": {
"app": "unpackage/res/icons/76x76.png",
"app@2x": "unpackage/res/icons/152x152.png",
"notification": "unpackage/res/icons/20x20.png",
"notification@2x": "unpackage/res/icons/40x40.png",
"proapp@2x": "unpackage/res/icons/167x167.png",
"settings": "unpackage/res/icons/29x29.png",
"settings@2x": "unpackage/res/icons/58x58.png",
"spotlight": "unpackage/res/icons/40x40.png",
"spotlight@2x": "unpackage/res/icons/80x80.png"
},
"iphone": {
"app@2x": "unpackage/res/icons/120x120.png",
"app@3x": "unpackage/res/icons/180x180.png",
"notification@2x": "unpackage/res/icons/40x40.png",
"notification@3x": "unpackage/res/icons/60x60.png",
"settings@2x": "unpackage/res/icons/58x58.png",
"settings@3x": "unpackage/res/icons/87x87.png",
"spotlight@2x": "unpackage/res/icons/80x80.png",
"spotlight@3x": "unpackage/res/icons/120x120.png"
}
}
},
"splashscreen": {
"androidStyle": "default",
"android": {
"hdpi": "C:/Users/ADMIN/Pictures/480-762.png",
"xhdpi": "C:/Users/ADMIN/Pictures/720-1242.png",
"xxhdpi": "C:/Users/ADMIN/Pictures/1080-1882.png"
}
},
"google": {
"permissions": [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
@@ -61,7 +102,10 @@
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/>",
"<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
"<uses-permission android:name=\"android.permission.MANAGE_EXTERNAL_STORAGE\"/>"
]
},
"apple": {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,8 @@
@font-face {
font-family: "iconfont"; /* Project id */
src: url('iconfont.ttf?t=1776936195904') format('truetype');
font-family: "iconfont"; /* Project id 4890805 */
src: url('iconfont.woff2?t=1782200893170') format('woff2'),
url('iconfont.woff?t=1782200893170') format('woff'),
url('iconfont.ttf?t=1782200893170') format('truetype');
}
.iconfont {
@@ -11,6 +13,182 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-cloud:before {
content: "\e988";
}
.icon-qitawenjian:before {
content: "\e7b6";
}
.icon-wenjianyasuo:before {
content: "\e643";
}
.icon-wenjianshipin:before {
content: "\e644";
}
.icon-wenjianyinpin:before {
content: "\e645";
}
.icon-wenjiantupian:before {
content: "\e646";
}
.icon-daimawenjian:before {
content: "\e66a";
}
.icon-file-markdown-fill:before {
content: "\ebb1";
}
.icon-SVG:before {
content: "\e614";
}
.icon-HTML:before {
content: "\e615";
}
.icon-CSS:before {
content: "\e618";
}
.icon-CSV:before {
content: "\e619";
}
.icon-JSON:before {
content: "\e61b";
}
.icon-JS:before {
content: "\e61c";
}
.icon-PDF:before {
content: "\e61e";
}
.icon-PHP:before {
content: "\e621";
}
.icon-TXT:before {
content: "\e622";
}
.icon-XLS:before {
content: "\e623";
}
.icon-DOC:before {
content: "\e624";
}
.icon-PPT:before {
content: "\e626";
}
.icon-SQL:before {
content: "\e627";
}
.icon-bianji:before {
content: "\e605";
}
.icon-fasong:before {
content: "\e705";
}
.icon-download:before {
content: "\e61a";
}
.icon-edit-fill:before {
content: "\e61d";
}
.icon-favorite-fill:before {
content: "\e61f";
}
.icon-favorite:before {
content: "\e620";
}
.icon-upload:before {
content: "\e63e";
}
.icon-yonghuziliao:before {
content: "\e6a1";
}
.icon-pen-fill:before {
content: "\e67c";
}
.icon-qunliao:before {
content: "\e606";
}
.icon-shipintonghua:before {
content: "\e609";
}
.icon-tianjia:before {
content: "\e60d";
}
.icon-tongxunlu:before {
content: "\e612";
}
.icon-tianjiahaoyou:before {
content: "\e613";
}
.icon-shanchu:before {
content: "\e6d3";
}
.icon-choose-fill:before {
content: "\e6a2";
}
.icon-a-wenjianjiawenjian:before {
content: "\e69e";
}
.icon-sousuo:before {
content: "\e6eb";
}
.icon-Robot:before {
content: "\e67d";
}
.icon-saochu:before {
content: "\e6a3";
}
.icon-fanhui:before {
content: "\e765";
}
.icon-brain-2-fill:before {
content: "\e800";
}
.icon-gengduo:before {
content: "\e6c5";
}
.icon-del:before {
content: "\e616";
}
@@ -67,95 +245,7 @@
content: "\e647";
}
.icon-bianji:before {
content: "\e605";
}
.icon-fasong:before {
content: "\e705";
}
.icon-download:before {
content: "\e61a";
}
.icon-edit-fill:before {
content: "\e61d";
}
.icon-favorite-fill:before {
content: "\e61f";
}
.icon-favorite:before {
content: "\e620";
}
.icon-upload:before {
content: "\e63e";
}
.icon-yonghuziliao:before {
content: "\e6a1";
}
.icon-pen-fill:before {
content: "\e667";
}
.icon-qunliao:before {
content: "\e606";
}
.icon-shipintonghua:before {
content: "\e609";
}
.icon-tianjia:before {
content: "\e60d";
}
.icon-tongxunlu:before {
content: "\e612";
}
.icon-tianjiahaoyou:before {
content: "\e613";
}
.icon-shanchu:before {
content: "\e6d3";
}
.icon-choose-fill:before {
content: "\e6a2";
}
.icon-a-wenjianjiawenjian:before {
content: "\e69e";
}
.icon-sousuo:before {
content: "\e6eb";
}
.icon-Robot:before {
content: "\e661";
}
.icon-saochu:before {
content: "\e6a3";
}
.icon-fanhui:before {
content: "\e765";
}
.icon-brain-2-fill:before {
content: "\e800";
}
.icon-gengduo:before {
content: "\e6c5";
.icon-qita:before {
content: "\e600";
}

File diff suppressed because one or more lines are too long

View File

@@ -1,10 +1,318 @@
{
"id": "",
"name": "",
"id": "4890805",
"name": "information",
"font_family": "iconfont",
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "18170211",
"name": "云端,云,云服务",
"font_class": "cloud",
"unicode": "e988",
"unicode_decimal": 59784
},
{
"icon_id": "35959059",
"name": "其他文件",
"font_class": "qitawenjian",
"unicode": "e7b6",
"unicode_decimal": 59318
},
{
"icon_id": "1004650",
"name": "文件-压缩",
"font_class": "wenjianyasuo",
"unicode": "e643",
"unicode_decimal": 58947
},
{
"icon_id": "1004652",
"name": "文件-视频",
"font_class": "wenjianshipin",
"unicode": "e644",
"unicode_decimal": 58948
},
{
"icon_id": "1004653",
"name": "文件-音频",
"font_class": "wenjianyinpin",
"unicode": "e645",
"unicode_decimal": 58949
},
{
"icon_id": "1004654",
"name": "文件-图片",
"font_class": "wenjiantupian",
"unicode": "e646",
"unicode_decimal": 58950
},
{
"icon_id": "26618450",
"name": "代码文件",
"font_class": "daimawenjian",
"unicode": "e66a",
"unicode_decimal": 58986
},
{
"icon_id": "19702974",
"name": "markdown文件",
"font_class": "file-markdown-fill",
"unicode": "ebb1",
"unicode_decimal": 60337
},
{
"icon_id": "12904094",
"name": "SVG",
"font_class": "SVG",
"unicode": "e614",
"unicode_decimal": 58900
},
{
"icon_id": "12904096",
"name": "HTML",
"font_class": "HTML",
"unicode": "e615",
"unicode_decimal": 58901
},
{
"icon_id": "12904097",
"name": "CSS",
"font_class": "CSS",
"unicode": "e618",
"unicode_decimal": 58904
},
{
"icon_id": "12904100",
"name": "CSV",
"font_class": "CSV",
"unicode": "e619",
"unicode_decimal": 58905
},
{
"icon_id": "12904101",
"name": "JSON",
"font_class": "JSON",
"unicode": "e61b",
"unicode_decimal": 58907
},
{
"icon_id": "12904102",
"name": "JS",
"font_class": "JS",
"unicode": "e61c",
"unicode_decimal": 58908
},
{
"icon_id": "12904106",
"name": "PDF",
"font_class": "PDF",
"unicode": "e61e",
"unicode_decimal": 58910
},
{
"icon_id": "12904107",
"name": "PHP",
"font_class": "PHP",
"unicode": "e621",
"unicode_decimal": 58913
},
{
"icon_id": "12904108",
"name": "TXT",
"font_class": "TXT",
"unicode": "e622",
"unicode_decimal": 58914
},
{
"icon_id": "12904109",
"name": "XLS",
"font_class": "XLS",
"unicode": "e623",
"unicode_decimal": 58915
},
{
"icon_id": "12904116",
"name": "DOC",
"font_class": "DOC",
"unicode": "e624",
"unicode_decimal": 58916
},
{
"icon_id": "12904119",
"name": "PPT",
"font_class": "PPT",
"unicode": "e626",
"unicode_decimal": 58918
},
{
"icon_id": "12904126",
"name": "SQL",
"font_class": "SQL",
"unicode": "e627",
"unicode_decimal": 58919
},
{
"icon_id": "7515699",
"name": "编辑",
"font_class": "bianji",
"unicode": "e605",
"unicode_decimal": 58885
},
{
"icon_id": "8440993",
"name": "发送",
"font_class": "fasong",
"unicode": "e705",
"unicode_decimal": 59141
},
{
"icon_id": "9512543",
"name": "下载",
"font_class": "download",
"unicode": "e61a",
"unicode_decimal": 58906
},
{
"icon_id": "9512544",
"name": "编辑",
"font_class": "edit-fill",
"unicode": "e61d",
"unicode_decimal": 58909
},
{
"icon_id": "9512556",
"name": "收藏",
"font_class": "favorite-fill",
"unicode": "e61f",
"unicode_decimal": 58911
},
{
"icon_id": "9512559",
"name": "收藏",
"font_class": "favorite",
"unicode": "e620",
"unicode_decimal": 58912
},
{
"icon_id": "9512675",
"name": "上传",
"font_class": "upload",
"unicode": "e63e",
"unicode_decimal": 58942
},
{
"icon_id": "11633996",
"name": "用户资料",
"font_class": "yonghuziliao",
"unicode": "e6a1",
"unicode_decimal": 59041
},
{
"icon_id": "17775968",
"name": "笔",
"font_class": "pen-fill",
"unicode": "e67c",
"unicode_decimal": 59004
},
{
"icon_id": "18537099",
"name": "群聊",
"font_class": "qunliao",
"unicode": "e606",
"unicode_decimal": 58886
},
{
"icon_id": "18537375",
"name": "视频通话",
"font_class": "shipintonghua",
"unicode": "e609",
"unicode_decimal": 58889
},
{
"icon_id": "18654056",
"name": "添加",
"font_class": "tianjia",
"unicode": "e60d",
"unicode_decimal": 58893
},
{
"icon_id": "18655694",
"name": "通讯录",
"font_class": "tongxunlu",
"unicode": "e612",
"unicode_decimal": 58898
},
{
"icon_id": "18656610",
"name": "添加好友",
"font_class": "tianjiahaoyou",
"unicode": "e613",
"unicode_decimal": 58899
},
{
"icon_id": "24660909",
"name": "删除",
"font_class": "shanchu",
"unicode": "e6d3",
"unicode_decimal": 59091
},
{
"icon_id": "25015243",
"name": "选择箭头-fill",
"font_class": "choose-fill",
"unicode": "e6a2",
"unicode_decimal": 59042
},
{
"icon_id": "27229314",
"name": "文件夹,文件",
"font_class": "a-wenjianjiawenjian",
"unicode": "e69e",
"unicode_decimal": 59038
},
{
"icon_id": "27995029",
"name": "搜索",
"font_class": "sousuo",
"unicode": "e6eb",
"unicode_decimal": 59115
},
{
"icon_id": "28661052",
"name": "Robot",
"font_class": "Robot",
"unicode": "e67d",
"unicode_decimal": 59005
},
{
"icon_id": "32429618",
"name": "扫除",
"font_class": "saochu",
"unicode": "e6a3",
"unicode_decimal": 59043
},
{
"icon_id": "38950621",
"name": "返回",
"font_class": "fanhui",
"unicode": "e765",
"unicode_decimal": 59237
},
{
"icon_id": "42230703",
"name": "brain-2-fill",
"font_class": "brain-2-fill",
"unicode": "e800",
"unicode_decimal": 59392
},
{
"icon_id": "43005043",
"name": "更多",
"font_class": "gengduo",
"unicode": "e6c5",
"unicode_decimal": 59077
},
{
"icon_id": "109713",
"name": "垃圾桶",
@@ -104,165 +412,11 @@
"unicode_decimal": 58951
},
{
"icon_id": "7515699",
"name": "编辑",
"font_class": "bianji",
"unicode": "e605",
"unicode_decimal": 58885
},
{
"icon_id": "8440993",
"name": "发送",
"font_class": "fasong",
"unicode": "e705",
"unicode_decimal": 59141
},
{
"icon_id": "9512543",
"name": "下载",
"font_class": "download",
"unicode": "e61a",
"unicode_decimal": 58906
},
{
"icon_id": "9512544",
"name": "编辑",
"font_class": "edit-fill",
"unicode": "e61d",
"unicode_decimal": 58909
},
{
"icon_id": "9512556",
"name": "收藏",
"font_class": "favorite-fill",
"unicode": "e61f",
"unicode_decimal": 58911
},
{
"icon_id": "9512559",
"name": "收藏",
"font_class": "favorite",
"unicode": "e620",
"unicode_decimal": 58912
},
{
"icon_id": "9512675",
"name": "上传",
"font_class": "upload",
"unicode": "e63e",
"unicode_decimal": 58942
},
{
"icon_id": "11633996",
"name": "用户资料",
"font_class": "yonghuziliao",
"unicode": "e6a1",
"unicode_decimal": 59041
},
{
"icon_id": "17775968",
"name": "笔",
"font_class": "pen-fill",
"unicode": "e667",
"unicode_decimal": 58983
},
{
"icon_id": "18537099",
"name": "群聊",
"font_class": "qunliao",
"unicode": "e606",
"unicode_decimal": 58886
},
{
"icon_id": "18537375",
"name": "视频通话",
"font_class": "shipintonghua",
"unicode": "e609",
"unicode_decimal": 58889
},
{
"icon_id": "18654056",
"name": "添加",
"font_class": "tianjia",
"unicode": "e60d",
"unicode_decimal": 58893
},
{
"icon_id": "18655694",
"name": "通讯录",
"font_class": "tongxunlu",
"unicode": "e612",
"unicode_decimal": 58898
},
{
"icon_id": "18656610",
"name": "添加好友",
"font_class": "tianjiahaoyou",
"unicode": "e613",
"unicode_decimal": 58899
},
{
"icon_id": "24660909",
"name": "删除",
"font_class": "shanchu",
"unicode": "e6d3",
"unicode_decimal": 59091
},
{
"icon_id": "25015243",
"name": "选择箭头-fill",
"font_class": "choose-fill",
"unicode": "e6a2",
"unicode_decimal": 59042
},
{
"icon_id": "27229314",
"name": "文件夹,文件",
"font_class": "a-wenjianjiawenjian",
"unicode": "e69e",
"unicode_decimal": 59038
},
{
"icon_id": "27995029",
"name": "搜索",
"font_class": "sousuo",
"unicode": "e6eb",
"unicode_decimal": 59115
},
{
"icon_id": "28661052",
"name": "Robot",
"font_class": "Robot",
"unicode": "e661",
"unicode_decimal": 58977
},
{
"icon_id": "32429618",
"name": "扫除",
"font_class": "saochu",
"unicode": "e6a3",
"unicode_decimal": 59043
},
{
"icon_id": "38950621",
"name": "返回",
"font_class": "fanhui",
"unicode": "e765",
"unicode_decimal": 59237
},
{
"icon_id": "42230703",
"name": "brain-2-fill",
"font_class": "brain-2-fill",
"unicode": "e800",
"unicode_decimal": 59392
},
{
"icon_id": "43005043",
"name": "更多",
"font_class": "gengduo",
"unicode": "e6c5",
"unicode_decimal": 59077
"icon_id": "1250",
"name": "其它",
"font_class": "qita",
"unicode": "e600",
"unicode_decimal": 58880
}
]
}

Binary file not shown.

Binary file not shown.

View File

@@ -1,26 +0,0 @@
## 0.1.32025-09-16
- chore: 更新文档
## 0.1.22025-06-07
- chore: 更新文档
## 0.1.12025-06-02
- feat: 兼容鸿蒙next
## 0.1.02025-04-04
- chore: 更新文档
## 0.0.92025-03-11
- fix: 修复安卓报错的问题
## 0.0.82025-03-11
- fix: 修复报错的问题
## 0.0.72025-03-10
- feat: 增加重命名选项
## 0.0.62025-02-28
- feat: 修复uniapp ios路径问题
## 0.0.52024-10-31
- feat: 修复uniapp ios无法使用
## 0.0.42024-10-26
- feat: 规范类型
## 0.0.32024-07-10
- fext: 兼容ios
## 0.0.22024-05-21
- fix: 修复uniapp找不到文件的错误
## 0.0.12024-04-15
- init

View File

@@ -1,38 +0,0 @@
<template>
<view @click="onClick">
<slot></slot>
</view>
</template>
<script>
import { chooseFile } from '@/uni_modules/lime-choose-file'
export default {
props: {
disabled: Boolean
},
emits: ['success', 'fail'],
data() {
return {
images: []
}
},
methods: {
onClick() {
if(this.disabled) return
chooseFile({
success:(res)=>{
this.$emit('success', res)
},
fail(err){
this.$emit('fail', err)
}
})
}
}
}
</script>
<style>
</style>

View File

@@ -1,103 +0,0 @@
<template>
<view class="demo-block">
<text class="demo-block__title-text ultra">ChooseFile 文件选择</text>
<text class="demo-block__desc-text">打开系统文件管理器选择文件。</text>
<view class="demo-block__body">
<view class="demo-block card">
<text class="demo-block__title-text large">基础使用</text>
<view class="demo-block__body row">
<button @click="onClick">选择图片</button>
<image v-for="(item, index) in images" :key="index" :src="item"></image>
</view>
</view>
</view>
</view>
</template>
<script setup>
import { chooseFile, ChooseFileOption } from '@/uni_modules/lime-choose-file'
const images = ref<string[]>([])
const onClick = () => {
chooseFile({
// filename: 'xxx',
type: 'image',
success(res) {
images.value = res.tempFiles.map((item) : string => item.path)
console.log('res', res.tempFiles)
console.log('reserrMsg', res)
},
fail(err) {
console.log('err', err)
}
} as ChooseFileOption)
}
</script>
<style lang="scss">
.row {
flex-direction: row;
flex-wrap: wrap;
}
.btn {
margin-bottom: 20rpx;
margin-right: 20rpx;
}
.demo-block {
margin: 32px 10px 0;
// overflow: visible;
&.card {
background-color: white;
padding: 30rpx;
margin-bottom: 20rpx !important;
}
&__title {
margin: 0;
margin-top: 8px;
&-text {
color: rgba(0, 0, 0, 0.6);
font-weight: 400;
font-size: 14px;
line-height: 16px;
display: flex;
&.large {
color: rgba(0, 0, 0, 0.9);
font-size: 18px;
font-weight: 700;
line-height: 26px;
}
&.ultra {
color: rgba(0, 0, 0, 0.9);
font-size: 24px;
font-weight: 700;
line-height: 32px;
}
}
}
&__desc-text {
color: rgba(0, 0, 0, 0.6);
margin: 8px 16px 0 0;
font-size: 14px;
line-height: 22px;
}
&__body {
margin: 16px 0;
overflow: visible;
.demo-block {
// margin-top: 0px;
margin: 0;
}
}
}
</style>

View File

@@ -1,36 +0,0 @@
<template>
<view>
<button @click="onClick">选图</button>
<image v-for="(item, index) in images" :key="index" :src="item"></image>
</view>
</template>
<script>
import { chooseFile } from '@/uni_modules/lime-choose-file'
export default {
data() {
return {
images: []
}
},
methods: {
onClick() {
chooseFile({
type: 'image',
success:(res)=>{
this.images = res.tempFiles.map((item) => item.path)
console.log('res', res.tempFiles)
},
fail(err){
console.log('err', err)
}
})
}
}
}
</script>
<style>
</style>

View File

@@ -1,2 +0,0 @@
<EFBFBD>,<2C>P<EFBFBD><50>=<3D>[&<26>۸<>6<EFBFBD>
<1B>I<EFBFBD>T<EFBFBD> ]<5D><>r<EFBFBD><72><EFBFBD><EFBFBD>*<2A>I<EFBFBD>F<EFBFBD>܃<EFBFBD>C咺+<16><>E<>|<7C>q<EFBFBD>`(<28><><EFBFBD><EFBFBD>I_<49>+D<><16>Zs<5A>f<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD>q<EFBFBD><71>gqݰ<71><DDB0><EFBFBD>IC*<2A>N<EFBFBD><4E>R<EFBFBD>W<EFBFBD>O<EFBFBD><17><>5<EFBFBD>@\7<>ta<74><61> `e<>7<EFBFBD><37><EFBFBD>H<EFBFBD><48>F:D<><44><EFBFBD>r<EFBFBD><72>|<7C><>#

View File

@@ -1,105 +0,0 @@
{
"id": "lime-choose-file",
"displayName": "lime-choose-file 文件选择",
"version": "0.1.3",
"description": "lime-choose-file 文件选择参考uni.chooseFile API实现的UTS API用法保持一致从本地选择文件。兼容uniapp/uniappX",
"keywords": [
"chooseFile",
"文件选择",
"uts"
],
"repository": "",
"engines": {
"HBuilderX": "^4.11",
"uni-app": "^4.61",
"uni-app-x": "^4.61"
},
"dcloudext": {
"type": "uts",
"sale": {
"regular": {
"price": "29.00"
},
"sourcecode": {
"price": "268.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": "",
"darkmode": "x",
"i18n": "x",
"widescreen": "x"
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "√",
"aliyun": "√",
"alipay": "√"
},
"client": {
"uni-app": {
"vue": {
"vue2": "√",
"vue3": "√"
},
"web": {
"safari": "√",
"chrome": "√"
},
"app": {
"vue": "√",
"nvue": "√",
"android": {
"extVersion": "",
"minVersion": "21"
},
"ios": "√",
"harmony": "√"
},
"mp": {
"weixin": "√",
"alipay": "-",
"toutiao": "-",
"baidu": "-",
"kuaishou": "-",
"jd": "-",
"harmony": "-",
"qq": "-",
"lark": "-"
},
"quickapp": {
"huawei": "-",
"union": "-"
}
},
"uni-app-x": {
"web": {
"safari": "√",
"chrome": "√"
},
"app": {
"android": {
"extVersion": "",
"minVersion": "21"
},
"ios": "√",
"harmony": "√"
},
"mp": {
"weixin": "√"
}
}
}
}
}
}

View File

@@ -1,61 +0,0 @@
# lime-choosefile 文件选择
文件选择UTS API系参考小程序chooseFile API实现的用法保持一致目前仅支持uniappX(web,ios,安卓,鸿蒙)
## 文档
🚀 [choose-file【站点1】](https://limex.qcoon.cn/native/choose-file.html)
🌍 [choose-file【站点2】](https://limeui.netlify.app/native/choose-file.html)
🔥 [choose-file【站点3】](https://limeui.familyzone.top/native/choose-file.html)
## 安装
插件市场导入APP需要在页面上引入然后自定义基座完成自定义基座后选择自定义基座运行
## 使用
### UNIAPPX
```js
import { chooseFile, type ChooseFileOption } from '@/uni_modules/lime-choose-file'
const images = ref<string[]>([])
const onClick = () => {
chooseFile({
filename: 'xxxx', // 可选 用于给文件重命名安卓、IOS
type: 'image',
success(res){
images.value = res.tempFiles.map((item):string => item.path)
console.log('res', res.tempFiles)
},
fail(err){
console.log('err', err)
}
} as ChooseFileOption)
}
```
### UNIAPP
```js
import { chooseFile } from '@/uni_modules/lime-choose-file'
const images = ref<string[]>([])
const onClick = () => {
chooseFile({
filename: 'xxxx', // 可选 用于给文件重命名安卓、IOS
type: 'image',
success(res){
images.value = res.tempFiles.map((item):string => item.path)
console.log('res', res.tempFiles)
},
fail(err){
console.log('err', err)
}
})
}
```
## 常见问题
- 1、IOS路径是中文时无法上传到服务器这时候需要设置`filename`给文件重命名
## API
因为直接参照小程序`chooseFile`API所以可以直接按[chooseFile](https://uniapp.dcloud.net.cn/api/media/file.html#choosefile)文档来

View File

@@ -1,126 +0,0 @@
# lime-choose-file 文件选择组件
一个基于UTS实现的文件选择插件参考小程序chooseFile API实现用法保持一致。支持安卓、iOS、鸿蒙和H5平台。提供了选择图片、视频和其他文件类型的功能。组件提供了简单易用的API使开发者能够方便地在应用中集成文件选择功能。
## 文档链接
📚 组件详细文档请访问以下站点:
- [文件选择组件文档 - 站点1](https://limex.qcoon.cn/native/choose-file.html)
- [文件选择组件文档 - 站点2](https://limeui.netlify.app/native/choose-file.html)
- [文件选择组件文档 - 站点3](https://limeui.familyzone.top/native/choose-file.html)
## 安装方法
1. 在uni-app插件市场中搜索并导入`lime-choose-file`
2. 导入后在页面引入相关方法
3. 需要自定义基座才能使用
4. 试用符合需求后才购买,插件无法退款
## 代码演示
### UNIAPPX 使用方式
```ts
import { chooseFile, type ChooseFileOption } from '@/uni_modules/lime-choose-file'
const images = ref<string[]>([])
const onClick = () => {
chooseFile({
filename: 'xxxx', // 可选 用于给文件重命名安卓、iOS
type: 'image',
success(res){
images.value = res.tempFiles.map((item):string => item.path)
console.log('选择结果:', res.tempFiles)
},
fail(err){
console.log('选择失败:', err)
}
} as ChooseFileOption)
}
```
### UNIAPP 使用方式
```ts
import { chooseFile } from '@/uni_modules/lime-choose-file'
const images = ref<string[]>([])
const onClick = () => {
chooseFile({
filename: 'xxxx', // 可选 用于给文件重命名安卓、iOS
type: 'image',
success(res){
images.value = res.tempFiles.map((item):string => item.path)
console.log('选择结果:', res.tempFiles)
},
fail(err){
console.log('选择失败:', err)
}
})
}
```
## API文档
### chooseFile 方法
| 参数 | 说明 | 类型 | 必填 |
| --- | --- | --- | --- |
| options | 文件选择选项 | _ChooseFileOption_ | 是 |
### ChooseFileOption 选项
| 参数 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| filename | _string_ | 否 | 指定文件名用于给文件重命名安卓、iOS |
| count | _number_ | 否 | 最多可以选择的文件数量默认为100 |
| type | _string_ | 否 | 所选文件类型,默认为'all' |
| extension | _string[]_ | 否 | 根据文件拓展名过滤每一项都不能是空字符串。默认不过滤。仅H5支持 |
| success | _(result: ChooseFileSuccessCallbackResult) => void_ | 否 | 接口调用成功的回调函数 |
| fail | _(res: GeneralCallbackResult) => void_ | 否 | 接口调用失败的回调函数 |
| complete | _(res: GeneralCallbackResult) => void_ | 否 | 接口调用结束的回调函数 |
### ChooseFileSuccessCallbackResult 返回参数
| 参数 | 类型 | 说明 |
| --- | --- | --- |
| tempFiles | _ChooseFile[]_ | 返回选择的文件的本地临时文件对象数组 |
| errMsg | _string_ | 错误信息 |
### ChooseFile 对象结构
| 参数 | 类型 | 说明 |
| --- | --- | --- |
| name | _string_ | 选择的文件名称 |
| path | _string_ | 本地临时文件路径 (本地路径) |
| size | _number_ | 本地临时文件大小,单位 B |
| time | _number_ | 选择的文件的会话发送时间Unix时间戳 |
| type | _'video' \| 'image' \| 'file' \| 'all'_ | 选择的文件类型 |
### 文件类型说明
| 类型值 | 说明 |
| --- | --- |
| video | 视频文件 |
| image | 图片文件 |
| file | 除图片和视频外的其他文件 |
| all | 所有类型文件 |
## 功能特点
- 支持多种文件类型的选择,包括图片、视频和其他文件
- 支持文件重命名功能
- 兼容安卓、iOS、鸿蒙和H5平台
- 提供简单易用的API接口
- 支持指定最大选择数量
- 支持文件扩展名过滤H5平台
## 常见问题
- iOS路径是中文时无法上传到服务器这时候需要设置`filename`给文件重命名
- APP端需要自定义基座才能使用
- 文件选择后会返回临时文件路径,需要及时使用或保存
- H5端可以通过extension参数过滤文件类型
## 支持与赞赏
如果你觉得本插件解决了你的问题,可以考虑支持作者:
| 支付宝赞助 | 微信赞助 |
|------------|------------|
| ![](https://testingcf.jsdelivr.net/gh/liangei/image@1.9/alipay.png) | ![](https://testingcf.jsdelivr.net/gh/liangei/image@1.9/wpay.png) |

View File

@@ -1,206 +0,0 @@
// @ts-nocheck
import Intent from 'android.content.Intent';
import ClipData from 'android.content.ClipData';
import Uri from 'android.net.Uri';
import InputStream from 'java.io.InputStream';
import OpenableColumns from 'android.provider.OpenableColumns';
import Cursor from 'android.database.Cursor';
import File from 'java.io.File';
import FileInputStream from 'java.io.FileInputStream';
import FileOutputStream from 'java.io.FileOutputStream';
import BufferedOutputStream from 'java.io.BufferedOutputStream';
import ByteArrayInputStream from 'java.io.ByteArrayInputStream';
import { ChooseFileOption, ChooseFile, ChooseFileSuccessCallbackResult } from '../interface'
import { GeneralCallbackResultImpl } from '../unierror'
const REQUEST_CODE_CHOOSE_FILE : Int = 42
let resultFunction : ((requestCode : Int, resultCode : Int, data ?: Intent) => void) | null = null
class ChooseFileImpl implements ChooseFile {
name : string = ''
path : string = ''
// private _path : string = ''
size : number = 0
time : number = 0
type : string = 'file'
// private uri : Uri
private options: ChooseFileOption
constructor(uri : Uri, options : ChooseFileOption) {
// this.uri = uri
this.options = options
this.time = Date.now()
this.type = this.getFileTypeFromUri(uri);
// this._path = uri.getPath() ?? ''
this.getFileInfoFromUri(uri)
if (this.isCache(options)) {
this.copyFileToCache(uri)
}
}
private isCache(options : ChooseFileOption) : boolean {
const extension = this.getFileExtension(this.name)
const extensions = options.extension
const type = options.type ?? 'all'
const hasExtension = extensions != null && extension != '' && extensions.includes(extension)
const isVideoOrImage = ['video', 'image'].includes(type)
const isFileAndNotVideoOrImage = type == 'file' && !['video', 'image'].includes(this.type);
if ((type == 'all' || isVideoOrImage || isFileAndNotVideoOrImage) && !hasExtension) {
return true
} else {
return false
}
}
private getFileExtension(fileName : string) : string {
const lastDotIndex = fileName.lastIndexOf(".");
if (lastDotIndex == -1) {
return "";
}
return fileName.substring(lastDotIndex + 1);
}
private copyFileToCache(uri : Uri) {
const cacheDir = UTSAndroid.getAppCachePath();
const context = UTSAndroid.getAppContext();
if(cacheDir != null) {
const path = new File(cacheDir);
if (!path.exists()) {
path.mkdir();
}
}
let fileName = this.name
if(this.options.filename != null) {
fileName = this.options.filename!;
if(this.options.count != null && this.options.count! > 1) {
fileName = `${fileName}_${Date.now()}`;
}
const extension = this.getFileExtension(this.name)
fileName = `${fileName}.${extension}`
}
const destFile = new File(cacheDir, fileName);
try {
const inputStream = context!.getContentResolver().openInputStream(uri)
const outputStream = new FileOutputStream(destFile)
if (inputStream != null) {
let buffer = ByteArray(1024);
let c = inputStream.read(buffer)
while (c > 0) {
outputStream.write(buffer, 0, c);
c = inputStream.read(buffer)
}
}
this.path = cacheDir + fileName//this.name
} catch (e) {
}
}
private getFileTypeFromUri(uri : Uri) : string {
const context = UTSAndroid.getAppContext();
let fileType = 'file'
let mimeType = context!.getContentResolver().getType(uri);
if (mimeType != null) {
if (mimeType.startsWith("video")) {
fileType = "video";
} else if (mimeType.startsWith("image")) {
fileType = "image";
}
}
return fileType;
}
private getFileInfoFromUri(uri : Uri) {
const context = UTSAndroid.getAppContext();
let cursor = context!.getContentResolver().query(uri, null, null, null, null);
if (cursor != null && cursor.moveToFirst()) {
this.name = cursor.getString(cursor.getColumnIndexOrThrow(OpenableColumns.DISPLAY_NAME))
const fileSize = cursor.getLong(cursor.getColumnIndexOrThrow(OpenableColumns.SIZE));
this.size = Number.from(fileSize)
cursor.close();
} else if ("file".equals(uri.getScheme())) {
this.name = uri.getLastPathSegment() ?? '';
const file = new File(uri.getPath() ?? '');
const fileSize = file.length();
this.size = Number.from(fileSize)
}
}
}
export function chooseFile(options : ChooseFileOption) {
if (resultFunction != null) {
UTSAndroid.offAppActivityResult(resultFunction!)
}
const type = options.type ?? 'all'
const intent = new Intent(Intent.ACTION_GET_CONTENT);
if (type.equals("all") || type.equals("file")) {
intent.setType("*/*");
} else if (type.equals("video")) {
intent.setType("video/*");
} else if (type.equals("image")) {
intent.setType("image/*");
}
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, options.count == 1 ? false : true); // 允许多选
resultFunction = (requestCode : Int, resultCode : Int, data ?: Intent) => {
if (requestCode == REQUEST_CODE_CHOOSE_FILE) {
UTSAndroid.offAppActivityResult(resultFunction!);
if (resultCode == -1 && data != null) {
const clipData = data.getClipData();
const tempFiles : ChooseFile[] = []
if (clipData != null) {
// 多选
// const itemCount = clipData.getItemCount();
// if (options.count != null && options.count! > itemCount) {
// const err = new GeneralCallbackResultImpl(9010002, `选中文件数量超过${options.count}`)
// options.fail?.(err)
// options.complete?.(err)
// return
// }
for (let i = 0; i < clipData.getItemCount(); i++) {
const uri = clipData.getItemAt(i.toInt()).getUri();
const chooseFile = new ChooseFileImpl(uri, options);
if(chooseFile.path !=''){
tempFiles.push(chooseFile)
}
}
} else {
// 单选
const uri = data.getData();
if (uri != null) {
const chooseFile = new ChooseFileImpl(uri, options)
if(chooseFile.path !='' ){
tempFiles.push(chooseFile)
}
}
}
const count = options.count ?? Integer.MAX_VALUE // Number.MAX_VALUE
if(tempFiles.length > 0 && count >= tempFiles.length){
options.success?.({
tempFiles,
errMsg: 'chooseFile:ok'
} as ChooseFileSuccessCallbackResult)
} else {
const err = new GeneralCallbackResultImpl(9010002, `没有可用的文件或文件超过设置数量`)
options.fail?.(err)
options.complete?.(err)
}
} else {
const err = new GeneralCallbackResultImpl(9010002, `没有可用的文件`)
options.fail?.(err)
options.complete?.(err)
}
} else {
const err = new GeneralCallbackResultImpl(9010002, `没有可用的文件`)
options.fail?.(err)
options.complete?.(err)
}
}
UTSAndroid.onAppActivityResult(resultFunction!)
UTSAndroid.getUniActivity()!.startActivityForResult(Intent.createChooser(intent, "选择文件"), REQUEST_CODE_CHOOSE_FILE)
// UTSAndroid.getUniActivity()!.overridePendingTransition((10).toInt(), (0).toInt());
}

View File

@@ -0,0 +1,262 @@
@file:Suppress("UNCHECKED_CAST", "USELESS_CAST", "INAPPLICABLE_JVM_NAME", "UNUSED_ANONYMOUS_PARAMETER", "SENSELESS_COMPARISON", "NAME_SHADOWING", "UNNECESSARY_NOT_NULL_ASSERTION")
package uts.sdk.modules.limeChooseFile
import android.content.Intent
import android.net.Uri
import android.provider.OpenableColumns
import io.dcloud.uniapp.*
import io.dcloud.uniapp.extapi.*
import io.dcloud.uts.*
import io.dcloud.uts.Map
import io.dcloud.uts.Set
import io.dcloud.uts.UTSAndroid
import java.io.File
import java.io.FileOutputStream
import kotlin.properties.Delegates
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
typealias ChooseFileErrorCode = Number
interface GeneralCallbackResult : IUniError {
override var errCode: ChooseFileErrorCode
}
interface ChooseFile {
var name: String
var path: String
var size: Number
var time: Number
var type: String
}
open class ChooseFileSuccessCallbackResult (
@JsonNotNull
open var tempFiles: UTSArray<ChooseFile>,
@JsonNotNull
open var errMsg: String,
) : UTSObject()
typealias ChooseFileSuccessCallback = (result: ChooseFileSuccessCallbackResult) -> Unit
typealias ChooseFileFailCallback = (res: GeneralCallbackResult) -> Unit
typealias ChooseFileCompleteCallback = (res: GeneralCallbackResult) -> Unit
open class ChooseFileOption (
open var filename: String? = null,
open var count: Number? = null,
open var type: String? = null,
open var extension: UTSArray<String>? = null,
open var success: ChooseFileSuccessCallback? = null,
open var fail: ChooseFileFailCallback? = null,
open var complete: ChooseFileCompleteCallback? = null,
) : UTSObject()
val UniErrorSubject = "chooseFile\""
val UniErrors: Map<ChooseFileErrorCode, String> = Map(_uA(
_uA(
9010001,
"chooseFile:ok"
),
_uA(
9010002,
"ChooseFile:failed"
)
))
open class GeneralCallbackResultImpl : UniError, GeneralCallbackResult {
constructor(errCode: ChooseFileErrorCode, errMsg: String? = null) : super() {
this.errSubject = UniErrorSubject
this.errCode = errCode
this.errMsg = errMsg ?: UniErrors[errCode] ?: ""
}
}
val REQUEST_CODE_CHOOSE_FILE: Int = 42
var resultFunction: ((requestCode: Int, resultCode: Int, data: Intent?) -> Unit)? = null
open class ChooseFileImpl : ChooseFile {
override var name: String = ""
override var path: String = ""
override var size: Number = 0
override var time: Number = 0
override var type: String = "file"
private var options: ChooseFileOption
constructor(uri: Uri, options: ChooseFileOption){
this.options = options
this.time = Date.now()
this.type = this.getFileTypeFromUri(uri)
this.getFileInfoFromUri(uri)
if (this.isCache(options)) {
this.copyFileToCache(uri)
}
}
private fun isCache(options: ChooseFileOption): Boolean {
val extension = this.getFileExtension(this.name)
val extensions = options.extension
val type = options.type ?: "all"
val hasExtension = extensions != null && extension != "" && extensions.includes(extension)
val isVideoOrImage = _uA(
"video",
"image"
).includes(type)
val isFileAndNotVideoOrImage = type == "file" && !_uA(
"video",
"image"
).includes(this.type)
if ((type == "all" || isVideoOrImage || isFileAndNotVideoOrImage) && !hasExtension) {
return true
} else {
return false
}
}
private fun getFileExtension(fileName: String): String {
val lastDotIndex = fileName.lastIndexOf(".")
if (lastDotIndex == -1) {
return ""
}
return fileName.substring(lastDotIndex + 1)
}
private fun copyFileToCache(uri: Uri) {
val cacheDir = UTSAndroid.getAppCachePath()
val context = UTSAndroid.getAppContext()
if (cacheDir != null) {
val path = File(cacheDir)
if (!path.exists()) {
path.mkdir()
}
}
var fileName = this.name
if (this.options.filename != null) {
fileName = this.options.filename!!
if (this.options.count != null && this.options.count!! > 1) {
fileName = "" + fileName + "_" + Date.now()
}
val extension = this.getFileExtension(this.name)
fileName = "" + fileName + "." + extension
}
val destFile = File(cacheDir, fileName)
try {
val inputStream = context!!.getContentResolver().openInputStream(uri)
val outputStream = FileOutputStream(destFile)
if (inputStream != null) {
var buffer = ByteArray(1024)
var c = inputStream.read(buffer)
while(c > 0){
outputStream.write(buffer, 0, c)
c = inputStream.read(buffer)
}
}
this.path = cacheDir + fileName
}
catch (e: Throwable) {}
}
private fun getFileTypeFromUri(uri: Uri): String {
val context = UTSAndroid.getAppContext()
var fileType = "file"
var mimeType = context!!.getContentResolver().getType(uri)
if (mimeType != null) {
if (mimeType.startsWith("video")) {
fileType = "video"
} else if (mimeType.startsWith("image")) {
fileType = "image"
}
}
return fileType
}
private fun getFileInfoFromUri(uri: Uri) {
val context = UTSAndroid.getAppContext()
var cursor = context!!.getContentResolver().query(uri, null, null, null, null)
if (cursor != null && cursor.moveToFirst()) {
this.name = cursor.getString(cursor.getColumnIndexOrThrow(OpenableColumns.DISPLAY_NAME))
val fileSize = cursor.getLong(cursor.getColumnIndexOrThrow(OpenableColumns.SIZE))
this.size = UTSNumber.from(fileSize)
cursor.close()
} else if ("file".equals(uri.getScheme())) {
this.name = uri.getLastPathSegment() ?: ""
val file = File(uri.getPath() ?: "")
val fileSize = file.length()
this.size = UTSNumber.from(fileSize)
}
}
}
fun chooseFile(options: ChooseFileOption) {
if (resultFunction != null) {
UTSAndroid.offAppActivityResult(resultFunction!!)
}
val type = options.type ?: "all"
val intent = Intent(Intent.ACTION_GET_CONTENT)
if (type.equals("all") || type.equals("file")) {
intent.setType("*/*")
} else if (type.equals("video")) {
intent.setType("video/*")
} else if (type.equals("image")) {
intent.setType("image/*")
}
intent.addCategory(Intent.CATEGORY_OPENABLE)
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, if (options.count == 1) {
false
} else {
true
}
)
resultFunction = fun(requestCode: Int, resultCode: Int, data: Intent?){
if (requestCode == REQUEST_CODE_CHOOSE_FILE) {
UTSAndroid.offAppActivityResult(resultFunction!!)
if (resultCode == -1 && data != null) {
val clipData = data.getClipData()
val tempFiles: UTSArray<ChooseFile> = _uA()
if (clipData != null) {
run {
var i: Number = 0
while(i < clipData.getItemCount()){
val uri = clipData.getItemAt(i.toInt()).getUri()
val chooseFile = ChooseFileImpl(uri, options)
if (chooseFile.path != "") {
tempFiles.push(chooseFile)
}
i++
}
}
} else {
val uri = data.getData()
if (uri != null) {
val chooseFile = ChooseFileImpl(uri, options)
if (chooseFile.path != "") {
tempFiles.push(chooseFile)
}
}
}
val count = options.count ?: Integer.MAX_VALUE
if (tempFiles.length > 0 && count >= tempFiles.length) {
options.success?.invoke(ChooseFileSuccessCallbackResult(tempFiles = tempFiles, errMsg = "chooseFile:ok"))
} else {
val err = GeneralCallbackResultImpl(9010002, "没有可用的文件或文件超过设置数量")
options.fail?.invoke(err)
options.complete?.invoke(err)
}
} else {
val err = GeneralCallbackResultImpl(9010002, "没有可用的文件")
options.fail?.invoke(err)
options.complete?.invoke(err)
}
} else {
val err = GeneralCallbackResultImpl(9010002, "没有可用的文件")
options.fail?.invoke(err)
options.complete?.invoke(err)
}
}
UTSAndroid.onAppActivityResult(resultFunction!!)
UTSAndroid.getUniActivity()!!.startActivityForResult(Intent.createChooser(intent, "选择文件"), REQUEST_CODE_CHOOSE_FILE)
}
open class ChooseFileOptionJSONObject : UTSJSONObject() {
open var filename: String? = null
open var count: Number? = null
open var type: String? = null
open var extension: UTSArray<String>? = null
open var success: UTSCallback? = null
open var fail: UTSCallback? = null
open var complete: UTSCallback? = null
}
fun chooseFileByJs(options: ChooseFileOptionJSONObject) {
return chooseFile(ChooseFileOption(filename = options.filename, count = options.count, type = options.type, extension = options.extension, success = fun(result: ChooseFileSuccessCallbackResult): Unit {
options.success?.invoke(result)
}
, fail = fun(res: GeneralCallbackResult): Unit {
options.fail?.invoke(res)
}
, complete = fun(res: GeneralCallbackResult): Unit {
options.complete?.invoke(res)
}
))
}

View File

@@ -1,3 +0,0 @@
{
"deploymentTarget": "9"
}

View File

@@ -1,138 +0,0 @@
// @ts-nocheck
import { ChooseFileOption, ChooseFile, ChooseFileSuccessCallbackResult } from '../interface'
import { UIDocumentPickerDelegate, UIDocumentPickerMode } from "UIKit"
import { URL, FileManager } from 'Foundation';
import { GeneralCallbackResultImpl } from '../unierror'
import { DispatchQueue } from 'Dispatch';
const documentTypes : Map<string, string[]> = new Map([
["all", ["public.item"]],
["file", [
"public.text",
"public.zip-archive",
"public.data",
"com.adobe.pdf",
"com.microsoft.word.doc",
"com.microsoft.word.docx",
"com.microsoft.excel.xls",
"com.microsoft.excel.xlsx"
]
],
["video", ["public.movie"]],
["image", ["public.image"]],
])
class ChooseFileImpl {
name : string = ''
path : string = ''
size : number = 0
time : number = 0
type : string = 'file'
constructor(uri : URL, options : ChooseFileOption) {
try {
const originalFileName = uri.lastPathComponent;
const attributes = UTSiOS.try(FileManager.default.attributesOfItem(atPath = uri.path))
const fileSize = attributes[FileAttributeKey.size] as number
const pathExtension = `${uri.pathExtension}`
const imageFormats = ['jpeg', 'jpg', 'png', 'gif', 'bmp', 'tiff', 'svg']
const videoFormats = ['mov', 'm4v', 'mp4', 'avi']
let fileName = originalFileName
if(options.filename != null) {
fileName = options.filename!
if(options.count != null && options.count! > 1) {
fileName = `${fileName}_${Date.now()}`;
}
fileName = `${fileName}.${pathExtension}`
}
// #ifdef UNI-APP-X
const dataPath = UTSiOS.getDataPath()
// #endif
// #ifndef UNI-APP-X
const dataPath = UTSiOS.getDataPath().replace(/data$/, "doc");
// #endif
const file = new URL(fileURLWithPath = dataPath).appendingPathComponent(fileName)//.absoluteString
const fileData = FileManager.default.contents(atPath = uri.path);
UTSiOS.try(fileData?.write(to = file))
if (imageFormats.includes(pathExtension)) {
this.type = 'image'
} else if (videoFormats.includes(pathExtension)) {
this.type = 'video'
} else {
this.type = 'file'
}
this.name = `${originalFileName}`
this.size = fileSize
this.path = `${file.absoluteString}`
} catch (e) {
}
}
}
class FilePickerManager implements UIDocumentPickerDelegate {
options : ChooseFileOption = {}
constructor() { }
chooseFile(options : ChooseFileOption) {
DispatchQueue.main.async(execute = () : void => {
this.options = options
const type = options.type ?? 'all'
const count = options.count ?? 1
const types = (documentTypes.get(type) ?? documentTypes.get('all')) as string[]
let documentPicker = UIDocumentPickerViewController(
documentTypes = types,
in = UIDocumentPickerMode.import
)
documentPicker.delegate = this
// 多选要大于 ios11
if (UTSiOS.available("iOS 11.0, *")) {
documentPicker.allowsMultipleSelection = count > 1
}
UTSiOS.getCurrentViewController().present(documentPicker, animated = true)
})
}
documentPicker(controller : UIDocumentPickerViewController, @argumentLabel("didPickDocumentsAt") urls : URL[]) {
DispatchQueue.main.async(execute = () : void => {
const tempFiles : ChooseFile[] = []
for (let i = 0; i < urls.length; i++) {
const url = urls[i]
const chooseFile = new ChooseFileImpl(url, this.options);
// IOS -> js 无法传class?
const file : ChooseFile = {
name: chooseFile.name,
path: chooseFile.path,
size: chooseFile.size,
time: chooseFile.time,
type: chooseFile.type,
}
if (chooseFile.path != '') {
tempFiles.push(file)
}
}
const count = this.options.count ?? Number.from(Double.greatestFiniteMagnitude) //Number.from(Double.MAX_VALUE)
if (tempFiles.length > 0 && count >= tempFiles.length) {
const res : ChooseFileSuccessCallbackResult = {
tempFiles,
errMsg: 'chooseFile:ok'
}
this.options.success?.(res)
} else {
const err = new GeneralCallbackResultImpl(9010002, `没有可用的文件或文件超过设置数量`)
this.options.fail?.(err)
this.options.complete?.(err)
}
})
}
}
const fileManager = new FilePickerManager()
export function chooseFile(options : ChooseFileOption) {
fileManager.chooseFile(options)
}

View File

@@ -1,35 +0,0 @@
// @ts-nocheck
export * from './interface';
import { type ChooseFileOption } from './interface';
export function chooseFile(options: ChooseFileOption){
// #ifdef WEB || APP-HARMONY
uni.chooseFile({
count: options.count ?? 100,
type: options.type,
extension: options.extension,
success(res) {
options.success?.({
// tempFilePaths
errMsg : 'ok',
tempFiles: res.tempFiles
})
},
fail(err) {
options.fail?.({
errCode: err.errCode,
errSubject: 'lime-choose-file'
})
},
complete(res) {
// options.complete?.(res)
}
})
// #endif
// #ifdef MP-WEIXIN
uni.chooseMessageFile(options)
// #endif
// #ifndef WEB || MP-WEIXIN || APP-HARMONY
console.error('chooseFile 不支持该平台')
// #endif
}

View File

@@ -1,108 +0,0 @@
// @ts-nocheck
/**
* 错误码
* 根据uni错误码规范要求建议错误码以90开头以下是错误码示例
* - 9010001 错误信息1
* - 9010002 错误信息2
*/
export type ChooseFileErrorCode = 9010001 | 9010002 | 1101001 | 1101002 | 1101003 | 1101004 | 1101005 | 1101006 | 1101007 | 1101008 | 1101009 | 1101010;
/**
* myApi 的错误回调参数
*/
export interface GeneralCallbackResult extends IUniError {
errCode : ChooseFileErrorCode
};
/** 返回选择的文件的本地临时文件对象数组 */
// #ifdef APP-ANDROID
export interface ChooseFile {
/** 选择的文件名称 */
name : string
/** 本地临时文件路径 (本地路径) */
path : string
/** 本地临时文件大小,单位 B */
size : number
/** 选择的文件的会话发送时间Unix时间戳工具暂不支持此属性 */
time : number
/** 选择的文件类型
*
* 可选值:
* - 'video': 选择了视频文件;
* - 'image': 选择了图片文件;
* - 'file': 选择了除图片和视频的文件; */
type : 'video' | 'image' | 'file' | 'all'
}
// #endif
// #ifndef APP-ANDROID
export type ChooseFile = {
/** 选择的文件名称 */
name : string
/** 本地临时文件路径 (本地路径) */
path : string
/** 本地临时文件大小,单位 B */
size : number
/** 选择的文件的会话发送时间Unix时间戳工具暂不支持此属性 */
time : number
/** 选择的文件类型
*
* 可选值:
* - 'video': 选择了视频文件;
* - 'image': 选择了图片文件;
* - 'file': 选择了除图片和视频的文件; */
type : 'video' | 'image' | 'file' | 'all'
}
// #endif
export type ChooseFileSuccessCallbackResult = {
/** 返回选择的文件的本地临时文件对象数组 */
tempFiles : ChooseFile[],
errMsg : string
}
/** 接口调用成功的回调函数 */
export type ChooseFileSuccessCallback = (
result : ChooseFileSuccessCallbackResult
) => void
/** 接口调用失败的回调函数 */
export type ChooseFileFailCallback = (res : GeneralCallbackResult) => void
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
export type ChooseFileCompleteCallback = (
res : GeneralCallbackResult
) => void
export type ChooseFileOption = {
/**
* 指定文件名,如果是多选就在后面增加上时间
*/
filename?: string
/**
* 最多可以选择的文件数量。
* @defaultValue 100
*/
count ?: number | null,
/**
* 所选文件类型
* @defaultValue all
*/
type ?: string | null,
/**
* 根据文件拓展名过滤每一项都不能是空字符串。默认不过滤。仅H5支持
*/
extension ?: (string[]) | null,
/**
* 成功则返回图片的本地文件路径列表 tempFilePaths
*/
success ?: ChooseFileSuccessCallback | null,
/**
* 接口调用失败的回调函数
*/
fail ?: ChooseFileFailCallback | null,
/**
* 接口调用结束的回调函数(调用成功、失败都会执行)
*/
complete ?: ChooseFileCompleteCallback | null
}

View File

@@ -1,40 +0,0 @@
// @ts-nocheck
/* 此规范为 uni 规范,可以按照自己的需要选择是否实现 */
import { ChooseFileErrorCode, GeneralCallbackResult } from "./interface.uts"
/**
* 错误主题
* 注意:错误主题一般为插件名称,每个组件不同,需要使用时请更改。
* [可选实现]
*/
export const UniErrorSubject = 'chooseFile"';
/**
* 错误信息
* @UniError
* [可选实现]
*/
export const UniErrors : Map<ChooseFileErrorCode, string> = new Map([
/**
* 错误码及对应的错误信息
*/
[9010001, 'chooseFile:ok'],
[9010002, 'ChooseFile:failed'],
]);
/**
* 错误对象实现
*/
export class GeneralCallbackResultImpl extends UniError implements GeneralCallbackResult {
/**
* 错误对象构造函数
*/
constructor(errCode : ChooseFileErrorCode, errMsg: string|null = null) {
super();
this.errSubject = UniErrorSubject;
this.errCode = errCode;
this.errMsg = errMsg ?? UniErrors[errCode] ?? "";
}
}