This commit is contained in:
2026-09-24 16:25:22 +08:00
commit 7428184f01
1198 changed files with 314515 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
## 1.0.32025-07-25
* 兼容原生鸿蒙
## 1.0.22025-03-15
* 兼容ios16+
## 1.0.12025-02-10
* 兼容微信
## 1.0.02024-08-24
首次发布
+97
View File
@@ -0,0 +1,97 @@
{
"id": "x-openweb",
"displayName": "x-openweb",
"version": "1.0.1",
"description": "x-openweb",
"keywords": [
"x-openweb"
],
"repository": "",
"engines": {
"HBuilderX": "^3.6.8",
"uni-app": "^3.1.0",
"uni-app-x": "^3.1.0"
},
"dcloudext": {
"type": "uts",
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "",
"data": "",
"permissions": ""
},
"npmurl": "",
"darkmode": "-",
"i18n": "-",
"widescreen": "-"
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "-",
"aliyun": "-",
"alipay": "-"
},
"client": {
"uni-app": {
"vue": {
"vue2": "-",
"vue3": "-"
},
"web": {
"safari": "-",
"chrome": "-"
},
"app": {
"vue": "-",
"nvue": "-",
"android": "-",
"ios": "-",
"harmony": "-"
},
"mp": {
"weixin": "-",
"alipay": "-",
"toutiao": "-",
"baidu": "-",
"kuaishou": "-",
"jd": "-",
"harmony": "-",
"qq": "-",
"lark": "-"
},
"quickapp": {
"huawei": "-",
"union": "-"
}
},
"uni-app-x": {
"web": {
"safari": "-",
"chrome": "-"
},
"app": {
"android": "-",
"ios": "-",
"harmony": "-"
},
"mp": {
"weixin": "-"
}
}
}
}
}
}
+27
View File
@@ -0,0 +1,27 @@
# x-openweb
### 开发文档
[TMUI4.0文档](https://xui.tmui.design/)
[TMUI4.0组件库](https://ext.dcloud.net.cn/plugin?id=16369)
应用app打开外链或者h5打开链接使用.
微信使用的是webview,因为你的小程序需要企业帐号权限,个人小程序无法使用。
### 说明
这是tmui4.0|XUI的原生插件附赠插件
### 兼容性
| Harmony | IOS | Android | WEB | 小程序 |
| --- | --- | --- | --- | --- |
| 支持 | 支持 | 支持 | 支持 | 支持 |
### 使用
如果是安卓请务必打自定义基座,如果ios:你在mac环境下配置好了环境无需打包本地编译,如果win开发ios需要打包基座。
```ts
import {openWeb} from "@/uni_modules/x-openweb"
openWeb(url)
```
@@ -0,0 +1,3 @@
{
"minSdkVersion": "21"
}
@@ -0,0 +1,8 @@
import Intent from 'android.content.Intent';
import Uri from 'android.net.Uri';
import Activity from 'android.app.Activity';
export function openWeb(url : string) {
let intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url))
let ac = UTSAndroid.getUniActivity() as Activity
ac.startActivity(intent)
}
@@ -0,0 +1,5 @@
{
"dependencies": {
"x_library_s": "./lib/x_library_s.har"
}
}
@@ -0,0 +1,10 @@
import { x_openweb } from "x_library_s";
import { BusinessError } from "@kit.BasicServicesKit";
export function openWeb(url : string) {
const context = UTSHarmony.getCurrentWindow()!.getUIContext();
x_openweb(context,url)
.catch((error:boolean)=>{
console.error("TMUI","打开失败")
})
}
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyAccessedAPITypes</key>
<array/>
<key>NSPrivacyCollectedDataTypes</key>
<array/>
<key>NSPrivacyTracking</key>
<false/>
<key>NSPrivacyTrackingDomains</key>
<array/>
</dict>
</plist>
@@ -0,0 +1,3 @@
{
"deploymentTarget": "12"
}
@@ -0,0 +1,16 @@
import { URL } from 'Foundation';
import { UIApplication } from 'UIKit';
export function openWeb(url : string) {
let href = new URL(string = url)
if (UTSiOS.available("iOS 16.0, *")) {
if (UIApplication.shared.canOpenURL(href!)) {
UIApplication.shared.open(href!, options= new Map(), completionHandler= nil)
}
}else{
if (UIApplication.shared.canOpenURL(href!)) {
UIApplication.shared.openURL(href!)
}
}
}
@@ -0,0 +1,45 @@
/**
* interface.uts
* uts插件接口定义文件,按规范定义接口文件可以在HBuilderX中更好的做到语法提示
*/
/**
* myApi 异步函数的参数,在type里定义函数需要的参数以及api成功、失败的相关回调函数。
*/
export type MyApiOptions = {
paramA : boolean
success ?: (res : MyApiResult) => void
fail ?: (res : MyApiFail) => void
complete ?: (res : any) => void
}
/**
* 函数返回结果
* 可以是void, 基本数据类型,自定义type, 或者其他类型。
* [可选实现]
*/
export type MyApiResult = {
fieldA : number,
fieldB : boolean,
fieldC : string
}
/**
* 错误码
* 根据uni错误码规范要求,建议错误码以90开头,以下是错误码示例:
* - 9010001 错误信息1
* - 9010002 错误信息2
*/
export type MyApiErrorCode = 9010001 | 9010002;
/**
* myApi 的错误回调参数
*/
export interface MyApiFail extends IUniError {
errCode : MyApiErrorCode
};
/* 异步函数定义 */
export type MyApi = (options : MyApiOptions) => void
/* 同步函数定义 */
export type MyApiSync = (paramA : boolean) => MyApiResult
@@ -0,0 +1,4 @@
export function openWeb(url : string) {
wx.openUrl ({ url:url, complete: console.log } )
}
+39
View File
@@ -0,0 +1,39 @@
/* 此规范为 uni 规范,可以按照自己的需要选择是否实现 */
import { MyApiErrorCode, MyApiFail } from "./interface.uts"
/**
* 错误主题
* 注意:错误主题一般为插件名称,每个组件不同,需要使用时请更改。
* [可选实现]
*/
export const UniErrorSubject = 'uts-api';
/**
* 错误信息
* @UniError
* [可选实现]
*/
export const MyAPIErrors : Map<MyApiErrorCode, string> = 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) ?? "";
}
}
@@ -0,0 +1,4 @@
export function openWeb(url : string) {
location.href = url;
}