Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
c22d0401
H
Hello UTS
项目概览
DCloud
/
Hello UTS
通知
1595
Star
27
Fork
9
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
2
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
Hello UTS
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
2
Issue
2
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
c22d0401
编写于
7月 26, 2024
作者:
W
wan201809
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/dev' into alpha
上级
8b29cb2a
cbf08261
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
181 addition
and
21 deletion
+181
-21
pages/SDKIntegration/Lottie/index.uvue
pages/SDKIntegration/Lottie/index.uvue
+1
-1
pages/SyntaxCase/MixNativeCode.vue
pages/SyntaxCase/MixNativeCode.vue
+42
-0
pages/advance/advance.uvue
pages/advance/advance.uvue
+8
-0
pages/advance/advance.vue
pages/advance/advance.vue
+2
-1
pages/component/helloView.uvue
pages/component/helloView.uvue
+22
-3
uni_modules/uts-hello-component/utssdk/app-android/index.vue
uni_modules/uts-hello-component/utssdk/app-android/index.vue
+1
-1
uni_modules/uts-platform-api/utssdk/app-android/index.uts
uni_modules/uts-platform-api/utssdk/app-android/index.uts
+5
-5
uni_modules/uts-tests/utssdk/Date.uts
uni_modules/uts-tests/utssdk/Date.uts
+59
-4
uni_modules/uts-tests/utssdk/NativeCode.uts
uni_modules/uts-tests/utssdk/NativeCode.uts
+11
-0
uni_modules/uts-tests/utssdk/UTSJSONObject.uts
uni_modules/uts-tests/utssdk/UTSJSONObject.uts
+12
-4
uni_modules/uts-tests/utssdk/app-android/kotlinCode.kt
uni_modules/uts-tests/utssdk/app-android/kotlinCode.kt
+13
-0
uni_modules/uts-tests/utssdk/index.uts
uni_modules/uts-tests/utssdk/index.uts
+5
-2
未找到文件。
pages/SDKIntegration/Lottie/index.uvue
浏览文件 @
c22d0401
...
...
@@ -66,7 +66,7 @@
},
changeRepeat: function() {
// this.$refs["animView"].updateRepeatConfig
("RESTART");
(this.$refs["animView"] as UtsAnimationViewElement).setRepeatMode
("RESTART");
},
lottieClickTest: function() {
console.log("lottieClickTest");
...
...
pages/SyntaxCase/MixNativeCode.vue
0 → 100644
浏览文件 @
c22d0401
<
template
>
<view>
<page-head
:title=
"title"
></page-head>
<view
class=
"uni-btn-v uni-common-mt"
>
<button
@
tap=
"callKotlinMethodGetInfoTest"
>
调用kotlin方法
</button>
<button
@
tap=
"callJavaMethodGetInfoTest"
>
调用java方法(需自定义基座)
</button>
</view>
</view>
</
template
>
<
script
>
import
{
callKotlinMethodGetInfo
,
callJavaMethodGetInfo
}
from
"
../../uni_modules/uts-syntaxcase
"
;
export
default
{
data
()
{
return
{
title
:
'
UTS混编示例
'
,
}
},
methods
:
{
callKotlinMethodGetInfoTest
:
function
()
{
let
phoneInfo
=
callKotlinMethodGetInfo
();
uni
.
showToast
({
title
:
phoneInfo
})
},
callJavaMethodGetInfoTest
:
function
()
{
let
javaInfo
=
callJavaMethodGetInfo
();
uni
.
showToast
({
title
:
javaInfo
})
},
}
}
</
script
>
<
style
>
</
style
>
\ No newline at end of file
pages/advance/advance.uvue
浏览文件 @
c22d0401
...
...
@@ -92,6 +92,14 @@
name: "console示例",
url: "SyntaxCase/consoleTest"
}] as Page[]
},
{
name: "组件开发示例",
open: false,
pages: [{
name: "Hello UTS Component",
url: "component/helloView"
}]
},
{
name: "平台代码示例",
...
...
pages/advance/advance.vue
浏览文件 @
c22d0401
...
...
@@ -119,7 +119,8 @@
},{
name
:
"
实例测试示例
"
,
url
:
"
SyntaxCase/instanceTest
"
}]
}
]
},
{
name
:
"
日志打印
"
,
...
...
pages/component/helloView.uvue
浏览文件 @
c22d0401
<template>
<view>
暂时不支持 todo
</view>
<div>
<button @tap="doSth">调用组件的方法</button>
<uts-hello-view ref="helloView" buttonText="点击按钮内容" style="width:375px;height: 375px;background-color: aqua;"></uts-hello-view>
<uts-hello-container>
<text>文本组件</text>
<image src="../../static/logo.png" mode="aspectFit"></image>
</uts-hello-container>
</div>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
// 调用组件内的方法
doSth() {
// uvue 页面调用方法
(this.$refs["helloView"] as UtsHelloViewElement).doSth("param doSomething");
}
}
}
</script>
<style>
...
...
uni_modules/uts-hello-component/utssdk/app-android/index.vue
浏览文件 @
c22d0401
...
...
@@ -128,7 +128,7 @@
// 组件内可以调用 UTSAndroid 内置方法
console
.
log
(
"
UTSAndroid.devicePX2px(1080) :
"
,
UTSAndroid
.
devicePX2px
(
1080
))
console
.
log
(
"
UTSAndroid.rpx2px(1080) :
"
,
UTSAndroid
.
rpx2px
(
1080
))
console
.
log
(
"
UTSAndroid.appJSBundleUrl() :
"
,
UTSAndroid
.
appJSBundleUrl
())
//
console.log("UTSAndroid.appJSBundleUrl() : ",UTSAndroid.appJSBundleUrl())
},
/**
* 原生View布局完成
...
...
uni_modules/uts-platform-api/utssdk/app-android/index.uts
浏览文件 @
c22d0401
...
...
@@ -203,7 +203,7 @@ export function gotoCameraTake(imageDone : (event : string) => void) : boolean {
}
}, function (_ : boolean, _ : string[]) {
//callback(false,"用户拒绝了部分权限")
})
}
,true
)
return true;
...
...
@@ -336,7 +336,7 @@ export function arrayPermissionFlowTest(callback : (ret : boolean, desc : string
*/
let permissionNeed = ["android.permission.WRITE_EXTERNAL_STORAGE", "android.permission.ACCESS_FINE_LOCATION", "android.permission.READ_PHONE_STATE"]
if (UTSAndroid.getSystemPermissionDenied(UTSAndroid.getUniActivity()!, permissionNeed).
isEmpty()
) {
if (UTSAndroid.getSystemPermissionDenied(UTSAndroid.getUniActivity()!, permissionNeed).
length == 0
) {
callback(false, "已具备请求权限")
return;
}
...
...
@@ -345,7 +345,7 @@ export function arrayPermissionFlowTest(callback : (ret : boolean, desc : string
if (allRight) {
// 交给目前的location 引擎,真实执行
// 测试权限api 返回值
if (
!UTSAndroid.getSystemPermissionDenied(UTSAndroid.getUniActivity()!, permissionNeed).isEmpty()
) {
if (
UTSAndroid.getSystemPermissionDenied(UTSAndroid.getUniActivity()!, permissionNeed).length > 0
) {
// 预期当前基座具备了读写日历的权限
callback(false, "权限请求完成,getSystemPermissionDenied 失败")
return;
...
...
@@ -483,7 +483,7 @@ export function singlePermissionFlowTest(callback : (ret : boolean, desc : strin
}
let permissionNeed = ["android.permission.READ_PHONE_STATE"]
if (UTSAndroid.getSystemPermissionDenied(UTSAndroid.getUniActivity()!, permissionNeed).
isEmpty()
) {
if (UTSAndroid.getSystemPermissionDenied(UTSAndroid.getUniActivity()!, permissionNeed).
length == 0
) {
callback(false, "已具备权限")
return;
}
...
...
@@ -491,7 +491,7 @@ export function singlePermissionFlowTest(callback : (ret : boolean, desc : strin
UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, permissionNeed, function (allRight : boolean, _ : string[]) {
if (allRight) {
// 测试权限api 返回值
if (
!UTSAndroid.getSystemPermissionDenied(UTSAndroid.getUniActivity()!, permissionNeed).isEmpty()
) {
if (
UTSAndroid.getSystemPermissionDenied(UTSAndroid.getUniActivity()!, permissionNeed).length > 0
) {
callback(false, "权限请求完成,getSystemPermissionDenied 失败")
return;
}
...
...
uni_modules/uts-tests/utssdk/Date.uts
浏览文件 @
c22d0401
...
...
@@ -25,11 +25,66 @@ export function testDate() : Result {
})
test('new Date', () => {
let date1 = new Date('1992-02-02');
console.log("1111",date1.getTime())
expect(date1.getTime()).toEqual(696988800000);
let date2 = new Date('1992-2-02');
console.log("2222",date2.getTime())
// expect(date2.getTime()).toEqual(696960000000);
// #ifdef APP-ANDROID
/**
* iso 8601 相关
*/
let isoCaseArr = [
"2012",
"2012-07",
"1997-07-16",
"1997-07-16T02:20:20",
"1995-12-17T03:24:00.888Z",
"2022-11-19T00:00:00.666+04:00",
"1997-07-16T19:20+01:00",
"1997-07-16T19:20:30+01:00",
"1997-07-16T19:20:30.45+01:00",
"1994-11-05T08:15:30-05:00"
];
let timeStr = ""
for(let i = 0; i < isoCaseArr.length; i++){
let perDate = new Date(isoCaseArr[i])
timeStr += perDate.getTime()
}
expect(timeStr).toEqual("132537600000013411008000008690112000008689908200008191706408881668801600666869077200000869077230000869077230450784041330000");
timeStr = ""
let rfcCaseArr = [
"Dec 25, 1995",
"17 Dec 1995 03:24:00 GMT",
"December 17, 1995 03:24:00",
"December 17, 95 03:24:00",
"December 17, 95 03:24",
"December 17, 95 03:24:00 GMT+11:00",
"December 17, 1995, 03:24:00 GMT+11:00",
];
for(let i = 0; i < rfcCaseArr.length; i++){
let perDate = new Date(rfcCaseArr[i])
timeStr += perDate.getTime()
}
expect(timeStr).toEqual("819820800000819170640000819141840000819141840000819141840000819131040000819131040000");
timeStr = ""
let otherCaseArr = [
"2024-5-01",
"2024-05-01 22:00",
"2024/05/01 22:00:00",
"2024/05/01 22:00",
"2024/5/1 22:00:00",
"2024/5/1 22:00",
"2024/5/1"
];
for(let i = 0; i < otherCaseArr.length; i++){
let perDate = new Date(otherCaseArr[i])
timeStr += perDate.getTime()
}
expect(timeStr).toEqual("1714492800000171457200000017145720000001714572000000171457200000017145720000001714492800000");
// #endif
})
test('valueOf', () => {
...
...
uni_modules/uts-tests/utssdk/NativeCode.uts
0 → 100644
浏览文件 @
c22d0401
import { describe, test, expect, Result } from './tests.uts'
export function testNativeCode(): Result {
return describe("mix-native-code-work", () => {
test('getStrFromNativeCode', () => {
// #ifdef APP-ANDROID
expect(NativeCode.getNativeStr()).toEqual("android-code");
// #endif
})
})
}
uni_modules/uts-tests/utssdk/UTSJSONObject.uts
浏览文件 @
c22d0401
...
...
@@ -22,13 +22,21 @@ export function testUTSJSONObject() : Result {
expect(returnedTarget.toMap().size).toEqual(3);
type A = {
username:
"张三",
age:
12
username:
string
age:
number
}
type C = {
work:
0.001
work:
number
}
let b = UTSJSONObject.assign(new A("张三",12),{b:2},new C(0.002))
let b = UTSJSONObject.assign( {
username:"张三",
age:12
} as A,
{b:2},
{
work:0.002
} as C)
expect(b['age']).toEqual(12);
expect(b['username']).toEqual("张三");
expect(b['b']).toEqual(2);
...
...
uni_modules/uts-tests/utssdk/app-android/kotlinCode.kt
0 → 100644
浏览文件 @
c22d0401
package
uts.sdk.modules.utsTests
import
android.os.Build
import
io.dcloud.uts.UTSAndroid
object
NativeCode
{
fun
getNativeStr
():
String
{
return
"android-code"
}
}
\ No newline at end of file
uni_modules/uts-tests/utssdk/index.uts
浏览文件 @
c22d0401
...
...
@@ -18,6 +18,7 @@ import { testGlobal } from './Global.uts'
import { testType } from './Type.uts'
export { Result } from './tests.uts'
import { testArrayBuffer } from './ArrayBuffer.uts'
import { testNativeCode } from './NativeCode.uts'
// Promise、Proxy、Reflect、Weakmap、WeakSet 不支持
...
...
@@ -40,7 +41,8 @@ export function runTests() : UTSJSONObject {
const JSONLargeRes = testJSONLarge();
const consoleRes = testConsole();
const UTSJSONObjectRes = testUTSJSONObject();
const ArrayBufferRes = testArrayBuffer();
const ArrayBufferRes = testArrayBuffer();
const NativeCodeRes = testNativeCode();
return {
Array: ArrayRes,
Date: DateRes,
...
...
@@ -60,6 +62,7 @@ export function runTests() : UTSJSONObject {
Type: TypeRes,
console:consoleRes,
UTSJSONObject:UTSJSONObjectRes,
ArrayBuffer:ArrayBufferRes
ArrayBuffer:ArrayBufferRes,
NativeCode:NativeCodeRes
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录