From 17b57327217d59bf2ac68ac0db7adeb2106621a7 Mon Sep 17 00:00:00 2001 From: sfchu Date: Wed, 27 Aug 2025 09:52:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=B3=A8=E9=87=8A=E8=8B=B1?= =?UTF-8?q?=E6=96=87=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/js/MainAbility/exit/exit.hml | 2 +- .../src/main/js/MainAbility/exit/exit.js | 6 +-- .../main/js/MainAbility/initpage/initpage.hml | 2 +- .../main/js/MainAbility/pages/index/index.css | 12 ++--- .../src/main/js/MainAbility/security/DES.js | 50 +++++++++---------- .../src/main/js/MainAbility/style1/style1.hml | 5 +- .../src/main/js/MainAbility/style2/style2.hml | 6 ++- .../src/main/js/MainAbility/style3/style3.css | 4 +- .../src/main/js/MainAbility/style3/style3.hml | 4 +- 9 files changed, 47 insertions(+), 44 deletions(-) diff --git a/LiteWearable/entry/src/main/js/MainAbility/exit/exit.hml b/LiteWearable/entry/src/main/js/MainAbility/exit/exit.hml index 9b0a820d..db1fc10f 100644 --- a/LiteWearable/entry/src/main/js/MainAbility/exit/exit.hml +++ b/LiteWearable/entry/src/main/js/MainAbility/exit/exit.hml @@ -1,5 +1,5 @@ +
Hello {{ title }} diff --git a/LiteWearable/entry/src/main/js/MainAbility/exit/exit.js b/LiteWearable/entry/src/main/js/MainAbility/exit/exit.js index 8d9cfc72..5af73721 100644 --- a/LiteWearable/entry/src/main/js/MainAbility/exit/exit.js +++ b/LiteWearable/entry/src/main/js/MainAbility/exit/exit.js @@ -1,7 +1,7 @@ // [Start exit_js] // index.js import router from '@ohos.router'; -// 导入app模块 +// Import the app module. import app from '@system.app'; export default { @@ -13,8 +13,8 @@ export default { uri: 'pages/details/details' }); }, - touchMove(e) { // swipe处理事件 - if (e.direction == 'right') { // 右滑退出 + touchMove(e) { // Handle swipe events. + if (e.direction == 'right') { // Swipe right to exit. app.terminate(); } } diff --git a/LiteWearable/entry/src/main/js/MainAbility/initpage/initpage.hml b/LiteWearable/entry/src/main/js/MainAbility/initpage/initpage.hml index 0acac82f..6ac97274 100644 --- a/LiteWearable/entry/src/main/js/MainAbility/initpage/initpage.hml +++ b/LiteWearable/entry/src/main/js/MainAbility/initpage/initpage.hml @@ -1,5 +1,5 @@ +
Hello {{ title }} diff --git a/LiteWearable/entry/src/main/js/MainAbility/pages/index/index.css b/LiteWearable/entry/src/main/js/MainAbility/pages/index/index.css index a75028a4..6388b193 100644 --- a/LiteWearable/entry/src/main/js/MainAbility/pages/index/index.css +++ b/LiteWearable/entry/src/main/js/MainAbility/pages/index/index.css @@ -1,10 +1,10 @@ .container { - width: 100%;/* 容器宽度设置为 100% */ - height: 100%;/* 容器高度设置为 100% */ + width: 100%;/* The width of the container is set to 100%. */ + height: 100%;/* The height of the container is set to 100%. */ justify-content: center; align-items: center; flex-direction: column; - background-color: aquamarine;/* 设置背景色为碧绿色 */ + background-color: aquamarine;/* Set the background color to light green. */ } .stackContainer { @@ -14,8 +14,8 @@ } .button { - top: 10%;/* 设置y轴上距离父组件为父组件高度的10%位置 */ - left: 10%;/* 设置x轴上距离父组件为父组件宽度的10%位置 */ + top: 10%;/* Set the position on the y-axis to be 10% of the height of the parent component from the top. */ + left: 10%;/* Set the position on the x-axis to be 10% of the width of the parent component from the parent component itself. */ width: 50%; height: 30%; font-size: 30px; @@ -27,5 +27,5 @@ height: 20%; font-size: 30px; background-color: black; - margin-top: 2%;/* 父组件高度的2% */ + margin-top: 2%;/* 2% of the height of the parent component. */ } \ No newline at end of file diff --git a/LiteWearable/entry/src/main/js/MainAbility/security/DES.js b/LiteWearable/entry/src/main/js/MainAbility/security/DES.js index efa05f9a..a9cbba6c 100644 --- a/LiteWearable/entry/src/main/js/MainAbility/security/DES.js +++ b/LiteWearable/entry/src/main/js/MainAbility/security/DES.js @@ -3,35 +3,35 @@ import huks from '@ohos.security.huks'; // [Start des_encrypt] // [Start des_decrypt] -// 别名,用于区分生成的KEY +// Alias, used to distinguish the generated KEY. const DES_CBC_64_KEY_ALIAS = 'DesCBC64KeyAlias'; // [StartExclude des_generate] -// 三段式句柄,用于连接三段式上下文 +// Three-part handle, used for connecting three-part context. let handle; let IV = '12345678'; -// 明文,加密前数据 +// Plain text, data before encryption. let plainText = 'DESAAAdffssghCBC5612345612345L64'; -// 密文,存放加密后数据 +// Ciphertext, storing the encrypted data. let cipherText = ''; // [EndExclude des_generate] // [StartExclude des_encrypt] // [StartExclude des_decrypt] -// 配置生成密钥所需的Tag +// Configure the Tag required for generating the key. function getDesGenProperties() { let properties = new Array(); let index = 0; - // DES算法 + // DES algorithm. properties[index++] = { tag: huks.HuksTag.HUKS_TAG_ALGORITHM, value: huks.HuksKeyAlg.HUKS_ALG_DES }; - // 密钥长度64 + // Key length: 64. properties[index++] = { tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, value: huks.HuksKeySize.HUKS_DES_KEY_SIZE_64 }; - // 密钥用途,加密和解密 + // Key usage, encryption and decryption. properties[index++] = { tag: huks.HuksTag.HUKS_TAG_PURPOSE, value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT @@ -40,7 +40,7 @@ function getDesGenProperties() { return properties; } -// 生成密钥 +// Generate a key. function generateDESKey() { let huksInfo; let options = { properties: getDesGenProperties() } @@ -58,37 +58,37 @@ function generateDESKey() { function getDesCBCEncryptProperties() { let properties = new Array(); let index = 0; - // 算法 + // algorithm. properties[index++] = { tag: huks.HuksTag.HUKS_TAG_ALGORITHM, value: huks.HuksKeyAlg.HUKS_ALG_DES }; - // 密钥长度 + // key length. properties[index++] = { tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, value: huks.HuksKeySize.HUKS_DES_KEY_SIZE_64 }; - // 密钥用途 + // Key usage. properties[index++] = { tag: huks.HuksTag.HUKS_TAG_PURPOSE, value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT }; - // 填充方式 + // Filling method. properties[index++] = { tag: huks.HuksTag.HUKS_TAG_PADDING, value: huks.HuksKeyPadding.HUKS_PADDING_NONE }; - // 分组方式 + // packet mode. properties[index++] = { tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, value: huks.HuksCipherMode.HUKS_MODE_CBC }; - // 分组加密偏移向量,更安全 + // Group encryption offset vector, more secure. properties[index++] = { tag: huks.HuksTag.HUKS_TAG_IV, value: stringToUint8Array(IV) @@ -143,7 +143,7 @@ function encryptDES() { } }); } else { - // 密文接收 + // Encrypted message reception cipherText = uint8ArrayToString(updateData.outData); huksInfo = cipherText } @@ -163,7 +163,7 @@ function encryptDES() { } }); } else { - // 密文接收 + // Encrypted message reception cipherText = cipherText + uint8ArrayToString(finishData.outData); huksInfo = cipherText } @@ -194,32 +194,32 @@ function uint8ArrayToString(fileData) { function GetDesCBCDecryptProperties() { let properties = new Array(); let index = 0; - // 算法 + // algorithm properties[index++] = { tag: huks.HuksTag.HUKS_TAG_ALGORITHM, value: huks.HuksKeyAlg.HUKS_ALG_DES }; - // 密钥长度 + // key length properties[index++] = { tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, value: huks.HuksKeySize.HUKS_DES_KEY_SIZE_64 }; - // 密钥用途 + // Key usage properties[index++] = { tag: huks.HuksTag.HUKS_TAG_PURPOSE, value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT }; - // 填充方式 + // Filling method properties[index++] = { tag: huks.HuksTag.HUKS_TAG_PADDING, value: huks.HuksKeyPadding.HUKS_PADDING_NONE }; - // 分组方式 + // packet mode properties[index++] = { tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, value: huks.HuksCipherMode.HUKS_MODE_CBC }; - // 分组加密偏移向量,更安全 + // Group encryption offset vector, more secure properties[index++] = { tag: huks.HuksTag.HUKS_TAG_IV, value: stringToUint8Array(IV) @@ -274,7 +274,7 @@ function decryptDES() { } }); } else { - // 明文接收 + // Clear text reception outPlainText = uint8ArrayToString(updateData.outData); huksInfo = outPlainText; } @@ -294,7 +294,7 @@ function decryptDES() { } }); } else { - // 明文接收 + // Clear text reception outPlainText = outPlainText + uint8ArrayToString(finishData.outData); huksInfo = outPlainText; } diff --git a/LiteWearable/entry/src/main/js/MainAbility/style1/style1.hml b/LiteWearable/entry/src/main/js/MainAbility/style1/style1.hml index bc53d37e..86089f34 100644 --- a/LiteWearable/entry/src/main/js/MainAbility/style1/style1.hml +++ b/LiteWearable/entry/src/main/js/MainAbility/style1/style1.hml @@ -1,8 +1,9 @@ + +
- + Hello World
diff --git a/LiteWearable/entry/src/main/js/MainAbility/style2/style2.hml b/LiteWearable/entry/src/main/js/MainAbility/style2/style2.hml index 161b7efb..7f5f73b1 100644 --- a/LiteWearable/entry/src/main/js/MainAbility/style2/style2.hml +++ b/LiteWearable/entry/src/main/js/MainAbility/style2/style2.hml @@ -1,7 +1,9 @@ + +
- + + Hello World diff --git a/LiteWearable/entry/src/main/js/MainAbility/style3/style3.css b/LiteWearable/entry/src/main/js/MainAbility/style3/style3.css index e90d8da4..2dde480f 100644 --- a/LiteWearable/entry/src/main/js/MainAbility/style3/style3.css +++ b/LiteWearable/entry/src/main/js/MainAbility/style3/style3.css @@ -1,4 +1,4 @@ -/* .为类选择器,所有组件中class="container" 的组件都会使用该样式 */ +/* . For the class selector, all components with the class attribute set to "container" will apply this style. */ .container { display: flex; justify-content: center; @@ -6,7 +6,7 @@ width: 466px; height: 466px; } -/* #为ID选择器,id为title的组件会使用该样式 */ +/* # For the ID selector, the component with the ID "title" will apply this style. */ #title { font-size: 30px; text-align: center; diff --git a/LiteWearable/entry/src/main/js/MainAbility/style3/style3.hml b/LiteWearable/entry/src/main/js/MainAbility/style3/style3.hml index e23b9118..e63cb8f9 100644 --- a/LiteWearable/entry/src/main/js/MainAbility/style3/style3.hml +++ b/LiteWearable/entry/src/main/js/MainAbility/style3/style3.hml @@ -1,8 +1,8 @@ - +
- + Hello World -- Gitee