zmt
3 years ago
35 changed files with 570 additions and 67 deletions
-
1.gitignore
-
4app/src/main/assets/apps/__UNI__2B9497D/www/app-config-service.js
-
2app/src/main/assets/apps/__UNI__2B9497D/www/app-service.js
-
2app/src/main/assets/apps/__UNI__2B9497D/www/app-view.js
-
2app/src/main/assets/apps/__UNI__2B9497D/www/manifest.json
-
2app/src/main/assets/apps/__UNI__2B9497D/www/pages/index/scan.js
-
2app/src/main/assets/apps/__UNI__2B9497D/www/pages/sample/ext-component.js
-
2app/src/main/assets/apps/__UNI__2B9497D/www/pages/sample/ext-module.js
-
2build.gradle
-
2face_module/src/main/java/com/appdev/face_module/MyManager.java
-
1gradle.properties
-
3uniapp示例工程源码/unipluginDemo/manifest.json
-
12uniapp示例工程源码/unipluginDemo/pages.json
-
2uniapp示例工程源码/unipluginDemo/pages/index/index.vue
-
215uniapp示例工程源码/unipluginDemo/pages/sample/ext-module-vue.vue
-
48uniapp示例工程源码/unipluginDemo/pages/sample/ext-module.nvue
-
4uniapp示例工程源码/unipluginDemo/unpackage/dist/build/app-plus/app-config-service.js
-
2uniapp示例工程源码/unipluginDemo/unpackage/dist/build/app-plus/app-service.js
-
2uniapp示例工程源码/unipluginDemo/unpackage/dist/build/app-plus/app-view.js
-
2uniapp示例工程源码/unipluginDemo/unpackage/dist/build/app-plus/manifest.json
-
2uniapp示例工程源码/unipluginDemo/unpackage/dist/build/app-plus/pages/index/scan.js
-
2uniapp示例工程源码/unipluginDemo/unpackage/dist/build/app-plus/pages/sample/ext-component.js
-
2uniapp示例工程源码/unipluginDemo/unpackage/dist/build/app-plus/pages/sample/ext-module.js
-
4uniapp示例工程源码/unipluginDemo/unpackage/resources/__UNI__2B9497D/www/app-config-service.js
-
2uniapp示例工程源码/unipluginDemo/unpackage/resources/__UNI__2B9497D/www/app-service.js
-
2uniapp示例工程源码/unipluginDemo/unpackage/resources/__UNI__2B9497D/www/app-view.js
-
2uniapp示例工程源码/unipluginDemo/unpackage/resources/__UNI__2B9497D/www/manifest.json
-
2uniapp示例工程源码/unipluginDemo/unpackage/resources/__UNI__2B9497D/www/pages/index/scan.js
-
2uniapp示例工程源码/unipluginDemo/unpackage/resources/__UNI__2B9497D/www/pages/sample/ext-component.js
-
2uniapp示例工程源码/unipluginDemo/unpackage/resources/__UNI__2B9497D/www/pages/sample/ext-module.js
-
70uniapp示例工程源码/unipluginDemo/utils/timeFormat.js
-
56zmt_module/src/main/java/io/dcloud/zmt_module/AsyncTask.java
-
62zmt_module/src/main/java/io/dcloud/zmt_module/PermissionCheck.java
-
3zmt_module/src/main/java/io/dcloud/zmt_module/TcpServer.java
-
112zmt_module/src/main/java/io/dcloud/zmt_module/zmtClass.java
@ -1,8 +1,8 @@ |
|||
|
|||
var isReady=false;var onReadyCallbacks=[]; |
|||
var isServiceReady=false;var onServiceReadyCallbacks=[]; |
|||
var __uniConfig = {"pages":["pages/index/index","pages/index/ball_list","pages/index/scan","pages/sample/ext-module","pages/sample/ext-component","pages/sample/richAlert"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"uni-app","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8"},"nvueCompiler":"uni-app","nvueStyleCompiler":"weex","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"unipluginDemo","compilerVersion":"3.3.11","entryPagePath":"pages/index/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}}; |
|||
var __uniRoutes = [{"path":"/pages/index/index","meta":{"isQuit":true},"window":{"navigationBarTitleText":"uni-app"}},{"path":"/pages/index/ball_list","meta":{},"window":{"navigationBarTitleText":"uni-app"}},{"path":"/pages/index/scan","meta":{"isNVue":true},"window":{"navigationBarTitleText":"22222"}},{"path":"/pages/sample/ext-module","meta":{"isNVue":true},"window":{"navigationBarTitleText":"扩展 module"}},{"path":"/pages/sample/ext-component","meta":{"isNVue":true},"window":{"navigationBarTitleText":"扩展 component"}},{"path":"/pages/sample/richAlert","meta":{},"window":{"navigationBarTitleText":"RichAlert"}}]; |
|||
var __uniConfig = {"pages":["pages/sample/ext-module-vue","pages/index/index","pages/index/ball_list","pages/index/scan","pages/sample/ext-module","pages/sample/ext-component","pages/sample/richAlert"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"uni-app","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8"},"nvueCompiler":"uni-app","nvueStyleCompiler":"weex","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"unipluginDemo","compilerVersion":"3.3.11","entryPagePath":"pages/sample/ext-module-vue","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}}; |
|||
var __uniRoutes = [{"path":"/pages/sample/ext-module-vue","meta":{"isQuit":true},"window":{"navigationBarTitleText":"扩展 module vue"}},{"path":"/pages/index/index","meta":{},"window":{"navigationBarTitleText":"uni-app"}},{"path":"/pages/index/ball_list","meta":{},"window":{"navigationBarTitleText":"uni-app"}},{"path":"/pages/index/scan","meta":{"isNVue":true},"window":{"navigationBarTitleText":"22222"}},{"path":"/pages/sample/ext-module","meta":{"isNVue":true},"window":{"navigationBarTitleText":"扩展 module nvue"}},{"path":"/pages/sample/ext-component","meta":{"isNVue":true},"window":{"navigationBarTitleText":"扩展 component"}},{"path":"/pages/sample/richAlert","meta":{},"window":{"navigationBarTitleText":"RichAlert"}}]; |
|||
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); |
|||
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); |
|||
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}}); |
2
app/src/main/assets/apps/__UNI__2B9497D/www/app-service.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
2
app/src/main/assets/apps/__UNI__2B9497D/www/app-view.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1 +1 @@ |
|||
{"@platforms":["android","iPhone","iPad"],"id":"__UNI__2B9497D","name":"unipluginDemo","version":{"name":"1.0.0","code":"100"},"description":"","launch_path":"__uniappview.html","developer":{"name":"","email":"","url":""},"permissions":{"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"target":"id:1","autoclose":true,"waiting":true,"delay":0},"popGesture":"close","launchwebview":{"render":"always","id":"1","kernel":"WKWebview"},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#F8F8F8"},"usingComponents":true,"nvueCompiler":"uni-app","compilerVersion":3,"allowsInlineMediaPlayback":true,"uni-app":{"compilerVersion":"3.3.11","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"launch_path":"__uniappview.html"}} |
|||
{"@platforms":["android","iPhone","iPad"],"id":"__UNI__2B9497D","name":"unipluginDemo","version":{"name":"1.0.0","code":"100"},"description":"","launch_path":"__uniappview.html","developer":{"name":"","email":"","url":""},"permissions":{"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"target":"id:1","autoclose":true,"waiting":true,"delay":0},"popGesture":"close","launchwebview":{"render":"always","id":"1","kernel":"WKWebview"},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#F8F8F8"},"compatible":{"ignoreVersion":true},"usingComponents":true,"nvueCompiler":"uni-app","compilerVersion":3,"allowsInlineMediaPlayback":true,"uni-app":{"compilerVersion":"3.3.11","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"launch_path":"__uniappview.html"}} |
2
app/src/main/assets/apps/__UNI__2B9497D/www/pages/index/scan.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
2
app/src/main/assets/apps/__UNI__2B9497D/www/pages/sample/ext-component.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
2
app/src/main/assets/apps/__UNI__2B9497D/www/pages/sample/ext-module.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,215 @@ |
|||
<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> |
|||
|
|||
<view class="console"> |
|||
<text class="log" v-for="i in logs">{{i}}</text> |
|||
</view> |
|||
<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 |
|||
|
|||
import {timeFormat} from "../../utils/timeFormat.js" |
|||
|
|||
export default { |
|||
onLoad() { |
|||
this.initAPPListener() |
|||
|
|||
|
|||
}, |
|||
onReady() { |
|||
this.logs.push("当前时间:"+this.getTime()) |
|||
}, |
|||
data() { |
|||
return { |
|||
logs:["LOG VIEW"] |
|||
} |
|||
}, |
|||
methods: { |
|||
|
|||
initAPPListener(){ |
|||
// #ifdef APP-PLUS |
|||
let that = this |
|||
// 原生平台事件监听,等待测试 |
|||
plus.globalEvent.addEventListener('myEvent', function(e){ |
|||
modal.toast({ |
|||
message: "TestEvent收到:"+JSON.stringify(e), |
|||
duration: 3.5 |
|||
}); |
|||
that.log("全局事件接收:"+JSON.stringify(e)) |
|||
}); |
|||
// #endif |
|||
}, |
|||
//百度人脸SDK,初始化,并申请授权(授权码写死在android端 faceClass) |
|||
faceAsyncFunc() { |
|||
this.log("执行faceModule.faceAsyncFunc"); |
|||
// 调用异步方法 |
|||
faceModule.faceAsyncFunc({ |
|||
'name': 'unimp', |
|||
'age': 1 |
|||
}, |
|||
(ret) => { |
|||
modal.toast({ |
|||
message: ret, |
|||
duration: 1.5 |
|||
}); |
|||
this.log(JSON.stringify(ret)) |
|||
}) |
|||
}, |
|||
tcpAsyncFunc(){ |
|||
// 调用异步方法 |
|||
this.log("Click Tcp Server.") |
|||
zmtModule.tcpAsyncFunc({ |
|||
'port':"16666", |
|||
}, |
|||
(ret) => { |
|||
modal.toast({ |
|||
message: ret, |
|||
duration: 2 |
|||
}); |
|||
this.log("invoke:"+JSON.stringify(ret)) |
|||
}) |
|||
}, |
|||
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 |
|||
}); |
|||
}, |
|||
//在Log View打印txt |
|||
log(txt){ |
|||
this.logs.push(this.getTime()+` ${txt}`) |
|||
}, |
|||
//返回当前时间 |
|||
getTime(){ |
|||
return timeFormat(new Date(),'mm/dd hh:MM:ss') |
|||
}, |
|||
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; |
|||
font-size: 12px; |
|||
|
|||
} |
|||
// button{ |
|||
// margin-top: 3px; |
|||
// } |
|||
.btn{ |
|||
margin: 3px; |
|||
// width: 95%; |
|||
} |
|||
.tips{ |
|||
font-size: 11px; |
|||
color: gray; |
|||
font-weight: 800; |
|||
} |
|||
|
|||
.console{ |
|||
// margin-left: 25rpx; |
|||
// width: %; |
|||
// height: auto; |
|||
display: flex; |
|||
flex-wrap: nowrap; |
|||
flex-direction: column; |
|||
align-items: flex-start; |
|||
background-color: lightgray; |
|||
padding: 20rpx; |
|||
} |
|||
.log{ |
|||
color: darkred; |
|||
font-size: 11px; |
|||
font-weight: 800; |
|||
} |
|||
</style> |
@ -1,8 +1,8 @@ |
|||
|
|||
var isReady=false;var onReadyCallbacks=[]; |
|||
var isServiceReady=false;var onServiceReadyCallbacks=[]; |
|||
var __uniConfig = {"pages":["pages/index/index","pages/index/ball_list","pages/index/scan","pages/sample/ext-module","pages/sample/ext-component","pages/sample/richAlert"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"uni-app","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8"},"nvueCompiler":"uni-app","nvueStyleCompiler":"weex","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"unipluginDemo","compilerVersion":"3.3.11","entryPagePath":"pages/index/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}}; |
|||
var __uniRoutes = [{"path":"/pages/index/index","meta":{"isQuit":true},"window":{"navigationBarTitleText":"uni-app"}},{"path":"/pages/index/ball_list","meta":{},"window":{"navigationBarTitleText":"uni-app"}},{"path":"/pages/index/scan","meta":{"isNVue":true},"window":{"navigationBarTitleText":"22222"}},{"path":"/pages/sample/ext-module","meta":{"isNVue":true},"window":{"navigationBarTitleText":"扩展 module"}},{"path":"/pages/sample/ext-component","meta":{"isNVue":true},"window":{"navigationBarTitleText":"扩展 component"}},{"path":"/pages/sample/richAlert","meta":{},"window":{"navigationBarTitleText":"RichAlert"}}]; |
|||
var __uniConfig = {"pages":["pages/sample/ext-module-vue","pages/index/index","pages/index/ball_list","pages/index/scan","pages/sample/ext-module","pages/sample/ext-component","pages/sample/richAlert"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"uni-app","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8"},"nvueCompiler":"uni-app","nvueStyleCompiler":"weex","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"unipluginDemo","compilerVersion":"3.3.11","entryPagePath":"pages/sample/ext-module-vue","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}}; |
|||
var __uniRoutes = [{"path":"/pages/sample/ext-module-vue","meta":{"isQuit":true},"window":{"navigationBarTitleText":"扩展 module vue"}},{"path":"/pages/index/index","meta":{},"window":{"navigationBarTitleText":"uni-app"}},{"path":"/pages/index/ball_list","meta":{},"window":{"navigationBarTitleText":"uni-app"}},{"path":"/pages/index/scan","meta":{"isNVue":true},"window":{"navigationBarTitleText":"22222"}},{"path":"/pages/sample/ext-module","meta":{"isNVue":true},"window":{"navigationBarTitleText":"扩展 module nvue"}},{"path":"/pages/sample/ext-component","meta":{"isNVue":true},"window":{"navigationBarTitleText":"扩展 component"}},{"path":"/pages/sample/richAlert","meta":{},"window":{"navigationBarTitleText":"RichAlert"}}]; |
|||
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); |
|||
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); |
|||
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}}); |
2
uniapp示例工程源码/unipluginDemo/unpackage/dist/build/app-plus/app-service.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
2
uniapp示例工程源码/unipluginDemo/unpackage/dist/build/app-plus/app-view.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1 +1 @@ |
|||
{"@platforms":["android","iPhone","iPad"],"id":"__UNI__2B9497D","name":"unipluginDemo","version":{"name":"1.0.0","code":"100"},"description":"","launch_path":"__uniappview.html","developer":{"name":"","email":"","url":""},"permissions":{"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"target":"id:1","autoclose":true,"waiting":true,"delay":0},"popGesture":"close","launchwebview":{"render":"always","id":"1","kernel":"WKWebview"},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#F8F8F8"},"usingComponents":true,"nvueCompiler":"uni-app","compilerVersion":3,"distribute":{"google":{"permissions":["<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>","<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>","<uses-permission android:name=\"android.permission.VIBRATE\"/>","<uses-permission android:name=\"android.permission.READ_LOGS\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-feature android:name=\"android.hardware.camera.autofocus\"/>","<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>","<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.CAMERA\"/>","<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>","<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>","<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>","<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>","<uses-permission android:name=\"android.permission.CALL_PHONE\"/>","<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>","<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>","<uses-feature android:name=\"android.hardware.camera\"/>","<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>","<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"]},"apple":{},"plugins":{"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}}}},"allowsInlineMediaPlayback":true,"uni-app":{"compilerVersion":"3.3.11","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"launch_path":"__uniappview.html"}} |
|||
{"@platforms":["android","iPhone","iPad"],"id":"__UNI__2B9497D","name":"unipluginDemo","version":{"name":"1.0.0","code":"100"},"description":"","launch_path":"__uniappview.html","developer":{"name":"","email":"","url":""},"permissions":{"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"target":"id:1","autoclose":true,"waiting":true,"delay":0},"popGesture":"close","launchwebview":{"render":"always","id":"1","kernel":"WKWebview"},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#F8F8F8"},"compatible":{"ignoreVersion":true},"usingComponents":true,"nvueCompiler":"uni-app","compilerVersion":3,"distribute":{"google":{"permissions":["<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>","<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>","<uses-permission android:name=\"android.permission.VIBRATE\"/>","<uses-permission android:name=\"android.permission.READ_LOGS\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-feature android:name=\"android.hardware.camera.autofocus\"/>","<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>","<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.CAMERA\"/>","<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>","<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>","<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>","<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>","<uses-permission android:name=\"android.permission.CALL_PHONE\"/>","<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>","<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>","<uses-feature android:name=\"android.hardware.camera\"/>","<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>","<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"]},"apple":{},"plugins":{"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}}}},"allowsInlineMediaPlayback":true,"uni-app":{"compilerVersion":"3.3.11","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"launch_path":"__uniappview.html"}} |
2
uniapp示例工程源码/unipluginDemo/unpackage/dist/build/app-plus/pages/index/scan.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
2
uniapp示例工程源码/unipluginDemo/unpackage/dist/build/app-plus/pages/sample/ext-component.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
2
uniapp示例工程源码/unipluginDemo/unpackage/dist/build/app-plus/pages/sample/ext-module.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1,8 +1,8 @@ |
|||
|
|||
var isReady=false;var onReadyCallbacks=[]; |
|||
var isServiceReady=false;var onServiceReadyCallbacks=[]; |
|||
var __uniConfig = {"pages":["pages/index/index","pages/index/ball_list","pages/index/scan","pages/sample/ext-module","pages/sample/ext-component","pages/sample/richAlert"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"uni-app","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8"},"nvueCompiler":"uni-app","nvueStyleCompiler":"weex","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"unipluginDemo","compilerVersion":"3.3.11","entryPagePath":"pages/index/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}}; |
|||
var __uniRoutes = [{"path":"/pages/index/index","meta":{"isQuit":true},"window":{"navigationBarTitleText":"uni-app"}},{"path":"/pages/index/ball_list","meta":{},"window":{"navigationBarTitleText":"uni-app"}},{"path":"/pages/index/scan","meta":{"isNVue":true},"window":{"navigationBarTitleText":"22222"}},{"path":"/pages/sample/ext-module","meta":{"isNVue":true},"window":{"navigationBarTitleText":"扩展 module"}},{"path":"/pages/sample/ext-component","meta":{"isNVue":true},"window":{"navigationBarTitleText":"扩展 component"}},{"path":"/pages/sample/richAlert","meta":{},"window":{"navigationBarTitleText":"RichAlert"}}]; |
|||
var __uniConfig = {"pages":["pages/sample/ext-module-vue","pages/index/index","pages/index/ball_list","pages/index/scan","pages/sample/ext-module","pages/sample/ext-component","pages/sample/richAlert"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"uni-app","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8"},"nvueCompiler":"uni-app","nvueStyleCompiler":"weex","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"unipluginDemo","compilerVersion":"3.3.11","entryPagePath":"pages/sample/ext-module-vue","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}}; |
|||
var __uniRoutes = [{"path":"/pages/sample/ext-module-vue","meta":{"isQuit":true},"window":{"navigationBarTitleText":"扩展 module vue"}},{"path":"/pages/index/index","meta":{},"window":{"navigationBarTitleText":"uni-app"}},{"path":"/pages/index/ball_list","meta":{},"window":{"navigationBarTitleText":"uni-app"}},{"path":"/pages/index/scan","meta":{"isNVue":true},"window":{"navigationBarTitleText":"22222"}},{"path":"/pages/sample/ext-module","meta":{"isNVue":true},"window":{"navigationBarTitleText":"扩展 module nvue"}},{"path":"/pages/sample/ext-component","meta":{"isNVue":true},"window":{"navigationBarTitleText":"扩展 component"}},{"path":"/pages/sample/richAlert","meta":{},"window":{"navigationBarTitleText":"RichAlert"}}]; |
|||
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); |
|||
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); |
|||
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}}); |
2
uniapp示例工程源码/unipluginDemo/unpackage/resources/__UNI__2B9497D/www/app-service.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
2
uniapp示例工程源码/unipluginDemo/unpackage/resources/__UNI__2B9497D/www/app-view.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1 +1 @@ |
|||
{"@platforms":["android","iPhone","iPad"],"id":"__UNI__2B9497D","name":"unipluginDemo","version":{"name":"1.0.0","code":"100"},"description":"","launch_path":"__uniappview.html","developer":{"name":"","email":"","url":""},"permissions":{"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"target":"id:1","autoclose":true,"waiting":true,"delay":0},"popGesture":"close","launchwebview":{"render":"always","id":"1","kernel":"WKWebview"},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#F8F8F8"},"usingComponents":true,"nvueCompiler":"uni-app","compilerVersion":3,"allowsInlineMediaPlayback":true,"uni-app":{"compilerVersion":"3.3.11","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"launch_path":"__uniappview.html"}} |
|||
{"@platforms":["android","iPhone","iPad"],"id":"__UNI__2B9497D","name":"unipluginDemo","version":{"name":"1.0.0","code":"100"},"description":"","launch_path":"__uniappview.html","developer":{"name":"","email":"","url":""},"permissions":{"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"target":"id:1","autoclose":true,"waiting":true,"delay":0},"popGesture":"close","launchwebview":{"render":"always","id":"1","kernel":"WKWebview"},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#F8F8F8"},"compatible":{"ignoreVersion":true},"usingComponents":true,"nvueCompiler":"uni-app","compilerVersion":3,"allowsInlineMediaPlayback":true,"uni-app":{"compilerVersion":"3.3.11","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"launch_path":"__uniappview.html"}} |
2
uniapp示例工程源码/unipluginDemo/unpackage/resources/__UNI__2B9497D/www/pages/index/scan.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
2
uniapp示例工程源码/unipluginDemo/unpackage/resources/__UNI__2B9497D/www/pages/sample/ext-component.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
2
uniapp示例工程源码/unipluginDemo/unpackage/resources/__UNI__2B9497D/www/pages/sample/ext-module.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,70 @@ |
|||
// padStart 的 polyfill,因为某些机型或情况,还无法支持es7的padStart,比如电脑版的微信小程序
|
|||
// 所以这里做一个兼容polyfill的兼容处理
|
|||
if (!String.prototype.padStart) { |
|||
// 为了方便表示这里 fillString 用了ES6 的默认参数,不影响理解
|
|||
String.prototype.padStart = function(maxLength, fillString = ' ') { |
|||
if (Object.prototype.toString.call(fillString) !== "[object String]") throw new TypeError( |
|||
'fillString must be String') |
|||
let str = this |
|||
// 返回 String(str) 这里是为了使返回的值是字符串字面量,在控制台中更符合直觉
|
|||
if (str.length >= maxLength) return String(str) |
|||
|
|||
let fillLength = maxLength - str.length, |
|||
times = Math.ceil(fillLength / fillString.length) |
|||
while (times >>= 1) { |
|||
fillString += fillString |
|||
if (times === 1) { |
|||
fillString += fillString |
|||
} |
|||
} |
|||
return fillString.slice(0, fillLength) + str; |
|||
} |
|||
} |
|||
|
|||
// 其他更多是格式化有如下:
|
|||
// yyyy:mm:dd|yyyy:mm|yyyy年mm月dd日|yyyy年mm月dd日 hh时MM分等,可自定义组合
|
|||
function timeFormat(dateTime = null, fmt = 'yyyy-mm-dd') { |
|||
// 如果为null,则格式化当前时间
|
|||
if (!dateTime) dateTime = Number(new Date()); |
|||
//兼容IOS
|
|||
if(typeof(dateTime)=="string"&&dateTime.indexOf("-")>0) dateTime = dateTime.replace(/\-/g,'/') |
|||
// 如果dateTime长度为10或者13,则为秒和毫秒的时间戳,如果超过13位,则为其他的时间格式
|
|||
if (dateTime.toString().length == 10) dateTime *= 1000; |
|||
let date = new Date(dateTime); |
|||
let ret; |
|||
let opt = { |
|||
"y+": date.getFullYear().toString(), // 年
|
|||
"m+": (date.getMonth() + 1).toString(), // 月
|
|||
"d+": date.getDate().toString(), // 日
|
|||
"h+": date.getHours().toString(), // 时
|
|||
"M+": date.getMinutes().toString(), // 分
|
|||
"s+": date.getSeconds().toString() // 秒
|
|||
// 有其他格式化字符需求可以继续添加,必须转化成字符串
|
|||
}; |
|||
for (let k in opt) { |
|||
ret = new RegExp("(" + k + ")").exec(fmt); |
|||
if (ret) { |
|||
fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0"))) |
|||
}; |
|||
}; |
|||
return fmt; |
|||
} |
|||
|
|||
//计算视频分钟时长,如(180s视频) a=180 返回03:00
|
|||
function getDurationTime(a){ |
|||
var b = "" |
|||
var h = parseInt(a/3600), |
|||
m = parseInt(a%3600/60), |
|||
s = parseInt(a%3600%60); |
|||
if(h>0){ |
|||
h = h<10 ? '0'+h : h |
|||
b += h+":" |
|||
} |
|||
m = m<10 ? '0'+m : m |
|||
s = s<10 ? '0'+s : s |
|||
b+=m+":"+s |
|||
// console.log(b);
|
|||
return b; |
|||
} |
|||
|
|||
export {timeFormat,getDurationTime} |
@ -0,0 +1,56 @@ |
|||
package io.dcloud.zmt_module; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
|
|||
import io.dcloud.feature.uniapp.AbsSDKInstance; |
|||
|
|||
public class AsyncTask { |
|||
|
|||
String TAG = "zmt_module_AsyncTask "; |
|||
|
|||
public interface MyTcpCallback{ |
|||
void callback(Object object); |
|||
} |
|||
|
|||
// TCP task |
|||
public void task(final MyTcpCallback myCallback, final Integer port){ |
|||
// Android 4.0 之后不能在主线程中请求HTTP请求 |
|||
Thread thread = new Thread(new Runnable() { |
|||
@Override |
|||
public void run() { |
|||
System.out.println("AsyncTask thread running... port:"+port); |
|||
|
|||
TcpServer server = new TcpServer(); |
|||
// server.initSocket((Integer.parseInt("16666"))); |
|||
server.initSocket(port); |
|||
|
|||
while (true){ |
|||
String tcp_receive_message = server.receiveMessage(SocketConfig.UTF_8);//接收消息 |
|||
System.out.println(TAG+"接收消息:"+tcp_receive_message); |
|||
String send_msg = "App received tcp message!"; //回发socket消息,确认接收 |
|||
send_msg = SocketHelper.getMessageByReadLine(send_msg); |
|||
server.sendMessage(send_msg,SocketConfig.UTF_8);//回发消息 |
|||
|
|||
JSONObject data = new JSONObject(); |
|||
data.put("threadID", Thread.currentThread().getId()); |
|||
data.put("threadName", Thread.currentThread().getName()); |
|||
// data.put("message", server.); |
|||
// data.put("message", tcp_receive_message); |
|||
data.put("message", tcp_receive_message); |
|||
myCallback.callback(data);//回调到zmtClass给uni端 |
|||
|
|||
try { |
|||
Thread.sleep(1000); //定义休眠时间 |
|||
} catch (InterruptedException e) { |
|||
e.printStackTrace(); |
|||
} |
|||
|
|||
} |
|||
|
|||
} |
|||
}); |
|||
thread.setDaemon(true);//开启守护线程 |
|||
thread.start(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,62 @@ |
|||
package io.dcloud.zmt_module; |
|||
|
|||
import android.Manifest; |
|||
import android.app.Activity; |
|||
import android.content.Context; |
|||
import android.content.pm.PackageManager; |
|||
import android.os.Build; |
|||
import android.util.Log; |
|||
|
|||
import androidx.core.app.ActivityCompat; |
|||
import androidx.core.content.PermissionChecker; |
|||
|
|||
public class PermissionCheck extends Activity { |
|||
private static final String TAG = "MainActivity"; |
|||
private final int ACCESS_LOCATION=1; |
|||
/** |
|||
* 获取权限,可以与其他项目的权限进行统一处理 |
|||
*/ |
|||
private void getPermission() { |
|||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) { |
|||
int permissionCheck = 0; |
|||
permissionCheck = this.checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION); //允许一个程序访问精良位置(如GPS) |
|||
permissionCheck += this.checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION); //允许一个程序访问CellID或WiFi热点来获取粗略的位置 |
|||
permissionCheck += this.checkSelfPermission(Manifest.permission.CAMERA); //请求访问使用照相设备 |
|||
|
|||
if (permissionCheck != PackageManager.PERMISSION_GRANTED) { //未获得权限 |
|||
ActivityCompat.requestPermissions( |
|||
this,// 请求授权 |
|||
new String[]{Manifest.permission.ACCESS_FINE_LOCATION, |
|||
Manifest.permission.ACCESS_COARSE_LOCATION,Manifest.permission.CAMERA},ACCESS_LOCATION);// 自定义常量,任意整型 |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 请求权限的结果回调。每次调用 requestpermissions(string[],int)时都会调用此方法。 |
|||
* @param requestCode 传入的请求代码 |
|||
* @param permissions 传入permissions的要求 |
|||
* @param grantResults 相应权限的授予结果:PERMISSION_GRANTED 或 PERMISSION_DENIED |
|||
*/ |
|||
@Override |
|||
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { |
|||
switch (requestCode) { |
|||
case ACCESS_LOCATION: |
|||
if (hasAllPermissionGranted(grantResults)) { |
|||
Log.i(TAG, "onRequestPermissionsResult: 用户允许权限"); |
|||
} else { |
|||
Log.i(TAG, "onRequestPermissionsResult: 拒绝搜索设备权限"); |
|||
} |
|||
break; |
|||
} |
|||
} |
|||
|
|||
private boolean hasAllPermissionGranted(int[] grantResults) { |
|||
for (int grantResult : grantResults) { |
|||
if (grantResult == PackageManager.PERMISSION_DENIED) { |
|||
return false; |
|||
} |
|||
} |
|||
return true; |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue