From 6d83765fb6e5a4bf91e7e02d5d472e728b258fe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=BF=97=E5=BC=BA?= Date: Sun, 9 Oct 2022 17:06:46 +0800 Subject: [PATCH 1/8] fist push MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨志强 --- .gitignore | 5 + AppScope/app.json5 | 11 + AppScope/resources/base/element/string.json | 8 + AppScope/resources/base/media/app_icon.png | Bin 0 -> 6790 bytes CHANGELOG.md | 8 + LICENSE | 201 +++ OAT.xml | 15 + README.OpenSource | 0 README.md | 135 +- build-profile.json5 | 44 + commons_fileupload/.gitignore | 3 + commons_fileupload/build-profile.json5 | 5 + commons_fileupload/hvigorfile.js | 3 + commons_fileupload/index.ets | 7 + commons_fileupload/package-lock.json | 5 + commons_fileupload/package.json | 13 + .../src/main/ets/components/index.ets | 253 ++++ .../src/main/ets/components/models/File.ets | 24 + .../main/ets/components/models/FormData.ets | 126 ++ .../src/main/ets/components/types/type.ets | 28 + .../src/main/ets/components/utils/helpers.ets | 38 + .../src/main/ets/components/utils/log.ets | 37 + .../src/main/ets/components/utils/utils.ets | 61 + commons_fileupload/src/main/module.json5 | 10 + .../main/resources/base/element/string.json | 8 + entry/.gitignore | 4 + entry/build-profile.json5 | 13 + entry/hvigorfile.js | 2 + entry/package-lock.json | 31 + entry/package.json | 16 + .../main/ets/Application/MyAbilityStage.ts | 9 + entry/src/main/ets/MainAbility/MainAbility.ts | 52 + entry/src/main/ets/pages/UploadFile.ets | 102 ++ entry/src/main/ets/pages/index.ets | 41 + entry/src/main/ets/utils/log.ets | 37 + entry/src/main/module.json5 | 52 + .../main/resources/base/element/color.json | 8 + .../main/resources/base/element/string.json | 16 + entry/src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../resources/base/profile/main_pages.json | 6 + entry/src/main/resources/rawfile/icon.png | Bin 0 -> 6790 bytes .../ets/Application/TestAbilityStage.ts | 9 + .../ohosTest/ets/TestAbility/TestAbility.ets | 59 + .../ohosTest/ets/TestAbility/pages/index.ets | 35 + .../ets/TestRunner/OpenHarmonyTestRunner.ts | 71 + entry/src/ohosTest/ets/test/Ability.test.ets | 36 + entry/src/ohosTest/ets/test/List.test.ets | 5 + entry/src/ohosTest/module.json5 | 38 + .../resources/base/element/color.json | 8 + .../resources/base/element/string.json | 16 + .../ohosTest/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../resources/base/profile/test_pages.json | 5 + hvigorfile.js | 2 + package-lock.json | 1226 +++++++++++++++++ package.json | 18 + 55 files changed, 2938 insertions(+), 27 deletions(-) create mode 100644 .gitignore create mode 100644 AppScope/app.json5 create mode 100644 AppScope/resources/base/element/string.json create mode 100644 AppScope/resources/base/media/app_icon.png create mode 100644 CHANGELOG.md create mode 100644 LICENSE create mode 100644 OAT.xml create mode 100644 README.OpenSource create mode 100644 build-profile.json5 create mode 100644 commons_fileupload/.gitignore create mode 100644 commons_fileupload/build-profile.json5 create mode 100644 commons_fileupload/hvigorfile.js create mode 100644 commons_fileupload/index.ets create mode 100644 commons_fileupload/package-lock.json create mode 100644 commons_fileupload/package.json create mode 100644 commons_fileupload/src/main/ets/components/index.ets create mode 100644 commons_fileupload/src/main/ets/components/models/File.ets create mode 100644 commons_fileupload/src/main/ets/components/models/FormData.ets create mode 100644 commons_fileupload/src/main/ets/components/types/type.ets create mode 100644 commons_fileupload/src/main/ets/components/utils/helpers.ets create mode 100644 commons_fileupload/src/main/ets/components/utils/log.ets create mode 100644 commons_fileupload/src/main/ets/components/utils/utils.ets create mode 100644 commons_fileupload/src/main/module.json5 create mode 100644 commons_fileupload/src/main/resources/base/element/string.json create mode 100644 entry/.gitignore create mode 100644 entry/build-profile.json5 create mode 100644 entry/hvigorfile.js create mode 100644 entry/package-lock.json create mode 100644 entry/package.json create mode 100644 entry/src/main/ets/Application/MyAbilityStage.ts create mode 100644 entry/src/main/ets/MainAbility/MainAbility.ts create mode 100644 entry/src/main/ets/pages/UploadFile.ets create mode 100644 entry/src/main/ets/pages/index.ets create mode 100644 entry/src/main/ets/utils/log.ets create mode 100644 entry/src/main/module.json5 create mode 100644 entry/src/main/resources/base/element/color.json create mode 100644 entry/src/main/resources/base/element/string.json create mode 100644 entry/src/main/resources/base/media/icon.png create mode 100644 entry/src/main/resources/base/profile/main_pages.json create mode 100644 entry/src/main/resources/rawfile/icon.png create mode 100644 entry/src/ohosTest/ets/Application/TestAbilityStage.ts create mode 100644 entry/src/ohosTest/ets/TestAbility/TestAbility.ets create mode 100644 entry/src/ohosTest/ets/TestAbility/pages/index.ets create mode 100644 entry/src/ohosTest/ets/TestRunner/OpenHarmonyTestRunner.ts create mode 100644 entry/src/ohosTest/ets/test/Ability.test.ets create mode 100644 entry/src/ohosTest/ets/test/List.test.ets create mode 100644 entry/src/ohosTest/module.json5 create mode 100644 entry/src/ohosTest/resources/base/element/color.json create mode 100644 entry/src/ohosTest/resources/base/element/string.json create mode 100644 entry/src/ohosTest/resources/base/media/icon.png create mode 100644 entry/src/ohosTest/resources/base/profile/test_pages.json create mode 100644 hvigorfile.js create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..91d237b --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/node_modules +/local.properties +/.idea +**/build +/.hvigor \ No newline at end of file diff --git a/AppScope/app.json5 b/AppScope/app.json5 new file mode 100644 index 0000000..335d12e --- /dev/null +++ b/AppScope/app.json5 @@ -0,0 +1,11 @@ +{ + "app": { + "bundleName": "com.example.myapplication", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true + } +} diff --git a/AppScope/resources/base/element/string.json b/AppScope/resources/base/element/string.json new file mode 100644 index 0000000..1080233 --- /dev/null +++ b/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MyApplication" + } + ] +} diff --git a/AppScope/resources/base/media/app_icon.png b/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4ZzgdeKtgoc+o5EvN9A1K1_<>M?MBqb#!ASf&# zEX?<)!RH(7>1P+j=jqG(58}TVN-$psA6K}atCuI!KTJD&FMmH-78ZejBm)0qc{ESp z|LuG1{QnBUJRg_E=h1#XMWt2%fcoN@l7eAS!Es?Q+;XsRNPhiiE=@AqlLkJzF`O18 zbsbSmKN=aaq8k3NFYZfDWpKmM!coBU0(XnL8R{4=i|wi{!uWYM2je{U{B*K2PVdu&=E zTq*-XsEsJ$u5H4g6DIm2Y!DN`>^v|AqlwuCD;w45K0@eqauiqWf7l&o)+YLHm~|L~ z7$0v5mkobriU!H<@mVJHLlmQqzQ3d6Rh_-|%Yy2li*tHO>_vcnuZ7OR_xkAIuIU&x z-|8Y0wj|6|a6_I(v91y%k_kNw6pnkNdxjqG8!%Vz_d%c_!X+6-;1`GC9_FpjoHev5fEV7RhJ>r=mh-jp$fqbqRJ=obwdgLDVP5+s zy1=_DWG0Y-Jb3t^WXmkr(d9~08k-|#Ly zaNOmT(^9tIb&eb4%CzIT zAm3CUtWSr1t4?h1kk#NBi{U|pJslvME{q|_eS^3En>SOqSxyuN1x;Is@8~m?*>}** znrRFArP!K_52RpX*&JHMR<^lVdm8ypJ}0R(SD(51j;6@ni$6bQ+2XL+R^|NnSp5}(kzvMZ^(@4fD_{QVu$(&K6H|C37TG1Am9Re{<<3gd zh@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+ + \ No newline at end of file diff --git a/README.OpenSource b/README.OpenSource new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md index fa0f955..2c7ec4c 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,120 @@ -# commons-fileupload +# PullToRefresh -#### 介绍 -{**以下是 Gitee 平台说明,您可以替换此简介** -Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 -无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)} +## 简介 -#### 软件架构 -软件架构说明 +> PullToRefresh是一个简单的下拉刷新、上拉加载三方库。 +> 支持设置内置动画的各种属性,支持设置自定义动画。 +#### 效果展示: -#### 安装教程 +内置动画效果 -1. xxxx -2. xxxx -3. xxxx +![Refresh](gifs/Refresh.gif)![Refresh](gifs/LoadMore.gif) -#### 使用说明 +## 下载安装 -1. xxxx -2. xxxx -3. xxxx +```shell +npm install @ohos/pulltorefresh --save +``` -#### 参与贡献 +OpenHarmony +npm环境配置等更多内容,请参考 [如何安装OpenHarmony npm包](https://gitee.com/openharmony-tpc/docs/blob/master/OpenHarmony_npm_usage.md) 。 -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request +## 使用说明 +### 快速使用 -#### 特技 +```typescript +import { PullToRefresh } from '@ohos/pulltorefresh' -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) +// 需绑定列表或宫格组件 +private scroller: Scroller = new Scroller(); + +PullToRefresh({ +// 必传项,需绑定传入主体布局内的列表或宫格组件 +scroller: this.scroller, +// 必传项,自定义主体布局,内部有列表或宫格组件 +customList: () => { + // 一个用@Builder修饰过的UI方法 + this.getListView(); +}, +// 可选项,下拉刷新回调 +onRefresh: () => { + return new Promise((resolve, reject) => { + // 模拟网络请求操作,请求网络2秒后得到数据,通知组件,变更列表数据 + setTimeout(() => { + resolve('刷新成功'); + this.data = this.dataNumbers; + }, 2000); + }); +}, +// 可选项,上拉加载更多回调 +onLoadMore: () => { + return new Promise((resolve, reject) => { + // 模拟网络请求操作,请求网络2秒后得到数据,通知组件,变更列表数据 + setTimeout(() => { + resolve(''); + this.data.push("增加的条目" + this.data.length); + }, 2000); + }); +}, +}) +``` + +设置属性示例和设置自定义动画示例请看[示例entry](https://gitee.com/openharmony-sig/PullToRefresh/tree/master/entry/src/main/ets/pages) + +## 属性(接口)说明 + +### PullToRefresh组件属性 + +| 属性 | 类型 | 释义 | 默认值 | +| :------------------:| :-------------------------------------------------------------: | :---------------------------: | :----------------------------: | +| scroller | Scroller | 列表或宫格组件所绑定的Scroller对象 | undefined | +| customList | ```() => void ``` | 自定义主体布局,内部有列表或宫格组件 | undefined | +| refreshConfigurator | PullToRefreshConfigurator | 组件属性配置 | PullToRefreshConfigurator | +| mWidth | Length | 容器宽 | undefined(自适应) | +| mHeight | Length | 容器高 | undefined(自适应) | +| onRefresh | ```() => Promise``` | 下拉刷新回调 | 1秒后结束下拉刷新动画并提示“刷新失败” | +| onLoadMore | ```() => Promise``` | 上拉加载更多回调 | 1秒后结束上拉加载动画 | +| customRefresh | ```() => void ``` | 自定义下拉刷新动画布局 | undefined | +| onAnimPullDown | ```(value?: number, width?: number, height?: number) => void``` | 下拉中回调 | undefined | +| onAnimRefreshing | ```(value?: number, width?: number, height?: number) => void``` | 刷新中回调 | undefined | +| customLoad | ```() => void``` | 自定义上拉加载动画布局 | undefined | +| onAnimPullUp | ```(value?: number, width?: number, height?: number) => void``` | 上拉中回调 | undefined | +| onAnimLoading | ```(value?: number, width?: number, height?: number) => void``` | 加载中回调 | undefined | + +### PullToRefreshConfigurator类接口 + +| 接口 | 参数类型 | 释义 | 默认值 | +| :------------------------:| :-------------------------: | :-----------------------: | :--------------: | +| setHasRefresh | boolean | 是否具有下拉刷新功能 | true | +| setHasLoadMore | boolean | 是否具有上拉加载功能 | true | +| setMaxTranslate | number | 可下拉上拉的最大距离 | 100 | +| setSensitivity | number | 下拉上拉灵敏度 | 0.7 | +| setListIsPlacement | boolean | 滑动结束后列表是否归位 | true | +| setAnimDuration | number | 滑动结束后,回弹动画执行时间 | 150 | +| setRefreshHeight | number | 下拉动画高度 | 30 | +| setRefreshColor | string | 下拉动画颜色 | '#999999' | +| setRefreshBackgroundColor | ResourceColor | 下拉动画区域背景色 | 'rgba(0,0,0,0)' | +| setRefreshTextColor | ResourceColor | 下拉加载完毕后提示文本的字体颜色 | '#999999' | +| setRefreshTextSize | number 或 string 或 Resource | 下拉加载完毕后提示文本的字体大小 | 18 | +| setLoadImgHeight | number | 上拉动画中图片的高度 | 30 | +| setLoadBackgroundColor | ResourceColor | 上拉动画区域背景色 | 'rgba(0,0,0,0)' | +| setLoadTextColor | ResourceColor | 上拉文本的字体颜色 | '#999999' | +| setLoadTextSize | number 或 string 或 Resource | 上拉文本的字体大小 | 18 | +| setLoadTextPullUp1 | string | 上拉1阶段文本 | '正在上拉刷新...' | +| setLoadTextPullUp2 | string | 上拉2阶段文本 | '放开刷新' | +| setLoadTextLoading | string | 上拉加载更多中时的文本 | '正在玩命加载中...' | + +## 兼容性 + +支持 OpenHarmony API version 9 版本。 + +## 贡献代码 + +使用过程中发现任何问题都可以提 [Issue](https://gitee.com/openharmony-sig/PullToRefresh/issues) +给我们,当然,我们也非常欢迎你给我们发 [PR](https://gitee.com/openharmony-sig/PullToRefresh/pulls) 。 + +## 开源协议 + +本项目基于 [Apache License 2.0](https://gitee.com/openharmony-sig/PullToRefresh/blob/master/LICENSE) ,请自由地享受和参与开源。 \ No newline at end of file diff --git a/build-profile.json5 b/build-profile.json5 new file mode 100644 index 0000000..2cab90a --- /dev/null +++ b/build-profile.json5 @@ -0,0 +1,44 @@ +{ + "app": { + "signingConfigs": [ + { + "name": "default", + "material": { + "certpath": "C:\\Users\\Administrator\\.ohos\\config\\openharmony\\auto_ohos_default_com.example.myapplication.cer", + "storePassword": "0000001ACC94C1246EB94D52D0EC68E3222C1143D0FFC07DF34F940A734EB2B69281841E03562328F9DD", + "keyAlias": "debugKey", + "keyPassword": "0000001AEAE19011179D4986A3118A84C68DD4492785351FF75B4C7A36559703BF3B0FA11C47C1B2CC1D", + "profile": "C:\\Users\\Administrator\\.ohos\\config\\openharmony\\auto_ohos_default_com.example.myapplication.p7b", + "signAlg": "SHA256withECDSA", + "storeFile": "C:\\Users\\Administrator\\.ohos\\config\\openharmony\\auto_ohos_default_com.example.myapplication.p12" + } + } + ], + "compileSdkVersion": 9, + "compatibleSdkVersion": 9, + "products": [ + { + "name": "default", + "signingConfig": "default", + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "commons_fileupload", + "srcPath": "./commons_fileupload" + } + ] +} \ No newline at end of file diff --git a/commons_fileupload/.gitignore b/commons_fileupload/.gitignore new file mode 100644 index 0000000..4f9a973 --- /dev/null +++ b/commons_fileupload/.gitignore @@ -0,0 +1,3 @@ +/node_modules +/.preview +/build \ No newline at end of file diff --git a/commons_fileupload/build-profile.json5 b/commons_fileupload/build-profile.json5 new file mode 100644 index 0000000..35dff6d --- /dev/null +++ b/commons_fileupload/build-profile.json5 @@ -0,0 +1,5 @@ +{ + "apiType": "stageMode", + "buildOption": { + } +} diff --git a/commons_fileupload/hvigorfile.js b/commons_fileupload/hvigorfile.js new file mode 100644 index 0000000..42ed4b4 --- /dev/null +++ b/commons_fileupload/hvigorfile.js @@ -0,0 +1,3 @@ +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +module.exports = require('@ohos/hvigor-ohos-plugin').harTasks + diff --git a/commons_fileupload/index.ets b/commons_fileupload/index.ets new file mode 100644 index 0000000..5af2fc4 --- /dev/null +++ b/commons_fileupload/index.ets @@ -0,0 +1,7 @@ +export { FileUpload } from "./src/main/ets/components/index"; + +export { ConstructOptions } from "./src/main/ets/components/types/type"; + +export { FormData } from "./src/main/ets/components/models/FormData"; + +export { File } from "./src/main/ets/components/models/File"; \ No newline at end of file diff --git a/commons_fileupload/package-lock.json b/commons_fileupload/package-lock.json new file mode 100644 index 0000000..efbb760 --- /dev/null +++ b/commons_fileupload/package-lock.json @@ -0,0 +1,5 @@ +{ + "name": "commons_fileupload", + "version": "1.0.0", + "lockfileVersion": 1 +} diff --git a/commons_fileupload/package.json b/commons_fileupload/package.json new file mode 100644 index 0000000..f522467 --- /dev/null +++ b/commons_fileupload/package.json @@ -0,0 +1,13 @@ +{ + "name": "commons_fileupload", + "description": "a npm package which contains arkUI2.0 page", + "ohos": { + "org": "" + }, + "version": "1.0.0", + "main": "index.ets", + "types": "", + "repository": {}, + "license": "ISC", + "dependencies": {} +} diff --git a/commons_fileupload/src/main/ets/components/index.ets b/commons_fileupload/src/main/ets/components/index.ets new file mode 100644 index 0000000..a35e526 --- /dev/null +++ b/commons_fileupload/src/main/ets/components/index.ets @@ -0,0 +1,253 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import http from "@ohos.net.http"; +import { ConstructOptions, MyHttpRequestOptions } from "./types/type"; +import { isFormData, isMyHttpRequestOptions, isString } from "./utils/utils"; +import { buildUrl, mergeConfig } from "./utils/helpers"; +import { log } from "./utils/log" +export class FileUpload { + private constructOptions: ConstructOptions; + + constructor(options: ConstructOptions) { + this.constructOptions = options; + } + + private request(url: string, config: http.HttpRequestOptions): Promise{ + if (!url) throw new Error("无效的url"); + url = buildUrl(this.constructOptions.baseUrl, url); + config = mergeConfig(this.constructOptions, config); + log(`请求配置:地址--${url} config--${JSON.stringify(config)}`) + + return new Promise((resolve, reject) => { + let httpRequest = http.createHttp(); + httpRequest.request(url, config, (err, data) => { + if (!err) { + resolve(data); + } else { + reject(err); + httpRequest.destroy(); + } + }) + }) + } + + private _generateHTTPMethod(method: http.RequestMethod): (configOrUrl: string, config: http.HttpRequestOptions) => Promise { + var that = this; + return function (configOrUrl: string, config: http.HttpRequestOptions): Promise{ + config.method = method; + return that.request(configOrUrl, config) + } + } + + post(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) + + post(configOrUrl: MyHttpRequestOptions) + + post(configOrUrl: any, extraData?: any, config?: any) { + if (isString(configOrUrl)) { + config = { + ...config, + extraData + } + } + + if (isMyHttpRequestOptions(configOrUrl)) { + config = { + ...configOrUrl + } + Reflect.deleteProperty(config, "url"); + configOrUrl = configOrUrl.url; + + } + + if (isFormData(config.extraData)) { + if (!config.header) { + config.header = {} + } + config.header["Content-Type"] = "multipart/form-data; boundary=" + config.extraData._boundary_key; + config.extraData = config.extraData.arrayBuffer && config.extraData.arrayBuffer(); + } + return this._generateHTTPMethod(http.RequestMethod.POST)(configOrUrl, config); + } + + get(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) + + get(configOrUrl: MyHttpRequestOptions) + + get(configOrUrl: any, extraData?: any, config?: any) { + if (isString(configOrUrl)) { + config = { + ...config, + extraData + } + } + + if (isMyHttpRequestOptions(configOrUrl)) { + config = { + ...configOrUrl + } + Reflect.deleteProperty(config, "url"); + configOrUrl = configOrUrl.url; + + } + + return this._generateHTTPMethod(http.RequestMethod.GET)(configOrUrl, config); + } + + head(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) + + head(configOrUrl: MyHttpRequestOptions) + + head(configOrUrl: any, extraData?: any, config?: any) { + if (isString(configOrUrl)) { + config = { + ...config, + extraData + } + } + + if (isMyHttpRequestOptions(configOrUrl)) { + config = { + ...configOrUrl + } + Reflect.deleteProperty(config, "url"); + configOrUrl = configOrUrl.url; + + } + + return this._generateHTTPMethod(http.RequestMethod.HEAD)(configOrUrl, config); + } + + options(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) + + options(configOrUrl: MyHttpRequestOptions) + + options(configOrUrl: any, extraData?: any, config?: any) { + if (isString(configOrUrl)) { + config = { + ...config, + extraData + } + } + + if (isMyHttpRequestOptions(configOrUrl)) { + config = { + ...configOrUrl + } + Reflect.deleteProperty(config, "url"); + configOrUrl = configOrUrl.url; + + } + + return this._generateHTTPMethod(http.RequestMethod.OPTIONS)(configOrUrl, config); + } + + put(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) + + put(configOrUrl: MyHttpRequestOptions) + + put(configOrUrl: any, extraData?: any, config?: any) { + if (isString(configOrUrl)) { + config = { + ...config, + extraData + } + } + + if (isMyHttpRequestOptions(configOrUrl)) { + config = { + ...configOrUrl + } + Reflect.deleteProperty(config, "url"); + configOrUrl = configOrUrl.url; + + } + + + return this._generateHTTPMethod(http.RequestMethod.PUT)(configOrUrl, config); + } + + delete(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) + + delete(configOrUrl: MyHttpRequestOptions) + + delete(configOrUrl: any, extraData?: any, config?: any) { + if (isString(configOrUrl)) { + config = { + ...config, + extraData + } + } + + if (isMyHttpRequestOptions(configOrUrl)) { + config = { + ...configOrUrl + } + Reflect.deleteProperty(config, "url"); + configOrUrl = configOrUrl.url; + + } + + return this._generateHTTPMethod(http.RequestMethod.DELETE)(configOrUrl, config); + } + + trace(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) + + trace(configOrUrl: MyHttpRequestOptions) + + trace(configOrUrl: any, extraData?: any, config?: any) { + if (isString(configOrUrl)) { + config = { + ...config, + extraData + } + } + + if (isMyHttpRequestOptions(configOrUrl)) { + config = { + ...configOrUrl + } + Reflect.deleteProperty(config, "url"); + configOrUrl = configOrUrl.url; + + } + + return this._generateHTTPMethod(http.RequestMethod.TRACE)(configOrUrl, config); + } + + connect(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) + + connect(configOrUrl: MyHttpRequestOptions) + + connect(configOrUrl: any, extraData?: any, config?: any) { + if (isString(configOrUrl)) { + config = { + ...config, + extraData + } + } + + if (isMyHttpRequestOptions(configOrUrl)) { + config = { + ...configOrUrl + } + Reflect.deleteProperty(config, "url"); + configOrUrl = configOrUrl.url; + + } + + return this._generateHTTPMethod(http.RequestMethod.CONNECT)(configOrUrl, config); + } +} \ No newline at end of file diff --git a/commons_fileupload/src/main/ets/components/models/File.ets b/commons_fileupload/src/main/ets/components/models/File.ets new file mode 100644 index 0000000..ac861e3 --- /dev/null +++ b/commons_fileupload/src/main/ets/components/models/File.ets @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +interface IFile{ + fileName:string; + fileData:string | ArrayBuffer; +} + +export class File implements IFile{ + [Symbol.toStringTag] = "File"; + fileName: string; + fileData:string | ArrayBuffer | Uint8Array +} \ No newline at end of file diff --git a/commons_fileupload/src/main/ets/components/models/FormData.ets b/commons_fileupload/src/main/ets/components/models/FormData.ets new file mode 100644 index 0000000..0cf28d1 --- /dev/null +++ b/commons_fileupload/src/main/ets/components/models/FormData.ets @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import mime from "mime-types"; +import { isFile,isString,isNumber } from "../utils/utils"; +import { File } from "./File"; + +export class FormData { + static DEFAULT_CONTENT_TYPE = "application/octet-stream"; + public _boundary_key: string | number; //随机字符串 + private _boundary: string; //分隔符 + private _end_boundary: string; //结尾分隔符 + private _result: Array = []; //最终拼接结果 + [Symbol.toStringTag] = "FormData"; + + constructor(stamp?: string) { + this._boundary_key = stamp || Date.now(); + this._boundary = "--" + this._boundary_key; + this._end_boundary = this._boundary + "--"; + } + + /** + * 添加键值对( 支持string | number | File类型的content ) + * @param key + * @param value + */ + append(key: string, value: string | number | File) { + if (isString(value)) { + this._appendValue(key,value); + } else if (isNumber(value)) { + this._appendValue(key,value + ""); + } else if (isFile(value)) { + const { fileName,fileData } = value; + if(!fileName || !fileData) throw new Error("无效的fileName或fileData"); + this._appendFile(key,value); + } else { + throw new Error("Unsupported value type"); + } + } + + /** + * 添加基本类型 + * @param key + * @param value + */ + private _appendValue(key: string, value: string) { + this.append + this._result.push(this._boundary + "\r\n"); + this._result.push(`Content-Disposition: form-data; name="${key}"\r\n\r\n`); + this._result.push(value); + this._result.push(`\r\n`); + } + + /** + * 添加文件类型 + * @param key + * @param file + */ + private _appendFile(key: string, file: File) { + const { fileName,fileData } = file; + const contentType = this._getContentType(file); + this._result.push(`${this._boundary}\r\n`); + this._result.push(`Content-Disposition: form-data; name="${key}"; filename="${fileName}"\r\n`); + this._result.push(`Content-Type: ${contentType}\r\n`); + this._result.push("\r\n"); + this._result.push(fileData); + this._result.push("\r\n"); + } + + /** + * 将_result转换成ArrayBuffer + */ + arrayBuffer(): ArrayBuffer { + this._result.push(`\r\n${this._end_boundary}`); + let charArr = []; + for(let i=0;i = { + [P in keyof T]: P extends keyof U ? T[P] | U[P] : T[P] +} + +export type MyHttpRequestOptions = UpdateItemType \ No newline at end of file diff --git a/commons_fileupload/src/main/ets/components/utils/helpers.ets b/commons_fileupload/src/main/ets/components/utils/helpers.ets new file mode 100644 index 0000000..9c7b33b --- /dev/null +++ b/commons_fileupload/src/main/ets/components/utils/helpers.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import http from "@ohos.net.http"; +import { ConstructOptions } from "../types/type" + +export function buildUrl(baseUrl:string,url:string):string{ + if(url && (url.startsWith("http://") || url.startsWith("https://"))){ + return url; + } + + if(baseUrl.endsWith("/") && url.startsWith("/")){ + return baseUrl + url.slice(1,url.length); + } + + if(!baseUrl.endsWith("/") && !url.startsWith("/")){ + return baseUrl + "/" + url; + } + + return baseUrl + url; +} + +export function mergeConfig(options:ConstructOptions,config:http.HttpRequestOptions):http.HttpRequestOptions{ + !config.connectTimeout && options.readTimeout && (config.connectTimeout = options.connectTimeout); + !config.readTimeout && options.readTimeout && (config.readTimeout = options.readTimeout); + return config; +} \ No newline at end of file diff --git a/commons_fileupload/src/main/ets/components/utils/log.ets b/commons_fileupload/src/main/ets/components/utils/log.ets new file mode 100644 index 0000000..3fcc26b --- /dev/null +++ b/commons_fileupload/src/main/ets/components/utils/log.ets @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const TAG = "COMMONS_FILEUPLOAD"; + +export function log(value:any){ + console.log(TAG + "----" + value); +} + +export function logError(value:any){ + console.error(TAG + "----" + value); +} + +export function logInfo(value:any){ + console.info(TAG + "----" + value); +} + +export function debug(func){ + if(typeof func !== "function") return; + try{ + func(); + }catch(err){ + logError(JSON.stringify(err)); + logError(err.message) + } +} diff --git a/commons_fileupload/src/main/ets/components/utils/utils.ets b/commons_fileupload/src/main/ets/components/utils/utils.ets new file mode 100644 index 0000000..4fb387d --- /dev/null +++ b/commons_fileupload/src/main/ets/components/utils/utils.ets @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { FormData } from "../models/FormData"; +import { File } from "../models/File"; +import { MyHttpRequestOptions } from "../types/type"; + +const toString = Object.prototype.toString; + +/** + * 是否是FormData类型 + * @param thing + */ +export function isFormData(thing:any):thing is FormData{ + const pattern = "[object FormData]"; + return thing && (toString.call(thing) === pattern); +} + +/** + * 是否是File类型 + * @param thing + */ +export function isFile(thing):thing is File{ + const pattern = "[object File]"; + return thing && (toString.call(thing) === pattern); +} + +/** + * 是否是Number类型 + * @param param + */ +export function isNumber(param:any):param is number{ + return typeof param === "number"; +} + +/** + * 是否是String类型 + * @param param + */ +export function isString(param:any):param is string{ + return typeof param === "string"; +} + +/** + * 是否是MyHttpRequestOptions类型 + * @param param + */ +export function isMyHttpRequestOptions(param):param is MyHttpRequestOptions{ + return (!!(param as MyHttpRequestOptions).url) +} \ No newline at end of file diff --git a/commons_fileupload/src/main/module.json5 b/commons_fileupload/src/main/module.json5 new file mode 100644 index 0000000..d00f0e8 --- /dev/null +++ b/commons_fileupload/src/main/module.json5 @@ -0,0 +1,10 @@ +{ + "module": { + "name": "commons_fileupload", + "type": "har", + "deviceTypes": [ + "default", + "tablet" + ] + } +} \ No newline at end of file diff --git a/commons_fileupload/src/main/resources/base/element/string.json b/commons_fileupload/src/main/resources/base/element/string.json new file mode 100644 index 0000000..1e76de0 --- /dev/null +++ b/commons_fileupload/src/main/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "page_show", + "value": "page from npm package" + } + ] +} diff --git a/entry/.gitignore b/entry/.gitignore new file mode 100644 index 0000000..5a6ba80 --- /dev/null +++ b/entry/.gitignore @@ -0,0 +1,4 @@ +/node_modules +/.preview +/build +/.cxx \ No newline at end of file diff --git a/entry/build-profile.json5 b/entry/build-profile.json5 new file mode 100644 index 0000000..f8f0340 --- /dev/null +++ b/entry/build-profile.json5 @@ -0,0 +1,13 @@ +{ + "apiType": 'stageMode', + "buildOption": { + }, + "targets": [ + { + "name": "default" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/entry/hvigorfile.js b/entry/hvigorfile.js new file mode 100644 index 0000000..d7720ee --- /dev/null +++ b/entry/hvigorfile.js @@ -0,0 +1,2 @@ +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +module.exports = require('@ohos/hvigor-ohos-plugin').hapTasks diff --git a/entry/package-lock.json b/entry/package-lock.json new file mode 100644 index 0000000..0eab12e --- /dev/null +++ b/entry/package-lock.json @@ -0,0 +1,31 @@ +{ + "name": "entry", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@ohos/commons_fileupload": { + "version": "file:../commons_fileupload", + "dependencies": { + "@types/mime-types": { + "version": "2.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@types/mime-types/-/mime-types-2.1.1.tgz", + "integrity": "sha512-vXOTGVSLR2jMw440moWTC7H19iUyLtP3Z1YTj7cSsubOICinjMxFeb/V57v9QdyyPGbbWolUFSSmSiRSn94tFw==" + }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://repo.huaweicloud.com/repository/npm/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "requires": { + "mime-db": "1.52.0" + } + } + } + } + } +} diff --git a/entry/package.json b/entry/package.json new file mode 100644 index 0000000..5b2807f --- /dev/null +++ b/entry/package.json @@ -0,0 +1,16 @@ +{ + "license": "ISC", + "devDependencies": {}, + "name": "entry", + "ohos": { + "org": "huawei", + "directoryLevel": "module", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": { + "@ohos/commons_fileupload": "file:../commons_fileupload" + } +} diff --git a/entry/src/main/ets/Application/MyAbilityStage.ts b/entry/src/main/ets/Application/MyAbilityStage.ts new file mode 100644 index 0000000..4bea34b --- /dev/null +++ b/entry/src/main/ets/Application/MyAbilityStage.ts @@ -0,0 +1,9 @@ +import hilog from '@ohos.hilog'; +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'AbilityStage onCreate'); + } +} \ No newline at end of file diff --git a/entry/src/main/ets/MainAbility/MainAbility.ts b/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000..45f4a1c --- /dev/null +++ b/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,52 @@ +import hilog from '@ohos.hilog'; +import Ability from '@ohos.application.Ability' +import Window from '@ohos.window' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? ''); + } + + onDestroy() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: Window.WindowStage) { + // Main window is created, set main page for this ability + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/index', (err, data) => { + if (err.code) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR); + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + globalThis.resourceManager = this.context.resourceManager; + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground() { + // Ability has brought to foreground + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground() { + // Ability has back to background + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/entry/src/main/ets/pages/UploadFile.ets b/entry/src/main/ets/pages/UploadFile.ets new file mode 100644 index 0000000..e3ef33a --- /dev/null +++ b/entry/src/main/ets/pages/UploadFile.ets @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { FormData, File, FileUpload } from "@ohos/commons_fileupload" +import { log, logError, debug } from "../utils/log" + +@Entry +@Component +struct UploadFile { + @State message: string = '文件上传' + @State loadedFileResult: string = ""; + fileInfo: Array = []; + fileUpload: FileUpload + + aboutToAppear() { + this.fileUpload = new FileUpload({ + baseUrl: "https://53004908n5.imdo.co", + readTimeout: 60000, + connectTimeout: 60000 + }) + } + + build() { + + Column() { + Column() { + Text("第一步:加载文件").fontSize(20).margin({ bottom: 20 }) + Row({ space: 10 }) { + Button("icon.png").onClick(() => this.loadFileByResource("icon.png")) + }.padding({ left: 10 }) + + Text("已加载文件信息:" + this.loadedFileResult).fontSize(20).margin({ top: 10 }).padding({ left: 10 }) + }.alignItems(HorizontalAlign.Start).width("100%") + + Column() { + Text("第二步:上传文件").fontSize(20).margin({ bottom: 20 }) + Button("点击上传").onClick(() => this.upload()) + }.alignItems(HorizontalAlign.Start).width("100%") + } + .width('100%') + .height("100%") + .padding({ top: 50, bottom: 80 }) + .justifyContent(FlexAlign.SpaceBetween) + + } + + /** + * 通过资源加载文件 + * @param fileName + */ + loadFileByResource(fileName: string): void { + globalThis.resourceManager.getRawFile(fileName, (error, value) => { + if (error != null) { + logError(error); + this.loadedFileResult = "加载文件失败..." + return; + } + const file = new File(); + file.fileName = fileName; + file.fileData = value; + this.fileInfo.push(file); + this.loadedFileResult = this.loadedFileResult += "--" + fileName + " " + }) + } + + /** + * 上传 + */ + upload() { + if (!this.fileInfo) { + logError("当前上传的文件为空,请先加载之后再上传"); + return; + } + log('检验通过') + + const formData = new FormData(); + formData.append("id", 1); + this.fileInfo.forEach(v => { + formData.append(v.fileName, v); + }) + log("formData实例化完成,准备上传") + + this.fileUpload.post("/api/upload", formData).then(res => { + log("this.fileUpload.request 成功---" + JSON.stringify(res)) + }).catch(err => { + logError("this.fileUpload.request 失败" + JSON.stringify(err)) + }) + + + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/index.ets b/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000..9086dbe --- /dev/null +++ b/entry/src/main/ets/pages/index.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Router from "@ohos.router"; +@Entry +@Component +struct Index { + private menus = [ + { + text:"文件上传", + path:"pages/UploadFile" + } + ] + + @Builder BuildText(text:string,path:string){ + Text(text).fontSize(30).onClick(() => this.handleClick(path)) + } + + build() { + Column({space:30}){ + ForEach(this.menus,(v) => { + this.BuildText(v.text,v.path); + }) + }.width("100%").padding({top:50}) + } + + handleClick(path:string){ + Router.push({url:path}) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/utils/log.ets b/entry/src/main/ets/utils/log.ets new file mode 100644 index 0000000..c1815a0 --- /dev/null +++ b/entry/src/main/ets/utils/log.ets @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const TAG = "COMMONS_FILEUPLOAD"; + +export function log(value:any){ + console.log(TAG + "----" + value); +} + +export function logError(value:any){ + console.error(TAG + "----" + value); +} + +export function logInfo(value:any){ + console.info(TAG + "----" + value); +} + +export function debug(func){ + if(typeof func !== "function") return; + try{ + func(); + }catch(err){ + logError(JSON.stringify(err)); + logError(err.message) + } +} diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 new file mode 100644 index 0000000..86e644b --- /dev/null +++ b/entry/src/main/module.json5 @@ -0,0 +1,52 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/MyAbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:white", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "requestPermissions": [ + { + "name": "ohos.permission.INTERNET" + }, + { + "name": "ohos.permission.WRITE_MEDIA" + }, + { + "name": "ohos.permission.GET_NETWORK_INFO" + }, + { + "name": "ohos.permission.READ_MEDIA" + }, + ] + } +} \ No newline at end of file diff --git a/entry/src/main/resources/base/element/color.json b/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000..1bbc9aa --- /dev/null +++ b/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000..490210a --- /dev/null +++ b/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/entry/src/main/resources/base/media/icon.png b/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4ZzgdeKtgoc+o5EvN9A1K1_<>M?MBqb#!ASf&# zEX?<)!RH(7>1P+j=jqG(58}TVN-$psA6K}atCuI!KTJD&FMmH-78ZejBm)0qc{ESp z|LuG1{QnBUJRg_E=h1#XMWt2%fcoN@l7eAS!Es?Q+;XsRNPhiiE=@AqlLkJzF`O18 zbsbSmKN=aaq8k3NFYZfDWpKmM!coBU0(XnL8R{4=i|wi{!uWYM2je{U{B*K2PVdu&=E zTq*-XsEsJ$u5H4g6DIm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MyXeeGO2(UQL;ax|x?Ncixmeo1=$ z{-);Au{*tfzOG?KQ~K|ak8-HQ?`Pekhe2WM(8s{xv-p>Zmu_6{G!-oE$7$mY`MOJorI=+mMx?H;`pr!;fVYz?5~yXBACruWB`Ph zZM}90_<^OBxIhyZ9BW$`>6JvO;%VFpqVr8|7t3~AmxYak6?`Pp#c;**_SYmi`&z23 z`p6_~ePvH)C6x-G9$hgL=eVALq`-AiamN>!3~Lxw&{H(b{B(7xSRm6<3<{%{yXiH# zos5Rv1L+8fUKJLo%P>4I&$}y { + if (err.code) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR); + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', + JSON.stringify(data) ?? ''); + }); + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); + } + + onForeground() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); + } + + onBackground() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); + } +} \ No newline at end of file diff --git a/entry/src/ohosTest/ets/TestAbility/pages/index.ets b/entry/src/ohosTest/ets/TestAbility/pages/index.ets new file mode 100644 index 0000000..954dfe0 --- /dev/null +++ b/entry/src/ohosTest/ets/TestAbility/pages/index.ets @@ -0,0 +1,35 @@ +import hilog from '@ohos.hilog'; + +@Entry +@Component +struct Index { + aboutToAppear() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/entry/src/ohosTest/ets/TestRunner/OpenHarmonyTestRunner.ts b/entry/src/ohosTest/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000..94579b9 --- /dev/null +++ b/entry/src/ohosTest/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,71 @@ +import hilog from '@ohos.hilog'; +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout', + '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); + } + + async onRun() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters['-D'] + if (debug == 'true') + { + cmd += ' -D' + } + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); + }) + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); + } +} \ No newline at end of file diff --git a/entry/src/ohosTest/ets/test/Ability.test.ets b/entry/src/ohosTest/ets/test/Ability.test.ets new file mode 100644 index 0000000..460fe8c --- /dev/null +++ b/entry/src/ohosTest/ets/test/Ability.test.ets @@ -0,0 +1,36 @@ +import hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +export default function abilityTest() { + describe('ActsAbilityTest', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(function () { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }) + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + it('assertContain',0, function () { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); + let a = 'abc' + let b = 'b' + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b) + expect(a).assertEqual(a) + }) + }) +} \ No newline at end of file diff --git a/entry/src/ohosTest/ets/test/List.test.ets b/entry/src/ohosTest/ets/test/List.test.ets new file mode 100644 index 0000000..d766fe2 --- /dev/null +++ b/entry/src/ohosTest/ets/test/List.test.ets @@ -0,0 +1,5 @@ +import abilityTest from './Ability.test' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/entry/src/ohosTest/module.json5 b/entry/src/ohosTest/module.json5 new file mode 100644 index 0000000..12ee374 --- /dev/null +++ b/entry/src/ohosTest/module.json5 @@ -0,0 +1,38 @@ +{ + "module": { + "name": "entry_test", + "type": "feature", + "srcEntrance": "./ets/Application/TestAbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "TestAbility", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:test_pages", + "abilities": [ + { + "name": "TestAbility", + "srcEntrance": "./ets/TestAbility/TestAbility.ets", + "description": "$string:TestAbility_desc", + "icon": "$media:icon", + "label": "$string:TestAbility_label", + "visible": true, + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:white", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ] + } +} diff --git a/entry/src/ohosTest/resources/base/element/color.json b/entry/src/ohosTest/resources/base/element/color.json new file mode 100644 index 0000000..1bbc9aa --- /dev/null +++ b/entry/src/ohosTest/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/entry/src/ohosTest/resources/base/element/string.json b/entry/src/ohosTest/resources/base/element/string.json new file mode 100644 index 0000000..36d4230 --- /dev/null +++ b/entry/src/ohosTest/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "test ability description" + }, + { + "name": "TestAbility_desc", + "value": "the test ability" + }, + { + "name": "TestAbility_label", + "value": "test label" + } + ] +} \ No newline at end of file diff --git a/entry/src/ohosTest/resources/base/media/icon.png b/entry/src/ohosTest/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4ZzgdeKtgoc+o5EvN9A1K1_<>M?MBqb#!ASf&# zEX?<)!RH(7>1P+j=jqG(58}TVN-$psA6K}atCuI!KTJD&FMmH-78ZejBm)0qc{ESp z|LuG1{QnBUJRg_E=h1#XMWt2%fcoN@l7eAS!Es?Q+;XsRNPhiiE=@AqlLkJzF`O18 zbsbSmKN=aaq8k3NFYZfDWpKmM!coBU0(XnL8R{4=i|wi{!uWYM2je{U{B*K2PVdu&=E zTq*-XsEsJ$u5H4g6DIm2Y!DN`>^v|AqlwuCD;w45K0@eqauiqWf7l&o)+YLHm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g?jZ8m-m0}&6+DA!qam(p$mN5R})yA_7m$q@| zFEd|dpS595rxQr-n#GjI5i-AhnUE>Cr;jpCqSrD~EwK_DqI^7%3#p5)%T_od!t3SOmH9MyXeeGO2(UQL;ax|x?Ncixmeo1=$ z{-);Au{*tfzOG?KQ~K|ak8-HQ?`Pekhe2WM(8s{xv-p>Zmu_6{G!-oE$7$mY`MOJorI=+mMx?H;`pr!;fVYz?5~yXBACruWB`Ph zZM}90_<^OBxIhyZ9BW$`>6JvO;%VFpqVr8|7t3~AmxYak6?`Pp#c;**_SYmi`&z23 z`p6_~ePvH)C6x-G9$hgL=eVALq`-AiamN>!3~Lxw&{H(b{B(7xSRm6<3<{%{yXiH# zos5Rv1L+8fUKJLo%P>4I&$}y= 2.1.2 < 3.0.0" + } + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://repo.huaweicloud.com/repository/npm/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "ini": { + "version": "1.3.8", + "resolved": "https://repo.huaweicloud.com/repository/npm/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" + }, + "interpret": { + "version": "1.4.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==" + }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha512-xgs2NH9AE66ucSq4cNG1nhSFghr5l6tdL15Pk+jl46bmmBapgoaY/AacXyaDznAqmGL99TiLSQgO/XazFSKYeQ==" + }, + "is-absolute": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-absolute/-/is-absolute-1.0.0.tgz", + "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", + "requires": { + "is-relative": "^1.0.0", + "is-windows": "^1.0.1" + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==" + }, + "is-core-module": { + "version": "2.10.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-core-module/-/is-core-module-2.10.0.tgz", + "integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==", + "requires": { + "has": "^1.0.3" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==" + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==", + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, + "is-plain-object": { + "version": "5.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-plain-object/-/is-plain-object-5.0.0.tgz", + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==" + }, + "is-relative": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-relative/-/is-relative-1.0.0.tgz", + "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", + "requires": { + "is-unc-path": "^1.0.0" + } + }, + "is-stream": { + "version": "2.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==" + }, + "is-unc-path": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-unc-path/-/is-unc-path-1.0.0.tgz", + "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", + "requires": { + "unc-path-regex": "^0.1.2" + } + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha512-rMYPYvCzsXywIsldgLaSoPlw5PfoB/ssr7hY4pLfcodrA5M/eArza1a9VmTiNIBNMjOGr1Ow9mTyU2o69U6U9Q==" + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==" + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + }, + "json5": { + "version": "2.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/json5/-/json5-2.2.0.tgz", + "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", + "requires": { + "minimist": "^1.2.5" + } + }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + }, + "lcid": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha512-YiGkH6EnGrDGqLMITnGjXtGmNtjoXw9SVUzcaos8RBi7Ps0VBylkq+vOcY9QE5poLasPCR849ucFUkl0UzUyOw==", + "requires": { + "invert-kv": "^1.0.0" + } + }, + "liftoff": { + "version": "4.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/liftoff/-/liftoff-4.0.0.tgz", + "integrity": "sha512-rMGwYF8q7g2XhG2ulBmmJgWv25qBsqRbDn5gH0+wnuyeFt7QBJlHJmtg5qEdn4pN6WVAUMgXnIxytMFRX9c1aA==", + "requires": { + "extend": "^3.0.2", + "findup-sync": "^5.0.0", + "fined": "^2.0.0", + "flagged-respawn": "^2.0.0", + "is-plain-object": "^5.0.0", + "object.map": "^1.0.1", + "rechoir": "^0.8.0", + "resolve": "^1.20.0" + } + }, + "load-json-file": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha512-cy7ZdNRXdablkXYNI049pthVeXFurRyb9+hA/dZzerZ0pGTx42z+y+ssxBaVV2l70t1muq5IdKhn4UtcoGUY9A==", + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + } + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://repo.huaweicloud.com/repository/npm/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "log4js": { + "version": "6.4.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/log4js/-/log4js-6.4.1.tgz", + "integrity": "sha512-iUiYnXqAmNKiIZ1XSAitQ4TmNs8CdZYTAWINARF3LjnsLN8tY5m0vRwd6uuWj/yNY0YHxeZodnbmxKFUOM2rMg==", + "requires": { + "date-format": "^4.0.3", + "debug": "^4.3.3", + "flatted": "^3.2.4", + "rfdc": "^1.3.0", + "streamroller": "^3.0.2" + } + }, + "make-iterator": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/make-iterator/-/make-iterator-1.0.1.tgz", + "integrity": "sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw==", + "requires": { + "kind-of": "^6.0.2" + } + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha512-8y/eV9QQZCiyn1SprXSrCmqJN0yNRATe+PO8ztwqrvrbdRLA3eYJF0yaR0YayLWkMbsQSKWS9N2gPcGEc4UsZg==" + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" + }, + "micromatch": { + "version": "4.0.5", + "resolved": "https://repo.huaweicloud.com/repository/npm/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "requires": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.6", + "resolved": "https://repo.huaweicloud.com/repository/npm/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" + }, + "ms": { + "version": "2.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "mute-stdout": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/mute-stdout/-/mute-stdout-1.0.0.tgz", + "integrity": "sha512-MaSQenn0f9oxIjtCufclpV00MuYTiHaXPbdcfPIM+quMqoa8cXywjHHx4LhhIAZlXqPWMdcUpYviajfmHtHRJw==" + }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "requires": { + "path-key": "^3.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==" + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" + }, + "object.assign": { + "version": "4.1.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/object.assign/-/object.assign-4.1.4.tgz", + "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + } + }, + "object.defaults": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/object.defaults/-/object.defaults-1.1.0.tgz", + "integrity": "sha512-c/K0mw/F11k4dEUBMW8naXUuBuhxRCfG7W+yFy8EcijU/rSmazOUd1XAEEe6bC0OuXY4HUKjTJv7xbxIMqdxrA==", + "requires": { + "array-each": "^1.0.1", + "array-slice": "^1.0.0", + "for-own": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "object.map": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/object.map/-/object.map-1.0.1.tgz", + "integrity": "sha512-3+mAJu2PLfnSVGHwIWubpOFLscJANBKuB/6A4CxBstc4aqwQY0FWcsppuy4jU5GSB95yES5JHSI+33AWuS4k6w==", + "requires": { + "for-own": "^1.0.0", + "make-iterator": "^1.0.0" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha512-tqa/UMy/CCoYmj+H5qc07qvSL9dqcs/WZENZ1JbtWBlATP+iVOe778gE6MSijnyCnORzDuX6hU+LA4SZ09YjFQ==", + "requires": { + "isobject": "^3.0.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "os-locale": { + "version": "1.4.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/os-locale/-/os-locale-1.4.0.tgz", + "integrity": "sha512-PRT7ZORmwu2MEFt4/fv3Q+mEfN4zetKxufQrkShY2oGvUms9r8otu5HfdyIFHkYXjO7laNsoVGmM2MANfuTA8g==", + "requires": { + "lcid": "^1.0.0" + } + }, + "parse-filepath": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/parse-filepath/-/parse-filepath-1.0.2.tgz", + "integrity": "sha512-FwdRXKCohSVeXqwtYonZTXtbGJKrn+HNyWDYVcp5yuJlesTwNH4rsmRZ+GrKAPJ5bLpRxESMeS+Rl0VCHRvB2Q==", + "requires": { + "is-absolute": "^1.0.0", + "map-cache": "^0.2.0", + "path-root": "^0.1.1" + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha512-QR/GGaKCkhwk1ePQNYDRKYZ3mwU9ypsKhB0XyFnLQdomyEqk3e8wpW3V5Jp88zbxK4n5ST1nqo+g9juTpownhQ==", + "requires": { + "error-ex": "^1.2.0" + } + }, + "parse-passwd": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/parse-passwd/-/parse-passwd-1.0.0.tgz", + "integrity": "sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q==" + }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha512-yTltuKuhtNeFJKa1PiRzfLAU5182q1y4Eb4XCJ3PBqyzEDkAZRzBrKKBct682ls9reBVHf9udYLN5Nd+K1B9BQ==", + "requires": { + "pinkie-promise": "^2.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://repo.huaweicloud.com/repository/npm/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + }, + "path-root": { + "version": "0.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/path-root/-/path-root-0.1.1.tgz", + "integrity": "sha512-QLcPegTHF11axjfojBIoDygmS2E3Lf+8+jI6wOVmNVenrKSo3mFdSGiIgdSHenczw3wPtlVMQaFVwGmM7BJdtg==", + "requires": { + "path-root-regex": "^0.1.0" + } + }, + "path-root-regex": { + "version": "0.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/path-root-regex/-/path-root-regex-0.1.2.tgz", + "integrity": "sha512-4GlJ6rZDhQZFE0DPVKh0e9jmZ5egZfxTkp7bcRDuPlJXbAwhxcl2dINPUAsjLdejqaLsCeg8axcLjIbvBjN4pQ==" + }, + "path-type": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha512-S4eENJz1pkiQn9Znv33Q+deTOKmbl+jj1Fl+qiP/vYezj+S8x+J3Uo0ISrx/QoEvIlOaDWJhPaRd1flJ9HXZqg==", + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" + }, + "pify": { + "version": "2.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==" + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==" + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==", + "requires": { + "pinkie": "^2.0.0" + } + }, + "pretty-hrtime": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/pretty-hrtime/-/pretty-hrtime-1.0.0.tgz", + "integrity": "sha512-CU2l5CYUAptUYq/671ajexQfXuxJFwwg0n243Kdkx8bTjeenedsWgu8TGHPm03vLfNtk3aTXgySKPp3Usykudw==" + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha512-7BGwRHqt4s/uVbuyoeejRn4YmFnYZiFl4AuaeXHlgZf3sONF0SOGlxs2Pw8g6hCKupo08RafIO5YXFNOKTfwsQ==", + "requires": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + } + }, + "read-pkg-up": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha512-WD9MTlNtI55IwYUS27iHh9tK3YoIVhxis8yKhLpTqWtml739uXc9NWTpxoHkfZf3+DkCCsXox94/VWZniuZm6A==", + "requires": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + } + }, + "rechoir": { + "version": "0.8.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/rechoir/-/rechoir-0.8.0.tgz", + "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", + "requires": { + "resolve": "^1.20.0" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==" + }, + "require-from-string": { + "version": "2.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==" + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha512-IqSUtOVP4ksd1C/ej5zeEh/BIP2ajqpn8c5x+q99gvcIG/Qf0cud5raVnE/Dwd0ua9TXYDoDc0RE5hBSdz22Ug==" + }, + "resolve": { + "version": "1.22.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "requires": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "resolve-dir": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/resolve-dir/-/resolve-dir-1.0.1.tgz", + "integrity": "sha512-R7uiTjECzvOsWSfdM0QKFNBVFcK27aHOUwdvK53BcW8zqnGdYp0Fbj82cy54+2A4P2tFM22J5kRfe1R+lM/1yg==", + "requires": { + "expand-tilde": "^2.0.0", + "global-modules": "^1.0.0" + } + }, + "resolve-package-path": { + "version": "4.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/resolve-package-path/-/resolve-package-path-4.0.3.tgz", + "integrity": "sha512-SRpNAPW4kewOaNUt8VPqhJ0UMxawMwzJD8V7m1cJfdSTK9ieZwS6K7Dabsm4bmLFM96Z5Y/UznrpG5kt1im8yA==", + "requires": { + "path-root": "^0.1.1" + } + }, + "rfdc": { + "version": "1.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/rfdc/-/rfdc-1.3.0.tgz", + "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "semver": { + "version": "5.7.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==" + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://repo.huaweicloud.com/repository/npm/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + }, + "spdx-correct": { + "version": "3.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==" + }, + "spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.12", + "resolved": "https://repo.huaweicloud.com/repository/npm/spdx-license-ids/-/spdx-license-ids-3.0.12.tgz", + "integrity": "sha512-rr+VVSXtRhO4OHbXUiAF7xW3Bo9DuuF6C5jH+q/x15j2jniycgKbxU09Hr0WqlSLUs4i4ltHGXqTe7VHclYWyA==" + }, + "streamroller": { + "version": "3.1.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/streamroller/-/streamroller-3.1.3.tgz", + "integrity": "sha512-CphIJyFx2SALGHeINanjFRKQ4l7x2c+rXYJ4BMq0gd+ZK0gi4VT8b+eHe2wi58x4UayBAKx4xtHpXT/ea1cz8w==", + "requires": { + "date-format": "^4.0.14", + "debug": "^4.3.4", + "fs-extra": "^8.1.0" + }, + "dependencies": { + "fs-extra": { + "version": "8.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" + } + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==", + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha512-kwrX1y7czp1E69n2ajbG65mIo9dqvJ+8aBQXOGVxqwvNbsXdFM6Lq37dLAY3mknUwru8CfcCbfOLL/gMo+fi3g==", + "requires": { + "is-utf8": "^0.2.0" + } + }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==" + }, + "strnum": { + "version": "1.0.5", + "resolved": "https://repo.huaweicloud.com/repository/npm/strnum/-/strnum-1.0.5.tgz", + "integrity": "sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==" + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==" + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "requires": { + "is-number": "^7.0.0" + } + }, + "unc-path-regex": { + "version": "0.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/unc-path-regex/-/unc-path-regex-0.1.2.tgz", + "integrity": "sha512-eXL4nmJT7oCpkZsHZUOJo8hcX3GbsiDOa0Qu9F646fi8dT3XuSVopVqAcEiVzSKKH7UoDti23wNX3qGFxcW5Qg==" + }, + "universalify": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" + }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "requires": { + "punycode": "^2.1.0" + } + }, + "v8flags": { + "version": "3.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/v8flags/-/v8flags-3.2.0.tgz", + "integrity": "sha512-mH8etigqMfiGWdeXpaaqGfs6BndypxusHHcv2qSHyZkGEznCd/qAXCWWRzeowtL54147cktFOC4P5y+kl8d8Jg==", + "requires": { + "homedir-polyfill": "^1.0.1" + } + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/which-module/-/which-module-1.0.0.tgz", + "integrity": "sha512-F6+WgncZi/mJDrammbTuHe1q0R5hOXv/mBaiNA2TCNT/LTHusX0V+CJnj9XT8ki5ln2UZyyddDgHfCzyrOH7MQ==" + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha512-vAaEaDM946gbNpH5pLVNR+vX2ht6n0Bt3GXwVB1AuAqZosOvHNF3P7wDnh8KLkSqgUh0uh77le7Owgoz+Z9XBw==", + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "y18n": { + "version": "3.2.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/y18n/-/y18n-3.2.2.tgz", + "integrity": "sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ==" + }, + "yargs": { + "version": "7.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/yargs/-/yargs-7.1.2.tgz", + "integrity": "sha512-ZEjj/dQYQy0Zx0lgLMLR8QuaqTihnxirir7EwUHp1Axq4e3+k8jXU5K0VLbNvedv1f4EWtBonDIZm0NUr+jCcA==", + "requires": { + "camelcase": "^3.0.0", + "cliui": "^3.2.0", + "decamelize": "^1.1.1", + "get-caller-file": "^1.0.1", + "os-locale": "^1.4.0", + "read-pkg-up": "^1.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^1.0.2", + "which-module": "^1.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^5.0.1" + } + }, + "yargs-parser": { + "version": "5.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/yargs-parser/-/yargs-parser-5.0.1.tgz", + "integrity": "sha512-wpav5XYiddjXxirPoCTUPbqM0PXvJ9hiBMvuJgInvo4/lAOTZzUprArw17q2O1P2+GHhbBr18/iQwjL5Z9BqfA==", + "requires": { + "camelcase": "^3.0.0", + "object.assign": "^4.1.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..7929e73 --- /dev/null +++ b/package.json @@ -0,0 +1,18 @@ +{ + "license": "ISC", + "devDependencies": {}, + "name": "myapplication", + "ohos": { + "org": "huawei", + "directoryLevel": "project", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": { + "@ohos/hypium": "1.0.2", + "@ohos/hvigor-ohos-plugin": "1.2.2", + "@ohos/hvigor": "1.2.2" + } +} -- Gitee From 2deeb6b3dc633f7316cfb971264a9d45fabeff7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=BF=97=E5=BC=BA?= Date: Mon, 10 Oct 2022 00:50:34 -0700 Subject: [PATCH 2/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9README.md=E3=80=81?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=95=8F=E6=84=9F=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨志强 --- CHANGELOG.md | 9 +- README.OpenSource | 11 ++ README.en.md | 36 ---- README.md | 176 +++++++++--------- build-profile.json5 | 57 +++--- .../src/main/ets/components/index.ets | 16 +- .../src/main/ets/components/types/type.ets | 2 +- 7 files changed, 128 insertions(+), 179 deletions(-) delete mode 100644 README.en.md diff --git a/CHANGELOG.md b/CHANGELOG.md index d42381b..b2e58f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,7 @@ -## 1.0.0 -1.支持下拉刷新 +# (2022-10-10) -2.支持上拉加载更多 +## 0.1.0 -3.支持设置内置动画的各种属性 +1. 基本请求(get、post、delete...) -4.支持自定义动画 \ No newline at end of file +2. 文件上传(分片上传、断点续传) diff --git a/README.OpenSource b/README.OpenSource index e69de29..0706567 100644 --- a/README.OpenSource +++ b/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "axios", + "License": "MIT License", + "License File": "https://github.com/axios/axios/blob/v1.x/LICENSE", + "Version Number": "1.1.2", + "Owner" : "Matt Zabriskie", + "Upstream URL": "https://github.com/axios/axios", + "Description": "Promise based HTTP client for the browser and node.js" + }, +] \ No newline at end of file diff --git a/README.en.md b/README.en.md deleted file mode 100644 index 036d49a..0000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# commons-fileupload - -#### Description -{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**} - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md index 2c7ec4c..5604cbd 100644 --- a/README.md +++ b/README.md @@ -1,110 +1,100 @@ -# PullToRefresh +# commons-fileupload ## 简介 -> PullToRefresh是一个简单的下拉刷新、上拉加载三方库。 -> 支持设置内置动画的各种属性,支持设置自定义动画。 - -#### 效果展示: - -内置动画效果 - -![Refresh](gifs/Refresh.gif)![Refresh](gifs/LoadMore.gif) +commons-fileupload 是一个请求库。可以用来做文件上传(支持分片)、基本请求、文件下载。目前支持的功能,如下: +| 功能 | 描述 | 备注 | +| :--------------: | :----------------------------: | :--: | +| 基础请求 | 支持 get、post、head... | +| 文件上传 | 支持分片上传、断点续传、多文件上传 | +| 文件下载 | 未支持(后续支持) | 目前 oh 未支持 expectDataType,文件下载功能暂不支持。如果需要下载功能,建议使用 oh 原生的 request 模块 ## 下载安装 -```shell -npm install @ohos/pulltorefresh --save +```js +npm install @ohos/commons-fileupload --save ``` OpenHarmony -npm环境配置等更多内容,请参考 [如何安装OpenHarmony npm包](https://gitee.com/openharmony-tpc/docs/blob/master/OpenHarmony_npm_usage.md) 。 +npm 环境配置等更多内容,请参考 [如何安装 OpenHarmony npm 包](https://gitee.com/openharmony-tpc/docs/blob/master/OpenHarmony_npm_usage.md) 。 ## 使用说明 -### 快速使用 - -```typescript -import { PullToRefresh } from '@ohos/pulltorefresh' - -// 需绑定列表或宫格组件 -private scroller: Scroller = new Scroller(); - -PullToRefresh({ -// 必传项,需绑定传入主体布局内的列表或宫格组件 -scroller: this.scroller, -// 必传项,自定义主体布局,内部有列表或宫格组件 -customList: () => { - // 一个用@Builder修饰过的UI方法 - this.getListView(); -}, -// 可选项,下拉刷新回调 -onRefresh: () => { - return new Promise((resolve, reject) => { - // 模拟网络请求操作,请求网络2秒后得到数据,通知组件,变更列表数据 - setTimeout(() => { - resolve('刷新成功'); - this.data = this.dataNumbers; - }, 2000); - }); -}, -// 可选项,上拉加载更多回调 -onLoadMore: () => { - return new Promise((resolve, reject) => { - // 模拟网络请求操作,请求网络2秒后得到数据,通知组件,变更列表数据 - setTimeout(() => { - resolve(''); - this.data.push("增加的条目" + this.data.length); - }, 2000); - }); -}, -}) +### 文件上传 + +1.配置网络权限(在 entry\src\main\module.json5 文件中) + ``` +{ + "module":{ + ..., + "requestPermissions": [ + { + "name": "ohos.permission.INTERNET" + }, + ] + } +} +``` + +2.在页面中的使用 -设置属性示例和设置自定义动画示例请看[示例entry](https://gitee.com/openharmony-sig/PullToRefresh/tree/master/entry/src/main/ets/pages) +``` +import { FormData, File, FileUpload } from "@ohos/commons_fileupload" + + +aboutToAppear() { + this.fileUpload = new FileUpload({ + baseUrl: "https://53004908n5.imdo.co", + readTimeout: 60000, + connectTimeout: 60000 + }) +} + + +const formData = new FormData(); +formData.append("key", 1);//可以添加基本类型的值,目前支持string、number +formData.append("myFile", File); //也可以添加File类型的对象 + + +this.fileUpload.post("/api/upload", formData).then(res => { + console.log("success"); +}).catch(err => { + console.error("fail"); +}) +``` ## 属性(接口)说明 -### PullToRefresh组件属性 - -| 属性 | 类型 | 释义 | 默认值 | -| :------------------:| :-------------------------------------------------------------: | :---------------------------: | :----------------------------: | -| scroller | Scroller | 列表或宫格组件所绑定的Scroller对象 | undefined | -| customList | ```() => void ``` | 自定义主体布局,内部有列表或宫格组件 | undefined | -| refreshConfigurator | PullToRefreshConfigurator | 组件属性配置 | PullToRefreshConfigurator | -| mWidth | Length | 容器宽 | undefined(自适应) | -| mHeight | Length | 容器高 | undefined(自适应) | -| onRefresh | ```() => Promise``` | 下拉刷新回调 | 1秒后结束下拉刷新动画并提示“刷新失败” | -| onLoadMore | ```() => Promise``` | 上拉加载更多回调 | 1秒后结束上拉加载动画 | -| customRefresh | ```() => void ``` | 自定义下拉刷新动画布局 | undefined | -| onAnimPullDown | ```(value?: number, width?: number, height?: number) => void``` | 下拉中回调 | undefined | -| onAnimRefreshing | ```(value?: number, width?: number, height?: number) => void``` | 刷新中回调 | undefined | -| customLoad | ```() => void``` | 自定义上拉加载动画布局 | undefined | -| onAnimPullUp | ```(value?: number, width?: number, height?: number) => void``` | 上拉中回调 | undefined | -| onAnimLoading | ```(value?: number, width?: number, height?: number) => void``` | 加载中回调 | undefined | - -### PullToRefreshConfigurator类接口 - -| 接口 | 参数类型 | 释义 | 默认值 | -| :------------------------:| :-------------------------: | :-----------------------: | :--------------: | -| setHasRefresh | boolean | 是否具有下拉刷新功能 | true | -| setHasLoadMore | boolean | 是否具有上拉加载功能 | true | -| setMaxTranslate | number | 可下拉上拉的最大距离 | 100 | -| setSensitivity | number | 下拉上拉灵敏度 | 0.7 | -| setListIsPlacement | boolean | 滑动结束后列表是否归位 | true | -| setAnimDuration | number | 滑动结束后,回弹动画执行时间 | 150 | -| setRefreshHeight | number | 下拉动画高度 | 30 | -| setRefreshColor | string | 下拉动画颜色 | '#999999' | -| setRefreshBackgroundColor | ResourceColor | 下拉动画区域背景色 | 'rgba(0,0,0,0)' | -| setRefreshTextColor | ResourceColor | 下拉加载完毕后提示文本的字体颜色 | '#999999' | -| setRefreshTextSize | number 或 string 或 Resource | 下拉加载完毕后提示文本的字体大小 | 18 | -| setLoadImgHeight | number | 上拉动画中图片的高度 | 30 | -| setLoadBackgroundColor | ResourceColor | 上拉动画区域背景色 | 'rgba(0,0,0,0)' | -| setLoadTextColor | ResourceColor | 上拉文本的字体颜色 | '#999999' | -| setLoadTextSize | number 或 string 或 Resource | 上拉文本的字体大小 | 18 | -| setLoadTextPullUp1 | string | 上拉1阶段文本 | '正在上拉刷新...' | -| setLoadTextPullUp2 | string | 上拉2阶段文本 | '放开刷新' | -| setLoadTextLoading | string | 上拉加载更多中时的文本 | '正在玩命加载中...' | +### FileUpload 构造函数参数 + +| 接口 | 参数类型 | 释义 | 是否必填 | 默认值 | +| :------------: | :------: | :----------: | :------: | ------- | +| baseUrl | string | 请求基地址 | 否 | 空 | +| connectTimeout | number | 连接超时时间 | 否 | 60000ms | +| readTimeout | number | 读取超时时间 | 否 | 60000ms | + +### FileUpload 实例方法 + +| 方法 | 类型 | 释义 | +| :-----: | :-----------------------------------------------------------------: | :--------------: | +| post | ( configOrUrl : MyHttpRequestOptions ) : Promise | post 请求方法 | +| get | ( configOrUrl : MyHttpRequestOptions ) : Promise | get 请求方法 | +| head | ( configOrUrl : MyHttpRequestOptions ) : Promise | head 请求方法 | +| options | ( configOrUrl : MyHttpRequestOptions ) : Promise | options 请求方法 | +| put | ( configOrUrl : MyHttpRequestOptions ) : Promise | put 请求方法 | +| delete | ( configOrUrl : MyHttpRequestOptions ) : Promise | delete 请求方法 | +| trace | ( configOrUrl : MyHttpRequestOptions ) : Promise | trace 请求方法 | + +### MyHttpRequestOptions + +| 接口 | 参数类型 | 释义 | 是否必填 | 默认值 | +| :------------: | :-----------------------------------------: | :----------: | :------: | ------- | +| url | string | 接口名字 | 是 | | +| extraData | string \| Object \| ArrayBuffer \| FormData | 请求参数 | 否 | 空 | +| header | Object | 请求头 | 否 | 空 | +| connectTimeout | number | 连接超时时间 | 否 | 60000ms | +| readTimeout | number | 读取超时时间 | 否 | 60000ms | ## 兼容性 @@ -112,9 +102,9 @@ onLoadMore: () => { ## 贡献代码 -使用过程中发现任何问题都可以提 [Issue](https://gitee.com/openharmony-sig/PullToRefresh/issues) -给我们,当然,我们也非常欢迎你给我们发 [PR](https://gitee.com/openharmony-sig/PullToRefresh/pulls) 。 +使用过程中发现任何问题都可以提 [Issue](https://gitee.com/openharmony-sig/commons-fileupload/issues) +给我们,当然,我们也非常欢迎你给我们发 [PR](https://gitee.com/openharmony-sig/commons-fileupload/pulls) 。 ## 开源协议 -本项目基于 [Apache License 2.0](https://gitee.com/openharmony-sig/PullToRefresh/blob/master/LICENSE) ,请自由地享受和参与开源。 \ No newline at end of file +本项目基于 [Apache License 2.0](https://gitee.com/openharmony-sig/PullToRefresh/blob/master/LICENSE) ,请自由地享受和参与开源。 diff --git a/build-profile.json5 b/build-profile.json5 index 2cab90a..d89c345 100644 --- a/build-profile.json5 +++ b/build-profile.json5 @@ -1,44 +1,29 @@ { - "app": { - "signingConfigs": [ + app: { + signingConfigs: [], + compileSdkVersion: 9, + compatibleSdkVersion: 9, + products: [ { - "name": "default", - "material": { - "certpath": "C:\\Users\\Administrator\\.ohos\\config\\openharmony\\auto_ohos_default_com.example.myapplication.cer", - "storePassword": "0000001ACC94C1246EB94D52D0EC68E3222C1143D0FFC07DF34F940A734EB2B69281841E03562328F9DD", - "keyAlias": "debugKey", - "keyPassword": "0000001AEAE19011179D4986A3118A84C68DD4492785351FF75B4C7A36559703BF3B0FA11C47C1B2CC1D", - "profile": "C:\\Users\\Administrator\\.ohos\\config\\openharmony\\auto_ohos_default_com.example.myapplication.p7b", - "signAlg": "SHA256withECDSA", - "storeFile": "C:\\Users\\Administrator\\.ohos\\config\\openharmony\\auto_ohos_default_com.example.myapplication.p12" - } - } + name: "default", + signingConfig: "default", + }, ], - "compileSdkVersion": 9, - "compatibleSdkVersion": 9, - "products": [ - { - "name": "default", - "signingConfig": "default", - } - ] }, - "modules": [ + modules: [ { - "name": "entry", - "srcPath": "./entry", - "targets": [ + name: "entry", + srcPath: "./entry", + targets: [ { - "name": "default", - "applyToProducts": [ - "default" - ] - } - ] + name: "default", + applyToProducts: ["default"], + }, + ], }, { - "name": "commons_fileupload", - "srcPath": "./commons_fileupload" - } - ] -} \ No newline at end of file + name: "commons_fileupload", + srcPath: "./commons_fileupload", + }, + ], +} diff --git a/commons_fileupload/src/main/ets/components/index.ets b/commons_fileupload/src/main/ets/components/index.ets index a35e526..5083b2f 100644 --- a/commons_fileupload/src/main/ets/components/index.ets +++ b/commons_fileupload/src/main/ets/components/index.ets @@ -53,7 +53,7 @@ export class FileUpload { post(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - post(configOrUrl: MyHttpRequestOptions) + post(configOrUrl: Omit) post(configOrUrl: any, extraData?: any, config?: any) { if (isString(configOrUrl)) { @@ -84,7 +84,7 @@ export class FileUpload { get(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - get(configOrUrl: MyHttpRequestOptions) + get(configOrUrl: Omit) get(configOrUrl: any, extraData?: any, config?: any) { if (isString(configOrUrl)) { @@ -108,7 +108,7 @@ export class FileUpload { head(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - head(configOrUrl: MyHttpRequestOptions) + head(configOrUrl: Omit) head(configOrUrl: any, extraData?: any, config?: any) { if (isString(configOrUrl)) { @@ -132,7 +132,7 @@ export class FileUpload { options(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - options(configOrUrl: MyHttpRequestOptions) + options(configOrUrl: Omit) options(configOrUrl: any, extraData?: any, config?: any) { if (isString(configOrUrl)) { @@ -156,7 +156,7 @@ export class FileUpload { put(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - put(configOrUrl: MyHttpRequestOptions) + put(configOrUrl: Omit) put(configOrUrl: any, extraData?: any, config?: any) { if (isString(configOrUrl)) { @@ -181,7 +181,7 @@ export class FileUpload { delete(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - delete(configOrUrl: MyHttpRequestOptions) + delete(configOrUrl: Omit) delete(configOrUrl: any, extraData?: any, config?: any) { if (isString(configOrUrl)) { @@ -205,7 +205,7 @@ export class FileUpload { trace(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - trace(configOrUrl: MyHttpRequestOptions) + trace(configOrUrl: Omit) trace(configOrUrl: any, extraData?: any, config?: any) { if (isString(configOrUrl)) { @@ -229,7 +229,7 @@ export class FileUpload { connect(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - connect(configOrUrl: MyHttpRequestOptions) + connect(configOrUrl: Omit) connect(configOrUrl: any, extraData?: any, config?: any) { if (isString(configOrUrl)) { diff --git a/commons_fileupload/src/main/ets/components/types/type.ets b/commons_fileupload/src/main/ets/components/types/type.ets index e52b76b..de14678 100644 --- a/commons_fileupload/src/main/ets/components/types/type.ets +++ b/commons_fileupload/src/main/ets/components/types/type.ets @@ -16,7 +16,7 @@ import http from "@ohos.net.http"; import { FormData } from "../models/FormData"; export interface ConstructOptions { - baseUrl: string; + baseUrl?: string; readTimeout?: number; connectTimeout?: number; } -- Gitee From c1e1032ee5b81b7fb42bf08064bd24c212243dea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=BF=97=E5=BC=BA?= Date: Mon, 10 Oct 2022 19:08:15 -0700 Subject: [PATCH 3/8] =?UTF-8?q?=E8=A7=84=E8=8C=83=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨志强 --- README.md | 2 +- .../.gitignore | 0 .../build-profile.json5 | 0 .../hvigorfile.js | 0 .../index.ets | 2 +- commons-fileupload/package-lock.json | 26 ++++++++ commons-fileupload/package.json | 31 ++++++++++ .../src/main/ets/components/index.ets | 15 +++-- .../src/main/ets/components/models/File.ets | 0 .../main/ets/components/models/FormData.ets | 59 +++++++++---------- .../src/main/ets/components/types/type.ets | 5 -- .../src/main/ets/components/utils/helpers.ets | 30 +++++----- .../src/main/ets/components/utils/log.ets | 30 ++++++---- .../src/main/ets/components/utils/utils.ets | 0 .../src/main/module.json5 | 0 .../main/resources/base/element/string.json | 0 commons_fileupload/package-lock.json | 5 -- commons_fileupload/package.json | 13 ---- entry/package-lock.json | 7 ++- entry/package.json | 2 +- entry/src/main/ets/pages/UploadFile.ets | 2 +- 21 files changed, 138 insertions(+), 91 deletions(-) rename {commons_fileupload => commons-fileupload}/.gitignore (100%) rename {commons_fileupload => commons-fileupload}/build-profile.json5 (100%) rename {commons_fileupload => commons-fileupload}/hvigorfile.js (100%) rename {commons_fileupload => commons-fileupload}/index.ets (72%) create mode 100644 commons-fileupload/package-lock.json create mode 100644 commons-fileupload/package.json rename {commons_fileupload => commons-fileupload}/src/main/ets/components/index.ets (95%) rename {commons_fileupload => commons-fileupload}/src/main/ets/components/models/File.ets (100%) rename {commons_fileupload => commons-fileupload}/src/main/ets/components/models/FormData.ets (65%) rename {commons_fileupload => commons-fileupload}/src/main/ets/components/types/type.ets (88%) rename {commons_fileupload => commons-fileupload}/src/main/ets/components/utils/helpers.ets (49%) rename {commons_fileupload => commons-fileupload}/src/main/ets/components/utils/log.ets (70%) rename {commons_fileupload => commons-fileupload}/src/main/ets/components/utils/utils.ets (100%) rename {commons_fileupload => commons-fileupload}/src/main/module.json5 (100%) rename {commons_fileupload => commons-fileupload}/src/main/resources/base/element/string.json (100%) delete mode 100644 commons_fileupload/package-lock.json delete mode 100644 commons_fileupload/package.json diff --git a/README.md b/README.md index 5604cbd..6a364d0 100644 --- a/README.md +++ b/README.md @@ -107,4 +107,4 @@ this.fileUpload.post("/api/upload", formData).then(res => { ## 开源协议 -本项目基于 [Apache License 2.0](https://gitee.com/openharmony-sig/PullToRefresh/blob/master/LICENSE) ,请自由地享受和参与开源。 +本项目基于 [Apache License 2.0](https://gitee.com/openharmony-sig/commons-fileupload/blob/master/LICENSE) ,请自由地享受和参与开源。 diff --git a/commons_fileupload/.gitignore b/commons-fileupload/.gitignore similarity index 100% rename from commons_fileupload/.gitignore rename to commons-fileupload/.gitignore diff --git a/commons_fileupload/build-profile.json5 b/commons-fileupload/build-profile.json5 similarity index 100% rename from commons_fileupload/build-profile.json5 rename to commons-fileupload/build-profile.json5 diff --git a/commons_fileupload/hvigorfile.js b/commons-fileupload/hvigorfile.js similarity index 100% rename from commons_fileupload/hvigorfile.js rename to commons-fileupload/hvigorfile.js diff --git a/commons_fileupload/index.ets b/commons-fileupload/index.ets similarity index 72% rename from commons_fileupload/index.ets rename to commons-fileupload/index.ets index 5af2fc4..7ac8ac3 100644 --- a/commons_fileupload/index.ets +++ b/commons-fileupload/index.ets @@ -1,6 +1,6 @@ export { FileUpload } from "./src/main/ets/components/index"; -export { ConstructOptions } from "./src/main/ets/components/types/type"; +export { ConstructOptions } from "./src/main/ets/components/index"; export { FormData } from "./src/main/ets/components/models/FormData"; diff --git a/commons-fileupload/package-lock.json b/commons-fileupload/package-lock.json new file mode 100644 index 0000000..f1e8fe3 --- /dev/null +++ b/commons-fileupload/package-lock.json @@ -0,0 +1,26 @@ +{ + "name": "commons_fileupload", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/mime-types": { + "version": "2.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@types/mime-types/-/mime-types-2.1.1.tgz", + "integrity": "sha512-vXOTGVSLR2jMw440moWTC7H19iUyLtP3Z1YTj7cSsubOICinjMxFeb/V57v9QdyyPGbbWolUFSSmSiRSn94tFw==" + }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://repo.huaweicloud.com/repository/npm/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "requires": { + "mime-db": "1.52.0" + } + } + } +} diff --git a/commons-fileupload/package.json b/commons-fileupload/package.json new file mode 100644 index 0000000..3e913ee --- /dev/null +++ b/commons-fileupload/package.json @@ -0,0 +1,31 @@ +{ + "name": "@ohos/commons-fileupload", + "keywords": [ + "OpenHarmony", + "fileUpload", + "request", + "file" + ], + "author": "ohos_tpc", + "description": "专门为OpenHarmony打造的一款包含基础请求以及文件上传等功能的库", + "ohos": { + "org": "opensource" + }, + "repository": "https://gitee.com/openharmony-sig/commons-fileupload", + "version": "0.1.0", + "tags": [ + "OpenHarmony", + "fileUpload", + "request", + "file" + ], + "license": "Apache License 2.0", + "main": "index.ets", + "types": "", + "dependencies": { + "mime-types": "^2.1.35" + }, + "devDependencies": { + "@types/mime-types": "^2.1.1" + } +} diff --git a/commons_fileupload/src/main/ets/components/index.ets b/commons-fileupload/src/main/ets/components/index.ets similarity index 95% rename from commons_fileupload/src/main/ets/components/index.ets rename to commons-fileupload/src/main/ets/components/index.ets index 5083b2f..cbd225a 100644 --- a/commons_fileupload/src/main/ets/components/index.ets +++ b/commons-fileupload/src/main/ets/components/index.ets @@ -13,10 +13,17 @@ * limitations under the License. */ import http from "@ohos.net.http"; -import { ConstructOptions, MyHttpRequestOptions } from "./types/type"; +import { MyHttpRequestOptions } from "./types/type"; import { isFormData, isMyHttpRequestOptions, isString } from "./utils/utils"; import { buildUrl, mergeConfig } from "./utils/helpers"; -import { log } from "./utils/log" +import { logger } from "./utils/log"; + +export interface ConstructOptions { + baseUrl?: string; + readTimeout?: number; + connectTimeout?: number; +} + export class FileUpload { private constructOptions: ConstructOptions; @@ -28,7 +35,7 @@ export class FileUpload { if (!url) throw new Error("无效的url"); url = buildUrl(this.constructOptions.baseUrl, url); config = mergeConfig(this.constructOptions, config); - log(`请求配置:地址--${url} config--${JSON.stringify(config)}`) + logger.log(`请求配置:地址--${url} config--${JSON.stringify(config)}`) return new Promise((resolve, reject) => { let httpRequest = http.createHttp(); @@ -77,7 +84,7 @@ export class FileUpload { config.header = {} } config.header["Content-Type"] = "multipart/form-data; boundary=" + config.extraData._boundary_key; - config.extraData = config.extraData.arrayBuffer && config.extraData.arrayBuffer(); + config.extraData = config.extraData.toArrayBuffer && config.extraData.toArrayBuffer(); } return this._generateHTTPMethod(http.RequestMethod.POST)(configOrUrl, config); } diff --git a/commons_fileupload/src/main/ets/components/models/File.ets b/commons-fileupload/src/main/ets/components/models/File.ets similarity index 100% rename from commons_fileupload/src/main/ets/components/models/File.ets rename to commons-fileupload/src/main/ets/components/models/File.ets diff --git a/commons_fileupload/src/main/ets/components/models/FormData.ets b/commons-fileupload/src/main/ets/components/models/FormData.ets similarity index 65% rename from commons_fileupload/src/main/ets/components/models/FormData.ets rename to commons-fileupload/src/main/ets/components/models/FormData.ets index 0cf28d1..6156304 100644 --- a/commons_fileupload/src/main/ets/components/models/FormData.ets +++ b/commons-fileupload/src/main/ets/components/models/FormData.ets @@ -18,16 +18,16 @@ import { File } from "./File"; export class FormData { static DEFAULT_CONTENT_TYPE = "application/octet-stream"; - public _boundary_key: string | number; //随机字符串 - private _boundary: string; //分隔符 - private _end_boundary: string; //结尾分隔符 - private _result: Array = []; //最终拼接结果 + public boundaryKey: string | number; //随机字符串 + private boundary: string; //分隔符 + private endBoundary: string; //结尾分隔符 + private result: Array = []; //最终拼接结果 [Symbol.toStringTag] = "FormData"; constructor(stamp?: string) { - this._boundary_key = stamp || Date.now(); - this._boundary = "--" + this._boundary_key; - this._end_boundary = this._boundary + "--"; + this.boundaryKey = stamp || Date.now(); + this.boundary = "--" + this.boundaryKey; + this.endBoundary = this.boundary + "--"; } /** @@ -37,13 +37,13 @@ export class FormData { */ append(key: string, value: string | number | File) { if (isString(value)) { - this._appendValue(key,value); + this.appendValue(key,value); } else if (isNumber(value)) { - this._appendValue(key,value + ""); + this.appendValue(key,value + ""); } else if (isFile(value)) { const { fileName,fileData } = value; if(!fileName || !fileData) throw new Error("无效的fileName或fileData"); - this._appendFile(key,value); + this.appendFile(key,value); } else { throw new Error("Unsupported value type"); } @@ -54,12 +54,11 @@ export class FormData { * @param key * @param value */ - private _appendValue(key: string, value: string) { - this.append - this._result.push(this._boundary + "\r\n"); - this._result.push(`Content-Disposition: form-data; name="${key}"\r\n\r\n`); - this._result.push(value); - this._result.push(`\r\n`); + private appendValue(key: string, value: string) { + this.result.push(this.boundary + "\r\n"); + this.result.push(`Content-Disposition: form-data; name="${key}"\r\n\r\n`); + this.result.push(value); + this.result.push(`\r\n`); } /** @@ -67,25 +66,25 @@ export class FormData { * @param key * @param file */ - private _appendFile(key: string, file: File) { + private appendFile(key: string, file: File) { const { fileName,fileData } = file; - const contentType = this._getContentType(file); - this._result.push(`${this._boundary}\r\n`); - this._result.push(`Content-Disposition: form-data; name="${key}"; filename="${fileName}"\r\n`); - this._result.push(`Content-Type: ${contentType}\r\n`); - this._result.push("\r\n"); - this._result.push(fileData); - this._result.push("\r\n"); + const contentType = this.getContentType(file); + this.result.push(`${this.boundary}\r\n`); + this.result.push(`Content-Disposition: form-data; name="${key}"; filename="${fileName}"\r\n`); + this.result.push(`Content-Type: ${contentType}\r\n`); + this.result.push("\r\n"); + this.result.push(fileData); + this.result.push("\r\n"); } /** - * 将_result转换成ArrayBuffer + * 将result转换成ArrayBuffer */ - arrayBuffer(): ArrayBuffer { - this._result.push(`\r\n${this._end_boundary}`); + toArrayBuffer(): ArrayBuffer { + this.result.push(`\r\n${this.endBoundary}`); let charArr = []; - for(let i=0;i = { [P in keyof T]: P extends keyof U ? T[P] | U[P] : T[P] diff --git a/commons_fileupload/src/main/ets/components/utils/helpers.ets b/commons-fileupload/src/main/ets/components/utils/helpers.ets similarity index 49% rename from commons_fileupload/src/main/ets/components/utils/helpers.ets rename to commons-fileupload/src/main/ets/components/utils/helpers.ets index 9c7b33b..3cba43f 100644 --- a/commons_fileupload/src/main/ets/components/utils/helpers.ets +++ b/commons-fileupload/src/main/ets/components/utils/helpers.ets @@ -15,24 +15,24 @@ import http from "@ohos.net.http"; import { ConstructOptions } from "../types/type" -export function buildUrl(baseUrl:string,url:string):string{ - if(url && (url.startsWith("http://") || url.startsWith("https://"))){ - return url; - } +export function buildUrl(baseUrl: string, url: string): string { + if (url && (url.startsWith("http://") || url.startsWith("https://"))) { + return url; + } - if(baseUrl.endsWith("/") && url.startsWith("/")){ - return baseUrl + url.slice(1,url.length); - } + if (baseUrl.endsWith("/") && url.startsWith("/")) { + return baseUrl + url.slice(1, url.length); + } - if(!baseUrl.endsWith("/") && !url.startsWith("/")){ - return baseUrl + "/" + url; - } + if (!baseUrl.endsWith("/") && !url.startsWith("/")) { + return baseUrl + "/" + url; + } - return baseUrl + url; + return baseUrl + url; } -export function mergeConfig(options:ConstructOptions,config:http.HttpRequestOptions):http.HttpRequestOptions{ - !config.connectTimeout && options.readTimeout && (config.connectTimeout = options.connectTimeout); - !config.readTimeout && options.readTimeout && (config.readTimeout = options.readTimeout); - return config; +export function mergeConfig(options: ConstructOptions, config: http.HttpRequestOptions): http.HttpRequestOptions { + !config.connectTimeout && options.readTimeout && (config.connectTimeout = options.connectTimeout); + !config.readTimeout && options.readTimeout && (config.readTimeout = options.readTimeout); + return config; } \ No newline at end of file diff --git a/commons_fileupload/src/main/ets/components/utils/log.ets b/commons-fileupload/src/main/ets/components/utils/log.ets similarity index 70% rename from commons_fileupload/src/main/ets/components/utils/log.ets rename to commons-fileupload/src/main/ets/components/utils/log.ets index 3fcc26b..204cfd1 100644 --- a/commons_fileupload/src/main/ets/components/utils/log.ets +++ b/commons-fileupload/src/main/ets/components/utils/log.ets @@ -14,24 +14,28 @@ */ const TAG = "COMMONS_FILEUPLOAD"; -export function log(value:any){ + +export class logger { + static log(value: any) { console.log(TAG + "----" + value); -} + } -export function logError(value:any){ + static logError(value: any) { console.error(TAG + "----" + value); -} + } -export function logInfo(value:any){ + static logInfo(value: any) { console.info(TAG + "----" + value); -} + } -export function debug(func){ - if(typeof func !== "function") return; - try{ - func(); - }catch(err){ - logError(JSON.stringify(err)); - logError(err.message) + static debugFunc(func) { + if (typeof func !== "function") return; + try { + func(); + } catch (err) { + logger.logError(JSON.stringify(err)); + logger.logError(err.message) } + } } + diff --git a/commons_fileupload/src/main/ets/components/utils/utils.ets b/commons-fileupload/src/main/ets/components/utils/utils.ets similarity index 100% rename from commons_fileupload/src/main/ets/components/utils/utils.ets rename to commons-fileupload/src/main/ets/components/utils/utils.ets diff --git a/commons_fileupload/src/main/module.json5 b/commons-fileupload/src/main/module.json5 similarity index 100% rename from commons_fileupload/src/main/module.json5 rename to commons-fileupload/src/main/module.json5 diff --git a/commons_fileupload/src/main/resources/base/element/string.json b/commons-fileupload/src/main/resources/base/element/string.json similarity index 100% rename from commons_fileupload/src/main/resources/base/element/string.json rename to commons-fileupload/src/main/resources/base/element/string.json diff --git a/commons_fileupload/package-lock.json b/commons_fileupload/package-lock.json deleted file mode 100644 index efbb760..0000000 --- a/commons_fileupload/package-lock.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "commons_fileupload", - "version": "1.0.0", - "lockfileVersion": 1 -} diff --git a/commons_fileupload/package.json b/commons_fileupload/package.json deleted file mode 100644 index f522467..0000000 --- a/commons_fileupload/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "commons_fileupload", - "description": "a npm package which contains arkUI2.0 page", - "ohos": { - "org": "" - }, - "version": "1.0.0", - "main": "index.ets", - "types": "", - "repository": {}, - "license": "ISC", - "dependencies": {} -} diff --git a/entry/package-lock.json b/entry/package-lock.json index 0eab12e..4ed800d 100644 --- a/entry/package-lock.json +++ b/entry/package-lock.json @@ -4,8 +4,11 @@ "lockfileVersion": 1, "requires": true, "dependencies": { - "@ohos/commons_fileupload": { - "version": "file:../commons_fileupload", + "@ohos/commons-fileupload": { + "version": "file:../commons-fileupload", + "requires": { + "mime-types": "^2.1.35" + }, "dependencies": { "@types/mime-types": { "version": "2.1.1", diff --git a/entry/package.json b/entry/package.json index 5b2807f..3ddd445 100644 --- a/entry/package.json +++ b/entry/package.json @@ -11,6 +11,6 @@ "repository": {}, "version": "1.0.0", "dependencies": { - "@ohos/commons_fileupload": "file:../commons_fileupload" + "@ohos/commons-fileupload": "file:../commons-fileupload" } } diff --git a/entry/src/main/ets/pages/UploadFile.ets b/entry/src/main/ets/pages/UploadFile.ets index e3ef33a..c29e4c2 100644 --- a/entry/src/main/ets/pages/UploadFile.ets +++ b/entry/src/main/ets/pages/UploadFile.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { FormData, File, FileUpload } from "@ohos/commons_fileupload" +import { FormData, File, FileUpload } from "@ohos/commons-fileupload" import { log, logError, debug } from "../utils/log" @Entry -- Gitee From fcb1e95f14f38c641645fd470beef287e194d211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=BF=97=E5=BC=BA?= Date: Wed, 12 Oct 2022 09:36:01 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9library=E5=90=8D=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨志强 --- {commons-fileupload => commons_fileupload}/.gitignore | 0 .../build-profile.json5 | 0 .../hvigorfile.js | 0 {commons-fileupload => commons_fileupload}/index.ets | 0 .../package-lock.json | 7 ++++--- .../package.json | 0 .../src/main/ets/components/index.ets | 0 .../src/main/ets/components/models/File.ets | 0 .../src/main/ets/components/models/FormData.ets | 0 .../src/main/ets/components/types/type.ets | 0 .../src/main/ets/components/utils/helpers.ets | 2 +- .../src/main/ets/components/utils/log.ets | 0 .../src/main/ets/components/utils/utils.ets | 0 .../src/main/module.json5 | 0 .../src/main/resources/base/element/string.json | 0 entry/package-lock.json | 2 +- entry/package.json | 2 +- entry/src/main/ets/pages/UploadFile.ets | 10 +++++----- 18 files changed, 12 insertions(+), 11 deletions(-) rename {commons-fileupload => commons_fileupload}/.gitignore (100%) rename {commons-fileupload => commons_fileupload}/build-profile.json5 (100%) rename {commons-fileupload => commons_fileupload}/hvigorfile.js (100%) rename {commons-fileupload => commons_fileupload}/index.ets (100%) rename {commons-fileupload => commons_fileupload}/package-lock.json (87%) rename {commons-fileupload => commons_fileupload}/package.json (100%) rename {commons-fileupload => commons_fileupload}/src/main/ets/components/index.ets (100%) rename {commons-fileupload => commons_fileupload}/src/main/ets/components/models/File.ets (100%) rename {commons-fileupload => commons_fileupload}/src/main/ets/components/models/FormData.ets (100%) rename {commons-fileupload => commons_fileupload}/src/main/ets/components/types/type.ets (100%) rename {commons-fileupload => commons_fileupload}/src/main/ets/components/utils/helpers.ets (96%) rename {commons-fileupload => commons_fileupload}/src/main/ets/components/utils/log.ets (100%) rename {commons-fileupload => commons_fileupload}/src/main/ets/components/utils/utils.ets (100%) rename {commons-fileupload => commons_fileupload}/src/main/module.json5 (100%) rename {commons-fileupload => commons_fileupload}/src/main/resources/base/element/string.json (100%) diff --git a/commons-fileupload/.gitignore b/commons_fileupload/.gitignore similarity index 100% rename from commons-fileupload/.gitignore rename to commons_fileupload/.gitignore diff --git a/commons-fileupload/build-profile.json5 b/commons_fileupload/build-profile.json5 similarity index 100% rename from commons-fileupload/build-profile.json5 rename to commons_fileupload/build-profile.json5 diff --git a/commons-fileupload/hvigorfile.js b/commons_fileupload/hvigorfile.js similarity index 100% rename from commons-fileupload/hvigorfile.js rename to commons_fileupload/hvigorfile.js diff --git a/commons-fileupload/index.ets b/commons_fileupload/index.ets similarity index 100% rename from commons-fileupload/index.ets rename to commons_fileupload/index.ets diff --git a/commons-fileupload/package-lock.json b/commons_fileupload/package-lock.json similarity index 87% rename from commons-fileupload/package-lock.json rename to commons_fileupload/package-lock.json index f1e8fe3..7f22a29 100644 --- a/commons-fileupload/package-lock.json +++ b/commons_fileupload/package-lock.json @@ -1,13 +1,14 @@ { - "name": "commons_fileupload", - "version": "1.0.0", + "name": "@ohos/commons-fileupload", + "version": "0.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { "@types/mime-types": { "version": "2.1.1", "resolved": "https://repo.huaweicloud.com/repository/npm/@types/mime-types/-/mime-types-2.1.1.tgz", - "integrity": "sha512-vXOTGVSLR2jMw440moWTC7H19iUyLtP3Z1YTj7cSsubOICinjMxFeb/V57v9QdyyPGbbWolUFSSmSiRSn94tFw==" + "integrity": "sha512-vXOTGVSLR2jMw440moWTC7H19iUyLtP3Z1YTj7cSsubOICinjMxFeb/V57v9QdyyPGbbWolUFSSmSiRSn94tFw==", + "dev": true }, "mime-db": { "version": "1.52.0", diff --git a/commons-fileupload/package.json b/commons_fileupload/package.json similarity index 100% rename from commons-fileupload/package.json rename to commons_fileupload/package.json diff --git a/commons-fileupload/src/main/ets/components/index.ets b/commons_fileupload/src/main/ets/components/index.ets similarity index 100% rename from commons-fileupload/src/main/ets/components/index.ets rename to commons_fileupload/src/main/ets/components/index.ets diff --git a/commons-fileupload/src/main/ets/components/models/File.ets b/commons_fileupload/src/main/ets/components/models/File.ets similarity index 100% rename from commons-fileupload/src/main/ets/components/models/File.ets rename to commons_fileupload/src/main/ets/components/models/File.ets diff --git a/commons-fileupload/src/main/ets/components/models/FormData.ets b/commons_fileupload/src/main/ets/components/models/FormData.ets similarity index 100% rename from commons-fileupload/src/main/ets/components/models/FormData.ets rename to commons_fileupload/src/main/ets/components/models/FormData.ets diff --git a/commons-fileupload/src/main/ets/components/types/type.ets b/commons_fileupload/src/main/ets/components/types/type.ets similarity index 100% rename from commons-fileupload/src/main/ets/components/types/type.ets rename to commons_fileupload/src/main/ets/components/types/type.ets diff --git a/commons-fileupload/src/main/ets/components/utils/helpers.ets b/commons_fileupload/src/main/ets/components/utils/helpers.ets similarity index 96% rename from commons-fileupload/src/main/ets/components/utils/helpers.ets rename to commons_fileupload/src/main/ets/components/utils/helpers.ets index 3cba43f..cadbd78 100644 --- a/commons-fileupload/src/main/ets/components/utils/helpers.ets +++ b/commons_fileupload/src/main/ets/components/utils/helpers.ets @@ -13,7 +13,7 @@ * limitations under the License. */ import http from "@ohos.net.http"; -import { ConstructOptions } from "../types/type" +import { ConstructOptions } from "../index" export function buildUrl(baseUrl: string, url: string): string { if (url && (url.startsWith("http://") || url.startsWith("https://"))) { diff --git a/commons-fileupload/src/main/ets/components/utils/log.ets b/commons_fileupload/src/main/ets/components/utils/log.ets similarity index 100% rename from commons-fileupload/src/main/ets/components/utils/log.ets rename to commons_fileupload/src/main/ets/components/utils/log.ets diff --git a/commons-fileupload/src/main/ets/components/utils/utils.ets b/commons_fileupload/src/main/ets/components/utils/utils.ets similarity index 100% rename from commons-fileupload/src/main/ets/components/utils/utils.ets rename to commons_fileupload/src/main/ets/components/utils/utils.ets diff --git a/commons-fileupload/src/main/module.json5 b/commons_fileupload/src/main/module.json5 similarity index 100% rename from commons-fileupload/src/main/module.json5 rename to commons_fileupload/src/main/module.json5 diff --git a/commons-fileupload/src/main/resources/base/element/string.json b/commons_fileupload/src/main/resources/base/element/string.json similarity index 100% rename from commons-fileupload/src/main/resources/base/element/string.json rename to commons_fileupload/src/main/resources/base/element/string.json diff --git a/entry/package-lock.json b/entry/package-lock.json index 4ed800d..f3e4a33 100644 --- a/entry/package-lock.json +++ b/entry/package-lock.json @@ -5,7 +5,7 @@ "requires": true, "dependencies": { "@ohos/commons-fileupload": { - "version": "file:../commons-fileupload", + "version": "file:../commons_fileupload", "requires": { "mime-types": "^2.1.35" }, diff --git a/entry/package.json b/entry/package.json index 3ddd445..8a39eaf 100644 --- a/entry/package.json +++ b/entry/package.json @@ -11,6 +11,6 @@ "repository": {}, "version": "1.0.0", "dependencies": { - "@ohos/commons-fileupload": "file:../commons-fileupload" + "@ohos/commons-fileupload": "file:../commons_fileupload" } } diff --git a/entry/src/main/ets/pages/UploadFile.ets b/entry/src/main/ets/pages/UploadFile.ets index c29e4c2..407e635 100644 --- a/entry/src/main/ets/pages/UploadFile.ets +++ b/entry/src/main/ets/pages/UploadFile.ets @@ -91,11 +91,11 @@ struct UploadFile { }) log("formData实例化完成,准备上传") - this.fileUpload.post("/api/upload", formData).then(res => { - log("this.fileUpload.request 成功---" + JSON.stringify(res)) - }).catch(err => { - logError("this.fileUpload.request 失败" + JSON.stringify(err)) - }) +// this.fileUpload.post("/api/upload", formData).then(res => { +// log("this.fileUpload.request 成功---" + JSON.stringify(res)) +// }).catch(err => { +// logError("this.fileUpload.request 失败" + JSON.stringify(err)) +// }) } -- Gitee From e48107bdec655c6700b6d60ee3e75c0efd052b28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=BF=97=E5=BC=BA?= Date: Wed, 12 Oct 2022 10:33:48 +0800 Subject: [PATCH 5/8] =?UTF-8?q?FormData=20=E9=80=82=E9=85=8D3.2.7.5?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E7=9A=84SDK?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨志强 --- build-profile.json5 | 19 +++++- commons_fileupload/package.json | 60 +++++++++---------- .../src/main/ets/components/index.ets | 2 +- .../main/ets/components/models/FormData.ets | 41 ++++++------- entry/package.json | 26 ++++---- entry/src/main/ets/pages/UploadFile.ets | 11 ++-- entry/src/main/ets/pages/index.ets | 1 + package.json | 30 +++++----- 8 files changed, 103 insertions(+), 87 deletions(-) diff --git a/build-profile.json5 b/build-profile.json5 index d89c345..baf6094 100644 --- a/build-profile.json5 +++ b/build-profile.json5 @@ -1,6 +1,19 @@ { app: { - signingConfigs: [], + signingConfigs: [ + { + "name": "default", + "material": { + "certpath": "C:\\Users\\Administrator\\.ohos\\config\\openharmony\\auto_ohos_default_com.example.myapplication.cer", + "storePassword": "0000001AE8365E463CAD0DD2FD605E6AC5765451B80EEF11E9701B86E77D39C5FCB8EE69FBFBACBC98C6", + "keyAlias": "debugKey", + "keyPassword": "0000001A5EAF66914210E266C1ADB705F210822C45DB0E9B2D953A6A19C10385CE161DE425C45320592A", + "profile": "C:\\Users\\Administrator\\.ohos\\config\\openharmony\\auto_ohos_default_com.example.myapplication.p7b", + "signAlg": "SHA256withECDSA", + "storeFile": "C:\\Users\\Administrator\\.ohos\\config\\openharmony\\auto_ohos_default_com.example.myapplication.p12" + } + } + ], compileSdkVersion: 9, compatibleSdkVersion: 9, products: [ @@ -17,7 +30,9 @@ targets: [ { name: "default", - applyToProducts: ["default"], + applyToProducts: [ + "default" + ], }, ], }, diff --git a/commons_fileupload/package.json b/commons_fileupload/package.json index 3e913ee..2ad6a6c 100644 --- a/commons_fileupload/package.json +++ b/commons_fileupload/package.json @@ -1,31 +1,31 @@ { - "name": "@ohos/commons-fileupload", - "keywords": [ - "OpenHarmony", - "fileUpload", - "request", - "file" - ], - "author": "ohos_tpc", - "description": "专门为OpenHarmony打造的一款包含基础请求以及文件上传等功能的库", - "ohos": { - "org": "opensource" - }, - "repository": "https://gitee.com/openharmony-sig/commons-fileupload", - "version": "0.1.0", - "tags": [ - "OpenHarmony", - "fileUpload", - "request", - "file" - ], - "license": "Apache License 2.0", - "main": "index.ets", - "types": "", - "dependencies": { - "mime-types": "^2.1.35" - }, - "devDependencies": { - "@types/mime-types": "^2.1.1" - } -} + "types":"", + "keywords":[ + "OpenHarmony", + "fileUpload", + "request", + "file" + ], + "author":"ohos_tpc", + "description":"专门为OpenHarmony打造的一款包含基础请求以及文件上传等功能的库", + "ohos":{ + "org":"opensource" + }, + "main":"index.ets", + "repository":"https://gitee.com/openharmony-sig/commons-fileupload", + "version":"0.1.0", + "tags":[ + "OpenHarmony", + "fileUpload", + "request", + "file" + ], + "dependencies":{ + "mime-types":"^2.1.35" + }, + "license":"Apache License 2.0", + "devDependencies":{ + "@types/mime-types":"^2.1.1" + }, + "name":"@ohos/commons-fileupload" +} \ No newline at end of file diff --git a/commons_fileupload/src/main/ets/components/index.ets b/commons_fileupload/src/main/ets/components/index.ets index cbd225a..a9e749f 100644 --- a/commons_fileupload/src/main/ets/components/index.ets +++ b/commons_fileupload/src/main/ets/components/index.ets @@ -83,7 +83,7 @@ export class FileUpload { if (!config.header) { config.header = {} } - config.header["Content-Type"] = "multipart/form-data; boundary=" + config.extraData._boundary_key; + config.header["Content-Type"] = "multipart/form-data; boundary=" + config.extraData.boundaryKey; config.extraData = config.extraData.toArrayBuffer && config.extraData.toArrayBuffer(); } return this._generateHTTPMethod(http.RequestMethod.POST)(configOrUrl, config); diff --git a/commons_fileupload/src/main/ets/components/models/FormData.ets b/commons_fileupload/src/main/ets/components/models/FormData.ets index 6156304..9b61554 100644 --- a/commons_fileupload/src/main/ets/components/models/FormData.ets +++ b/commons_fileupload/src/main/ets/components/models/FormData.ets @@ -1,3 +1,4 @@ + /* * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the 'License'); @@ -13,7 +14,7 @@ * limitations under the License. */ import mime from "mime-types"; -import { isFile,isString,isNumber } from "../utils/utils"; +import { isFile, isString, isNumber } from "../utils/utils"; import { File } from "./File"; export class FormData { @@ -37,13 +38,13 @@ export class FormData { */ append(key: string, value: string | number | File) { if (isString(value)) { - this.appendValue(key,value); + this.appendValue(key, value); } else if (isNumber(value)) { - this.appendValue(key,value + ""); + this.appendValue(key, value + ""); } else if (isFile(value)) { const { fileName,fileData } = value; - if(!fileName || !fileData) throw new Error("无效的fileName或fileData"); - this.appendFile(key,value); + if (!fileName || !fileData) throw new Error("无效的fileName或fileData"); + this.appendFile(key, value); } else { throw new Error("Unsupported value type"); } @@ -56,9 +57,9 @@ export class FormData { */ private appendValue(key: string, value: string) { this.result.push(this.boundary + "\r\n"); - this.result.push(`Content-Disposition: form-data; name="${key}"\r\n\r\n`); + this.result.push('Content-Disposition: form-data; name="' + key + '"\r\n\r\n'); this.result.push(value); - this.result.push(`\r\n`); + this.result.push("\r\n"); } /** @@ -69,9 +70,9 @@ export class FormData { private appendFile(key: string, file: File) { const { fileName,fileData } = file; const contentType = this.getContentType(file); - this.result.push(`${this.boundary}\r\n`); - this.result.push(`Content-Disposition: form-data; name="${key}"; filename="${fileName}"\r\n`); - this.result.push(`Content-Type: ${contentType}\r\n`); + this.result.push(this.boundary + "\r\n"); + this.result.push('Content-Disposition: form-data; name="' + key + '"; filename="' + fileName + '"\r\n'); + this.result.push('Content-Type: ' + contentType + '\r\n'); this.result.push("\r\n"); this.result.push(fileData); this.result.push("\r\n"); @@ -81,28 +82,28 @@ export class FormData { * 将result转换成ArrayBuffer */ toArrayBuffer(): ArrayBuffer { - this.result.push(`\r\n${this.endBoundary}`); + this.result.push("\r\n" + this.endBoundary); let charArr = []; - for(let i=0;i { -// log("this.fileUpload.request 成功---" + JSON.stringify(res)) -// }).catch(err => { -// logError("this.fileUpload.request 失败" + JSON.stringify(err)) -// }) + this.fileUpload.post("/api/upload", formData).then(res => { + log("this.fileUpload.request 成功---" + JSON.stringify(res)) + }).catch(err => { + logError("this.fileUpload.request 失败" + JSON.stringify(err)) + }) } diff --git a/entry/src/main/ets/pages/index.ets b/entry/src/main/ets/pages/index.ets index 9086dbe..b56e74f 100644 --- a/entry/src/main/ets/pages/index.ets +++ b/entry/src/main/ets/pages/index.ets @@ -13,6 +13,7 @@ * limitations under the License. */ import Router from "@ohos.router"; + @Entry @Component struct Index { diff --git a/package.json b/package.json index 7929e73..e2cded7 100644 --- a/package.json +++ b/package.json @@ -1,18 +1,18 @@ { - "license": "ISC", - "devDependencies": {}, - "name": "myapplication", - "ohos": { - "org": "huawei", - "directoryLevel": "project", - "buildTool": "hvigor" + "license":"ISC", + "devDependencies":{}, + "name":"myapplication", + "ohos":{ + "org":"huawei", + "directoryLevel":"project", + "buildTool":"hvigor" }, - "description": "example description", - "repository": {}, - "version": "1.0.0", - "dependencies": { - "@ohos/hypium": "1.0.2", - "@ohos/hvigor-ohos-plugin": "1.2.2", - "@ohos/hvigor": "1.2.2" + "description":"example description", + "repository":{}, + "version":"1.0.0", + "dependencies":{ + "@ohos/hypium":"1.0.2", + "@ohos/hvigor-ohos-plugin":"1.2.2", + "@ohos/hvigor":"1.2.2" } -} +} \ No newline at end of file -- Gitee From b6f3979ceafe7e8d31842916700a1940cc3e0d8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=BF=97=E5=BC=BA?= Date: Wed, 12 Oct 2022 14:29:24 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E9=87=8D=E6=9E=84FormData=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=B1=BB=E5=9E=8B=E5=A3=B0=E6=98=8E=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨志强 --- commons_fileupload/index.d.ts | 80 +++++++++++++++++++ commons_fileupload/package.json | 34 ++++---- .../ets/components/{index.ets => index.ts} | 78 +++++++++--------- .../components/models/{File.ets => File.ts} | 0 .../models/{FormData.ets => FormData.ts} | 0 .../components/types/{type.ets => type.ts} | 0 .../utils/{helpers.ets => helpers.ts} | 0 .../ets/components/utils/{log.ets => log.ts} | 0 .../components/utils/{utils.ets => utils.ts} | 0 entry/package.json | 26 +++--- entry/src/main/ets/pages/UploadFile.ets | 6 +- entry/src/main/ets/pages/index.ets | 2 +- entry/src/main/resources/rawfile/test.txt | 1 + 13 files changed, 158 insertions(+), 69 deletions(-) create mode 100644 commons_fileupload/index.d.ts rename commons_fileupload/src/main/ets/components/{index.ets => index.ts} (77%) rename commons_fileupload/src/main/ets/components/models/{File.ets => File.ts} (100%) rename commons_fileupload/src/main/ets/components/models/{FormData.ets => FormData.ts} (100%) rename commons_fileupload/src/main/ets/components/types/{type.ets => type.ts} (100%) rename commons_fileupload/src/main/ets/components/utils/{helpers.ets => helpers.ts} (100%) rename commons_fileupload/src/main/ets/components/utils/{log.ets => log.ts} (100%) rename commons_fileupload/src/main/ets/components/utils/{utils.ets => utils.ts} (100%) create mode 100644 entry/src/main/resources/rawfile/test.txt diff --git a/commons_fileupload/index.d.ts b/commons_fileupload/index.d.ts new file mode 100644 index 0000000..9ad673f --- /dev/null +++ b/commons_fileupload/index.d.ts @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { MyHttpRequestOptions } from "./src/main/ets/components/types/type"; +import { ConstructOptions } from "./src/main/ets/components/index" + +export class FileUpload { + private constructOptions: ConstructOptions; + + constructor(options: ConstructOptions) + + post(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) + + post(configOrUrl: Omit) + + + get(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) + + get(configOrUrl: Omit) + + + head(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) + + head(configOrUrl: Omit) + + + options(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) + + options(configOrUrl: Omit) + + + put(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) + + put(configOrUrl: Omit) + + + delete(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) + + delete(configOrUrl: Omit) + + + trace(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) + + trace(configOrUrl: Omit) + + + connect(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) + + connect(configOrUrl: Omit) + +} + + +export class FormData { + static DEFAULT_CONTENT_TYPE:string; + public boundaryKey: string | number; //随机字符串 + constructor(stamp?: string) + append(key: string, value: string | number | File):void + toArrayBuffer(): ArrayBuffer +} + + +export class File { + public fileName: string; + public fileData:string | ArrayBuffer | Uint8Array +} + + diff --git a/commons_fileupload/package.json b/commons_fileupload/package.json index 2ad6a6c..fcb76b2 100644 --- a/commons_fileupload/package.json +++ b/commons_fileupload/package.json @@ -1,31 +1,31 @@ { - "types":"", - "keywords":[ + "types": "./index.d.ts", + "keywords": [ "OpenHarmony", "fileUpload", "request", "file" ], - "author":"ohos_tpc", - "description":"专门为OpenHarmony打造的一款包含基础请求以及文件上传等功能的库", - "ohos":{ - "org":"opensource" + "author": "ohos_tpc", + "description": "专门为OpenHarmony打造的一款包含基础请求以及文件上传等功能的库", + "ohos": { + "org": "opensource" }, - "main":"index.ets", - "repository":"https://gitee.com/openharmony-sig/commons-fileupload", - "version":"0.1.0", - "tags":[ + "main": "index.ets", + "repository": "https://gitee.com/openharmony-sig/commons-fileupload", + "version": "0.1.0", + "tags": [ "OpenHarmony", "fileUpload", "request", "file" ], - "dependencies":{ - "mime-types":"^2.1.35" + "dependencies": { + "mime-types": "^2.1.35" }, - "license":"Apache License 2.0", - "devDependencies":{ - "@types/mime-types":"^2.1.1" + "license": "Apache License 2.0", + "devDependencies": { + "@types/mime-types": "^2.1.1" }, - "name":"@ohos/commons-fileupload" -} \ No newline at end of file + "name": "@ohos/commons-fileupload" +} diff --git a/commons_fileupload/src/main/ets/components/index.ets b/commons_fileupload/src/main/ets/components/index.ts similarity index 77% rename from commons_fileupload/src/main/ets/components/index.ets rename to commons_fileupload/src/main/ets/components/index.ts index a9e749f..632de00 100644 --- a/commons_fileupload/src/main/ets/components/index.ets +++ b/commons_fileupload/src/main/ets/components/index.ts @@ -13,7 +13,7 @@ * limitations under the License. */ import http from "@ohos.net.http"; -import { MyHttpRequestOptions } from "./types/type"; +import { MyHttpRequestOptions } from "./types/type"; import { isFormData, isMyHttpRequestOptions, isString } from "./utils/utils"; import { buildUrl, mergeConfig } from "./utils/helpers"; import { logger } from "./utils/log"; @@ -24,6 +24,7 @@ export interface ConstructOptions { connectTimeout?: number; } + export class FileUpload { private constructOptions: ConstructOptions; @@ -31,7 +32,7 @@ export class FileUpload { this.constructOptions = options; } - private request(url: string, config: http.HttpRequestOptions): Promise{ + private request(url: string, config: http.HttpRequestOptions): Promise { if (!url) throw new Error("无效的url"); url = buildUrl(this.constructOptions.baseUrl, url); config = mergeConfig(this.constructOptions, config); @@ -52,16 +53,12 @@ export class FileUpload { private _generateHTTPMethod(method: http.RequestMethod): (configOrUrl: string, config: http.HttpRequestOptions) => Promise { var that = this; - return function (configOrUrl: string, config: http.HttpRequestOptions): Promise{ + return function (configOrUrl: string, config: http.HttpRequestOptions): Promise { config.method = method; return that.request(configOrUrl, config) } } - post(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - - post(configOrUrl: Omit) - post(configOrUrl: any, extraData?: any, config?: any) { if (isString(configOrUrl)) { config = { @@ -89,10 +86,6 @@ export class FileUpload { return this._generateHTTPMethod(http.RequestMethod.POST)(configOrUrl, config); } - get(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - - get(configOrUrl: Omit) - get(configOrUrl: any, extraData?: any, config?: any) { if (isString(configOrUrl)) { config = { @@ -113,10 +106,6 @@ export class FileUpload { return this._generateHTTPMethod(http.RequestMethod.GET)(configOrUrl, config); } - head(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - - head(configOrUrl: Omit) - head(configOrUrl: any, extraData?: any, config?: any) { if (isString(configOrUrl)) { config = { @@ -137,10 +126,6 @@ export class FileUpload { return this._generateHTTPMethod(http.RequestMethod.HEAD)(configOrUrl, config); } - options(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - - options(configOrUrl: Omit) - options(configOrUrl: any, extraData?: any, config?: any) { if (isString(configOrUrl)) { config = { @@ -161,10 +146,6 @@ export class FileUpload { return this._generateHTTPMethod(http.RequestMethod.OPTIONS)(configOrUrl, config); } - put(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - - put(configOrUrl: Omit) - put(configOrUrl: any, extraData?: any, config?: any) { if (isString(configOrUrl)) { config = { @@ -186,10 +167,6 @@ export class FileUpload { return this._generateHTTPMethod(http.RequestMethod.PUT)(configOrUrl, config); } - delete(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - - delete(configOrUrl: Omit) - delete(configOrUrl: any, extraData?: any, config?: any) { if (isString(configOrUrl)) { config = { @@ -210,10 +187,6 @@ export class FileUpload { return this._generateHTTPMethod(http.RequestMethod.DELETE)(configOrUrl, config); } - trace(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - - trace(configOrUrl: Omit) - trace(configOrUrl: any, extraData?: any, config?: any) { if (isString(configOrUrl)) { config = { @@ -234,10 +207,6 @@ export class FileUpload { return this._generateHTTPMethod(http.RequestMethod.TRACE)(configOrUrl, config); } - connect(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - - connect(configOrUrl: Omit) - connect(configOrUrl: any, extraData?: any, config?: any) { if (isString(configOrUrl)) { config = { @@ -257,4 +226,41 @@ export class FileUpload { return this._generateHTTPMethod(http.RequestMethod.CONNECT)(configOrUrl, config); } -} \ No newline at end of file +} + + +function generateHTTPMethod(method: http.RequestMethod): (configOrUrl: string, config: http.HttpRequestOptions) => Promise { + return function (configOrUrl: any, extraData?: any, config?: any): Promise { + if (isString(configOrUrl)) { + config = { + ...config, + extraData + } + } + + if (isMyHttpRequestOptions(configOrUrl)) { + config = { + ...configOrUrl + } + Reflect.deleteProperty(config, "url"); + configOrUrl = configOrUrl.url; + + } + + if (method === http.RequestMethod.POST && isFormData(config.extraData)) { + if (!config.header) { + config.header = {} + } + config.header["Content-Type"] = "multipart/form-data; boundary=" + config.extraData.boundaryKey; + config.extraData = config.extraData.toArrayBuffer && config.extraData.toArrayBuffer(); + } + config.method = method; + return this.request(configOrUrl, config) + } +} + +const REQUEST_METHOD = ["options", "get", "head", "post", "put", "delete", "trace", "connect"] + +REQUEST_METHOD.forEach(v => { + FileUpload.prototype[v] = generateHTTPMethod(http.RequestMethod[v.toUpperCase()]) +}) \ No newline at end of file diff --git a/commons_fileupload/src/main/ets/components/models/File.ets b/commons_fileupload/src/main/ets/components/models/File.ts similarity index 100% rename from commons_fileupload/src/main/ets/components/models/File.ets rename to commons_fileupload/src/main/ets/components/models/File.ts diff --git a/commons_fileupload/src/main/ets/components/models/FormData.ets b/commons_fileupload/src/main/ets/components/models/FormData.ts similarity index 100% rename from commons_fileupload/src/main/ets/components/models/FormData.ets rename to commons_fileupload/src/main/ets/components/models/FormData.ts diff --git a/commons_fileupload/src/main/ets/components/types/type.ets b/commons_fileupload/src/main/ets/components/types/type.ts similarity index 100% rename from commons_fileupload/src/main/ets/components/types/type.ets rename to commons_fileupload/src/main/ets/components/types/type.ts diff --git a/commons_fileupload/src/main/ets/components/utils/helpers.ets b/commons_fileupload/src/main/ets/components/utils/helpers.ts similarity index 100% rename from commons_fileupload/src/main/ets/components/utils/helpers.ets rename to commons_fileupload/src/main/ets/components/utils/helpers.ts diff --git a/commons_fileupload/src/main/ets/components/utils/log.ets b/commons_fileupload/src/main/ets/components/utils/log.ts similarity index 100% rename from commons_fileupload/src/main/ets/components/utils/log.ets rename to commons_fileupload/src/main/ets/components/utils/log.ts diff --git a/commons_fileupload/src/main/ets/components/utils/utils.ets b/commons_fileupload/src/main/ets/components/utils/utils.ts similarity index 100% rename from commons_fileupload/src/main/ets/components/utils/utils.ets rename to commons_fileupload/src/main/ets/components/utils/utils.ts diff --git a/entry/package.json b/entry/package.json index e7deb82..8a39eaf 100644 --- a/entry/package.json +++ b/entry/package.json @@ -1,16 +1,16 @@ { - "license":"ISC", - "devDependencies":{}, - "name":"entry", - "ohos":{ - "org":"huawei", - "directoryLevel":"module", - "buildTool":"hvigor" + "license": "ISC", + "devDependencies": {}, + "name": "entry", + "ohos": { + "org": "huawei", + "directoryLevel": "module", + "buildTool": "hvigor" }, - "description":"example description", - "repository":{}, - "version":"1.0.0", - "dependencies":{ - "@ohos/commons-fileupload":"file:../commons_fileupload" + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": { + "@ohos/commons-fileupload": "file:../commons_fileupload" } -} \ No newline at end of file +} diff --git a/entry/src/main/ets/pages/UploadFile.ets b/entry/src/main/ets/pages/UploadFile.ets index a653156..822385a 100644 --- a/entry/src/main/ets/pages/UploadFile.ets +++ b/entry/src/main/ets/pages/UploadFile.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { FormData, File, FileUpload } from "@ohos/commons-fileupload" +import {FileUpload,File,FormData} from "@ohos/commons-fileupload" import { log, logError, debug } from "../utils/log" @Entry @Component @@ -28,6 +28,7 @@ struct UploadFile { readTimeout: 60000, connectTimeout: 60000 }) + } build() { @@ -37,6 +38,8 @@ struct UploadFile { Text("第一步:加载文件").fontSize(20).margin({ bottom: 20 }) Row({ space: 10 }) { Button("icon.png").onClick(() => this.loadFileByResource("icon.png")) + Button("test.txt").onClick(() => this.loadFileByResource("test.txt")) + }.padding({ left: 10 }) Text("已加载文件信息:" + this.loadedFileResult).fontSize(20).margin({ top: 10 }).padding({ left: 10 }) @@ -96,6 +99,5 @@ struct UploadFile { logError("this.fileUpload.request 失败" + JSON.stringify(err)) }) - } } \ No newline at end of file diff --git a/entry/src/main/ets/pages/index.ets b/entry/src/main/ets/pages/index.ets index b56e74f..251fc7b 100644 --- a/entry/src/main/ets/pages/index.ets +++ b/entry/src/main/ets/pages/index.ets @@ -19,7 +19,7 @@ import Router from "@ohos.router"; struct Index { private menus = [ { - text:"文件上传", + text:"文件上传Demo演示", path:"pages/UploadFile" } ] diff --git a/entry/src/main/resources/rawfile/test.txt b/entry/src/main/resources/rawfile/test.txt new file mode 100644 index 0000000..f584548 --- /dev/null +++ b/entry/src/main/resources/rawfile/test.txt @@ -0,0 +1 @@ +Hello World!!! \ No newline at end of file -- Gitee From 66b968f7730f1b25ffb1e449aa0ec8e0a0b4e9bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=BF=97=E5=BC=BA?= Date: Wed, 12 Oct 2022 02:11:57 -0700 Subject: [PATCH 7/8] =?UTF-8?q?FileUpload=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨志强 --- build-profile.json5 | 12 - commons_fileupload/index.d.ts | 80 ------- commons_fileupload/package.json | 2 +- .../src/main/ets/components/index.ts | 213 +++++------------- 4 files changed, 56 insertions(+), 251 deletions(-) delete mode 100644 commons_fileupload/index.d.ts diff --git a/build-profile.json5 b/build-profile.json5 index baf6094..d76dcfb 100644 --- a/build-profile.json5 +++ b/build-profile.json5 @@ -1,18 +1,6 @@ { app: { signingConfigs: [ - { - "name": "default", - "material": { - "certpath": "C:\\Users\\Administrator\\.ohos\\config\\openharmony\\auto_ohos_default_com.example.myapplication.cer", - "storePassword": "0000001AE8365E463CAD0DD2FD605E6AC5765451B80EEF11E9701B86E77D39C5FCB8EE69FBFBACBC98C6", - "keyAlias": "debugKey", - "keyPassword": "0000001A5EAF66914210E266C1ADB705F210822C45DB0E9B2D953A6A19C10385CE161DE425C45320592A", - "profile": "C:\\Users\\Administrator\\.ohos\\config\\openharmony\\auto_ohos_default_com.example.myapplication.p7b", - "signAlg": "SHA256withECDSA", - "storeFile": "C:\\Users\\Administrator\\.ohos\\config\\openharmony\\auto_ohos_default_com.example.myapplication.p12" - } - } ], compileSdkVersion: 9, compatibleSdkVersion: 9, diff --git a/commons_fileupload/index.d.ts b/commons_fileupload/index.d.ts deleted file mode 100644 index 9ad673f..0000000 --- a/commons_fileupload/index.d.ts +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the 'License'); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an 'AS IS' BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { MyHttpRequestOptions } from "./src/main/ets/components/types/type"; -import { ConstructOptions } from "./src/main/ets/components/index" - -export class FileUpload { - private constructOptions: ConstructOptions; - - constructor(options: ConstructOptions) - - post(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - - post(configOrUrl: Omit) - - - get(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - - get(configOrUrl: Omit) - - - head(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - - head(configOrUrl: Omit) - - - options(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - - options(configOrUrl: Omit) - - - put(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - - put(configOrUrl: Omit) - - - delete(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - - delete(configOrUrl: Omit) - - - trace(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - - trace(configOrUrl: Omit) - - - connect(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - - connect(configOrUrl: Omit) - -} - - -export class FormData { - static DEFAULT_CONTENT_TYPE:string; - public boundaryKey: string | number; //随机字符串 - constructor(stamp?: string) - append(key: string, value: string | number | File):void - toArrayBuffer(): ArrayBuffer -} - - -export class File { - public fileName: string; - public fileData:string | ArrayBuffer | Uint8Array -} - - diff --git a/commons_fileupload/package.json b/commons_fileupload/package.json index fcb76b2..a44088c 100644 --- a/commons_fileupload/package.json +++ b/commons_fileupload/package.json @@ -1,5 +1,5 @@ { - "types": "./index.d.ts", + "types": "", "keywords": [ "OpenHarmony", "fileUpload", diff --git a/commons_fileupload/src/main/ets/components/index.ts b/commons_fileupload/src/main/ets/components/index.ts index 632de00..27cb35e 100644 --- a/commons_fileupload/src/main/ets/components/index.ts +++ b/commons_fileupload/src/main/ets/components/index.ts @@ -32,15 +32,15 @@ export class FileUpload { this.constructOptions = options; } - private request(url: string, config: http.HttpRequestOptions): Promise { + private request(url: string, options: http.HttpRequestOptions): Promise { if (!url) throw new Error("无效的url"); url = buildUrl(this.constructOptions.baseUrl, url); - config = mergeConfig(this.constructOptions, config); - logger.log(`请求配置:地址--${url} config--${JSON.stringify(config)}`) + options = mergeConfig(this.constructOptions, options); + logger.log(`请求配置:地址--${url} config--${JSON.stringify(options)}`) return new Promise((resolve, reject) => { let httpRequest = http.createHttp(); - httpRequest.request(url, config, (err, data) => { + httpRequest.request(url, options, (err, data) => { if (!err) { resolve(data); } else { @@ -51,15 +51,11 @@ export class FileUpload { }) } - private _generateHTTPMethod(method: http.RequestMethod): (configOrUrl: string, config: http.HttpRequestOptions) => Promise { - var that = this; - return function (configOrUrl: string, config: http.HttpRequestOptions): Promise { - config.method = method; - return that.request(configOrUrl, config) - } - } + private transformParams(method: http.RequestMethod, configOrUrl: any, extraData?: any, config?: any): { + url: string, + options: http.HttpRequestOptions + }{ - post(configOrUrl: any, extraData?: any, config?: any) { if (isString(configOrUrl)) { config = { ...config, @@ -76,191 +72,92 @@ export class FileUpload { } - if (isFormData(config.extraData)) { + if (method === http.RequestMethod.POST && isFormData(config.extraData)) { if (!config.header) { config.header = {} } config.header["Content-Type"] = "multipart/form-data; boundary=" + config.extraData.boundaryKey; config.extraData = config.extraData.toArrayBuffer && config.extraData.toArrayBuffer(); } - return this._generateHTTPMethod(http.RequestMethod.POST)(configOrUrl, config); - } - - get(configOrUrl: any, extraData?: any, config?: any) { - if (isString(configOrUrl)) { - config = { - ...config, - extraData - } - } - - if (isMyHttpRequestOptions(configOrUrl)) { - config = { - ...configOrUrl - } - Reflect.deleteProperty(config, "url"); - configOrUrl = configOrUrl.url; + config.method = method; + return { + url: configOrUrl, + options: config } - return this._generateHTTPMethod(http.RequestMethod.GET)(configOrUrl, config); } - head(configOrUrl: any, extraData?: any, config?: any) { - if (isString(configOrUrl)) { - config = { - ...config, - extraData - } - } - - if (isMyHttpRequestOptions(configOrUrl)) { - config = { - ...configOrUrl - } - Reflect.deleteProperty(config, "url"); - configOrUrl = configOrUrl.url; + post(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - } + post(configOrUrl: Omit) - return this._generateHTTPMethod(http.RequestMethod.HEAD)(configOrUrl, config); + post(configOrUrl: any, extraData?: any, config?: any) { + const {url,options} = this.transformParams(http.RequestMethod.POST, configOrUrl, extraData, config); + return this.request(url, options); } - options(configOrUrl: any, extraData?: any, config?: any) { - if (isString(configOrUrl)) { - config = { - ...config, - extraData - } - } - - if (isMyHttpRequestOptions(configOrUrl)) { - config = { - ...configOrUrl - } - Reflect.deleteProperty(config, "url"); - configOrUrl = configOrUrl.url; + get(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - } + get(configOrUrl: Omit) - return this._generateHTTPMethod(http.RequestMethod.OPTIONS)(configOrUrl, config); + get(configOrUrl: any, extraData?: any, config?: any) { + const {url,options} = this.transformParams(http.RequestMethod.GET, configOrUrl, extraData, config); + return this.request(url, options); } - put(configOrUrl: any, extraData?: any, config?: any) { - if (isString(configOrUrl)) { - config = { - ...config, - extraData - } - } - - if (isMyHttpRequestOptions(configOrUrl)) { - config = { - ...configOrUrl - } - Reflect.deleteProperty(config, "url"); - configOrUrl = configOrUrl.url; - - } + head(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) + head(configOrUrl: Omit) - return this._generateHTTPMethod(http.RequestMethod.PUT)(configOrUrl, config); + head(configOrUrl: any, extraData?: any, config?: any) { + const {url,options} = this.transformParams(http.RequestMethod.HEAD, configOrUrl, extraData, config); + return this.request(url, options); } - delete(configOrUrl: any, extraData?: any, config?: any) { - if (isString(configOrUrl)) { - config = { - ...config, - extraData - } - } - - if (isMyHttpRequestOptions(configOrUrl)) { - config = { - ...configOrUrl - } - Reflect.deleteProperty(config, "url"); - configOrUrl = configOrUrl.url; + options(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - } + options(configOrUrl: Omit) - return this._generateHTTPMethod(http.RequestMethod.DELETE)(configOrUrl, config); + options(configOrUrl: any, extraData?: any, config?: any) { + const {url,options} = this.transformParams(http.RequestMethod.OPTIONS, configOrUrl, extraData, config); + return this.request(url, options); } - trace(configOrUrl: any, extraData?: any, config?: any) { - if (isString(configOrUrl)) { - config = { - ...config, - extraData - } - } - - if (isMyHttpRequestOptions(configOrUrl)) { - config = { - ...configOrUrl - } - Reflect.deleteProperty(config, "url"); - configOrUrl = configOrUrl.url; + put(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - } + put(configOrUrl: Omit) - return this._generateHTTPMethod(http.RequestMethod.TRACE)(configOrUrl, config); + put(configOrUrl: any, extraData?: any, config?: any) { + const {url,options} = this.transformParams(http.RequestMethod.PUT, configOrUrl, extraData, config); + return this.request(url, options); } - connect(configOrUrl: any, extraData?: any, config?: any) { - if (isString(configOrUrl)) { - config = { - ...config, - extraData - } - } - - if (isMyHttpRequestOptions(configOrUrl)) { - config = { - ...configOrUrl - } - Reflect.deleteProperty(config, "url"); - configOrUrl = configOrUrl.url; + delete(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - } + delete(configOrUrl: Omit) - return this._generateHTTPMethod(http.RequestMethod.CONNECT)(configOrUrl, config); + delete(configOrUrl: any, extraData?: any, config?: any) { + const {url,options} = this.transformParams(http.RequestMethod.DELETE, configOrUrl, extraData, config); + return this.request(url, options); } -} + trace(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) -function generateHTTPMethod(method: http.RequestMethod): (configOrUrl: string, config: http.HttpRequestOptions) => Promise { - return function (configOrUrl: any, extraData?: any, config?: any): Promise { - if (isString(configOrUrl)) { - config = { - ...config, - extraData - } - } + trace(configOrUrl: Omit) - if (isMyHttpRequestOptions(configOrUrl)) { - config = { - ...configOrUrl - } - Reflect.deleteProperty(config, "url"); - configOrUrl = configOrUrl.url; + trace(configOrUrl: any, extraData?: any, config?: any) { + const {url,options} = this.transformParams(http.RequestMethod.TRACE, configOrUrl, extraData, config); + return this.request(url, options); + } - } + connect(configOrUrl: string, extraData: MyHttpRequestOptions["extraData"], config?: Pick) - if (method === http.RequestMethod.POST && isFormData(config.extraData)) { - if (!config.header) { - config.header = {} - } - config.header["Content-Type"] = "multipart/form-data; boundary=" + config.extraData.boundaryKey; - config.extraData = config.extraData.toArrayBuffer && config.extraData.toArrayBuffer(); - } - config.method = method; - return this.request(configOrUrl, config) + connect(configOrUrl: Omit) + + connect(configOrUrl: any, extraData?: any, config?: any) { + const {url,options} = this.transformParams(http.RequestMethod.CONNECT, configOrUrl, extraData, config); + return this.request(url, options); } } -const REQUEST_METHOD = ["options", "get", "head", "post", "put", "delete", "trace", "connect"] - -REQUEST_METHOD.forEach(v => { - FileUpload.prototype[v] = generateHTTPMethod(http.RequestMethod[v.toUpperCase()]) -}) \ No newline at end of file -- Gitee From a9e17cd26fdb20e661938b0b8088f6c5a6be2ad7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=BF=97=E5=BC=BA?= Date: Wed, 12 Oct 2022 17:20:33 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=AD=BE=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨志强 --- commons_fileupload/package.json | 34 +++++++++---------- .../src/main/ets/components/index.ts | 2 +- entry/package.json | 26 +++++++------- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/commons_fileupload/package.json b/commons_fileupload/package.json index a44088c..2ad6a6c 100644 --- a/commons_fileupload/package.json +++ b/commons_fileupload/package.json @@ -1,31 +1,31 @@ { - "types": "", - "keywords": [ + "types":"", + "keywords":[ "OpenHarmony", "fileUpload", "request", "file" ], - "author": "ohos_tpc", - "description": "专门为OpenHarmony打造的一款包含基础请求以及文件上传等功能的库", - "ohos": { - "org": "opensource" + "author":"ohos_tpc", + "description":"专门为OpenHarmony打造的一款包含基础请求以及文件上传等功能的库", + "ohos":{ + "org":"opensource" }, - "main": "index.ets", - "repository": "https://gitee.com/openharmony-sig/commons-fileupload", - "version": "0.1.0", - "tags": [ + "main":"index.ets", + "repository":"https://gitee.com/openharmony-sig/commons-fileupload", + "version":"0.1.0", + "tags":[ "OpenHarmony", "fileUpload", "request", "file" ], - "dependencies": { - "mime-types": "^2.1.35" + "dependencies":{ + "mime-types":"^2.1.35" }, - "license": "Apache License 2.0", - "devDependencies": { - "@types/mime-types": "^2.1.1" + "license":"Apache License 2.0", + "devDependencies":{ + "@types/mime-types":"^2.1.1" }, - "name": "@ohos/commons-fileupload" -} + "name":"@ohos/commons-fileupload" +} \ No newline at end of file diff --git a/commons_fileupload/src/main/ets/components/index.ts b/commons_fileupload/src/main/ets/components/index.ts index 27cb35e..657130d 100644 --- a/commons_fileupload/src/main/ets/components/index.ts +++ b/commons_fileupload/src/main/ets/components/index.ts @@ -54,7 +54,7 @@ export class FileUpload { private transformParams(method: http.RequestMethod, configOrUrl: any, extraData?: any, config?: any): { url: string, options: http.HttpRequestOptions - }{ + } { if (isString(configOrUrl)) { config = { diff --git a/entry/package.json b/entry/package.json index 8a39eaf..e7deb82 100644 --- a/entry/package.json +++ b/entry/package.json @@ -1,16 +1,16 @@ { - "license": "ISC", - "devDependencies": {}, - "name": "entry", - "ohos": { - "org": "huawei", - "directoryLevel": "module", - "buildTool": "hvigor" + "license":"ISC", + "devDependencies":{}, + "name":"entry", + "ohos":{ + "org":"huawei", + "directoryLevel":"module", + "buildTool":"hvigor" }, - "description": "example description", - "repository": {}, - "version": "1.0.0", - "dependencies": { - "@ohos/commons-fileupload": "file:../commons_fileupload" + "description":"example description", + "repository":{}, + "version":"1.0.0", + "dependencies":{ + "@ohos/commons-fileupload":"file:../commons_fileupload" } -} +} \ No newline at end of file -- Gitee