Переглянути джерело

修改相机页面。修改baseurl等。

jiaxiaoqiang 5 місяців тому
батько
коміт
6ca8441102

+ 1 - 1
entry/src/main/ets/entryability/EntryAbility.ets

@@ -51,7 +51,7 @@ export default class EntryAbility extends UIAbility {
       windowClass.setWindowLayoutFullScreen(true)
     })
     // ================================= 更改跟路由
-    windowStage.loadContent('pages/TestHdcInstallPage', (err) => {
+    windowStage.loadContent('pages/Index', (err) => {
       if (err.code) {
         hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
         return;

+ 3 - 2
entry/src/main/ets/pages/CameraVersion2.ets

@@ -118,9 +118,9 @@ struct Index {
       // 开始上传
       console.log(TAG, "开始上传", imageUri)
       uploadInstance.startUpload(imageUri, () => {
-        // this.isUploading = false
-        // this.assetUri = ""
+
         console.log(TAG, "上传完成后的callback")
+        this.isUploading = false
       })
 
 
@@ -241,6 +241,7 @@ struct Index {
           .border({ width: 4, color: '#FFFFFF' }) // 白色边框
           .onClick(() => {
             console.log(TAG, "点击了拍照按钮")
+            this.isUploading = true
             this.takePhoto();
 
           })

+ 18 - 10
entry/src/main/ets/pages/Index.ets

@@ -5,7 +5,8 @@ import uploadInstance from "../utils/UploadUtil"
 
 
 const TAG = "openHarmonyBridge" //webview和vue沟通的名称
-const webUrl = "http://10.88.11.200:11000"
+// const webUrl = "http://192.168.1.4:11000/"
+const webUrl = "http://192.168.0.49:3005/"
 
 // const webUrl = "http://10.88.20.88:3005/"
 
@@ -37,11 +38,16 @@ class BridgeModel {
 
   startCamera(params: string): void {
     console.info(TAG, `startCamera:`, params);
+    // 如果在web端第的登录页面传参数不对,这里要注释掉以免报错
     uploadInstance.configUploadParam(params)
-    router.pushUrl({ url: "pages/CameraPage" })
+    // router.pushUrl({ url: "pages/CameraPage" })
+    router.pushUrl({
+      url: "pages/CameraVersion2"
+    })
   }
 
   exitApp(params: string): void {
+    console.info(TAG, `exitApp:`, params);
     let pro = new process.ProcessManager();
     pro.exit(0);
   }
@@ -75,10 +81,11 @@ struct Index {
       // 这个webview调用相机不知道为什么只能执行一次,选择文件的回到还行,但是为了统一写法还是用registerJavaScriptProxy,但是有时候注册的方法也只能执行一次,不知道为什么。
       // Web({ src: $rawfile('doc_old.html'), controller: this.controller })//测试官方文档 这个是好使的
 
-      // Web({
-      //   src: "http://192.168.101.118:3005/login",
-      //   controller: this.controller
-      // })
+      Button("跳转到相机页面").onClick(() => {
+        router.pushUrl({
+          url: "pages/CameraVersion2"
+        })
+      })
       Web({
         src: webUrl,
         controller: this.controller
@@ -109,10 +116,11 @@ struct Index {
 
           // event.request.grant([""])
         })
-      // .onConsole((e) => {
-      //   console.log(TAG, "onConsole", JSON.stringify(e))
-      //   return true
-      // })
+      .onConsole((e) => {
+        console.log(TAG, "onConsole", JSON.stringify(e))
+        return true
+      })
+
 
 
       // 退出程序

+ 2 - 2
entry/src/main/ets/utils/Request.ets

@@ -12,8 +12,8 @@ import { printError, printRequest, printResponse, handleRes } from './Helps';
 import RequestParamsModel from './requestParams';
 import uploadInstance from './UploadUtil';
 
-
-export  const JGRequestBaseUrl = "http://10.88.11.200:8079/"
+// jxq: 项目基本请求路径 险峰的
+export  const JGRequestBaseUrl = "http://192.168.1.4:8079/"
 
 const DEBUG = true //
 

+ 1 - 1
entry/src/main/ets/utils/UploadUtil.ets

@@ -40,7 +40,7 @@ interface FileDataModel {
 
 class UploadUtil {
   private baseUrl: string = JGRequestBaseUrl
-  private fileUrl: string = "http://192.168.1.4/:9000" //上传完成后可以查看的
+  private fileUrl: string = "http://192.168.1.4:9000" //上传完成后可以查看的
   private uploadPath: string = "/api/v1/base/upload"
   controller: web_webview.WebviewController | null = null
   ports: web_webview.WebMessagePort[] = [];