Apate 5 bulan lalu
induk
melakukan
1b12466b11
77 mengubah file dengan 792 tambahan dan 0 penghapusan
  1. TEMPAT SAMPAH
      Charge6.hap
  2. 11 0
      Charge6/.gitignore
  3. 10 0
      Charge6/AppScope/app.json5
  4. 8 0
      Charge6/AppScope/resources/base/element/string.json
  5. TEMPAT SAMPAH
      Charge6/AppScope/resources/base/media/app_icon.png
  6. 27 0
      Charge6/build-profile.json5
  7. 6 0
      Charge6/entry/.gitignore
  8. 14 0
      Charge6/entry/build-profile.json5
  9. 2 0
      Charge6/entry/hvigorfile.ts
  10. 10 0
      Charge6/entry/oh-package.json5
  11. 41 0
      Charge6/entry/src/main/ets/entryability/EntryAbility.ts
  12. 147 0
      Charge6/entry/src/main/ets/pages/Index.ets
  13. 33 0
      Charge6/entry/src/main/ets/pages/utils.ets
  14. 37 0
      Charge6/entry/src/main/module.json5
  15. 8 0
      Charge6/entry/src/main/resources/base/element/color.json
  16. 16 0
      Charge6/entry/src/main/resources/base/element/string.json
  17. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/1.jpg
  18. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/20.jpg
  19. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/29.jpg
  20. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/40.jpg
  21. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/7.jpg
  22. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/ChargeStation.png
  23. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/add_car.png
  24. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/add_carging_pile.png
  25. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/addcarBg.png
  26. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/addchargingBg.png
  27. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/avatar.png
  28. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/back.png
  29. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/bg.png
  30. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/bottomBg.png
  31. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/car.png
  32. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/carCharging.png
  33. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/car_3d.png
  34. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/charge.png
  35. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/charging.png
  36. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/chargingBg.png
  37. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/chargingIcon.png
  38. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/charging_pile.png
  39. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/drop_down.png
  40. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/electric.png
  41. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/home.png
  42. 1 0
      Charge6/entry/src/main/resources/base/media/ic_bottom_home.svg
  43. 0 0
      Charge6/entry/src/main/resources/base/media/ic_bottom_record.svg
  44. 1 0
      Charge6/entry/src/main/resources/base/media/ic_bottom_user.svg
  45. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/icon.png
  46. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/location.png
  47. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/logo.png
  48. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/mileage.png
  49. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/my.png
  50. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/navigation.png
  51. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/order.png
  52. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/orderId.png
  53. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/paid.png
  54. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/pay.png
  55. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/right.png
  56. TEMPAT SAMPAH
      Charge6/entry/src/main/resources/base/media/unpaid.png
  57. 5 0
      Charge6/entry/src/main/resources/base/profile/main_pages.json
  58. 16 0
      Charge6/entry/src/main/resources/en_US/element/string.json
  59. 16 0
      Charge6/entry/src/main/resources/zh_CN/element/string.json
  60. 35 0
      Charge6/entry/src/ohosTest/ets/test/Ability.test.ets
  61. 5 0
      Charge6/entry/src/ohosTest/ets/test/List.test.ets
  62. 48 0
      Charge6/entry/src/ohosTest/ets/testability/TestAbility.ets
  63. 34 0
      Charge6/entry/src/ohosTest/ets/testability/pages/Index.ets
  64. 49 0
      Charge6/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts
  65. 37 0
      Charge6/entry/src/ohosTest/module.json5
  66. 8 0
      Charge6/entry/src/ohosTest/resources/base/element/color.json
  67. 16 0
      Charge6/entry/src/ohosTest/resources/base/element/string.json
  68. TEMPAT SAMPAH
      Charge6/entry/src/ohosTest/resources/base/media/icon.png
  69. 5 0
      Charge6/entry/src/ohosTest/resources/base/profile/test_pages.json
  70. 6 0
      Charge6/hvigor/hvigor-config.json5
  71. 0 0
      Charge6/hvigor/hvigor-wrapper.js
  72. 2 0
      Charge6/hvigorfile.ts
  73. 48 0
      Charge6/hvigorw
  74. 64 0
      Charge6/hvigorw.bat
  75. 13 0
      Charge6/oh-package-lock.json5
  76. 13 0
      Charge6/oh-package.json5
  77. TEMPAT SAMPAH
      产品原型(国六).rp

TEMPAT SAMPAH
Charge6.hap


+ 11 - 0
Charge6/.gitignore

@@ -0,0 +1,11 @@
+/node_modules
+/oh_modules
+/local.properties
+/.idea
+**/build
+/.hvigor
+.cxx
+/.clangd
+/.clang-format
+/.clang-tidy
+**/.test

+ 10 - 0
Charge6/AppScope/app.json5

@@ -0,0 +1,10 @@
+{
+  "app": {
+    "bundleName": "com.example.charge6",
+    "vendor": "example",
+    "versionCode": 1000000,
+    "versionName": "1.0.0",
+    "icon": "$media:app_icon",
+    "label": "$string:app_name"
+  }
+}

+ 8 - 0
Charge6/AppScope/resources/base/element/string.json

@@ -0,0 +1,8 @@
+{
+  "string": [
+    {
+      "name": "app_name",
+      "value": "Charge6"
+    }
+  ]
+}

TEMPAT SAMPAH
Charge6/AppScope/resources/base/media/app_icon.png


+ 27 - 0
Charge6/build-profile.json5

@@ -0,0 +1,27 @@
+{
+  "app": {
+    "signingConfigs": [],
+    "compileSdkVersion": 9,
+    "compatibleSdkVersion": 9,
+    "products": [
+      {
+        "name": "default",
+        "signingConfig": "default",
+      }
+    ]
+  },
+  "modules": [
+    {
+      "name": "entry",
+      "srcPath": "./entry",
+      "targets": [
+        {
+          "name": "default",
+          "applyToProducts": [
+            "default"
+          ]
+        }
+      ]
+    }
+  ]
+}

+ 6 - 0
Charge6/entry/.gitignore

@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test

+ 14 - 0
Charge6/entry/build-profile.json5

@@ -0,0 +1,14 @@
+{
+  "apiType": 'stageMode',
+  "buildOption": {
+  },
+  "targets": [
+    {
+      "name": "default",
+      "runtimeOS": "HarmonyOS"
+    },
+    {
+      "name": "ohosTest",
+    }
+  ]
+}

+ 2 - 0
Charge6/entry/hvigorfile.ts

@@ -0,0 +1,2 @@
+// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
+export { hapTasks } from '@ohos/hvigor-ohos-plugin';

+ 10 - 0
Charge6/entry/oh-package.json5

@@ -0,0 +1,10 @@
+{
+  "name": "entry",
+  "version": "1.0.0",
+  "description": "Please describe the basic information.",
+  "main": "",
+  "author": "",
+  "license": "",
+  "dependencies": {}
+}
+

+ 41 - 0
Charge6/entry/src/main/ets/entryability/EntryAbility.ts

@@ -0,0 +1,41 @@
+import UIAbility from '@ohos.app.ability.UIAbility';
+import hilog from '@ohos.hilog';
+import window from '@ohos.window';
+
+export default class EntryAbility extends UIAbility {
+  onCreate(want, launchParam) {
+    hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+  }
+
+  onDestroy() {
+    hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
+  }
+
+  onWindowStageCreate(windowStage: window.WindowStage) {
+    // Main window is created, set main page for this ability
+    hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+
+    windowStage.loadContent('pages/Index', (err, data) => {
+      if (err.code) {
+        hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
+        return;
+      }
+      hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? '');
+    });
+  }
+
+  onWindowStageDestroy() {
+    // Main window is destroyed, release UI related resources
+    hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+  }
+
+  onForeground() {
+    // Ability has brought to foreground
+    hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
+  }
+
+  onBackground() {
+    // Ability has back to background
+    hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
+  }
+}

+ 147 - 0
Charge6/entry/src/main/ets/pages/Index.ets

@@ -0,0 +1,147 @@
+import utils from './utils'
+@Entry
+@Component
+struct Index {
+  @State currentTabIndex: number = 0
+
+  build() {
+    Tabs({barPosition: BarPosition.End}){
+      TabContent(){Home()}.tabBar(this.Bar({image: $r('app.media.ic_bottom_home'), title: '首页', index: 0}))
+      TabContent(){Text('订单')}.tabBar(this.Bar({image: $r('app.media.ic_bottom_record'), title: '订单', index: 1}))
+      TabContent(){Text('个人中心')}.tabBar(this.Bar({image: $r('app.media.ic_bottom_user'), title: '个人中心', index: 2}))
+    }.onChange((v)=>{
+      this.currentTabIndex = v;
+    })
+  }
+  @Builder Bar(option){
+    Column({space:5}){
+      Image(option.image).width(24).fillColor(this.currentTabIndex == option.index ? Color.Blue : '')
+      Text(option.title).fontSize(12).fontColor(this.currentTabIndex == option.index ? Color.Blue : Color.Gray)
+    }
+  }
+}
+export class CarInfoData{
+  id?:	number = 0;
+  licencePlate?:	string = '';
+  vehicleBrand?:	string = '';
+  vehicleModel?:	string = '';
+  remainingMileage?:	number = 0;
+  rechargeStatus?:	number = 0
+}
+
+@Component struct Home {
+  @State carInfoData:CarInfoData = {}
+  @State chargeState:boolean = false
+  @State power: number = 0
+
+
+  aboutToAppear(){
+    this.getCarInfoData();
+  }
+  private getCarInfoData(){
+    utils.doRequest("POST", "/login", {username: 'user', password: '123456'}, (res)=>{
+      AppStorage.SetOrCreate('token', res.token)
+      utils.doRequest("GET", "/api/recharge/vehicle/selected", {}, (res)=>{
+        this.carInfoData = res.data
+      })
+    })
+  }
+  build(){
+    Column({space:25}){
+      Row({space:5}){
+        Image($r('app.media.logo')).width(24)
+        Text('首页').fontSize(24)
+      }.width('100%').margin({top:20})
+      Row(){
+        Text('当前车辆').fontSize(20)
+        Blank()
+        Text('京'+this.carInfoData.licencePlate).fontSize(15)
+      }.width('100%')
+      Row(){
+        this.titleList({key: '车牌', value: '京 '+this.carInfoData.licencePlate})
+        this.titleList({key: '品牌', value: this.carInfoData.vehicleBrand})
+        this.titleList({key: '型号', value: this.carInfoData.vehicleModel})
+        this.titleList({key: '剩余里程', value: this.carInfoData.remainingMileage+" km"})
+      }.width('100%').justifyContent(FlexAlign.SpaceAround)
+     Image($r('app.media.1')).height("30%").width('100%')
+
+      if (true){
+        this.chargeStart()
+      }
+
+      Row(){
+        this.btn({image: $r('app.media.add_car'), title: "添加车辆"})
+        this.btn({image: $r('app.media.add_carging_pile'), title: "添加充电桩"})
+        this.btn({image: $r('app.media.charge'), title: "一键充电"})
+
+      }.width('100%').height('20%').justifyContent(FlexAlign.SpaceAround).backgroundColor('#ffd2f5f5').borderRadius(20)
+
+
+
+    }.width('100%').height('100%').padding(20)
+  }
+  @Builder titleList(option){
+    Column({space:8}){
+      Text(option.value).fontSize(20).fontWeight(FontWeight.Bold)
+      Text(option.key).fontSize(15).fontColor(Color.Gray)
+    }
+  }
+  @Builder btn(option){
+    Column({space:8}){
+      Button(){
+        Image(option.image).width(24)
+      }.type(ButtonType.Circle).padding(15).backgroundColor('#fff')
+      Text(option.title)
+    }
+  }
+  private  timer;
+  private startCharging(){
+    this.chargeState = true
+    this.timer = setInterval(()=>{
+      this.power += 10;
+      if (this.power > 100) {
+        this.power = 100;
+        clearInterval(this.timer)
+      }
+    },1000)
+  }
+  private endCharge(){
+    clearInterval(this.timer)
+    this.chargeState = false
+  }
+  @Builder chargeStart(){
+    Column({space:15}){
+      Row(){
+        Text('已连接:1号充电桩').fontSize(20).fontWeight(FontWeight.Bold)
+        Blank()
+        Button(this.chargeState ? '停止充电' : '开始充电')
+          .height('30vp')
+          .fontSize(15)
+          .width(100)
+          .onClick(()=>{
+            this.chargeState ? this.endCharge() : this.startCharging()
+          })
+      }.width('100%')
+      Row(){
+        Progress({value:this.power, total:100, type:ProgressType.Capsule})
+          .width('70%').height(10)
+        Row({space:5}){
+          Text(this.power+'%')
+          Text('|')
+          Text(this.chargeState ? (this.power == 100 ? "已充满" : "充电中") : "待充电")
+        }
+      }.width('100%').justifyContent(FlexAlign.SpaceBetween)
+      if (this.chargeState){
+        Row(){
+          Text("充电功率:250W").fontSize(12)
+          Blank()
+          Text(){
+            Span('预计还需')
+            Span(`${100 - this.power}分钟`).fontColor(Color.Orange)
+            Span('充满')
+          }.fontSize(12)
+        }.width('100%')
+      }
+    }
+  }
+}

+ 33 - 0
Charge6/entry/src/main/ets/pages/utils.ets

@@ -0,0 +1,33 @@
+import http from '@ohos.net.http'
+import Prompt from '@system.prompt'
+export class CommonConstants{
+  static  readonly server:string = 'http://10.2.19.161:8080/zh-admin'
+}
+export default {
+  doRequest(methods: string, uri:string, params:object, successFun: Function){
+    const httpRequest = http.createHttp()
+    httpRequest.request(
+      CommonConstants.server + uri, {
+      // @ts-ignore
+      method:methods,
+      header:{
+        "Content-Type":"application/json",
+        "Authorization":'Bearer ' +	AppStorage.Get('token')
+      },
+      extraData:params,
+    },(err, data)=>{
+      if (!err) {
+        var result = JSON.parse(data.result.toString())
+        if (result.code === 200) {
+          successFun(result)
+        }else {
+          Prompt.showToast({
+            message: result.msg
+          });
+        }
+      }else {
+        console.error("error: "+JSON.stringify(err))
+      }
+    });
+  }
+}

+ 37 - 0
Charge6/entry/src/main/module.json5

@@ -0,0 +1,37 @@
+{
+  "module": {
+    "name": "entry",
+    "type": "entry",
+    "description": "$string:module_desc",
+    "mainElement": "EntryAbility",
+    "deviceTypes": [
+      "phone",
+      "tablet"
+    ],
+    "deliveryWithInstall": true,
+    "installationFree": false,
+    "pages": "$profile:main_pages",
+    "abilities": [
+      {
+        "name": "EntryAbility",
+        "srcEntry": "./ets/entryability/EntryAbility.ts",
+        "description": "$string:EntryAbility_desc",
+        "icon": "$media:icon",
+        "label": "$string:EntryAbility_label",
+        "startWindowIcon": "$media:icon",
+        "startWindowBackground": "$color:start_window_background",
+        "exported": true,
+        "skills": [
+          {
+            "entities": [
+              "entity.system.home"
+            ],
+            "actions": [
+              "action.system.home"
+            ]
+          }
+        ]
+      }
+    ]
+  }
+}

+ 8 - 0
Charge6/entry/src/main/resources/base/element/color.json

@@ -0,0 +1,8 @@
+{
+  "color": [
+    {
+      "name": "start_window_background",
+      "value": "#FFFFFF"
+    }
+  ]
+}

+ 16 - 0
Charge6/entry/src/main/resources/base/element/string.json

@@ -0,0 +1,16 @@
+{
+  "string": [
+    {
+      "name": "module_desc",
+      "value": "module description"
+    },
+    {
+      "name": "EntryAbility_desc",
+      "value": "description"
+    },
+    {
+      "name": "EntryAbility_label",
+      "value": "label"
+    }
+  ]
+}

TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/1.jpg


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/20.jpg


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/29.jpg


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/40.jpg


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/7.jpg


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/ChargeStation.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/add_car.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/add_carging_pile.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/addcarBg.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/addchargingBg.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/avatar.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/back.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/bg.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/bottomBg.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/car.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/carCharging.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/car_3d.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/charge.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/charging.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/chargingBg.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/chargingIcon.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/charging_pile.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/drop_down.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/electric.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/home.png


+ 1 - 0
Charge6/entry/src/main/resources/base/media/ic_bottom_home.svg

@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">    <title>Public/ic_public_home_filled</title>    <defs>        <path d="M12.5548977,4.55117487 L12.6529233,4.62758192 L12.6883166,4.65995815 L21,12.5839983 L21,19.25 C21,20.8476809 19.75108,22.1536609 18.1762728,22.2449073 L18,22.25 L6,22.25 C4.40231912,22.25 3.09633912,21.00108 3.00509269,19.4262728 L3,19.25 L3,12.5839983 L11.3117958,4.65995815 C11.6576006,4.33188693 12.1809818,4.29723756 12.5548977,4.55117487 Z M12,13.5 C10.4023191,13.5 9.09633912,14.74892 9.00509269,16.3237272 L9,16.5 L9,20.25 L15,20.25 L15,16.5 C15,14.8431458 13.6568542,13.5 12,13.5 Z M9.39893803,2.34618127 C10.9454248,1.02063659 13.259436,1.06634502 14.75299,2.48330658 L14.75299,2.48330658 L22.4382087,9.7744115 L22.5181827,9.85955793 C22.8392264,10.243763 22.8283766,10.8160918 22.475412,11.1881356 C22.0952963,11.5887982 21.4623504,11.6054546 21.0616879,11.2253389 L21.0616879,11.2253389 L13.3764692,3.93423398 L13.2633454,3.83462897 C12.4905831,3.20379726 11.3583509,3.23699892 10.6234274,3.93423398 L10.6234274,3.93423398 L2.93820874,11.2253389 L2.84897391,11.3007239 C2.44841532,11.6011159 1.87744922,11.5601794 1.52448461,11.1881356 C1.14436887,10.7874731 1.16102534,10.1545272 1.56168788,9.7744115 L1.56168788,9.7744115 L9.24690658,2.48330658 Z" id="path-1"></path>    </defs>    <g id="Public/ic_public_home_filled" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">        <mask id="mask-2" fill="white">            <use xlink:href="#path-1"></use>        </mask>        <use id="形状结合" fill="#000000" fill-rule="nonzero" xlink:href="#path-1"></use>    </g></svg>

File diff ditekan karena terlalu besar
+ 0 - 0
Charge6/entry/src/main/resources/base/media/ic_bottom_record.svg


+ 1 - 0
Charge6/entry/src/main/resources/base/media/ic_bottom_user.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1702462021136" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4695" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32"><path d="M979.936 962.976c-22.656 48.768-83.136 52.544-101.152 52.544l-741.856 0c-12.736-0.736-64.352-6.336-87.776-50.432-9.888-18.592-17.664-49.728 1.408-92.32 34.752-77.408 115.264-84.928 134.496-85.6 137.056-21.216 181.568-68.384 181.984-68.832l3.2-3.328c14.624-13.792 19.616-38.016 20.928-59.072-88.64-67.424-144.704-197.632-144.704-340.736 0-229.344 142.272-310.688 264.128-310.688 121.888 0 264.192 81.376 264.192 310.688 0 143.104-56 273.28-144.64 340.704 1.376 21.12 6.368 45.408 20.864 59.104l4 4.288c0.096 0 44.832 46.816 181.216 67.904 31.392 1.248 90.336 18.336 128.608 75.936 29.888 44.992 24.704 79.168 15.072 99.84z" fill="#272636" p-id="4696"></path></svg>

TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/icon.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/location.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/logo.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/mileage.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/my.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/navigation.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/order.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/orderId.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/paid.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/pay.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/right.png


TEMPAT SAMPAH
Charge6/entry/src/main/resources/base/media/unpaid.png


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

@@ -0,0 +1,5 @@
+{
+  "src": [
+    "pages/Index"
+  ]
+}

+ 16 - 0
Charge6/entry/src/main/resources/en_US/element/string.json

@@ -0,0 +1,16 @@
+{
+  "string": [
+    {
+      "name": "module_desc",
+      "value": "module description"
+    },
+    {
+      "name": "EntryAbility_desc",
+      "value": "description"
+    },
+    {
+      "name": "EntryAbility_label",
+      "value": "label"
+    }
+  ]
+}

+ 16 - 0
Charge6/entry/src/main/resources/zh_CN/element/string.json

@@ -0,0 +1,16 @@
+{
+  "string": [
+    {
+      "name": "module_desc",
+      "value": "模块描述"
+    },
+    {
+      "name": "EntryAbility_desc",
+      "value": "description"
+    },
+    {
+      "name": "EntryAbility_label",
+      "value": "label"
+    }
+  ]
+}

+ 35 - 0
Charge6/entry/src/ohosTest/ets/test/Ability.test.ets

@@ -0,0 +1,35 @@
+import hilog from '@ohos.hilog';
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+
+export default function abilityTest() {
+  describe('ActsAbilityTest', function () {
+    // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+    beforeAll(function () {
+      // Presets an action, which is performed only once before all test cases of the test suite start.
+      // This API supports only one parameter: preset action function.
+    })
+    beforeEach(function () {
+      // Presets an action, which is performed before each unit test case starts.
+      // The number of execution times is the same as the number of test cases defined by **it**.
+      // This API supports only one parameter: preset action function.
+    })
+    afterEach(function () {
+      // Presets a clear action, which is performed after each unit test case ends.
+      // The number of execution times is the same as the number of test cases defined by **it**.
+      // This API supports only one parameter: clear action function.
+    })
+    afterAll(function () {
+      // Presets a clear action, which is performed after all test cases of the test suite end.
+      // This API supports only one parameter: clear action function.
+    })
+    it('assertContain',0, function () {
+      // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+      hilog.info(0x0000, 'testTag', '%{public}s', 'it begin');
+      let a = 'abc'
+      let b = 'b'
+      // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+      expect(a).assertContain(b)
+      expect(a).assertEqual(a)
+    })
+  })
+}

+ 5 - 0
Charge6/entry/src/ohosTest/ets/test/List.test.ets

@@ -0,0 +1,5 @@
+import abilityTest from './Ability.test'
+
+export default function testsuite() {
+  abilityTest()
+}

+ 48 - 0
Charge6/entry/src/ohosTest/ets/testability/TestAbility.ets

@@ -0,0 +1,48 @@
+import UIAbility from '@ohos.app.ability.UIAbility';
+import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
+import hilog from '@ohos.hilog';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../test/List.test';
+import window from '@ohos.window';
+
+export default class TestAbility extends UIAbility {
+    onCreate(want, launchParam) {
+        hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate');
+        hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
+        hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? '');
+        var abilityDelegator: any
+        abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+        var abilityDelegatorArguments: any
+        abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+        hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!');
+        Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
+    }
+
+    onDestroy() {
+        hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy');
+    }
+
+    onWindowStageCreate(windowStage: window.WindowStage) {
+        hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate');
+        windowStage.loadContent('testability/pages/Index', (err, data) => {
+            if (err.code) {
+                hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
+                return;
+            }
+            hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s',
+                JSON.stringify(data) ?? '');
+        });
+    }
+
+    onWindowStageDestroy() {
+        hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy');
+    }
+
+    onForeground() {
+        hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground');
+    }
+
+    onBackground() {
+        hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground');
+    }
+}

+ 34 - 0
Charge6/entry/src/ohosTest/ets/testability/pages/Index.ets

@@ -0,0 +1,34 @@
+import hilog from '@ohos.hilog';
+
+@Entry
+@Component
+struct Index {
+  aboutToAppear() {
+    hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear');
+  }
+ @State message: string = 'Hello World'
+   build() {
+         Row() {
+           Column() {
+             Text(this.message)
+               .fontSize(50)
+               .fontWeight(FontWeight.Bold)
+             Button() {
+               Text('next page')
+                 .fontSize(20)
+                 .fontWeight(FontWeight.Bold)
+             }.type(ButtonType.Capsule)
+             .margin({
+               top: 20
+             })
+             .backgroundColor('#0D9FFB')
+             .width('35%')
+             .height('5%')
+             .onClick(()=>{
+             })
+           }
+             .width('100%')
+         }
+             .height('100%')
+   }
+ }

+ 49 - 0
Charge6/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts

@@ -0,0 +1,49 @@
+import hilog from '@ohos.hilog';
+import TestRunner from '@ohos.application.testRunner';
+import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
+
+var abilityDelegator = undefined
+var abilityDelegatorArguments = undefined
+
+async function onAbilityCreateCallback() {
+    hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback');
+}
+
+async function addAbilityMonitorCallback(err: any) {
+    hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? '');
+}
+
+export default class OpenHarmonyTestRunner implements TestRunner {
+    constructor() {
+    }
+
+    onPrepare() {
+        hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare ');
+    }
+
+    async onRun() {
+        hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run');
+        abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+        abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+        var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility'
+        let lMonitor = {
+            abilityName: testAbilityName,
+            onAbilityCreate: onAbilityCreateCallback,
+        };
+        abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
+        var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName
+        var debug = abilityDelegatorArguments.parameters['-D']
+        if (debug == 'true')
+        {
+            cmd += ' -D'
+        }
+        hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd);
+        abilityDelegator.executeShellCommand(cmd,
+            (err: any, d: any) => {
+                hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? '');
+                hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? '');
+                hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? '');
+            })
+        hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end');
+    }
+}

+ 37 - 0
Charge6/entry/src/ohosTest/module.json5

@@ -0,0 +1,37 @@
+{
+  "module": {
+    "name": "entry_test",
+    "type": "feature",
+    "description": "$string:module_test_desc",
+    "mainElement": "TestAbility",
+    "deviceTypes": [
+      "phone",
+      "tablet"
+    ],
+    "deliveryWithInstall": true,
+    "installationFree": false,
+    "pages": "$profile:test_pages",
+    "abilities": [
+      {
+        "name": "TestAbility",
+        "srcEntry": "./ets/testability/TestAbility.ets",
+        "description": "$string:TestAbility_desc",
+        "icon": "$media:icon",
+        "label": "$string:TestAbility_label",
+        "exported": true,
+        "startWindowIcon": "$media:icon",
+        "startWindowBackground": "$color:start_window_background",
+        "skills": [
+          {
+            "actions": [
+              "action.system.home"
+            ],
+            "entities": [
+              "entity.system.home"
+            ]
+          }
+        ]
+      }
+    ]
+  }
+}

+ 8 - 0
Charge6/entry/src/ohosTest/resources/base/element/color.json

@@ -0,0 +1,8 @@
+{
+  "color": [
+    {
+      "name": "start_window_background",
+      "value": "#FFFFFF"
+    }
+  ]
+}

+ 16 - 0
Charge6/entry/src/ohosTest/resources/base/element/string.json

@@ -0,0 +1,16 @@
+{
+  "string": [
+    {
+      "name": "module_test_desc",
+      "value": "test ability description"
+    },
+    {
+      "name": "TestAbility_desc",
+      "value": "the test ability"
+    },
+    {
+      "name": "TestAbility_label",
+      "value": "test label"
+    }
+  ]
+}

TEMPAT SAMPAH
Charge6/entry/src/ohosTest/resources/base/media/icon.png


+ 5 - 0
Charge6/entry/src/ohosTest/resources/base/profile/test_pages.json

@@ -0,0 +1,5 @@
+{
+  "src": [
+    "testability/pages/Index"
+  ]
+}

+ 6 - 0
Charge6/hvigor/hvigor-config.json5

@@ -0,0 +1,6 @@
+{
+  "hvigorVersion": "2.4.2",
+  "dependencies": {
+    "@ohos/hvigor-ohos-plugin": "2.4.2"
+  }
+}

File diff ditekan karena terlalu besar
+ 0 - 0
Charge6/hvigor/hvigor-wrapper.js


+ 2 - 0
Charge6/hvigorfile.ts

@@ -0,0 +1,2 @@
+// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
+export { appTasks } from '@ohos/hvigor-ohos-plugin';

+ 48 - 0
Charge6/hvigorw

@@ -0,0 +1,48 @@
+#!/bin/bash
+
+# ----------------------------------------------------------------------------
+#  Hvigor startup script, version 1.0.0
+# 
+#  Required ENV vars:
+#  ------------------
+#    NODE_HOME - location of a Node home dir
+#    or 
+#    Add /usr/local/nodejs/bin to the PATH environment variable
+# ----------------------------------------------------------------------------
+
+HVIGOR_APP_HOME=$(dirname $(readlink -f $0))
+HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js
+warn() {
+	echo ""
+	echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m"
+}
+
+error() {
+	echo ""
+	echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m"
+}
+
+fail() {
+	error "$@"
+	exit 1
+}
+
+# Determine node to start hvigor wrapper script
+if [ -n "${NODE_HOME}" ];then
+   EXECUTABLE_NODE="${NODE_HOME}/bin/node"
+   if [ ! -x "$EXECUTABLE_NODE" ];then
+       fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed"
+   fi
+else
+   EXECUTABLE_NODE="node"
+   which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path"
+fi
+
+# Check hvigor wrapper script
+if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then
+	fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}"
+fi
+
+# start hvigor-wrapper script
+exec "${EXECUTABLE_NODE}" \
+	"${HVIGOR_WRAPPER_SCRIPT}" "$@"

+ 64 - 0
Charge6/hvigorw.bat

@@ -0,0 +1,64 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem  Hvigor startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js
+set NODE_EXE=node.exe
+
+goto start
+
+:start
+@rem Find node.exe
+if defined NODE_HOME goto findNodeFromNodeHome
+
+%NODE_EXE% --version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto execute
+
+echo.
+echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
+echo.
+echo Please set the NODE_HOME variable in your environment to match the
+echo location of your NodeJs installation.
+
+goto fail
+
+:findNodeFromNodeHome
+set NODE_HOME=%NODE_HOME:"=%
+set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE%
+
+if exist "%NODE_EXE_PATH%" goto execute
+echo.
+echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
+echo.
+echo Please set the NODE_HOME variable in your environment to match the
+echo location of your NodeJs installation.
+
+goto fail
+
+:execute
+@rem Execute hvigor
+"%NODE_EXE%" %WRAPPER_MODULE_PATH% %*
+
+if "%ERRORLEVEL%" == "0" goto hvigorwEnd
+
+:fail
+exit /b 1
+
+:hvigorwEnd
+if "%OS%" == "Windows_NT" endlocal
+
+:end

+ 13 - 0
Charge6/oh-package-lock.json5

@@ -0,0 +1,13 @@
+{
+  "lockfileVersion": 1,
+  "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
+  "specifiers": {
+    "@ohos/hypium@1.0.6": "@ohos/hypium@1.0.6"
+  },
+  "packages": {
+    "@ohos/hypium@1.0.6": {
+      "resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz",
+      "integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ=="
+    }
+  }
+}

+ 13 - 0
Charge6/oh-package.json5

@@ -0,0 +1,13 @@
+{
+  "name": "charge6",
+  "version": "1.0.0",
+  "description": "Please describe the basic information.",
+  "main": "",
+  "author": "",
+  "license": "",
+  "dependencies": {
+  },
+  "devDependencies": {
+    "@ohos/hypium": "1.0.6"
+  }
+}

TEMPAT SAMPAH
产品原型(国六).rp


Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini