You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
169 lines
3.9 KiB
169 lines
3.9 KiB
<template>
|
|
<div class="content">
|
|
|
|
<button class="btn" type="primary" @click="gotoNativePage">跳转原生Activity</button>
|
|
<button class="btn" type="primary" @click="tcpAsyncFunc">[开启TcpServer]</button>
|
|
<text class="tips">
|
|
点击后将开启TcpServer. 本机IP: 192.168.1.64 端口:16666
|
|
</text>
|
|
<!-- <button type="primary" @click="testFun2">zmt-testFun2</button> -->
|
|
|
|
|
|
<button class="btn" type="primary" @click="faceAsyncFunc">[百度人脸SDK授权]</button>
|
|
<text class="tips">
|
|
点击后将进行百度人脸SDK初始化及授权申请,该授权码写死在Android端zmt_module内faceClass,因已使用过,将返回已被占用提示.
|
|
</text>
|
|
|
|
<button class="btn" type="primary" @click="testAsyncFunc2">uniplugin_module_ox testAsyncFunc2</button>
|
|
<button class="btn" type="primary" @click="testSyncFunc2">uniplugin_module_ox testSyncFunc2</button>
|
|
<button class="btn" type="primary" @click="testAsyncFunc">uniplugin_module testAsyncFunc</button>
|
|
<button class="btn" type="primary" @click="testSyncFunc">uniplugin_module testSyncFunc</button>
|
|
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
// #ifdef APP-PLUS
|
|
// 获取 module
|
|
var zmtModule = uni.requireNativePlugin("Zmt-Module")
|
|
var testModule = uni.requireNativePlugin("TestModule") //uniplugin_module
|
|
var uniplugin_module_ox = uni.requireNativePlugin("uniplugin_module_ox") //uniplugin_module_ox
|
|
var faceModule = uni.requireNativePlugin("Face-Module") //百度人脸SDK, face_module
|
|
const modal = uni.requireNativePlugin('modal');
|
|
// #endif
|
|
|
|
export default {
|
|
onLoad() {
|
|
this.initAPPListener()
|
|
},
|
|
methods: {
|
|
|
|
initAPPListener(){
|
|
// #ifdef APP-PLUS
|
|
// 原生平台事件监听,等待测试
|
|
plus.globalEvent.addEventListener('TestEvent', function(e){
|
|
modal.toast({
|
|
message: "TestEvent收到:"+e.msg,
|
|
duration: 1.5
|
|
});
|
|
});
|
|
// #endif
|
|
},
|
|
//百度人脸SDK,初始化,并申请授权(授权码写死在android端 faceClass)
|
|
faceAsyncFunc() {
|
|
console.log("测试开始faceAsyncFunc");
|
|
// 调用异步方法
|
|
faceModule.faceAsyncFunc({
|
|
'name': 'unimp',
|
|
'age': 1
|
|
},
|
|
(ret) => {
|
|
modal.toast({
|
|
message: ret,
|
|
duration: 1.5
|
|
});
|
|
})
|
|
},
|
|
tcpAsyncFunc(){
|
|
// 调用异步方法
|
|
zmtModule.tcpAsyncFunc({
|
|
'name': 'unimp',
|
|
'age': 1
|
|
},
|
|
(ret) => {
|
|
modal.toast({
|
|
message: ret,
|
|
duration: 1.5
|
|
});
|
|
})
|
|
},
|
|
testFun2(){
|
|
// 调用同步方法
|
|
var ret = zmtModule.testSyncFunc({
|
|
'name': 'unimp',
|
|
'age': 1
|
|
})
|
|
modal.toast({
|
|
message: ret,
|
|
duration: 1.5
|
|
});
|
|
},
|
|
testAsyncFunc() {
|
|
// 调用异步方法
|
|
testModule.testAsyncFunc({
|
|
'name': 'unimp',
|
|
'age': 1
|
|
},
|
|
(ret) => {
|
|
modal.toast({
|
|
message: ret,
|
|
duration: 1.5
|
|
});
|
|
})
|
|
},
|
|
testSyncFunc() {
|
|
// 调用同步方法
|
|
var ret = testModule.testSyncFunc({
|
|
'name': 'unimp',
|
|
'age': 1
|
|
})
|
|
modal.toast({
|
|
message: ret,
|
|
duration: 1.5
|
|
});
|
|
},
|
|
|
|
testAsyncFunc2() {
|
|
// 调用异步方法
|
|
uniplugin_module_ox.testAsyncFunc2({
|
|
'name': 'unimp',
|
|
'age': 1
|
|
},
|
|
(ret) => {
|
|
modal.toast({
|
|
message: ret,
|
|
duration: 1.5
|
|
});
|
|
})
|
|
},
|
|
testSyncFunc2() {
|
|
// 调用同步方法
|
|
var ret = uniplugin_module_ox.testSyncFunc2({
|
|
'name': 'unimp',
|
|
'age': 1
|
|
})
|
|
modal.toast({
|
|
message: ret,
|
|
duration: 1.5
|
|
});
|
|
},
|
|
gotoNativePage() {
|
|
testModule.gotoNativePage();
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<style lang="scss">
|
|
.content{
|
|
// width: 750rpx;
|
|
// margin-top: 10rpx;
|
|
// display: flex;
|
|
// flex-wrap: nowrap;
|
|
// align-items: flex-start;
|
|
// flex-direction: column;
|
|
// justify-content: center;
|
|
|
|
}
|
|
// button{
|
|
// margin-top: 3px;
|
|
// }
|
|
.btn{
|
|
margin: 3px;
|
|
// width: 95%;
|
|
}
|
|
.tips{
|
|
font-size: 11px;
|
|
color: gray;
|
|
font-weight: 800;
|
|
}
|
|
</style>
|