提交 9514d935 编写于 作者: 杜庆泉's avatar 杜庆泉

uni-app x 增加lottie示例 & 更新语法测试示例

上级 8f162371
......@@ -8,10 +8,10 @@
<button @tap="changeAction(1)">测试action play</button>
<button @tap="changeAction(2)">测试action pause</button>
<button @tap="changeAction(3)">测试action stop</button>
<!-- <uts-animation-view ref="animView" :path="animUrl" :autoplay="autoplay" :loop="loop" :action="action"
<uts-animation-view ref="animView" :path="animUrl" :autoplay="autoplay" :loop="loop" :action="action"
:hidden="hidden" @bindended="testAnimEnd" @click="lottieClickTest" @longpress="lottieLongpressTest"
:style="{width:widthNum+'rpx',height:heightNum+'px',background:yanse}">
</uts-animation-view> -->
</uts-animation-view>
</div>
</template>
......
......@@ -11,13 +11,13 @@
</view>
</template>
<script lang="ts">
// import {
// checkHasIntegration
// } from "@/uni_modules/uts-tencentgeolocation";
import {
checkHasIntegration
} from "@/uni_modules/uts-tencentgeolocation";
// import {
// checkHasLottieIntegration
// } from "@/uni_modules/uts-animation-view";
import {
checkHasLottieIntegration
} from "@/uni_modules/uts-animation-view";
type ListItem = {
name : string,
......@@ -66,14 +66,29 @@
})
},
gotoLottie: function () {
if (checkHasLottieIntegration()) {
uni.navigateTo({
url: '/pages/SDKIntegration/Lottie/index'
})
} else {
uni.showToast({
title:'暂时不支持uni-appx'
icon: 'none',
title: '需要在自定义基座中运行'
})
}
},
gotoTencentLocation: function () {
let ret = checkHasIntegration();
if (!ret) {
uni.showToast({
title:'暂时不支持uni-appx'
icon: 'none',
title: '需要在自定义基座中运行'
})
} else {
uni.navigateTo({
url: '/pages/SDKIntegration/TencentLocation/TencentLocation'
})
}
},
gotoTencentMap: function () {
uni.navigateTo({
......
......@@ -173,38 +173,24 @@
this.testUtsSyncWithCallbackResult['return'] = false;
this.testUtsSyncWithCallbackResult['success'] = false;
this.testUtsSyncWithCallbackResult['complete'] = false;
let option = new AsyncOptions(
"success",
(res:string) => {
if (
testSyncWithCallback({
type: "success",
success: (res:any) => {
console.log("testSyncWithCallback.success.callback", res);
this.testUtsSyncWithCallbackResult['success'] = true;
},
(res:string) => {
fail: (res:any) => {
console.log("testSyncWithCallback.fail.callback", res);
// testUtsSyncWithCallbackResult.fail = true;
},
(res:string) => {
complete: (res:any) => {
console.log("testSyncWithCallback.complete.callback", res);
this.testUtsSyncWithCallbackResult['complete'] = true;
},
)
if (
testSyncWithCallback(option)['name'] === "testSyncWithCallback"
// testSyncWithCallback({
// type: "success",
// success: (res:any) => {
// console.log("testSyncWithCallback.success.callback", res);
// this.testUtsSyncWithCallbackResult['success'] = true;
// },
// fail: (res:any) => {
// console.log("testSyncWithCallback.fail.callback", res);
// // testUtsSyncWithCallbackResult.fail = true;
// },
// complete: (res:any) => {
// console.log("testSyncWithCallback.complete.callback", res);
// this.testUtsSyncWithCallbackResult['complete'] = true;
// },
// }).name === "testSyncWithCallback"
} as AsyncOptions)['name'] === "testSyncWithCallback"
) {
this.testUtsSyncWithCallbackResult['return'] = true;
}
......@@ -215,22 +201,22 @@
this.testUtsAsyncResult['success'] = false;
// testUtsAsyncResult.fail = false;
this.testUtsAsyncResult['complete'] = false;
let option = new AsyncOptions(
"success",
(res:any) => {
try {
const res = await testAsync({
type:"success",
success:(res:any) => {
console.log("testAsync.success.callback", res);
this.testUtsAsyncResult['success'] = true;
},
(res:any) => {
fail:(res:any) => {
console.log("testAsync.fail.callback", res);
},
(res:any) => {
complete:(res:any) => {
console.log("testAsync.complete.callback", res);
this.testUtsAsyncResult['complete'] = true;
},
)
try {
const res = await testAsync(option);
} as AsyncOptions);
if (res.name === "testAsync") {
this.testUtsAsyncResult['return'] = true;
}
......@@ -242,22 +228,22 @@
this.testUtsAsyncMulitParamResult['return'] = false;
this.testUtsAsyncMulitParamResult['success'] = false;
this.testUtsAsyncMulitParamResult['complete'] = false;
let option = AsyncOptions(
"success",
(res) => {
try {
const res = await testAsyncParam3(100,"hello",{
type:"success",
success:(res) => {
console.log("testUtsAsyncMulitParam.success.callback", res);
this.testUtsAsyncMulitParamResult['success'] = true;
},
(res) => {
fail:(res) => {
console.log("testUtsAsyncMulitParam.fail.callback", res);
},
(res) => {
complete:(res) => {
console.log("testUtsAsyncMulitParam.complete.callback", res);
this.testUtsAsyncMulitParamResult['complete'] = true;
},
)
try {
const res = await testAsyncParam3(100,"hello",option);
} as AsyncOptions);
if (res.name === "testUtsAsyncMulitParam") {
this.testUtsAsyncMulitParamResult['return'] = true;
}
......@@ -288,23 +274,21 @@
this.testUtsClassStaticSyncWithCallbackResult['return'] = false;
this.testUtsClassStaticSyncWithCallbackResult['success'] = false;
this.testUtsClassStaticSyncWithCallbackResult['complete'] = false;
let option = AsyncOptions(
"success",
(res) => {
if (
Test.testClassStaticSyncWithCallback({
type:"success",
success:(res) => {
console.log("testStaticSyncWithCallback.success.callback", res);
this.testUtsClassStaticSyncWithCallbackResult['success'] = true;
},
(res) => {
fail:(res) => {
console.log("testStaticSyncWithCallback.fail.callback", res);
// testUtsClassStaticSyncWithCallbackResult.fail = true;
},
(res) => {
complete:(res) => {
console.log("testStaticSyncWithCallback.complete.callback", res);
this.testUtsClassStaticSyncWithCallbackResult['complete'] = true;
},
)
if (
Test.testClassStaticSyncWithCallback(option)['name'] === "testSyncWithCallback"
} as AsyncOptions)['name'] === "testSyncWithCallback"
) {
this.testUtsClassStaticSyncWithCallbackResult['return'] = true;
}
......@@ -314,22 +298,22 @@
this.testUtsClassStaticAsyncResult['return'] = false;
this.testUtsClassStaticAsyncResult['success'] = false;
this.testUtsClassStaticAsyncResult['complete'] = false;
let option = new AsyncOptions(
"success",
(res) => {
try {
const res = await Test.testClassStaticAsync({
type:"success",
success:(res:any) => {
console.log("testAsync.success.callback", res);
this.testUtsClassStaticAsyncResult['success'] = true;
},
(res) => {
fail:(res:any) => {
console.log("testAsync.fail.callback", res);
},
(res) => {
complete:(res:any) => {
console.log("testAsync.complete.callback", res);
this.testUtsClassStaticAsyncResult['complete'] = true;
},
)
try {
const res = await Test.testClassStaticAsync(option);
} as AsyncOptions);
if (res.name === "testAsync") {
this.testUtsClassStaticAsyncResult['return'] = true;
}
......@@ -383,23 +367,22 @@
this.testUtsClassAsyncResult['return'] = false;
this.testUtsClassAsyncResult['success'] = false;
this.testUtsClassAsyncResult['complete'] = false;
let option = AsyncOptions(
"success",
(res) => {
try {
const res = await test!.testClassAsync({
type:"success",
success:(res) => {
console.log("testAsync.success.callback", res);
this.testUtsClassAsyncResult['success'] = true;
},
(res) => {
fail:(res) => {
console.log("testAsync.fail.callback", res);
},
(res) => {
complete:(res) => {
console.log("testAsync.complete.callback", res);
this.testUtsClassAsyncResult['complete'] = true;
},
)
try {
const res = await test!.testClassAsync(option);
console.log('res', res)
} as AsyncOptions);
if (res.name === "testAsync") {
this.testUtsClassAsyncResult['return'] = true;
}
......@@ -426,20 +409,19 @@
this.testUtsClassInstanceResult['callback'] = true;
}
})
let option = SyncOptions(
(res) => {
const res = task.sync({
success:(res) => {
console.log("task.sync.success.callback", res);
this.testUtsClassInstanceResult['success'] = true;
},
(res) => {
fail:(res) => {
console.log("task.sync.fail.callback", res);
},
(res) => {
complete:(res) => {
console.log("task.sync.complete.callback", res);
this.testUtsClassInstanceResult['complete'] = true;
},
)
const res = task.sync(option)
}} as SyncOptions)
if (res === 'sync') {
this.testUtsClassInstanceResult['return'] = true;
}
......
......@@ -228,7 +228,7 @@ export function stopAssetAudio() {
}
@Suppress("DEPRECATION")
//@UTSAndroid.Suppress("DEPRECATION")
export function goOtherActivity(imageDone : (event : string) => void) : boolean {
// 检查相关权限是否已经具备
......
......@@ -3,13 +3,13 @@ import AlertDialog from 'android.app.AlertDialog';
import DialogInterface from 'android.content.DialogInterface';
import EditText from 'android.widget.EditText';
@Suppress("UNUSED_PARAMETER")
//@UTSAndroid.Suppress("UNUSED_PARAMETER")
export function showAlert(_title : string | null, _message : string | null, _result : (index : Number) => void) {
let uiRunable = new DialogUIRunnable(null, _title!, _message!, "", false);
UTSAndroid.getUniActivity()!.runOnUiThread(uiRunable)
}
@Suppress("UNUSED_PARAMETER")
//@UTSAndroid.Suppress("UNUSED_PARAMETER")
export function showPrompt(_title : string | null, _message : string | null, _placeholder : string | null, success : (content : string) => void) {
let uiRunable = new DialogUIRunnable(success, _title!, _message!, _placeholder!, true);
UTSAndroid.getUniActivity()!.runOnUiThread(uiRunable)
......
......@@ -78,7 +78,7 @@ export class AppHookProxy implements UTSAndroidHookProxy {
}
@Suppress("DEPRECATION")
//@UTSAndroid.Suppress("DEPRECATION")
class ForeService extends Service {
constructor (){
......@@ -311,7 +311,7 @@ class FruitAdapter extends RecyclerView.Adapter<FruitAdapter.ViewHolder>{
}
@Suppress("DEPRECATION")
//@UTSAndroid.Suppress("DEPRECATION")
class DemoActivity extends Activity{
constructor (){
......@@ -365,7 +365,7 @@ class DemoActivity extends Activity{
}
@Suppress("DEPRECATION")
//@UTSAndroid.Suppress("DEPRECATION")
class IntentRunable extends Runnable{
override run(){
console.log("IntentRunable = " + Thread.currentThread().getName())
......@@ -418,7 +418,7 @@ function initShortCut() {
}
@Suppress("DEPRECATION")
//@UTSAndroid.Suppress("DEPRECATION")
export function gotoDemoActivity():boolean {
// 这里的逻辑是为了判断 当前的自定义activity 是否注册了,并以此为条件判断是否是自定义基座
let hasXActivityIntegration = true
......
......@@ -168,7 +168,7 @@ export function gotoSystemPermissionActivityTest() {
/**
* 跳转系统拍照界面,并触发相关生命周期测试
*/
@Suppress("DEPRECATION")
//@UTSAndroid.Suppress("DEPRECATION")
export function gotoCameraTake(imageDone : (event : string) => void) : boolean {
let permissionNeed = ["android.permission.CAMERA"]
......
......@@ -79,7 +79,7 @@ class ScreenFileObserver extends FileObserver {
/**
* 开启截图监听
*/
@Suppress("DEPRECATION")
//@UTSAndroid.Suppress("DEPRECATION")
export function onUserCaptureScreen(callback: UserCaptureScreenCallback) {
// 检查相关权限是否已经具备
......
......@@ -187,7 +187,7 @@ export function getLocation(locationOptions: LocationOptions):boolean {
/**
* 持续监听位置变化
*/
@Suppress("UNUSED_PARAMETER")
//@UTSAndroid.Suppress("UNUSED_PARAMETER")
export function watchPosition(_locationOptions: LocationOptions) {
//todo
}
......@@ -195,7 +195,7 @@ export function watchPosition(_locationOptions: LocationOptions) {
/**
* 关闭监听位置变化
*/
@Suppress("UNUSED_PARAMETER")
//@UTSAndroid.Suppress("UNUSED_PARAMETER")
export function clearWatch() {
//todo
}
\ No newline at end of file
import { describe, test, expect, Result } from './tests.uts'
@Suppress("IMPLICIT_BOXING_IN_IDENTITY_EQUALS")
//@UTSAndroid.Suppress("IMPLICIT_BOXING_IN_IDENTITY_EQUALS")
export function testForLoop(): Result {
return describe('ForLoop', () => {
test('syntax', () => {
......
import { describe, test, expect, Result } from './tests.uts'
@Suppress("IMPLICIT_BOXING_IN_IDENTITY_EQUALS")
//@UTSAndroid.Suppress("IMPLICIT_BOXING_IN_IDENTITY_EQUALS")
export function testNumber() : Result {
return describe("Number", () => {
......
import { describe, test, expect, Result } from './tests.uts'
@UTSAndroid.Suppress("USELESS_IS_CHECK")
//@UTSAndroid.Suppress("USELESS_IS_CHECK")
export function testType() : Result {
return describe("Type", () => {
test("Object literal to type instance", () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册