diff --git a/pages.json b/pages.json
index 6dfacdf4c32bfc91dfc2a9a39d1c11c6f5bb36cd..5e6eb3212a1dba6ff26aa24b06003fe7a8b4a0d0 100644
--- a/pages.json
+++ b/pages.json
@@ -1932,6 +1932,13 @@
"navigationBarTitleText": ""
}
},
+ {
+ "path" : "pages/API/dialog-page/uts-dialog-page",
+ "style" :
+ {
+ "navigationBarTitleText" : ""
+ }
+ },
// #endif
// #ifdef APP
{
diff --git a/pages/API/dialog-page/uts-dialog-page.uvue b/pages/API/dialog-page/uts-dialog-page.uvue
new file mode 100644
index 0000000000000000000000000000000000000000..26fa9dc59f09745ff8dd6fa66f664fcebcfca9d5
--- /dev/null
+++ b/pages/API/dialog-page/uts-dialog-page.uvue
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/API/event-bus/uts-event-bus.test.js b/pages/API/event-bus/uts-event-bus.test.js
index 83bd671503f9987b31d110d1dba5dbccbd0c8c1b..b130f8ea488866c8fa132847b6b1094dd8ce4b3d 100644
--- a/pages/API/event-bus/uts-event-bus.test.js
+++ b/pages/API/event-bus/uts-event-bus.test.js
@@ -34,14 +34,31 @@ describe('event-bus', () => {
await page.callMethod('JsOnUts')
await page.callMethod('emitFromUts')
const l1 = (await page.data()).log.length
- expect(l1).toBeGreaterThan(0)
+ expect(l1).toBeGreaterThan(0)
+
+ await page.callMethod('clear')
+ await page.callMethod('emitUtsMessageUTSObject')
+ const data = await page.data()
+ console.log(data)
+ expect(data.log.length).toBe(1)
+ expect(data.log[0].name).toMatch('金运大厦')
+
+ await page.callMethod('clear')
+ await page.callMethod('emitUtsMessages')
+ const l12 = (await page.data()).log.length
+ expect(l12).toBe(2)
+ await page.callMethod('clear')
+ await page.callMethod('emitUtsMessageNoArgument')
+ const l13 = (await page.data()).log.length
+ expect(l13).toBe(0)
await page.callMethod('clear')
await page.callMethod('offUts')
await page.callMethod('emitFromUts')
const l2 = (await page.data()).log.length
- expect(l2).toBe(0)
+ expect(l2).toBe(0)
+
await page.callMethod('clear')
await page.callMethod('UtsOnJS')
diff --git a/pages/API/event-bus/uts-event-bus.uvue b/pages/API/event-bus/uts-event-bus.uvue
index 6e554582b5c2770e2c4c3b5e30e62f0e9ea515f8..2dab4b0a9f55c70e3a793da118f2ee3b9765dd95 100644
--- a/pages/API/event-bus/uts-event-bus.uvue
+++ b/pages/API/event-bus/uts-event-bus.uvue
@@ -4,11 +4,15 @@
-
-
+
+
+
+
+
-
+
+
@@ -29,7 +33,10 @@
import {
onJsMessage,
offJsMessage,
- emitUtsMessage,
+ emitUtsMessage,
+ emitUtsMessageUTSObject,
+ emitUtsMessageNoArgument,
+ emitUtsMessages,
getMessageChannel,
getRevJsMessage,
clearJsMessage,
@@ -44,10 +51,15 @@
}
},
methods: {
- fn(res : string, res2 : string) {
- console.log("on rev: " + res)
- this.log.push(res)
- this.log.push(res2)
+ fn(res : any, res2 : any) {
+ if (res != null){
+ console.log("on rev: " + JSON.stringify(res))
+ this.log.push(res)
+ }
+ if (res2 != null) {
+ console.log("on rev: " + JSON.stringify(res2))
+ this.log.push(res2)
+ }
},
fn2(res : string) {
this.log.push(res)
@@ -61,6 +73,25 @@
},
emitFromUts() {
emitUtsMessage("emit form uts")
+ },
+ emitUtsMessageUTSObject() {
+ emitUtsMessageUTSObject({
+ latitude: 39.951028,
+ longitude: 116.354662,
+ name: '金运大厦',
+ address: '西直门北大街xx号'
+ })
+ },
+ emitUtsMessages() {
+ emitUtsMessages({
+ latitude: 39.951028,
+ longitude: 116.354662,
+ name: '金运大厦',
+ address: '西直门北大街xx号'
+ }, "emit form uts")
+ },
+ emitUtsMessageNoArgument() {
+ emitUtsMessageNoArgument()
},
JsOnUtsOnce() {
uni.$once(getMessageChannel(), this.fn2)
@@ -82,6 +113,20 @@
if (msg && msg.length){
this.log.push(msg)
}
+ },
+ emitFormJSObject() {
+ clearJsMessage()
+ uni.$emit("JsMessage", {
+ latitude: 39.951028,
+ longitude: 116.354662,
+ name: '金运大厦form js',
+ address: '西直门北大街xx号 from js'
+ })
+ let msg = getRevJsMessage()
+ console.log("message:"+msg)
+ if (msg && msg.length){
+ this.log.push(msg)
+ }
},
clear() {
clearJsMessage()
diff --git a/uni_modules/uts-dialogpage/changelog.md b/uni_modules/uts-dialogpage/changelog.md
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uts-dialogpage/package.json b/uni_modules/uts-dialogpage/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..d655ddfc67484bbfab467d66103abd65588418ef
--- /dev/null
+++ b/uni_modules/uts-dialogpage/package.json
@@ -0,0 +1,82 @@
+{
+ "id": "uts-dialogpage",
+ "displayName": "uts-dialogpage",
+ "version": "1.0.0",
+ "description": "uts-dialogpage",
+ "keywords": [
+ "uts-dialogpage"
+],
+ "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": "u",
+ "vue3": "u"
+ },
+ "App": {
+ "app-android": "u",
+ "app-ios": "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/uni_modules/uts-dialogpage/readme.md b/uni_modules/uts-dialogpage/readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..7fe7d7d5732fffe41c3b29c0182bb2802771b600
--- /dev/null
+++ b/uni_modules/uts-dialogpage/readme.md
@@ -0,0 +1,6 @@
+# uts-dialogpage
+### 开发文档
+[UTS 语法](https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html)
+[UTS API插件](https://uniapp.dcloud.net.cn/plugin/uts-plugin.html)
+[UTS 组件插件](https://uniapp.dcloud.net.cn/plugin/uts-component.html)
+[Hello UTS](https://gitcode.net/dcloud/hello-uts)
\ No newline at end of file
diff --git a/uni_modules/uts-dialogpage/utssdk/app-ios/config.json b/uni_modules/uts-dialogpage/utssdk/app-ios/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..ec0dcfb1579d5327e81c25ee5e8d78034dfff3c4
--- /dev/null
+++ b/uni_modules/uts-dialogpage/utssdk/app-ios/config.json
@@ -0,0 +1,3 @@
+{
+ "deploymentTarget": "12"
+}
diff --git a/uni_modules/uts-dialogpage/utssdk/app-ios/index.uts b/uni_modules/uts-dialogpage/utssdk/app-ios/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..a1882d62a4f511b09b298662d0141a6d81aae94c
--- /dev/null
+++ b/uni_modules/uts-dialogpage/utssdk/app-ios/index.uts
@@ -0,0 +1,65 @@
+/**
+ * 引用 iOS 系统库,示例如下:
+ * import { UIDevice } from "UIKit";
+ * [可选实现,按需引入]
+ */
+
+// import {OpenDialogPageOptions,openDialogPage} from "DCloudUTSExtAPI";
+
+/* 引入 interface.uts 文件中定义的变量 */
+import { TestOpenDialogPage, TestCloseDialogPage } from '../interface.uts';
+
+var curDialogPage : UniDialogPage | null = null
+export const testOpenDialogPage : TestOpenDialogPage = function (url:string) {
+
+ // let utsJsonObj : DCloudUTSExtAPI.OpenDialogPageOptions = {
+ // url:"zhangsan"
+ // }
+ console.log("testOpenDialogPage")
+
+ // let option = new OpenDialogPageOptions({
+ // url:url
+ // })
+ let option = new OpenDialogPageOptions()
+ option.url = url
+ console.log(url)
+
+ option.animationType ="slide-in-left"
+ // option.parentPage = getCurrentPages()[0]
+
+ option.success = (arg : OpenDialogPageSuccess )=>{
+ console.log("success")
+ }
+ option.complete = (arg : OpenDialogPageComplete )=>{
+ console.log(arg)
+ }
+
+ option.fail = (arg : OpenDialogPageFail )=>{
+ console.log("fail")
+ }
+ curDialogPage = uni.openDialogPage(option)
+}
+
+export const testCloseDialogPage : TestCloseDialogPage = function () {
+ console.log("testCloseDialogPage")
+ if ( curDialogPage != null ){
+ let option = new CloseDialogPageOptions()
+ option.dialogPage = curDialogPage
+
+ option.success = (arg : CloseDialogPageSuccess )=>{
+ console.log("success")
+ }
+ option.complete = (arg : CloseDialogPageComplete )=>{
+ console.log(arg)
+ }
+
+ option.fail = (arg : CloseDialogPageFail )=>{
+ console.log("fail")
+ }
+ uni.closeDialogPage(option)
+ }
+}
+
+/**
+ * 更多插件开发的信息详见:https://uniapp.dcloud.net.cn/plugin/uts-plugin.html
+ */
diff --git a/uni_modules/uts-dialogpage/utssdk/interface.uts b/uni_modules/uts-dialogpage/utssdk/interface.uts
new file mode 100644
index 0000000000000000000000000000000000000000..8cd8c84e6dfebd1ef009a0ab81994e8794dab669
--- /dev/null
+++ b/uni_modules/uts-dialogpage/utssdk/interface.uts
@@ -0,0 +1,6 @@
+/**
+ * interface.uts
+ * uts插件接口定义文件,按规范定义接口文件可以在HBuilderX中更好的做到语法提示
+ */
+export type TestOpenDialogPage = (url:string)=>void
+export type TestCloseDialogPage = ()=>void
\ No newline at end of file
diff --git a/uni_modules/uts-dialogpage/utssdk/unierror.uts b/uni_modules/uts-dialogpage/utssdk/unierror.uts
new file mode 100644
index 0000000000000000000000000000000000000000..c20aca6dd9198f9fa2de2514dc419c18cbe04e57
--- /dev/null
+++ b/uni_modules/uts-dialogpage/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) ?? "";
+ }
+}
diff --git a/uni_modules/uts-eventbus/utssdk/app-ios/index.uts b/uni_modules/uts-eventbus/utssdk/app-ios/index.uts
index 4b88bfb5fdcf6fe9fd2e110b16b1dd0af70dde5c..666fa3e6768c97c12263a6727ddc61146252327e 100644
--- a/uni_modules/uts-eventbus/utssdk/app-ios/index.uts
+++ b/uni_modules/uts-eventbus/utssdk/app-ios/index.uts
@@ -17,19 +17,30 @@ export function emitUtsMessage(arg : string) {
uni.$emit(MessageChannel, arg);
}
+export function emitUtsMessageUTSObject(arg : UTSJSONObject) {
+ uni.$emit(MessageChannel, arg);
+}
+
+export function emitUtsMessages(arg : UTSJSONObject, arg2 : string ){
+ uni.$emit(MessageChannel, arg, arg2);
+}
+
+export function emitUtsMessageNoArgument(){
+ uni.$emit(MessageChannel);
+}
+
var callbackId : NSNumber | null = null
export function onJsMessage (messageChannel : string ) {
revFromJS = ""
if (callbackId != null) {
uni.$off(messageChannel, callbackId!)
- callbackId = null
+ callbackId = null
}
-
callbackId = uni.$on(messageChannel, function (...spreadArgs : Any) {
if (spreadArgs.length > 0) {
- let arg0 = spreadArgs[0] as String | null
- if ( arg0 != null ){
- revFromJS = arg0!;
+ let arg0 = JSON.stringify(spreadArgs[0])
+ if ( typeof arg0 == "string" ) {
+ revFromJS = arg0!
}
}
})
@@ -39,20 +50,21 @@ export function onJsMessageOnce (messageChannel : string ) {
revFromJS = ""
uni.$once(messageChannel, function (...spreadArgs : Any) {
if (spreadArgs.length > 0) {
- let arg0 = spreadArgs[0] as String | null
- if ( arg0 != null ){
- revFromJS = arg0!;
- }
+ let arg0 = JSON.stringify(spreadArgs[0])
+ if ( typeof arg0 == "string" ) {
+ revFromJS = arg0!
+ }
}
})
}
export function offJsMessage(messageChannel : string) {
if (callbackId != null) {
- uni.$off(messageChannel, callbackId!)
+ uni.$off(messageChannel, callbackId!)
+ callbackId = null
}
}
export function clearJsMessage() {
revFromJS = ""
-}
\ No newline at end of file
+}