Commit fdd7fd19 authored by p x's avatar p x
Browse files

1

parent 6b9a3463
......@@ -12,21 +12,21 @@ class JsApi {
//同步API
@JavascriptInterface
fun testSyn(msg: String): String {
fun testSyn(msg: Object ): String {
return msg.toString() + "[syn call]"
}
//异步API
@JavascriptInterface
fun testAsyn(msg: String, handler: CompletionHandler<String?>) {
fun testAsyn(msg: Object , handler: CompletionHandler<String?>) {
handler.complete(msg.toString() + " [ asyn call]")
}
@JavascriptInterface
fun writeLog(msg: String) {
println("------------ writeLog")
mainVM?.writeLog(msg)
fun writeLog(msg: Object) {
println("------------writeLog ${msg}")
mainVM?.writeLog(msg.toString())
// FileIoUtils.writeToFile(gson.toJson(perceptionBean), "PerTarget_15_move.txt")
}
......
......@@ -54,11 +54,9 @@ class MainActivity : AppCompatActivity() {
setAllowFileAccessFromFileURLs(true)
setAllowUniversalAccessFromFileURLs(true)
}
val url = "file:///android_asset/dist/index.html"
// val url = "http://192.168.60.134:8081/#/index.html"
// val url = "http://82.156.182.48:8088/3dmap/"
// val url = "https://10.149.230.104:19443/shudao-navigation3d-app/index"
// val url = "https://172.29.128.38:13443/shudao-navigation3d-app/index"
// val url = "file:///android_asset/dist/index.html"
val url = "http://192.168.60.109:5101/#/"
binding.dwebview.loadUrl(url)
binding.dwebview.webViewClient = object : WebViewClient() {
......
......@@ -29,6 +29,7 @@ object DateUtils {
val FORMAT_DATE_TIME = "yyyy-MM-dd HH:mm"
val FORMAT_DATE1_TIME = "yyyy/MM/dd HH:mm"
val FORMAT_DATE_TIME_SECOND = "yyyy-MM-dd HH:mm:ss"
val FORMAT_DATE_TIME_SECOND_MIll = "yyyy-MM-dd HH:mm:ss.SSS"
val FORMAT_MM_DD = "MM.dd"
val FORMAT_YYYY_MM_DD = "yyyy.MM.dd"
val FORMAT_DATE_CHINA = "yyyy年MM月dd日"
......
......@@ -3,6 +3,7 @@ package com.sd.geelyhmiweb.viewmodels
import android.content.Context
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.sd.geelyhmiweb.utils.DateUtils
import com.sd.geelyhmiweb.utils.FileIoUtils
import dagger.hilt.android.lifecycle.HiltViewModel
import dagger.hilt.android.qualifiers.ApplicationContext
......@@ -18,7 +19,8 @@ class MainVM @Inject constructor(
fun writeLog(str: String){
viewModelScope.launch {
FileIoUtils.writeToFile(str, "log.txt")
var time = DateUtils.getCurrentTime(DateUtils.FORMAT_DATE_TIME_SECOND_MIll)
FileIoUtils.writeToFile("$time ${str}", "web_log.txt")
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment