nwo
stringclasses 304
values | sha
stringclasses 304
values | path
stringlengths 9
214
| language
stringclasses 1
value | identifier
stringlengths 0
49
| docstring
stringlengths 1
34.2k
| function
stringlengths 8
59.4k
| ast_function
stringlengths 71
497k
| obf_function
stringlengths 8
39.4k
| url
stringlengths 102
324
| function_sha
stringlengths 40
40
| source
stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
jxdiaodeyi/YX_Sports.git
|
af5346bd3d5003c33c306ff77b4b5e9184219893
|
YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinX.ets
|
arkts
|
SpinX
|
TODO SpinKit动画组件
author: 桃花镇童长老
since: 2024/05/01
仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fspinkit
github: https://github.com/787107497
gitee: https://gitee.com/tongyuyan/spinkit
QQ交流群: 569512366
|
@ComponentV2
export struct SpinX {
@Require @Param spinSize: number;
@Require @Param spinColor: ResourceColor;
@Local angle1: number = 0;
@Local scale2: number = 0.3;
build() {
Stack() {
Canvas()
.width(this.spinSize)
.height(this.spinSize)
.border({
width: this.spinSize * 0.08,
radius: this.spinSize,
color: this.spinColor,
style: {
top: BorderStyle.Solid,
right: BorderStyle.Dotted,
bottom: BorderStyle.Solid,
left: BorderStyle.Dotted
}
})
.rotate({ angle: this.angle1 })
Canvas()
.width(this.spinSize * 0.5)
.height(this.spinSize * 0.5)
.border({
width: this.spinSize * 0.08,
radius: this.spinSize,
color: this.spinColor,
style: {
top: BorderStyle.Dotted,
right: BorderStyle.Solid,
bottom: BorderStyle.Dotted,
left: BorderStyle.Solid
}
})
.scale({ x: this.scale2, y: this.scale2 })
}
.renderFit(RenderFit.CENTER)
.width(this.spinSize)
.height(this.spinSize)
.onAppear(() => {
let keyframes1: Array<KeyframeState> = [
{
duration: 2000,
curve: Curve.Linear,
event: () => {
this.angle1 = 360
}
}];
let keyframes2: Array<KeyframeState> = [
{
duration: 1000,
curve: Curve.EaseInOut,
event: () => {
this.scale2 = 0.9
}
},
{
duration: 1000,
curve: Curve.EaseInOut,
event: () => {
this.scale2 = 0.3
}
}];
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: 0 }, keyframes1);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: 0 }, keyframes2);
})
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinX AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right angle1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right scale2 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.3 AST#expression#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right * AST#expression#Left 0.08 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinColor AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left style AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left BorderStyle AST#expression#Right . Solid AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left BorderStyle AST#expression#Right . Dotted AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left BorderStyle AST#expression#Right . Solid AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left BorderStyle AST#expression#Right . Dotted AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . angle1 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right * AST#expression#Left 0.5 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right * AST#expression#Left 0.5 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right * AST#expression#Left 0.08 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinColor AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left style AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left BorderStyle AST#expression#Right . Dotted AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left BorderStyle AST#expression#Right . Solid AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left BorderStyle AST#expression#Right . Dotted AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left BorderStyle AST#expression#Right . Solid AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . scale ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale2 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale2 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . renderFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left RenderFit AST#expression#Right . CENTER AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onAppear ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes1 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . angle1 AST#member_expression#Right = AST#expression#Left 360 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes2 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 1000 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseInOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale2 AST#member_expression#Right = AST#expression#Left 0.9 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 1000 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseInOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale2 AST#member_expression#Right = AST#expression#Left 0.3 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@ComponentV2
export struct SpinX {
@Require @Param spinSize: number;
@Require @Param spinColor: ResourceColor;
@Local angle1: number = 0;
@Local scale2: number = 0.3;
build() {
Stack() {
Canvas()
.width(this.spinSize)
.height(this.spinSize)
.border({
width: this.spinSize * 0.08,
radius: this.spinSize,
color: this.spinColor,
style: {
top: BorderStyle.Solid,
right: BorderStyle.Dotted,
bottom: BorderStyle.Solid,
left: BorderStyle.Dotted
}
})
.rotate({ angle: this.angle1 })
Canvas()
.width(this.spinSize * 0.5)
.height(this.spinSize * 0.5)
.border({
width: this.spinSize * 0.08,
radius: this.spinSize,
color: this.spinColor,
style: {
top: BorderStyle.Dotted,
right: BorderStyle.Solid,
bottom: BorderStyle.Dotted,
left: BorderStyle.Solid
}
})
.scale({ x: this.scale2, y: this.scale2 })
}
.renderFit(RenderFit.CENTER)
.width(this.spinSize)
.height(this.spinSize)
.onAppear(() => {
let keyframes1: Array<KeyframeState> = [
{
duration: 2000,
curve: Curve.Linear,
event: () => {
this.angle1 = 360
}
}];
let keyframes2: Array<KeyframeState> = [
{
duration: 1000,
curve: Curve.EaseInOut,
event: () => {
this.scale2 = 0.9
}
},
{
duration: 1000,
curve: Curve.EaseInOut,
event: () => {
this.scale2 = 0.3
}
}];
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: 0 }, keyframes1);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: 0 }, keyframes2);
})
}
}
|
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinX.ets#L27-L99
|
9e0b91b1f480eb038ff04d0e0ebd5b8cd3a860b0
|
github
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets
|
arkts
|
saveLearn
|
/ 保存学习记录Learn
|
public static async saveLearn(learn: Learn): Promise<void> {
// 保存到db
await PlanDbAccess.shared.insertLearn(learn.asDBLearn());
}
|
AST#method_declaration#Left public static async saveLearn AST#parameter_list#Left ( AST#parameter#Left learn : AST#type_annotation#Left AST#primary_type#Left Learn AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // 保存到db AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left PlanDbAccess AST#expression#Right AST#await_expression#Right AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . insertLearn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left learn AST#expression#Right . asDBLearn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public static async saveLearn(learn: Learn): Promise<void> {
await PlanDbAccess.shared.insertLearn(learn.asDBLearn());
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets#L452-L455
|
9be0688f5cdad86a31d6c0514c24dfb67bc2bbcb
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonCodeLayout.ets
|
arkts
|
multiCodeBreathe
|
多二维码结果图案的呼吸动效
|
multiCodeBreathe(): void {
this.multiCodeScale = 1;
animateTo({
duration: 300,
curve: curves.cubicBezierCurve(0.33, 0, 0.67, 1), // Animation curve.
delay: 0,
iterations: 4,
playMode: PlayMode.Alternate,
onFinish: () => {
funcDelayer(() => {
this.multiCodeBreathe();
}, 400);
}
}, () => {
this.multiCodeScale = 0.8;
});
}
|
AST#method_declaration#Left multiCodeBreathe AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . multiCodeScale AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left animateTo AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 300 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left curves AST#expression#Right . cubicBezierCurve AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0.33 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0.67 AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , // Animation curve. AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left playMode AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left PlayMode AST#expression#Right . Alternate AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onFinish AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left funcDelayer AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . multiCodeBreathe AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 400 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . multiCodeScale AST#member_expression#Right = AST#expression#Left 0.8 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
multiCodeBreathe(): void {
this.multiCodeScale = 1;
animateTo({
duration: 300,
curve: curves.cubicBezierCurve(0.33, 0, 0.67, 1),
delay: 0,
iterations: 4,
playMode: PlayMode.Alternate,
onFinish: () => {
funcDelayer(() => {
this.multiCodeBreathe();
}, 400);
}
}, () => {
this.multiCodeScale = 0.8;
});
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonCodeLayout.ets#L317-L333
|
e3c0adffd37b2c2ac52a187b18bf0782261aacf2
|
gitee
|
sithvothykiv/dialog_hub.git
|
b676c102ef2d05f8994d170abe48dcc40cd39005
|
custom_dialog/src/main/ets/core/proxy/ConfirmBuilderProxy.ets
|
arkts
|
check
|
设置弹窗复选框
@param isChecked 默认是否勾选
@param onCheckedChange 勾选变化回调
@param checkTips 复选框右侧文本
@returns
|
check(isChecked: boolean, onCheckedChange?: Callback<boolean>, checkTips?: ResourceStr) {
(this.builderOptions as IConfirmDialogOptions).checkTips = checkTips;
(this.builderOptions as IConfirmDialogOptions).isChecked = isChecked;
(this.builderOptions as IConfirmDialogOptions).onCheckedChange = onCheckedChange;
return this;
}
|
AST#method_declaration#Left check AST#parameter_list#Left ( AST#parameter#Left isChecked : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left onCheckedChange ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left checkTips ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . builderOptions AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left IConfirmDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . checkTips AST#member_expression#Right = AST#expression#Left checkTips AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . builderOptions AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left IConfirmDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . isChecked AST#member_expression#Right = AST#expression#Left isChecked AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . builderOptions AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left IConfirmDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . onCheckedChange AST#member_expression#Right = AST#expression#Left onCheckedChange AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left this AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
check(isChecked: boolean, onCheckedChange?: Callback<boolean>, checkTips?: ResourceStr) {
(this.builderOptions as IConfirmDialogOptions).checkTips = checkTips;
(this.builderOptions as IConfirmDialogOptions).isChecked = isChecked;
(this.builderOptions as IConfirmDialogOptions).onCheckedChange = onCheckedChange;
return this;
}
|
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/ConfirmBuilderProxy.ets#L63-L68
|
d19c96684ba99be2435b7de55e9764ec465d55d0
|
github
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
ArkUI/orientationDevelopment/entry/src/main/ets/pages/MediaQueryPage.ets
|
arkts
|
changeOrientation
|
Change the horizontal and vertical screen status functions of the device
|
private changeOrientation(isLandscape: boolean) {
// Obtain the context of the UIAbility instance
let context: common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext;
// Call this API to manually change the horizontal and vertical screen status of the device
window.getLastWindow(context).then((lastWindow) => {
lastWindow.setPreferredOrientation(isLandscape ? window.Orientation.LANDSCAPE : window.Orientation.PORTRAIT)
});
}
|
AST#method_declaration#Left private changeOrientation AST#parameter_list#Left ( AST#parameter#Left isLandscape : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // Obtain the context of the UIAbility instance AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getHostContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // Call this API to manually change the horizontal and vertical screen status of the device AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left window AST#expression#Right . getLastWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left lastWindow AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left lastWindow AST#expression#Right . setPreferredOrientation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left isLandscape AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left window AST#expression#Right . Orientation AST#member_expression#Right AST#expression#Right . LANDSCAPE AST#member_expression#Right AST#expression#Right : AST#expression#Left window AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Orientation AST#member_expression#Right AST#expression#Right . PORTRAIT AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private changeOrientation(isLandscape: boolean) {
let context: common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext;
window.getLastWindow(context).then((lastWindow) => {
lastWindow.setPreferredOrientation(isLandscape ? window.Orientation.LANDSCAPE : window.Orientation.PORTRAIT)
});
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/orientationDevelopment/entry/src/main/ets/pages/MediaQueryPage.ets#L37-L44
|
7763630ba555d0d59bc3fc5150336a901063d413
|
gitee
|
bigbear20240612/planner_build-.git
|
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
|
entry/src/main/ets/common/utils/DataSyncVerifier.ets
|
arkts
|
clearAllTestData
|
清空所有测试数据
|
async clearAllTestData(): Promise<void> {
try {
// 获取所有任务并删除
const allTasks = this.taskViewModel.getAllTasks();
for (const task of allTasks) {
await this.taskViewModel.deleteTask(task.id);
}
hilog.info(0x0000, 'DataSyncVerifier', 'All test data cleared');
} catch (error) {
hilog.error(0x0000, 'DataSyncVerifier', 'Failed to clear test data: %{public}s', (error as Error).message);
}
}
|
AST#method_declaration#Left async clearAllTestData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 获取所有任务并删除 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left allTasks = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . taskViewModel AST#member_expression#Right AST#expression#Right . getAllTasks AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( const task of AST#expression#Left allTasks AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . taskViewModel AST#member_expression#Right AST#expression#Right . deleteTask AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'DataSyncVerifier' AST#expression#Right , AST#expression#Left 'All test data cleared' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'DataSyncVerifier' AST#expression#Right , AST#expression#Left 'Failed to clear test data: %{public}s' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async clearAllTestData(): Promise<void> {
try {
const allTasks = this.taskViewModel.getAllTasks();
for (const task of allTasks) {
await this.taskViewModel.deleteTask(task.id);
}
hilog.info(0x0000, 'DataSyncVerifier', 'All test data cleared');
} catch (error) {
hilog.error(0x0000, 'DataSyncVerifier', 'Failed to clear test data: %{public}s', (error as Error).message);
}
}
|
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/DataSyncVerifier.ets#L39-L50
|
ffae9688453c4263d68e8ada7196a1936f7089f4
|
github
|
openharmony/arkui_ace_engine
|
30c7d1ee12fbedf0fabece54291d75897e2ad44f
|
examples/Overlay/entry/src/main/ets/pages/components/menu/menuExpand.ets
|
arkts
|
MenuExpandBuilder
|
Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
@Builder
export function MenuExpandBuilder(name: string, param: Object) {
MenuExpandExample()
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function MenuExpandBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left MenuExpandExample ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#decorated_export_declaration#Right
|
@Builder
export function MenuExpandBuilder(name: string, param: Object) {
MenuExpandExample()
}
|
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/pages/components/menu/menuExpand.ets#L16-L19
|
fc9f65cbd3501d348619e5af1bd3a02f1f059d5a
|
gitee
|
ElegantDancer/arkts.git
|
5f46683fa690e0e976c7dee6813c2a04f3922ea2
|
ToDoListArkTS/entry/build/default/generated/profile/default/BuildProfile.ets
|
arkts
|
Use these variables when you tailor your ArkTS code. They must be of the const type.
|
export const BUNDLE_NAME = 'com.huawei.todolist';
|
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left BUNDLE_NAME = AST#expression#Left 'com.huawei.todolist' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
|
export const BUNDLE_NAME = 'com.huawei.todolist';
|
https://github.com/ElegantDancer/arkts.git/blob/5f46683fa690e0e976c7dee6813c2a04f3922ea2/ToDoListArkTS/entry/build/default/generated/profile/default/BuildProfile.ets#L4-L4
|
e8f27e4371c8e8ddbcf2ad7bb3981fb8aacd7bfe
|
github
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/media/VoiceService.ets
|
arkts
|
语音识别结果接口
|
export interface RecognitionResult {
text: string;
confidence: number;
timestamp: string;
duration: number;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface RecognitionResult AST#object_type#Left { AST#type_member#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left confidence : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left timestamp : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface RecognitionResult {
text: string;
confidence: number;
timestamp: string;
duration: number;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/VoiceService.ets#L18-L23
|
7bd179119495e371cdce86a757d55fb95877befc
|
github
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/AnimationAttribute.ets
|
arkts
|
动效属性,提供了必需的动效属性,后续添加属性可通过继承该类实现
|
export class AnimationAttribute {
// 背景条左边距,即:背景条左侧离tab组件左侧的距离
public left: number = 0;
// 背景条宽度
public indicatorBarWidth: number = 0;
// 背景条高度
public indicatorBarHeight: number = 0;
}
|
AST#export_declaration#Left export AST#class_declaration#Left class AnimationAttribute AST#class_body#Left { // 背景条左边距,即:背景条左侧离tab组件左侧的距离 AST#property_declaration#Left public left : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right // 背景条宽度 AST#property_declaration#Left public indicatorBarWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right // 背景条高度 AST#property_declaration#Left public indicatorBarHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class AnimationAttribute {
public left: number = 0;
public indicatorBarWidth: number = 0;
public indicatorBarHeight: number = 0;
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/AnimationAttribute.ets#L20-L27
|
6d2e792dcb34567c87356e651abaace3b14feab2
|
gitee
|
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/network/src/main/ets/datasource/page/PageNetworkDataSourceImpl.ets
|
arkts
|
getConfirmOrder
|
获取确认订单页数据
@returns {Promise<NetworkResponse<ConfirmOrder>>} 确认订单信息
|
async getConfirmOrder(): Promise<NetworkResponse<ConfirmOrder>> {
const resp: AxiosResponse<NetworkResponse<ConfirmOrder>> =
await NetworkClient.http.get("page/confirmOrder");
return resp.data;
}
|
AST#method_declaration#Left async getConfirmOrder AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ConfirmOrder AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left resp : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AxiosResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ConfirmOrder AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left NetworkClient AST#expression#Right AST#await_expression#Right AST#expression#Right . http AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "page/confirmOrder" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left resp AST#expression#Right . data AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async getConfirmOrder(): Promise<NetworkResponse<ConfirmOrder>> {
const resp: AxiosResponse<NetworkResponse<ConfirmOrder>> =
await NetworkClient.http.get("page/confirmOrder");
return resp.data;
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/page/PageNetworkDataSourceImpl.ets#L36-L40
|
5ac78bcb48c386d85c26b9673f58a635d7699306
|
github
|
open9527/OpenHarmony
|
fdea69ed722d426bf04e817ec05bff4002e81a4e
|
libs/core/src/main/ets/utils/Base64Utils.ets
|
arkts
|
decodeSync
|
解码,通过输入参数解码后输出对应Uint8Array对象。
@param array
@returns
|
static decodeSync(array: Uint8Array | string, options?: util.Type): Uint8Array {
let base64 = new util.Base64Helper();
let result = base64.decodeSync(array, options);
return result;
}
|
AST#method_declaration#Left static decodeSync AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left util . Type AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left base64 = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left util AST#expression#Right AST#new_expression#Right AST#expression#Right . Base64Helper AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left base64 AST#expression#Right . decodeSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left array AST#expression#Right , AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static decodeSync(array: Uint8Array | string, options?: util.Type): Uint8Array {
let base64 = new util.Base64Helper();
let result = base64.decodeSync(array, options);
return result;
}
|
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/Base64Utils.ets#L39-L43
|
a07cda7b850e7856c15d00f5c9c92d7adb3f9637
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/NewLogin.ets
|
arkts
|
receiveMessage
|
对接收的消息处理
@param data
|
receiveMessage(data: string): void {
Logger.info(TAG, 'receiveMessage begin data ' + JSON.stringify(data));
if (data.split('&')[0] && data.split('&')[0] === 'invitationNumber') {
AppStorage.setOrCreate('invitationNumber', data.split('&')[1]);
return;
}
if (data == 'ok') {
// router.clear();
this.pushIndex();
} else if (data === Constants.START_ABILITY_EVENT_ANSWER) {
// 如果是通话请求,则拉起语音通话应用
Logger.info(TAG, 'receiveMessage data userId ' + JSON.stringify(data));
let oppositeId: number = this.userId === 1 ? 2 : 1
Logger.info(TAG, 'receiveMessage data oppositeId ' + JSON.stringify(data));
let want: Want = {
bundleName: Constants.BUNDLE_NAME,
abilityName: Constants.ABILITY_NAME,
parameters: {
'START_ABILITY_EVENT_KEY': Constants.START_ABILITY_EVENT_ANSWER,
'START_ABILITY_DATA_KEY': oppositeId
}
};
// 拉起语音通话应用
startAbility(want);
} else if (data === Constants.COMM_EVENT_ANSWER_FROM_VOICE) {
// 发布公共事件至语音通话示例:接听
CommonEvent.publish(Constants.COMM_EVENT_ANSWER_FROM_HOST, this.publishCallback);
Logger.info(TAG, 'receiveMessage data COMM_EVENT_ANSWER' + JSON.stringify(data));
} else if (data === Constants.COMM_EVENT_HANGUP_FROM_VOICE) {
// 发布公共事件至语音通话示例:挂断
CommonEvent.publish(Constants.COMM_EVENT_HANGUP_FROM_HOST, this.publishCallback);
Logger.info(TAG, 'receiveMessage data COMM_EVENT_HANGUP' + JSON.stringify(data));
} else {
AppStorage.setOrCreate('receiveMsg', data);
AppStorage.setOrCreate('sendMsg', 'clear');
this.receiveMsg = data;
}
}
|
AST#method_declaration#Left receiveMessage AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'receiveMessage begin data ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . split AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '&' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right && AST#expression#Left data AST#expression#Right AST#binary_expression#Right AST#expression#Right . split AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '&' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right === AST#expression#Left 'invitationNumber' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'invitationNumber' AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . split AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '&' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left data AST#expression#Right == AST#expression#Left 'ok' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // router.clear(); AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pushIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left data AST#expression#Right === AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . START_ABILITY_EVENT_ANSWER AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 如果是通话请求,则拉起语音通话应用 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'receiveMessage data userId ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left oppositeId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userId AST#member_expression#Right AST#expression#Right === AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 2 AST#expression#Right : AST#expression#Left 1 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#ERROR#Left Logger AST#ERROR#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'receiveMessage data oppositeId ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bundleName AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . BUNDLE_NAME AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left abilityName AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . ABILITY_NAME AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left parameters AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'START_ABILITY_EVENT_KEY' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . START_ABILITY_EVENT_ANSWER AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'START_ABILITY_DATA_KEY' AST#property_name#Right : AST#expression#Left oppositeId AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 拉起语音通话应用 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left startAbility AST#expression#Right AST#argument_list#Left ( AST#expression#Left want AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left data AST#expression#Right === AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . COMM_EVENT_ANSWER_FROM_VOICE AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 发布公共事件至语音通话示例:接听 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CommonEvent AST#expression#Right . publish AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . COMM_EVENT_ANSWER_FROM_HOST AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . publishCallback AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'receiveMessage data COMM_EVENT_ANSWER' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left data AST#expression#Right === AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . COMM_EVENT_HANGUP_FROM_VOICE AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 发布公共事件至语音通话示例:挂断 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CommonEvent AST#expression#Right . publish AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . COMM_EVENT_HANGUP_FROM_HOST AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . publishCallback AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'receiveMessage data COMM_EVENT_HANGUP' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'receiveMsg' AST#expression#Right , AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'sendMsg' AST#expression#Right , AST#expression#Left 'clear' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . receiveMsg AST#member_expression#Right = AST#expression#Left data AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
receiveMessage(data: string): void {
Logger.info(TAG, 'receiveMessage begin data ' + JSON.stringify(data));
if (data.split('&')[0] && data.split('&')[0] === 'invitationNumber') {
AppStorage.setOrCreate('invitationNumber', data.split('&')[1]);
return;
}
if (data == 'ok') {
this.pushIndex();
} else if (data === Constants.START_ABILITY_EVENT_ANSWER) {
Logger.info(TAG, 'receiveMessage data userId ' + JSON.stringify(data));
let oppositeId: number = this.userId === 1 ? 2 : 1
Logger.info(TAG, 'receiveMessage data oppositeId ' + JSON.stringify(data));
let want: Want = {
bundleName: Constants.BUNDLE_NAME,
abilityName: Constants.ABILITY_NAME,
parameters: {
'START_ABILITY_EVENT_KEY': Constants.START_ABILITY_EVENT_ANSWER,
'START_ABILITY_DATA_KEY': oppositeId
}
};
startAbility(want);
} else if (data === Constants.COMM_EVENT_ANSWER_FROM_VOICE) {
CommonEvent.publish(Constants.COMM_EVENT_ANSWER_FROM_HOST, this.publishCallback);
Logger.info(TAG, 'receiveMessage data COMM_EVENT_ANSWER' + JSON.stringify(data));
} else if (data === Constants.COMM_EVENT_HANGUP_FROM_VOICE) {
CommonEvent.publish(Constants.COMM_EVENT_HANGUP_FROM_HOST, this.publishCallback);
Logger.info(TAG, 'receiveMessage data COMM_EVENT_HANGUP' + JSON.stringify(data));
} else {
AppStorage.setOrCreate('receiveMsg', data);
AppStorage.setOrCreate('sendMsg', 'clear');
this.receiveMsg = data;
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/NewLogin.ets#L136-L174
|
dec3ed0c3f04a7e3c829a272e36a0cb31bdcdc3e
|
gitee
|
Active-hue/ArkTS-Accounting.git
|
c432916d305b407557f08e35017c3fd70668e441
|
entry/src/main/ets/pages/AddBill.ets
|
arkts
|
saveBill
|
保存账单
|
async saveBill() {
if (!this.amount || parseFloat(this.amount) <= 0) {
promptAction.showToast({
message: '请输入有效金额',
duration: 2000
});
return;
}
if (!this.selectedCategory) {
promptAction.showToast({
message: '请选择分类',
duration: 2000
});
return;
}
// 查找选中分类的图标编号
const categories = this.billType === 0 ? this.expenseCategories : this.incomeCategories;
const selectedCat = categories.find(cat => cat.name === this.selectedCategory);
// 创建账单对象
// 将日期转换为 YYYY-MM-DD 格式
const today = new Date();
const year = today.getFullYear();
const month = (today.getMonth() + 1).toString().padStart(2, '0');
const day = today.getDate().toString().padStart(2, '0');
const dateStr = `${year}-${month}-${day}`;
const bill: BillItem = {
id: Date.now().toString(),
type: this.billType,
amount: this.amount,
category: this.selectedCategory,
categoryIcon: selectedCat?.icon || '1',
remark: this.remark,
date: dateStr, // 使用标准日期格式 YYYY-MM-DD
time: new Date().toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit' })
};
console.info('准备保存账单:', JSON.stringify(bill));
// 保存账单
await BillDataManager.saveBill(bill);
console.info('账单保存完成');
promptAction.showToast({
message: '保存成功',
duration: 2000
});
// 返回主页面
setTimeout(() => {
console.info('返回主页面');
router.back();
}, 500);
}
|
AST#method_declaration#Left async saveBill AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . amount AST#member_expression#Right AST#expression#Right || AST#expression#Left parseFloat AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . amount AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right <= AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left '请输入有效金额' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . selectedCategory AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left '请选择分类' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 查找选中分类的图标编号 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left categories = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . billType AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . expenseCategories AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . incomeCategories AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left selectedCat = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left categories AST#expression#Right . find AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left cat => AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cat AST#expression#Right . name AST#member_expression#Right AST#expression#Right === AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . selectedCategory AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 创建账单对象 // 将日期转换为 YYYY-MM-DD 格式 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left today = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left year = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left today AST#expression#Right . getFullYear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left month = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left today AST#expression#Right . getMonth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right , AST#expression#Left '0' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left day = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left today AST#expression#Right . getDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right , AST#expression#Left '0' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left dateStr = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left year AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left month AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left day AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left bill : AST#type_annotation#Left AST#primary_type#Left BillItem AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left type AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . billType AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left amount AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . amount AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left category AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedCategory AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left categoryIcon AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left selectedCat AST#expression#Right ?. icon AST#member_expression#Right AST#expression#Right || AST#expression#Left '1' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left remark AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . remark AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left date AST#property_name#Right : AST#expression#Left dateStr AST#expression#Right AST#property_assignment#Right , // 使用标准日期格式 YYYY-MM-DD AST#property_assignment#Left AST#property_name#Left time AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toLocaleTimeString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'zh-CN' AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left hour AST#property_name#Right : AST#expression#Left '2-digit' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left minute AST#property_name#Right : AST#expression#Left '2-digit' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '准备保存账单:' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left bill AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 保存账单 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left BillDataManager AST#expression#Right AST#await_expression#Right AST#expression#Right . saveBill AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left bill AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '账单保存完成' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left '保存成功' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 返回主页面 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '返回主页面' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . back AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 500 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async saveBill() {
if (!this.amount || parseFloat(this.amount) <= 0) {
promptAction.showToast({
message: '请输入有效金额',
duration: 2000
});
return;
}
if (!this.selectedCategory) {
promptAction.showToast({
message: '请选择分类',
duration: 2000
});
return;
}
const categories = this.billType === 0 ? this.expenseCategories : this.incomeCategories;
const selectedCat = categories.find(cat => cat.name === this.selectedCategory);
const today = new Date();
const year = today.getFullYear();
const month = (today.getMonth() + 1).toString().padStart(2, '0');
const day = today.getDate().toString().padStart(2, '0');
const dateStr = `${year}-${month}-${day}`;
const bill: BillItem = {
id: Date.now().toString(),
type: this.billType,
amount: this.amount,
category: this.selectedCategory,
categoryIcon: selectedCat?.icon || '1',
remark: this.remark,
date: dateStr,
time: new Date().toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit' })
};
console.info('准备保存账单:', JSON.stringify(bill));
await BillDataManager.saveBill(bill);
console.info('账单保存完成');
promptAction.showToast({
message: '保存成功',
duration: 2000
});
setTimeout(() => {
console.info('返回主页面');
router.back();
}, 500);
}
|
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/AddBill.ets#L353-L410
|
eb8985e0fea16d2a0c7bae27c6e2e8c147e9425e
|
github
|
salehelper/algorithm_arkts.git
|
61af15272038646775a4745fca98a48ba89e1f4e
|
entry/src/main/ets/utils/Logger.ets
|
arkts
|
warn
|
输出警告日志
@param message 日志信息
|
public static warn(message: string): void {
console.warn(`[${Logger.TAG}] ${message}`);
}
|
AST#method_declaration#Left public static warn AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [ AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . TAG AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ] AST#template_substitution#Left $ { AST#expression#Left message AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public static warn(message: string): void {
console.warn(`[${Logger.TAG}] ${message}`);
}
|
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/utils/Logger.ets#L19-L21
|
4c5304a90eb5bf3e1d691bb0bf3991ba1b418876
|
github
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/CartPage.ets
|
arkts
|
CartItem
|
购物车商品项
|
@Builder
CartItem(cart: Cart) {
Column({ space: AppDimensions.spaceSmall }) {
ForEach(cart.spec, (spec: CartSpec) => {
Row({ space: AppDimensions.spaceMedium }) {
// 选择框
Checkbox()
.select(this.isSpecSelected(cart.goodsId, spec.id))
.onChange((value: boolean) => {
this.toggleSpecSelection(cart.goodsId, spec.id);
})
// 商品图片
Image(cart.goodsMainPic)
.width(80)
.height(80)
.borderRadius(AppDimensions.radiusSmall)
.objectFit(ImageFit.Cover)
// 商品信息
Column({ space: AppDimensions.spaceSmall }) {
Text(cart.goodsName)
.fontSize(AppTypography.fontSizeMedium)
.fontColor(AppColors.textPrimary)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
Text(spec.specName)
.fontSize(AppTypography.fontSizeSmall)
.fontColor(AppColors.textSecondary)
.padding(AppDimensions.paddingXSmall)
.backgroundColor(AppColors.surfaceVariant)
.borderRadius(AppDimensions.radiusSmall)
Row() {
Text(`¥${(spec.price / 100).toFixed(2)}`)
.fontSize(AppTypography.fontSizeLarge)
.fontColor(AppColors.price)
.fontWeight(AppTypography.fontWeightBold)
Blank()
// 数量控制器
Row({ space: AppDimensions.spaceSmall }) {
Text('−')
.fontSize(20)
.fontColor(spec.count > 1 ? AppColors.textPrimary : AppColors.textTertiary)
.width(24)
.height(24)
.textAlign(TextAlign.Center)
.border({ width: 1, color: AppColors.border, radius: 4 })
.onClick(() => {
if (spec.count > 1) {
spec.count--;
this.calculateTotal();
}
})
Text(spec.count.toString())
.fontSize(AppTypography.fontSizeMedium)
.fontColor(AppColors.textPrimary)
.width(30)
.textAlign(TextAlign.Center)
Text('+')
.fontSize(20)
.fontColor(spec.count < spec.stock ? AppColors.textPrimary : AppColors.textTertiary)
.width(24)
.height(24)
.textAlign(TextAlign.Center)
.border({ width: 1, color: AppColors.border, radius: 4 })
.onClick(() => {
if (spec.count < spec.stock) {
spec.count++;
this.calculateTotal();
}
})
}
}
.width('100%')
}
.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
}
.width('100%')
.backgroundColor(AppColors.surface)
.borderRadius(AppDimensions.radiusMedium)
.padding(AppDimensions.paddingMedium)
})
}
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right CartItem AST#parameter_list#Left ( AST#parameter#Left cart : AST#type_annotation#Left AST#primary_type#Left Cart AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left AppDimensions AST#expression#Right . spaceSmall AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left cart AST#expression#Right . spec AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left spec : AST#type_annotation#Left AST#primary_type#Left CartSpec AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left AppDimensions AST#expression#Right . spaceMedium AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // 选择框 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Checkbox ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . select ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSpecSelected AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left cart AST#expression#Right . goodsId AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . toggleSpecSelection AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left cart AST#expression#Right . goodsId AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 商品图片 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#member_expression#Left AST#expression#Left cart AST#expression#Right . goodsMainPic AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 80 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 80 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppDimensions AST#expression#Right . radiusSmall AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Cover AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 商品信息 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left AppDimensions AST#expression#Right . spaceSmall AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left cart AST#expression#Right . goodsName AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppTypography AST#expression#Right . fontSizeMedium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppColors AST#expression#Right . textPrimary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left 2 AST#expression#Right ) AST#modifier_chain_expression#Left . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Ellipsis AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . specName AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppTypography AST#expression#Right . fontSizeSmall AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppColors AST#expression#Right . textSecondary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppDimensions AST#expression#Right . paddingXSmall AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppColors AST#expression#Right . surfaceVariant AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppDimensions AST#expression#Right . radiusSmall AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` ¥ AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . price AST#member_expression#Right AST#expression#Right / AST#expression#Left 100 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . toFixed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppTypography AST#expression#Right . fontSizeLarge AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppColors AST#expression#Right . price AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppTypography AST#expression#Right . fontWeightBold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Blank ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 数量控制器 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left AppDimensions AST#expression#Right . spaceSmall AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '−' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . count AST#member_expression#Right AST#expression#Right > AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left AppColors AST#expression#Right . textPrimary AST#member_expression#Right AST#expression#Right : AST#expression#Left AppColors AST#expression#Right AST#conditional_expression#Right AST#expression#Right . textTertiary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AppColors AST#expression#Right . border AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . count AST#member_expression#Right AST#expression#Right > AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . count AST#member_expression#Right AST#expression#Right -- AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calculateTotal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . count AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppTypography AST#expression#Right . fontSizeMedium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppColors AST#expression#Right . textPrimary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 30 AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '+' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . count AST#member_expression#Right AST#expression#Right < AST#expression#Left spec AST#expression#Right AST#binary_expression#Right AST#expression#Right . stock AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left AppColors AST#expression#Right . textPrimary AST#member_expression#Right AST#expression#Right : AST#expression#Left AppColors AST#expression#Right AST#conditional_expression#Right AST#expression#Right . textTertiary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AppColors AST#expression#Right . border AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . count AST#member_expression#Right AST#expression#Right < AST#expression#Left spec AST#expression#Right AST#binary_expression#Right AST#expression#Right . stock AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . count AST#member_expression#Right AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calculateTotal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppColors AST#expression#Right . surface AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppDimensions AST#expression#Right . radiusMedium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppDimensions AST#expression#Right . paddingMedium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
CartItem(cart: Cart) {
Column({ space: AppDimensions.spaceSmall }) {
ForEach(cart.spec, (spec: CartSpec) => {
Row({ space: AppDimensions.spaceMedium }) {
Checkbox()
.select(this.isSpecSelected(cart.goodsId, spec.id))
.onChange((value: boolean) => {
this.toggleSpecSelection(cart.goodsId, spec.id);
})
Image(cart.goodsMainPic)
.width(80)
.height(80)
.borderRadius(AppDimensions.radiusSmall)
.objectFit(ImageFit.Cover)
Column({ space: AppDimensions.spaceSmall }) {
Text(cart.goodsName)
.fontSize(AppTypography.fontSizeMedium)
.fontColor(AppColors.textPrimary)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
Text(spec.specName)
.fontSize(AppTypography.fontSizeSmall)
.fontColor(AppColors.textSecondary)
.padding(AppDimensions.paddingXSmall)
.backgroundColor(AppColors.surfaceVariant)
.borderRadius(AppDimensions.radiusSmall)
Row() {
Text(`¥${(spec.price / 100).toFixed(2)}`)
.fontSize(AppTypography.fontSizeLarge)
.fontColor(AppColors.price)
.fontWeight(AppTypography.fontWeightBold)
Blank()
Row({ space: AppDimensions.spaceSmall }) {
Text('−')
.fontSize(20)
.fontColor(spec.count > 1 ? AppColors.textPrimary : AppColors.textTertiary)
.width(24)
.height(24)
.textAlign(TextAlign.Center)
.border({ width: 1, color: AppColors.border, radius: 4 })
.onClick(() => {
if (spec.count > 1) {
spec.count--;
this.calculateTotal();
}
})
Text(spec.count.toString())
.fontSize(AppTypography.fontSizeMedium)
.fontColor(AppColors.textPrimary)
.width(30)
.textAlign(TextAlign.Center)
Text('+')
.fontSize(20)
.fontColor(spec.count < spec.stock ? AppColors.textPrimary : AppColors.textTertiary)
.width(24)
.height(24)
.textAlign(TextAlign.Center)
.border({ width: 1, color: AppColors.border, radius: 4 })
.onClick(() => {
if (spec.count < spec.stock) {
spec.count++;
this.calculateTotal();
}
})
}
}
.width('100%')
}
.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
}
.width('100%')
.backgroundColor(AppColors.surface)
.borderRadius(AppDimensions.radiusMedium)
.padding(AppDimensions.paddingMedium)
})
}
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/CartPage.ets#L105-L195
|
05ec14278f7e97a18558a34fe8531b0cda228375
|
github
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/data/src/main/ets/repository/CartRepository.ets
|
arkts
|
updateCartSpecCount
|
更新购物车中商品的规格数量
@param {number} goodsId 商品ID
@param {number} specId 规格ID
@param {number} count 规格数量
@returns {Promise<void>} Promise<void>
|
updateCartSpecCount(goodsId: number, specId: number, count: number): Promise<void> {
return this.dataSource.updateCartSpecCount(goodsId, specId, count);
}
|
AST#method_declaration#Left updateCartSpecCount AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left specId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left count : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right . updateCartSpecCount AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left goodsId AST#expression#Right , AST#expression#Left specId AST#expression#Right , AST#expression#Left count AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
updateCartSpecCount(goodsId: number, specId: number, count: number): Promise<void> {
return this.dataSource.updateCartSpecCount(goodsId, specId, count);
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/CartRepository.ets#L47-L49
|
62afea24c7d348498988f615f24420d7c105ac10
|
github
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets
|
arkts
|
@file 订单详情页面 ViewModel
@author Joker.X
|
@ObservedV2
export default class OrderDetailViewModel extends BaseNetWorkViewModel<Order> {
/**
* 订单仓库
*/
private readonly repository: OrderRepository = new OrderRepository();
/**
* 公共仓库
*/
private readonly commonRepository: CommonRepository = new CommonRepository();
/**
* 路由参数
*/
private readonly routeParam: OrderIdParam | undefined = getRouteParams<OrderIdParam>(OrderRoutes.Detail);
/**
* 订单 ID
*/
private readonly orderId: number = this.routeParam?.orderId ?? 0;
/**
* 订单商品列表(购物车结构)
*/
@Trace
cartList: Cart[] = [];
/**
* 再次购买弹窗显示状态
*/
@Trace
rebuyModalVisible: boolean = false;
/**
* 商品评论弹窗显示状态
*/
@Trace
commentModalVisible: boolean = false;
/**
* 取消原因弹窗显示状态
*/
@Trace
cancelModalVisible: boolean = false;
/**
* 取消原因弹窗网络状态
*/
@Trace
cancelReasonsUiState: BaseNetWorkUiState = BaseNetWorkUiState.LOADING;
/**
* 取消原因列表
*/
@Trace
cancelReasonList: DictItem[] = [];
/**
* 选中的取消原因
*/
@Trace
selectedCancelReason: DictItem | null = null;
/**
* 确认收货弹窗显示状态
*/
@Trace
showConfirmDialog: boolean = false;
/**
* 请求订单详情数据
* @returns {Promise<NetworkResponse<Order>>} 网络请求 Promise
*/
protected requestRepository(): Promise<NetworkResponse<Order>> {
return this.repository.getOrderInfo(this.orderId);
}
/**
* 请求成功回调
* @param {Order} data - 订单数据
* @returns {void} 无返回值
*/
protected onRequestSuccess(data: Order): void {
this.cartList = this.convertOrderGoodsToCart(data);
super.onRequestSuccess(data);
}
/**
* 跳转支付页面
* @returns {void} 无返回值
*/
toPay(): void {
const order: Order = this.data ?? new Order();
const payPrice: number = order.price - order.discountPrice;
OrderNavigator.toPay(order.id, payPrice);
}
/**
* 显示再次购买弹窗
* @returns {void} 无返回值
*/
showRebuyModal(): void {
this.rebuyModalVisible = true;
}
/**
* 隐藏再次购买弹窗
* @returns {void} 无返回值
*/
hideRebuyModal(): void {
this.rebuyModalVisible = false;
}
/**
* 显示商品评论弹窗
* @returns {void} 无返回值
*/
showCommentModal(): void {
this.commentModalVisible = true;
}
/**
* 隐藏商品评论弹窗
* @returns {void} 无返回值
*/
hideCommentModal(): void {
this.commentModalVisible = false;
}
/**
* 处理再次购买逻辑
* @returns {void} 无返回值
*/
handleRebuy(): void {
if (this.cartList.length > 1) {
this.showRebuyModal();
return;
}
const goodsId: number = this.getFirstCartGoodsId();
if (!goodsId) {
return;
}
this.toGoodsDetail(goodsId);
}
/**
* 处理订单评价逻辑
* @returns {void} 无返回值
*/
handleOrderComment(): void {
if (this.cartList.length > 1) {
this.showCommentModal();
return;
}
const orderId: number = this.data?.id ?? 0;
const goodsId: number = this.getFirstCartGoodsId();
if (!orderId || !goodsId) {
return;
}
OrderNavigator.toComment(orderId, goodsId);
}
/**
* 跳转商品详情页面(再次购买)
* @param {number} goodsId - 商品 ID
* @returns {void} 无返回值
*/
toGoodsDetail(goodsId: number): void {
if (!goodsId) {
return;
}
this.hideRebuyModal();
GoodsNavigator.toDetail(goodsId);
}
/**
* 跳转订单评价页面(指定商品)
* @param {number} goodsId - 商品 ID
* @returns {void} 无返回值
*/
toOrderCommentForGoods(goodsId: number): void {
const orderId: number = this.data?.id ?? 0;
if (!orderId || !goodsId) {
return;
}
this.hideCommentModal();
OrderNavigator.toComment(orderId, goodsId);
}
/**
* 显示取消原因选择弹窗
* @returns {void} 无返回值
*/
showCancelModal(): void {
this.cancelModalVisible = true;
this.loadCancelReasons();
}
/**
* 隐藏取消原因选择弹窗
* @returns {void} 无返回值
*/
hideCancelModal(): void {
this.cancelModalVisible = false;
}
/**
* 选择取消原因
* @param {DictItem} reason - 取消原因
* @returns {void} 无返回值
*/
selectCancelReason(reason: DictItem): void {
this.selectedCancelReason = reason;
}
/**
* 加载取消原因字典数据
* @returns {void} 无返回值
*/
loadCancelReasons(): void {
if (this.cancelReasonsUiState === BaseNetWorkUiState.SUCCESS && this.cancelReasonList.length > 0) {
return;
}
const params: DictDataRequest = new DictDataRequest();
params.types = ["orderCancelReason"];
RequestHelper.repository<DictDataResponse>(this.commonRepository.getDictData(params))
.toast(false)
.start((): void => {
this.cancelReasonsUiState = BaseNetWorkUiState.LOADING;
})
.execute()
.then((data: DictDataResponse): void => {
this.cancelReasonList = data.orderCancelReason ?? [];
this.cancelReasonsUiState = BaseNetWorkUiState.SUCCESS;
})
.catch((): void => {
this.cancelReasonList = [];
this.cancelReasonsUiState = BaseNetWorkUiState.ERROR;
});
}
/**
* 确认取消订单
* @returns {void} 无返回值
*/
confirmCancelOrder(): void {
const params: CancelOrderRequest = new CancelOrderRequest();
params.orderId = this.orderId;
params.remark = this.selectedCancelReason?.name ?? "";
RequestHelper.repository<boolean>(this.repository.cancelOrder(params))
.loading(true)
.execute()
.then((): void => this.retryRequest());
}
/**
* 显示确认收货弹窗
* @returns {void} 无返回值
*/
showConfirmReceiveDialog(): void {
this.showConfirmDialog = true;
}
/**
* 隐藏确认收货弹窗
* @returns {void} 无返回值
*/
hideConfirmReceiveDialog(): void {
this.showConfirmDialog = false;
}
/**
* 确认收货订单
* @returns {void} 无返回值
*/
confirmReceiveOrder(): void {
RequestHelper.repository<boolean>(this.repository.confirmReceive(this.orderId))
.loading(true)
.execute()
.then((): void => {
this.retryRequest();
this.hideConfirmReceiveDialog();
});
}
/**
* 将订单商品转换为购物车列表
* @param {Order} order - 订单信息
* @returns {Cart[]} 购物车列表
*/
private convertOrderGoodsToCart(order: Order): Cart[] {
const goodsList: OrderGoods[] = order.goodsList ?? [];
if (goodsList.length === 0) {
return [];
}
const groupedMap = new Map<number, OrderGoods[]>();
for (const goods of goodsList) {
const exists = groupedMap.get(goods.goodsId);
if (exists) {
exists.push(goods);
} else {
groupedMap.set(goods.goodsId, [goods]);
}
}
const result: Cart[] = [];
groupedMap.forEach((items: OrderGoods[], goodsId: number): void => {
const firstItem: OrderGoods = items[0];
const cart = new Cart();
cart.goodsId = goodsId;
cart.goodsName = firstItem.goodsInfo?.title ?? "";
cart.goodsMainPic = firstItem.goodsInfo?.mainPic ?? "";
const specs: CartGoodsSpec[] = [];
for (const orderGoods of items) {
if (orderGoods.spec) {
const spec = new CartGoodsSpec();
spec.id = orderGoods.spec.id;
spec.goodsId = orderGoods.spec.goodsId;
spec.name = orderGoods.spec.name;
spec.price = orderGoods.spec.price;
spec.stock = orderGoods.spec.stock;
spec.count = orderGoods.count;
spec.images = orderGoods.spec.images;
specs.push(spec);
}
}
cart.spec = specs;
result.push(cart);
});
return result;
}
/**
* 获取购物车第一件商品 ID
* @returns {number} 商品 ID
*/
private getFirstCartGoodsId(): number {
const cart: Cart | undefined = this.cartList[0];
return cart?.goodsId ?? 0;
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class OrderDetailViewModel extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BaseNetWorkViewModel AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Order AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /**
* 订单仓库
*/ AST#property_declaration#Left private readonly repository : AST#type_annotation#Left AST#primary_type#Left OrderRepository AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left OrderRepository AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right /**
* 公共仓库
*/ AST#property_declaration#Left private readonly commonRepository : AST#type_annotation#Left AST#primary_type#Left CommonRepository AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CommonRepository AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right /**
* 路由参数
*/ AST#property_declaration#Left private readonly routeParam : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left OrderIdParam AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left getRouteParams AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left OrderIdParam AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left OrderRoutes AST#expression#Right . Detail AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right /**
* 订单 ID
*/ AST#property_declaration#Left private readonly orderId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . routeParam AST#member_expression#Right AST#expression#Right ?. orderId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right /**
* 订单商品列表(购物车结构)
*/ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right cartList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Cart [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 再次购买弹窗显示状态
*/ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right rebuyModalVisible : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 商品评论弹窗显示状态
*/ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right commentModalVisible : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 取消原因弹窗显示状态
*/ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right cancelModalVisible : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 取消原因弹窗网络状态
*/ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right cancelReasonsUiState : AST#type_annotation#Left AST#primary_type#Left BaseNetWorkUiState AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left BaseNetWorkUiState AST#expression#Right . LOADING AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right /**
* 取消原因列表
*/ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right cancelReasonList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DictItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 选中的取消原因
*/ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right selectedCancelReason : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left DictItem AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 确认收货弹窗显示状态
*/ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right showConfirmDialog : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 请求订单详情数据
* @returns {Promise<NetworkResponse<Order>>} 网络请求 Promise
*/ AST#method_declaration#Left protected requestRepository AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Order AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . repository AST#member_expression#Right AST#expression#Right . getOrderInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . orderId AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 请求成功回调
* @param {Order} data - 订单数据
* @returns {void} 无返回值
*/ AST#method_declaration#Left protected onRequestSuccess AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Order AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cartList AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . convertOrderGoodsToCart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left super AST#expression#Right . onRequestSuccess AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 跳转支付页面
* @returns {void} 无返回值
*/ AST#method_declaration#Left toPay AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left order : AST#type_annotation#Left AST#primary_type#Left Order AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . data AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#new_expression#Left new AST#expression#Left Order AST#expression#Right AST#new_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left payPrice : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left order AST#expression#Right . price AST#member_expression#Right AST#expression#Right - AST#expression#Left order AST#expression#Right AST#binary_expression#Right AST#expression#Right . discountPrice AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OrderNavigator AST#expression#Right . toPay AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left order AST#expression#Right . id AST#member_expression#Right AST#expression#Right , AST#expression#Left payPrice AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 显示再次购买弹窗
* @returns {void} 无返回值
*/ AST#method_declaration#Left showRebuyModal AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rebuyModalVisible AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 隐藏再次购买弹窗
* @returns {void} 无返回值
*/ AST#method_declaration#Left hideRebuyModal AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rebuyModalVisible AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 显示商品评论弹窗
* @returns {void} 无返回值
*/ AST#method_declaration#Left showCommentModal AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . commentModalVisible AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 隐藏商品评论弹窗
* @returns {void} 无返回值
*/ AST#method_declaration#Left hideCommentModal AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . commentModalVisible AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 处理再次购买逻辑
* @returns {void} 无返回值
*/ AST#method_declaration#Left handleRebuy AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cartList AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showRebuyModal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getFirstCartGoodsId AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left goodsId AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . toGoodsDetail AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left goodsId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 处理订单评价逻辑
* @returns {void} 无返回值
*/ AST#method_declaration#Left handleOrderComment AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cartList AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showCommentModal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left orderId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . data AST#member_expression#Right AST#expression#Right ?. id AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getFirstCartGoodsId AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left orderId AST#expression#Right AST#unary_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left goodsId AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OrderNavigator AST#expression#Right . toComment AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left orderId AST#expression#Right , AST#expression#Left goodsId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 跳转商品详情页面(再次购买)
* @param {number} goodsId - 商品 ID
* @returns {void} 无返回值
*/ AST#method_declaration#Left toGoodsDetail AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left goodsId AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hideRebuyModal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left GoodsNavigator AST#expression#Right . toDetail AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left goodsId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 跳转订单评价页面(指定商品)
* @param {number} goodsId - 商品 ID
* @returns {void} 无返回值
*/ AST#method_declaration#Left toOrderCommentForGoods AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left orderId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . data AST#member_expression#Right AST#expression#Right ?. id AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left orderId AST#expression#Right AST#unary_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left goodsId AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hideCommentModal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OrderNavigator AST#expression#Right . toComment AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left orderId AST#expression#Right , AST#expression#Left goodsId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 显示取消原因选择弹窗
* @returns {void} 无返回值
*/ AST#method_declaration#Left showCancelModal AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cancelModalVisible AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loadCancelReasons AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 隐藏取消原因选择弹窗
* @returns {void} 无返回值
*/ AST#method_declaration#Left hideCancelModal AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cancelModalVisible AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 选择取消原因
* @param {DictItem} reason - 取消原因
* @returns {void} 无返回值
*/ AST#method_declaration#Left selectCancelReason AST#parameter_list#Left ( AST#parameter#Left reason : AST#type_annotation#Left AST#primary_type#Left DictItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedCancelReason AST#member_expression#Right = AST#expression#Left reason AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 加载取消原因字典数据
* @returns {void} 无返回值
*/ AST#method_declaration#Left loadCancelReasons AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cancelReasonsUiState AST#member_expression#Right AST#expression#Right === AST#expression#Left BaseNetWorkUiState AST#expression#Right AST#binary_expression#Right AST#expression#Right . SUCCESS AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . cancelReasonList AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left params : AST#type_annotation#Left AST#primary_type#Left DictDataRequest AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left DictDataRequest AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . types AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left "orderCancelReason" AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RequestHelper AST#expression#Right . repository AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left DictDataResponse AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . commonRepository AST#member_expression#Right AST#expression#Right . getDictData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . start AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cancelReasonsUiState AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left BaseNetWorkUiState AST#expression#Right . LOADING AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . execute AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left DictDataResponse AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cancelReasonList AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . orderCancelReason AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cancelReasonsUiState AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left BaseNetWorkUiState AST#expression#Right . SUCCESS AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cancelReasonList AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cancelReasonsUiState AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left BaseNetWorkUiState AST#expression#Right . ERROR AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 确认取消订单
* @returns {void} 无返回值
*/ AST#method_declaration#Left confirmCancelOrder AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left params : AST#type_annotation#Left AST#primary_type#Left CancelOrderRequest AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CancelOrderRequest AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . orderId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . orderId AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . remark AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedCancelReason AST#member_expression#Right AST#expression#Right ?. name AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RequestHelper AST#expression#Right . repository AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . repository AST#member_expression#Right AST#expression#Right . cancelOrder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . loading AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . execute AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . retryRequest AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 显示确认收货弹窗
* @returns {void} 无返回值
*/ AST#method_declaration#Left showConfirmReceiveDialog AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showConfirmDialog AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 隐藏确认收货弹窗
* @returns {void} 无返回值
*/ AST#method_declaration#Left hideConfirmReceiveDialog AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showConfirmDialog AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 确认收货订单
* @returns {void} 无返回值
*/ AST#method_declaration#Left confirmReceiveOrder AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RequestHelper AST#expression#Right . repository AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . repository AST#member_expression#Right AST#expression#Right . confirmReceive AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . orderId AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . loading AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . execute AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . retryRequest AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hideConfirmReceiveDialog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 将订单商品转换为购物车列表
* @param {Order} order - 订单信息
* @returns {Cart[]} 购物车列表
*/ AST#method_declaration#Left private convertOrderGoodsToCart AST#parameter_list#Left ( AST#parameter#Left order : AST#type_annotation#Left AST#primary_type#Left Order AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Cart [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left goodsList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left OrderGoods [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left order AST#expression#Right . goodsList AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left goodsList AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left groupedMap = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Map AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left OrderGoods [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( const goods of AST#expression#Left goodsList AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left exists = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left groupedMap AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left goods AST#expression#Right . goodsId AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left exists AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left exists AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left goods AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left groupedMap AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left goods AST#expression#Right . goodsId AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left goods AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Cart [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left groupedMap AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left items : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left OrderGoods [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left firstItem : AST#type_annotation#Left AST#primary_type#Left OrderGoods AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left items AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left cart = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Cart AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left cart AST#expression#Right . goodsId AST#member_expression#Right = AST#expression#Left goodsId AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left cart AST#expression#Right . goodsName AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left firstItem AST#expression#Right . goodsInfo AST#member_expression#Right AST#expression#Right ?. title AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left cart AST#expression#Right . goodsMainPic AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left firstItem AST#expression#Right . goodsInfo AST#member_expression#Right AST#expression#Right ?. mainPic AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left specs : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CartGoodsSpec [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( const orderGoods of AST#expression#Left items AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left orderGoods AST#expression#Right . spec AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left spec = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CartGoodsSpec AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . id AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left orderGoods AST#expression#Right . spec AST#member_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . goodsId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left orderGoods AST#expression#Right . spec AST#member_expression#Right AST#expression#Right . goodsId AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . name AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left orderGoods AST#expression#Right . spec AST#member_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . price AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left orderGoods AST#expression#Right . spec AST#member_expression#Right AST#expression#Right . price AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . stock AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left orderGoods AST#expression#Right . spec AST#member_expression#Right AST#expression#Right . stock AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . count AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left orderGoods AST#expression#Right . count AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . images AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left orderGoods AST#expression#Right . spec AST#member_expression#Right AST#expression#Right . images AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left specs AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left spec AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left cart AST#expression#Right . spec AST#member_expression#Right = AST#expression#Left specs AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left cart AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取购物车第一件商品 ID
* @returns {number} 商品 ID
*/ AST#method_declaration#Left private getFirstCartGoodsId AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left cart : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Cart AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cartList AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cart AST#expression#Right ?. goodsId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#decorated_export_declaration#Right
|
@ObservedV2
export default class OrderDetailViewModel extends BaseNetWorkViewModel<Order> {
private readonly repository: OrderRepository = new OrderRepository();
private readonly commonRepository: CommonRepository = new CommonRepository();
private readonly routeParam: OrderIdParam | undefined = getRouteParams<OrderIdParam>(OrderRoutes.Detail);
private readonly orderId: number = this.routeParam?.orderId ?? 0;
@Trace
cartList: Cart[] = [];
@Trace
rebuyModalVisible: boolean = false;
@Trace
commentModalVisible: boolean = false;
@Trace
cancelModalVisible: boolean = false;
@Trace
cancelReasonsUiState: BaseNetWorkUiState = BaseNetWorkUiState.LOADING;
@Trace
cancelReasonList: DictItem[] = [];
@Trace
selectedCancelReason: DictItem | null = null;
@Trace
showConfirmDialog: boolean = false;
protected requestRepository(): Promise<NetworkResponse<Order>> {
return this.repository.getOrderInfo(this.orderId);
}
protected onRequestSuccess(data: Order): void {
this.cartList = this.convertOrderGoodsToCart(data);
super.onRequestSuccess(data);
}
toPay(): void {
const order: Order = this.data ?? new Order();
const payPrice: number = order.price - order.discountPrice;
OrderNavigator.toPay(order.id, payPrice);
}
showRebuyModal(): void {
this.rebuyModalVisible = true;
}
hideRebuyModal(): void {
this.rebuyModalVisible = false;
}
showCommentModal(): void {
this.commentModalVisible = true;
}
hideCommentModal(): void {
this.commentModalVisible = false;
}
handleRebuy(): void {
if (this.cartList.length > 1) {
this.showRebuyModal();
return;
}
const goodsId: number = this.getFirstCartGoodsId();
if (!goodsId) {
return;
}
this.toGoodsDetail(goodsId);
}
handleOrderComment(): void {
if (this.cartList.length > 1) {
this.showCommentModal();
return;
}
const orderId: number = this.data?.id ?? 0;
const goodsId: number = this.getFirstCartGoodsId();
if (!orderId || !goodsId) {
return;
}
OrderNavigator.toComment(orderId, goodsId);
}
toGoodsDetail(goodsId: number): void {
if (!goodsId) {
return;
}
this.hideRebuyModal();
GoodsNavigator.toDetail(goodsId);
}
toOrderCommentForGoods(goodsId: number): void {
const orderId: number = this.data?.id ?? 0;
if (!orderId || !goodsId) {
return;
}
this.hideCommentModal();
OrderNavigator.toComment(orderId, goodsId);
}
showCancelModal(): void {
this.cancelModalVisible = true;
this.loadCancelReasons();
}
hideCancelModal(): void {
this.cancelModalVisible = false;
}
selectCancelReason(reason: DictItem): void {
this.selectedCancelReason = reason;
}
loadCancelReasons(): void {
if (this.cancelReasonsUiState === BaseNetWorkUiState.SUCCESS && this.cancelReasonList.length > 0) {
return;
}
const params: DictDataRequest = new DictDataRequest();
params.types = ["orderCancelReason"];
RequestHelper.repository<DictDataResponse>(this.commonRepository.getDictData(params))
.toast(false)
.start((): void => {
this.cancelReasonsUiState = BaseNetWorkUiState.LOADING;
})
.execute()
.then((data: DictDataResponse): void => {
this.cancelReasonList = data.orderCancelReason ?? [];
this.cancelReasonsUiState = BaseNetWorkUiState.SUCCESS;
})
.catch((): void => {
this.cancelReasonList = [];
this.cancelReasonsUiState = BaseNetWorkUiState.ERROR;
});
}
confirmCancelOrder(): void {
const params: CancelOrderRequest = new CancelOrderRequest();
params.orderId = this.orderId;
params.remark = this.selectedCancelReason?.name ?? "";
RequestHelper.repository<boolean>(this.repository.cancelOrder(params))
.loading(true)
.execute()
.then((): void => this.retryRequest());
}
showConfirmReceiveDialog(): void {
this.showConfirmDialog = true;
}
hideConfirmReceiveDialog(): void {
this.showConfirmDialog = false;
}
confirmReceiveOrder(): void {
RequestHelper.repository<boolean>(this.repository.confirmReceive(this.orderId))
.loading(true)
.execute()
.then((): void => {
this.retryRequest();
this.hideConfirmReceiveDialog();
});
}
private convertOrderGoodsToCart(order: Order): Cart[] {
const goodsList: OrderGoods[] = order.goodsList ?? [];
if (goodsList.length === 0) {
return [];
}
const groupedMap = new Map<number, OrderGoods[]>();
for (const goods of goodsList) {
const exists = groupedMap.get(goods.goodsId);
if (exists) {
exists.push(goods);
} else {
groupedMap.set(goods.goodsId, [goods]);
}
}
const result: Cart[] = [];
groupedMap.forEach((items: OrderGoods[], goodsId: number): void => {
const firstItem: OrderGoods = items[0];
const cart = new Cart();
cart.goodsId = goodsId;
cart.goodsName = firstItem.goodsInfo?.title ?? "";
cart.goodsMainPic = firstItem.goodsInfo?.mainPic ?? "";
const specs: CartGoodsSpec[] = [];
for (const orderGoods of items) {
if (orderGoods.spec) {
const spec = new CartGoodsSpec();
spec.id = orderGoods.spec.id;
spec.goodsId = orderGoods.spec.goodsId;
spec.name = orderGoods.spec.name;
spec.price = orderGoods.spec.price;
spec.stock = orderGoods.spec.stock;
spec.count = orderGoods.count;
spec.images = orderGoods.spec.images;
specs.push(spec);
}
}
cart.spec = specs;
result.push(cart);
});
return result;
}
private getFirstCartGoodsId(): number {
const cart: Cart | undefined = this.cartList[0];
return cart?.goodsId ?? 0;
}
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets#L22-L356
|
392cba86dc773f45f079e8f9b1f9d29a8ca3644e
|
github
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/ai/SimpleAIService.ets
|
arkts
|
callRealStreamAPI
|
调用真实AI API(流式输出)
|
private async callRealStreamAPI(
prompt: string,
streamMode: StreamMode,
onStreamUpdate: (state: StreamState) => void
): Promise<string> {
if (!this.currentConfig) {
throw new Error('AI配置未找到');
}
const configModel = this.currentConfig.model;
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[SimpleAIService] CallRealStreamAPI - Model: ${configModel}, StreamMode: ${streamMode}`);
// 注意:大部分AI API的流式输出在移动设备上实现较复杂
// 这里先实现一个改进的伪流式输出,基于chunk分块而不是单字符
try {
// 先获取完整响应
const fullContent = await this.callRealAPI(prompt);
// 改进的流式输出:按词或短语分块,而不是单字符
await this.improvedStreamOutput(fullContent, streamMode, onStreamUpdate);
return fullContent;
} catch (error) {
const errorStr = String(error);
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[SimpleAIService] Stream API call failed: ${errorStr}`);
throw new Error(`Stream API call failed: ${errorStr}`);
}
}
|
AST#method_declaration#Left private async callRealStreamAPI AST#parameter_list#Left ( AST#parameter#Left prompt : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left streamMode : AST#type_annotation#Left AST#primary_type#Left StreamMode AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left onStreamUpdate : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left state : AST#type_annotation#Left AST#primary_type#Left StreamState AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . currentConfig AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'AI配置未找到' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left configModel = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentConfig AST#member_expression#Right AST#expression#Right . model AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` [SimpleAIService] CallRealStreamAPI - Model: AST#template_substitution#Left $ { AST#expression#Left configModel AST#expression#Right } AST#template_substitution#Right , StreamMode: AST#template_substitution#Left $ { AST#expression#Left streamMode AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 注意:大部分AI API的流式输出在移动设备上实现较复杂 // 这里先实现一个改进的伪流式输出,基于chunk分块而不是单字符 AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 先获取完整响应 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left fullContent = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . callRealAPI AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left prompt AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 改进的流式输出:按词或短语分块,而不是单字符 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . improvedStreamOutput AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left fullContent AST#expression#Right , AST#expression#Left streamMode AST#expression#Right , AST#expression#Left onStreamUpdate AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left fullContent AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left errorStr = AST#expression#Left AST#call_expression#Left AST#expression#Left String AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` [SimpleAIService] Stream API call failed: AST#template_substitution#Left $ { AST#expression#Left errorStr AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Stream API call failed: AST#template_substitution#Left $ { AST#expression#Left errorStr AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private async callRealStreamAPI(
prompt: string,
streamMode: StreamMode,
onStreamUpdate: (state: StreamState) => void
): Promise<string> {
if (!this.currentConfig) {
throw new Error('AI配置未找到');
}
const configModel = this.currentConfig.model;
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[SimpleAIService] CallRealStreamAPI - Model: ${configModel}, StreamMode: ${streamMode}`);
try {
const fullContent = await this.callRealAPI(prompt);
await this.improvedStreamOutput(fullContent, streamMode, onStreamUpdate);
return fullContent;
} catch (error) {
const errorStr = String(error);
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[SimpleAIService] Stream API call failed: ${errorStr}`);
throw new Error(`Stream API call failed: ${errorStr}`);
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/SimpleAIService.ets#L318-L347
|
8b3de8b6c4225dc7d0408bd233dab7adad422c87
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
harmonyos/src/main/ets/services/settings/SettingsService.ets
|
arkts
|
needsUpgrade
|
检查设置是否需要升级
@returns 是否需要升级
|
async needsUpgrade(): Promise<boolean> {
try {
const settings = await this.getSettings();
return settings.version !== BusinessConstants.SETTINGS_VERSION;
} catch (error) {
return true; // 如果无法读取版本,认为需要升级
}
}
|
AST#method_declaration#Left async needsUpgrade AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left settings = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . getSettings AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left settings AST#expression#Right . version AST#member_expression#Right AST#expression#Right !== AST#expression#Left BusinessConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right . SETTINGS_VERSION AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right // 如果无法读取版本,认为需要升级 } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async needsUpgrade(): Promise<boolean> {
try {
const settings = await this.getSettings();
return settings.version !== BusinessConstants.SETTINGS_VERSION;
} catch (error) {
return true;
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/settings/SettingsService.ets#L434-L441
|
a5027577f3c06a6b3147c15cb6013a792c07c103
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/cardswiperanimation/src/main/ets/utils/CardComponent.ets
|
arkts
|
animateFunc
|
设置卡片组件点击图片后的动画
duration: 动画时长
curve: 动画曲线,默认Friction(阻尼曲线)
|
animateFunc() {
animateTo({
duration: Constants.DURATION,
curve: Constants.DEFAULT_ANIMATION_CURVE
}, () => {
this.isPhotoShow = !this.isPhotoShow;
})
}
|
AST#method_declaration#Left animateFunc AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left animateTo ( AST#ERROR#Left AST#component_parameters#Left { AST#component_parameter#Left duration : AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . DURATION AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left curve : AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . DEFAULT_ANIMATION_CURVE AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right , AST#ERROR#Right AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPhotoShow AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . isPhotoShow AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
animateFunc() {
animateTo({
duration: Constants.DURATION,
curve: Constants.DEFAULT_ANIMATION_CURVE
}, () => {
this.isPhotoShow = !this.isPhotoShow;
})
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cardswiperanimation/src/main/ets/utils/CardComponent.ets#L168-L175
|
99da73be91bbc597f449d3812d5e4603a1cdff4c
|
gitee
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/order/src/main/ets/view/OrderRefundPage.ets
|
arkts
|
PriceValue
|
退款金额值
@param {number} price - 金额
@returns {void} 无返回值
|
@Builder
private PriceValue(price: number): void {
IBestPrice({
value: price,
integerFontSize: 14,
decimalFontSize: 12,
symbolFontSize: 12
});
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private PriceValue AST#parameter_list#Left ( AST#parameter#Left price : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left IBestPrice ( AST#component_parameters#Left { AST#component_parameter#Left value : AST#expression#Left price AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left integerFontSize : AST#expression#Left 14 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left decimalFontSize : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left symbolFontSize : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
private PriceValue(price: number): void {
IBestPrice({
value: price,
integerFontSize: 14,
decimalFontSize: 12,
symbolFontSize: 12
});
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderRefundPage.ets#L172-L180
|
1915c66effc159a3ed9676b2d376a3574247fccb
|
github
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/components/AxisBase.ets
|
arkts
|
disableGridDashedLine
|
Disables the grid line to be drawn in dashed mode.
|
public disableGridDashedLine(): void {
this.mGridDashPathEffect = null;
}
|
AST#method_declaration#Left public disableGridDashedLine AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mGridDashPathEffect AST#member_expression#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public disableGridDashedLine(): void {
this.mGridDashPathEffect = null;
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L604-L606
|
9d0fef99fb75f15acf764ab4beeb4fb41a31eba2
|
gitee
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/common/utils/FileSizeUtils.ets
|
arkts
|
formatBytes
|
格式化文件大小(带单位)
@param bytes - 字节数
@param decimalPlaces - 小数位数 (默认1位)
@returns 格式化的字符串
|
static formatBytes(bytes: number, decimalPlaces: number = 1): string {
if (bytes === 0) return '0B';
const k = 1024;
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(decimalPlaces)) + sizes[i];
}
|
AST#method_declaration#Left static formatBytes AST#parameter_list#Left ( AST#parameter#Left bytes : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left decimalPlaces : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left bytes AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left '0B' AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left k = AST#expression#Left 1024 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left sizes = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 'B' AST#expression#Right , AST#expression#Left 'KB' AST#expression#Right , AST#expression#Left 'MB' AST#expression#Right , AST#expression#Left 'GB' AST#expression#Right , AST#expression#Left 'TB' AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left i = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left bytes AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left Math AST#expression#Right AST#binary_expression#Right AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left k AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left parseFloat AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left bytes AST#expression#Right / AST#expression#Left Math AST#expression#Right AST#binary_expression#Right AST#expression#Right . pow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left k AST#expression#Right , AST#expression#Left i AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . toFixed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left decimalPlaces AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left AST#subscript_expression#Left AST#expression#Left sizes AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static formatBytes(bytes: number, decimalPlaces: number = 1): string {
if (bytes === 0) return '0B';
const k = 1024;
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(decimalPlaces)) + sizes[i];
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/FileSizeUtils.ets#L12-L20
|
4e345f121f15f8102875dbbf16b50915d6749b1e
|
github
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets
|
arkts
|
setUseAutoScaleMinRestriction
|
Sets autoscale restriction for axis min value as enabled/disabled
@Deprecated
|
public setUseAutoScaleMinRestriction(isEnabled: boolean): void {
this.mUseAutoScaleRestrictionMin = isEnabled;
}
|
AST#method_declaration#Left public setUseAutoScaleMinRestriction AST#parameter_list#Left ( AST#parameter#Left isEnabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mUseAutoScaleRestrictionMin AST#member_expression#Right = AST#expression#Left isEnabled AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public setUseAutoScaleMinRestriction(isEnabled: boolean): void {
this.mUseAutoScaleRestrictionMin = isEnabled;
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets#L410-L412
|
8ae1e5afed83e0ce555333be4514e123aecfcca4
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/swipercomponent/src/main/ets/utils/SwiperSection.ets
|
arkts
|
SwiperSection
|
功能描述:
1. isLoop为true,轮播图自动切换,向左或者向右滑动,轮播图可以切换。
2. 点击轮播图图片,开发者可以根据自己的需求执行对应的功能效果,比如点击跳转到指定页面。
实现原理:
1. 通过stack组件堆叠图片,实现多层级效果,配合手势滑动和显式动画实现切换的动画效果。同时通过改变数据中间值currentIndex来改变组件zIndex层级和高度来实现切换的效果
@param swiperListView - 轮播模块列表
@param currentIndex - 双向数据绑定当前索引
@param swiperAnimationDuration - 轮播切换动画时间
@param swiperSwitchDuration - 轮播每5s切换一次
@param isLoop - 是否循环播放
@param indicatorBuilder - 导航点自定义视图
@param swiperItemHandle - 点击swiper逻辑处理函数
|
@Component
export struct SwiperSection {
// -------------------对外暴露变量-----------------------
// 轮播模块列表
swiperListView: SwiperItemViewType[] = [];
// 双向数据绑定当前索引
@Link currentIndex: number;
// 轮播切换动画时间
swiperAnimationDuration: number = CommonConstants.SWIPER_ANIMATION_DURATION;
// 轮播每5s切换一次
swiperSwitchDuration: number = CommonConstants.SWIPER_SWITCH_DURATION;
// 是否循环播放
isLoop: boolean = true;
// 导航点自定义视图
@BuilderParam indicatorBuilder?: () => void;
// 点击swiper逻辑处理函数
swiperItemHandle: (swiperItemData: SwiperData) => void = (swiperItemData: SwiperData) => {};
// --------------------私有属性----------------------------
// 定时器句柄
private swiperInterval: number = 0;
// 数据中间值
private halfCount: number = 0;
// 初始化触摸Swiper的偏移量
private offsetX: number = 0;
aboutToAppear(): void {
this.halfCount = Math.floor(this.swiperListView.length / 2);
this.currentIndex = this.halfCount;
if (this.isLoop) {
this.swiperInterval = setInterval(() => {
this.startAnimation(true, this.swiperAnimationDuration);
}, this.swiperSwitchDuration);
} else {
this.startAnimation(true, this.swiperAnimationDuration);
}
}
aboutToDisappear(): void {
if (this.swiperInterval && this.isLoop) {
// 页面销毁时,清除定时器
clearInterval(this.swiperInterval);
}
}
/**
* 获取图片系数
* @param index:索引值
* @returns
*/
getImgCoefficients(index: number): number {
const coefficient: number = this.currentIndex - index; // 计算图片左右位置
const tempCoefficient: number = Math.abs(coefficient);
if (tempCoefficient <= this.halfCount) {
return coefficient;
}
let tempOffset: number = this.swiperListView.length - tempCoefficient; // 判断图片位于左右层级位置
if (tempOffset <= this.halfCount) {
if (coefficient > 0) {
return -tempOffset;
}
return tempOffset;
}
return 0;
}
/**
* 计算偏移量
* @param index:索引值
* @returns
*/
getOffSetX(index: number): number {
const offsetIndex: number = this.getImgCoefficients(index);
const tempOffset: number = Math.abs(offsetIndex);
let offsetX: number = 0;
if (tempOffset === 1) {
// 根据图片层级系数来决定左右偏移量
offsetX = CommonConstants.SWIPER_OFFSET_X * offsetIndex;
}
return offsetX;
}
// 性能:显式动画(https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/ts-explicit-animation-V5)
startAnimation(isLeft: boolean, duration: number): void {
animateTo({
duration: duration,
}, () => {
const tempIndex: number = isLeft ? this.currentIndex + 1 : this.currentIndex - 1 + this.swiperListView.length;
this.currentIndex = tempIndex % this.swiperListView.length;
})
}
build() {
Column() {
Stack() {
// LazyForEach必须在容器组件内使用,仅有List、Grid、Swiper以及WaterFlow组件支持数据懒加载,其他组件仍然是一次性加载所有的数据。
ForEach(this.swiperListView, (item: SwiperItemViewType, index: number) => {
Column() {
item.contentBuilder.builder(item.data)
}
.shadow(ShadowStyle.OUTER_DEFAULT_SM)
.backgroundColor(Color.White)
.borderRadius(CommonConstants.SWIPER_BORDER_RADIUS)
.clip(true)
.offset({
x: this.getOffSetX(index),
y: 0
})
.blur(index !== this.currentIndex ? CommonConstants.SWIPER_BLUR_VALUE : 0)
// TODO: 知识点:通过animateTo实现动画并且同时改变currentIndex数据中间值来判断组件zIndex实现切换动画
.zIndex(this.halfCount + 1 - Math.abs(this.getImgCoefficients(index)))
.width($r('app.string.swipercomponent_swiper_stack_width'))
.height(index !== this.currentIndex ? $r('app.string.swipercomponent_swiper_stack_height1') :
$r('app.string.swipercomponent_swiper_stack_height2'))
.onClick(() => {
// 点击轮播图Item时,根据点击的模块信息,将页面放入路由栈
this.swiperItemHandle(item.data);
})
}, (item: SwiperItemViewType) => JSON.stringify(item))
}
.height($r('app.string.swipercomponent_main_page_swiper_height'))
.width(CommonConstants.CONTENT_FULL_VIEW)
.gesture(
PanGesture({ direction: PanDirection.Horizontal })
.onActionStart((event: GestureEvent) => {
if (this.isLoop) {
clearInterval(this.swiperInterval);
}
this.offsetX = event.offsetX;
})
.onActionEnd((event: GestureEvent) => {
logger.info(`onActionEnd start`);
let isLeft: boolean = event.offsetX < this.offsetX;
if (event.offsetX - this.offsetX >= CommonConstants.SWIPER_LEFT_SCROLL ||
event.offsetX - this.offsetX <= CommonConstants.SWIPER_RIGHT_SCROLL) {
this.startAnimation(isLeft, this.swiperAnimationDuration);
}
if (this.isLoop) {
this.swiperInterval = setInterval(() => {
this.startAnimation(true, this.swiperAnimationDuration);
}, this.swiperSwitchDuration);
}
})
)
.alignContent(Alignment.Center)
.padding({
left: $r('app.string.swipercomponent_main_page_padding2'),
right: $r('app.string.swipercomponent_main_page_padding2'),
top: $r('app.string.swipercomponent_main_page_padding2')
})
if (this.indicatorBuilder) {
this.indicatorBuilder()
}
}
.width(CommonConstants.CONTENT_FULL_VIEW)
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SwiperSection AST#component_body#Left { // -------------------对外暴露变量----------------------- // 轮播模块列表 AST#property_declaration#Left swiperListView : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SwiperItemViewType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 双向数据绑定当前索引 AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right currentIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 轮播切换动画时间 AST#property_declaration#Left swiperAnimationDuration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . SWIPER_ANIMATION_DURATION AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 轮播每5s切换一次 AST#property_declaration#Left swiperSwitchDuration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . SWIPER_SWITCH_DURATION AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 是否循环播放 AST#property_declaration#Left isLoop : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right // 导航点自定义视图 AST#property_declaration#Left AST#decorator#Left @ BuilderParam AST#decorator#Right indicatorBuilder ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 点击swiper逻辑处理函数 AST#property_declaration#Left swiperItemHandle : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left swiperItemData : AST#type_annotation#Left AST#primary_type#Left SwiperData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left swiperItemData : AST#type_annotation#Left AST#primary_type#Left SwiperData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ; AST#property_declaration#Right // --------------------私有属性---------------------------- // 定时器句柄 AST#property_declaration#Left private swiperInterval : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right // 数据中间值 AST#property_declaration#Left private halfCount : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right // 初始化触摸Swiper的偏移量 AST#property_declaration#Left private offsetX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . halfCount AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . swiperListView AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentIndex AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . halfCount AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isLoop AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . swiperInterval AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left setInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . startAnimation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . swiperAnimationDuration AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . swiperSwitchDuration AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . startAnimation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . swiperAnimationDuration AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . swiperInterval AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . isLoop AST#member_expression#Right AST#expression#Right ) { // 页面销毁时,清除定时器 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left clearInterval ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . swiperInterval AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 获取图片系数
* @param index:索引值
* @returns
*/ AST#method_declaration#Left getImgCoefficients AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left coefficient : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentIndex AST#member_expression#Right AST#expression#Right - AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 计算图片左右位置 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left tempCoefficient : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . abs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left coefficient AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left tempCoefficient AST#expression#Right <= AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . halfCount AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left coefficient AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left tempOffset : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . swiperListView AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right - AST#expression#Left tempCoefficient AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 判断图片位于左右层级位置 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left tempOffset AST#expression#Right <= AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . halfCount AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left coefficient AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#unary_expression#Left - AST#expression#Left tempOffset AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left tempOffset AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 0 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 计算偏移量
* @param index:索引值
* @returns
*/ AST#method_declaration#Left getOffSetX AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left offsetIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getImgCoefficients AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left tempOffset : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . abs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left offsetIndex AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left offsetX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left tempOffset AST#expression#Right === AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 根据图片层级系数来决定左右偏移量 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left offsetX = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . SWIPER_OFFSET_X AST#member_expression#Right AST#expression#Right * AST#expression#Left offsetIndex AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left offsetX AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // 性能:显式动画(https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/ts-explicit-animation-V5) AST#method_declaration#Left startAnimation AST#parameter_list#Left ( AST#parameter#Left isLeft : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left animateTo ( AST#ERROR#Left AST#component_parameters#Left { AST#component_parameter#Left duration : AST#expression#Left duration AST#expression#Right AST#component_parameter#Right , } AST#component_parameters#Right , AST#ERROR#Right AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left tempIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left isLeft AST#expression#Right ? AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentIndex AST#member_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . currentIndex AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . swiperListView AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentIndex AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left tempIndex AST#expression#Right % AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . swiperListView AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { // LazyForEach必须在容器组件内使用,仅有List、Grid、Swiper以及WaterFlow组件支持数据懒加载,其他组件仍然是一次性加载所有的数据。 AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . swiperListView AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left SwiperItemViewType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . contentBuilder AST#member_expression#Right AST#expression#Right . builder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . data AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#member_expression#Left AST#expression#Left ShadowStyle AST#expression#Right . OUTER_DEFAULT_SM AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . SWIPER_BORDER_RADIUS AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . clip ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . offset ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getOffSetX AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . blur ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right !== AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentIndex AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . SWIPER_BLUR_VALUE AST#member_expression#Right AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) // TODO: 知识点:通过animateTo实现动画并且同时改变currentIndex数据中间值来判断组件zIndex实现切换动画 AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . halfCount AST#member_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left Math AST#expression#Right AST#binary_expression#Right AST#expression#Right . abs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getImgCoefficients AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.swipercomponent_swiper_stack_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right !== AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentIndex AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.swipercomponent_swiper_stack_height1' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.swipercomponent_swiper_stack_height2' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 点击轮播图Item时,根据点击的模块信息,将页面放入路由栈 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . swiperItemHandle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . data AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left SwiperItemViewType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.swipercomponent_main_page_swiper_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . CONTENT_FULL_VIEW AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . gesture ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left PanGesture AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left direction AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left PanDirection AST#expression#Right . Horizontal AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onActionStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isLoop AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left clearInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . swiperInterval AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . offsetX AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . offsetX AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onActionEnd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onActionEnd start ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left isLeft : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . offsetX AST#member_expression#Right AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . offsetX AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . offsetX AST#member_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . offsetX AST#member_expression#Right AST#expression#Right >= AST#expression#Left CommonConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right . SWIPER_LEFT_SCROLL AST#member_expression#Right AST#expression#Right || AST#expression#Left event AST#expression#Right AST#binary_expression#Right AST#expression#Right . offsetX AST#member_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . offsetX AST#member_expression#Right AST#expression#Right <= AST#expression#Left CommonConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right . SWIPER_RIGHT_SCROLL AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . startAnimation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left isLeft AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . swiperAnimationDuration AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isLoop AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . swiperInterval AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left setInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . startAnimation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . swiperAnimationDuration AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . swiperSwitchDuration AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.swipercomponent_main_page_padding2' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.swipercomponent_main_page_padding2' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.swipercomponent_main_page_padding2' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . indicatorBuilder AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . indicatorBuilder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . CONTENT_FULL_VIEW AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct SwiperSection {
swiperListView: SwiperItemViewType[] = [];
@Link currentIndex: number;
swiperAnimationDuration: number = CommonConstants.SWIPER_ANIMATION_DURATION;
swiperSwitchDuration: number = CommonConstants.SWIPER_SWITCH_DURATION;
isLoop: boolean = true;
@BuilderParam indicatorBuilder?: () => void;
swiperItemHandle: (swiperItemData: SwiperData) => void = (swiperItemData: SwiperData) => {};
private swiperInterval: number = 0;
private halfCount: number = 0;
private offsetX: number = 0;
aboutToAppear(): void {
this.halfCount = Math.floor(this.swiperListView.length / 2);
this.currentIndex = this.halfCount;
if (this.isLoop) {
this.swiperInterval = setInterval(() => {
this.startAnimation(true, this.swiperAnimationDuration);
}, this.swiperSwitchDuration);
} else {
this.startAnimation(true, this.swiperAnimationDuration);
}
}
aboutToDisappear(): void {
if (this.swiperInterval && this.isLoop) {
clearInterval(this.swiperInterval);
}
}
getImgCoefficients(index: number): number {
const coefficient: number = this.currentIndex - index;
const tempCoefficient: number = Math.abs(coefficient);
if (tempCoefficient <= this.halfCount) {
return coefficient;
}
let tempOffset: number = this.swiperListView.length - tempCoefficient;
if (tempOffset <= this.halfCount) {
if (coefficient > 0) {
return -tempOffset;
}
return tempOffset;
}
return 0;
}
getOffSetX(index: number): number {
const offsetIndex: number = this.getImgCoefficients(index);
const tempOffset: number = Math.abs(offsetIndex);
let offsetX: number = 0;
if (tempOffset === 1) {
offsetX = CommonConstants.SWIPER_OFFSET_X * offsetIndex;
}
return offsetX;
}
startAnimation(isLeft: boolean, duration: number): void {
animateTo({
duration: duration,
}, () => {
const tempIndex: number = isLeft ? this.currentIndex + 1 : this.currentIndex - 1 + this.swiperListView.length;
this.currentIndex = tempIndex % this.swiperListView.length;
})
}
build() {
Column() {
Stack() {
ForEach(this.swiperListView, (item: SwiperItemViewType, index: number) => {
Column() {
item.contentBuilder.builder(item.data)
}
.shadow(ShadowStyle.OUTER_DEFAULT_SM)
.backgroundColor(Color.White)
.borderRadius(CommonConstants.SWIPER_BORDER_RADIUS)
.clip(true)
.offset({
x: this.getOffSetX(index),
y: 0
})
.blur(index !== this.currentIndex ? CommonConstants.SWIPER_BLUR_VALUE : 0)
.zIndex(this.halfCount + 1 - Math.abs(this.getImgCoefficients(index)))
.width($r('app.string.swipercomponent_swiper_stack_width'))
.height(index !== this.currentIndex ? $r('app.string.swipercomponent_swiper_stack_height1') :
$r('app.string.swipercomponent_swiper_stack_height2'))
.onClick(() => {
this.swiperItemHandle(item.data);
})
}, (item: SwiperItemViewType) => JSON.stringify(item))
}
.height($r('app.string.swipercomponent_main_page_swiper_height'))
.width(CommonConstants.CONTENT_FULL_VIEW)
.gesture(
PanGesture({ direction: PanDirection.Horizontal })
.onActionStart((event: GestureEvent) => {
if (this.isLoop) {
clearInterval(this.swiperInterval);
}
this.offsetX = event.offsetX;
})
.onActionEnd((event: GestureEvent) => {
logger.info(`onActionEnd start`);
let isLeft: boolean = event.offsetX < this.offsetX;
if (event.offsetX - this.offsetX >= CommonConstants.SWIPER_LEFT_SCROLL ||
event.offsetX - this.offsetX <= CommonConstants.SWIPER_RIGHT_SCROLL) {
this.startAnimation(isLeft, this.swiperAnimationDuration);
}
if (this.isLoop) {
this.swiperInterval = setInterval(() => {
this.startAnimation(true, this.swiperAnimationDuration);
}, this.swiperSwitchDuration);
}
})
)
.alignContent(Alignment.Center)
.padding({
left: $r('app.string.swipercomponent_main_page_padding2'),
right: $r('app.string.swipercomponent_main_page_padding2'),
top: $r('app.string.swipercomponent_main_page_padding2')
})
if (this.indicatorBuilder) {
this.indicatorBuilder()
}
}
.width(CommonConstants.CONTENT_FULL_VIEW)
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/swipercomponent/src/main/ets/utils/SwiperSection.ets#L37-L193
|
7ea93d457e1c785f4e395eaf2091ccb9eb9d0c37
|
gitee
|
sithvothykiv/dialog_hub.git
|
b676c102ef2d05f8994d170abe48dcc40cd39005
|
custom_dialog/src/main/ets/utils/SysUtil.ets
|
arkts
|
getNumber
|
获取指定资源对应的integer数值或者float数值
@param res
@returns
|
static getNumber(res: Resource): number {
return SysUtil.getResourceManager().getNumber(res);
}
|
AST#method_declaration#Left static getNumber AST#parameter_list#Left ( AST#parameter#Left res : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left SysUtil AST#expression#Right . getResourceManager AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getNumber AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left res AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getNumber(res: Resource): number {
return SysUtil.getResourceManager().getNumber(res);
}
|
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/SysUtil.ets#L27-L29
|
c07007cc20fb40b15b7f4c7c6aef127ae976df47
|
github
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/utils/JListInterface.ets
|
arkts
|
Copyright (C) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export default interface
|
AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right
|
export default interface
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/JListInterface.ets#L16-L16
|
80d47f01f3137d025aa3c66d0717d53605f8e618
|
gitee
|
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/action/DialogUtil.ets
|
arkts
|
initDialogButton
|
多个按钮,初始化参数
@param options
|
private static initDialogButton(options: OptionDialogOptions) {
if (!options.buttons) {
options.buttons = [DialogUtil.defaultConfig.primaryButton, DialogUtil.defaultConfig.secondaryButton]
}
if (options.buttons && options.buttons.length > 0) {
let buttons = new Array<ButtonOptions>();
for (let index = 0; index < options.buttons.length; index++) {
if (TypeUtil.isResourceStr(options.buttons[index])) {
let button: ButtonOptions = {
value: options.buttons[index] as ResourceStr,
action: () => {
if (options.onAction) {
options.onAction(DialogUtil.getDialogAction(index));
}
}
}
buttons.push(button);
} else {
let btn = options.buttons[index] as ButtonOptions;
let btnAction = btn.action;
btn.action = () => {
if (options.onAction) {
options.onAction(DialogUtil.getDialogAction(index));
}
if (btnAction) {
btnAction();
}
}
buttons.push(btn);
}
}
options.buttons = buttons;
}
}
|
AST#method_declaration#Left private static initDialogButton AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left OptionDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left options AST#expression#Right AST#unary_expression#Right AST#expression#Right . buttons AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . buttons AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DialogUtil AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . primaryButton AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DialogUtil AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . secondaryButton AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . buttons AST#member_expression#Right AST#expression#Right && AST#expression#Left options AST#expression#Right AST#binary_expression#Right AST#expression#Right . buttons AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left buttons = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ButtonOptions AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left index = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right < AST#expression#Left options AST#expression#Right AST#binary_expression#Right AST#expression#Right . buttons AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left index AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TypeUtil AST#expression#Right . isResourceStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . buttons AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left button : AST#type_annotation#Left AST#primary_type#Left ButtonOptions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#as_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . buttons AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . onAction AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . onAction AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DialogUtil AST#expression#Right . getDialogAction AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#ERROR#Left buttons AST#ERROR#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left button AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left btn = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . buttons AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ButtonOptions AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left btnAction = AST#expression#Left AST#member_expression#Left AST#expression#Left btn AST#expression#Right . action AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left btn AST#expression#Right . action AST#member_expression#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . onAction AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . onAction AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DialogUtil AST#expression#Right . getDialogAction AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left btnAction AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left btnAction AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left buttons AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left btn AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . buttons AST#member_expression#Right = AST#expression#Left buttons AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private static initDialogButton(options: OptionDialogOptions) {
if (!options.buttons) {
options.buttons = [DialogUtil.defaultConfig.primaryButton, DialogUtil.defaultConfig.secondaryButton]
}
if (options.buttons && options.buttons.length > 0) {
let buttons = new Array<ButtonOptions>();
for (let index = 0; index < options.buttons.length; index++) {
if (TypeUtil.isResourceStr(options.buttons[index])) {
let button: ButtonOptions = {
value: options.buttons[index] as ResourceStr,
action: () => {
if (options.onAction) {
options.onAction(DialogUtil.getDialogAction(index));
}
}
}
buttons.push(button);
} else {
let btn = options.buttons[index] as ButtonOptions;
let btnAction = btn.action;
btn.action = () => {
if (options.onAction) {
options.onAction(DialogUtil.getDialogAction(index));
}
if (btnAction) {
btnAction();
}
}
buttons.push(btn);
}
}
options.buttons = buttons;
}
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/action/DialogUtil.ets#L363-L396
|
b6170e1e08f946874e8ca16a6bc76c34619a733c
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/crypto/SHA.ets
|
arkts
|
digestSegmentSync
|
SHA摘要,分段,同步
@param data 待摘要的数据
@param algName 摘要算法名(SHA1、SHA224、SHA256、SHA384、SHA512)。
@param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。
@param len 自定义的数据拆分长度
@returns
|
static digestSegmentSync(data: string, algName: crypto.SHA = 'SHA256',
resultCoding: crypto.BhCoding = 'hex', len: number = 120): string {
return CryptoUtil.digestSegmentSync(data, algName, resultCoding, len);
}
|
AST#method_declaration#Left static digestSegmentSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . SHA AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SHA256' AST#expression#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . BhCoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'hex' AST#expression#Right AST#parameter#Right , AST#parameter#Left len : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 120 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . digestSegmentSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left algName AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right , AST#expression#Left len AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static digestSegmentSync(data: string, algName: crypto.SHA = 'SHA256',
resultCoding: crypto.BhCoding = 'hex', len: number = 120): string {
return CryptoUtil.digestSegmentSync(data, algName, resultCoding, len);
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SHA.ets#L76-L79
|
b415bd070b08f406db6774e8fc597c34da9f00d7
|
gitee
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/common/utils/strings/StringCrypto.ets
|
arkts
|
sha1
|
计算字符串的 SHA1 哈希值
@param input 输入字符串
@returns 十六进制格式的哈希值
|
static async sha1(input: string): Promise<string> {
return StringCrypto._computeHash(input, 'SHA1');
}
|
AST#method_declaration#Left static async sha1 AST#parameter_list#Left ( AST#parameter#Left input : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StringCrypto AST#expression#Right . _computeHash AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left input AST#expression#Right , AST#expression#Left 'SHA1' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static async sha1(input: string): Promise<string> {
return StringCrypto._computeHash(input, 'SHA1');
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringCrypto.ets#L18-L20
|
1dde11198c869c733738d767d36c2a97054ed0b2
|
github
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/data/src/main/ets/repository/SearchHistoryRepository.ets
|
arkts
|
getRecentSearchHistory
|
获取指定数量的最新搜索历史记录
@param {number} limit 限制数量
@returns {Promise<SearchHistory[]>} 搜索历史列表
|
getRecentSearchHistory(limit: number): Promise<SearchHistory[]> {
return this.dataSource.getRecentSearchHistory(limit);
}
|
AST#method_declaration#Left getRecentSearchHistory AST#parameter_list#Left ( AST#parameter#Left limit : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SearchHistory [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right . getRecentSearchHistory AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left limit AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getRecentSearchHistory(limit: number): Promise<SearchHistory[]> {
return this.dataSource.getRecentSearchHistory(limit);
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/SearchHistoryRepository.ets#L79-L81
|
944e2cad3270916365376b0543af3d92b6c3aa05
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/fadingedge/src/main/ets/common/Constants.ets
|
arkts
|
Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export default class Const {
// 示例图片间距
public static readonly EXAMPLE_IMAGE_GAP: number = 10;
// 示例图片数量
public static readonly ITEM_COUNT: number = 6;
// 动画时长
public static readonly DURATION: number = 220;
// 边缘渐变起始和终止颜色
public static readonly BEGIN_COLOR: string = '#00ffffff';
public static readonly END_COLOR: string = '#ffffffff';
// 根容器组件默认间距
public static readonly ROOT_GAP: number = 20;
// 顶部菜单栏间距
public static readonly MENU_ITEM_SPACE: number = 5;
// 顶部菜单栏Item中文字与图片间距
public static readonly MENU_ITEM_COL_SPACE: number = 5;
// 渐变角度
public static readonly OVERLAY_LINEAR_GRADIENT_ANGLE: number = 90;
// 渐变颜色位置
public static readonly OVERLAY_LINEAR_GRADIENT_COLOR_POS: number[] = [0.0, 0.15, 0.85, 1.0];
// tosat提示框持续时间
public static readonly PROMPT_TOAST_DURATION: number = 1200;
}
|
AST#export_declaration#Left export default AST#class_declaration#Left class Const AST#class_body#Left { // 示例图片间距 AST#property_declaration#Left public static readonly EXAMPLE_IMAGE_GAP : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 10 AST#expression#Right ; AST#property_declaration#Right // 示例图片数量 AST#property_declaration#Left public static readonly ITEM_COUNT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 6 AST#expression#Right ; AST#property_declaration#Right // 动画时长 AST#property_declaration#Left public static readonly DURATION : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 220 AST#expression#Right ; AST#property_declaration#Right // 边缘渐变起始和终止颜色 AST#property_declaration#Left public static readonly BEGIN_COLOR : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#00ffffff' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public static readonly END_COLOR : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#ffffffff' AST#expression#Right ; AST#property_declaration#Right // 根容器组件默认间距 AST#property_declaration#Left public static readonly ROOT_GAP : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 20 AST#expression#Right ; AST#property_declaration#Right // 顶部菜单栏间距 AST#property_declaration#Left public static readonly MENU_ITEM_SPACE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 5 AST#expression#Right ; AST#property_declaration#Right // 顶部菜单栏Item中文字与图片间距 AST#property_declaration#Left public static readonly MENU_ITEM_COL_SPACE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 5 AST#expression#Right ; AST#property_declaration#Right // 渐变角度 AST#property_declaration#Left public static readonly OVERLAY_LINEAR_GRADIENT_ANGLE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 90 AST#expression#Right ; AST#property_declaration#Right // 渐变颜色位置 AST#property_declaration#Left public static readonly OVERLAY_LINEAR_GRADIENT_COLOR_POS : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0.0 AST#expression#Right , AST#expression#Left 0.15 AST#expression#Right , AST#expression#Left 0.85 AST#expression#Right , AST#expression#Left 1.0 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // tosat提示框持续时间 AST#property_declaration#Left public static readonly PROMPT_TOAST_DURATION : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1200 AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export default class Const {
public static readonly EXAMPLE_IMAGE_GAP: number = 10;
public static readonly ITEM_COUNT: number = 6;
public static readonly DURATION: number = 220;
public static readonly BEGIN_COLOR: string = '#00ffffff';
public static readonly END_COLOR: string = '#ffffffff';
public static readonly ROOT_GAP: number = 20;
public static readonly MENU_ITEM_SPACE: number = 5;
public static readonly MENU_ITEM_COL_SPACE: number = 5;
public static readonly OVERLAY_LINEAR_GRADIENT_ANGLE: number = 90;
public static readonly OVERLAY_LINEAR_GRADIENT_COLOR_POS: number[] = [0.0, 0.15, 0.85, 1.0];
public static readonly PROMPT_TOAST_DURATION: number = 1200;
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/fadingedge/src/main/ets/common/Constants.ets#L16-L38
|
515149764bbc9188c69793b09eb18c23cc40dbd5
|
gitee
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/lunar/LunarService.ets
|
arkts
|
getLunarCalendarMonth
|
获取农历月历
@param year 农历年份
@param month 农历月份
@param isLeapMonth 是否闰月
@returns 农历月历信息
|
async getLunarCalendarMonth(year: number, month: number, isLeapMonth: boolean = false): Promise<LunarCalendarMonth | null> {
try {
const monthDays = LunarUtils.getLunarMonthDays(year, month, isLeapMonth);
const monthName = LunarUtils.getMonthName(month, isLeapMonth);
const days: LunarCalendarDay[] = [];
const today = DateUtils.formatDate(new Date());
for (let day = 1; day <= monthDays; day++) {
const solarDate = await this.lunarToSolar(year, month, day, isLeapMonth);
if (solarDate) {
const lunarDayName = LunarUtils.getDayName(day);
// 检查是否有节日
const holiday = this.getLunarHolidayName(month, day);
// 检查是否有节气(简化实现)
const solarTerms = this.getSolarTermsName(solarDate);
days.push({
lunarYear: year,
lunarMonth: month,
lunarDay: day,
lunarDayName,
solarDate,
isToday: solarDate === today,
isLeapMonth,
holiday,
solarTerms
});
}
}
return {
year,
month,
isLeapMonth,
monthName,
days,
totalDays: monthDays
};
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to get lunar calendar month: ${error}`);
return null;
}
}
|
AST#method_declaration#Left async getLunarCalendarMonth AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isLeapMonth : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left LunarCalendarMonth AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left monthDays = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LunarUtils AST#expression#Right . getLunarMonthDays AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left year AST#expression#Right , AST#expression#Left month AST#expression#Right , AST#expression#Left isLeapMonth AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left monthName = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LunarUtils AST#expression#Right . getMonthName AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left month AST#expression#Right , AST#expression#Left isLeapMonth AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left days : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left LunarCalendarDay [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left today = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateUtils AST#expression#Right . formatDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left day = AST#expression#Left 1 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left day AST#expression#Right <= AST#expression#Left monthDays AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left day AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left solarDate = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . lunarToSolar AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left year AST#expression#Right , AST#expression#Left month AST#expression#Right , AST#expression#Left day AST#expression#Right , AST#expression#Left isLeapMonth AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left solarDate AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left lunarDayName = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LunarUtils AST#expression#Right . getDayName AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left day AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 检查是否有节日 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left holiday = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getLunarHolidayName AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left month AST#expression#Right , AST#expression#Left day AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 检查是否有节气(简化实现) AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left solarTerms = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getSolarTermsName AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left solarDate AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left days AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left lunarYear AST#property_name#Right : AST#expression#Left year AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lunarMonth AST#property_name#Right : AST#expression#Left month AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lunarDay AST#property_name#Right : AST#expression#Left day AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left lunarDayName AST#property_assignment#Right , AST#property_assignment#Left solarDate AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left isToday AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left solarDate AST#expression#Right === AST#expression#Left today AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left isLeapMonth AST#property_assignment#Right , AST#property_assignment#Left holiday AST#property_assignment#Right , AST#property_assignment#Left solarTerms AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left year AST#property_assignment#Right , AST#property_assignment#Left month AST#property_assignment#Right , AST#property_assignment#Left isLeapMonth AST#property_assignment#Right , AST#property_assignment#Left monthName AST#property_assignment#Right , AST#property_assignment#Left days AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left totalDays AST#property_name#Right : AST#expression#Left monthDays AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to get lunar calendar month: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async getLunarCalendarMonth(year: number, month: number, isLeapMonth: boolean = false): Promise<LunarCalendarMonth | null> {
try {
const monthDays = LunarUtils.getLunarMonthDays(year, month, isLeapMonth);
const monthName = LunarUtils.getMonthName(month, isLeapMonth);
const days: LunarCalendarDay[] = [];
const today = DateUtils.formatDate(new Date());
for (let day = 1; day <= monthDays; day++) {
const solarDate = await this.lunarToSolar(year, month, day, isLeapMonth);
if (solarDate) {
const lunarDayName = LunarUtils.getDayName(day);
const holiday = this.getLunarHolidayName(month, day);
const solarTerms = this.getSolarTermsName(solarDate);
days.push({
lunarYear: year,
lunarMonth: month,
lunarDay: day,
lunarDayName,
solarDate,
isToday: solarDate === today,
isLeapMonth,
holiday,
solarTerms
});
}
}
return {
year,
month,
isLeapMonth,
monthName,
days,
totalDays: monthDays
};
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to get lunar calendar month: ${error}`);
return null;
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/LunarService.ets#L341-L385
|
7b62e611ebcf3ed9636661fefad2d59676e37bed
|
github
|
openharmony/xts_acts
|
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
|
arkcompiler/esmodule/esmodule_dynamicimport/entry/src/main/ets/pages/Index.ets
|
arkts
|
Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export async function varibleWithinHap( ): Promise<boolean> {
let filePath = '../Calc';
let lib: ESObject = await import(filePath);
let res: boolean = false;
if (lib.add(3, 5) == 8) {
res = true;
}
return res;
}
|
AST#export_declaration#Left export AST#function_declaration#Left async function varibleWithinHap AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left filePath = AST#expression#Left '../Calc' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left lib : AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#await_expression#Left await AST#expression#Left AST#import_expression#Left import ( AST#expression#Left filePath AST#expression#Right ) AST#import_expression#Right AST#expression#Right AST#await_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left res : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left lib AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 3 AST#expression#Right , AST#expression#Left 5 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right == AST#expression#Left 8 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left res = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left res AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export async function varibleWithinHap( ): Promise<boolean> {
let filePath = '../Calc';
let lib: ESObject = await import(filePath);
let res: boolean = false;
if (lib.add(3, 5) == 8) {
res = true;
}
return res;
}
|
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkcompiler/esmodule/esmodule_dynamicimport/entry/src/main/ets/pages/Index.ets#L16-L24
|
abffe3c36d3ece63d8ff2bd61fab24221ac9d8a2
|
gitee
|
|
2763981847/Clock-Alarm.git
|
8949bedddb7d011021848196735f30ffe2bd1daf
|
entry/src/main/ets/common/util/Logger.ets
|
arkts
|
error
|
记录错误级别的日志。
@param args 要记录的日志信息
|
error(...args: string[]): void {
hilog.error(this.domain, this.prefix, this.format, args);
}
|
AST#method_declaration#Left error AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . domain AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . prefix AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . format AST#member_expression#Right AST#expression#Right , AST#expression#Left args AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
error(...args: string[]): void {
hilog.error(this.domain, this.prefix, this.format, args);
}
|
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/util/Logger.ets#L51-L53
|
8a479f02bfc06b3e5fda3a659231b1bddfb910a3
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/videocache/src/main/ets/utils/utils.ets
|
arkts
|
临界值
时间处理函数
@param time
@returns
|
export function handleTime(time: number): string {
const minInt: number = Math.floor(time / TIME_ONE);
const minString: string = minInt > 0 ? (minInt > TIME_THREE ? minInt.toString() : `0${minInt}`) : '00';
const secondsInt: number = Math.floor((time - minInt * TIME_ONE) / TIME_TWO);
const secondsString: string = secondsInt > 0 ? (secondsInt > TIME_THREE ? secondsInt.toString() : `0${secondsInt}`) : '00';
return `${minString}:${secondsString}`;
}
|
AST#export_declaration#Left export AST#function_declaration#Left function handleTime AST#parameter_list#Left ( AST#parameter#Left time : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left minInt : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left time AST#expression#Right / AST#expression#Left TIME_ONE AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left minString : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left minInt AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left minInt AST#expression#Right > AST#expression#Left TIME_THREE AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left minInt AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left AST#template_literal#Left ` 0 AST#template_substitution#Left $ { AST#expression#Left minInt AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right : AST#expression#Left '00' AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left secondsInt : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left time AST#expression#Right - AST#expression#Left AST#binary_expression#Left AST#expression#Left minInt AST#expression#Right * AST#expression#Left TIME_ONE AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left TIME_TWO AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left secondsString : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left secondsInt AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left secondsInt AST#expression#Right > AST#expression#Left TIME_THREE AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left secondsInt AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left AST#template_literal#Left ` 0 AST#template_substitution#Left $ { AST#expression#Left secondsInt AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right : AST#expression#Left '00' AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left minString AST#expression#Right } AST#template_substitution#Right : AST#template_substitution#Left $ { AST#expression#Left secondsString AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function handleTime(time: number): string {
const minInt: number = Math.floor(time / TIME_ONE);
const minString: string = minInt > 0 ? (minInt > TIME_THREE ? minInt.toString() : `0${minInt}`) : '00';
const secondsInt: number = Math.floor((time - minInt * TIME_ONE) / TIME_TWO);
const secondsString: string = secondsInt > 0 ? (secondsInt > TIME_THREE ? secondsInt.toString() : `0${secondsInt}`) : '00';
return `${minString}:${secondsString}`;
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocache/src/main/ets/utils/utils.ets#L25-L31
|
9d1c44387125a4f474019c1c5838351a867c0e93
|
gitee
|
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_dialog/src/main/ets/dialog/ActionParameter.ets
|
arkts
|
initSelect
|
选择类弹出框,参数
@param options
|
static initSelect(options: SelectOptions) {
if (options.radioContent && options.radioContent.length > 0) {
CacheHelper.put(`${CacheHelper.CACHE_LABEL}${options.dialogId ?? ""}`, "");
if (Helper.isResourceStr(options.radioContent[0])) {
let sheetInfos = new Array<SheetInfo>()
for (let index = 0; index < options.radioContent.length; index++) {
let sheetInfo: SheetInfo = {
title: options.radioContent[index] as ResourceStr,
action: () => {
CacheHelper.put(`${CacheHelper.CACHE_LABEL}${options.dialogId ?? ""}`, index.toString());
if (options.onCheckedChanged) {
options.onCheckedChanged(index);
}
}
}
sheetInfos.push(sheetInfo);
}
options.radioContent = sheetInfos;
} else {
for (let index = 0; index < options.radioContent.length; index++) {
let btn = options.radioContent[index] as SheetInfo;
let btnAction = btn.action;
btn.action = () => {
CacheHelper.put(`${CacheHelper.CACHE_LABEL}${options.dialogId ?? ""}`, index.toString());
if (options.onCheckedChanged) {
options.onCheckedChanged(index);
}
if (btnAction) {
btnAction();
}
}
}
}
}
if (!options.confirm) { //选择弹出框底部按钮。
options.confirm = ActionParameter.config.primaryButton
}
if (options.confirm) {
if (Helper.isResourceStr(options.confirm)) {
options.confirm = {
value: options.confirm as ResourceStr,
action: () => {
if (options.actionCancel) { //点击操作按钮时,是否关闭弹窗。
DialogHelper.closeDialog(options.dialogId ?? "");
}
if (options.onAction) {
const indexStr = CacheHelper.get<string>(`${CacheHelper.CACHE_LABEL}${options.dialogId ?? ""}`);
options.onAction(DialogAction.ONE, options.dialogId ?? "", indexStr);
}
}
}
} else {
let confirmButton = options.confirm as ButtonOptions;
let confirmAction = confirmButton.action;
confirmButton.action = () => {
if (options.actionCancel) { //点击操作按钮时,是否关闭弹窗。
DialogHelper.closeDialog(options.dialogId ?? "");
}
if (options.onAction) {
const indexStr = CacheHelper.get<string>(`${CacheHelper.CACHE_LABEL}${options.dialogId ?? ""}`);
options.onAction(DialogAction.ONE, options.dialogId ?? "", indexStr);
}
if (confirmAction) {
confirmAction();
}
}
}
}
}
|
AST#method_declaration#Left static initSelect AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left SelectOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . radioContent AST#member_expression#Right AST#expression#Right && AST#expression#Left options AST#expression#Right AST#binary_expression#Right AST#expression#Right . radioContent AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CacheHelper AST#expression#Right . put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left CacheHelper AST#expression#Right . CACHE_LABEL AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . dialogId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right , AST#expression#Left "" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Helper AST#expression#Right . isResourceStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . radioContent AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left sheetInfos = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left SheetInfo AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left for ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left let AST#expression#Right in AST#expression#Left AST#assignment_expression#Left dex = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left ; AST#ERROR#Right in AST#expression#Left dex AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left < AST#qualified_type#Left options . radioContent . length AST#qualified_type#Right ; AST#ERROR#Right in AST#expression#Left AST#update_expression#Left AST#expression#Left dex AST#expression#Right ++ AST#update_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left sheetInfo AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left SheetInfo AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#as_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . radioContent AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CacheHelper AST#expression#Right . put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left CacheHelper AST#expression#Right . CACHE_LABEL AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . dialogId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left index AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . onCheckedChanged AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . onCheckedChanged AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left sheetInfos AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sheetInfo AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . radioContent AST#member_expression#Right = AST#expression#Left sheetInfos AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } else { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left for ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left let AST#expression#Right in AST#expression#Left AST#assignment_expression#Left dex = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left ; AST#ERROR#Right in AST#expression#Left dex AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left < AST#qualified_type#Left options . radioContent . length AST#qualified_type#Right ; AST#ERROR#Right in AST#expression#Left AST#update_expression#Left AST#expression#Left dex AST#expression#Right ++ AST#update_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left btn = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . radioContent AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left SheetInfo AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left btnAction = AST#expression#Left AST#member_expression#Left AST#expression#Left btn AST#expression#Right . action AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left btn AST#expression#Right . action AST#member_expression#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CacheHelper AST#expression#Right . put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left CacheHelper AST#expression#Right . CACHE_LABEL AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . dialogId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left index AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . onCheckedChanged AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . onCheckedChanged AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left btnAction AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left btnAction AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left options AST#expression#Right AST#unary_expression#Right AST#expression#Right . confirm AST#member_expression#Right AST#expression#Right ) { //选择弹出框底部按钮。 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . confirm AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ActionParameter AST#expression#Right . config AST#member_expression#Right AST#expression#Right . primaryButton AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . confirm AST#member_expression#Right AST#expression#Right ) { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Helper AST#expression#Right . isResourceStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . confirm AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . confirm AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . confirm AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . actionCancel AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { //点击操作按钮时,是否关闭弹窗。 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DialogHelper AST#expression#Right . closeDialog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . dialogId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . onAction AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left indexStr = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CacheHelper AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left CacheHelper AST#expression#Right . CACHE_LABEL AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . dialogId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . onAction AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left DialogAction AST#expression#Right . ONE AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . dialogId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left indexStr AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left confirmButton = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . confirm AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ButtonOptions AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left confirmAction = AST#expression#Left AST#member_expression#Left AST#expression#Left confirmButton AST#expression#Right . action AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left confirmButton AST#expression#Right . action AST#member_expression#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . actionCancel AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { //点击操作按钮时,是否关闭弹窗。 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DialogHelper AST#expression#Right . closeDialog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . dialogId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . onAction AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left indexStr = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CacheHelper AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left CacheHelper AST#expression#Right . CACHE_LABEL AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . dialogId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . onAction AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left DialogAction AST#expression#Right . ONE AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . dialogId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left indexStr AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left confirmAction AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left confirmAction AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
static initSelect(options: SelectOptions) {
if (options.radioContent && options.radioContent.length > 0) {
CacheHelper.put(`${CacheHelper.CACHE_LABEL}${options.dialogId ?? ""}`, "");
if (Helper.isResourceStr(options.radioContent[0])) {
let sheetInfos = new Array<SheetInfo>()
for (let index = 0; index < options.radioContent.length; index++) {
let sheetInfo: SheetInfo = {
title: options.radioContent[index] as ResourceStr,
action: () => {
CacheHelper.put(`${CacheHelper.CACHE_LABEL}${options.dialogId ?? ""}`, index.toString());
if (options.onCheckedChanged) {
options.onCheckedChanged(index);
}
}
}
sheetInfos.push(sheetInfo);
}
options.radioContent = sheetInfos;
} else {
for (let index = 0; index < options.radioContent.length; index++) {
let btn = options.radioContent[index] as SheetInfo;
let btnAction = btn.action;
btn.action = () => {
CacheHelper.put(`${CacheHelper.CACHE_LABEL}${options.dialogId ?? ""}`, index.toString());
if (options.onCheckedChanged) {
options.onCheckedChanged(index);
}
if (btnAction) {
btnAction();
}
}
}
}
}
if (!options.confirm) {
options.confirm = ActionParameter.config.primaryButton
}
if (options.confirm) {
if (Helper.isResourceStr(options.confirm)) {
options.confirm = {
value: options.confirm as ResourceStr,
action: () => {
if (options.actionCancel) {
DialogHelper.closeDialog(options.dialogId ?? "");
}
if (options.onAction) {
const indexStr = CacheHelper.get<string>(`${CacheHelper.CACHE_LABEL}${options.dialogId ?? ""}`);
options.onAction(DialogAction.ONE, options.dialogId ?? "", indexStr);
}
}
}
} else {
let confirmButton = options.confirm as ButtonOptions;
let confirmAction = confirmButton.action;
confirmButton.action = () => {
if (options.actionCancel) {
DialogHelper.closeDialog(options.dialogId ?? "");
}
if (options.onAction) {
const indexStr = CacheHelper.get<string>(`${CacheHelper.CACHE_LABEL}${options.dialogId ?? ""}`);
options.onAction(DialogAction.ONE, options.dialogId ?? "", indexStr);
}
if (confirmAction) {
confirmAction();
}
}
}
}
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/ActionParameter.ets#L425-L494
|
10042e61ca6ceef98ea226394177b2bf7e6b6978
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVPlayerModel.ets
|
arkts
|
regAVPlayerCallback
|
注册avplayer回调函数
@param avPlayer AVPlayer实例
@param timeUpdateCb 歌曲时间更新回调
@param stateUpdateCb avplayer状态更新回调
@param completeCb avplayer单曲完成回调
@returns {void}
|
private regAVPlayerCallback(avPlayer: media.AVPlayer, timeUpdateCb: Function, stateUpdateCb: Function, completeCb: Function): void {
// seek操作结果回调函数
avPlayer.on('seekDone', (seekDoneTime: number) => {
logger.debug(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`);
})
// error回调监听函数,当avPlayer在操作过程中出现错误时调用 reset接口触发重置流程
avPlayer.on('error', (err: BusinessError) => {
logger.error(`Invoke avPlayer failed, code is ${err.code}, message is ${err.message}`);
// 调用reset重置资源,触发idle状态
avPlayer.reset();
})
// 歌曲时间进度更新
avPlayer.on('timeUpdate', (newTime: number) => {
timeUpdateCb(newTime);
})
// 状态机变化回调函数
avPlayer.on('stateChange', (state: media.AVPlayerState) => {
stateUpdateCb(state);
switch (state) {
// 成功调用reset接口后触发该状态机上报
case CommonConstants.AVPLAYER_STATE_IDLE:
logger.debug('AVPlayer state idle called.');
|
AST#method_declaration#Left private regAVPlayerCallback AST#parameter_list#Left ( AST#parameter#Left avPlayer : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left media . AVPlayer AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left timeUpdateCb : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left stateUpdateCb : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left completeCb : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right { // seek操作结果回调函数 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left avPlayer AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'seekDone' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left seekDoneTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AVPlayer seek succeeded, seek time is AST#template_substitution#Left $ { AST#expression#Left seekDoneTime AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right // error回调监听函数,当avPlayer在操作过程中出现错误时调用 reset接口触发重置流程 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left avPlayer AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'error' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Invoke avPlayer failed, code is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 调用reset重置资源,触发idle状态 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left avPlayer AST#expression#Right . reset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right // 歌曲时间进度更新 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left avPlayer AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'timeUpdate' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left newTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left timeUpdateCb AST#expression#Right AST#argument_list#Left ( AST#expression#Left newTime AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right // 状态机变化回调函数 AST#expression#Left AST#member_expression#Left AST#expression#Left avPlayer AST#expression#Right . on AST#member_expression#Right AST#expression#Right ( AST#member_expression#Left AST#expression#Left 'stateChange' AST#expression#Right AST#ERROR#Left , AST#parameter_list#Left ( AST#parameter#Left state : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left media . AVPlayerState AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left stateUpdateCb AST#expression#Right AST#argument_list#Left ( AST#expression#Left state AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left switch AST#expression#Right AST#argument_list#Left ( AST#expression#Left state AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right { // 成功调用reset接口后触发该状态机上报 AST#property_name#Left case AST#property_name#Right CommonConstants AST#ERROR#Right . AVPLAYER_STATE_IDLE AST#member_expression#Right AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left logger . debug AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left ( 'AVPlayer state idle called.' ) AST#ERROR#Right ; AST#method_declaration#Right
|
private regAVPlayerCallback(avPlayer: media.AVPlayer, timeUpdateCb: Function, stateUpdateCb: Function, completeCb: Function): void {
avPlayer.on('seekDone', (seekDoneTime: number) => {
logger.debug(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`);
})
avPlayer.on('error', (err: BusinessError) => {
logger.error(`Invoke avPlayer failed, code is ${err.code}, message is ${err.message}`);
avPlayer.reset();
})
avPlayer.on('timeUpdate', (newTime: number) => {
timeUpdateCb(newTime);
})
avPlayer.on('stateChange', (state: media.AVPlayerState) => {
stateUpdateCb(state);
switch (state) {
case CommonConstants.AVPLAYER_STATE_IDLE:
logger.debug('AVPlayer state idle called.');
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVPlayerModel.ets#L83-L105
|
d80e0fdaf6254ddce9cc72fd5b5c55e2e541fee6
|
gitee
|
zl3624/harmonyos_network_samples
|
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
|
code/rcp/OpenAIWithRCP/entry/src/main/ets/pages/Index.ets
|
arkts
|
chat
|
对话
|
async chat() {
let cfg: rcp.SessionConfiguration = {
headers: {
'Authorization': `Bearer ${this.apiKey}`,
'Content-Type': 'application/json'
}
}
let chatInfo = this.getChatInfo()
let postInfo = JSON.stringify(chatInfo)
const session = rcp.createSession(cfg);
session.post(this.baseUrl+this.chatAPI, postInfo)
.then(resp => {
if(resp.statusCode==200){
let chatResp = resp.toJSON() as ChatResponse;
this.msgHistory += `我:${this.question}\r\n`
this.msgHistory += `AI:${chatResp.choices[0].message.content}\r\n`
this.msgHistory += `(共消耗token:${chatResp.usage.total_tokens},其中提问:${chatResp.usage.prompt_tokens},回答:${chatResp.usage.completion_tokens})\r\n`
}
})
.catch((err: BusinessError) => {
console.error(`err: err code is ${err.code}, err message is ${JSON.stringify(err)}`);
});
}
|
AST#method_declaration#Left async chat AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left cfg : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left rcp . SessionConfiguration AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left headers AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'Authorization' AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` Bearer AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . apiKey AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'Content-Type' AST#property_name#Right : AST#expression#Left 'application/json' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left chatInfo = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getChatInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left postInfo = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left chatInfo AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left session = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left rcp AST#expression#Right . createSession AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left cfg AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left session AST#expression#Right . post AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . baseUrl AST#member_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . chatAPI AST#member_expression#Right AST#expression#Right , AST#expression#Left postInfo AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left resp => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resp AST#expression#Right . statusCode AST#member_expression#Right AST#expression#Right == AST#expression#Left 200 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left chatResp = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resp AST#expression#Right . toJSON AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ChatResponse AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . msgHistory AST#member_expression#Right += AST#expression#Left AST#template_literal#Left ` 我: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . question AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right \r \n ` AST#template_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . msgHistory AST#member_expression#Right += AST#expression#Left AST#template_literal#Left ` AI: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left chatResp AST#expression#Right . choices AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right . content AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right \r \n ` AST#template_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . msgHistory AST#member_expression#Right += AST#expression#Left AST#template_literal#Left ` (共消耗token: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left chatResp AST#expression#Right . usage AST#member_expression#Right AST#expression#Right . total_tokens AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,其中提问: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left chatResp AST#expression#Right . usage AST#member_expression#Right AST#expression#Right . prompt_tokens AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,回答: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left chatResp AST#expression#Right . usage AST#member_expression#Right AST#expression#Right . completion_tokens AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ) \r \n ` AST#template_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` err: err code is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , err message is AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async chat() {
let cfg: rcp.SessionConfiguration = {
headers: {
'Authorization': `Bearer ${this.apiKey}`,
'Content-Type': 'application/json'
}
}
let chatInfo = this.getChatInfo()
let postInfo = JSON.stringify(chatInfo)
const session = rcp.createSession(cfg);
session.post(this.baseUrl+this.chatAPI, postInfo)
.then(resp => {
if(resp.statusCode==200){
let chatResp = resp.toJSON() as ChatResponse;
this.msgHistory += `我:${this.question}\r\n`
this.msgHistory += `AI:${chatResp.choices[0].message.content}\r\n`
this.msgHistory += `(共消耗token:${chatResp.usage.total_tokens},其中提问:${chatResp.usage.prompt_tokens},回答:${chatResp.usage.completion_tokens})\r\n`
}
})
.catch((err: BusinessError) => {
console.error(`err: err code is ${err.code}, err message is ${JSON.stringify(err)}`);
});
}
|
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/OpenAIWithRCP/entry/src/main/ets/pages/Index.ets#L129-L153
|
be677daffead6f9b6333383a2d1d687bd2610cb4
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/social/SocialShareService.ets
|
arkts
|
getAvailableSharePlatforms
|
获取可用的分享平台
|
async getAvailableSharePlatforms(): Promise<SharePlatform[]> {
const availablePlatforms: SharePlatform[] = [];
try {
// 检查系统分享能力
availablePlatforms.push(SharePlatform.SYSTEM);
availablePlatforms.push(SharePlatform.SMS);
availablePlatforms.push(SharePlatform.EMAIL);
// 检查第三方应用是否已安装
const installedApps = await this.getInstalledShareApps();
if (installedApps.includes('com.tencent.mm')) {
availablePlatforms.push(SharePlatform.WECHAT);
availablePlatforms.push(SharePlatform.WECHAT_MOMENTS);
}
if (installedApps.includes('com.tencent.mobileqq')) {
availablePlatforms.push(SharePlatform.QQ);
availablePlatforms.push(SharePlatform.QQ_ZONE);
}
if (installedApps.includes('com.sina.weibo')) {
availablePlatforms.push(SharePlatform.WEIBO);
}
if (installedApps.includes('com.alibaba.android.rimet')) {
availablePlatforms.push(SharePlatform.DINGTALK);
}
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`Available share platforms: ${availablePlatforms.join(', ')}`);
return availablePlatforms;
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to get available platforms: ${error}`);
return [SharePlatform.SYSTEM];
}
}
|
AST#method_declaration#Left async getAvailableSharePlatforms AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SharePlatform [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left availablePlatforms : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SharePlatform [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 检查系统分享能力 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left availablePlatforms AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left SharePlatform AST#expression#Right . SYSTEM AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left availablePlatforms AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left SharePlatform AST#expression#Right . SMS AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left availablePlatforms AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left SharePlatform AST#expression#Right . EMAIL AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 检查第三方应用是否已安装 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left installedApps = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . getInstalledShareApps AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left installedApps AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'com.tencent.mm' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left availablePlatforms AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left SharePlatform AST#expression#Right . WECHAT AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left availablePlatforms AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left SharePlatform AST#expression#Right . WECHAT_MOMENTS AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left installedApps AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'com.tencent.mobileqq' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left availablePlatforms AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left SharePlatform AST#expression#Right . QQ AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left availablePlatforms AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left SharePlatform AST#expression#Right . QQ_ZONE AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left installedApps AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'com.sina.weibo' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left availablePlatforms AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left SharePlatform AST#expression#Right . WEIBO AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left installedApps AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'com.alibaba.android.rimet' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left availablePlatforms AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left SharePlatform AST#expression#Right . DINGTALK AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Available share platforms: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left availablePlatforms AST#expression#Right . join AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left ', ' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left availablePlatforms AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to get available platforms: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SharePlatform AST#expression#Right . SYSTEM AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async getAvailableSharePlatforms(): Promise<SharePlatform[]> {
const availablePlatforms: SharePlatform[] = [];
try {
availablePlatforms.push(SharePlatform.SYSTEM);
availablePlatforms.push(SharePlatform.SMS);
availablePlatforms.push(SharePlatform.EMAIL);
const installedApps = await this.getInstalledShareApps();
if (installedApps.includes('com.tencent.mm')) {
availablePlatforms.push(SharePlatform.WECHAT);
availablePlatforms.push(SharePlatform.WECHAT_MOMENTS);
}
if (installedApps.includes('com.tencent.mobileqq')) {
availablePlatforms.push(SharePlatform.QQ);
availablePlatforms.push(SharePlatform.QQ_ZONE);
}
if (installedApps.includes('com.sina.weibo')) {
availablePlatforms.push(SharePlatform.WEIBO);
}
if (installedApps.includes('com.alibaba.android.rimet')) {
availablePlatforms.push(SharePlatform.DINGTALK);
}
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`Available share platforms: ${availablePlatforms.join(', ')}`);
return availablePlatforms;
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to get available platforms: ${error}`);
return [SharePlatform.SYSTEM];
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/SocialShareService.ets#L258-L296
|
2012dfb5f15b3e155803491abccf364093a0beb4
|
github
|
harmonyos/samples
|
f5d967efaa7666550ee3252d118c3c73a77686f5
|
ETSUI/LoginSample/entry/src/main/ets/view/CustomerListComponent.ets
|
arkts
|
CustomerListComponent
|
Customer service page component.
|
@Component
export struct CustomerListComponent {
build() {
Column() {
List() {
ForEach(LoginPageViewModel.getContactListItems(), (contactItemInfo: ListItemData) => {
ListItem() {
Row() {
Text(contactItemInfo.title)
.fontSize($r('app.float.name_text_size'))
.fontColor($r('app.color.text'))
Blank()
Text(contactItemInfo.summary)
.fontSize($r('app.float.app_info_sub_title_size'))
.fontColor($r('app.color.text_opacity'))
}
.width(CommonConstants.ROW_WIDTH_PERCENT)
.height($r('app.float.list_height'))
}
}, contactItemInfo => JSON.stringify(contactItemInfo));
}
.divider({
strokeWidth: $r('app.float.divider_stroke_width'),
color: $r('app.color.divider')
})
}
.width(CommonConstants.DETAIL_COLUMN_WIDTH_PERCENT)
.padding({
top: $r('app.float.list_padding_top'),
bottom: $r('app.float.list_padding_bottom'),
left: $r('app.float.list_padding_left'),
right: $r('app.float.list_padding_right')
})
.margin({ top: $r('app.float.name_text_padding_top') })
.backgroundColor($r('app.color.start_window_background'))
.borderRadius($r('app.float.detail_list_radius'))
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CustomerListComponent AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LoginPageViewModel AST#expression#Right . getContactListItems AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left contactItemInfo : AST#type_annotation#Left AST#primary_type#Left ListItemData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left contactItemInfo AST#expression#Right . title AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.name_text_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Blank ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left contactItemInfo AST#expression#Right . summary AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.app_info_sub_title_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_opacity' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . ROW_WIDTH_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.list_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left contactItemInfo => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left contactItemInfo AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . divider ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left strokeWidth AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.divider_stroke_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.divider' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . DETAIL_COLUMN_WIDTH_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.list_padding_top' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.list_padding_bottom' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.list_padding_left' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.list_padding_right' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.name_text_padding_top' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.start_window_background' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.detail_list_radius' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct CustomerListComponent {
build() {
Column() {
List() {
ForEach(LoginPageViewModel.getContactListItems(), (contactItemInfo: ListItemData) => {
ListItem() {
Row() {
Text(contactItemInfo.title)
.fontSize($r('app.float.name_text_size'))
.fontColor($r('app.color.text'))
Blank()
Text(contactItemInfo.summary)
.fontSize($r('app.float.app_info_sub_title_size'))
.fontColor($r('app.color.text_opacity'))
}
.width(CommonConstants.ROW_WIDTH_PERCENT)
.height($r('app.float.list_height'))
}
}, contactItemInfo => JSON.stringify(contactItemInfo));
}
.divider({
strokeWidth: $r('app.float.divider_stroke_width'),
color: $r('app.color.divider')
})
}
.width(CommonConstants.DETAIL_COLUMN_WIDTH_PERCENT)
.padding({
top: $r('app.float.list_padding_top'),
bottom: $r('app.float.list_padding_bottom'),
left: $r('app.float.list_padding_left'),
right: $r('app.float.list_padding_right')
})
.margin({ top: $r('app.float.name_text_padding_top') })
.backgroundColor($r('app.color.start_window_background'))
.borderRadius($r('app.float.detail_list_radius'))
}
}
|
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/LoginSample/entry/src/main/ets/view/CustomerListComponent.ets#L8-L45
|
f91a55b178a7b853fafcd19bdd7bd8f7708e1d3c
|
gitee
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
avscreen-capture-screen-record-master/entry/src/main/ets/common/utils/TimeUtils.ets
|
arkts
|
Time handling function.
@param time
@returns
|
export function formatVideoTime(totalSeconds: number): string {
const hours = Math.floor(totalSeconds / 3600);
const minutes = Math.floor((totalSeconds % 3600) / 60);
const seconds = totalSeconds % 60;
return `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
}
|
AST#export_declaration#Left export AST#function_declaration#Left function formatVideoTime AST#parameter_list#Left ( AST#parameter#Left totalSeconds : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left hours = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left totalSeconds AST#expression#Right / AST#expression#Left 3600 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left minutes = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left totalSeconds AST#expression#Right % AST#expression#Left 3600 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left 60 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left seconds = AST#expression#Left AST#binary_expression#Left AST#expression#Left totalSeconds AST#expression#Right % AST#expression#Left 60 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hours AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right , AST#expression#Left '0' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right : AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left minutes AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right , AST#expression#Left '0' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right : AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left seconds AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right , AST#expression#Left '0' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function formatVideoTime(totalSeconds: number): string {
const hours = Math.floor(totalSeconds / 3600);
const minutes = Math.floor((totalSeconds % 3600) / 60);
const seconds = totalSeconds % 60;
return `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/avscreen-capture-screen-record-master/entry/src/main/ets/common/utils/TimeUtils.ets#L20-L26
|
35427b45ef7a4bdc6165c72491405b61d1b80660
|
gitee
|
|
wasd09090030/MyHongmengProject.git
|
a8ed386b658ceeac69ef5bc42a92d78c7980821c
|
entry/src/main/ets/viewmodels/ReviewViewModel.ets
|
arkts
|
getOnTimeCount
|
获取准时完成的任务数量
|
static getOnTimeCount(completedTasks: TaskItem[]): number {
return completedTasks.filter(t => {
if (!t.actualTime) return false;
const ratio = t.estimatedTime / t.actualTime;
return ratio >= 0.9 && ratio <= 1.1;
}).length;
}
|
AST#method_declaration#Left static getOnTimeCount AST#parameter_list#Left ( AST#parameter#Left completedTasks : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TaskItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left completedTasks AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left t => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left t AST#expression#Right AST#unary_expression#Right AST#expression#Right . actualTime AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left ratio = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left t AST#expression#Right . estimatedTime AST#member_expression#Right AST#expression#Right / AST#expression#Left t AST#expression#Right AST#binary_expression#Right AST#expression#Right . actualTime AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left ratio AST#expression#Right >= AST#expression#Left 0.9 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left ratio AST#expression#Right <= AST#expression#Left 1.1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getOnTimeCount(completedTasks: TaskItem[]): number {
return completedTasks.filter(t => {
if (!t.actualTime) return false;
const ratio = t.estimatedTime / t.actualTime;
return ratio >= 0.9 && ratio <= 1.1;
}).length;
}
|
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/viewmodels/ReviewViewModel.ets#L121-L127
|
790ddeea1dd46165b05a29b500ef37c638bf55e5
|
github
|
mhtcgr/ToDoList_For_Harmony.git
|
356d4c9a507205f02870e970203022a380c8a2a1
|
entry/src/main/ets/model/model.ets
|
arkts
|
loadTodos
|
从 Preferences 中加载所有待办事项到 ToDoData 数组
|
async loadTodos() {
try {
const todosStr = (await preference.get(CommonConstants.KEY_NAME, '[]')).toString();
this.ToDoData = JSON.parse(todosStr);
Logger.info(CommonConstants.TAG, `Loaded ${this.ToDoData.length} todos.`);
} catch (err) {
Logger.error(CommonConstants.TAG, `Failed to load todos, Cause: ${err}`);
this.ToDoData = []; // 如果加载失败,确保 ToDoData 为空数组
}
}
|
AST#method_declaration#Left async loadTodos AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left todosStr = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left preference AST#expression#Right AST#await_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . KEY_NAME AST#member_expression#Right AST#expression#Right , AST#expression#Left '[]' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ToDoData AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left todosStr AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Loaded AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ToDoData AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right todos. ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to load todos, Cause: AST#template_substitution#Left $ { AST#expression#Left err AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ToDoData AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 如果加载失败,确保 ToDoData 为空数组 } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async loadTodos() {
try {
const todosStr = (await preference.get(CommonConstants.KEY_NAME, '[]')).toString();
this.ToDoData = JSON.parse(todosStr);
Logger.info(CommonConstants.TAG, `Loaded ${this.ToDoData.length} todos.`);
} catch (err) {
Logger.error(CommonConstants.TAG, `Failed to load todos, Cause: ${err}`);
this.ToDoData = [];
}
}
|
https://github.com/mhtcgr/ToDoList_For_Harmony.git/blob/356d4c9a507205f02870e970203022a380c8a2a1/entry/src/main/ets/model/model.ets#L29-L38
|
ada2096b9b8a2b70e0a586bef12b0df481910b34
|
github
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/util/src/main/ets/notification/NotificationUtil.ets
|
arkts
|
申请通知权限,统一处理权限申请流程
@param callback 权限申请结果回调
|
export async function requestPermission(callback: (granted: boolean) => void): Promise<void> {
if (isEnabled()) {
callback(true);
} else {
requestEnable().then(() => callback(true)).catch(() => callback(false));
}
}
|
AST#export_declaration#Left export AST#function_declaration#Left async function requestPermission AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left granted : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left isEnabled AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left callback AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left requestEnable AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left callback AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left callback AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export async function requestPermission(callback: (granted: boolean) => void): Promise<void> {
if (isEnabled()) {
callback(true);
} else {
requestEnable().then(() => callback(true)).catch(() => callback(false));
}
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L47-L53
|
bc2ff662a3fb5d4e62ced7ee6043bb0deaeac4b6
|
github
|
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
core/designsystem/src/main/ets/component/Column.ets
|
arkts
|
ColumnSpaceBetweenStart
|
纵向两端分布 + 水平起始
|
@ComponentV2
export struct ColumnSpaceBetweenStart {
/**
* Column 构造参数
*/
@Param
options: ColumnOptions | ColumnOptionsV2 = {};
/**
* 宽度
*/
@Param
widthValue: Length | undefined = undefined;
/**
* 高度
*/
@Param
heightValue: Length | undefined = undefined;
/**
* 尺寸(对应官方 size 属性)
*/
@Param
sizeValue: SizeOptions | undefined = undefined;
/**
* 内边距
*/
@Param
paddingValue: Padding | Length | LocalizedPadding | undefined = undefined;
/**
* 外边距
*/
@Param
marginValue: Margin | Length | LocalizedMargin | undefined = undefined;
/**
* 是否填充最大宽高
*/
@Param
fillMaxSize: boolean = false;
/**
* 背景颜色
*/
@Param
bgColor: ResourceColor | undefined = undefined;
/**
* 点击事件
*/
@Param
onTap: ((event: ClickEvent) => void) | undefined = undefined;
/**
* 内容构建函数
*/
@BuilderParam
content: CustomBuilder;
/**
* 渲染布局
* @returns {void} 无返回值
* @example
* ColumnSpaceBetweenStart() { Text("A"); Text("B"); }
*/
build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.SpaceBetween,
alignItems: HorizontalAlign.Start,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue,
fillMaxSize: this.fillMaxSize,
bgColor: this.bgColor,
onTap: this.onTap,
content: this.content
});
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ColumnSpaceBetweenStart AST#component_body#Left { /**
* Column 构造参数
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ColumnOptions AST#primary_type#Right | AST#primary_type#Left ColumnOptionsV2 AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 宽度
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right widthValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Length AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 高度
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right heightValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Length AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 尺寸(对应官方 size 属性)
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right sizeValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left SizeOptions AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 内边距
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right paddingValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Padding AST#primary_type#Right | AST#primary_type#Left Length AST#primary_type#Right | AST#primary_type#Left LocalizedPadding AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 外边距
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right marginValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Margin AST#primary_type#Right | AST#primary_type#Left Length AST#primary_type#Right | AST#primary_type#Left LocalizedMargin AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 是否填充最大宽高
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right fillMaxSize : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 背景颜色
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right bgColor : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceColor AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 点击事件
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right onTap : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left ClickEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right ) AST#parenthesized_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 内容构建函数
*/ AST#property_declaration#Left AST#decorator#Left @ BuilderParam AST#decorator#Right content : AST#type_annotation#Left AST#primary_type#Left CustomBuilder AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* 渲染布局
* @returns {void} 无返回值
* @example
* ColumnSpaceBetweenStart() { Text("A"); Text("B"); }
*/ AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left ColumnBase ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left alignItems : AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left widthValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . widthValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left heightValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . heightValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left sizeValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sizeValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left paddingValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . paddingValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left marginValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . marginValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left fillMaxSize : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fillMaxSize AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left bgColor : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bgColor AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onTap : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onTap AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left content : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@ComponentV2
export struct ColumnSpaceBetweenStart {
@Param
options: ColumnOptions | ColumnOptionsV2 = {};
@Param
widthValue: Length | undefined = undefined;
@Param
heightValue: Length | undefined = undefined;
@Param
sizeValue: SizeOptions | undefined = undefined;
@Param
paddingValue: Padding | Length | LocalizedPadding | undefined = undefined;
@Param
marginValue: Margin | Length | LocalizedMargin | undefined = undefined;
@Param
fillMaxSize: boolean = false;
@Param
bgColor: ResourceColor | undefined = undefined;
@Param
onTap: ((event: ClickEvent) => void) | undefined = undefined;
@BuilderParam
content: CustomBuilder;
build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.SpaceBetween,
alignItems: HorizontalAlign.Start,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue,
fillMaxSize: this.fillMaxSize,
bgColor: this.bgColor,
onTap: this.onTap,
content: this.content
});
}
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Column.ets#L945-L1020
|
cdc26b42fb86d08a9d23e00c3d16d92e5d8a0c90
|
github
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/main/src/main/ets/viewmodel/MeViewModel.ets
|
arkts
|
aboutToAppear
|
页面出现前
@returns {void} 无返回值
|
aboutToAppear(): void {
this.userState.refreshUserInfo();
}
|
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userState AST#member_expression#Right AST#expression#Right . refreshUserInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
aboutToAppear(): void {
this.userState.refreshUserInfo();
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/MeViewModel.ets#L98-L100
|
0df5da3706c463bc2e90359bc5775faa7fd1cffa
|
github
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/util/src/main/ets/notification/NotificationUtil.ets
|
arkts
|
发布带有图片的通知
@param {NotificationPictureOptions} options 通知消息配置项
@returns {Promise<number>} number 返回通知ID
|
export async function sendPicture(options: NotificationPictureOptions): Promise<number> {
const notificationId: number = Date.now(); // 通知ID基于时间戳生成,确保唯一性
const pictureContent: notificationManager.NotificationPictureContent = {
title: options.mainTitle,
text: options.mainContent,
briefText: options.summaryText,
expandedTitle: options.expandedDisplayTitle,
picture: options.attachedImage
}
if (options.supplementaryContent || PresetNotificationConfig.supplementaryContent) {
pictureContent.additionalText = options.supplementaryContent ?? PresetNotificationConfig.supplementaryContent;
}
if (options.lockscreenDisplayImage || PresetNotificationConfig.lockscreenDisplayImage) {
pictureContent.lockscreenPicture = options.lockscreenDisplayImage ?? PresetNotificationConfig.lockscreenDisplayImage;
}
let notificationContent: notificationManager.NotificationContent = {
notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_PICTURE,
picture: pictureContent
}
const notificationRequest = makeRequest(notificationId, options, notificationContent);
await notificationManager.publish(notificationRequest);
return notificationId;
}
|
AST#export_declaration#Left export AST#function_declaration#Left async function sendPicture AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left NotificationPictureOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left notificationId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 通知ID基于时间戳生成,确保唯一性 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pictureContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationPictureContent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . mainTitle AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left text AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . mainContent AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left briefText AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . summaryText AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left expandedTitle AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . expandedDisplayTitle AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left picture AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . attachedImage AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . supplementaryContent AST#member_expression#Right AST#expression#Right || AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . supplementaryContent AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left pictureContent AST#expression#Right . additionalText AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . supplementaryContent AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . supplementaryContent AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . lockscreenDisplayImage AST#member_expression#Right AST#expression#Right || AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . lockscreenDisplayImage AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left pictureContent AST#expression#Right . lockscreenPicture AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . lockscreenDisplayImage AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . lockscreenDisplayImage AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left notificationContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationContent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left notificationContentType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notificationManager AST#expression#Right . ContentType AST#member_expression#Right AST#expression#Right . NOTIFICATION_CONTENT_PICTURE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left picture AST#property_name#Right : AST#expression#Left pictureContent AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left notificationRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left makeRequest AST#expression#Right AST#argument_list#Left ( AST#expression#Left notificationId AST#expression#Right , AST#expression#Left options AST#expression#Right , AST#expression#Left notificationContent AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left notificationManager AST#expression#Right AST#await_expression#Right AST#expression#Right . publish AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left notificationRequest AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left notificationId AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export async function sendPicture(options: NotificationPictureOptions): Promise<number> {
const notificationId: number = Date.now();
const pictureContent: notificationManager.NotificationPictureContent = {
title: options.mainTitle,
text: options.mainContent,
briefText: options.summaryText,
expandedTitle: options.expandedDisplayTitle,
picture: options.attachedImage
}
if (options.supplementaryContent || PresetNotificationConfig.supplementaryContent) {
pictureContent.additionalText = options.supplementaryContent ?? PresetNotificationConfig.supplementaryContent;
}
if (options.lockscreenDisplayImage || PresetNotificationConfig.lockscreenDisplayImage) {
pictureContent.lockscreenPicture = options.lockscreenDisplayImage ?? PresetNotificationConfig.lockscreenDisplayImage;
}
let notificationContent: notificationManager.NotificationContent = {
notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_PICTURE,
picture: pictureContent
}
const notificationRequest = makeRequest(notificationId, options, notificationContent);
await notificationManager.publish(notificationRequest);
return notificationId;
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L120-L142
|
e0569a5f747561a81e03ead09c09171c0d63c79c
|
github
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/model/Constants.ets
|
arkts
|
键盘类型枚举
|
export enum EKeyboardType {
NUMERIC, //数字键盘
UPPERCASE, // 大写字母键盘
LOWERCASE, // 小写字母键盘
SPECIAL, // 特殊字符键盘
}
|
AST#export_declaration#Left export AST#enum_declaration#Left enum EKeyboardType AST#enum_body#Left { AST#enum_member#Left NUMERIC AST#enum_member#Right , //数字键盘 AST#enum_member#Left UPPERCASE AST#enum_member#Right , // 大写字母键盘 AST#enum_member#Left LOWERCASE AST#enum_member#Right , // 小写字母键盘 AST#enum_member#Left SPECIAL AST#enum_member#Right , // 特殊字符键盘 } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
|
export enum EKeyboardType {
NUMERIC,
UPPERCASE,
LOWERCASE,
SPECIAL,
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/model/Constants.ets#L19-L24
|
2cd595053e96f08c44822c2d32ba768580a5d256
|
gitee
|
|
common-apps/ZRouter
|
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
|
RouterApi/src/main/ets/api/Router.ets
|
arkts
|
clear
|
@deprecated
@see {ZRouter.getInstance().clear}
|
public static clear() {
ZRouter.getRouterMgr().clear()
}
|
AST#method_declaration#Left public static clear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ZRouter AST#expression#Right . getRouterMgr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . clear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public static clear() {
ZRouter.getRouterMgr().clear()
}
|
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L496-L498
|
4cd3a24ffa368a50dc17957f891e7dfa98fbf7c4
|
gitee
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_ui/src/main/ets/ui/base/PreviewUtil.ets
|
arkts
|
previewImage
|
预览图片
@param uri 预览uri
|
static async previewImage(uri: string): Promise<void> {
await PreviewUtil.openPreview('image', uri);
}
|
AST#method_declaration#Left static async previewImage AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left PreviewUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . openPreview AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'image' AST#expression#Right , AST#expression#Left uri AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
static async previewImage(uri: string): Promise<void> {
await PreviewUtil.openPreview('image', uri);
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/PreviewUtil.ets#L51-L53
|
0e70c136cda10e23c525de91e0fac8f37c451267
|
gitee
|
changweizhang/ChatUI
|
36df7ce41aeb281d8472ca9182f449da6dc109f7
|
chatui/src/main/ets/components/ChatDataSource.ets
|
arkts
|
notifyDataDelete
|
通知LazyForEach组件需要在index对应索引处删除该子组件
|
notifyDataDelete(index: number): void {
this.listeners.forEach(listener => {
listener.onDataDelete(index);
})
}
|
AST#method_declaration#Left notifyDataDelete AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left listener => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onDataDelete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
notifyDataDelete(index: number): void {
this.listeners.forEach(listener => {
listener.onDataDelete(index);
})
}
|
https://github.com/changweizhang/ChatUI/blob/36df7ce41aeb281d8472ca9182f449da6dc109f7/chatui/src/main/ets/components/ChatDataSource.ets#L75-L79
|
065738c3db5f8e201a09595196ccb961690f9030
|
gitee
|
huangwei021230/HarmonyFlow.git
|
427f918873b0c9efdc975ff4889726b1bfccc546
|
entry/src/main/ets/lib/Pointer.ets
|
arkts
|
clear
|
Clears this map and resets all pointers.
|
clear(): void {
for (let pointer of this.pointers) {
pointer.reset();
}
}
|
AST#method_declaration#Left clear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( let pointer of AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pointers AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pointer AST#expression#Right . reset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
clear(): void {
for (let pointer of this.pointers) {
pointer.reset();
}
}
|
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/Pointer.ets#L51-L55
|
25fccba5713c777dee24ea08f1fcf0d5737d65fa
|
github
|
openharmony/arkui_ace_engine
|
30c7d1ee12fbedf0fabece54291d75897e2ad44f
|
examples/Overlay/entry/src/main/ets/common/CustomDialogController.ets
|
arkts
|
若尝试在CustomDialog中传入多个其他的Controller,以实现在CustomDialog中打开另一个或另一些CustomDialog,那么此处需要将指向自己的controller放在所有controller的后面
|
build() {
Column() {
Text('CustomDialog').fontSize(20).margin({ top: 10, bottom: 10 })
TextInput({ placeholder: '', text: this.textValue }).height(60).width('90%')
.onChange((value: string) => {
this.textValue = value
})
Text('Whether to change a text?').fontSize(16).margin({ bottom: 10 })
Flex({ justifyContent: FlexAlign.SpaceAround }) {
Button('cancel')
.onClick(() => {
if (this.controller != undefined) {
this.controller.close()
}
}).backgroundColor(0xffffff).fontColor(Color.Black)
Button('confirm')
.onClick(() => {
if (this.controller != undefined) {
this.inputValue = this.textValue
this.controller.close()
}
}).backgroundColor(0xffffff).fontColor(Color.Red)
}.margin({ bottom: 10 })
}
}
|
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'CustomDialog' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextInput ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left '' AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left text : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 60 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '90%' AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textValue AST#member_expression#Right = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'Whether to change a text?' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( AST#component_parameters#Left { AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceAround AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'cancel' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right != AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 0xffffff AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'confirm' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right != AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputValue AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textValue AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 0xffffff AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Red AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
|
build() {
Column() {
Text('CustomDialog').fontSize(20).margin({ top: 10, bottom: 10 })
TextInput({ placeholder: '', text: this.textValue }).height(60).width('90%')
.onChange((value: string) => {
this.textValue = value
})
Text('Whether to change a text?').fontSize(16).margin({ bottom: 10 })
Flex({ justifyContent: FlexAlign.SpaceAround }) {
Button('cancel')
.onClick(() => {
if (this.controller != undefined) {
this.controller.close()
}
}).backgroundColor(0xffffff).fontColor(Color.Black)
Button('confirm')
.onClick(() => {
if (this.controller != undefined) {
this.inputValue = this.textValue
this.controller.close()
}
}).backgroundColor(0xffffff).fontColor(Color.Red)
}.margin({ bottom: 10 })
}
}
|
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/common/CustomDialogController.ets#L324-L348
|
79d79879f9df98d0765bc3685f46f87fad948f3c
|
gitee
|
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/data/BaseDataSet.ets
|
arkts
|
setColorsByArrAndAlpha
|
Sets colors with a specific alpha value.
@param colors
@param alpha
|
public setColorsByArrAndAlpha(colors: number[], alpha: number): void {
this.resetColors();
for (let color of colors) {
this.addColor(ColorTemplate.argb(alpha, ColorTemplate.red(color), ColorTemplate.green(color), ColorTemplate.blue(color)));
}
}
|
AST#method_declaration#Left public setColorsByArrAndAlpha AST#parameter_list#Left ( AST#parameter#Left colors : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left alpha : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . resetColors AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( let color of AST#expression#Left colors AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . addColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ColorTemplate AST#expression#Right . argb AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left alpha AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ColorTemplate AST#expression#Right . red AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left color AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ColorTemplate AST#expression#Right . green AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left color AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ColorTemplate AST#expression#Right . blue AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left color AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public setColorsByArrAndAlpha(colors: number[], alpha: number): void {
this.resetColors();
for (let color of colors) {
this.addColor(ColorTemplate.argb(alpha, ColorTemplate.red(color), ColorTemplate.green(color), ColorTemplate.blue(color)));
}
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BaseDataSet.ets#L225-L230
|
f140fb0e6f3debbdcbac8e14aa2e9d5a16830552
|
gitee
|
jxdiaodeyi/YX_Sports.git
|
af5346bd3d5003c33c306ff77b4b5e9184219893
|
YX_Sports/oh_modules/.ohpm/@pura+harmony-dialog@1.1.7/oh_modules/@pura/harmony-dialog/src/main/ets/dialog/DialogHelper.ets
|
arkts
|
getMainUIContext
|
获取MainWindow的UIContext
@returns
|
static getMainUIContext(): UIContext | undefined {
if (DialogHelper.mainUIContext) {
return DialogHelper.mainUIContext;
}
const uiContext = DialogHelper.getUIAbilityContext().windowStage.getMainWindowSync().getUIContext();
if (uiContext) {
DialogHelper.mainUIContext = uiContext;
}
return DialogHelper.mainUIContext;
}
|
AST#method_declaration#Left static getMainUIContext AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left UIContext AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left DialogHelper AST#expression#Right . mainUIContext AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left DialogHelper AST#expression#Right . mainUIContext AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left uiContext = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DialogHelper AST#expression#Right . getUIAbilityContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . windowStage AST#member_expression#Right AST#expression#Right . getMainWindowSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left uiContext AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left DialogHelper AST#expression#Right . mainUIContext AST#member_expression#Right = AST#expression#Left uiContext AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left DialogHelper AST#expression#Right . mainUIContext AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getMainUIContext(): UIContext | undefined {
if (DialogHelper.mainUIContext) {
return DialogHelper.mainUIContext;
}
const uiContext = DialogHelper.getUIAbilityContext().windowStage.getMainWindowSync().getUIContext();
if (uiContext) {
DialogHelper.mainUIContext = uiContext;
}
return DialogHelper.mainUIContext;
}
|
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-dialog@1.1.7/oh_modules/@pura/harmony-dialog/src/main/ets/dialog/DialogHelper.ets#L90-L99
|
2b30f6124535a3b9d043cdbcd33164c91cfd0e6b
|
github
|
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
|
6231773905435f000d00d94b26504433082ba40b
|
packages/declarations/ets/api/@ohos.arkui.advanced.ToolBar.d.ets
|
arkts
|
ToolBarOption
|
Declare type ToolBarOption
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare type ToolBarOption
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11
|
@Observed
export declare class ToolBarOption {
/**
* Define text content.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Define text content.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
content: ResourceStr;
/**
* Define the action event.
* @type { ?() => void }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Define the action event.
* @type { ?() => void }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
action?: () => void;
/**
* Define icon resource.
* @type { ?Resource }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Define icon resource.
* @type { ?Resource }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
icon?: Resource;
/**
* Define item type.
* @type { ?ItemState }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Define item type.
* @type { ?ItemState }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
state?: ItemState;
/**
* Define text fontColor.
* @type { ?ResourceColor }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
textColor?: ResourceColor;
/**
* Text fontColor when the item is activated.
* @type { ?ResourceColor }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
activatedTextColor?: ResourceColor;
/**
* Define icon fillColor.
* @type { ?ResourceColor }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
iconColor?: ResourceColor;
/**
* Icon fillColor when the item is activated.
* @type { ?ResourceColor }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
activatedIconColor?: ResourceColor;
/**
* Item symbol icon.
*
* @type { ?ToolBarSymbolGlyphOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
toolBarSymbolOptions?: ToolBarSymbolGlyphOptions;
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right class ToolBarOption AST#class_body#Left { /**
* Define text content.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Define text content.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#property_declaration#Left content : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Define the action event.
* @type { ?() => void }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Define the action event.
* @type { ?() => void }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#property_declaration#Left action ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Define icon resource.
* @type { ?Resource }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Define icon resource.
* @type { ?Resource }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#property_declaration#Left icon ? : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Define item type.
* @type { ?ItemState }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Define item type.
* @type { ?ItemState }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#property_declaration#Left state ? : AST#type_annotation#Left AST#primary_type#Left ItemState AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Define text fontColor.
* @type { ?ResourceColor }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/ AST#property_declaration#Left textColor ? : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Text fontColor when the item is activated.
* @type { ?ResourceColor }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/ AST#property_declaration#Left activatedTextColor ? : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Define icon fillColor.
* @type { ?ResourceColor }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/ AST#property_declaration#Left iconColor ? : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Icon fillColor when the item is activated.
* @type { ?ResourceColor }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/ AST#property_declaration#Left activatedIconColor ? : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Item symbol icon.
*
* @type { ?ToolBarSymbolGlyphOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/ AST#property_declaration#Left toolBarSymbolOptions ? : AST#type_annotation#Left AST#primary_type#Left ToolBarSymbolGlyphOptions AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right } AST#class_body#Right AST#decorated_export_declaration#Right
|
@Observed
export declare class ToolBarOption {
content: ResourceStr;
action?: () => void;
icon?: Resource;
state?: ItemState;
textColor?: ResourceColor;
activatedTextColor?: ResourceColor;
iconColor?: ResourceColor;
activatedIconColor?: ResourceColor;
toolBarSymbolOptions?: ToolBarSymbolGlyphOptions;
}
|
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ToolBar.d.ets#L111-L210
|
909753cbb72dd6eba5c1e346bc09e78366449327
|
github
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets
|
arkts
|
getSearchHistoryCount
|
获取搜索历史记录数量
@returns {Promise<number>} 搜索历史数量
|
async getSearchHistoryCount(): Promise<number> {
return this.orm.query(SearchHistoryEntity).find().length;
}
|
AST#method_declaration#Left async getSearchHistoryCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . orm AST#member_expression#Right AST#expression#Right . query AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left SearchHistoryEntity AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . find AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async getSearchHistoryCount(): Promise<number> {
return this.orm.query(SearchHistoryEntity).find().length;
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets#L80-L82
|
4c53eb79c84e7d40ad22114251178bbbe6f79e66
|
github
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
core/navigation/src/main/ets/user/UserParam.ets
|
arkts
|
收货地址详情参数
|
export interface UserAddressDetailParam {
/**
* 是否为编辑模式
*/
isEditMode?: boolean;
/**
* 地址 ID(0表示新增)
*/
addressId?: number;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface UserAddressDetailParam AST#object_type#Left { /**
* 是否为编辑模式
*/ AST#type_member#Left isEditMode ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 地址 ID(0表示新增)
*/ AST#type_member#Left addressId ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface UserAddressDetailParam {
isEditMode?: boolean;
addressId?: number;
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/user/UserParam.ets#L19-L28
|
4a5174c57cd564ee170d9cc17b5e1cfed887a673
|
github
|
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/entity/constraint.ets
|
arkts
|
KeyboardUtil回调
|
export declare type KeyboardCallBack = (show: boolean, height: number) => void;
|
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#type_declaration#Left type KeyboardCallBack = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left show : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left height : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right ; AST#type_declaration#Right AST#export_declaration#Right
|
export declare type KeyboardCallBack = (show: boolean, height: number) => void;
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/constraint.ets#L53-L53
|
cab0095d3b09f79eceef3ac2cc497893d89a6fcb
|
gitee
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/sideEffectModuleOptimize.ets
|
arkts
|
Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export let dataOptimize2 = 'data from side effect module';
|
AST#export_declaration#Left export AST#variable_declaration#Left let AST#variable_declarator#Left dataOptimize2 = AST#expression#Left 'data from side effect module' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
|
export let dataOptimize2 = 'data from side effect module';
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/sideEffectModuleOptimize.ets#L16-L16
|
a22b222a2309ea156020c60a2e52a5587a7105bf
|
gitee
|
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
api/@ohos.arkui.advanced.ComposeTitleBar.d.ets
|
arkts
|
Declaration of the menu item on the right side.
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declaration of the menu item on the right side.
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11
Declaration of the menu item on the right side.
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20
|
export declare class ComposeTitleBarMenuItem {
/**
* Icon resource for this menu item.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Icon resource for this menu item.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
/**
* Icon resource for this menu item.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/
value: ResourceStr;
/**
* Symbol resource for this menu item.
* @type { ?SymbolGlyphModifier }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
/**
* Symbol resource for this menu item.
* @type { ?SymbolGlyphModifier }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/
symbolStyle?: SymbolGlyphModifier;
/**
* Icon label for this menu item.
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
/**
* Icon label for this menu item.
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/
label?: ResourceStr;
/**
* Whether to enable this menu item.
* @type { ?boolean }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Whether to enable this menu item.
* @type { ?boolean }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
/**
* Whether to enable this menu item.
* @type { ?boolean }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/
isEnabled?: boolean;
/**
* Callback function when click on this menu item.
* @type { ?() => void }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Callback function when click on this menu item.
* @type { ?() => void }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
/**
* Callback function when click on this menu item.
* @type { ?() => void }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/
action?: () => void;
/**
* The accessibilityText of this menu item.
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
/**
* The accessibilityText of this menu item.
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/
accessibilityText?: ResourceStr;
/**
* The accessibilityDescription of this menu item.
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
/**
* The accessibilityDescription of this menu item.
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/
accessibilityDescription?: ResourceStr;
/**
* The accessibilityLevel of this menu item.
* @type { ?string }
* @default "auto".The options are as follows:<br/>
* "auto":The value is converted to "yes" or "no" based on the component.
* "yes": the current component is selectable for the accessibility service.
* "no": The current component is not selectable for the accessibility service.
* "no-hide-descendants":The current component and all its child components are not selectable<br/>
* for the accessibility service.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
/**
* The accessibilityLevel of this menu item.
* @type { ?string }
* @default "auto".The options are as follows:<br/>
* "auto":The value is converted to "yes" or "no" based on the component.
* "yes": the current component is selectable for the accessibility service.
* "no": The current component is not selectable for the accessibility service.
* "no-hide-descendants":The current component and all its child components are not selectable<br/>
* for the accessibility service.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/
accessibilityLevel?: string;
}
|
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class ComposeTitleBarMenuItem AST#class_body#Left { /**
* Icon resource for this menu item.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Icon resource for this menu item.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ /**
* Icon resource for this menu item.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/ AST#property_declaration#Left value : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Symbol resource for this menu item.
* @type { ?SymbolGlyphModifier }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/ /**
* Symbol resource for this menu item.
* @type { ?SymbolGlyphModifier }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/ AST#property_declaration#Left symbolStyle ? : AST#type_annotation#Left AST#primary_type#Left SymbolGlyphModifier AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Icon label for this menu item.
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/ /**
* Icon label for this menu item.
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/ AST#property_declaration#Left label ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Whether to enable this menu item.
* @type { ?boolean }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Whether to enable this menu item.
* @type { ?boolean }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ /**
* Whether to enable this menu item.
* @type { ?boolean }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/ AST#property_declaration#Left isEnabled ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Callback function when click on this menu item.
* @type { ?() => void }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Callback function when click on this menu item.
* @type { ?() => void }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ /**
* Callback function when click on this menu item.
* @type { ?() => void }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/ AST#property_declaration#Left action ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* The accessibilityText of this menu item.
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/ /**
* The accessibilityText of this menu item.
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/ AST#property_declaration#Left accessibilityText ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* The accessibilityDescription of this menu item.
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/ /**
* The accessibilityDescription of this menu item.
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/ AST#property_declaration#Left accessibilityDescription ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* The accessibilityLevel of this menu item.
* @type { ?string }
* @default "auto".The options are as follows:<br/>
* "auto":The value is converted to "yes" or "no" based on the component.
* "yes": the current component is selectable for the accessibility service.
* "no": The current component is not selectable for the accessibility service.
* "no-hide-descendants":The current component and all its child components are not selectable<br/>
* for the accessibility service.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/ /**
* The accessibilityLevel of this menu item.
* @type { ?string }
* @default "auto".The options are as follows:<br/>
* "auto":The value is converted to "yes" or "no" based on the component.
* "yes": the current component is selectable for the accessibility service.
* "no": The current component is not selectable for the accessibility service.
* "no-hide-descendants":The current component and all its child components are not selectable<br/>
* for the accessibility service.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/ AST#property_declaration#Left accessibilityLevel ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export declare class ComposeTitleBarMenuItem {
value: ResourceStr;
symbolStyle?: SymbolGlyphModifier;
label?: ResourceStr;
isEnabled?: boolean;
action?: () => void;
accessibilityText?: ResourceStr;
accessibilityDescription?: ResourceStr;
accessibilityLevel?: string;
}
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ComposeTitleBar.d.ets#L43-L209
|
ca21ffe22fbfe7f01a1c6c4522eaae8fbc89c946
|
gitee
|
|
huangwei021230/HarmonyFlow.git
|
427f918873b0c9efdc975ff4889726b1bfccc546
|
entry/src/main/ets/lib/FlowLocale.ets
|
arkts
|
from
|
Constructs a new FlorisLocale with given language, country, and variant.
@param language A two-letter language code.
@param country A two-letter country code.
@param variant A two-letter variant code.
@return A new FlorisLocale.
|
public static from(language: string, country: string, variant: string): FlorisLocale {
return FlorisLocale.from(new Locale(language, country, variant));
}
|
AST#method_declaration#Left public static from AST#parameter_list#Left ( AST#parameter#Left language : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left country : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left variant : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FlorisLocale AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left FlorisLocale AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Locale AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left language AST#expression#Right , AST#expression#Left country AST#expression#Right , AST#expression#Left variant AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public static from(language: string, country: string, variant: string): FlorisLocale {
return FlorisLocale.from(new Locale(language, country, variant));
}
|
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/FlowLocale.ets#L67-L69
|
3d64c4301c5bc4857dcde92a8b01b29202491efb
|
github
|
huaweicloud/huaweicloud-iot-device-sdk-arkts.git
|
72954bea19e7e7f93567487b036c0664457bdaf3
|
huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets
|
arkts
|
fireServicesChanged
|
触发多个服务的属性变化,SDK自动上报变化的属性到平台
@param serviceIds 发生变化的服务id列表
|
public fireServicesChanged(serviceIds: string[]): void {
const serviceProperties: ServiceProperty[] = [];
serviceIds.forEach(serviceId => {
const deviceService = this.getService(serviceId);
if (deviceService === null || deviceService === undefined || deviceService.serviceId === null) {
LogUtil.error(`service not found: ${serviceId}`);
return;
}
const props = deviceService.onRead();
const serviceProperty: ServiceProperty = {
service_id: deviceService.serviceId,
properties: props,
event_time: IoTUtil.getEventTimestamp(),
}
serviceProperties.push(serviceProperty)
})
if (serviceProperties.length === 0) {
return;
}
this.client.reportProperties(serviceProperties).then((data: IoTMqttResponse) => {
LogUtil.debug(`report properties success ${JSON.stringify(data)}`)
}).catch((err: IoTMqttResponse | string) => {
LogUtil.error(`report properties failed ${JSON.stringify(err)}`)
})
}
|
AST#method_declaration#Left public fireServicesChanged AST#parameter_list#Left ( AST#parameter#Left serviceIds : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left serviceProperties : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ServiceProperty [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left serviceIds AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left serviceId => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left deviceService = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getService AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left serviceId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left deviceService AST#expression#Right === AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left deviceService AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left deviceService AST#expression#Right AST#binary_expression#Right AST#expression#Right . serviceId AST#member_expression#Right AST#expression#Right === AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` service not found: AST#template_substitution#Left $ { AST#expression#Left serviceId AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left props = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left deviceService AST#expression#Right . onRead AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left serviceProperty : AST#type_annotation#Left AST#primary_type#Left ServiceProperty AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left service_id AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left deviceService AST#expression#Right . serviceId AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left properties AST#property_name#Right : AST#expression#Left props AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event_time AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left IoTUtil AST#expression#Right . getEventTimestamp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#ERROR#Left service Prop erties AST#ERROR#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left serviceProperty AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left serviceProperties AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . client AST#member_expression#Right AST#expression#Right . reportProperties AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left serviceProperties AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left IoTMqttResponse AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` report properties success AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left IoTMqttResponse AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` report properties failed AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public fireServicesChanged(serviceIds: string[]): void {
const serviceProperties: ServiceProperty[] = [];
serviceIds.forEach(serviceId => {
const deviceService = this.getService(serviceId);
if (deviceService === null || deviceService === undefined || deviceService.serviceId === null) {
LogUtil.error(`service not found: ${serviceId}`);
return;
}
const props = deviceService.onRead();
const serviceProperty: ServiceProperty = {
service_id: deviceService.serviceId,
properties: props,
event_time: IoTUtil.getEventTimestamp(),
}
serviceProperties.push(serviceProperty)
})
if (serviceProperties.length === 0) {
return;
}
this.client.reportProperties(serviceProperties).then((data: IoTMqttResponse) => {
LogUtil.debug(`report properties success ${JSON.stringify(data)}`)
}).catch((err: IoTMqttResponse | string) => {
LogUtil.error(`report properties failed ${JSON.stringify(err)}`)
})
}
|
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets#L251-L277
|
731d6668e30b67e426a7d3a103e83106b94ac685
|
github
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/common/components/animation/AnimBlink.ets
|
arkts
|
执行闪烁动画(类似 SwiftUI 中 blink 效果)
|
export function blink(options: BlinkOptions): void {
const times = options.times ?? 3
const duration = options.duration ?? 300
const set = options.set
let count = 0
let visible = true
/**
* 执行一步闪烁
*/
const blinkStep = () => {
if (count >= times * 2) {
// 所有闪烁完成,恢复为可见
set(1)
options.onFinished?.()
return
}
// 设置透明度(1 可见,0 隐藏)
const nextOpacity = visible ? 0 : 1
// 执行动画
animateTo({ duration, curve: Curve.EaseInOut }, () => {
set(nextOpacity)
})
visible = !visible
count++
setTimeout(blinkStep, duration)
}
blinkStep()
}
|
AST#export_declaration#Left export AST#function_declaration#Left function blink AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left BlinkOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left times = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . times AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 3 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left duration = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . duration AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 300 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left set = AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left count = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left visible = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#variable_declarator#Right /**
* 执行一步闪烁
*/ AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left blinkStep = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left count AST#expression#Right >= AST#expression#Left AST#binary_expression#Left AST#expression#Left times AST#expression#Right * AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 所有闪烁完成,恢复为可见 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left set AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . onFinished AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 设置透明度(1 可见,0 隐藏) AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left nextOpacity AST#ERROR#Left = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left visible AST#expression#Right ? AST#expression#Left 0 AST#expression#Right : AST#expression#Left 1 AST#expression#Right AST#conditional_expression#Right AST#expression#Right // 执行动画 AST#ERROR#Left animateTo AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left duration AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseInOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left set AST#expression#Right AST#argument_list#Left ( AST#expression#Left nextOpacity AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right visible AST#ERROR#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left AST#update_expression#Left AST#expression#Left visible AST#expression#Right AST#ERROR#Left count AST#ERROR#Right ++ AST#update_expression#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#ERROR#Left setTimeout AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left blinkStep AST#expression#Right , AST#expression#Left duration AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#ERROR#Left bl AST#ERROR#Right in AST#expression#Left kStep AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function blink(options: BlinkOptions): void {
const times = options.times ?? 3
const duration = options.duration ?? 300
const set = options.set
let count = 0
let visible = true
const blinkStep = () => {
if (count >= times * 2) {
set(1)
options.onFinished?.()
return
}
const nextOpacity = visible ? 0 : 1
animateTo({ duration, curve: Curve.EaseInOut }, () => {
set(nextOpacity)
})
visible = !visible
count++
setTimeout(blinkStep, duration)
}
blinkStep()
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/animation/AnimBlink.ets#L14-L48
|
9107ee63da2d8fe01cf3f35b146abc0a7aa5452b
|
github
|
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
core/base/src/main/ets/viewmodel/BaseViewModel.ets
|
arkts
|
BaseViewModel
|
@file 通用基础视图模型,提供生命周期钩子
@author Joker.X
|
@ObservedV2
export class BaseViewModel {
/**
* 页面出现前(组件创建后、build 前)
* @returns {void} 无返回值
*/
aboutToAppear(): void {
}
/**
* 页面隐藏前
* @returns {void} 无返回值
*/
aboutToDisappear(): void {
}
/**
* 组件构建完成(API 12+)
* @returns {void} 无返回值
*/
onDidBuild(): void {
}
/**
* 组件即将回收
* @returns {void} 无返回值
*/
aboutToRecycle(): void {
}
/**
* 主题即将应用
* @param {Theme} theme - 主题对象
* @returns {void} 无返回值
*/
onWillApplyTheme(theme: Theme): void {
}
/**
* 生命周期:销毁
* @returns {void} 无返回值
*/
aboutToBeDeleted(): void {
}
/**
* 页面显示完成 - 来自 NavDestination
* @param {VisibilityChangeReason} reason - 可见性变化原因
* @returns {void} 无返回值
*/
onShown(reason: VisibilityChangeReason): void {
}
/**
* 页面隐藏完成 - 来自 NavDestination
* @param {VisibilityChangeReason} reason - 可见性变化原因
* @returns {void} 无返回值
*/
onHidden(reason: VisibilityChangeReason): void {
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export class BaseViewModel AST#class_body#Left { /**
* 页面出现前(组件创建后、build 前)
* @returns {void} 无返回值
*/ AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right /**
* 页面隐藏前
* @returns {void} 无返回值
*/ AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right /**
* 组件构建完成(API 12+)
* @returns {void} 无返回值
*/ AST#method_declaration#Left onDidBuild AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right /**
* 组件即将回收
* @returns {void} 无返回值
*/ AST#method_declaration#Left aboutToRecycle AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right /**
* 主题即将应用
* @param {Theme} theme - 主题对象
* @returns {void} 无返回值
*/ AST#method_declaration#Left onWillApplyTheme AST#parameter_list#Left ( AST#parameter#Left theme : AST#type_annotation#Left AST#primary_type#Left Theme AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right /**
* 生命周期:销毁
* @returns {void} 无返回值
*/ AST#method_declaration#Left aboutToBeDeleted AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right /**
* 页面显示完成 - 来自 NavDestination
* @param {VisibilityChangeReason} reason - 可见性变化原因
* @returns {void} 无返回值
*/ AST#method_declaration#Left onShown AST#parameter_list#Left ( AST#parameter#Left reason : AST#type_annotation#Left AST#primary_type#Left VisibilityChangeReason AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right /**
* 页面隐藏完成 - 来自 NavDestination
* @param {VisibilityChangeReason} reason - 可见性变化原因
* @returns {void} 无返回值
*/ AST#method_declaration#Left onHidden AST#parameter_list#Left ( AST#parameter#Left reason : AST#type_annotation#Left AST#primary_type#Left VisibilityChangeReason AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#decorated_export_declaration#Right
|
@ObservedV2
export class BaseViewModel {
aboutToAppear(): void {
}
aboutToDisappear(): void {
}
onDidBuild(): void {
}
aboutToRecycle(): void {
}
onWillApplyTheme(theme: Theme): void {
}
aboutToBeDeleted(): void {
}
onShown(reason: VisibilityChangeReason): void {
}
onHidden(reason: VisibilityChangeReason): void {
}
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/viewmodel/BaseViewModel.ets#L5-L65
|
5770fba68fd05e522bee7e8d5d38b1630c31441a
|
github
|
zl3624/harmonyos_network_samples
|
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
|
code/rcp/RCPCertVerify/entry/src/main/ets/pages/Index.ets
|
arkts
|
selectCA
|
选择CA证书文件
|
selectCA() {
let documentPicker = new picker.DocumentViewPicker();
documentPicker.select().then((result) => {
if (result.length > 0) {
this.caFileUri = result[0]
this.msgHistory += "select file: " + this.caFileUri + "\r\n";
}
}).catch((e: BusinessError) => {
this.msgHistory += 'DocumentViewPicker.select failed ' + e.message + "\r\n";
});
}
|
AST#method_declaration#Left selectCA AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left documentPicker = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left picker AST#expression#Right AST#new_expression#Right AST#expression#Right . DocumentViewPicker AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left documentPicker AST#expression#Right . select AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left result AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . caFileUri AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left result AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . msgHistory AST#member_expression#Right += AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "select file: " AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . caFileUri AST#member_expression#Right AST#expression#Right + AST#expression#Left "\r\n" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left e : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . msgHistory AST#member_expression#Right += AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'DocumentViewPicker.select failed ' AST#expression#Right + AST#expression#Left e AST#expression#Right AST#binary_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right + AST#expression#Left "\r\n" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
selectCA() {
let documentPicker = new picker.DocumentViewPicker();
documentPicker.select().then((result) => {
if (result.length > 0) {
this.caFileUri = result[0]
this.msgHistory += "select file: " + this.caFileUri + "\r\n";
}
}).catch((e: BusinessError) => {
this.msgHistory += 'DocumentViewPicker.select failed ' + e.message + "\r\n";
});
}
|
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/RCPCertVerify/entry/src/main/ets/pages/Index.ets#L197-L207
|
4c67a4123caae88f3b01ccf469ecd9dc7e38495c
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_web/src/main/ets/utils/FileUtils.ets
|
arkts
|
getTempDirPath
|
获取临时目录下的文件夹路径或文件路径。
@param dirPath 文件路径;支持完整路径和相对路径(download/wps/doc);dirPath传空字符串表示根目录
@param fileName 文件名(test.text);fileName传空字符串表示文件夹路径
@param blHap true:HAP级别文件路径、 false:App级别文件路径
@returns
|
static getTempDirPath(dirPath: string | undefined = undefined, fileName: string | undefined = undefined,
blHap: boolean = true): string {
let filePath = blHap ? ArkWebHelper.getContext().tempDir : ArkWebHelper.getContext().getApplicationContext().tempDir; //根目录
if (StrUtils.isNotEmpty(dirPath)) {
if (FileUtils.hasDirPath(dirPath) && StrUtils.startsWith(dirPath, filePath)) { //路径中包含根目录,是完整路径。
filePath = dirPath!;
} else { //路径中不包含根目录,拼接成完整路径。
filePath = filePath + FileUtils.separator + dirPath;
}
if (!FileUtils.accessSync(filePath)) {
FileUtils.mkdirSync(filePath); //如果文件夹不存在就创建
}
}
if (StrUtils.isNotEmpty(fileName)) {
filePath = filePath + FileUtils.separator + fileName;
}
return filePath;
}
|
AST#method_declaration#Left static getTempDirPath AST#parameter_list#Left ( AST#parameter#Left dirPath : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right AST#parameter#Right , AST#parameter#Left fileName : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right AST#parameter#Right , AST#parameter#Left blHap : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left filePath = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left blHap AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ArkWebHelper AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . tempDir AST#member_expression#Right AST#expression#Right : AST#expression#Left ArkWebHelper AST#expression#Right AST#conditional_expression#Right AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getApplicationContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . tempDir AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //根目录 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StrUtils AST#expression#Right . isNotEmpty AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dirPath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left FileUtils AST#expression#Right . hasDirPath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dirPath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left StrUtils AST#expression#Right AST#binary_expression#Right AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dirPath AST#expression#Right , AST#expression#Left filePath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { //路径中包含根目录,是完整路径。 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left filePath = AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left dirPath AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { //路径中不包含根目录,拼接成完整路径。 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left filePath = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left filePath AST#expression#Right + AST#expression#Left FileUtils AST#expression#Right AST#binary_expression#Right AST#expression#Right . separator AST#member_expression#Right AST#expression#Right + AST#expression#Left dirPath AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left FileUtils AST#expression#Right AST#unary_expression#Right AST#expression#Right . accessSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filePath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left FileUtils AST#expression#Right . mkdirSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filePath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //如果文件夹不存在就创建 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StrUtils AST#expression#Right . isNotEmpty AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left fileName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left filePath = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left filePath AST#expression#Right + AST#expression#Left FileUtils AST#expression#Right AST#binary_expression#Right AST#expression#Right . separator AST#member_expression#Right AST#expression#Right + AST#expression#Left fileName AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left filePath AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getTempDirPath(dirPath: string | undefined = undefined, fileName: string | undefined = undefined,
blHap: boolean = true): string {
let filePath = blHap ? ArkWebHelper.getContext().tempDir : ArkWebHelper.getContext().getApplicationContext().tempDir;
if (StrUtils.isNotEmpty(dirPath)) {
if (FileUtils.hasDirPath(dirPath) && StrUtils.startsWith(dirPath, filePath)) {
filePath = dirPath!;
} else {
filePath = filePath + FileUtils.separator + dirPath;
}
if (!FileUtils.accessSync(filePath)) {
FileUtils.mkdirSync(filePath);
}
}
if (StrUtils.isNotEmpty(fileName)) {
filePath = filePath + FileUtils.separator + fileName;
}
return filePath;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/FileUtils.ets#L96-L113
|
bdfb826d778053007cd679160160b816e58483be
|
gitee
|
zhongte/TaoYao
|
80850f3800dd6037216d3f7c58a2bf34a881c93f
|
taoyao/src/main/ets/shijing/taoyao/checker/GeneralChecker.ets
|
arkts
|
使用系统提供的方法检测是否有权限
|
export class GeneralChecker implements PermissionChecker {
hasPermission(permissions: Array<Permissions>): boolean {
for (let i = 0; i < permissions.length; i++) {
const permission = permissions[i]
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DENIED;
// 获取应用程序的accessTokenID
let tokenId: number = 0;
try {
let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION);
let appInfo: bundleManager.ApplicationInfo = bundleInfo.appInfo;
tokenId = appInfo.accessTokenId;
} catch (error) {
const err: BusinessError = error as BusinessError;
console.error(`Failed to get bundle info for self. Code is ${err.code}, message is ${err.message}`);
}
// 校验应用是否被授予权限
grantStatus = atManager.checkAccessTokenSync(tokenId, permission);
if (grantStatus !== abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) {
return false
}
}
return true
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class GeneralChecker AST#implements_clause#Left implements PermissionChecker AST#implements_clause#Right AST#class_body#Left { AST#method_declaration#Left hasPermission AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left permissions AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left permission = AST#expression#Left AST#subscript_expression#Left AST#expression#Left permissions AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left atManager : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left abilityAccessCtrl . AtManager AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left abilityAccessCtrl AST#expression#Right . createAtManager AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left grantStatus : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left abilityAccessCtrl . GrantStatus AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left abilityAccessCtrl AST#expression#Right . GrantStatus AST#member_expression#Right AST#expression#Right . PERMISSION_DENIED AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 获取应用程序的accessTokenID AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left tokenId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left bundleInfo = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bundleManager AST#expression#Right . getBundleInfoForSelfSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bundleManager AST#expression#Right . BundleFlag AST#member_expression#Right AST#expression#Right . GET_BUNDLE_INFO_WITH_APPLICATION AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left appInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left bundleManager . ApplicationInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left bundleInfo AST#expression#Right . appInfo AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left tokenId = AST#expression#Left AST#member_expression#Left AST#expression#Left appInfo AST#expression#Right . accessTokenId AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to get bundle info for self. Code is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right // 校验应用是否被授予权限 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left grantStatus = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left atManager AST#expression#Right . checkAccessTokenSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tokenId AST#expression#Right , AST#expression#Left permission AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left grantStatus AST#expression#Right !== AST#expression#Left abilityAccessCtrl AST#expression#Right AST#binary_expression#Right AST#expression#Right . GrantStatus AST#member_expression#Right AST#expression#Right . PERMISSION_GRANTED AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class GeneralChecker implements PermissionChecker {
hasPermission(permissions: Array<Permissions>): boolean {
for (let i = 0; i < permissions.length; i++) {
const permission = permissions[i]
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DENIED;
let tokenId: number = 0;
try {
let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION);
let appInfo: bundleManager.ApplicationInfo = bundleInfo.appInfo;
tokenId = appInfo.accessTokenId;
} catch (error) {
const err: BusinessError = error as BusinessError;
console.error(`Failed to get bundle info for self. Code is ${err.code}, message is ${err.message}`);
}
grantStatus = atManager.checkAccessTokenSync(tokenId, permission);
if (grantStatus !== abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) {
return false
}
}
return true
}
}
|
https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/checker/GeneralChecker.ets#L8-L33
|
7f8d310278bfdb5db4959182df7f000d52288834
|
gitee
|
|
RicardoWesleyli/HarmonyNEXT_Examples.git
|
6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670
|
Chapter6/entry/src/main/ets/pages/Index.ets
|
arkts
|
todayWeatherView
|
今日天气代码块
|
@Builder
todayWeatherView(){
Column({space:20}) {
this.textView('香港特别行政区',32,600,Color.White)
this.textView('26°C',48,600,Color.White)
Row({space:10}){
this.textView('最高',23,600,Color.White)
this.textView('25°C',32,600,Color.White)
this.textView('最低',23,600,Color.White)
this.textView('22°C',32,600,Color.White)
}
this.textView('多云☁️',23,600,Color.White)
}
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right todayWeatherView AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 20 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textView AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '香港特别行政区' AST#expression#Right , AST#expression#Left 32 AST#expression#Right , AST#expression#Left 600 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textView AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '26°C' AST#expression#Right , AST#expression#Left 48 AST#expression#Right , AST#expression#Left 600 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 10 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textView AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '最高' AST#expression#Right , AST#expression#Left 23 AST#expression#Right , AST#expression#Left 600 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textView AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '25°C' AST#expression#Right , AST#expression#Left 32 AST#expression#Right , AST#expression#Left 600 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textView AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '最低' AST#expression#Right , AST#expression#Left 23 AST#expression#Right , AST#expression#Left 600 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textView AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '22°C' AST#expression#Right , AST#expression#Left 32 AST#expression#Right , AST#expression#Left 600 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textView AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '多云☁️' AST#expression#Right , AST#expression#Left 23 AST#expression#Right , AST#expression#Left 600 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
todayWeatherView(){
Column({space:20}) {
this.textView('香港特别行政区',32,600,Color.White)
this.textView('26°C',48,600,Color.White)
Row({space:10}){
this.textView('最高',23,600,Color.White)
this.textView('25°C',32,600,Color.White)
this.textView('最低',23,600,Color.White)
this.textView('22°C',32,600,Color.White)
}
this.textView('多云☁️',23,600,Color.White)
}
}
|
https://github.com/RicardoWesleyli/HarmonyNEXT_Examples.git/blob/6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670/Chapter6/entry/src/main/ets/pages/Index.ets#L75-L90
|
20546f0aa19cad4603906042ba1e4aeb2ba8f746
|
github
|
open9527/OpenHarmony
|
fdea69ed722d426bf04e817ec05bff4002e81a4e
|
libs/web/src/main/ets/WebViewManager.ets
|
arkts
|
init
|
初始化
@param debug 日志显示
|
static init(debug: boolean = false) {
Logger.init(debug)
webview.WebviewController.initializeWebEngine()
webview.WebviewController.setWebDebuggingAccess(debug)
}
|
AST#method_declaration#Left static init AST#parameter_list#Left ( AST#parameter#Left debug : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . init AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left debug AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebviewController AST#member_expression#Right AST#expression#Right . initializeWebEngine AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebviewController AST#member_expression#Right AST#expression#Right . setWebDebuggingAccess AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left debug AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
static init(debug: boolean = false) {
Logger.init(debug)
webview.WebviewController.initializeWebEngine()
webview.WebviewController.setWebDebuggingAccess(debug)
}
|
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/web/src/main/ets/WebViewManager.ets#L16-L20
|
af6115158fce7e8a0b6cf9936a15c03e3b050d02
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/ai/ChatbotEngine.ets
|
arkts
|
clearContextVariables
|
清除上下文变量
|
clearContextVariables(sessionId: string, keepPersistent: boolean = true): void {
try {
const sessionVars = this.contextVariables.get(sessionId);
if (!sessionVars) return;
if (keepPersistent) {
// 只删除非持久化变量
for (const [name, variable] of sessionVars.entries()) {
if (!variable.persistent) {
sessionVars.delete(name);
}
}
} else {
// 删除所有变量
sessionVars.clear();
}
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`Cleared context variables for session: ${sessionId}`);
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`Failed to clear context variables: ${error}`);
}
}
|
AST#method_declaration#Left clearContextVariables AST#parameter_list#Left ( AST#parameter#Left sessionId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keepPersistent : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left sessionVars = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . contextVariables AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sessionId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left sessionVars AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left keepPersistent AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { // 只删除非持久化变量 AST#ERROR#Left for ( AST#ERROR#Left const AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#array_literal#Left [ AST#expression#Left name AST#expression#Right , AST#expression#Left variable AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#ERROR#Left of sessionVars AST#ERROR#Right . entries AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#property_name#Left if AST#property_name#Right ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left variable AST#expression#Right AST#unary_expression#Right AST#expression#Right . persistent AST#member_expression#Right AST#expression#Right ) { AST#property_name#Left sessionVars AST#property_name#Right . AST#ERROR#Right AST#expression#Left AST#unary_expression#Left delete AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left name AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#ERROR#Left } } } else AST#ERROR#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { // 删除所有变量 AST#property_assignment#Left sessionVars AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . clear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#ERROR#Right } AST#object_literal#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Cleared context variables for session: AST#template_substitution#Left $ { AST#expression#Left sessionId AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to clear context variables: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
clearContextVariables(sessionId: string, keepPersistent: boolean = true): void {
try {
const sessionVars = this.contextVariables.get(sessionId);
if (!sessionVars) return;
if (keepPersistent) {
for (const [name, variable] of sessionVars.entries()) {
if (!variable.persistent) {
sessionVars.delete(name);
}
}
} else {
sessionVars.clear();
}
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`Cleared context variables for session: ${sessionId}`);
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`Failed to clear context variables: ${error}`);
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/ChatbotEngine.ets#L313-L336
|
7f970eca0e029e2378f9355b33cf0ecd41abf543
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/Solutions/Shopping/OrangeShopping/feature/detailPageHsp/src/main/ets/components/EventsDialog.ets
|
arkts
|
EventsDialog
|
Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
@CustomDialog
export struct EventsDialog {
private customDialogController?: CustomDialogController
build() {
Column() {
Column() {
Image($r('app.media.product004'))
.objectFit(ImageFit.Contain)
.height(300)
.aspectRatio(1.5)
Column() {
Text($r('app.string.shopping'))
.fontSize(24)
Text($r('app.string.shopping_advertising'))
.margin({ top: 100 })
.fontSize(20)
.opacity(0.6)
}
.margin({ top: '10vp' })
}
.height('100%')
.justifyContent(FlexAlign.Center)
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
Text($r('app.string.close'))
.fontSize('16vp')
.textAlign(TextAlign.Center)
.fontColor('#FFFFFF')
}
.position({ x: '85%', y: '3%' })
.width('12%')
.aspectRatio(2.4)
.backgroundColor('rgba(0,0,0,0.3)')
.borderRadius('18vp')
.onClick(() => {
this.customDialogController?.close();
})
}
.backgroundColor('#F1F3F5')
.width('90%')
.margin(60)
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct EventsDialog AST#component_body#Left { AST#property_declaration#Left private customDialogController ? : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.product004' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Contain AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 300 AST#expression#Right ) AST#modifier_chain_expression#Left . aspectRatio ( AST#expression#Left 1.5 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.shopping' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.shopping_advertising' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 100 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left 0.6 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left '10vp' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( AST#component_parameters#Left { AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left alignItems : AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.close' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left '16vp' AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#FFFFFF' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left '85%' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left '3%' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '12%' AST#expression#Right ) AST#modifier_chain_expression#Left . aspectRatio ( AST#expression#Left 2.4 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 'rgba(0,0,0,0.3)' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left '18vp' AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . customDialogController AST#member_expression#Right AST#expression#Right ?. close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#F1F3F5' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '90%' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left 60 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@CustomDialog
export struct EventsDialog {
private customDialogController?: CustomDialogController
build() {
Column() {
Column() {
Image($r('app.media.product004'))
.objectFit(ImageFit.Contain)
.height(300)
.aspectRatio(1.5)
Column() {
Text($r('app.string.shopping'))
.fontSize(24)
Text($r('app.string.shopping_advertising'))
.margin({ top: 100 })
.fontSize(20)
.opacity(0.6)
}
.margin({ top: '10vp' })
}
.height('100%')
.justifyContent(FlexAlign.Center)
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
Text($r('app.string.close'))
.fontSize('16vp')
.textAlign(TextAlign.Center)
.fontColor('#FFFFFF')
}
.position({ x: '85%', y: '3%' })
.width('12%')
.aspectRatio(2.4)
.backgroundColor('rgba(0,0,0,0.3)')
.borderRadius('18vp')
.onClick(() => {
this.customDialogController?.close();
})
}
.backgroundColor('#F1F3F5')
.width('90%')
.margin(60)
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Shopping/OrangeShopping/feature/detailPageHsp/src/main/ets/components/EventsDialog.ets#L16-L59
|
528ee9dce9c4bf5d7cf00113f0307501ef5a995c
|
gitee
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
NdkDrawing/entry/src/main/ets/pages/Index.ets
|
arkts
|
draw
|
background image
|
draw(context: DrawContext): void {
// Call the Native onDraw interface on the native side to draw, and pass in the background image this.pMap and the graphic drawing context as parameters
testNapi.nativeOnDraw(666, context, uiContext?.vp2px(this.size.width), uiContext?.vp2px(this.size.height),
this.drawType, this.pMap);
}
|
AST#method_declaration#Left draw AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left DrawContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // Call the Native onDraw interface on the native side to draw, and pass in the background image this.pMap and the graphic drawing context as parameters AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left testNapi AST#expression#Right . nativeOnDraw AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 666 AST#expression#Right , AST#expression#Left context AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left uiContext AST#expression#Right ?. vp2px AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left uiContext AST#expression#Right ?. vp2px AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . drawType AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pMap AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
draw(context: DrawContext): void {
testNapi.nativeOnDraw(666, context, uiContext?.vp2px(this.size.width), uiContext?.vp2px(this.size.height),
this.drawType, this.pMap);
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NdkDrawing/entry/src/main/ets/pages/Index.ets#L42-L46
|
dc0527b09c5aac698fbcc2858752d755fee546fa
|
gitee
|
Application-Security-Automation/Arktan.git
|
3ad9cb05235e38b00cd5828476aa59a345afa1c0
|
dataset/completeness/function_call/library_function/string_lib_func_002_F.ets
|
arkts
|
Introduction 库函数-string_concat
|
export function string_lib_func_002_F(taint_src : string) {
let clean = "clean";
let t = clean.concat("_");
taint.Sink(t);
}
|
AST#export_declaration#Left export AST#function_declaration#Left function string_lib_func_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left clean = AST#expression#Left "clean" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left t = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left clean AST#expression#Right . concat AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "_" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left taint AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left t AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function string_lib_func_002_F(taint_src : string) {
let clean = "clean";
let t = clean.concat("_");
taint.Sink(t);
}
|
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/string_lib_func_002_F.ets#L7-L11
|
fc248ba2808e1e9f31c4fd411a165baa1ae30399
|
github
|
|
sithvothykiv/dialog_hub.git
|
b676c102ef2d05f8994d170abe48dcc40cd39005
|
custom_dialog/src/main/ets/core/DialogBuilder.ets
|
arkts
|
LoadingProgressBuilder
|
LoadingProgress加载进度弹窗view
|
@Builder
export function LoadingProgressBuilder(options: ILoadingProgressOptions) { //, observedData: LoadingProgressObserved
LoadingProgressView({ options: options });
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function LoadingProgressBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ILoadingProgressOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { //, observedData: LoadingProgressObserved AST#ui_custom_component_statement#Left LoadingProgressView ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left options AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#decorated_export_declaration#Right
|
@Builder
export function LoadingProgressBuilder(options: ILoadingProgressOptions) {
LoadingProgressView({ options: options });
}
|
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogBuilder.ets#L285-L288
|
a51999e7c9dada0f4988fa84316d04f9332771de
|
github
|
jjjjjjava/ffmpeg_tools.git
|
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
|
src/main/ets/ffmpeg/TaskConfig.ets
|
arkts
|
TaskConfig Builder
|
export class TaskConfigBuilder {
public useHardwareDecoder: boolean = false; // 默认软解
public timeoutMs: number = 0; // 默认不超时
public retryCount: number = 0; // 默认不重试
public setHardwareDecoder(useHardwareDecoder: boolean): TaskConfigBuilder {
this.useHardwareDecoder = useHardwareDecoder;
return this;
}
public setTimeout(timeoutMs: number): TaskConfigBuilder {
if (timeoutMs < 0) {
throw new Error('timeoutMs must be >= 0');
}
this.timeoutMs = timeoutMs;
return this;
}
public setRetryCount(retryCount: number): TaskConfigBuilder {
if (retryCount < 0) {
throw new Error('retryCount must be >= 0');
}
this.retryCount = retryCount;
return this;
}
public build(): TaskConfig {
return new TaskConfig(this);
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class TaskConfigBuilder AST#class_body#Left { AST#property_declaration#Left public useHardwareDecoder : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right // 默认软解 AST#property_declaration#Left public timeoutMs : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right // 默认不超时 AST#property_declaration#Left public retryCount : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right // 默认不重试 AST#method_declaration#Left public setHardwareDecoder AST#parameter_list#Left ( AST#parameter#Left useHardwareDecoder : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TaskConfigBuilder AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . useHardwareDecoder AST#member_expression#Right = AST#expression#Left useHardwareDecoder AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left this AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left public setTimeout AST#parameter_list#Left ( AST#parameter#Left timeoutMs : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TaskConfigBuilder AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left timeoutMs AST#expression#Right < AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'timeoutMs must be >= 0' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeoutMs AST#member_expression#Right = AST#expression#Left timeoutMs AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left this AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left public setRetryCount AST#parameter_list#Left ( AST#parameter#Left retryCount : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TaskConfigBuilder AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left retryCount AST#expression#Right < AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'retryCount must be >= 0' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . retryCount AST#member_expression#Right = AST#expression#Left retryCount AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left this AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left public build AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TaskConfig AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left TaskConfig AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class TaskConfigBuilder {
public useHardwareDecoder: boolean = false;
public timeoutMs: number = 0;
public retryCount: number = 0;
public setHardwareDecoder(useHardwareDecoder: boolean): TaskConfigBuilder {
this.useHardwareDecoder = useHardwareDecoder;
return this;
}
public setTimeout(timeoutMs: number): TaskConfigBuilder {
if (timeoutMs < 0) {
throw new Error('timeoutMs must be >= 0');
}
this.timeoutMs = timeoutMs;
return this;
}
public setRetryCount(retryCount: number): TaskConfigBuilder {
if (retryCount < 0) {
throw new Error('retryCount must be >= 0');
}
this.retryCount = retryCount;
return this;
}
public build(): TaskConfig {
return new TaskConfig(this);
}
}
|
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/TaskConfig.ets#L51-L80
|
a62f7868b12f8be7347373d59d96a5e52ea34254
|
github
|
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/data/src/main/ets/repository/AuthRepository.ets
|
arkts
|
register
|
用户注册
@param {Record<string, string>} params - 注册参数
@returns {Promise<NetworkResponse<Auth>>} 注册结果
|
async register(params: Record<string, string>): Promise<NetworkResponse<Auth>> {
return this.networkDataSource.register(params);
}
|
AST#method_declaration#Left async register AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Auth AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . networkDataSource AST#member_expression#Right AST#expression#Right . register AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async register(params: Record<string, string>): Promise<NetworkResponse<Auth>> {
return this.networkDataSource.register(params);
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/AuthRepository.ets#L45-L47
|
4b5362423a491ee8adaa1e4bfab5e45ac8f752e3
|
github
|
zhongte/TaoYao
|
80850f3800dd6037216d3f7c58a2bf34a881c93f
|
taoyao/src/main/ets/shijing/taoyao/notification/NotificationPermissionChecker.ets
|
arkts
|
isDistributedEnabled
|
判断是否支持分布式通知
@returns
|
static isDistributedEnabled(): Promise<boolean>{
return notificationManager.isDistributedEnabled()
}
|
AST#method_declaration#Left static isDistributedEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notificationManager AST#expression#Right . isDistributedEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static isDistributedEnabled(): Promise<boolean>{
return notificationManager.isDistributedEnabled()
}
|
https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/notification/NotificationPermissionChecker.ets#L19-L21
|
04866580b90b7eb70405cfa0ea4965774a497f83
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/crypto/SM2.ets
|
arkts
|
decryptSync
|
解密,同步
@param data 加密或者解密的数据。data不能为null。
@param priKey 指定解密私钥。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合。
|
static decryptSync(data: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey,
transformation: string = 'SM2_256|SM3'): cryptoFramework.DataBlob {
return CryptoUtil.decryptSync(data, priKey, null, transformation);
}
|
AST#method_declaration#Left static decryptSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PriKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left transformation : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SM2_256|SM3' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . decryptSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left priKey AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left transformation AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static decryptSync(data: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey,
transformation: string = 'SM2_256|SM3'): cryptoFramework.DataBlob {
return CryptoUtil.decryptSync(data, priKey, null, transformation);
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM2.ets#L75-L78
|
5fc7a2bdd8266ae0141e57f2a30ae594506bff6e
|
gitee
|
Application-Security-Automation/Arktan.git
|
3ad9cb05235e38b00cd5828476aa59a345afa1c0
|
dataset/completeness/function_call/library_function/string_lib_func_017_T.ets
|
arkts
|
Introduction 库函数-string_toUpperCase
|
export function string_lib_func_017_T(taint_src : string) {
let t = taint_src.toUpperCase();
taint.Sink(t);
}
|
AST#export_declaration#Left export AST#function_declaration#Left function string_lib_func_017_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left t = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left taint_src AST#expression#Right . toUpperCase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left taint AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left t AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function string_lib_func_017_T(taint_src : string) {
let t = taint_src.toUpperCase();
taint.Sink(t);
}
|
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/string_lib_func_017_T.ets#L7-L10
|
aeb8aeeecc0c5a0aded5e97c12875779f17ccd52
|
github
|
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_crypto_dto/src/main/ets/crypto/encryption/AES.ets
|
arkts
|
decodeGCM
|
解密-GCM模式
@param str 加密的字符串
@param aesKey AES密钥
|
static async decodeGCM(str: string, aesKey: string): Promise<OutDTO<string>> {
//转换密钥
let symKey = await CryptoUtil.convertKeyFromStr(aesKey, 'AES256', 256);
// 初始化加解密操作环境:开始解密
let mode = crypto.CryptoMode.DECRYPT_MODE;
//创建解密器
let cipher = crypto.createCipher('AES256|GCM|PKCS7');
//初始化加密
await cipher.init(mode, symKey, AES.gcmParams);
//解密
let updateOutput = await cipher.update({ data: StrAndUintUtil.stringToByteArray(str, 256) });
//判断是否完成
let finalOutput = await cipher.doFinal(null);
let decode = util.TextDecoder.create('utf-8', { ignoreBOM: true });
return OutDTO.OKByDataRow('AES解密成功~', decode.decodeWithStream(updateOutput.data));
}
|
AST#method_declaration#Left static async decodeGCM AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left OutDTO AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { //转换密钥 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left symKey = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left CryptoUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . convertKeyFromStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left aesKey AST#expression#Right , AST#expression#Left 'AES256' AST#expression#Right , AST#expression#Left 256 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 初始化加解密操作环境:开始解密 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left mode = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left crypto AST#expression#Right . CryptoMode AST#member_expression#Right AST#expression#Right . DECRYPT_MODE AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //创建解密器 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left cipher = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left crypto AST#expression#Right . createCipher AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'AES256|GCM|PKCS7' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //初始化加密 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left cipher AST#expression#Right AST#await_expression#Right AST#expression#Right . init AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left mode AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AES AST#expression#Right . gcmParams AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //解密 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateOutput = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left cipher AST#expression#Right AST#await_expression#Right AST#expression#Right . update AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StrAndUintUtil AST#expression#Right . stringToByteArray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left 256 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //判断是否完成 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left finalOutput = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left cipher AST#expression#Right AST#await_expression#Right AST#expression#Right . doFinal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left decode = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left util AST#expression#Right . TextDecoder AST#member_expression#Right AST#expression#Right . create AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'utf-8' AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left ignoreBOM AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OutDTO AST#expression#Right . OKByDataRow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'AES解密成功~' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left decode AST#expression#Right . decodeWithStream AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left updateOutput AST#expression#Right . data AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static async decodeGCM(str: string, aesKey: string): Promise<OutDTO<string>> {
let symKey = await CryptoUtil.convertKeyFromStr(aesKey, 'AES256', 256);
let mode = crypto.CryptoMode.DECRYPT_MODE;
let cipher = crypto.createCipher('AES256|GCM|PKCS7');
await cipher.init(mode, symKey, AES.gcmParams);
let updateOutput = await cipher.update({ data: StrAndUintUtil.stringToByteArray(str, 256) });
let finalOutput = await cipher.doFinal(null);
let decode = util.TextDecoder.create('utf-8', { ignoreBOM: true });
return OutDTO.OKByDataRow('AES解密成功~', decode.decodeWithStream(updateOutput.data));
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/AES.ets#L158-L173
|
7cbeec701f18bded1da21f8bde39e6aad1aa17ec
|
gitee
|
openharmony/arkui_ace_engine
|
30c7d1ee12fbedf0fabece54291d75897e2ad44f
|
examples/components/common/Index.ets
|
arkts
|
Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export * from './src/main/ets/components';
|
AST#export_declaration#Left export * from './src/main/ets/components' ; AST#export_declaration#Right
|
export * from './src/main/ets/components';
|
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/components/common/Index.ets#L16-L16
|
a6bbeb6cdde0e125ce469593a0920fe4d78cfde6
|
gitee
|
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/common/utils/DateUtils.ets
|
arkts
|
padZero
|
左侧补零函数(私有静态方法)
@param value 需要补零的数字
@param len 目标长度,默认2位
@returns 补零后的字符串
|
private static padZero(value: number, len: number = 2): string {
return value.toString().padStart(len, '0');
}
|
AST#method_declaration#Left private static padZero AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left len : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left len AST#expression#Right , AST#expression#Left '0' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private static padZero(value: number, len: number = 2): string {
return value.toString().padStart(len, '0');
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DateUtils.ets#L339-L341
|
9dab53410b4b72b32fdb12a4eb02749f2c381600
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/notification/TimedReminderService.ets
|
arkts
|
cancelAllReminders
|
取消所有提醒
|
public async cancelAllReminders(): Promise<number> {
try {
let cancelledCount = 0;
const reminders = Array.from(this.activeReminders.keys());
for (const reminderId of reminders) {
if (await this.cancelReminder(reminderId)) {
cancelledCount++;
}
}
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[TimedReminderService] Cancelled ${cancelledCount} reminders`);
return cancelledCount;
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[TimedReminderService] Failed to cancel all reminders: ${error}`);
return 0;
}
}
|
AST#method_declaration#Left public async cancelAllReminders AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left cancelledCount = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left reminders = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Array AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . activeReminders AST#member_expression#Right AST#expression#Right . keys AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( const reminderId of AST#expression#Left reminders AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . cancelReminder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left reminderId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left cancelledCount AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` [TimedReminderService] Cancelled AST#template_substitution#Left $ { AST#expression#Left cancelledCount AST#expression#Right } AST#template_substitution#Right reminders ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left cancelledCount AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` [TimedReminderService] Failed to cancel all reminders: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 0 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public async cancelAllReminders(): Promise<number> {
try {
let cancelledCount = 0;
const reminders = Array.from(this.activeReminders.keys());
for (const reminderId of reminders) {
if (await this.cancelReminder(reminderId)) {
cancelledCount++;
}
}
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[TimedReminderService] Cancelled ${cancelledCount} reminders`);
return cancelledCount;
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[TimedReminderService] Failed to cancel all reminders: ${error}`);
return 0;
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/TimedReminderService.ets#L188-L208
|
68b1aecfe15eff0453f58d6a598584117ef10aac
|
github
|
zqaini002/YaoYaoLingXian.git
|
5095b12cbeea524a87c42d0824b1702978843d39
|
YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamPage.ets
|
arkts
|
getData
|
获取真实数据的方法
|
async getData() {
try {
this.isDreamsLoading = true;
// 获取当前登录用户ID
const userId = this.userSession.getUserId();
if (this.selectedCategory === '全部') {
// 获取所有梦想
this.dreams = await getDreamsByUserId(userId);
} else {
// 获取特定分类的梦想
this.dreams = await getDreamsByUserIdAndCategory(userId, this.selectedCategory);
}
console.info(`成功获取用户梦想列表,userId: ${userId}, 分类: ${this.selectedCategory}, 数量: ${this.dreams.length}`);
} catch (error) {
console.error(`获取梦想列表失败: ${error instanceof Error ? error.message : String(error)}`);
} finally {
this.isDreamsLoading = false;
}
}
|
AST#method_declaration#Left async getData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isDreamsLoading AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 获取当前登录用户ID AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left userId = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userSession AST#member_expression#Right AST#expression#Right . getUserId AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedCategory AST#member_expression#Right AST#expression#Right === AST#expression#Left '全部' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 获取所有梦想 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dreams AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left getDreamsByUserId AST#expression#Right AST#await_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left userId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { // 获取特定分类的梦想 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dreams AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left getDreamsByUserIdAndCategory AST#expression#Right AST#await_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left userId AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedCategory AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 成功获取用户梦想列表,userId: AST#template_substitution#Left $ { AST#expression#Left userId AST#expression#Right } AST#template_substitution#Right , 分类: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedCategory AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , 数量: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dreams AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 获取梦想列表失败: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left error AST#expression#Right instanceof AST#expression#Left Error AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right : AST#expression#Left String AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#finally_clause#Left finally AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isDreamsLoading AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#finally_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async getData() {
try {
this.isDreamsLoading = true;
const userId = this.userSession.getUserId();
if (this.selectedCategory === '全部') {
this.dreams = await getDreamsByUserId(userId);
} else {
this.dreams = await getDreamsByUserIdAndCategory(userId, this.selectedCategory);
}
console.info(`成功获取用户梦想列表,userId: ${userId}, 分类: ${this.selectedCategory}, 数量: ${this.dreams.length}`);
} catch (error) {
console.error(`获取梦想列表失败: ${error instanceof Error ? error.message : String(error)}`);
} finally {
this.isDreamsLoading = false;
}
}
|
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamPage.ets#L72-L93
|
57706e0bb774ebb7b1db4f8cba48cf9180bde642
|
github
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
ResponsiveLayout/entry/src/main/ets/constants/BreakpointConstants.ets
|
arkts
|
Constants for breakpoint.
|
export class BreakpointConstants {
/**
* Breakpoints that represent small device types.
*/
static readonly BREAKPOINT_SM: string = 'sm';
/**
* Breakpoints that represent middle device types.
*/
static readonly BREAKPOINT_MD: string = 'md';
/**
* Breakpoints that represent large device types.
*/
static readonly BREAKPOINT_LG: string = 'lg';
}
|
AST#export_declaration#Left export AST#class_declaration#Left class BreakpointConstants AST#class_body#Left { /**
* Breakpoints that represent small device types.
*/ AST#property_declaration#Left static readonly BREAKPOINT_SM : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sm' AST#expression#Right ; AST#property_declaration#Right /**
* Breakpoints that represent middle device types.
*/ AST#property_declaration#Left static readonly BREAKPOINT_MD : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'md' AST#expression#Right ; AST#property_declaration#Right /**
* Breakpoints that represent large device types.
*/ AST#property_declaration#Left static readonly BREAKPOINT_LG : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'lg' AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class BreakpointConstants {
static readonly BREAKPOINT_SM: string = 'sm';
static readonly BREAKPOINT_MD: string = 'md';
static readonly BREAKPOINT_LG: string = 'lg';
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ResponsiveLayout/entry/src/main/ets/constants/BreakpointConstants.ets#L19-L32
|
f453109b04fb1ff0f9ad7c6cb594e06855aec53d
|
gitee
|
|
BohanSu/LumosAgent-HarmonyOS.git
|
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
|
entry/src/main/ets/common/Utils.ets
|
arkts
|
getStartOfToday
|
Get start of today (00:00:00) as timestamp
@returns Timestamp of start of today
|
static getStartOfToday(): number {
const now = new Date();
now.setHours(0, 0, 0, 0);
return now.getTime();
}
|
AST#method_declaration#Left static getStartOfToday AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left now = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left now AST#expression#Right . setHours AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left now AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getStartOfToday(): number {
const now = new Date();
now.setHours(0, 0, 0, 0);
return now.getTime();
}
|
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/Utils.ets#L43-L47
|
e310ea4c02a5fd6b3a324b0fa800bfa896364d75
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/encapsulationdialog/src/main/ets/dialog/util/AnimationUtil.ets
|
arkts
|
transitionFromUp
|
顶部弹出动画
@param duration 动画时间
@returns
|
static transitionFromUp(duration: number = 200): TransitionEffect {
return TransitionEffect.asymmetric(
TransitionEffect.OPACITY.animation({ duration: duration }).combine(
TransitionEffect.move(TransitionEdge.TOP).animation({ duration: duration })),
TransitionEffect.OPACITY.animation({ delay: duration, duration: duration }).combine(
TransitionEffect.move(TransitionEdge.TOP).animation({ duration: duration }))
)
}
|
AST#method_declaration#Left static transitionFromUp AST#parameter_list#Left ( AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 200 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TransitionEffect AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TransitionEffect AST#expression#Right . asymmetric AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TransitionEffect AST#expression#Right . OPACITY AST#member_expression#Right AST#expression#Right . animation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left duration AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . combine AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TransitionEffect AST#expression#Right . move AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left TransitionEdge AST#expression#Right . TOP AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . animation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left duration AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TransitionEffect AST#expression#Right . OPACITY AST#member_expression#Right AST#expression#Right . animation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left duration AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left duration AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . combine AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TransitionEffect AST#expression#Right . move AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left TransitionEdge AST#expression#Right . TOP AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . animation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left duration AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static transitionFromUp(duration: number = 200): TransitionEffect {
return TransitionEffect.asymmetric(
TransitionEffect.OPACITY.animation({ duration: duration }).combine(
TransitionEffect.move(TransitionEdge.TOP).animation({ duration: duration })),
TransitionEffect.OPACITY.animation({ delay: duration, duration: duration }).combine(
TransitionEffect.move(TransitionEdge.TOP).animation({ duration: duration }))
)
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/encapsulationdialog/src/main/ets/dialog/util/AnimationUtil.ets#L22-L29
|
05e9794fdd093e852c3a30e62585f5c792fbd701
|
gitee
|
harmonyos/samples
|
f5d967efaa7666550ee3252d118c3c73a77686f5
|
ETSUI/CategoryListSample/entry/src/main/ets/common/bean/ListItemData.ets
|
arkts
|
List item data.
|
export class ListItemData {
/**
* List item title.
*/
title: Resource;
/**
* Summary.
*/
summary: Resource;
/**
* Arrow image.
*/
imageArrow: Resource;
}
|
AST#export_declaration#Left export AST#class_declaration#Left class ListItemData AST#class_body#Left { /**
* List item title.
*/ AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Summary.
*/ AST#property_declaration#Left summary : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Arrow image.
*/ AST#property_declaration#Left imageArrow : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class ListItemData {
title: Resource;
summary: Resource;
imageArrow: Resource;
}
|
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/CategoryListSample/entry/src/main/ets/common/bean/ListItemData.ets#L4-L19
|
f93153e0101e41b2e678b1c9bbc172a04a1e2753
|
gitee
|
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CFileDownloader.ets
|
arkts
|
downloadFile
|
下载文件
@param fileName - 文件名
@param proccessing - 进度回调,返回当前下载进度百分比
@param finished - 完成回调,返回文件URL、元数据信息或错误信息
|
public downloadFile(fileName: string, proccessing: (progress: number) => void, finished: (fileUrl: string | null, metaInfo: CMetaInfo | null, error: string | null) => void): void {
// 校验文件名有效性
if (!fileName || fileName.trim().length === 0) {
finished(null, null, "文件名为空");
return;
}
// 检查网络连接
if (!NetWorkTool.checkInternetConnection()) {
finished(null, null, "网络不可用");
return;
}
// 从COS下载文件
this.downloadCFileFromCos(fileName, proccessing, finished);
}
|
AST#method_declaration#Left public downloadFile AST#parameter_list#Left ( AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left proccessing : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left progress : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left finished : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left fileUrl : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left metaInfo : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left CMetaInfo AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left error : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // 校验文件名有效性 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left fileName AST#expression#Right AST#unary_expression#Right AST#expression#Right || AST#expression#Left fileName AST#expression#Right AST#binary_expression#Right AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left finished ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left "文件名为空" AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right // 检查网络连接 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left NetWorkTool AST#expression#Right AST#unary_expression#Right AST#expression#Right . checkInternetConnection AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left finished ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left "网络不可用" AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right // 从COS下载文件 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . downloadCFileFromCos AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left fileName AST#expression#Right , AST#expression#Left proccessing AST#expression#Right , AST#expression#Left finished AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public downloadFile(fileName: string, proccessing: (progress: number) => void, finished: (fileUrl: string | null, metaInfo: CMetaInfo | null, error: string | null) => void): void {
if (!fileName || fileName.trim().length === 0) {
finished(null, null, "文件名为空");
return;
}
if (!NetWorkTool.checkInternetConnection()) {
finished(null, null, "网络不可用");
return;
}
this.downloadCFileFromCos(fileName, proccessing, finished);
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CFileDownloader.ets#L167-L182
|
8b26706a5b6230535b9f0ce07223dc398f1d2b6a
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_dialog/src/main/ets/dialog/ActionParameter.ets
|
arkts
|
initToastDefault
|
初始化ToastOptions参数
@param options
|
static initToastDefault(options: ToastOptions, type: number = 0) {
if (type == 2) {
options.duration = options.duration ?? ActionParameter.config.toast_durationLong;
} else if (type == 1) {
options.duration = options.duration ?? ActionParameter.config.toast_durationShort;
} else {
options.duration = options.duration ?? ActionParameter.config.toast_duration;
}
options.uiContext = options.uiContext ?? DialogHelper.getMainUIContext();
options.fontColor = options.fontColor ?? ActionParameter.config.toast_fontColor; //文字颜色。
options.backgroundColor = options.backgroundColor ?? ActionParameter.config.toast_backgroundColor; //背景颜色,建议八位色值前两位为透明度。
options.backgroundBlurStyle = options.backgroundBlurStyle ?? ActionParameter.config.toast_backgroundBlurStyle; //文本提示框背板模糊材质。默认值:BlurStyle.NON。说明:设置为BlurStyle.NONE即可关闭背景虚化。当设置了backgroundBlurStyle为非NONE值时,则不要设置backgroundColor,否则颜色显示将不符合预期效果。。
options.shadow = options.shadow ?? ShadowStyle.OUTER_DEFAULT_MD; //文本提示框背板阴影。默认值:ShadowStyle.OUTER_DEFAULT_MD
options.showMode = options.showMode ?? promptAction.ToastShowMode.DEFAULT; //设置弹窗是否显示在应用之上。默认值:ToastShowMode.DEFAULT,默认显示在应用内。
options.bottom = options.bottom ?? "80vp"; //设置弹窗底部边框距离导航条的高度,ToastShowMode.TOP_MOST模式下,软键盘拉起时,如果bottom值过小,toast要被软键盘遮挡时,会自动避让至距离软键盘80vp处。ToastShowMode.DEFAULT模式下,软键盘拉起时,会上移软键盘的高度。默认值:80vp。说明:当底部没有导航条时,bottom为设置弹窗底部边框距离窗口底部的高度。设置对齐方式alignment后,bottom不生效。
options.offset = options.offset ?? { dx: 0, dy: 0 }; //在对齐方式上的偏移。默认值:{ dx: 0, dy: 0 },默认没有偏移。说明: 只支持设置px类型的数值,如需设置vp,可以将vp改成px传入。
if (ActionParameter.config.toast_alignment) {
options.alignment = options.alignment ?? ActionParameter.config.toast_alignment; //对齐方式。
} else {
options.alignment = options.alignment ?? Helper.getAlignment(ActionParameter.config.alignment); //对齐方式。默认值:undefined,默认底部偏上位置。
}
options.enableHoverMode = options.enableHoverMode ?? ActionParameter.config.enableHoverMode; //是否响应悬停态。默认值:false,默认不响应。<API14+>
options.hoverModeArea = options.hoverModeArea ?? ActionParameter.config.hoverModeArea; //设置悬停态下弹窗的默认展示区域。默认值:HoverModeAreaType.BOTTOM_SCREEN。<API14+>
}
|
AST#method_declaration#Left static initToastDefault AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ToastOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right == AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . duration AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . duration AST#member_expression#Right AST#expression#Right ?? AST#expression#Left ActionParameter AST#expression#Right AST#binary_expression#Right AST#expression#Right . config AST#member_expression#Right AST#expression#Right . toast_durationLong AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right == AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . duration AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . duration AST#member_expression#Right AST#expression#Right ?? AST#expression#Left ActionParameter AST#expression#Right AST#binary_expression#Right AST#expression#Right . config AST#member_expression#Right AST#expression#Right . toast_durationShort AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . duration AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . duration AST#member_expression#Right AST#expression#Right ?? AST#expression#Left ActionParameter AST#expression#Right AST#binary_expression#Right AST#expression#Right . config AST#member_expression#Right AST#expression#Right . toast_duration AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . uiContext AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . uiContext AST#member_expression#Right AST#expression#Right ?? AST#expression#Left DialogHelper AST#expression#Right AST#binary_expression#Right AST#expression#Right . getMainUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . fontColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . fontColor AST#member_expression#Right AST#expression#Right ?? AST#expression#Left ActionParameter AST#expression#Right AST#binary_expression#Right AST#expression#Right . config AST#member_expression#Right AST#expression#Right . toast_fontColor AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right //文字颜色。 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . backgroundColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . backgroundColor AST#member_expression#Right AST#expression#Right ?? AST#expression#Left ActionParameter AST#expression#Right AST#binary_expression#Right AST#expression#Right . config AST#member_expression#Right AST#expression#Right . toast_backgroundColor AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right //背景颜色,建议八位色值前两位为透明度。 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . backgroundBlurStyle AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . backgroundBlurStyle AST#member_expression#Right AST#expression#Right ?? AST#expression#Left ActionParameter AST#expression#Right AST#binary_expression#Right AST#expression#Right . config AST#member_expression#Right AST#expression#Right . toast_backgroundBlurStyle AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right //文本提示框背板模糊材质。默认值:BlurStyle.NON。说明:设置为BlurStyle.NONE即可关闭背景虚化。当设置了backgroundBlurStyle为非NONE值时,则不要设置backgroundColor,否则颜色显示将不符合预期效果。。 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . shadow AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . shadow AST#member_expression#Right AST#expression#Right ?? AST#expression#Left ShadowStyle AST#expression#Right AST#binary_expression#Right AST#expression#Right . OUTER_DEFAULT_MD AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right //文本提示框背板阴影。默认值:ShadowStyle.OUTER_DEFAULT_MD AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . showMode AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . showMode AST#member_expression#Right AST#expression#Right ?? AST#expression#Left promptAction AST#expression#Right AST#binary_expression#Right AST#expression#Right . ToastShowMode AST#member_expression#Right AST#expression#Right . DEFAULT AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right //设置弹窗是否显示在应用之上。默认值:ToastShowMode.DEFAULT,默认显示在应用内。 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . bottom AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . bottom AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "80vp" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right //设置弹窗底部边框距离导航条的高度,ToastShowMode.TOP_MOST模式下,软键盘拉起时,如果bottom值过小,toast要被软键盘遮挡时,会自动避让至距离软键盘80vp处。ToastShowMode.DEFAULT模式下,软键盘拉起时,会上移软键盘的高度。默认值:80vp。说明:当底部没有导航条时,bottom为设置弹窗底部边框距离窗口底部的高度。设置对齐方式alignment后,bottom不生效。 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . offset AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . offset AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left dx AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left dy AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right //在对齐方式上的偏移。默认值:{ dx: 0, dy: 0 },默认没有偏移。说明: 只支持设置px类型的数值,如需设置vp,可以将vp改成px传入。 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ActionParameter AST#expression#Right . config AST#member_expression#Right AST#expression#Right . toast_alignment AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . alignment AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . alignment AST#member_expression#Right AST#expression#Right ?? AST#expression#Left ActionParameter AST#expression#Right AST#binary_expression#Right AST#expression#Right . config AST#member_expression#Right AST#expression#Right . toast_alignment AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right //对齐方式。 } else { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . alignment AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . alignment AST#member_expression#Right AST#expression#Right ?? AST#expression#Left Helper AST#expression#Right AST#binary_expression#Right AST#expression#Right . getAlignment AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ActionParameter AST#expression#Right . config AST#member_expression#Right AST#expression#Right . alignment AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right //对齐方式。默认值:undefined,默认底部偏上位置。 } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . enableHoverMode AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . enableHoverMode AST#member_expression#Right AST#expression#Right ?? AST#expression#Left ActionParameter AST#expression#Right AST#binary_expression#Right AST#expression#Right . config AST#member_expression#Right AST#expression#Right . enableHoverMode AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right //是否响应悬停态。默认值:false,默认不响应。<API14+> AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . hoverModeArea AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . hoverModeArea AST#member_expression#Right AST#expression#Right ?? AST#expression#Left ActionParameter AST#expression#Right AST#binary_expression#Right AST#expression#Right . config AST#member_expression#Right AST#expression#Right . hoverModeArea AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right //设置悬停态下弹窗的默认展示区域。默认值:HoverModeAreaType.BOTTOM_SCREEN。<API14+> } AST#builder_function_body#Right AST#method_declaration#Right
|
static initToastDefault(options: ToastOptions, type: number = 0) {
if (type == 2) {
options.duration = options.duration ?? ActionParameter.config.toast_durationLong;
} else if (type == 1) {
options.duration = options.duration ?? ActionParameter.config.toast_durationShort;
} else {
options.duration = options.duration ?? ActionParameter.config.toast_duration;
}
options.uiContext = options.uiContext ?? DialogHelper.getMainUIContext();
options.fontColor = options.fontColor ?? ActionParameter.config.toast_fontColor;
options.backgroundColor = options.backgroundColor ?? ActionParameter.config.toast_backgroundColor;
options.backgroundBlurStyle = options.backgroundBlurStyle ?? ActionParameter.config.toast_backgroundBlurStyle;
options.shadow = options.shadow ?? ShadowStyle.OUTER_DEFAULT_MD;
options.showMode = options.showMode ?? promptAction.ToastShowMode.DEFAULT;
options.bottom = options.bottom ?? "80vp";
options.offset = options.offset ?? { dx: 0, dy: 0 };
if (ActionParameter.config.toast_alignment) {
options.alignment = options.alignment ?? ActionParameter.config.toast_alignment;
} else {
options.alignment = options.alignment ?? Helper.getAlignment(ActionParameter.config.alignment); 默认值:undefined,默认底部偏上位置。
}
options.enableHoverMode = options.enableHoverMode ?? ActionParameter.config.enableHoverMode;
options.hoverModeArea = options.hoverModeArea ?? ActionParameter.config.hoverModeArea;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/ActionParameter.ets#L644-L667
|
22fb8d53f77b6c9e4f6b2bee839282cbf9a6ea8e
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/DateUtil.ets
|
arkts
|
isSameDay
|
判断是否是同一天
|
static isSameDay(date1: number | string | Date, date2: number | string | Date) {
date1 = DateUtil.getFormatDate(date1);
date2 = DateUtil.getFormatDate(date2);
let blSameYear = date1.getFullYear() === date2.getFullYear();
let blSameMonth = date1.getMonth() === date2.getMonth();
let blSameDay = date1.getDate() === date2.getDate();
return blSameYear && blSameMonth && blSameDay;
}
|
AST#method_declaration#Left static isSameDay AST#parameter_list#Left ( AST#parameter#Left date1 : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left date2 : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left date1 = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateUtil AST#expression#Right . getFormatDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left date1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left date2 = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateUtil AST#expression#Right . getFormatDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left date2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left blSameYear = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date1 AST#expression#Right . getFullYear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right === AST#expression#Left date2 AST#expression#Right AST#binary_expression#Right AST#expression#Right . getFullYear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left blSameMonth = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date1 AST#expression#Right . getMonth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right === AST#expression#Left date2 AST#expression#Right AST#binary_expression#Right AST#expression#Right . getMonth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left blSameDay = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date1 AST#expression#Right . getDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right === AST#expression#Left date2 AST#expression#Right AST#binary_expression#Right AST#expression#Right . getDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left blSameYear AST#expression#Right && AST#expression#Left blSameMonth AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left blSameDay AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
static isSameDay(date1: number | string | Date, date2: number | string | Date) {
date1 = DateUtil.getFormatDate(date1);
date2 = DateUtil.getFormatDate(date2);
let blSameYear = date1.getFullYear() === date2.getFullYear();
let blSameMonth = date1.getMonth() === date2.getMonth();
let blSameDay = date1.getDate() === date2.getDate();
return blSameYear && blSameMonth && blSameDay;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L214-L221
|
63280155ed709b64f21a53ef2ec1d09cd1f74327
|
gitee
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/main/src/main/ets/view/MePage.ets
|
arkts
|
isLoggedIn
|
是否已登录
@returns {boolean} 是否登录
|
private isLoggedIn(): boolean {
return this.userState.isLoggedIn();
}
|
AST#method_declaration#Left private isLoggedIn AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userState AST#member_expression#Right AST#expression#Right . isLoggedIn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private isLoggedIn(): boolean {
return this.userState.isLoggedIn();
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/MePage.ets#L214-L216
|
3f662f60976230ba955854ffce6d27dde783922e
|
github
|
openharmony-sig/knowledge_demo_smart_home
|
6cdf5d81ef84217f386c4200bfc4124a0ded5a0d
|
FA/DistScheduleEts/entry/src/main/ets/addDevice/utils/base64Util.ets
|
arkts
|
base64encode
|
base64编码
@param {Object} str
|
static base64encode(str){
var out, i, len;
var c1, c2, c3;
len = str.length;
i = 0;
out = "";
while (i < len) {
c1 = str.charCodeAt(i++) & 0xff;
if (i == len) {
out += this.base64EncodeChars.charAt(c1 >> 2);
out += this.base64EncodeChars.charAt((c1 & 0x3) << 4);
out += "==";
break;
}
c2 = str.charCodeAt(i++);
if (i == len) {
out += this.base64EncodeChars.charAt(c1 >> 2);
out += this.base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
out += this.base64EncodeChars.charAt((c2 & 0xF) << 2);
out += "=";
break;
}
c3 = str.charCodeAt(i++);
out += this.base64EncodeChars.charAt(c1 >> 2);
out += this.base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
out += this.base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
out += this.base64EncodeChars.charAt(c3 & 0x3F);
}
return out;
}
|
AST#method_declaration#Left static base64encode AST#parameter_list#Left ( AST#parameter#Left str AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left var AST#variable_declarator#Left out AST#variable_declarator#Right , AST#variable_declarator#Left i AST#variable_declarator#Right , AST#variable_declarator#Left len AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left var AST#variable_declarator#Left c1 AST#variable_declarator#Right , AST#variable_declarator#Left c2 AST#variable_declarator#Right , AST#variable_declarator#Left c3 AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left len = AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left i = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left out = AST#expression#Left "" AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#while_statement#Left while ( AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left len AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left c1 = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . charCodeAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right & AST#expression#Left 0xff AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right == AST#expression#Left len AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left out += AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . base64EncodeChars AST#member_expression#Right AST#expression#Right . charAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left c1 AST#expression#Right >> AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left out += AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . base64EncodeChars AST#member_expression#Right AST#expression#Right . charAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left c1 AST#expression#Right & AST#expression#Left 0x3 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right << AST#expression#Left 4 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left out += AST#expression#Left "==" AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#break_statement#Left break ; AST#break_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left c2 = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . charCodeAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right == AST#expression#Left len AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left out += AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . base64EncodeChars AST#member_expression#Right AST#expression#Right . charAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left c1 AST#expression#Right >> AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left out += AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . base64EncodeChars AST#member_expression#Right AST#expression#Right . charAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left c1 AST#expression#Right & AST#expression#Left 0x3 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right << AST#expression#Left 4 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right | AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left c2 AST#expression#Right & AST#expression#Left 0xF0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right >> AST#expression#Left 4 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left out += AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . base64EncodeChars AST#member_expression#Right AST#expression#Right . charAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left c2 AST#expression#Right & AST#expression#Left 0xF AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right << AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left out += AST#expression#Left "=" AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#break_statement#Left break ; AST#break_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left c3 = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . charCodeAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left out += AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . base64EncodeChars AST#member_expression#Right AST#expression#Right . charAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left c1 AST#expression#Right >> AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left out += AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . base64EncodeChars AST#member_expression#Right AST#expression#Right . charAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left c1 AST#expression#Right & AST#expression#Left 0x3 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right << AST#expression#Left 4 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right | AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left c2 AST#expression#Right & AST#expression#Left 0xF0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right >> AST#expression#Left 4 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left out += AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . base64EncodeChars AST#member_expression#Right AST#expression#Right . charAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left c2 AST#expression#Right & AST#expression#Left 0xF AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right << AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right | AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left c3 AST#expression#Right & AST#expression#Left 0xC0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right >> AST#expression#Left 6 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left out += AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . base64EncodeChars AST#member_expression#Right AST#expression#Right . charAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left c3 AST#expression#Right & AST#expression#Left 0x3F AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#while_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left out AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static base64encode(str){
var out, i, len;
var c1, c2, c3;
len = str.length;
i = 0;
out = "";
while (i < len) {
c1 = str.charCodeAt(i++) & 0xff;
if (i == len) {
out += this.base64EncodeChars.charAt(c1 >> 2);
out += this.base64EncodeChars.charAt((c1 & 0x3) << 4);
out += "==";
break;
}
c2 = str.charCodeAt(i++);
if (i == len) {
out += this.base64EncodeChars.charAt(c1 >> 2);
out += this.base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
out += this.base64EncodeChars.charAt((c2 & 0xF) << 2);
out += "=";
break;
}
c3 = str.charCodeAt(i++);
out += this.base64EncodeChars.charAt(c1 >> 2);
out += this.base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
out += this.base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
out += this.base64EncodeChars.charAt(c3 & 0x3F);
}
return out;
}
|
https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/addDevice/utils/base64Util.ets#L28-L57
|
1df74a5d0782ee474eb0fad466c74570e4c65834
|
gitee
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/processes/extension_actions.ets
|
arkts
|
Selects and installs a zip or crx.
@returns True if success, false if failed, undefined for a duplicated id.
|
export function select_install_extension(uiContext: UIContext) {
return document_pick_to_uri(['zip', 'crx']).then(async (result) => {
if (!result) {
// storage.set('universal_fail_prompt_desc_gateway', $r('app.string.Fail_select_bad_file'));
return false;
}
console.log(`[select_install_extension] ${result}`);
let path = uri_2_path(result);
let id = extension_id_for_path(path);
// Same ID, block
let block = sandbox_access('extensions/' + id + '/');
if (block) {
return undefined;
}
// Copy
let uri_zip_crx = copy_from_uri_to_sandbox_temp_with_timestamp(result, 'extensions');
// sandbox_mkdir_sync('extensions/' + id);
sandbox_mkdir_sync('extensions/' + id + '/meow');
// Decompress
let inFile = uri_2_path(uri_zip_crx);
let outFileDirBase = meowContext().filesDir + '/extensions/' + id;
let outFileDir = outFileDirBase + '/meow';
console.log(`[select_install_extension] Decompress from ${inFile}, to ${outFileDir}`);
let options: zlib.Options = {
level: zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION,
// parallel: zlib.ParallelStrategy.PARALLEL_STRATEGY_PARALLEL_DECOMPRESSION
};
try {
return zlib.decompressFile(inFile, outFileDir, options).then(() => {
let files = fileIo.listFileSync(outFileDir);
console.log(`[Extension] listFileSync: ${files}`);
if (files.length > 1) {
// It's OK
} else {
// The zip file includes another layer of folder!
try {
fileIo.moveDirSync(outFileDir + '/' + files[0], outFileDirBase);
sandbox_rmdir_sync('extensions/' + id + '/meow');
} catch (e) {
console.error(`[Extension] Reduce layer failed! from ${outFileDir + '/' + files[0]} to ${outFileDirBase}: ` + e);
}
}
// Update extensions
let result = try_add_extension_to_bunch(id, undefined, undefined, uiContext);
if (!result) {
sandbox_rmdir_sync('extensions/' + id);
console.error(`[Extension] Try add extension failed! Deleting directory [${'extensions/' + id}]!`);
return false;
}
let extensions_ids = AppStorage.get('extensions_ids') as string[];
extensions_ids.push(id);
return true;
})
} catch (e) {
console.error('[Extension][select_install_extension][decompressFile] zip error: ' + e);
return false;
}
})
}
|
AST#export_declaration#Left export AST#function_declaration#Left function select_install_extension AST#parameter_list#Left ( AST#parameter#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left document_pick_to_uri AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left 'zip' AST#expression#Right , AST#expression#Left 'crx' AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left async AST#parameter_list#Left ( AST#parameter#Left result AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left result AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { // storage.set('universal_fail_prompt_desc_gateway', $r('app.string.Fail_select_bad_file')); AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [select_install_extension] AST#template_substitution#Left $ { AST#expression#Left result AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left path = AST#expression#Left AST#call_expression#Left AST#expression#Left uri_2_path AST#expression#Right AST#argument_list#Left ( AST#expression#Left result AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left id = AST#expression#Left AST#call_expression#Left AST#expression#Left extension_id_for_path AST#expression#Right AST#argument_list#Left ( AST#expression#Left path AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // Same ID, block AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left block = AST#expression#Left AST#call_expression#Left AST#expression#Left sandbox_access AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'extensions/' AST#expression#Right + AST#expression#Left id AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left '/' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left block AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left undefined AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // Copy AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left uri_zip_crx = AST#expression#Left AST#call_expression#Left AST#expression#Left copy_from_uri_to_sandbox_temp_with_timestamp AST#expression#Right AST#argument_list#Left ( AST#expression#Left result AST#expression#Right , AST#expression#Left 'extensions' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // sandbox_mkdir_sync('extensions/' + id); AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left sandbox_mkdir_sync AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'extensions/' AST#expression#Right + AST#expression#Left id AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left '/meow' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Decompress AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left inFile = AST#expression#Left AST#call_expression#Left AST#expression#Left uri_2_path AST#expression#Right AST#argument_list#Left ( AST#expression#Left uri_zip_crx AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left outFileDirBase = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left meowContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . filesDir AST#member_expression#Right AST#expression#Right + AST#expression#Left '/extensions/' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left id AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left outFileDir = AST#expression#Left AST#binary_expression#Left AST#expression#Left outFileDirBase AST#expression#Right + AST#expression#Left '/meow' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [select_install_extension] Decompress from AST#template_substitution#Left $ { AST#expression#Left inFile AST#expression#Right } AST#template_substitution#Right , to AST#template_substitution#Left $ { AST#expression#Left outFileDir AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left options : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left zlib . Options AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left level AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left zlib AST#expression#Right . CompressLevel AST#member_expression#Right AST#expression#Right . COMPRESS_LEVEL_DEFAULT_COMPRESSION AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // parallel: zlib.ParallelStrategy.PARALLEL_STRATEGY_PARALLEL_DECOMPRESSION } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left zlib AST#expression#Right . decompressFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left inFile AST#expression#Right , AST#expression#Left outFileDir AST#expression#Right , AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left files = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileIo AST#expression#Right . listFileSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left outFileDir AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [Extension] listFileSync: AST#template_substitution#Left $ { AST#expression#Left files AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left files AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // It's OK } AST#block_statement#Right else AST#block_statement#Left { // The zip file includes another layer of folder! AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileIo AST#expression#Right . moveDirSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left outFileDir AST#expression#Right + AST#expression#Left '/' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left AST#subscript_expression#Left AST#expression#Left files AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left outFileDirBase AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left sandbox_rmdir_sync AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'extensions/' AST#expression#Right + AST#expression#Left id AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left '/meow' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#template_literal#Left ` [Extension] Reduce layer failed! from AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left outFileDir AST#expression#Right + AST#expression#Left '/' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left AST#subscript_expression#Left AST#expression#Left files AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right } AST#template_substitution#Right to AST#template_substitution#Left $ { AST#expression#Left outFileDirBase AST#expression#Right } AST#template_substitution#Right : ` AST#template_literal#Right AST#expression#Right + AST#expression#Left e AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // Update extensions AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result = AST#expression#Left AST#call_expression#Left AST#expression#Left try_add_extension_to_bunch AST#expression#Right AST#argument_list#Left ( AST#expression#Left id AST#expression#Right , AST#expression#Left undefined AST#expression#Right , AST#expression#Left undefined AST#expression#Right , AST#expression#Left uiContext AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left result AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left sandbox_rmdir_sync AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left 'extensions/' AST#expression#Right + AST#expression#Left id AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [Extension] Try add extension failed! Deleting directory [ AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left 'extensions/' AST#expression#Right + AST#expression#Left id AST#expression#Right AST#binary_expression#Right AST#expression#Right } AST#template_substitution#Right ]! ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left extensions_ids = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'extensions_ids' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extensions_ids AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left id AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left '[Extension][select_install_extension][decompressFile] zip error: ' AST#expression#Right + AST#expression#Left e AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function select_install_extension(uiContext: UIContext) {
return document_pick_to_uri(['zip', 'crx']).then(async (result) => {
if (!result) {
return false;
}
console.log(`[select_install_extension] ${result}`);
let path = uri_2_path(result);
let id = extension_id_for_path(path);
let block = sandbox_access('extensions/' + id + '/');
if (block) {
return undefined;
}
let uri_zip_crx = copy_from_uri_to_sandbox_temp_with_timestamp(result, 'extensions');
sandbox_mkdir_sync('extensions/' + id + '/meow');
let inFile = uri_2_path(uri_zip_crx);
let outFileDirBase = meowContext().filesDir + '/extensions/' + id;
let outFileDir = outFileDirBase + '/meow';
console.log(`[select_install_extension] Decompress from ${inFile}, to ${outFileDir}`);
let options: zlib.Options = {
level: zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION,
};
try {
return zlib.decompressFile(inFile, outFileDir, options).then(() => {
let files = fileIo.listFileSync(outFileDir);
console.log(`[Extension] listFileSync: ${files}`);
if (files.length > 1) {
} else {
try {
fileIo.moveDirSync(outFileDir + '/' + files[0], outFileDirBase);
sandbox_rmdir_sync('extensions/' + id + '/meow');
} catch (e) {
console.error(`[Extension] Reduce layer failed! from ${outFileDir + '/' + files[0]} to ${outFileDirBase}: ` + e);
}
}
let result = try_add_extension_to_bunch(id, undefined, undefined, uiContext);
if (!result) {
sandbox_rmdir_sync('extensions/' + id);
console.error(`[Extension] Try add extension failed! Deleting directory [${'extensions/' + id}]!`);
return false;
}
let extensions_ids = AppStorage.get('extensions_ids') as string[];
extensions_ids.push(id);
return true;
})
} catch (e) {
console.error('[Extension][select_install_extension][decompressFile] zip error: ' + e);
return false;
}
})
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/extension_actions.ets#L86-L150
|
b1ad149677798d0f9033835dfeff678026d0056c
|
gitee
|
|
zl3624/harmonyos_network_samples
|
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
|
code/http/SimulateLogin/entry/src/main/ets/pages/Index.ets
|
arkts
|
login
|
模拟登录
|
login() {
//http请求对象
let httpRequest = http.createHttp();
//请求的登录名和密码参数
let params = "username=" + this.loginName + "&password=" + this.passwd
let opt: http.HttpRequestOptions = {
method: http.RequestMethod.POST,
extraData: params,
header: {'Content-Type': 'application/x-www-form-urlencoded' },
expectDataType: http.HttpDataType.STRING
}
httpRequest.request(this.loginUrl, opt)
.then((resp) => {
this.msgHistory += "响应码:" + resp.responseCode + "\r\n"
this.msgHistory += resp.result + "\r\n"
})
.catch((e) => {
this.msgHistory += "请求失败:" + e.message + "\r\n"
})
}
|
AST#method_declaration#Left login AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //http请求对象 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left httpRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . createHttp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //请求的登录名和密码参数 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left params = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "username=" AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . loginName AST#member_expression#Right AST#expression#Right + AST#expression#Left "&password=" AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . passwd AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left opt : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left http . HttpRequestOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left method AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . RequestMethod AST#member_expression#Right AST#expression#Right . POST AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left extraData AST#property_name#Right : AST#expression#Left params AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left header AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'Content-Type' AST#property_name#Right : AST#expression#Left 'application/x-www-form-urlencoded' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left expectDataType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . HttpDataType AST#member_expression#Right AST#expression#Right . STRING AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#ERROR#Left httpRequest AST#ERROR#Right . request AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loginUrl AST#member_expression#Right AST#expression#Right , AST#expression#Left opt AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left resp AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . msgHistory AST#member_expression#Right += AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "响应码:" AST#expression#Right + AST#expression#Left resp AST#expression#Right AST#binary_expression#Right AST#expression#Right . responseCode AST#member_expression#Right AST#expression#Right + AST#expression#Left "\r\n" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . msgHistory AST#member_expression#Right += AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resp AST#expression#Right . result AST#member_expression#Right AST#expression#Right + AST#expression#Left "\r\n" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left e AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . msgHistory AST#member_expression#Right += AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "请求失败:" AST#expression#Right + AST#expression#Left e AST#expression#Right AST#binary_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right + AST#expression#Left "\r\n" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
login() {
let httpRequest = http.createHttp();
let params = "username=" + this.loginName + "&password=" + this.passwd
let opt: http.HttpRequestOptions = {
method: http.RequestMethod.POST,
extraData: params,
header: {'Content-Type': 'application/x-www-form-urlencoded' },
expectDataType: http.HttpDataType.STRING
}
httpRequest.request(this.loginUrl, opt)
.then((resp) => {
this.msgHistory += "响应码:" + resp.responseCode + "\r\n"
this.msgHistory += resp.result + "\r\n"
})
.catch((e) => {
this.msgHistory += "请求失败:" + e.message + "\r\n"
})
}
|
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/SimulateLogin/entry/src/main/ets/pages/Index.ets#L146-L167
|
fd5b930bd5ba85f616053707e26fd0eb6fc93c14
|
gitee
|
wangjinyuan/JS-TS-ArkTS-database.git
|
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
|
npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/TypingStart.ets
|
arkts
|
get
|
应用约束:1. 强制使用静态类型
|
get elapsedTime(): number {
return Date.now() - this.since.getTime();
}
|
AST#method_declaration#Left get AST#ERROR#Left elapsedTime AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . since AST#member_expression#Right AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
get elapsedTime(): number {
return Date.now() - this.since.getTime();
}
|
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/TypingStart.ets#L71-L73
|
210267a81de02250a121208ced57f7fc48999307
|
github
|
2763981847/Accounting-app.git
|
cf8302a42588ecce1561b82e8533798157157257
|
entry/src/main/ets/pages/StatisticPage.ets
|
arkts
|
StatisticPage
|
使用@Link和@State修饰符管理组件的数据和状态
|
@Component
export default struct StatisticPage {
@Link @Watch('refreshClassifiedStatistics') accounts: Array<Account>;
// 由于@State修饰Date类型可能出错,因此这里存储的是时间戳
@State @Watch('refreshClassifiedStatistics') endDate: number = getEndOfTheDay(new Date()).getTime();
@State @Watch('refreshClassifiedStatistics') beginDate: number = getFirstDateOfThisMonth(this.endDate).getTime();
@State @Watch('refreshClassifiedStatistics') accountType: number = 0;
@State classifiedStatistics: Array<ClassifiedStatistic> = statisticByType(this.accounts, this.accountType, this.beginDate, this.endDate);
@State totalAmount: number = this.classifiedStatistics.map(classifiedStatistic => classifiedStatistic.amount)
.reduce((total, cur) => total + cur, 0);
@State ratios: Array<number> = getRatios(this.classifiedStatistics);
private scroller: Scroller = new Scroller();
// 刷新分类统计信息
private refreshClassifiedStatistics() {
this.classifiedStatistics = statisticByType(this.accounts, this.accountType, this.beginDate, this.endDate);
this.totalAmount = this.classifiedStatistics
.map(classifiedStatistic => classifiedStatistic.amount)
.reduce((total, cur) => total + cur, 0);
this.ratios = getRatios(this.classifiedStatistics);
}
// 渲染页面
build() {
Scroll(this.scroller) {
Column({ space: CommonConstants.SPACE_M }) {
Column() {
// 日期选择组件
DateSelectComponent({
beginDate: $beginDate,
endDate: $endDate,
selectedIndex: 0
}).width(CommonConstants.EIGHTY_PERCENT);
Row() {
Stack() {
// 数据面板
DataPanel({
values: this.classifiedStatistics.map(classifiedStatistic => classifiedStatistic.amount),
max: 0
})
.aspectRatio(1);
Column({ space: CommonConstants.SPACE_S }) {
// 总支出/收入文本
Text('总' + (this.accountType === 0 ? '支出' : '收入'))
.fontColor($r('app.color.gray'))
.fontSize($r('app.float.font_size_M'));
// 总金额文本
Text(this.totalAmount.toString())
.fontColor($r('app.color.black'))
.fontSize($r('app.float.font_size_MP'));
// 切换按钮
Image($r('app.media.switch'))
.width($r('app.float.component_size_SM'))
.onClick(() => this.accountType = this.accountType === 0 ? 1 : 0);
}.justifyContent(FlexAlign.Center);
}.width('70%')
.aspectRatio(1);
// 列表展示分类统计信息
List({ space: CommonConstants.SPACE_S }) {
ForEach(this.classifiedStatistics, (classifiedStatistic: ClassifiedStatistic, index: number) => {
ListItem() {
Row({ space: CommonConstants.SPACE_S }) {
// 分类面板
Text().backgroundColor(panelColors[index])
.aspectRatio(1)
.height($r('app.float.component_size_S'))
.borderRadius($r('app.float.radius_size_S'));
// 分类类型文本
Text(classifiedStatistic.typeText)
.fontColor(panelColors[index])
.fontSize($r('app.float.font_size_S'));
}
}
});
}.width('25%');
}.justifyContent(FlexAlign.SpaceBetween)
.alignItems(VerticalAlign.Center)
.width(CommonConstants.FULL_WIDTH);
}
.justifyContent(FlexAlign.Center)
.padding($r('app.float.edge_size_M'))
.width(CommonConstants.FULL_WIDTH)
.borderRadius($r('app.float.radius_size_L'))
.backgroundColor(Color.White);
Column({ space: CommonConstants.SPACE_M }) {
// 类别/比例标题行
Row() {
Text('类别/比例')
.fontColor($r('app.color.gray'))
.fontSize($r('app.float.font_size_M'));
Text('金额')
.fontColor($r('app.color.gray'))
.fontSize($r('app.float.font_size_M'));
}.justifyContent(FlexAlign.SpaceBetween)
.width(CommonConstants.FULL_WIDTH);
// 列表展示详细分类统计信息
List({ space: CommonConstants.SPACE_S }) {
ForEach(this.classifiedStatistics, (classifiedStatistic: ClassifiedStatistic, index: number) => {
ListItem() {
Row() {
// 排名文本
Text((index + 1).toString())
.fontSize($r('app.float.font_size_MP'))
.fontColor($r('app.color.gray'))
.margin({ right: $r('app.float.edge_size_M') });
// 分类图标
Image(ImageList[classifiedStatistic.typeText])
.width($r('app.float.component_size_M'))
.aspectRatio(CommonConstants.FULL_SIZE)
.margin({ right: $r('app.float.edge_size_MP') });
Column() {
// 分类类型文本
Text(classifiedStatistic.typeText)
.height($r('app.float.component_size_SM'))
.fontSize($r('app.float.font_size_M'));
// 笔数文本
Text(classifiedStatistic.count + '笔')
.fontSize($r('app.float.font_size_S'))
.fontColor($r('app.color.gray'));
}.alignItems(HorizontalAlign.Start)
.margin({ right: $r('app.float.edge_size_M') });
// 比例文本
Text('/' + (this.ratios[index] * 100).toFixed(2) + '%').height($r('app.float.component_size_SM'))
.fontSize($r('app.float.font_size_S'))
.fontColor($r('app.color.gray'));
// 占位
Blank()
.layoutWeight(1);
// 金额文本
Text(this.accountType === 0 ? '-' + classifiedStatistic.amount.toString() : '+' + classifiedStatistic.amount.toString())
.fontSize($r('app.float.font_size_M'))
.fontColor(this.accountType === 0 ? $r('app.color.pay_color') : $r('app.color.main_color'))
.align(Alignment.End)
.flexGrow(CommonConstants.FULL_SIZE);
}
.width(CommonConstants.FULL_WIDTH)
.padding({ left: $r('app.float.edge_size_M'), right: $r('app.float.edge_size_M') });
}
.width(CommonConstants.FULL_WIDTH)
.height($r('app.float.component_size_LM'));
});
}
.width(CommonConstants.FULL_WIDTH);
}
.width(CommonConstants.FULL_WIDTH)
.padding($r('app.float.edge_size_M'))
.borderRadius($r('app.float.radius_size_L'))
.backgroundColor(Color.White);
}
.width(CommonConstants.FULL_WIDTH)
}
// 整体布局设置
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.align(Alignment.Top)
.scrollBar(BarState.Off)
.backgroundColor($r('app.color.background_color'))
.padding({
left: $r('app.float.edge_size_M'),
right: $r('app.float.edge_size_M'),
top: $r('app.float.edge_size_M')
});
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct StatisticPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'refreshClassifiedStatistics' AST#expression#Right ) AST#decorator#Right accounts : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Account AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 由于@State修饰Date类型可能出错,因此这里存储的是时间戳 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'refreshClassifiedStatistics' AST#expression#Right ) AST#decorator#Right endDate : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left getEndOfTheDay AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'refreshClassifiedStatistics' AST#expression#Right ) AST#decorator#Right beginDate : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left getFirstDateOfThisMonth AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . endDate AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'refreshClassifiedStatistics' AST#expression#Right ) AST#decorator#Right accountType : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right classifiedStatistics : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ClassifiedStatistic AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left statisticByType AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . accounts AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . accountType AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . beginDate AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . endDate AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right totalAmount : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . classifiedStatistics AST#member_expression#Right AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left classifiedStatistic => AST#expression#Left AST#member_expression#Left AST#expression#Left classifiedStatistic AST#expression#Right . amount AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . reduce AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left total AST#parameter#Right , AST#parameter#Left cur AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#binary_expression#Left AST#expression#Left total AST#expression#Right + AST#expression#Left cur AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right ratios : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left getRatios AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . classifiedStatistics AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private scroller : AST#type_annotation#Left AST#primary_type#Left Scroller AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Scroller AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // 刷新分类统计信息 AST#method_declaration#Left private refreshClassifiedStatistics AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . classifiedStatistics AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left statisticByType AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . accounts AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . accountType AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . beginDate AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . endDate AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . totalAmount AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . classifiedStatistics AST#member_expression#Right AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left classifiedStatistic => AST#expression#Left AST#member_expression#Left AST#expression#Left classifiedStatistic AST#expression#Right . amount AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . reduce AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left total AST#parameter#Right , AST#parameter#Left cur AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#binary_expression#Left AST#expression#Left total AST#expression#Right + AST#expression#Left cur AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ratios AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left getRatios AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . classifiedStatistics AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right // 渲染页面 AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scroller AST#member_expression#Right AST#expression#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . SPACE_M AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 日期选择组件 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left DateSelectComponent ( AST#component_parameters#Left { AST#component_parameter#Left beginDate : AST#expression#Left $beginDate AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left endDate : AST#expression#Left $endDate AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left selectedIndex : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . EIGHTY_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { // 数据面板 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left DataPanel ( AST#component_parameters#Left { AST#component_parameter#Left values : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . classifiedStatistics AST#member_expression#Right AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left classifiedStatistic => AST#expression#Left AST#member_expression#Left AST#expression#Left classifiedStatistic AST#expression#Right . amount AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left max : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . aspectRatio ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . SPACE_S AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // 总支出/收入文本 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#binary_expression#Left AST#expression#Left '总' AST#expression#Right + AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . accountType AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '支出' AST#expression#Right : AST#expression#Left '收入' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.gray' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.font_size_M' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right // 总金额文本 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . totalAmount AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.black' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.font_size_MP' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right // 切换按钮 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.switch' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.component_size_SM' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . accountType AST#member_expression#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . accountType AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 1 AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '70%' AST#expression#Right ) AST#modifier_chain_expression#Left . aspectRatio ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right // 列表展示分类统计信息 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . SPACE_S AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . classifiedStatistics AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left classifiedStatistic : AST#type_annotation#Left AST#primary_type#Left ClassifiedStatistic AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . SPACE_S AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // 分类面板 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left panelColors AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . aspectRatio ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.component_size_S' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.radius_size_S' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right // 分类类型文本 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left classifiedStatistic AST#expression#Right . typeText AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left panelColors AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.font_size_S' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '25%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_WIDTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.edge_size_M' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_WIDTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.radius_size_L' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . SPACE_M AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // 类别/比例标题行 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '类别/比例' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.gray' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.font_size_M' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '金额' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.gray' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.font_size_M' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_WIDTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right // 列表展示详细分类统计信息 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . SPACE_S AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . classifiedStatistics AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left classifiedStatistic : AST#type_annotation#Left AST#primary_type#Left ClassifiedStatistic AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // 排名文本 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.font_size_MP' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.gray' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.edge_size_M' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right // 分类图标 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left ImageList AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left classifiedStatistic AST#expression#Right . typeText AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.component_size_M' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . aspectRatio ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_SIZE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.edge_size_MP' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 分类类型文本 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left classifiedStatistic AST#expression#Right . typeText AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.component_size_SM' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.font_size_M' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right // 笔数文本 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left classifiedStatistic AST#expression#Right . count AST#member_expression#Right AST#expression#Right + AST#expression#Left '笔' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.font_size_S' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.gray' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.edge_size_M' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right // 比例文本 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '/' AST#expression#Right + AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ratios AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right * AST#expression#Left 100 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . toFixed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left '%' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.component_size_SM' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.font_size_S' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.gray' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right // 占位 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Blank ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right // 金额文本 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . accountType AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '-' AST#expression#Right + AST#expression#Left classifiedStatistic AST#expression#Right AST#binary_expression#Right AST#expression#Right . amount AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left '+' AST#expression#Right + AST#expression#Left classifiedStatistic AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right . amount AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.font_size_M' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . accountType AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.pay_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.main_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . align ( AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . End AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . flexGrow ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_SIZE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_WIDTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.edge_size_M' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.edge_size_M' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_WIDTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.component_size_LM' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_WIDTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_WIDTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.edge_size_M' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.radius_size_L' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_WIDTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right // 整体布局设置 AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_WIDTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_HEIGHT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . align ( AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . Top AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Off AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.background_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.edge_size_M' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.edge_size_M' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.edge_size_M' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export default struct StatisticPage {
@Link @Watch('refreshClassifiedStatistics') accounts: Array<Account>;
@State @Watch('refreshClassifiedStatistics') endDate: number = getEndOfTheDay(new Date()).getTime();
@State @Watch('refreshClassifiedStatistics') beginDate: number = getFirstDateOfThisMonth(this.endDate).getTime();
@State @Watch('refreshClassifiedStatistics') accountType: number = 0;
@State classifiedStatistics: Array<ClassifiedStatistic> = statisticByType(this.accounts, this.accountType, this.beginDate, this.endDate);
@State totalAmount: number = this.classifiedStatistics.map(classifiedStatistic => classifiedStatistic.amount)
.reduce((total, cur) => total + cur, 0);
@State ratios: Array<number> = getRatios(this.classifiedStatistics);
private scroller: Scroller = new Scroller();
private refreshClassifiedStatistics() {
this.classifiedStatistics = statisticByType(this.accounts, this.accountType, this.beginDate, this.endDate);
this.totalAmount = this.classifiedStatistics
.map(classifiedStatistic => classifiedStatistic.amount)
.reduce((total, cur) => total + cur, 0);
this.ratios = getRatios(this.classifiedStatistics);
}
build() {
Scroll(this.scroller) {
Column({ space: CommonConstants.SPACE_M }) {
Column() {
DateSelectComponent({
beginDate: $beginDate,
endDate: $endDate,
selectedIndex: 0
}).width(CommonConstants.EIGHTY_PERCENT);
Row() {
Stack() {
DataPanel({
values: this.classifiedStatistics.map(classifiedStatistic => classifiedStatistic.amount),
max: 0
})
.aspectRatio(1);
Column({ space: CommonConstants.SPACE_S }) {
Text('总' + (this.accountType === 0 ? '支出' : '收入'))
.fontColor($r('app.color.gray'))
.fontSize($r('app.float.font_size_M'));
Text(this.totalAmount.toString())
.fontColor($r('app.color.black'))
.fontSize($r('app.float.font_size_MP'));
Image($r('app.media.switch'))
.width($r('app.float.component_size_SM'))
.onClick(() => this.accountType = this.accountType === 0 ? 1 : 0);
}.justifyContent(FlexAlign.Center);
}.width('70%')
.aspectRatio(1);
List({ space: CommonConstants.SPACE_S }) {
ForEach(this.classifiedStatistics, (classifiedStatistic: ClassifiedStatistic, index: number) => {
ListItem() {
Row({ space: CommonConstants.SPACE_S }) {
Text().backgroundColor(panelColors[index])
.aspectRatio(1)
.height($r('app.float.component_size_S'))
.borderRadius($r('app.float.radius_size_S'));
Text(classifiedStatistic.typeText)
.fontColor(panelColors[index])
.fontSize($r('app.float.font_size_S'));
}
}
});
}.width('25%');
}.justifyContent(FlexAlign.SpaceBetween)
.alignItems(VerticalAlign.Center)
.width(CommonConstants.FULL_WIDTH);
}
.justifyContent(FlexAlign.Center)
.padding($r('app.float.edge_size_M'))
.width(CommonConstants.FULL_WIDTH)
.borderRadius($r('app.float.radius_size_L'))
.backgroundColor(Color.White);
Column({ space: CommonConstants.SPACE_M }) {
Row() {
Text('类别/比例')
.fontColor($r('app.color.gray'))
.fontSize($r('app.float.font_size_M'));
Text('金额')
.fontColor($r('app.color.gray'))
.fontSize($r('app.float.font_size_M'));
}.justifyContent(FlexAlign.SpaceBetween)
.width(CommonConstants.FULL_WIDTH);
List({ space: CommonConstants.SPACE_S }) {
ForEach(this.classifiedStatistics, (classifiedStatistic: ClassifiedStatistic, index: number) => {
ListItem() {
Row() {
Text((index + 1).toString())
.fontSize($r('app.float.font_size_MP'))
.fontColor($r('app.color.gray'))
.margin({ right: $r('app.float.edge_size_M') });
Image(ImageList[classifiedStatistic.typeText])
.width($r('app.float.component_size_M'))
.aspectRatio(CommonConstants.FULL_SIZE)
.margin({ right: $r('app.float.edge_size_MP') });
Column() {
Text(classifiedStatistic.typeText)
.height($r('app.float.component_size_SM'))
.fontSize($r('app.float.font_size_M'));
Text(classifiedStatistic.count + '笔')
.fontSize($r('app.float.font_size_S'))
.fontColor($r('app.color.gray'));
}.alignItems(HorizontalAlign.Start)
.margin({ right: $r('app.float.edge_size_M') });
Text('/' + (this.ratios[index] * 100).toFixed(2) + '%').height($r('app.float.component_size_SM'))
.fontSize($r('app.float.font_size_S'))
.fontColor($r('app.color.gray'));
Blank()
.layoutWeight(1);
Text(this.accountType === 0 ? '-' + classifiedStatistic.amount.toString() : '+' + classifiedStatistic.amount.toString())
.fontSize($r('app.float.font_size_M'))
.fontColor(this.accountType === 0 ? $r('app.color.pay_color') : $r('app.color.main_color'))
.align(Alignment.End)
.flexGrow(CommonConstants.FULL_SIZE);
}
.width(CommonConstants.FULL_WIDTH)
.padding({ left: $r('app.float.edge_size_M'), right: $r('app.float.edge_size_M') });
}
.width(CommonConstants.FULL_WIDTH)
.height($r('app.float.component_size_LM'));
});
}
.width(CommonConstants.FULL_WIDTH);
}
.width(CommonConstants.FULL_WIDTH)
.padding($r('app.float.edge_size_M'))
.borderRadius($r('app.float.radius_size_L'))
.backgroundColor(Color.White);
}
.width(CommonConstants.FULL_WIDTH)
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.align(Alignment.Top)
.scrollBar(BarState.Off)
.backgroundColor($r('app.color.background_color'))
.padding({
left: $r('app.float.edge_size_M'),
right: $r('app.float.edge_size_M'),
top: $r('app.float.edge_size_M')
});
}
}
|
https://github.com/2763981847/Accounting-app.git/blob/cf8302a42588ecce1561b82e8533798157157257/entry/src/main/ets/pages/StatisticPage.ets#L14-L183
|
44cbb2145dc546473e83dcd42a7ab94b4d06bc69
|
github
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.