diff --git a/src/uni_modules/lz-url_launch/changelog.md b/src/uni_modules/lz-url_launch/changelog.md new file mode 100644 index 0000000..e69de29 diff --git a/src/uni_modules/lz-url_launch/package.json b/src/uni_modules/lz-url_launch/package.json new file mode 100644 index 0000000..4eb775f --- /dev/null +++ b/src/uni_modules/lz-url_launch/package.json @@ -0,0 +1,83 @@ +{ + "id": "lz-url_launch", + "displayName": "lz-url_launch", + "version": "1.0.0", + "description": "lz-url_launch", + "keywords": [ + "lz-url_launch" +], + "repository": "", + "engines": { + "HBuilderX": "^3.6.8" + }, + "dcloudext": { + "type": "uts", + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "", + "data": "", + "permissions": "" + }, + "npmurl": "" + }, + "uni_modules": { + "dependencies": [], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "u", + "aliyun": "u", + "alipay": "u" + }, + "client": { + "Vue": { + "vue2": "y", + "vue3": "y" + }, + "App": { + "app-android": "u", + "app-ios": "y", + "app-harmony": "u" + }, + "H5-mobile": { + "Safari": "u", + "Android Browser": "u", + "微信浏览器(Android)": "u", + "QQ浏览器(Android)": "u" + }, + "H5-pc": { + "Chrome": "u", + "IE": "u", + "Edge": "u", + "Firefox": "u", + "Safari": "u" + }, + "小程序": { + "微信": "u", + "阿里": "u", + "百度": "u", + "字节跳动": "u", + "QQ": "u", + "钉钉": "u", + "快手": "u", + "飞书": "u", + "京东": "u" + }, + "快应用": { + "华为": "u", + "联盟": "u" + } + } + } + } +} \ No newline at end of file diff --git a/src/uni_modules/lz-url_launch/readme.md b/src/uni_modules/lz-url_launch/readme.md new file mode 100644 index 0000000..5390aec --- /dev/null +++ b/src/uni_modules/lz-url_launch/readme.md @@ -0,0 +1,7 @@ +# lz-url_launch +### 开发文档 +[UTS 语法](https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html) +[UTS API插件](https://uniapp.dcloud.net.cn/plugin/uts-plugin.html) +[UTS uni-app兼容模式组件](https://uniapp.dcloud.net.cn/plugin/uts-component.html) +[UTS 标准模式组件](https://doc.dcloud.net.cn/uni-app-x/plugin/uts-vue-component.html) +[Hello UTS](https://gitcode.net/dcloud/hello-uts) \ No newline at end of file diff --git a/src/uni_modules/lz-url_launch/utssdk/app-ios/config.json b/src/uni_modules/lz-url_launch/utssdk/app-ios/config.json new file mode 100644 index 0000000..ec0dcfb --- /dev/null +++ b/src/uni_modules/lz-url_launch/utssdk/app-ios/config.json @@ -0,0 +1,3 @@ +{ + "deploymentTarget": "12" +} diff --git a/src/uni_modules/lz-url_launch/utssdk/app-ios/index.uts b/src/uni_modules/lz-url_launch/utssdk/app-ios/index.uts new file mode 100644 index 0000000..032a3c4 --- /dev/null +++ b/src/uni_modules/lz-url_launch/utssdk/app-ios/index.uts @@ -0,0 +1,10 @@ +import { DispatchQueue } from "UIKit"; +import { SFSafariViewController } from "SafariServices"; + +export const urlLaunch : UrlLaunch = function (url : string) : void { + let urlObject = URL(string = url); + let vc = SFSafariViewController(url = urlObject!) + DispatchQueue.main.async(execute = () : void => { + UTSiOS.getCurrentViewController().present(vc, animated = true); + }); +} \ No newline at end of file diff --git a/src/uni_modules/lz-url_launch/utssdk/interface.uts b/src/uni_modules/lz-url_launch/utssdk/interface.uts new file mode 100644 index 0000000..aa22824 --- /dev/null +++ b/src/uni_modules/lz-url_launch/utssdk/interface.uts @@ -0,0 +1,6 @@ +/** + * interface.uts + * uts插件接口定义文件,按规范定义接口文件可以在HBuilderX中更好的做到语法提示 + */ + +export type UrlLaunch = (url : string) => void \ No newline at end of file diff --git a/src/uni_modules/lz-url_launch/utssdk/unierror.uts b/src/uni_modules/lz-url_launch/utssdk/unierror.uts new file mode 100644 index 0000000..c20aca6 --- /dev/null +++ b/src/uni_modules/lz-url_launch/utssdk/unierror.uts @@ -0,0 +1,39 @@ +/* 此规范为 uni 规范,可以按照自己的需要选择是否实现 */ +import { MyApiErrorCode, MyApiFail } from "./interface.uts" +/** + * 错误主题 + * 注意:错误主题一般为插件名称,每个组件不同,需要使用时请更改。 + * [可选实现] + */ +export const UniErrorSubject = 'uts-api'; + + +/** + * 错误信息 + * @UniError + * [可选实现] + */ +export const MyAPIErrors : Map = new Map([ + /** + * 错误码及对应的错误信息 + */ + [9010001, 'custom error mseeage1'], + [9010002, 'custom error mseeage2'], +]); + + +/** + * 错误对象实现 + */ +export class MyApiFailImpl extends UniError implements MyApiFail { + + /** + * 错误对象构造函数 + */ + constructor(errCode : MyApiErrorCode) { + super(); + this.errSubject = UniErrorSubject; + this.errCode = errCode; + this.errMsg = MyAPIErrors.get(errCode) ?? ""; + } +}