Ver código fonte

删除测试页面,调整相机界面返回

dengrui 3 meses atrás
pai
commit
005e7b8f47

+ 5 - 5
build-profile.json5

@@ -21,13 +21,13 @@
       {
         "name": "default",
         "material": {
-          "certpath": "C:/Users/Administrator/.ohos/config/openharmony/default_common-station-web_RYQhOtG3oPpAUMsnAlEeKMLDDcU6Dxe3sz7pow0GVEQ=.cer",
-          "storePassword": "0000001AA22B3872C196E0E68F876789073DB734D98E385061515171EB6B4D122CDFE61062E1B2C9A724",
+          "certpath": "C:/Users/suyat/.ohos/config/openharmony/default_common-station-web_vZFNwrVUnpY3mys1WI1huqdp1qAMQniXhwm2hXzDqzw=.cer",
+          "storePassword": "00000019CEA85C11F67495AD711499FA68E595A610FAFB257D57D5ED14D52A67E505935558E6F62C4C",
           "keyAlias": "debugKey",
-          "keyPassword": "0000001A00539E6C3C1BDF580730B26B0E934586A504A2501E116A7CB12C091792BBE45B3617842AC252",
-          "profile": "C:/Users/Administrator/.ohos/config/openharmony/default_common-station-web_RYQhOtG3oPpAUMsnAlEeKMLDDcU6Dxe3sz7pow0GVEQ=.p7b",
+          "keyPassword": "00000019F9BDB276526512C9334D6E76D2B9B7346047185576241194B982DBB926339764834ABDC473",
+          "profile": "C:/Users/suyat/.ohos/config/openharmony/default_common-station-web_vZFNwrVUnpY3mys1WI1huqdp1qAMQniXhwm2hXzDqzw=.p7b",
           "signAlg": "SHA256withECDSA",
-          "storeFile": "C:/Users/Administrator/.ohos/config/openharmony/default_common-station-web_RYQhOtG3oPpAUMsnAlEeKMLDDcU6Dxe3sz7pow0GVEQ=.p12"
+          "storeFile": "C:/Users/suyat/.ohos/config/openharmony/default_common-station-web_vZFNwrVUnpY3mys1WI1huqdp1qAMQniXhwm2hXzDqzw=.p12"
         }
       }
     ]

+ 21 - 6
entry/src/main/ets/pages/CameraVersion2.ets

@@ -200,9 +200,11 @@ struct Index {
   build() {
     Column() {
       Row() {
+
       }
       .width('100%')
       .height('5%')
+      .alignItems(VerticalAlign.Center)
       Row() {
         if (this.commodityPixelMap) {
           Stack({ alignContent: Alignment.Center }) {
@@ -234,31 +236,44 @@ struct Index {
 
       // 底部:拍照按钮区域
       Row() {
-        Button('', { type: ButtonType.Circle })
+        Button('', { type: ButtonType.Circle})
           .width(this.isButtonPressed ? 70 : 80) // 按下时缩小按钮
           .height(this.isButtonPressed ? 70 : 80)
           .backgroundColor(this.isButtonPressed ? '#CCCCCC' : '#FFFFFF') // 按下时按钮颜色变灰
-          .border({ width: 4, color: '#FFFFFF' }) // 白色边框
+          .border({ width: 4, color: '#FFFFFF' })// 白色边框
           .onClick(() => {
             console.log(TAG, "点击了拍照按钮")
+            if(this.isUploading){
+              return
+            }
             this.isUploading = true
             this.takePhoto();
 
           })
           .onTouch((event: TouchEvent) => {
+            if(this.isUploading){
+              return
+            }
             if (event.type === TouchType.Down) {
               this.isButtonPressed = true; // 按下时设置为 true
             } else if (event.type === TouchType.Up || event.type === TouchType.Cancel) {
               this.isButtonPressed = false; // 松开时设置为 false
             }
           })
+        Button(){
+          Image($r('app.media.close'))
+            .width(40)
+            .height(40)
+        }
+        .width(70)
+        .height(70)
+        .backgroundColor('#1c1c1c')
+        .onClick(() => {
+          router.back()        })
 
-        Button("返回1").onClick(() => {
-          router.back()
-        })
       }.width('100%')
       .height('15%')
-      .justifyContent(FlexAlign.Center) // 按钮居中
+      .justifyContent(FlexAlign.SpaceEvenly) // 按钮居中
       .backgroundColor('#000000') // 底部背景为黑色
     }
     .width('100%')

+ 7 - 7
entry/src/main/ets/pages/Index.ets

@@ -6,9 +6,9 @@ import uploadInstance from "../utils/UploadUtil"
 
 const TAG = "openHarmonyBridge" //webview和vue沟通的名称
 // const webUrl = "http://192.168.1.4:11000/"
-const webUrl = "http://192.168.0.49:3005/"
+// const webUrl = "http://192.168.0.47:3005/"
 
-// const webUrl = "http://10.88.20.88:3005/"
+const webUrl = "http://10.88.11.201:11000/"
 
 class BridgeModel {
   constructor() {
@@ -81,11 +81,11 @@ struct Index {
       // 这个webview调用相机不知道为什么只能执行一次,选择文件的回到还行,但是为了统一写法还是用registerJavaScriptProxy,但是有时候注册的方法也只能执行一次,不知道为什么。
       // Web({ src: $rawfile('doc_old.html'), controller: this.controller })//测试官方文档 这个是好使的
 
-      Button("跳转到相机页面").onClick(() => {
-        router.pushUrl({
-          url: "pages/CameraVersion2"
-        })
-      })
+      // Button("跳转到相机页面").onClick(() => {
+      //   router.pushUrl({
+      //     url: "pages/CameraVersion2"
+      //   })
+      // })
       Web({
         src: webUrl,
         controller: this.controller

+ 155 - 155
entry/src/main/ets/pages/TestDownloadPage.ets

@@ -1,155 +1,155 @@
-import request from '@ohos.request';
-import { BusinessError } from '@ohos.base';
-import { GlobalContext } from '../utils/GlobalThis';
-import fs from '@ohos.file.fs';
-import installer from '@ohos.bundle.installer';
-
-import common from '@ohos.app.ability.common';
-import buffer from '@ohos.buffer';
-import JGRequest from '../utils/Request';
-
-
-@Entry
-@Component
-struct TestDownloadPage {
-  @State message: string = '下载1111';
-
-  aboutToAppear(): void {
-
-
-  }
-
-  download = () => {
-    let url = "http://10.88.11.200:10000/openharmony/entry.hap"
-
-    try {
-      // 需要手动将 url 替换为真实服务器的 HTTP 协议地址
-      request.downloadFile(getContext(this), { url: url }).then((data: request.DownloadTask) => {
-        let downloadTask: request.DownloadTask = data;
-        downloadTask.on('progress', (r, t) => {
-          console.log("xxxxxxxxxxxxx", r, t)
-        })
-      }).catch((err: BusinessError) => {
-        console.error(`xxxxxxxxxxxxFailed to request the download. Code: ${err.code}, message: ${err.message}`);
-      })
-    } catch (err) {
-      console.error(`xxxxxxxxxxxxxFailed to request the download. err: ${JSON.stringify(err)}`);
-    }
-
-  }
-
-  downloadApp() {
-
-    let _this = this;
-
-    // 下载路径,示例: /data/storage/el2/base/haps/entry/files/org.ohosdev.deviceinfo-v1.0.0.hap
-    let filePath = getContext(this).filesDir + '/' + 'packageName' + '-' + '1.0.0' + ".hap";
-    console.log("xxxxxxxxxxxx filepath", filePath)
-    // 判断文件是否存在
-    fs.access(filePath).then((res) => {
-
-      // 不存在,下载并安装
-      try {
-        console.log("xxxxxxxxxxx  下载")
-        request.downloadFile(getContext(this), {
-          url: "http://10.88.11.200:10000/openharmony/entry.hap",
-          filePath: filePath,
-          header: {
-            'Content-Type': 'multipart/form-data',
-          }
-        }).then((downloadTask) => {
-
-          console.log("xxxxxxxxxxxxxxx", JSON.stringify(downloadTask))
-
-          // 监听下载完成
-          downloadTask.on('complete', () => {
-            console.info('xxxxxxxxxxxxxxxxxxDownload task completed.');
-            // 安装应用
-            // _this.installApp(filePath);
-          });
-          downloadTask.on('progress', (r, t) => {
-            console.log("xxxxxxxxxxxxx", r, t)
-          })
-          // // 监听下载失败
-          downloadTask.on('fail', (err) => {
-            console.info('xxxxxxxxxxx Download task failed. Cause:' + JSON.stringify(err));
-
-          });
-        }).catch((err: BusinessError) => {
-          console.error('xxxxxxxxxxxxxxxxxxxxxxxxFailed to request the download. Cause: ' + JSON.stringify(err));
-
-        })
-      } catch (err) {
-        // err.message: bad file path   Download File already exists
-        console.error('xxxxxxxxxxx xerr.code : ' + err.code + ', err.message : ' + err.message);
-
-      }
-
-    }).catch((err: BusinessError) => {
-      console.info("xxxxxxxxxxx access failed with error message: " + err.message + ", error code: " + err.code);
-    });
-  }
-
-  downloadAgent = () => {
-    let config: request.agent.Config = {
-      action: request.agent.Action.DOWNLOAD,
-      url: "http://10.88.11.200:10000/openharmony/entry.hap",
-      gauge: true,
-      overwrite: true,
-      // network: request.agent.Network.WIFI,
-    };
-    request.agent.create(getContext(), config).then((task: request.agent.Task) => {
-
-      task.on('progress', async (progress) => {
-        console.warn(`xxxxxxxxxxx   /Request download status ${progress.state}, downloaded ${progress.processed}`);
-      })
-      task.on('completed', async () => {
-        console.warn(`xxxxxxxxxxx  /Request download completed`);
-      })
-    }).catch((err: BusinessError) => {
-      console.info("xxxxxxxxxxx access failed with error message: " + err.message + ", error code: " + err.code);
-    });
-  }
-
-  // 安装应用 或 更新应用
-  installApp(hapPath: string) {
-    let hapFilePaths = [hapPath];
-    try {
-      installer.getBundleInstaller().then(data => {
-        data.install(hapFilePaths, {
-          userId: 100,
-          isKeepData: false,
-          installFlag: 1,
-        }, err => {
-          // if (err) {
-          //   console.error('install failed:' + err.message);
-          // } else {
-          //   console.info('install successfully.');
-          //
-          // }
-        });
-      }).catch(() => {
-        // console.error('getBundleInstaller failed. Cause: ' + error.message);
-
-      });
-    } catch (error) {
-      // console.error('getBundleInstaller failed. Cause: ' + error.message);
-
-    }
-  }
-
-  build() {
-    Row() {
-      Column() {
-        Text(this.message)
-          .fontSize(50)
-          .fontWeight(FontWeight.Bold)
-          .onClick(() => {
-            this.downloadApp()
-          })
-      }
-      .width('100%')
-    }
-    .height('100%')
-  }
-}
+// import request from '@ohos.request';
+// import { BusinessError } from '@ohos.base';
+// import { GlobalContext } from '../utils/GlobalThis';
+// import fs from '@ohos.file.fs';
+// import installer from '@ohos.bundle.installer';
+//
+// import common from '@ohos.app.ability.common';
+// import buffer from '@ohos.buffer';
+// import JGRequest from '../utils/Request';
+//
+//
+// @Entry
+// @Component
+// struct TestDownloadPage {
+//   @State message: string = '下载1111';
+//
+//   aboutToAppear(): void {
+//
+//
+//   }
+//
+//   download = () => {
+//     let url = "http://10.88.11.200:10000/openharmony/entry.hap"
+//
+//     try {
+//       // 需要手动将 url 替换为真实服务器的 HTTP 协议地址
+//       request.downloadFile(getContext(this), { url: url }).then((data: request.DownloadTask) => {
+//         let downloadTask: request.DownloadTask = data;
+//         downloadTask.on('progress', (r, t) => {
+//           console.log("xxxxxxxxxxxxx", r, t)
+//         })
+//       }).catch((err: BusinessError) => {
+//         console.error(`xxxxxxxxxxxxFailed to request the download. Code: ${err.code}, message: ${err.message}`);
+//       })
+//     } catch (err) {
+//       console.error(`xxxxxxxxxxxxxFailed to request the download. err: ${JSON.stringify(err)}`);
+//     }
+//
+//   }
+//
+//   downloadApp() {
+//
+//     let _this = this;
+//
+//     // 下载路径,示例: /data/storage/el2/base/haps/entry/files/org.ohosdev.deviceinfo-v1.0.0.hap
+//     let filePath = getContext(this).filesDir + '/' + 'packageName' + '-' + '1.0.0' + ".hap";
+//     console.log("xxxxxxxxxxxx filepath", filePath)
+//     // 判断文件是否存在
+//     fs.access(filePath).then((res) => {
+//
+//       // 不存在,下载并安装
+//       try {
+//         console.log("xxxxxxxxxxx  下载")
+//         request.downloadFile(getContext(this), {
+//           url: "http://10.88.11.200:10000/openharmony/entry.hap",
+//           filePath: filePath,
+//           header: {
+//             'Content-Type': 'multipart/form-data',
+//           }
+//         }).then((downloadTask) => {
+//
+//           console.log("xxxxxxxxxxxxxxx", JSON.stringify(downloadTask))
+//
+//           // 监听下载完成
+//           downloadTask.on('complete', () => {
+//             console.info('xxxxxxxxxxxxxxxxxxDownload task completed.');
+//             // 安装应用
+//             // _this.installApp(filePath);
+//           });
+//           downloadTask.on('progress', (r, t) => {
+//             console.log("xxxxxxxxxxxxx", r, t)
+//           })
+//           // // 监听下载失败
+//           downloadTask.on('fail', (err) => {
+//             console.info('xxxxxxxxxxx Download task failed. Cause:' + JSON.stringify(err));
+//
+//           });
+//         }).catch((err: BusinessError) => {
+//           console.error('xxxxxxxxxxxxxxxxxxxxxxxxFailed to request the download. Cause: ' + JSON.stringify(err));
+//
+//         })
+//       } catch (err) {
+//         // err.message: bad file path   Download File already exists
+//         console.error('xxxxxxxxxxx xerr.code : ' + err.code + ', err.message : ' + err.message);
+//
+//       }
+//
+//     }).catch((err: BusinessError) => {
+//       console.info("xxxxxxxxxxx access failed with error message: " + err.message + ", error code: " + err.code);
+//     });
+//   }
+//
+//   downloadAgent = () => {
+//     let config: request.agent.Config = {
+//       action: request.agent.Action.DOWNLOAD,
+//       url: "http://10.88.11.200:10000/openharmony/entry.hap",
+//       gauge: true,
+//       overwrite: true,
+//       // network: request.agent.Network.WIFI,
+//     };
+//     request.agent.create(getContext(), config).then((task: request.agent.Task) => {
+//
+//       task.on('progress', async (progress) => {
+//         console.warn(`xxxxxxxxxxx   /Request download status ${progress.state}, downloaded ${progress.processed}`);
+//       })
+//       task.on('completed', async () => {
+//         console.warn(`xxxxxxxxxxx  /Request download completed`);
+//       })
+//     }).catch((err: BusinessError) => {
+//       console.info("xxxxxxxxxxx access failed with error message: " + err.message + ", error code: " + err.code);
+//     });
+//   }
+//
+//   // 安装应用 或 更新应用
+//   installApp(hapPath: string) {
+//     let hapFilePaths = [hapPath];
+//     try {
+//       installer.getBundleInstaller().then(data => {
+//         data.install(hapFilePaths, {
+//           userId: 100,
+//           isKeepData: false,
+//           installFlag: 1,
+//         }, err => {
+//           // if (err) {
+//           //   console.error('install failed:' + err.message);
+//           // } else {
+//           //   console.info('install successfully.');
+//           //
+//           // }
+//         });
+//       }).catch(() => {
+//         // console.error('getBundleInstaller failed. Cause: ' + error.message);
+//
+//       });
+//     } catch (error) {
+//       // console.error('getBundleInstaller failed. Cause: ' + error.message);
+//
+//     }
+//   }
+//
+//   build() {
+//     Row() {
+//       Column() {
+//         Text(this.message)
+//           .fontSize(50)
+//           .fontWeight(FontWeight.Bold)
+//           .onClick(() => {
+//             this.downloadApp()
+//           })
+//       }
+//       .width('100%')
+//     }
+//     .height('100%')
+//   }
+// }

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

@@ -13,7 +13,7 @@ import RequestParamsModel from './requestParams';
 import uploadInstance from './UploadUtil';
 
 // jxq: 项目基本请求路径 险峰的
-export  const JGRequestBaseUrl = "http://192.168.1.4:8079/"
+export  const JGRequestBaseUrl = "http://10.88.11.200: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://10.88.11.201:9000" //上传完成后可以查看的
   private uploadPath: string = "/api/v1/base/upload"
   controller: web_webview.WebviewController | null = null
   ports: web_webview.WebMessagePort[] = [];

Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 0
entry/src/main/resources/base/media/close.svg


+ 0 - 1
entry/src/main/resources/base/profile/main_pages.json

@@ -4,7 +4,6 @@
     "pages/CameraPage",
     "pages/SelectFilePage",
     "pages/TestHdcInstallPage",
-    "pages/TestDownloadPage",
     "pages/StationDevicesPage",
     "pages/PostMessagePage",
     "pages/CameraVersion2"