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/entry/src/main/ets/pages/home/result.ets
|
arkts
|
控制加载提示的显示
|
build() {
Column() {
this.topReturn()//顶部
Scroll(){
Column() {
Column() {
Row() {
Text('腹部').fontSize(25)
}.width('100%')
Row() {
Text('12课程').fontSize(15)
}.width('100%')
}.width('100%').justifyContent(FlexAlign.Start).padding(15)
this.showItem(this.datas)
}
}
}
.padding({ top: px2vp(this.topRectHeight), bottom: px2vp(this.bottomRectHeight) })
}
|
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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . topReturn 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( ) 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 Column ( ) 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 . fontSize ( AST#expression#Left 25 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 '100%' 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 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 '12课程' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 15 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 '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 . width ( 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 . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 15 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showItem 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 . datas 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#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 . 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#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . topRectHeight AST#member_expression#Right 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 bottom AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bottomRectHeight AST#member_expression#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#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
|
build() {
Column() {
this.topReturn()
Scroll(){
Column() {
Column() {
Row() {
Text('腹部').fontSize(25)
}.width('100%')
Row() {
Text('12课程').fontSize(15)
}.width('100%')
}.width('100%').justifyContent(FlexAlign.Start).padding(15)
this.showItem(this.datas)
}
}
}
.padding({ top: px2vp(this.topRectHeight), bottom: px2vp(this.bottomRectHeight) })
}
|
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/home/result.ets#L108-L132
|
702eeff7c4a67a9fda378c9373e1af5ee012a9f5
|
github
|
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets
|
arkts
|
fixImageMove
|
Image move fix.
@param rotated
@param flipImage
@returns offset.
|
static fixImageMove(rotated: Array<Point>, flipImage: RectF): Array<number> {
let offsetX = 0;
let offsetY = 0;
for (let point of rotated) {
if (point.x < flipImage.left) {
offsetX = Math.min(offsetX, point.x - flipImage.left);
} else if (point.x > flipImage.right) {
offsetX = Math.max(offsetX, point.x - flipImage.right);
}
if (point.y < flipImage.top) {
offsetY = Math.min(offsetY, point.y - flipImage.top);
} else if (point.y > flipImage.bottom) {
offsetY = Math.max(offsetY, point.y - flipImage.bottom);
}
}
return [offsetX, offsetY];
}
|
AST#method_declaration#Left static fixImageMove AST#parameter_list#Left ( AST#parameter#Left rotated : 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 Point 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 flipImage : AST#type_annotation#Left AST#primary_type#Left RectF 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 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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left offsetX = 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 offsetY = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( let point of AST#expression#Left rotated 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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left point AST#expression#Right . x AST#member_expression#Right AST#expression#Right < AST#expression#Left flipImage AST#expression#Right AST#binary_expression#Right AST#expression#Right . left 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 offsetX = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . min AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left offsetX AST#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 point AST#expression#Right . x AST#member_expression#Right AST#expression#Right - AST#expression#Left flipImage AST#expression#Right AST#binary_expression#Right AST#expression#Right . left 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 else 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 point AST#expression#Right . x AST#member_expression#Right AST#expression#Right > AST#expression#Left flipImage AST#expression#Right AST#binary_expression#Right AST#expression#Right . right 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 offsetX = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . max AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left offsetX AST#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 point AST#expression#Right . x AST#member_expression#Right AST#expression#Right - AST#expression#Left flipImage AST#expression#Right AST#binary_expression#Right AST#expression#Right . right 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#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 point AST#expression#Right . y AST#member_expression#Right AST#expression#Right < AST#expression#Left flipImage AST#expression#Right AST#binary_expression#Right AST#expression#Right . top 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 offsetY = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . min AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left offsetY AST#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 point AST#expression#Right . y AST#member_expression#Right AST#expression#Right - AST#expression#Left flipImage AST#expression#Right AST#binary_expression#Right AST#expression#Right . top 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 else 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 point AST#expression#Right . y AST#member_expression#Right AST#expression#Right > AST#expression#Left flipImage AST#expression#Right AST#binary_expression#Right AST#expression#Right . bottom 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 offsetY = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . max AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left offsetY AST#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 point AST#expression#Right . y AST#member_expression#Right AST#expression#Right - AST#expression#Left flipImage AST#expression#Right AST#binary_expression#Right AST#expression#Right . bottom 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#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#array_literal#Left [ AST#expression#Left offsetX AST#expression#Right , AST#expression#Left offsetY AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static fixImageMove(rotated: Array<Point>, flipImage: RectF): Array<number> {
let offsetX = 0;
let offsetY = 0;
for (let point of rotated) {
if (point.x < flipImage.left) {
offsetX = Math.min(offsetX, point.x - flipImage.left);
} else if (point.x > flipImage.right) {
offsetX = Math.max(offsetX, point.x - flipImage.right);
}
if (point.y < flipImage.top) {
offsetY = Math.min(offsetY, point.y - flipImage.top);
} else if (point.y > flipImage.bottom) {
offsetY = Math.max(offsetY, point.y - flipImage.bottom);
}
}
return [offsetX, offsetY];
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets#L238-L254
|
a022969c932e3e3d21236e96c236021a9ceaed9e
|
gitee
|
zl3624/harmonyos_network_samples
|
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
|
code/http/HttpRequestDownload/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"
//返回的首部信息中,cookie的格式为:
// set-cookie: sessionid=19837d50s270ms999us100ns; Max-Age=1800; Path=/
//这里需要记录下sessionid,作为下次提交时的cookie信息
let cookies: string = resp.header["set-cookie"]
this.sessionId = cookies.split(";")[0].split("=")[1]
this.msgHistory += "sessionId:" + this.sessionId + "\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 //返回的首部信息中,cookie的格式为: // set-cookie: sessionid=19837d50s270ms999us100ns; Max-Age=1800; Path=/ //这里需要记录下sessionid,作为下次提交时的cookie信息 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left cookies : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resp AST#expression#Right . header AST#member_expression#Right AST#expression#Right [ AST#expression#Left "set-cookie" AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . sessionId AST#member_expression#Right = AST#expression#Left AST#assignment_expression#Left AST#member_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#subscript_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cookies 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 . 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#ERROR#Left this AST#ERROR#Right . msgHistory AST#member_expression#Right += AST#expression#Left AST#assignment_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 "sessionId:" AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . sessionId AST#member_expression#Right AST#expression#Right + AST#expression#Left "\r\n" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#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#assignment_expression#Right AST#expression#Right AST#assignment_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 . 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"
let cookies: string = resp.header["set-cookie"]
this.sessionId = cookies.split(";")[0].split("=")[1]
this.msgHistory += "sessionId:" + this.sessionId + "\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/HttpRequestDownload/entry/src/main/ets/pages/Index.ets#L191-L219
|
1332b0b8c444526d5ac8da91df5acd9103eb36f4
|
gitee
|
queueit/harmony-sdk.git
|
ba7b4b38c03730bfbe305789acba6db0012d5f5c
|
queueit_sdk/src/main/ets/main/QueueItEngine.ets
|
arkts
|
runWithConnection
|
--- Internal Logic ---
|
private async runWithConnection(enqueueToken?: string, enqueueKey?: string): Promise<void> {
try {
const queueITWaitingRoomProviderResult = await this.provider.tryEnqueue(enqueueToken, enqueueKey);
Logger.debug(QueueItEngine.TAG, `checkResult: ${JSON.stringify(queueITWaitingRoomProviderResult)}`);
if (queueITWaitingRoomProviderResult.error) {
this.handleError(queueITWaitingRoomProviderResult.error, queueITWaitingRoomProviderResult.errorMessage);
return;
}
if (!queueITWaitingRoomProviderResult.result) {
this.handleError(QueueError.INVALID_RESPONSE, "Check result was unexpectedly null");
return;
}
const resultData = queueITWaitingRoomProviderResult.result;
Logger.debug(QueueItEngine.TAG, `resultData: ${JSON.stringify(resultData)}`);
if (queueITWaitingRoomProviderResult.shouldEnqueue) {
Logger.info(QueueItEngine.TAG, "Enqueue required. Showing queue view.");
this.viewManager.showQueue(resultData);
} else {
this.handlePassOrDisabled(resultData);
}
} catch (error) {
this.handleError(error.queueError || QueueError.API_ERROR, error.message);
}
}
|
AST#method_declaration#Left private async runWithConnection AST#parameter_list#Left ( AST#parameter#Left enqueueToken ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left enqueueKey ? : 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#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 queueITWaitingRoomProviderResult = 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 . provider AST#member_expression#Right AST#expression#Right . tryEnqueue AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left enqueueToken AST#expression#Right , AST#expression#Left enqueueKey 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 Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left QueueItEngine AST#expression#Right . TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` checkResult: 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 queueITWaitingRoomProviderResult 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left queueITWaitingRoomProviderResult AST#expression#Right . error 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 . handleError AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left queueITWaitingRoomProviderResult AST#expression#Right . error AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left queueITWaitingRoomProviderResult AST#expression#Right . errorMessage 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#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 queueITWaitingRoomProviderResult AST#expression#Right AST#unary_expression#Right AST#expression#Right . result 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 . handleError AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left QueueError AST#expression#Right . INVALID_RESPONSE AST#member_expression#Right AST#expression#Right , AST#expression#Left "Check result was unexpectedly null" 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 resultData = AST#expression#Left AST#member_expression#Left AST#expression#Left queueITWaitingRoomProviderResult AST#expression#Right . result 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 Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left QueueItEngine AST#expression#Right . TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` resultData: 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 resultData 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left queueITWaitingRoomProviderResult AST#expression#Right . shouldEnqueue 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 AST#member_expression#Left AST#expression#Left QueueItEngine AST#expression#Right . TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left "Enqueue required. Showing queue view." 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#member_expression#Left AST#expression#Left this AST#expression#Right . viewManager AST#member_expression#Right AST#expression#Right . showQueue AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left resultData 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 this AST#expression#Right . handlePassOrDisabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left resultData 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#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 this AST#expression#Right . handleError 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 error AST#expression#Right . queueError AST#member_expression#Right AST#expression#Right || AST#expression#Left QueueError AST#expression#Right AST#binary_expression#Right AST#expression#Right . API_ERROR AST#member_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#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
|
private async runWithConnection(enqueueToken?: string, enqueueKey?: string): Promise<void> {
try {
const queueITWaitingRoomProviderResult = await this.provider.tryEnqueue(enqueueToken, enqueueKey);
Logger.debug(QueueItEngine.TAG, `checkResult: ${JSON.stringify(queueITWaitingRoomProviderResult)}`);
if (queueITWaitingRoomProviderResult.error) {
this.handleError(queueITWaitingRoomProviderResult.error, queueITWaitingRoomProviderResult.errorMessage);
return;
}
if (!queueITWaitingRoomProviderResult.result) {
this.handleError(QueueError.INVALID_RESPONSE, "Check result was unexpectedly null");
return;
}
const resultData = queueITWaitingRoomProviderResult.result;
Logger.debug(QueueItEngine.TAG, `resultData: ${JSON.stringify(resultData)}`);
if (queueITWaitingRoomProviderResult.shouldEnqueue) {
Logger.info(QueueItEngine.TAG, "Enqueue required. Showing queue view.");
this.viewManager.showQueue(resultData);
} else {
this.handlePassOrDisabled(resultData);
}
} catch (error) {
this.handleError(error.queueError || QueueError.API_ERROR, error.message);
}
}
|
https://github.com/queueit/harmony-sdk.git/blob/ba7b4b38c03730bfbe305789acba6db0012d5f5c/queueit_sdk/src/main/ets/main/QueueItEngine.ets#L130-L155
|
c74489c67071c2180321c3a4ff6af6f9718b8179
|
github
|
zqaini002/YaoYaoLingXian.git
|
5095b12cbeea524a87c42d0824b1702978843d39
|
YaoYaoLingXian/entry/src/main/ets/pages/personal/UserPostsPage.ets
|
arkts
|
onPullDownRefresh
|
下拉刷新
|
onPullDownRefresh() {
if (this.isRefreshing || this.isLoadingMore) {
return;
}
this.loadData(true);
}
|
AST#method_declaration#Left onPullDownRefresh 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 this AST#expression#Right . isRefreshing AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . isLoadingMore AST#member_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 . loadData 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 ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
onPullDownRefresh() {
if (this.isRefreshing || this.isLoadingMore) {
return;
}
this.loadData(true);
}
|
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/personal/UserPostsPage.ets#L123-L128
|
55bae3c1c44d1cc47a4c708369e409dc2bc5b42e
|
github
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
eftool/src/main/ets/device/keyboard/TypeWritingUtil.ets
|
arkts
|
@Component export struct TypeWritingUtil { @Link text: string @State curIndex: number = 0 @State placeholderText: string = '请输入值' @State inputText: string = '' //字母输入区 @State inputTextHanzi: string[] = [] //汉字候选区 @State enChina: boolean = false //是否中英文false = 英文,true=中文 @State isUp: 0 | 1 | 2 = 0 //是否大小写 0=小写,1=短时大写,2=长时大写 @State showPopup: boolean = false //气泡控制 @State popText: string = '' //气泡内容 @State showNum: boolean = false //气泡内容 @State ctx:common.Context = getContext(); aboutToAppear(): void { this.ctx = getContext().createModuleContext('ef_ui'); } //键盘隐藏事件 hideClick: () => void = () => { } //拼字事件 pinyinAdd(input: string) { console.log('89757输入框:' + input) if (this.enChina && this.isUp === 0) { this.inputText += input for (let i = lexicon.ciku.length - 1; i >= 0; i--) { if (lexicon.ciku[i][0] == this.inputText) { let tmp: string[] = lexicon.ciku[i]; for (let j = 1; j < tmp.length; j++) { this.inputTextHanzi.push(tmp[j]) } break } } } else { if (this.isUp === 1) { this.text += input.toUpperCase() this.isUp = 0 } else if (this.isUp === 2) { this.text += input.toUpperCase() } else { this.text += input } } console.log('89757候选词:' + this.inputTextHanzi) } //删除事件 pinyinDel(input: string) { console.log('89757输入框:' + input) let tmp: string[] = [] for (let i = lexicon.ciku.length - 1; i >= 0; i--) { if (lexicon.ciku[i][0] == this.inputText) { let tmp: string[] = lexicon.ciku[i]; for (let j = 1; j < 6; j++) { tmp.push(tmp[j]) } break } } this.inputTextHanzi = tmp console.log('89757候选词:' + this.inputTextHanzi) } //候选区词语点击事件 hxClick(item: string) { this.text += item this.inputText = '' this.inputTextHanzi = [] } //隐藏按钮点击事件 ycClick() { //this.inputController.stopEditing() this.hideClick() this.inputText = '' this.inputTextHanzi = [] } //大小写点击事件 upClick() { if (this.isUp === 0) { this.isUp = 1 this.showNum = false } else if (this.isUp === 1) { this.isUp = 2 this.showNum = false } else { this.isUp = 0 } } //中英文切换点击事件 enChinaClick() { if (this.inputText.length !== 0) { this.text += this.inputText } this.inputText = '' this.inputTextHanzi = [] this.isUp = 0 this.showNum = false this.enChina = !this.enChina } //删除点击事件 delClick() { if (this.inputText.length > 0) { this.inputText = this.inputText.substring(0, this.inputText.length - 1) this.pinyinDel(this.inputText) } else { this.text = this.text.substring(0, this.text.length - 1) } } //删除长按事件 delChaClick() { this.text = '' this.inputTextHanzi = [] this.inputText = '' } //空格点击事件 kgClick() { this.text += ' ' } //符号+123 点击事件 fuhao123Click() { this.isUp = 0 this.enChina = false this.showNum = !this.showNum } //气泡 @Builder popRow() { Row() { Button({ type: ButtonType.Normal }) { Column({ space: 5 }) { Text('') .fontSize(15) .fontColor('#d0d0d0') }.width(10) } .width('9%') .backgroundColor('#FFFFFF') .borderRadius(6) .bindPopup(this.showPopup, { message: this.popText, popupColor: Color.Grey, placementOnTop: true, backgroundBlurStyle: BlurStyle.NONE, // 把失去焦点的模式去掉 否则颜色不保持 onStateChange: (event) => { // 当手指点了其他位置 关闭状态 this.showPopup = event.isVisible } }) }.visibility(Visibility.None) } //单个字母按键 @Builder comButton(item: keyValue) { Button({ type: ButtonType.Normal }) { Column({ space: 5 }) { if (this.isUp !== 0) { Text(item.key.toString().toUpperCase()) .fontWeight(FontWeight.Bold) .fontSize(18) .fontColor('#000000') Text(item.value.toString().toUpperCase()) .fontSize(15) .fontColor('#d0d0d0') } else if (this.showNum) { Text(item.value) .fontWeight(FontWeight.Bold) .fontSize(18) .fontColor('#000000') Text(item.key) .fontSize(15) .fontColor('#d0d0d0') } else { Text(item.key) .fontWeight(FontWeight.Bold) .fontSize(18) .fontColor('#000000') Text(item.value) .fontSize(15) .fontColor('#d0d0d0') } }.width(10) } .width('9%') .backgroundColor('#FFFFFF') .borderRadius(6) .onClick(() => { if (this.showNum) { this.pinyinAdd(item.value.toString()) } else { this.pinyinAdd(item.key.toString()) } }) .gesture( LongPressGesture() .onAction(() => { if (this.showNum) { this.popText = item.key.toString() } else { this.popText = item.value.toString() } this.showPopup = true }) .onActionEnd(() => { this.text += this.popText this.showPopup = false }) ) } build() { Column({ space: 10 }) { //上功能区-候选区 Row() { Column({ space: 5 }) { Row() { //拼音区 Text(this.inputText) .fontSize(18) .fontColor('#000000') .visibility(Visibility.Visible) }.width('100%').height('50%') .onClick(() => { this.hxClick(this.inputText) }) //汉字候选区 Scroll() { Row() { Text() { ForEach(this.inputTextHanzi, (item: string) => { Span(item + ' ') .fontSize(18) .fontColor('#000000') .visibility(Visibility.Hidden) .onClick(() => { this.hxClick(item) }) }) }.textAlign(TextAlign.Start) } }.width('100%').height('50%') .scrollable(ScrollDirection.Horizontal) .padding({ bottom: 5 }) } .layoutWeight(1).height('100%') .alignItems(HorizontalAlign.Start) //隐藏按钮 Column() { Image(this.ctx.resourceManager.getMediaContentBase64Sync($r("app.media.uiLoading"))) .width(20) .aspectRatio(1) } .justifyContent(FlexAlign.Center) .alignItems(HorizontalAlign.Center) .width('10%') .height('100%') .border({ width: { left: 1, }, color: '#FFFFFF' }) .onClick(() => { this.ycClick() }) } .width('100%') .height(50) .justifyContent(FlexAlign.SpaceBetween) .alignItems(VerticalAlign.Center) //气泡占位 this.popRow() //第一行 Row() { ForEach(lexicon.dataList1, (item: keyValue) => { this.comButton(item) }) }.justifyContent(FlexAlign.SpaceBetween) .width('100%') //第二行 Row() { ForEach(lexicon.dataList2, (item: keyValue) => { this.comButton(item) }) } .justifyContent(FlexAlign.SpaceBetween) .width('100%') .padding({ left: 15, right: 15, }) //第三行 Row() { ForEach(lexicon.dataList3, (item: keyValue) => { if (item.key === 'top') { Button({ type: ButtonType.Normal }) { if (this.isUp === 0) { Image(item.value) .height(20) .aspectRatio(1) .fillColor('#000000') } else if (this.isUp === 1) { Image(item.value) .height(20) .aspectRatio(1) .fillColor('#84C1FF') } else { Image(this.ctx.resourceManager.getMediaContentBase64Sync($r("app.media.error"))) .height(20) .aspectRatio(1) .fillColor('#84C1FF') } } .width('13%') .height('15%') .backgroundColor('#FFFFFF') .borderRadius(6) .onClick(() => { this.upClick() }) } else if (item.key === 'delete') { Button({ type: ButtonType.Normal }) { Image(item.value) .height(20) .aspectRatio(1) .fillColor('#000000') .gesture( LongPressGesture() .onAction((event: GestureEvent) => { if (event) { this.delChaClick() } }) ) } .width('13%') .height('15%') .backgroundColor('#FFFFFF') .borderRadius(6) .onClick(() => { this.delClick() }) .gesture( LongPressGesture() .onAction((event: GestureEvent) => { if (event) { this.delChaClick() } }) ) } else { this.comButton(item) } }) }.justifyContent(FlexAlign.SpaceBetween) .width('100%') //第四行 Row() { ForEach(lexicon.dataList4, (item: keyValue, index: number) => { if (item.key === 'huiche') { Button({ type: ButtonType.Normal }) { Image(item.value) .height(20) .aspectRatio(1) .fillColor('#000000') .onClick(() => { this.text += '\n' }) }.width('11%').height('15%').backgroundColor('#FFFFFF').borderRadius(6) } else if (item.key === 'kongge') { Button({ type: ButtonType.Normal }) { Image(item.value) .height(20) .width('60%') .fillColor('#000000') } .width('20%') .height('15%') .backgroundColor('#FFFFFF') .borderRadius(6) .onClick(() => { this.kgClick() }) } else if (index === 5) { Button({ type: ButtonType.Normal }) { Column({ space: 5 }) { if (!this.enChina) { Text('英') .fontWeight(FontWeight.Bold) .fontSize(18) .fontColor('#000000') Text('/中') .fontSize(15) .fontWeight(FontWeight.Bold) .fontColor('#d0d0d0') } else { Text('中') .fontWeight(FontWeight.Bold) .fontSize(18) .fontColor('#84C1FF') Text('/英') .fontSize(15) .fontWeight(FontWeight.Bold) .fontColor('#d0d0d0') } } } .width('11%') .height('15%') .backgroundColor('#FFFFFF') .borderRadius(6) .borderRadius(6) .onClick(() => { this.enChinaClick() }) } else { if (item.key === '123' || item.key === 'fuhao') { Button({ type: ButtonType.Normal }) { Text(item.value) .fontSize(15) .fontWeight(this.showNum ? FontWeight.Bold : FontWeight.Normal) .fontColor(this.showNum ? '#000000' : '#d0d0d0') } .width('11%') .height('15%') .backgroundColor('#FFFFFF') .borderRadius(6) .onClick(() => { this.fuhao123Click() }) } else { Button({ type: ButtonType.Normal }) { Text(item.value) .fontSize(15) .fontWeight(FontWeight.Bold) .fontColor('#d0d0d0') .onClick(() => { this.text += item.value }) }.width('11%').height('15%').backgroundColor('#FFFFFF').borderRadius(6) } } }) }.justifyContent(FlexAlign.SpaceBetween) .width('100%') } .height('35%') .width('100%') .backgroundColor('#d0d0d0') .padding(10) } } export class lexicon { static dataList1: keyValue[] = [ { key: 'q', value: '1' }, { key: 'w', value: '2' }, { key: 'e', value: '3' }, { key: 'r', value: '4' }, { key: 't', value: '5' }, { key: 'y', value: '6' }, { key: 'u', value: '7' }, { key: 'i', value: '8' }, { key: 'o', value: '9' }, { key: 'p', value: '0' } ] static dataList2: keyValue[] = [ { key: 'a', value: '~' }, { key: 's', value: '!' }, { key: 'd', value: '@' }, { key: 'f', value: '#' }, { key: 'g', value: '%' }, { key: 'h', value: '^' }, { key: 'j', value: '&' }, { key: 'k', value: '*' }, { key: 'l', value: '?' }, ] static dataList3: keyValue[] = [ { key: 'top', value: this.ctx.resourceManager.getMediaContentBase64Sync($r("app.media.error")) }, { key: 'z', value: '(' }, { key: 'x', value: ')' }, { key: 'c', value: '-' }, { key: 'v', value: '_' }, { key: 'b', value: ':' }, { key: 'n', value: ';' }, { key: 'm', value: '/' }, { key: 'delete', value: this.ctx.resourceManager.getMediaContentBase64Sync($r("app.media.close")) } ] static dataList4: keyValue[] = [ { key: 'fuhao', value: '!?#' }, { key: '123', value: '123' }, { key: '', value: ',' }, { key: 'kongge', value: this.ctx.resourceManager.getMediaContentBase64Sync($r("app.media.ok")) }, { key: '', value: '.' }, { key: '英/', value: '中' }, { key: 'huiche', value: this.ctx.resourceManager.getMediaContentBase64Sync($r("app.media.notice")) } ] static ciku: string[][] = [ ["a", "啊", "阿"], ["ai", "爱", "艾", "哎", "埃", "挨", "唉", "哀", "皑", "蔼", "矮", "碍", "隘", "癌"], ["an", "安", "俺", "按", "暗", "岸", "胺", "案", "鞍", "氨",], ["ang", "肮", "昂", "盎"], ["ao", "嗷", "凹", "敖", "熬", "翱", "袄", "傲", "奥", "懊", "澳"], ["b", "爸", "八", "叭", "吧", "笆", "八", "疤", "巴", "拔", "跋", "靶", "把", "坝", "霸", "罢", "爸", "扒", "耙"], ["ba", "芭", "捌", "叭", "吧", "笆", "八", "疤", "巴", "拔", "跋", "靶", "把", "坝", "霸", "罢", "爸", "扒", "耙"], ["bai", "白", "摆", "佰", "败", "拜", "柏", "百", "稗", "伯"], ["ban", "斑", "班", "搬", "扳", "颁", "板", "版", "扮", "拌", "伴", "瓣", "半", "办", "绊", "般"], ["bang", "邦", "帮", "梆", "榜", "绑", "棒", "镑", "傍", "谤", "膀", "磅", "蚌"], ["bao", "苞", "胞", "包", "褒", "雹", "保", "饱", "宝", "抱", "报", "豹", "鲍", "爆", "剥", "薄", "暴", "刨", "炮", "曝", "瀑", "堡"], ["bei", "杯", "碑", "悲", "卑", "北", "辈", "背", "贝", "钡", "倍", "狈", "备", "惫", "焙", "被"], ["ben", "奔", "苯", "本", "笨"], ["beng", "崩", "绷", "甭", "泵", "蹦", "迸", "蚌"], ["bi", "逼", "鼻", "比", "鄙", "笔", "彼", "碧", "蓖", "蔽", "毕", "毙", "毖", "币", "庇", "痹", "闭", "敝", "弊", "必", "壁", "避", "陛", "辟", "臂", "秘"], ["bian", "鞭", "边", "编", "贬", "变", "卞", "辨", "辩", "辫", "扁", "便", "遍"], ["biao", "标", "彪", "膘", "表"], ["bie", "鳖", "憋", "别", "瘪"], ["bin", "彬", "斌", "濒", "滨", "宾", "摈"], ["bing", "兵", "冰", "柄", "丙", "秉", "饼", "炳", "病", "并", "屏"], ["bo", "玻", "菠", "播", "拨", "钵", "博", "勃", "搏", "铂", "箔", "帛", "舶", "脖", "膊", "渤", "驳", "柏", "剥", "薄", "波", "泊", "卜", "般", "伯"], ["bu", "捕", "哺", "补", "埠", "布", "步", "簿", "部", "怖", "卜", "不", "埔", "堡"], ["ca", "擦"], ["cai", "猜", "裁", "材", "才", "财", "睬", "踩", "采", "彩", "菜", "蔡"], ["can", "餐", "残", "惭", "惨", "灿", "蚕", "参", "掺"], ["cang", "苍", "舱", "仓", "沧", "藏"], ["cao", "操", "糙", "槽", "曹", "草"], ["ce", "策", "册", "测", "厕", "侧"], ["cen", "参"], ["ceng", "层", "蹭", "曾"], ["cha", "插", "叉", "茶", "碴", "搽", "察", "岔", "诧", "茬", "查", "刹", "喳", "差"], ["chai", "柴", "豺", "拆", "差"], ["chan", "搀", "蝉", "馋", "谗", "缠", "铲", "产", "阐", "颤", "掺", "单"], ["chang", "昌", "猖", "场", "尝", "常", "偿", "肠", "厂", "畅", "唱", "倡", "长", "敞", "裳"], ["chao", "超", "抄", "钞", "潮", "巢", "吵", "炒", "朝", "嘲", "绰", "剿"], ["che", "扯", "撤", "掣", "彻", "澈", "车"], ["chen", "郴", "臣", "辰", "尘", "晨", "忱", "沉", "陈", "趁", "衬", "橙", "沈", "称", "秤"], ["cheng", "撑", "城", "成", "呈", "程", "惩", "诚", "承", "逞", "骋", "橙", "乘", "澄", "盛", "称", "秤"], ["chi", "痴", "持", "池", "迟", "弛", "驰", "耻", "齿", "侈", "赤", "翅", "斥", "炽", "吃", "匙", "尺"], ["chong", "充", "冲", "崇", "宠", "虫", "重"], ["chou", "抽", "酬", "畴", "踌", "稠", "愁", "筹", "仇", "绸", "瞅", "丑", "臭"], ["chu", "初", "出", "橱", "厨", "躇", "锄", "雏", "滁", "除", "楚", "础", "储", "矗", "搐", "触", "处", "畜"], ["chuai", "揣"], ["chuan", "川", "穿", "椽", "船", "喘", "串", "传"], ["chuang", "疮", "窗", "床", "闯", "创"], ["chui", "吹", "炊", "捶", "锤", "垂", "椎"], ["chun", "春", "椿", "醇", "唇", "淳", "纯", "蠢"], ["chuo", "戳", "绰"], ["ci", "疵", "茨", "磁", "雌", "辞", "慈", "瓷", "词", "此", "刺", "赐", "次", "伺", "兹", "差"], ["cong", "聪", "葱", "囱", "匆", "从", "丛"], ["cou", "凑"], ["cu", "粗", "醋", "簇", "促", "卒"], ["cuan", "蹿", "篡", "窜", "攒"], ["cui", "摧", "崔", "催", "脆", "瘁", "粹", "淬", "翠"], ["cun", "村", "存", "寸"], ["cuo", "磋", "搓", "措", "挫", "错", "撮"], ["da", "搭", "达", "答", "瘩", "打", "大"], ["dai", "歹", "傣", "戴", "带", "殆", "代", "贷", "袋", "待", "逮", "怠", "大", "呆"], ["dan", "耽", "担", "丹", "郸", "胆", "旦", "氮", "但", "惮", "淡", "诞", "蛋", "掸", "弹", "石", "单"], ["dang", "当", "挡", "党", "荡", "档"], ["dao", "刀", "捣", "蹈", "倒", "岛", "祷", "导", "到", "稻", "悼", "道", "盗"], ["de", "德", "得", "的", "地"], ["dei"], ["deng", "蹬", "灯", "登", "等", "瞪", "凳", "邓", "澄"], ["di", "低", "滴", "迪", "敌", "笛", "狄", "涤", "嫡", "抵", "蒂", "第", "帝", "弟", "递", "缔", "的", "堤", "翟", "底", "地", "提"], ["dian", "颠", "掂", "滇", "碘", "点", "典", "靛", "垫", "电", "甸", "店", "惦", "奠", "淀", "殿", "佃"], ["diao", "碉", "叼", "雕", "凋", "刁", "掉", "吊", "钓", "调"], ["die", "跌", "爹", "碟", "蝶", "迭", "谍", "叠"], ["ding", "盯", "叮", "钉", "顶", "鼎", "锭", "定", "订", "丁"], ["diu", "丢"], ["dong", "东", "冬", "董", "懂", "动", "栋", "冻", "洞", "侗", "恫"], ["dou", "兜", "抖", "斗", "陡", "豆", "逗", "痘", "都"], ["du", "督", "毒", "犊", "独", "堵", "睹", "赌", "杜", "镀", "肚", "渡", "妒", "都", "读", "度"], ["duan", "端", "短", "锻", "段", "断", "缎"], ["dui", "兑", "队", "对", "堆"], ["dun", "墩", "吨", "钝", "遁", "蹲", "敦", "顿", "囤", "盾"], ["duo", "掇", "哆", "多", "夺", "垛", "躲", "朵", "跺", "剁", "惰", "度", "舵", "堕"], ["e", "峨", "鹅", "俄", "额", "讹", "娥", "厄", "扼", "遏", "鄂", "饿", "阿", "蛾", "恶", "哦"], ["en", "恩"], ["er", "而", "耳", "尔", "饵", "洱", "二", "贰", "儿"], ["fa", "发", "罚", "筏", "伐", "乏", "阀", "法", "珐"], ["fan", "藩", "帆", "翻", "樊", "矾", "钒", "凡", "烦", "反", "返", "范", "贩", "犯", "饭", "泛", "番", "繁"], ["fang", "坊", "芳", "方", "肪", "房", "防", "妨", "仿", "访", "纺", "放"], ["fei", "菲", "非", "啡", "飞", "肥", "匪", "诽", "吠", "肺", "废", "沸", "费"], ["fen", "芬", "酚", "吩", "氛", "分", "纷", "坟", "焚", "汾", "粉", "奋", "份", "忿", "愤", "粪"], ["feng", "丰", "封", "枫", "蜂", "峰", "锋", "风", "疯", "烽", "逢", "缝", "讽", "奉", "凤", "冯"], ["fo", "佛"], ["fou", "否"], ["fu", "夫", "敷", "肤", "孵", "扶", "辐", "幅", "氟", "符", "伏", "俘", "服", "浮", "涪", "福", "袱", "弗", "甫", "抚", "辅", "俯", "釜", "斧", "腑", "府", "腐", "赴", "副", "覆", "赋", "复", "傅", "付", "阜", "父", "腹", "负", "富", "讣", "附", "妇", "缚", "咐", "佛", "拂", "脯"], ["ga", "噶", "嘎", "夹", "咖"], ["gai", "该", "改", "概", "钙", "溉", "盖", "芥"], ["gan", "干", "甘", "杆", "柑", "竿", "肝", "赶", "感", "秆", "敢", "赣", "乾"], ["gang", "冈", "刚", "钢", "缸", "肛", "纲", "岗", "港", "杠", "扛"], ["gao", "篙", "皋", "高", "膏", "羔", "糕", "搞", "稿", "镐", "告"], ["ge", "哥", "歌", "搁", "戈", "鸽", "疙", "割", "葛", "格", "阁", "隔", "铬", "个", "各", "胳", "革", "蛤", "咯"], ["gei", "给"], ["gen", "根", "跟"], ["geng", "耕", "更", "庚", "羹", "埂", "耿", "梗", "粳", "颈"], ["gong", "工", "攻", "功", "恭", "龚", "供", "躬", "公", "宫", "弓", "巩", "拱", "贡", "共", "汞"], ["gou", "钩", "勾", "沟", "苟", "狗", "垢", "构", "购", "够"], ["gu", "辜", "菇", "咕", "箍", "估", "沽", "孤", "姑", "古", "蛊", "骨", "股", "故", "顾", "固", "雇", "鼓", "谷", "贾"], ["gua", "刮", "瓜", "剐", "寡", "挂", "褂"], ["guai", "乖", "拐", "怪"], ["guan", "棺", "关", "官", "冠", "观", "管", "馆", "罐", "惯", "灌", "贯", "纶"], ["guang", "光", "逛", "广"], ["gui", "瑰", "规", "圭", "归", "闺", "轨", "鬼", "诡", "癸", "桂", "柜", "跪", "贵", "刽", "硅", "傀", "炔", "龟"], ["gun", "辊", "滚", "棍"], ["guo", "锅", "郭", "国", "果", "裹", "过", "涡"], ["ha", "蛤", "哈"], ["hai", "骸", "孩", "海", "氦", "亥", "害", "骇", "还", "咳"], ["han", "酣", "憨", "邯", "韩", "含", "涵", "寒", "函", "喊", "罕", "翰", "撼", "捍", "旱", "憾", "悍", "焊", "汗", "汉"], ["hang", "杭", "航", "夯", "吭", "巷", "行"], ["hao", "壕", "嚎", "豪", "毫", "郝", "好", "耗", "号", "浩", "镐", "貉"], ["he", "喝", "荷", "菏", "禾", "何", "盒", "阂", "河", "赫", "褐", "鹤", "贺", "核", "合", "涸", "吓", "呵", "貉", "和"], ["hei", "黑", "嘿"], ["hen", "痕", "很", "狠", "恨"], ["heng", "亨", "横", "衡", "恒", "哼", "行"], ["hong", "轰", "哄", "烘", "虹", "鸿", "洪", "宏", "弘", "红"], ["hou", "喉", "侯", "猴", "吼", "厚", "候", "后"], ["hu", "呼", "乎", "忽", "瑚", "壶", "葫", "胡", "蝴", "狐", "糊", "湖", "弧", "虎", "护", "互", "沪", "户", "唬", "和"], ["hua", "花", "华", "猾", "画", "化", "话", "哗", "滑", "划"], ["huai", "槐", "怀", "淮", "徊", "坏"], ["huan", "欢", "环", "桓", "缓", "换", "患", "唤", "痪", "豢", "焕", "涣", "宦", "幻", "还"], ["huang", "荒", "慌", "黄", "磺", "蝗", "簧", "皇", "凰", "惶", "煌", "晃", "幌", "恍", "谎"], ["hui", "灰", "挥", "辉", "徽", "恢", "蛔", "回", "毁", "悔", "慧", "卉", "惠", "晦", "贿", "秽", "烩", "汇", "讳", "诲", "绘", "会"], ["hun", "昏", "婚", "魂", "浑", "混", "荤"], ["huo", "活", "伙", "火", "获", "或", "惑", "霍", "货", "祸", "豁", "和"], ["ji", "击", "圾", "基", "机", "畸", "积", "箕", "肌", "饥", "迹", "激", "讥", "鸡", "姬", "绩", "吉", "极", "棘", "辑", "籍", "集", "及", "急", "疾", "汲", "即", "嫉", "级", "挤", "几", "脊", "己", "蓟", "技", "冀", "季", "伎", "剂", "悸", "济", "寄", "寂", "计", "记", "既", "忌", "际", "妓", "继", "纪", "给", "稽", "缉", "祭", "藉", "期", "奇", "齐", "系"], ["jia", "嘉", "枷", "佳", "加", "荚", "颊", "甲", "钾", "假", "稼", "架", "驾", "嫁", "夹", "贾", "价", "搅", "茄", "缴", "家"], ["jian", "歼", "监", "坚", "尖", "笺", "间", "煎", "兼", "肩", "艰", "奸", "缄", "茧", "检", "柬", "碱", "拣", "捡", "简", "俭", "剪", "减", "荐", "鉴", "践", "贱", "键", "箭", "件", "健", "舰", "剑", "饯", "渐", "溅", "涧", "建", "槛", "见", "浅"], ["jiang", "僵", "姜", "浆", "江", "疆", "蒋", "桨", "奖", "讲", "匠", "酱", "将", "降", "强"], ["jiao", "椒", "礁", "焦", "胶", "交", "郊", "浇", "骄", "娇", "脚", "教", "轿", "较", "叫", "窖", "蕉", "嚼", "搅", "铰", "狡", "饺", "绞", "酵", "觉", "校", "矫", "侥", "角", "缴", "剿"], ["jie", "揭", "接", "皆", "秸", "街", "阶", "截", "劫", "节", "杰", "捷", "睫", "竭", "洁", "结", "姐", "戒", "界", "借", "介", "疥", "诫", "届", "桔", "解", "藉", "芥"], ["jin", "巾", "筋", "斤", "金", "今", "津", "襟", "紧", "锦", "仅", "谨", "进", "靳", "晋", "禁", "近", "烬", "浸", "尽", "劲"], ["jing", "荆", "兢", "茎", "睛", "晶", "鲸", "京", "惊", "精", "经", "井", "警", "静", "境", "敬", "镜", "径", "痉", "靖", "竟", "竞", "净", "劲", "粳", "景", "颈"], ["jiong", "炯", "窘"], ["jiu", "揪", "究", "纠", "玖", "韭", "久", "灸", "九", "酒", "厩", "救", "旧", "臼", "舅", "咎", "就", "疚"], ["ju", "鞠", "拘", "狙", "疽", "驹", "菊", "局", "矩", "举", "沮", "聚", "拒", "据", "巨", "具", "距", "踞", "锯", "俱", "惧", "炬", "剧", "车", "桔", "居", "咀", "句", "蛆", "足"], ["juan", "捐", "鹃", "娟", "倦", "眷", "绢", "卷", "圈"], ["jue", "撅", "攫", "抉", "掘", "倔", "爵", "决", "诀", "绝", "嚼", "觉", "角"], ["jun", "菌", "钧", "军", "君", "峻", "俊", "竣", "郡", "骏", "均", "浚"], ["ka", "喀", "咖", "卡", "咯"], ["kai", "开", "揩", "凯", "慨", "楷"], ["kan", "刊", "堪", "勘", "坎", "砍", "看", "槛", "嵌"], ["kang", "康", "慷", "糠", "抗", "亢", "炕", "扛"], ["kao", "考", "拷", "烤", "靠"], ["ke", "坷", "苛", "柯", "棵", "磕", "颗", "科", "可", "渴", "克", "刻", "客", "课", "壳", "呵", "咳"], ["ken", "肯", "啃", "垦", "恳"], ["keng", "坑", "吭"], ["kong", "空", "恐", "孔", "控"], ["kou", "抠", "口", "扣", "寇"], ["ku", "枯", "哭", "窟", "苦", "酷", "库", "裤"], ["kua", "夸", "垮", "挎", "跨", "胯"], ["kuai", "块", "筷", "侩", "快", "会"], ["kuan", "宽", "款"], ["kuang", "匡", "筐", "狂", "框", "矿", "眶", "旷", "况"], ["kui", "亏", "盔", "岿", "窥", "葵", "奎", "魁", "馈", "愧", "傀", "溃"], ["kun", "坤", "昆", "捆", "困"], ["kuo", "扩", "廓", "阔", "括"], ["la", "垃", "拉", "喇", "辣", "啦", "蜡", "腊", "落"], ["lai", "莱", "来", "赖"], ["lan", "婪", "栏", "拦", "篮", "阑", "兰", "澜", "谰", "揽", "览", "懒", "缆", "烂", "滥", "蓝"], ["lang", "琅", "榔", "狼", "廊", "郎", "朗", "浪"], ["lao", "捞", "劳", "牢", "老", "佬", "涝", "姥", "酪", "烙", "潦", "落"], ["le", "勒", "乐", "肋", "了"], ["lei", "雷", "镭", "蕾", "磊", "累", "儡", "垒", "擂", "类", "泪", "勒", "肋"], ["leng", "楞", "冷", "棱"], ["li", "厘", "梨", "犁", "黎", "篱", "狸", "离", "漓", "理", "李", "里", "鲤", "礼", "莉", "荔", "吏", "栗", "丽", "厉", "励", "砾", "历", "利", "例", "俐", "痢", "立", "粒", "沥", "隶", "力", "璃", "哩"], ["lia"], ["lian", "联", "莲", "连", "镰", "廉", "涟", "帘", "敛", "脸", "链", "恋", "炼", "练", "怜"], ["liang", "粮", "凉", "梁", "粱", "良", "两", "辆", "量", "晾", "亮", "谅", "俩"], ["liao", "撩", "聊", "僚", "疗", "燎", "寥", "辽", "撂", "镣", "廖", "料", "潦", "了"], ["lie", "列", "裂", "烈", "劣", "猎"], ["lin", "琳", "林", "磷", "霖", "临", "邻", "鳞", "淋", "凛", "赁", "吝", "拎"], ["ling", "玲", "菱", "零", "龄", "铃", "伶", "羚", "凌", "灵", "陵", "岭", "领", "另", "令", "棱", "怜"], ["liu", "溜", "琉", "榴", "硫", "馏", "留", "刘", "瘤", "流", "柳", "六", "陆"], ["long", "龙", "聋", "咙", "笼", "窿", "隆", "垄", "拢", "陇", "弄"], ["lou", "楼", "娄", "搂", "篓", "漏", "陋", "露"], ["lu", "芦", "卢", "颅", "庐", "炉", "掳", "卤", "虏", "鲁", "麓", "路", "赂", "鹿", "潞", "禄", "录", "戮", "吕", "六", "碌", "露", "陆", "绿"], ["lv", "驴", "铝", "侣", "旅", "履", "屡", "缕", "虑", "氯", "律", "滤", "绿", "率"], ["lve", "掠", "略"], ["luan", "峦", "挛", "孪", "滦", "卵", "乱"], ["lun", "抡", "轮", "伦", "仑", "沦", "论", "纶"], ["luo", "萝", "螺", "罗", "逻", "锣", "箩", "骡", "裸", "洛", "骆", "烙", "络", "落", "咯"], ["ma", "妈", "麻", "玛", "码", "蚂", "马", "骂", "嘛", "吗", "摩", "抹", "么"], ["mai", "买", "麦", "卖", "迈", "埋", "脉"], ["man", "瞒", "馒", "蛮", "满", "曼", "慢", "漫", "谩", "埋", "蔓"], ["mang", "茫", "盲", "氓", "忙", "莽", "芒"], ["mao", "猫", "茅", "锚", "毛", "矛", "铆", "卯", "茂", "帽", "貌", "贸", "冒"], ["me", "么"], ["mei", "玫", "枚", "梅", "酶", "霉", "煤", "眉", "媒", "镁", "每", "美", "昧", "寐", "妹", "媚", "没", "糜"], ["men", "门", "闷", "们"], ["meng", "萌", "蒙", "檬", "锰", "猛", "梦", "孟", "盟"], ["mi", "眯", "醚", "靡", "迷", "弥", "米", "觅", "蜜", "密", "幂", "糜", "谜", "泌", "秘"], ["mian", "棉", "眠", "绵", "冕", "免", "勉", "缅", "面", "娩"], ["miao", "苗", "描", "瞄", "藐", "秒", "渺", "庙", "妙"], ["mie", "蔑", "灭"], ["min", "民", "抿", "皿", "敏", "悯", "闽"], ["ming", "明", "螟", "鸣", "铭", "名", "命"], ["miu", "谬"], ["mo", "摸", "摹", "蘑", "膜", "磨", "魔", "末", "莫", "墨", "默", "沫", "漠", "寞", "陌", "脉", "没", "模", "摩", "抹"], ["mou", "谋", "某", "牟"], ["mu", "拇", "牡", "亩", "姆", "母", "墓", "暮", "幕", "募", "慕", "木", "目", "睦", "牧", "穆", "姥", "模", "牟"], ["na", "拿", "钠", "纳", "呐", "那", "娜", "哪"], ["nai", "氖", "乃", "奶", "耐", "奈", "哪"], ["nan", "南", "男", "难"], ["nang", "囊"], ["nao", "挠", "脑", "恼", "闹", "淖"], ["ne", "呢", "哪"], ["nei", "馁", "内", "那", "哪"], ["nen", "嫩"], ["neng", "能"], ["ni", "妮", "霓", "倪", "泥", "尼", "拟", "你", "匿", "腻", "逆", "溺", "呢"], ["nian", "蔫", "拈", "年", "碾", "撵", "捻", "念", "粘"], ["niang", "娘", "酿"], ["niao", "鸟", "尿"], ["nie", "捏", "聂", "孽", "啮", "镊", "镍", "涅"], ["nin", "您"], ["ning", "柠", "狞", "凝", "宁", "拧", "泞"], ["niu", "牛", "扭", "钮", "纽"], ["nong", "脓", "浓", "农", "弄"], ["nu", "奴", "怒", "努"], ["nv", "女"], ["nve", "虐", "疟"], ["nuan", "暖"], ["nuo", "挪", "懦", "糯", "诺", "娜"], ["o", "哦"], ["ou", "欧", "鸥", "殴", "藕", "呕", "偶", "沤", "区"], ["pa", "啪", "趴", "爬", "帕", "怕", "扒", "耙", "琶"], ["pai", "拍", "排", "牌", "徘", "湃", "派", "迫"], ["pan", "攀", "潘", "盘", "磐", "盼", "畔", "判", "叛", "番", "胖", "般"], ["pang", "乓", "庞", "耪", "膀", "磅", "旁", "胖"], ["pao", "抛", "咆", "袍", "跑", "泡", "刨", "炮"], ["pei", "呸", "胚", "培", "裴", "赔", "陪", "配", "佩", "沛", "坏"], ["pen", "喷", "盆"], ["peng", "砰", "抨", "烹", "澎", "彭", "蓬", "棚", "硼", "篷", "膨", "朋", "鹏", "捧", "碰"], ["pi", "坯", "砒", "霹", "批", "披", "劈", "琵", "毗", "啤", "脾", "疲", "皮", "痞", "僻", "屁", "譬", "辟", "否", "匹", "坏"], ["pian", "篇", "偏", "片", "骗", "扁", "便"], ["piao", "飘", "漂", "瓢", "票", "朴"], ["pie", "撇", "瞥"], ["pin", "拼", "频", "贫", "品", "聘"], ["ping", "乒", "坪", "萍", "平", "凭", "瓶", "评", "苹", "屏"], ["po", "坡", "泼", "颇", "婆", "破", "粕", "泊", "迫", "魄", "朴"], ["pou", "剖"], ["pu", "扑", "铺", "仆", "莆", "葡", "菩", "蒲", "圃", "普", "浦", "谱", "脯", "埔", "曝", "瀑", "堡", "朴"], ["qi", "欺", "戚", "妻", "七", "凄", "柒", "沏", "棋", "歧", "崎", "脐", "旗", "祈", "祁", "骑", "起", "岂", "乞", "企", "启", "器", "气", "迄", "弃", "汽", "讫", "稽", "缉", "期", "栖", "其", "奇", "畦", "齐", "砌", "泣", "漆", "契"], ["qia", "掐", "卡", "洽"], ["qian", "牵", "扦", "钎", "千", "迁", "签", "仟", "谦", "黔", "钱", "钳", "前", "潜", "遣", "谴", "堑", "欠", "歉", "铅", "乾", "浅", "嵌", "纤"], ["qiang", "枪", "呛", "腔", "羌", "墙", "蔷", "抢", "强"], ["qiao", "锹", "敲", "悄", "桥", "乔", "侨", "巧", "撬", "翘", "峭", "俏", "窍", "壳", "橇", "瞧", "鞘", "雀"], ["qie", "切", "窃", "砌", "茄", "且", "怯"], ["qin", "钦", "侵", "秦", "琴", "勤", "芹", "擒", "禽", "寝", "亲", "沁"], ["qing", "青", "轻", "氢", "倾", "卿", "清", "擎", "晴", "氰", "情", "顷", "请", "庆", "亲"], ["qiong", "琼", "穷"], ["qiu", "秋", "丘", "邱", "球", "求", "囚", "酋", "泅"], ["qu", "趋", "曲", "躯", "屈", "驱", "渠", "取", "娶", "龋", "去", "区", "蛆", "趣"], ["quan", "颧", "权", "醛", "泉", "全", "痊", "拳", "犬", "券", "劝", "卷", "圈"], ["que", "缺", "瘸", "却", "鹊", "榷", "确", "炔", "雀"], ["qun", "裙", "群"], ["ran", "然", "燃", "冉", "染"], ["rang", "瓤", "壤", "攘", "嚷", "让"], ["rao", "饶", "扰", "绕"], ["re", "惹", "热"], ["ren", "壬", "仁", "人", "忍", "韧", "任", "认", "刃", "妊", "纫"], ["reng", "扔", "仍"], ["ri", "日"], ["rong", "戎", "茸", "蓉", "荣", "融", "熔", "溶", "容", "绒", "冗"], ["rou", "揉", "柔", "肉"], ["ru", "茹", "儒", "孺", "如", "辱", "乳", "汝", "入", "褥", "蠕"], ["ruan", "软", "阮"], ["rui", "蕊", "瑞", "锐"], ["run", "闰", "润"], ["ruo", "弱", "若"], ["sa", "撒", "洒", "萨"], ["sai", "腮", "鳃", "赛", "塞"], ["san", "三", "叁", "伞", "散"], ["sang", "桑", "嗓", "丧"], ["sao", "搔", "骚", "扫", "嫂", "梢"], ["se", "瑟", "涩", "塞", "色"], ["sen", "森"], ["seng", "僧"], ["sha", "砂", "杀", "沙", "纱", "傻", "啥", "煞", "莎", "刹", "杉", "厦"], ["shai", "筛", "晒", "色"], ["shan", "珊", "苫", "山", "删", "煽", "衫", "闪", "陕", "擅", "赡", "膳", "善", "汕", "扇", "缮", "杉", "栅", "掺", "单"], ["shang", "墒", "伤", "商", "赏", "晌", "上", "尚", "裳", "汤"], ["shao", "捎", "稍", "烧", "芍", "勺", "韶", "少", "哨", "邵", "绍", "鞘", "梢", "召"], ["she", "奢", "赊", "舌", "舍", "赦", "摄", "慑", "涉", "社", "设", "蛇", "拾", "折", "射"], ["shei"], ["shen", "砷", "申", "呻", "伸", "身", "深", "绅", "神", "审", "婶", "肾", "慎", "渗", "沈", "甚", "参", "娠", "什"], ["sheng", "声", "生", "甥", "牲", "升", "绳", "剩", "胜", "圣", "乘", "省", "盛"], ["shi", "师", "失", "狮", "施", "湿", "诗", "尸", "虱", "十", "时", "蚀", "实", "史", "矢", "使", "屎", "驶", "始", "式", "示", "士", "世", "柿", "事", "拭", "誓", "逝", "势", "是", "嗜", "噬", "适", "仕", "侍", "释", "饰", "市", "恃", "室", "视", "试", "匙", "石", "拾", "食", "识", "氏", "似", "嘘", "殖", "峙", "什"], ["shou", "收", "手", "首", "守", "寿", "授", "售", "受", "瘦", "兽", "熟"], ["shu", "蔬", "枢", "梳", "殊", "抒", "输", "叔", "舒", "淑", "疏", "书", "赎", "孰", "薯", "暑", "曙", "署", "蜀", "黍", "鼠", "述", "树", "束", "戍", "竖", "墅", "庶", "漱", "恕", "熟", "属", "术", "数"], ["shua", "刷", "耍"], ["shuai", "摔", "甩", "帅", "衰", "率"], ["shuan", "栓", "拴"], ["shuang", "霜", "双", "爽"], ["shui", "水", "睡", "税", "谁", "说"], ["shun", "吮", "瞬", "顺", "舜"], ["shuo", "硕", "朔", "烁", "数", "说"], ["si", "斯", "撕", "嘶", "私", "司", "丝", "死", "肆", "寺", "嗣", "四", "饲", "巳", "食", "思", "伺", "似"], ["song", "松", "耸", "怂", "颂", "送", "宋", "讼", "诵"], ["sou", "搜", "擞", "嗽", "艘"], ["su", "苏", "酥", "俗", "素", "速", "粟", "僳", "塑", "溯", "诉", "肃", "宿", "缩"], ["suan", "酸", "蒜", "算"], ["sui", "虽", "隋", "随", "绥", "髓", "碎", "岁", "穗", "遂", "隧", "祟", "尿"], ["sun", "孙", "损", "笋"], ["suo", "蓑", "梭", "唆", "琐", "索", "锁", "所", "莎", "缩"], ["ta", "塌", "他", "它", "她", "獭", "挞", "蹋", "踏", "塔", "拓"], ["tai", "胎", "苔", "抬", "台", "泰", "酞", "太", "态", "汰"], ["tan", "坍", "摊", "贪", "瘫", "滩", "坛", "檀", "痰", "潭", "谭", "谈", "坦", "毯", "袒", "碳", "探", "叹", "炭", "弹"], ["tang", "塘", "搪", "堂", "棠", "膛", "唐", "糖", "躺", "淌", "趟", "烫", "敞", "汤", "倘"], ["tao", "掏", "涛", "滔", "绦", "萄", "桃", "逃", "淘", "讨", "套", "陶"], ["te", "特"], ["teng", "藤", "腾", "疼", "誊"], ["ti", "梯", "剔", "踢", "锑", "题", "蹄", "啼", "体", "替", "嚏", "惕", "涕", "剃", "屉", "提"], ["tian", "天", "添", "填", "田", "甜", "恬", "舔", "腆", "蚕"], ["tiao", "挑", "条", "迢", "眺", "跳", "调"], ["tie", "贴", "铁", "帖"], ["ting", "厅", "烃", "汀", "廷", "停", "亭", "庭", "挺", "艇", "听"], ["tong", "通", "桐", "酮", "瞳", "同", "铜", "彤", "童", "桶", "捅", "筒", "统", "痛", "侗", "恫"], ["tou", "偷", "投", "头", "透"], ["tu", "秃", "突", "图", "徒", "途", "涂", "屠", "土", "吐", "兔", "凸", "余"], ["tuan", "湍", "团"], ["tui", "推", "颓", "腿", "蜕", "退", "褪"], ["tun", "吞", "屯", "臀", "囤"], ["tuo", "拖", "托", "脱", "鸵", "陀", "驼", "椭", "妥", "唾", "驮", "拓"], ["wa", "挖", "哇", "蛙", "洼", "娃", "瓦", "袜"], ["wai", "歪", "外"], ["wan", "豌", "弯", "湾", "玩", "顽", "丸", "烷", "完", "碗", "挽", "晚", "惋", "婉", "腕", "蔓", "皖", "宛", "万"], ["wang", "汪", "王", "枉", "网", "往", "旺", "望", "忘", "妄", "亡"], ["wei", "威", "巍", "微", "危", "韦", "违", "桅", "围", "唯", "惟", "为", "潍", "维", "苇", "萎", "委", "伟", "伪", "纬", "未", "味", "畏", "胃", "喂", "魏", "位", "渭", "谓", "慰", "卫", "尾", "蔚", "尉"], ["wen", "瘟", "温", "蚊", "文", "闻", "纹", "吻", "稳", "紊", "问"], ["weng", "嗡", "翁", "瓮"], ["wo", "挝", "蜗", "窝", "我", "斡", "卧", "握", "沃", "涡"], ["wu", "巫", "呜", "钨", "乌", "污", "诬", "屋", "芜", "梧", "吾", "吴", "毋", "武", "五", "捂", "午", "舞", "伍", "侮", "坞", "戊", "雾", "晤", "物", "勿", "务", "悟", "误", "恶", "无"], ["xi", "昔", "熙", "析", "西", "硒", "矽", "晰", "嘻", "吸", "锡", "牺", "稀", "息", "希", "悉", "膝", "夕", "惜", "熄", "烯", "汐", "犀", "檄", "袭", "席", "习", "媳", "喜", "隙", "细", "栖", "溪", "铣", "洗", "系", "戏"], ["xia", "瞎", "匣", "霞", "辖", "暇", "峡", "侠", "狭", "下", "虾", "厦", "夏", "吓"], ["xian", "掀", "锨", "先", "仙", "鲜", "咸", "贤", "衔", "舷", "闲", "涎", "弦", "嫌", "显", "险", "现", "献", "县", "腺", "馅", "羡", "宪", "陷", "限", "线", "铣", "纤"], ["xiang", "相", "厢", "镶", "香", "箱", "襄", "湘", "乡", "翔", "祥", "详", "想", "响", "享", "项", "橡", "像", "向", "象", "降", "巷"], ["xiao", "萧", "硝", "霄", "哮", "销", "消", "宵", "晓", "小", "孝", "肖", "啸", "笑", "效", "削", "嚣", "淆", "校"], ["xie", "楔", "些", "歇", "鞋", "协", "携", "胁", "谐", "写", "械", "卸", "蟹", "懈", "泄", "泻", "谢", "屑", "解", "蝎", "挟", "邪", "斜", "血", "叶", "契"], ["xin", "薪", "芯", "锌", "欣", "辛", "新", "忻", "心", "衅", "信"], ["xing", "星", "腥", "猩", "惺", "兴", "刑", "型", "形", "邢", "醒", "幸", "杏", "性", "姓", "省", "行"], ["xiong", "兄", "凶", "胸", "匈", "汹", "雄", "熊"], ["xiu", "休", "修", "羞", "朽", "嗅", "锈", "秀", "袖", "绣", "臭", "宿"], ["xu", "墟", "需", "虚", "须", "徐", "许", "蓄", "酗", "叙", "旭", "序", "恤", "絮", "婿", "绪", "续", "戌", "嘘", "畜", "吁"], ["xuan", "轩", "喧", "宣", "悬", "旋", "玄", "选", "癣", "眩", "绚"], ["xue", "靴", "薛", "学", "穴", "雪", "削", "血"], ["xun", "勋", "熏", "循", "旬", "询", "驯", "巡", "殉", "汛", "训", "讯", "逊", "迅", "浚", "寻"], ["ya", "压", "押", "鸦", "鸭", "呀", "丫", "牙", "蚜", "衙", "涯", "雅", "哑", "亚", "讶", "芽", "崖", "轧"], ["yan", "焉", "阉", "淹", "盐", "严", "研", "蜒", "岩", "延", "言", "颜", "阎", "炎", "沿", "奄", "掩", "眼", "衍", "演", "艳", "堰", "燕", "厌", "砚", "雁", "唁", "彦", "焰", "宴", "谚", "验", "铅", "咽", "烟", "殷"], ["yang", "殃", "央", "鸯", "秧", "杨", "扬", "佯", "疡", "羊", "洋", "阳", "氧", "仰", "痒", "养", "样", "漾"], ["yao", "邀", "腰", "妖", "瑶", "摇", "尧", "遥", "窑", "谣", "姚", "咬", "舀", "药", "要", "耀", "约", "钥", "侥"], ["ye", "椰", "噎", "耶", "爷", "野", "冶", "也", "页", "业", "夜", "咽", "掖", "叶", "腋", "液", "拽", "曳"], ["yi", "一", "壹", "医", "揖", "铱", "依", "伊", "衣", "颐", "夷", "移", "仪", "胰", "疑", "沂", "宜", "姨", "彝", "椅", "蚁", "倚", "已", "乙", "矣", "以", "艺", "抑", "易", "邑", "亿", "役", "臆", "逸", "肄", "疫", "亦", "裔", "意", "毅", "忆", "义", "益", "溢", "诣", "议", "谊", "译", "异", "翼", "翌", "绎", "遗", "屹"], ["yin", "茵", "荫", "因", "音", "阴", "姻", "吟", "银", "淫", "寅", "饮", "尹", "引", "隐", "印", "殷"], ["ying", "英", "樱", "婴", "鹰", "应", "缨", "莹", "萤", "营", "荧", "蝇", "迎", "赢", "盈", "影", "颖", "硬", "映"], ["yo", "哟"], ["yong", "拥", "佣", "臃", "痈", "庸", "雍", "踊", "蛹", "咏", "泳", "永", "恿", "勇", "用", "涌"], ["you", "幽", "优", "悠", "忧", "尤", "由", "邮", "铀", "犹", "油", "游", "酉", "有", "友", "右", "佑", "釉", "诱", "又", "幼"], ["yu", "迂", "淤", "于", "盂", "榆", "虞", "愚", "舆", "逾", "鱼", "愉", "渝", "渔", "隅", "予", "娱", "雨", "与", "屿", "禹", "宇", "语", "羽", "玉", "域", "芋", "郁", "遇", "喻", "峪", "御", "愈", "欲", "狱", "誉", "浴", "寓", "裕", "预", "豫", "驭", "尉", "余", "俞", "吁", "育"], ["yuan", "鸳", "渊", "冤", "元", "垣", "袁", "原", "援", "辕", "园", "圆", "猿", "源", "缘", "远", "苑", "愿", "怨", "院", "员"], ["yue", "曰", "越", "跃", "岳", "粤", "月", "悦", "阅", "乐", "约", "钥"], ["yun", "耘", "云", "郧", "匀", "陨", "允", "运", "蕴", "酝", "晕", "韵", "孕", "均", "员"], ["za", "匝", "砸", "杂", "扎", "咱", "咋"], ["zai", "栽", "哉", "灾", "宰", "载", "再", "在", "仔"], ["zan", "暂", "赞", "攒", "咱"], ["zang", "赃", "脏", "葬", "藏"], ["zao", "遭", "糟", "藻", "枣", "早", "澡", "蚤", "躁", "噪", "造", "皂", "灶", "燥", "凿"], ["ze", "责", "则", "泽", "择", "侧", "咋"], ["zei", "贼"], ["zen", "怎"], ["zeng", "增", "憎", "赠", "曾", "综"], ["zha", "渣", "札", "铡", "闸", "眨", "榨", "乍", "炸", "诈", "查", "扎", "喳", "栅", "柞", "轧", "咋"], ["zhai", "斋", "债", "寨", "翟", "祭", "择", "摘", "宅", "窄", "侧"], ["zhan", "瞻", "毡", "詹", "沾", "盏", "斩", "辗", "崭", "展", "蘸", "栈", "占", "战", "站", "湛", "绽", "颤", "粘"], ["zhang", "樟", "章", "彰", "漳", "张", "掌", "涨", "杖", "丈", "帐", "账", "仗", "胀", "瘴", "障", "长"], ["zhao", "招", "昭", "找", "沼", "赵", "照", "罩", "兆", "肇", "朝", "召", "爪", "着"], ["zhe", "遮", "哲", "蛰", "辙", "者", "蔗", "浙", "折", "锗", "这", "着"], ["zhei"], ["zhen", "珍", "斟", "真", "甄", "砧", "臻", "贞", "针", "侦", "枕", "疹", "诊", "震", "振", "镇", "阵", "帧"], ["zheng", "蒸", "挣", "睁", "征", "狰", "争", "怔", "整", "拯", "正", "政", "症", "郑", "证"], ["zhi", "芝", "支", "蜘", "知", "肢", "脂", "汁", "之", "织", "职", "直", "植", "执", "值", "侄", "址", "指", "止", "趾", "只", "旨", "纸", "志", "挚", "掷", "至", "致", "置", "帜", "制", "智", "秩", "稚", "质", "炙", "痔", "滞", "治", "窒", "识", "枝", "吱", "殖", "峙"], ["zhong", "中", "盅", "忠", "钟", "衷", "终", "肿", "仲", "众", "种", "重"], ["zhou", "舟", "周", "州", "洲", "诌", "轴", "肘", "帚", "咒", "皱", "宙", "昼", "骤", "粥"], ["zhu", "珠", "株", "蛛", "朱", "猪", "诸", "诛", "逐", "竹", "烛", "煮", "拄", "瞩", "嘱", "主", "柱", "助", "蛀", "贮", "铸", "筑", "住", "注", "祝", "驻", "属", "著"], ["zhua", "抓", "爪"], ["zhuai", "拽"], ["zhuan", "专", "砖", "撰", "篆", "传", "转", "赚"], ["zhuang", "桩", "庄", "装", "妆", "壮", "状", "幢", "撞"], ["zhui", "锥", "追", "赘", "坠", "缀", "椎"], ["zhun", "谆", "准"], ["zhuo", "捉", "拙", "卓", "桌", "茁", "酌", "啄", "灼", "浊", "琢", "缴", "着"], ["zi", "咨", "资", "姿", "滋", "淄", "孜", "紫", "籽", "滓", "子", "自", "渍", "字", "吱", "兹", "仔"], ["zong", "鬃", "棕", "踪", "宗", "总", "纵", "综"], ["zou", "邹", "走", "奏", "揍"], ["zu", "租", "族", "祖", "诅", "阻", "组", "足", "卒"], ["zuan", "钻", "纂"], ["zui", "嘴", "醉", "最", "罪"], ["zun", "尊", "遵"], ["zuo", "昨", "左", "佐", "做", "作", "坐", "座", "撮", "琢", "柞"] ] }
|
export class keyValue {
key: ResourceStr = ''
value: ResourceStr = ''
}
|
AST#export_declaration#Left export AST#class_declaration#Left class keyValue AST#class_body#Left { AST#property_declaration#Left key AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right value AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class keyValue {
key: ResourceStr = ''
value: ResourceStr = ''
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/device/keyboard/TypeWritingUtil.ets#L1509-L1512
|
0fb4dd457f309f7afd5d0192f63ca1a1b10f9eb8
|
gitee
|
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/blocks/modules/meowWebView.ets
|
arkts
|
align_rules_main_tab
|
Kind of constants
|
align_rules_main_tab() {
let align: AlignRuleOption;
if (this.tablet_mode) {
align = { left: { anchor: "__container__", align: HorizontalAlign.Start } }
} else {
align = { top: { anchor: "__container__", align: VerticalAlign.Top } }
}
return align;
}
|
AST#method_declaration#Left align_rules_main_tab AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left align : AST#type_annotation#Left AST#primary_type#Left AlignRuleOption AST#primary_type#Right AST#type_annotation#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 this AST#expression#Right . tablet_mode 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 align = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left "__container__" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start 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#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 align = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left "__container__" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Top 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#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 align AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
align_rules_main_tab() {
let align: AlignRuleOption;
if (this.tablet_mode) {
align = { left: { anchor: "__container__", align: HorizontalAlign.Start } }
} else {
align = { top: { anchor: "__container__", align: VerticalAlign.Top } }
}
return align;
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowWebView.ets#L798-L806
|
52a2a9fd69f3783325b65518309bc7e6bcff6f33
|
gitee
|
liuchao0739/arkTS_universal_starter.git
|
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
|
entry/src/main/ets/utils/DateUtils.ets
|
arkts
|
dateToTimestamp
|
日期转时间戳
|
static dateToTimestamp(date: Date): number {
return date.getTime();
}
|
AST#method_declaration#Left static dateToTimestamp AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date 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 date 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 dateToTimestamp(date: Date): number {
return date.getTime();
}
|
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/utils/DateUtils.ets#L67-L69
|
f8533ce404322d848ca1f92e5e409d122c6c95d5
|
github
|
iotjin/JhHarmonyDemo.git
|
819e6c3b1db9984c042a181967784550e171b2e8
|
JhCommon/src/main/ets/JhCommon/components/JhPickerTool.ets
|
arkts
|
isMultiStringArray
|
是否是多维字符串数组
@param arr
@returns
|
public static isMultiStringArray(arr: ESObject[]) {
// 如果不是数组,直接返回 false
if (!Array.isArray(arr)) {
return false
}
// 检查数组中的每个元素是否是字符串数组
return arr.every((item: ESObject): boolean => JhPickerTool.isOneStringArray(item))
}
|
AST#method_declaration#Left public static isMultiStringArray AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ESObject [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 如果不是数组,直接返回 false 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 Array AST#expression#Right AST#unary_expression#Right AST#expression#Right . isArray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left arr AST#expression#Right ) AST#argument_list#Right AST#call_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#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left arr AST#expression#Right . every 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 item : AST#type_annotation#Left AST#primary_type#Left ESObject 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JhPickerTool AST#expression#Right . isOneStringArray 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#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 isMultiStringArray(arr: ESObject[]) {
if (!Array.isArray(arr)) {
return false
}
return arr.every((item: ESObject): boolean => JhPickerTool.isOneStringArray(item))
}
|
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhPickerTool.ets#L251-L258
|
56535dff3c2294c2f4632485ce47a193e0d29eea
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/RandomUtil.ets
|
arkts
|
getRandomChineseChar
|
生成一个随机汉字('\u4E00'-'\u9FFF')
@return 随机的汉字字符
|
static getRandomChineseChar(): string {
const start = 0x4E00; //汉字起始Unicode编码,'\u4E00'
const end = 0x9FFF; //汉字结束Unicode编码,'\u9FFF'
const randomCode = start + Math.floor(Math.random() * (end - start + 1)); //生成一个随机码点
return String.fromCharCode(randomCode); //将随机码点转换为对应的汉字字符
}
|
AST#method_declaration#Left static getRandomChineseChar AST#parameter_list#Left ( ) 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 start = AST#expression#Left 0x4E00 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //汉字起始Unicode编码,'\u4E00' AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left end = AST#expression#Left 0x9FFF AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //汉字结束Unicode编码,'\u9FFF' AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left randomCode = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left start AST#expression#Right + AST#expression#Left Math AST#expression#Right AST#binary_expression#Right 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . random 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#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left end AST#expression#Right - AST#expression#Left start AST#expression#Right AST#binary_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 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left String AST#expression#Right . fromCharCode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left randomCode 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 getRandomChineseChar(): string {
const start = 0x4E00;
const end = 0x9FFF;
const randomCode = start + Math.floor(Math.random() * (end - start + 1));
return String.fromCharCode(randomCode);
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/RandomUtil.ets#L68-L73
|
7d944a98312c804715c245d742db78d36c506455
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/analytics/AnalyticsService.ets
|
arkts
|
年龄分布数据接口
|
export interface AgeDistribution {
ageGroup: string;
count: number;
percentage: number;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface AgeDistribution AST#object_type#Left { AST#type_member#Left ageGroup : 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 count : 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 percentage : 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 AgeDistribution {
ageGroup: string;
count: number;
percentage: number;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L22-L26
|
f89b066c277d4706561297150425adaacfa7723d
|
github
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/multicolumndisplay/src/main/ets/data/ProductDataFormat.ets
|
arkts
|
首页瀑布流列表信息
|
export class ProductInfo {
// id号
id: number;
// 图片地址
imageSrc: ResourceStr;
// 商品类型
type: string;
// 标题
name?: string;
// 描述信息
description?: string;
constructor(id: number, imageSrc: ResourceStr, type: string, name?: string, description?: string) {
this.id = id;
this.imageSrc = imageSrc;
this.type = type;
this.name = name;
this.description = description;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class ProductInfo AST#class_body#Left { // id号 AST#property_declaration#Left id : 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 imageSrc : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 商品类型 AST#property_declaration#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 标题 AST#property_declaration#Left name ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 描述信息 AST#property_declaration#Left description ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left imageSrc : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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 description ? : 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 . id AST#member_expression#Right = AST#expression#Left id 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 . imageSrc AST#member_expression#Right = AST#expression#Left imageSrc 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 . type AST#member_expression#Right = AST#expression#Left type 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 . name AST#member_expression#Right = AST#expression#Left name 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 . description AST#member_expression#Right = AST#expression#Left description AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class ProductInfo {
id: number;
imageSrc: ResourceStr;
type: string;
name?: string;
description?: string;
constructor(id: number, imageSrc: ResourceStr, type: string, name?: string, description?: string) {
this.id = id;
this.imageSrc = imageSrc;
this.type = type;
this.name = name;
this.description = description;
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multicolumndisplay/src/main/ets/data/ProductDataFormat.ets#L19-L38
|
e3edeb06e1917cfbee6d46c29acd825a41e8714c
|
gitee
|
|
XiangRui_FuZi/harmony-oscourse
|
da885f9a777a1eace7a07e1cd81137746687974b
|
class1/entry/src/main/ets/model/DataModel.ets
|
arkts
|
A subclass inheriting from BasicDataSource has overridden the methods.
|
export class TopTabContent extends BasicDataSource {
private tabContent: string[] = [];
// Get the length of the array.
public totalCount(): number {
return this.tabContent.length;
}
// Retrieve data at the specified index.
public getData(index: number): string {
return this.tabContent[index];
}
// Change a single piece of data.
public addData(index: number, data: string): void {
this.tabContent.splice(index, 0, data);
this.notifyDataAdd(index);
}
// Add data.
public pushData(data: string): void {
this.tabContent.push(data);
this.notifyDataAdd(this.tabContent.length - 1);
}
ResourceToString(resource:Resource):string{
return getContext(resource).resourceManager.getStringSync(resource)
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class TopTabContent extends AST#type_annotation#Left AST#primary_type#Left BasicDataSource AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private tabContent : 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#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // Get the length of the array. AST#method_declaration#Left public totalCount 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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tabContent AST#member_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 // Retrieve data at the specified index. AST#method_declaration#Left public getData 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 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#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tabContent AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // Change a single piece of data. AST#method_declaration#Left public addData 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#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#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 . tabContent AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right , AST#expression#Left 0 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataAdd 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#builder_function_body#Right AST#method_declaration#Right // Add data. AST#method_declaration#Left public pushData 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#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 . tabContent AST#member_expression#Right AST#expression#Right . push 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataAdd 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 . tabContent 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#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left ResourceToString AST#parameter_list#Left ( AST#parameter#Left resource : 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 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#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( AST#expression#Left resource AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getStringSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left resource 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 TopTabContent extends BasicDataSource {
private tabContent: string[] = [];
public totalCount(): number {
return this.tabContent.length;
}
public getData(index: number): string {
return this.tabContent[index];
}
public addData(index: number, data: string): void {
this.tabContent.splice(index, 0, data);
this.notifyDataAdd(index);
}
public pushData(data: string): void {
this.tabContent.push(data);
this.notifyDataAdd(this.tabContent.length - 1);
}
ResourceToString(resource:Resource):string{
return getContext(resource).resourceManager.getStringSync(resource)
}
}
|
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/model/DataModel.ets#L51-L79
|
650a507a4e55a55cf4e0ab81f82e74f24cce2439
|
gitee
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/CoreFile/UserFile/UserFileURI/entry/src/main/ets/common/PermissionUtils.ets
|
arkts
|
使用UIExtensionAbility:将common.UIAbilityContext 替换为common.UIExtensionContext
|
export function reqPermissionsFromUser(permissions: Permissions[], context: common.UIAbilityContext): void {
// 1. 创建应用权限管理器
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
// 2. 拉起弹框请求用户授权 requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗
atManager.requestPermissionsFromUser(context, permissions).then((data) => {
let grantStatus: number[] = data.authResults;
let length: number = grantStatus.length;
for (let i = 0; i < length; i++) {
if (grantStatus[i] === 0) {
// 用户授权,可以继续访问目标操作
promptAction.showToast({
message: 'permission succeed!', // 显示文本
})
} else {
// 用户拒绝授权,提示用户必须授权才能访问当前页面的功能,并引导用户到系统设置中打开相应的权限
promptAction.showToast({
message: 'user refused authorization!', // 显示文本
})
return;
}
}
// 授权成功
}).catch((err: BusinessError) => {
console.error(`Failed to request permissions from user. Code is ${err.code}, message is ${err.message}`);
})
}
|
AST#export_declaration#Left export AST#function_declaration#Left function reqPermissionsFromUser AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Permissions [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#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#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 { // 1. 创建应用权限管理器 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 // 2. 拉起弹框请求用户授权 requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗 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 atManager AST#expression#Right . requestPermissionsFromUser AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left permissions 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#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left grantStatus : 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#member_expression#Left AST#expression#Left data AST#expression#Right . authResults 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 length : 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 grantStatus 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#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#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left length AST#expression#Right AST#binary_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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left grantStatus AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_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 'permission succeed!' 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#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 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 'user refused authorization!' 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#block_statement#Right AST#for_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 ` Failed to request permissions from user. 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#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#function_declaration#Right AST#export_declaration#Right
|
export function reqPermissionsFromUser(permissions: Permissions[], context: common.UIAbilityContext): void {
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
atManager.requestPermissionsFromUser(context, permissions).then((data) => {
let grantStatus: number[] = data.authResults;
let length: number = grantStatus.length;
for (let i = 0; i < length; i++) {
if (grantStatus[i] === 0) {
promptAction.showToast({
message: 'permission succeed!',
})
} else {
promptAction.showToast({
message: 'user refused authorization!',
})
return;
}
}
}).catch((err: BusinessError) => {
console.error(`Failed to request permissions from user. Code is ${err.code}, message is ${err.message}`);
})
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/UserFile/UserFileURI/entry/src/main/ets/common/PermissionUtils.ets#L67-L92
|
f4c498a8164f78f23766aaf4fa24a782b7cecff9
|
gitee
|
|
openharmony/arkui_ace_engine
|
30c7d1ee12fbedf0fabece54291d75897e2ad44f
|
examples/Select/entry/src/main/ets/pages/components/checkbox/checkboxGroupIndicator.ets
|
arkts
|
CheckboxGroupIndicatorBuilder
|
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 CheckboxGroupIndicatorBuilder(name: string, param: Object) {
CheckboxGroupIndicatorExample()
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function CheckboxGroupIndicatorBuilder 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 CheckboxGroupIndicatorExample ( ) 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 CheckboxGroupIndicatorBuilder(name: string, param: Object) {
CheckboxGroupIndicatorExample()
}
|
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/checkbox/checkboxGroupIndicator.ets#L16-L19
|
eb909b8b52a9c776603c967072ba0d8bf51cf51d
|
gitee
|
huang7855196/ArkTs-iLearn.git
|
08590adaca7a58d5284416ba5cfc09117122af84
|
HomeModule/src/main/ets/components/HomeDayQuestionComp.ets
|
arkts
|
HomeDayQuestionComp
|
import { HmCalendar, HmCalendarType } from '@ohmos/calendar'
|
@Component
export struct HomeDayQuestionComp {
monthWords: string[] = [
"JAN",
"FEB",
"MAR",
"APR",
"MAY",
"JUN",
"JUL",
"AUG",
"SEP",
"OCT",
"NOV",
"DEC"
]
monthText: string = this.monthWords[new Date().getMonth()]
today: string = new Date().getDate().toString().padStart(2, '0')
build() {
Row() {
Row() {
Column() {
Text(this.monthText)
.fontColor('#fc3c30')
.fontSize(12)
.fontWeight(500)
.margin(4)
Text(this.today)
.fontSize(22)
}
.height(60)
.width(44)
.translate({ y: -10 })
.backgroundColor($r('app.color.white'))
.borderRadius(8)
.margin({ left: 12 })
//.shadow(ShadowStyle.OUTER_DEFAULT_LG)
.justifyContent(FlexAlign.Center)
Column() {
Text('每日 1 题')
.fontColor(14)
.fontSize(10)
.margin({ bottom: 8 })
Text('JS 闭包你是怎么理解的?')
.fontSize(12)
.fontWeight(FontWeight.Bold)
.textOverflow({
overflow: TextOverflow.Ellipsis
})
.maxLines(1)
}
.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
.padding({ left: 20 })
// HmCalendar({
// type: HmCalendarType.MONTH_DOT,
// selectedDays: [{ date: new Date().toString() }],
// color: 'green'
// })
// .margin({ right: 20 })
}
.width('100%')
.height(60)
.backgroundColor($r('app.color.home_gray'))
.borderRadius(8)
}
.padding(16)
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct HomeDayQuestionComp AST#component_body#Left { AST#property_declaration#Left monthWords : 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#ERROR#Left = AST#expression#Left AST#array_literal#Left [ AST#expression#Left "JAN" AST#expression#Right , AST#expression#Left "FEB" AST#expression#Right , AST#expression#Left "MAR" AST#expression#Right , AST#expression#Left "APR" AST#expression#Right , AST#expression#Left "MAY" AST#expression#Right , AST#expression#Left "JUN" AST#expression#Right , AST#expression#Left "JUL" AST#expression#Right , AST#expression#Left "AUG" AST#expression#Right , AST#expression#Left "SEP" AST#expression#Right , AST#expression#Left "OCT" AST#expression#Right , AST#expression#Left "NOV" AST#expression#Right , AST#expression#Left "DEC" AST#expression#Right ] AST#array_literal#Right AST#expression#Right month Text : string = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . monthWords AST#member_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#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 . getMonth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right today : string AST#ERROR#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#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 . 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#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 Row ( ) 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 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 this AST#expression#Right . monthText AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#fc3c30' AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left 500 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left 4 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 this AST#expression#Right . today AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 22 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 60 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 44 AST#expression#Right ) AST#modifier_chain_expression#Left . translate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 10 AST#expression#Right AST#unary_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.white' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) //.shadow(ShadowStyle.OUTER_DEFAULT_LG) 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#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 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 '每日 1 题' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 10 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 8 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'JS 闭包你是怎么理解的?' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right 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#Left . maxLines ( AST#expression#Left 1 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 . 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#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 20 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 // HmCalendar({ // type: HmCalendarType.MONTH_DOT, // selectedDays: [{ date: new Date().toString() }], // color: 'green' // }) // .margin({ right: 20 }) } 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 . height ( AST#expression#Left 60 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.home_gray' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 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 . padding ( AST#expression#Left 16 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 HomeDayQuestionComp {
monthWords: string[] = [
"JAN",
"FEB",
"MAR",
"APR",
"MAY",
"JUN",
"JUL",
"AUG",
"SEP",
"OCT",
"NOV",
"DEC"
]
monthText: string = this.monthWords[new Date().getMonth()]
today: string = new Date().getDate().toString().padStart(2, '0')
build() {
Row() {
Row() {
Column() {
Text(this.monthText)
.fontColor('#fc3c30')
.fontSize(12)
.fontWeight(500)
.margin(4)
Text(this.today)
.fontSize(22)
}
.height(60)
.width(44)
.translate({ y: -10 })
.backgroundColor($r('app.color.white'))
.borderRadius(8)
.margin({ left: 12 })
.justifyContent(FlexAlign.Center)
Column() {
Text('每日 1 题')
.fontColor(14)
.fontSize(10)
.margin({ bottom: 8 })
Text('JS 闭包你是怎么理解的?')
.fontSize(12)
.fontWeight(FontWeight.Bold)
.textOverflow({
overflow: TextOverflow.Ellipsis
})
.maxLines(1)
}
.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
.padding({ left: 20 })
}
.width('100%')
.height(60)
.backgroundColor($r('app.color.home_gray'))
.borderRadius(8)
}
.padding(16)
}
}
|
https://github.com/huang7855196/ArkTs-iLearn.git/blob/08590adaca7a58d5284416ba5cfc09117122af84/HomeModule/src/main/ets/components/HomeDayQuestionComp.ets#L3-L74
|
bc92aefebcd104e226bed78151ad05f0c16e3842
|
github
|
Rayawa/dashboard.git
|
9107efe7fb69a58d799a378b79ea8ffa4041cec8
|
entry/src/main/ets/pages/complex_share.ets
|
arkts
|
autoFillForm
|
自动填充表单(提取到信息后自动调用)
|
private autoFillForm() {
if (this.extractedApps.length === 0) {
return;
}
// 获取第一个应用信息
const app = this.extractedApps[0];
// 填充链接
if (app.link && !this.formData.appLink) {
this.formData.appLink = app.link;
}
// 填充包名
if (app.packageName && !this.formData.packageName) {
this.formData.packageName = app.packageName;
}
// 填充AppID
if (app.appID && !this.formData.appId) {
this.formData.appId = app.appID;
}
// 填充备注(如果有日期信息)
if (app.date && !this.formData.remark.includes(app.date)) {
if (this.formData.remark) {
this.formData.remark = `提取日期: ${app.date}\n${this.formData.remark}`;
} else {
this.formData.remark = `提取日期: ${app.date}`;
}
}
}
|
AST#method_declaration#Left private autoFillForm 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . extractedApps 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 app = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . extractedApps 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#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 AST#member_expression#Left AST#expression#Left app AST#expression#Right . link AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . formData AST#member_expression#Right AST#expression#Right . appLink 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . formData AST#member_expression#Right AST#expression#Right . appLink AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left app AST#expression#Right . link 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left app AST#expression#Right . packageName AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . formData AST#member_expression#Right AST#expression#Right . packageName 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . formData AST#member_expression#Right AST#expression#Right . packageName AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left app AST#expression#Right . packageName 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 // 填充AppID 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 AST#member_expression#Left AST#expression#Left app AST#expression#Right . appID AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . formData AST#member_expression#Right AST#expression#Right . appId 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . formData AST#member_expression#Right AST#expression#Right . appId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left app AST#expression#Right . appID 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#call_expression#Left AST#expression#Left AST#member_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 app AST#expression#Right . date AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . formData AST#member_expression#Right AST#expression#Right . remark AST#member_expression#Right AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left app AST#expression#Right . date AST#member_expression#Right 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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . formData AST#member_expression#Right AST#expression#Right . remark 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . formData AST#member_expression#Right AST#expression#Right . remark 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 app AST#expression#Right . date AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right \n 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 . formData AST#member_expression#Right AST#expression#Right . remark AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` 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 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . formData AST#member_expression#Right AST#expression#Right . remark 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 app AST#expression#Right . date AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private autoFillForm() {
if (this.extractedApps.length === 0) {
return;
}
const app = this.extractedApps[0];
if (app.link && !this.formData.appLink) {
this.formData.appLink = app.link;
}
if (app.packageName && !this.formData.packageName) {
this.formData.packageName = app.packageName;
}
if (app.appID && !this.formData.appId) {
this.formData.appId = app.appID;
}
if (app.date && !this.formData.remark.includes(app.date)) {
if (this.formData.remark) {
this.formData.remark = `提取日期: ${app.date}\n${this.formData.remark}`;
} else {
this.formData.remark = `提取日期: ${app.date}`;
}
}
}
|
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/pages/complex_share.ets#L502-L532
|
3034069212144e82ec5cc6e8ea354c40326a7ccb
|
github
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/model/src/main/ets/entity/SelectedGoods.ets
|
arkts
|
@file 已选商品项模型
用于规格选择后返回的数据,表示用户选择的单个商品规格项
@author Joker.X
|
export class SelectedGoods {
/**
* 商品ID
*/
goodsId: number = 0;
/**
* 商品信息
*/
goodsInfo?: Goods | null = null;
/**
* 规格
*/
spec?: GoodsSpec | null = null;
/**
* 数量
*/
count: number = 0;
/**
* @param {Partial<SelectedGoods>} init - 初始化数据
*/
constructor(init?: Partial<SelectedGoods>) {
if (!init) {
return;
}
this.goodsId = init.goodsId ?? this.goodsId;
this.goodsInfo = init.goodsInfo ?? this.goodsInfo;
this.spec = init.spec ?? this.spec;
this.count = init.count ?? this.count;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class SelectedGoods AST#class_body#Left { /**
* 商品ID
*/ AST#property_declaration#Left goodsId : 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 goodsInfo ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Goods 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 spec ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left GoodsSpec 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 count : 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 /**
* @param {Partial<SelectedGoods>} init - 初始化数据
*/ AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left init ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left SelectedGoods 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#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left init 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . goodsId 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 init AST#expression#Right . goodsId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_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 this AST#expression#Right . goodsInfo 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 init AST#expression#Right . goodsInfo AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . goodsInfo 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 this AST#expression#Right . spec 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 init AST#expression#Right . spec AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . spec 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 this AST#expression#Right . count 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 init AST#expression#Right . count AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right 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#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class SelectedGoods {
goodsId: number = 0;
goodsInfo?: Goods | null = null;
spec?: GoodsSpec | null = null;
count: number = 0;
constructor(init?: Partial<SelectedGoods>) {
if (!init) {
return;
}
this.goodsId = init.goodsId ?? this.goodsId;
this.goodsInfo = init.goodsInfo ?? this.goodsInfo;
this.spec = init.spec ?? this.spec;
this.count = init.count ?? this.count;
}
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/SelectedGoods.ets#L10-L40
|
79e269efb9577980e8ea7affa2f69839e03bda6f
|
github
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets
|
arkts
|
notifyDataDelete
|
通知LazyForEach组件需要在index对应索引处删除该子组件
@param {number} index - 索引值。
|
notifyDataDelete(index: double): 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 double 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: double): void {
this.listeners.forEach(listener => {
listener.onDataDelete(index);
})
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets#L128-L132
|
6e7d1725e03e144d1efd4bb76df291c24b8f8d29
|
gitee
|
wangjinyuan/JS-TS-ArkTS-database.git
|
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
|
npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildDelete.ets
|
arkts
|
scheduleForDeletion
|
应用约束10: 显式指定参数类型
|
private scheduleForDeletion(id: string): void {
// 应用约束30: 使用as进行类型断言
this.client.setTimeout(
() => this.deleted.delete(id),
this.client.options.restWsBridgeTimeout as number
);
}
|
AST#method_declaration#Left private scheduleForDeletion AST#parameter_list#Left ( AST#parameter#Left id : 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 { // 应用约束30: 使用as进行类型断言 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 . client AST#member_expression#Right AST#expression#Right . setTimeout 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 AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . deleted AST#member_expression#Right AST#expression#Right . delete 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#arrow_function#Right AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_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 . options AST#member_expression#Right AST#expression#Right . restWsBridgeTimeout AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#as_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
|
private scheduleForDeletion(id: string): void {
this.client.setTimeout(
() => this.deleted.delete(id),
this.client.options.restWsBridgeTimeout as number
);
}
|
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildDelete.ets#L59-L65
|
1fad3d011d637c8ec8f77f5c4457424e475a72e0
|
github
|
jjjjjjava/ffmpeg_tools.git
|
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
|
src/main/ets/ffmpeg/FFmpegCommandBuilder.ets
|
arkts
|
FFmpeg 命令构建器
链式 API 构建复杂的 FFmpeg 命令,供高级用户定制使用
@author panruiqi
@version 2.0.0
FFmpeg 命令构建器
@example
```typescript
const cmd = new FFmpegCommandBuilder()
.input('/path/to/input.mp4')
.hwaccel()
.filter('scale=1280:720')
.videoCodec('libx264')
.videoBitrate('2M')
.output('/path/to/output.mp4')
.build();
```
|
export class FFmpegCommandBuilder {
private static readonly HW_CODEC: string = 'h264_ohosavcodec';
private inputFiles: string[] = [];
private outputPath: string = '';
private useHwDecode: boolean = false;
private useHwEncode: boolean = false;
private filters: string[] = [];
private vCodec: string = '';
private aCodec: string = '';
private vBitrate: string = '';
private aBitrate: string = '';
private presetValue: string = '';
private crfValue: number = -1;
private formatValue: string = '';
private durationValue: string = '';
private startTimeValue: string = '';
private extraArgs: string[] = [];
/** 添加输入文件 */
public input(path: string): FFmpegCommandBuilder {
this.inputFiles.push(path);
return this;
}
/** 设置输出文件 */
public output(path: string): FFmpegCommandBuilder {
this.outputPath = path;
return this;
}
/** 启用硬件加速(硬解+硬编) */
public hwaccel(): FFmpegCommandBuilder {
this.useHwDecode = true;
this.useHwEncode = true;
return this;
}
/** 启用硬件解码 */
public hwDecode(): FFmpegCommandBuilder {
this.useHwDecode = true;
return this;
}
/** 启用硬件编码 */
public hwEncode(): FFmpegCommandBuilder {
this.useHwEncode = true;
return this;
}
/** 添加视频滤镜 */
public filter(filterExpr: string): FFmpegCommandBuilder {
this.filters.push(filterExpr);
return this;
}
/** 设置视频编码器 */
public videoCodec(codec: string): FFmpegCommandBuilder {
this.vCodec = codec;
return this;
}
/** 设置音频编码器 */
public audioCodec(codec: string): FFmpegCommandBuilder {
this.aCodec = codec;
return this;
}
/** 设置视频码率 */
public videoBitrate(bitrate: string): FFmpegCommandBuilder {
this.vBitrate = bitrate;
return this;
}
/** 设置音频码率 */
public audioBitrate(bitrate: string): FFmpegCommandBuilder {
this.aBitrate = bitrate;
return this;
}
/** 设置 x264 预设 */
public preset(value: string): FFmpegCommandBuilder {
this.presetValue = value;
return this;
}
/** 设置 CRF 质量 */
public crf(value: number): FFmpegCommandBuilder {
this.crfValue = value;
return this;
}
/** 设置输出格式 */
public format(fmt: string): FFmpegCommandBuilder {
this.formatValue = fmt;
return this;
}
/** 设置开始时间 */
public startTime(time: string): FFmpegCommandBuilder {
this.startTimeValue = time;
return this;
}
/** 设置持续时长 */
public duration(time: string): FFmpegCommandBuilder {
this.durationValue = time;
return this;
}
/** 视频缩放 */
public scale(width: number, height: number): FFmpegCommandBuilder {
return this.filter(`scale=${width}:${height}`);
}
/** 帧率设置 */
public fps(value: number): FFmpegCommandBuilder {
return this.filter(`fps=${value}`);
}
/** 添加额外参数 */
public arg(key: string, value?: string): FFmpegCommandBuilder {
this.extraArgs.push(key);
if (value !== undefined) {
this.extraArgs.push(value);
}
return this;
}
/** 构建命令数组 */
public build(): string[] {
if (this.inputFiles.length === 0) {
throw new Error('At least one input is required');
}
if (this.outputPath === '') {
throw new Error('Output path is required');
}
const cmd: string[] = ['ffmpeg'];
// 硬解码
if (this.useHwDecode) {
cmd.push('-c:v', FFmpegCommandBuilder.HW_CODEC);
}
// 开始时间
if (this.startTimeValue !== '') {
cmd.push('-ss', this.startTimeValue);
}
// 输入文件
for (let i = 0; i < this.inputFiles.length; i++) {
cmd.push('-i', this.inputFiles[i]);
}
// 持续时长
if (this.durationValue !== '') {
cmd.push('-t', this.durationValue);
}
// 视频滤镜
if (this.filters.length > 0) {
cmd.push('-vf', this.filters.join(','));
}
// 视频编码
if (this.useHwEncode) {
cmd.push('-c:v', FFmpegCommandBuilder.HW_CODEC);
} else if (this.vCodec !== '') {
cmd.push('-c:v', this.vCodec);
}
// 视频码率
if (this.vBitrate !== '') {
cmd.push('-b:v', this.vBitrate);
}
// CRF
if (this.crfValue >= 0) {
cmd.push('-crf', this.crfValue.toString());
}
// 预设
if (this.presetValue !== '') {
cmd.push('-preset', this.presetValue);
}
// 音频编码
if (this.aCodec !== '') {
cmd.push('-c:a', this.aCodec);
}
// 音频码率
if (this.aBitrate !== '') {
cmd.push('-b:a', this.aBitrate);
}
// 输出格式
if (this.formatValue !== '') {
cmd.push('-f', this.formatValue);
}
// 额外参数
for (let i = 0; i < this.extraArgs.length; i++) {
cmd.push(this.extraArgs[i]);
}
// 覆盖输出
cmd.push('-y', this.outputPath);
return cmd;
}
/** 构建命令字符串(调试用) */
public buildString(): string {
return this.build().join(' ');
}
/** 重置构建器 */
public reset(): FFmpegCommandBuilder {
this.inputFiles = [];
this.outputPath = '';
this.useHwDecode = false;
this.useHwEncode = false;
this.filters = [];
this.vCodec = '';
this.aCodec = '';
this.vBitrate = '';
this.aBitrate = '';
this.presetValue = '';
this.crfValue = -1;
this.formatValue = '';
this.durationValue = '';
this.startTimeValue = '';
this.extraArgs = [];
return this;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class FFmpegCommandBuilder AST#class_body#Left { AST#property_declaration#Left private static readonly HW_CODEC : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'h264_ohosavcodec' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private inputFiles : 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#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private outputPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private useHwDecode : 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 private useHwEncode : 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 private filters : 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#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private vCodec : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private aCodec : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private vBitrate : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private aBitrate : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private presetValue : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private crfValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private formatValue : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private durationValue : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private startTimeValue : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private extraArgs : 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#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right /** 添加输入文件 */ AST#method_declaration#Left public input AST#parameter_list#Left ( AST#parameter#Left path : 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 FFmpegCommandBuilder 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputFiles AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right 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#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 output AST#parameter_list#Left ( AST#parameter#Left path : 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 FFmpegCommandBuilder 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 . outputPath AST#member_expression#Right = AST#expression#Left path 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 hwaccel AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FFmpegCommandBuilder 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 . useHwDecode 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . useHwEncode 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 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 /** 启用硬件解码 */ AST#method_declaration#Left public hwDecode AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FFmpegCommandBuilder 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 . useHwDecode 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 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 hwEncode AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FFmpegCommandBuilder 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 . useHwEncode 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 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 filter AST#parameter_list#Left ( AST#parameter#Left filterExpr : 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 FFmpegCommandBuilder 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . filters AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filterExpr 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 this AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** 设置视频编码器 */ AST#method_declaration#Left public videoCodec AST#parameter_list#Left ( AST#parameter#Left codec : 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 FFmpegCommandBuilder 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 . vCodec AST#member_expression#Right = AST#expression#Left codec 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 audioCodec AST#parameter_list#Left ( AST#parameter#Left codec : 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 FFmpegCommandBuilder 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 . aCodec AST#member_expression#Right = AST#expression#Left codec 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 videoBitrate AST#parameter_list#Left ( AST#parameter#Left bitrate : 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 FFmpegCommandBuilder 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 . vBitrate AST#member_expression#Right = AST#expression#Left bitrate 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 audioBitrate AST#parameter_list#Left ( AST#parameter#Left bitrate : 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 FFmpegCommandBuilder 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 . aBitrate AST#member_expression#Right = AST#expression#Left bitrate 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 /** 设置 x264 预设 */ AST#method_declaration#Left public preset 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#type_annotation#Left AST#primary_type#Left FFmpegCommandBuilder 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 . presetValue 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#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 /** 设置 CRF 质量 */ AST#method_declaration#Left public crf 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_list#Right : AST#type_annotation#Left AST#primary_type#Left FFmpegCommandBuilder 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 . crfValue 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#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 format AST#parameter_list#Left ( AST#parameter#Left fmt : 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 FFmpegCommandBuilder 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 . formatValue AST#member_expression#Right = AST#expression#Left fmt 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 startTime AST#parameter_list#Left ( AST#parameter#Left time : 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 FFmpegCommandBuilder 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 . startTimeValue AST#member_expression#Right = AST#expression#Left time 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 duration AST#parameter_list#Left ( AST#parameter#Left time : 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 FFmpegCommandBuilder 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 . durationValue AST#member_expression#Right = AST#expression#Left time 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 scale AST#parameter_list#Left ( AST#parameter#Left width : AST#type_annotation#Left AST#primary_type#Left number 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 FFmpegCommandBuilder 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 this AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` scale= AST#template_substitution#Left $ { AST#expression#Left width AST#expression#Right } AST#template_substitution#Right : AST#template_substitution#Left $ { AST#expression#Left height 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** 帧率设置 */ AST#method_declaration#Left public fps 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_list#Right : AST#type_annotation#Left AST#primary_type#Left FFmpegCommandBuilder 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 this AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` fps= AST#template_substitution#Left $ { AST#expression#Left value 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** 添加额外参数 */ AST#method_declaration#Left public arg AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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#type_annotation#Left AST#primary_type#Left FFmpegCommandBuilder 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 . extraArgs AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key 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#binary_expression#Left AST#expression#Left value AST#expression#Right !== AST#expression#Left undefined 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . extraArgs AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left value 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#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 /** 构建命令数组 */ AST#method_declaration#Left public build AST#parameter_list#Left ( ) AST#parameter_list#Right : 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#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 . inputFiles 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#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 'At least one input is required' 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#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 . outputPath 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#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 'Output path is required' 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 cmd : 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#expression#Left AST#array_literal#Left [ AST#expression#Left 'ffmpeg' 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . useHwDecode 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 cmd AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '-c:v' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left FFmpegCommandBuilder AST#expression#Right . HW_CODEC 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . startTimeValue 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cmd AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '-ss' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . startTimeValue 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#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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . inputFiles 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 i AST#expression#Right ++ AST#update_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 cmd AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '-i' AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputFiles AST#member_expression#Right AST#expression#Right [ AST#expression#Left i 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#block_statement#Right AST#for_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 this AST#expression#Right . durationValue 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cmd AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '-t' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . durationValue 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . filters 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cmd AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '-vf' 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 this AST#expression#Right . filters AST#member_expression#Right 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#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 . useHwEncode 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 cmd AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '-c:v' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left FFmpegCommandBuilder AST#expression#Right . HW_CODEC 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 else 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 . vCodec 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cmd AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '-c:v' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vCodec 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#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 this AST#expression#Right . vBitrate 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cmd AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '-b:v' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vBitrate 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 // CRF 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 . crfValue 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cmd AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '-crf' 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 this AST#expression#Right . crfValue 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#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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . presetValue 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cmd AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '-preset' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . presetValue 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . aCodec 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cmd AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '-c:a' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . aCodec 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . aBitrate 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cmd AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '-b:a' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . aBitrate 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . formatValue 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cmd AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '-f' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . formatValue 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#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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . extraArgs 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 i AST#expression#Right ++ AST#update_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 cmd AST#expression#Right . push 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 this AST#expression#Right . extraArgs AST#member_expression#Right AST#expression#Right [ AST#expression#Left i 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#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 cmd AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '-y' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . outputPath 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#return_statement#Left return AST#expression#Left cmd AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** 构建命令字符串(调试用) */ AST#method_declaration#Left public buildString AST#parameter_list#Left ( ) 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 this AST#expression#Right . build AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** 重置构建器 */ AST#method_declaration#Left public reset AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FFmpegCommandBuilder 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 . inputFiles 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . outputPath AST#member_expression#Right = AST#expression#Left '' 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 . useHwDecode 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . useHwEncode 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . filters 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vCodec AST#member_expression#Right = AST#expression#Left '' 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 . aCodec AST#member_expression#Right = AST#expression#Left '' 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 . vBitrate AST#member_expression#Right = AST#expression#Left '' 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 . aBitrate AST#member_expression#Right = AST#expression#Left '' 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 . presetValue AST#member_expression#Right = AST#expression#Left '' 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 . crfValue AST#member_expression#Right = AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_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 . formatValue AST#member_expression#Right = AST#expression#Left '' 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 . durationValue AST#member_expression#Right = AST#expression#Left '' 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 . startTimeValue AST#member_expression#Right = AST#expression#Left '' 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 . extraArgs 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#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 } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class FFmpegCommandBuilder {
private static readonly HW_CODEC: string = 'h264_ohosavcodec';
private inputFiles: string[] = [];
private outputPath: string = '';
private useHwDecode: boolean = false;
private useHwEncode: boolean = false;
private filters: string[] = [];
private vCodec: string = '';
private aCodec: string = '';
private vBitrate: string = '';
private aBitrate: string = '';
private presetValue: string = '';
private crfValue: number = -1;
private formatValue: string = '';
private durationValue: string = '';
private startTimeValue: string = '';
private extraArgs: string[] = [];
public input(path: string): FFmpegCommandBuilder {
this.inputFiles.push(path);
return this;
}
public output(path: string): FFmpegCommandBuilder {
this.outputPath = path;
return this;
}
public hwaccel(): FFmpegCommandBuilder {
this.useHwDecode = true;
this.useHwEncode = true;
return this;
}
public hwDecode(): FFmpegCommandBuilder {
this.useHwDecode = true;
return this;
}
public hwEncode(): FFmpegCommandBuilder {
this.useHwEncode = true;
return this;
}
public filter(filterExpr: string): FFmpegCommandBuilder {
this.filters.push(filterExpr);
return this;
}
public videoCodec(codec: string): FFmpegCommandBuilder {
this.vCodec = codec;
return this;
}
public audioCodec(codec: string): FFmpegCommandBuilder {
this.aCodec = codec;
return this;
}
public videoBitrate(bitrate: string): FFmpegCommandBuilder {
this.vBitrate = bitrate;
return this;
}
public audioBitrate(bitrate: string): FFmpegCommandBuilder {
this.aBitrate = bitrate;
return this;
}
public preset(value: string): FFmpegCommandBuilder {
this.presetValue = value;
return this;
}
public crf(value: number): FFmpegCommandBuilder {
this.crfValue = value;
return this;
}
public format(fmt: string): FFmpegCommandBuilder {
this.formatValue = fmt;
return this;
}
public startTime(time: string): FFmpegCommandBuilder {
this.startTimeValue = time;
return this;
}
public duration(time: string): FFmpegCommandBuilder {
this.durationValue = time;
return this;
}
public scale(width: number, height: number): FFmpegCommandBuilder {
return this.filter(`scale=${width}:${height}`);
}
public fps(value: number): FFmpegCommandBuilder {
return this.filter(`fps=${value}`);
}
public arg(key: string, value?: string): FFmpegCommandBuilder {
this.extraArgs.push(key);
if (value !== undefined) {
this.extraArgs.push(value);
}
return this;
}
public build(): string[] {
if (this.inputFiles.length === 0) {
throw new Error('At least one input is required');
}
if (this.outputPath === '') {
throw new Error('Output path is required');
}
const cmd: string[] = ['ffmpeg'];
if (this.useHwDecode) {
cmd.push('-c:v', FFmpegCommandBuilder.HW_CODEC);
}
if (this.startTimeValue !== '') {
cmd.push('-ss', this.startTimeValue);
}
for (let i = 0; i < this.inputFiles.length; i++) {
cmd.push('-i', this.inputFiles[i]);
}
if (this.durationValue !== '') {
cmd.push('-t', this.durationValue);
}
if (this.filters.length > 0) {
cmd.push('-vf', this.filters.join(','));
}
if (this.useHwEncode) {
cmd.push('-c:v', FFmpegCommandBuilder.HW_CODEC);
} else if (this.vCodec !== '') {
cmd.push('-c:v', this.vCodec);
}
if (this.vBitrate !== '') {
cmd.push('-b:v', this.vBitrate);
}
if (this.crfValue >= 0) {
cmd.push('-crf', this.crfValue.toString());
}
if (this.presetValue !== '') {
cmd.push('-preset', this.presetValue);
}
if (this.aCodec !== '') {
cmd.push('-c:a', this.aCodec);
}
if (this.aBitrate !== '') {
cmd.push('-b:a', this.aBitrate);
}
if (this.formatValue !== '') {
cmd.push('-f', this.formatValue);
}
for (let i = 0; i < this.extraArgs.length; i++) {
cmd.push(this.extraArgs[i]);
}
cmd.push('-y', this.outputPath);
return cmd;
}
public buildString(): string {
return this.build().join(' ');
}
public reset(): FFmpegCommandBuilder {
this.inputFiles = [];
this.outputPath = '';
this.useHwDecode = false;
this.useHwEncode = false;
this.filters = [];
this.vCodec = '';
this.aCodec = '';
this.vBitrate = '';
this.aBitrate = '';
this.presetValue = '';
this.crfValue = -1;
this.formatValue = '';
this.durationValue = '';
this.startTimeValue = '';
this.extraArgs = [];
return this;
}
}
|
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegCommandBuilder.ets#L24-L261
|
3f3c0c241430c010491f59c1e744d9cf0aeeb4a5
|
github
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/textoverflow/src/main/ets/components/model/TextFlowMode.ets
|
arkts
|
设定需要动态监听的model,以便于添加评论时,实现数据的动态监听从而进行lazyForeach懒加载。
|
export class CommentData extends BasicDataSource {
// 懒加载数据
private comments: Array<CommentModel> = [];
// 获取懒加载数据源的数据长度
totalCount(): number {
return this.comments.length;
}
// 获取指定数据项
getData(index: number): CommentModel {
return this.comments[index];
}
// 获取指定数据项
getParentData(parentId: string): CommentModel | null {
for (let i = 0; i < this.comments.length; i++) {
if (this.comments[i].id === parentId) {
return this.comments[i];
}
}
return null;
}
// 存储数据到懒加载数据源中
pushData(data: CommentModel): void {
this.comments.push(data);
// 在数组头部添加数据
this.notifyDataAdd(this.comments.length - 1);
}
addDataFirst(data: CommentModel): void {
this.comments.unshift(data);
// 在数组头部添加数据
this.notifyDataAdd(0);
}
indexOf(data:CommentModel): number {
return this.comments.indexOf(data);
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class CommentData extends AST#type_annotation#Left AST#primary_type#Left BasicDataSource AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { // 懒加载数据 AST#property_declaration#Left private comments : 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 CommentModel 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#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 获取懒加载数据源的数据长度 AST#method_declaration#Left totalCount 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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . comments AST#member_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 // 获取指定数据项 AST#method_declaration#Left getData 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 CommentModel AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . comments AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // 获取指定数据项 AST#method_declaration#Left getParentData AST#parameter_list#Left ( AST#parameter#Left parentId : 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#union_type#Left AST#primary_type#Left CommentModel AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . comments 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 i 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#binary_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 this AST#expression#Right . comments AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right === AST#expression#Left parentId 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#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . comments AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#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#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // 存储数据到懒加载数据源中 AST#method_declaration#Left pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left CommentModel 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 . comments AST#member_expression#Right AST#expression#Right . push 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataAdd 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 . comments 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#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left addDataFirst AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left CommentModel 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 . comments AST#member_expression#Right AST#expression#Right . unshift 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataAdd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 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 AST#method_declaration#Left indexOf AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left CommentModel 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#member_expression#Left AST#expression#Left this AST#expression#Right . comments AST#member_expression#Right AST#expression#Right . indexOf 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#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 CommentData extends BasicDataSource {
private comments: Array<CommentModel> = [];
totalCount(): number {
return this.comments.length;
}
getData(index: number): CommentModel {
return this.comments[index];
}
getParentData(parentId: string): CommentModel | null {
for (let i = 0; i < this.comments.length; i++) {
if (this.comments[i].id === parentId) {
return this.comments[i];
}
}
return null;
}
pushData(data: CommentModel): void {
this.comments.push(data);
this.notifyDataAdd(this.comments.length - 1);
}
addDataFirst(data: CommentModel): void {
this.comments.unshift(data);
this.notifyDataAdd(0);
}
indexOf(data:CommentModel): number {
return this.comments.indexOf(data);
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/textoverflow/src/main/ets/components/model/TextFlowMode.ets#L115-L155
|
e205f24c6e9aa14e3fb261524a2aeb3dbb5c01e2
|
gitee
|
|
anhao0226/harmony-music-player.git
|
4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073
|
entry/src/main/ets/view_models/ArtistDetailModel.ets
|
arkts
|
ArtistMvModel
|
export class ArtistMvModel {
id: number;
name: string;
imgurl: string;
duration: number;
publishTime: number;
imgurl16v9: string;
formJson(json: any): ArtistMvModel {
this.id = json['id'];
this.name = json['name'];
this.imgurl = json['imgurl'];
this.duration = json['duration'];
this.publishTime = json['duration'];
this.imgurl16v9 = json['imgurl16v9'];
return this;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class ArtistMvModel AST#class_body#Left { AST#property_declaration#Left id : 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 name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left imgurl : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left duration : 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 publishTime : 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 imgurl16v9 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#method_declaration#Left formJson AST#parameter_list#Left ( AST#parameter#Left json : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ArtistMvModel 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 . id AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left json AST#expression#Right [ AST#expression#Left 'id' AST#expression#Right ] AST#subscript_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 . name AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left json AST#expression#Right [ AST#expression#Left 'name' AST#expression#Right ] AST#subscript_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 . imgurl AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left json AST#expression#Right [ AST#expression#Left 'imgurl' AST#expression#Right ] AST#subscript_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 . duration AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left json AST#expression#Right [ AST#expression#Left 'duration' AST#expression#Right ] AST#subscript_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 . publishTime AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left json AST#expression#Right [ AST#expression#Left 'duration' AST#expression#Right ] AST#subscript_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 . imgurl16v9 AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left json AST#expression#Right [ AST#expression#Left 'imgurl16v9' AST#expression#Right ] AST#subscript_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 this AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class ArtistMvModel {
id: number;
name: string;
imgurl: string;
duration: number;
publishTime: number;
imgurl16v9: string;
formJson(json: any): ArtistMvModel {
this.id = json['id'];
this.name = json['name'];
this.imgurl = json['imgurl'];
this.duration = json['duration'];
this.publishTime = json['duration'];
this.imgurl16v9 = json['imgurl16v9'];
return this;
}
}
|
https://github.com/anhao0226/harmony-music-player.git/blob/4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073/entry/src/main/ets/view_models/ArtistDetailModel.ets#L55-L72
|
c1ca6c2dfe69c01c9235e314aef17bb99ab55170
|
github
|
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/data/BarDataSet.ets
|
arkts
|
getGradients
|
This method is deprecated.
Use getFills() instead.
|
public getGradients(): JList<Fill> | null {
return this.mFills;
}
|
AST#method_declaration#Left public getGradients AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left JList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Fill AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_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 this AST#expression#Right . mFills AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public getGradients(): JList<Fill> | null {
return this.mFills;
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BarDataSet.ets#L93-L95
|
dfff5174aef5043005f816aac56fa82ea1a52933
|
gitee
|
wcmzllx/axis-render
|
34a330085691968cf1c132095e5ce078aa7ee933
|
AxisRenderLibrary/src/main/ets/common/AxisRender.ets
|
arkts
|
setCallBackInterval
|
设置回调间隔, 以小格子为单位,默认1/10小刻度回调一次
示例:0.2 ,即2/10刻度回调一次
@param interval 回调间隔
|
setCallBackInterval(interval: number) {
this.getInstance().setCallBackInterval(interval)
}
|
AST#method_declaration#Left setCallBackInterval AST#parameter_list#Left ( AST#parameter#Left interval : 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#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 this AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . setCallBackInterval AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left interval 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
|
setCallBackInterval(interval: number) {
this.getInstance().setCallBackInterval(interval)
}
|
https://github.com/wcmzllx/axis-render/blob/34a330085691968cf1c132095e5ce078aa7ee933/AxisRenderLibrary/src/main/ets/common/AxisRender.ets#L338-L340
|
7b2ce58655d1e0606a3ae92d6a45aa4f90a1a56b
|
gitee
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/hosts/bunch_of_tabs.ets
|
arkts
|
update_loading_progress
|
Asks the tab to update its loading progress, usually called in the tab's loading progress.
|
update_loading_progress(progress: number) {
this.loading_progress = progress;
return progress;
}
|
AST#method_declaration#Left update_loading_progress 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#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 . loading_progress AST#member_expression#Right = AST#expression#Left progress 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 progress AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
update_loading_progress(progress: number) {
this.loading_progress = progress;
return progress;
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L856-L859
|
dcef064998af35a7ea1cc2742ecf9cdf5607b639
|
gitee
|
openharmony/update_update_app
|
0157b7917e2f48e914b5585991e8b2f4bc25108a
|
feature/ota/src/main/ets/manager/OtaUpdateManager.ets
|
arkts
|
getStateObj
|
取状态对象
@param status 状态
|
getStateObj(status: number): BaseState {
if (this.stateObj?.state === status) {
return this.stateObj;
} else {
return StateManager.createInstance(status);
}
}
|
AST#method_declaration#Left getStateObj AST#parameter_list#Left ( AST#parameter#Left status : 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 BaseState 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 . stateObj AST#member_expression#Right AST#expression#Right ?. state AST#member_expression#Right AST#expression#Right === AST#expression#Left status 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#member_expression#Left AST#expression#Left this AST#expression#Right . stateObj AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else 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 StateManager AST#expression#Right . createInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left status 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getStateObj(status: number): BaseState {
if (this.stateObj?.state === status) {
return this.stateObj;
} else {
return StateManager.createInstance(status);
}
}
|
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/OtaUpdateManager.ets#L271-L277
|
687378f86689ece29b69a48fb8ad4fe419a49a05
|
gitee
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/module_city_select/src/main/ets/common/Utils.ets
|
arkts
|
日志类
|
export class Logger {
private static domain: number;
private static prefix: string;
private static format: string = '%{public}s';
constructor(prefix: string = '[HouseholdTemplate]', domain: number = 0xFF00) {
Logger.prefix = prefix;
Logger.domain = domain;
}
static debug(...args: Object[]): void {
hilog.debug(Logger.domain, Logger.prefix, Logger.format, args);
}
static info(...args: Object[]): void {
hilog.info(Logger.domain, Logger.prefix, Logger.format, args);
}
static warn(...args: Object[]): void {
hilog.warn(Logger.domain, Logger.prefix, Logger.format, args);
}
static error(...args: Object[]): void {
hilog.error(Logger.domain, Logger.prefix, Logger.format, args);
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class Logger AST#class_body#Left { AST#property_declaration#Left private static domain : 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 private static prefix : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private static format : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '%{public}s' AST#expression#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left prefix : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '[HouseholdTemplate]' AST#expression#Right AST#parameter#Right , AST#parameter#Left domain : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0xFF00 AST#expression#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 Logger AST#expression#Right . prefix AST#member_expression#Right = AST#expression#Left prefix 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 Logger AST#expression#Right . domain AST#member_expression#Right = AST#expression#Left domain AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right AST#method_declaration#Left static debug AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Object [ ] 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . domain AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . prefix AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left Logger 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 AST#method_declaration#Left static info AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Object [ ] 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 . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . domain AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . prefix AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left Logger 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 AST#method_declaration#Left static warn AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Object [ ] 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 . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . domain AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . prefix AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left Logger 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 AST#method_declaration#Left static error AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Object [ ] 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 Logger AST#expression#Right . domain AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . prefix AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left Logger 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 } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class Logger {
private static domain: number;
private static prefix: string;
private static format: string = '%{public}s';
constructor(prefix: string = '[HouseholdTemplate]', domain: number = 0xFF00) {
Logger.prefix = prefix;
Logger.domain = domain;
}
static debug(...args: Object[]): void {
hilog.debug(Logger.domain, Logger.prefix, Logger.format, args);
}
static info(...args: Object[]): void {
hilog.info(Logger.domain, Logger.prefix, Logger.format, args);
}
static warn(...args: Object[]): void {
hilog.warn(Logger.domain, Logger.prefix, Logger.format, args);
}
static error(...args: Object[]): void {
hilog.error(Logger.domain, Logger.prefix, Logger.format, args);
}
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/module_city_select/src/main/ets/common/Utils.ets#L32-L57
|
6cee6198959bb7d81dbb186ef46553ce70b35660
|
github
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/editaddress/src/main/ets/common/CommonConstants.ets
|
arkts
|
Common constants for common component.
|
export default class CommonConstants {
// opacity
static readonly FIRST_LEVEL_OPACITY: number = 0.9;
static readonly SECOND_LEVEL_OPACITY: number = 0.6;
static readonly HALF_OPACITY: number = 0.5;
// space
static readonly SPACE_4: number = 4;
static readonly SPACE_8: number = 8;
static readonly SPACE_12: number = 12;
// maxLines
static readonly MAX_LINE_ONE: number = 1;
static readonly MAX_LINE_TWO: number = 2;
// percent
static readonly FULL_PERCENT: string = '100%';
// layout weight
static readonly LAYOUT_WEIGHT: number = 1;
// font weight
static readonly LABEL_FONT_WEIGHT: number = 300
static readonly HALF_FONT_WEIGHT: number = 450;
static readonly LABEL_BUBBLE_FONT_WEIGHT: number = 700;
static readonly PLACE_HOLDER_FONT_WEIGHT: number = 400;
// height
static readonly LIST_ITEM_HEIGHT: number = 400;
static readonly LIST_ITEM_HEIGHT_TWO: number = 130;
static readonly LIST_HEIGHT: number = 1755;
static readonly ROW_HEIGHT: number = 150;
static readonly LIST_ITEM_ROW_HEIGHT: number = 40;
static readonly AVOID_AREA_HEIGHT: number = 500;
static readonly BUBBLE_AREA_HEIGHT: number = 36;
static readonly BUBBLE_CHECK_HEIGHT: number = 15;
static readonly TEXT_HEIGHT: number = 30;
static readonly ROW_HEIGHT_TWO: number = 30;
static readonly ROW_HEIGHT_THREE: number = 30;
static readonly BUTTON_HEIGHT: number = 40;
static readonly ROW_HEIGHT_FOUR: number = 40;
static readonly TEXT_AREA_HEIGHT: number = 70;
static readonly STACK_HEIGHT: number = 80;
static readonly STACK_HEIGHT_TWO: number = 40;
static readonly TEXT_INPUT_HEIGHT: number = 80;
static readonly IMAGE_HEIGHT: number = 15;
static readonly IMAGE_HEIGHT_TWO: number = 18;
// border width
static readonly BORDER_WIDTH: number = 1;
static readonly BORDER_RADIUS: number = 24;
static readonly BORDER_RADIUS_TWO: number = 30;
static readonly BORDER_RADIUS_THREE: number = 10;
static readonly BUBBLE_BORDER_RADIUS: number = 55;
static readonly BUBBLE_BORDER_RADIUS_TWO: number = 10;
// aspect ratio
static readonly IMAGE_ASPECT_RATIO_ONE: number = 1;
static readonly IMAGE_ASPECT_RATIO_ONE_POINT_SIX: number = 1.6;
// fontsize
static readonly LABEL_NAME_FONTSIZE: number = 16;
static readonly LABEL_FONTSIZE: number = 13;
static readonly HALF_FONTSIZE: number = 18;
static readonly HALF_FONTSIZE_TITLE: number = 19;
static readonly TEXT_FONTSIZE: number = 18;
static readonly BUBBLE_FONTSIZE: number = 12;
static readonly PLACE_HOLDER_FONTSIZE: number = 14;
static readonly BUBBLE_CHECK_FONTSIZE: number = 10;
// size
static readonly HALF_PADDING_BOTTOM: number = 15;
static readonly PADDING_TOP: number = 20;
static readonly PADDING_TOP_TWO: number = 10;
static readonly PADDING_BOTTOM: number = 5;
static readonly PADDING_LEFT: number = 13;
static readonly PADDING_LEFT_TWO: number = 5;
static readonly PADDING_RIGHT: number = 8;
static readonly PADDING: number = 15;
static readonly MARGIN_TOP: number = 10;
static readonly MARGIN_TOP_TWO: number = 25;
static readonly MARGIN_TOP_THREE: number = 45;
static readonly MARGIN_TOP_FOUR: number = 55;
static readonly MARGIN_LEFT: number = 20;
static readonly MARGIN_LEFT_TWO: number = 35;
static readonly MARGIN_LEFT_THREE: number = 5;
static readonly MARGIN_RIGHT: number = 15;
static readonly MARGIN_RIGHT_TWO: number = 5;
}
|
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { // opacity AST#property_declaration#Left static readonly FIRST_LEVEL_OPACITY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.9 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly SECOND_LEVEL_OPACITY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.6 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly HALF_OPACITY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.5 AST#expression#Right ; AST#property_declaration#Right // space AST#property_declaration#Left static readonly SPACE_4 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 4 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly SPACE_8 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 8 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly SPACE_12 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 12 AST#expression#Right ; AST#property_declaration#Right // maxLines AST#property_declaration#Left static readonly MAX_LINE_ONE : 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#property_declaration#Right AST#property_declaration#Left static readonly MAX_LINE_TWO : 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#property_declaration#Right // percent AST#property_declaration#Left static readonly FULL_PERCENT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right // layout weight AST#property_declaration#Left static readonly LAYOUT_WEIGHT : 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#property_declaration#Right // font weight AST#property_declaration#Left static readonly LABEL_FONT_WEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 300 AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly HALF_FONT_WEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 450 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly LABEL_BUBBLE_FONT_WEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 700 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly PLACE_HOLDER_FONT_WEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 400 AST#expression#Right ; AST#property_declaration#Right // height AST#property_declaration#Left static readonly LIST_ITEM_HEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 400 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly LIST_ITEM_HEIGHT_TWO : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 130 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly LIST_HEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1755 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly ROW_HEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 150 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly LIST_ITEM_ROW_HEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 40 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly AVOID_AREA_HEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 500 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly BUBBLE_AREA_HEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 36 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly BUBBLE_CHECK_HEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 15 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly TEXT_HEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 30 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly ROW_HEIGHT_TWO : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 30 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly ROW_HEIGHT_THREE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 30 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly BUTTON_HEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 40 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly ROW_HEIGHT_FOUR : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 40 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly TEXT_AREA_HEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 70 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly STACK_HEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 80 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly STACK_HEIGHT_TWO : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 40 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly TEXT_INPUT_HEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 80 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly IMAGE_HEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 15 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly IMAGE_HEIGHT_TWO : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 18 AST#expression#Right ; AST#property_declaration#Right // border width AST#property_declaration#Left static readonly BORDER_WIDTH : 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#property_declaration#Right AST#property_declaration#Left static readonly BORDER_RADIUS : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 24 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly BORDER_RADIUS_TWO : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 30 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly BORDER_RADIUS_THREE : 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 static readonly BUBBLE_BORDER_RADIUS : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 55 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly BUBBLE_BORDER_RADIUS_TWO : 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 // aspect ratio AST#property_declaration#Left static readonly IMAGE_ASPECT_RATIO_ONE : 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#property_declaration#Right AST#property_declaration#Left static readonly IMAGE_ASPECT_RATIO_ONE_POINT_SIX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1.6 AST#expression#Right ; AST#property_declaration#Right // fontsize AST#property_declaration#Left static readonly LABEL_NAME_FONTSIZE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 16 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly LABEL_FONTSIZE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 13 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly HALF_FONTSIZE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 18 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly HALF_FONTSIZE_TITLE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 19 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly TEXT_FONTSIZE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 18 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly BUBBLE_FONTSIZE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 12 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly PLACE_HOLDER_FONTSIZE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 14 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly BUBBLE_CHECK_FONTSIZE : 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 // size AST#property_declaration#Left static readonly HALF_PADDING_BOTTOM : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 15 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly PADDING_TOP : 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 static readonly PADDING_TOP_TWO : 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 static readonly PADDING_BOTTOM : 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 static readonly PADDING_LEFT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 13 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly PADDING_LEFT_TWO : 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 static readonly PADDING_RIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 8 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly PADDING : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 15 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly MARGIN_TOP : 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 static readonly MARGIN_TOP_TWO : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 25 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly MARGIN_TOP_THREE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 45 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly MARGIN_TOP_FOUR : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 55 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly MARGIN_LEFT : 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 static readonly MARGIN_LEFT_TWO : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 35 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly MARGIN_LEFT_THREE : 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 static readonly MARGIN_RIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 15 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly MARGIN_RIGHT_TWO : 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#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export default class CommonConstants {
static readonly FIRST_LEVEL_OPACITY: number = 0.9;
static readonly SECOND_LEVEL_OPACITY: number = 0.6;
static readonly HALF_OPACITY: number = 0.5;
static readonly SPACE_4: number = 4;
static readonly SPACE_8: number = 8;
static readonly SPACE_12: number = 12;
static readonly MAX_LINE_ONE: number = 1;
static readonly MAX_LINE_TWO: number = 2;
static readonly FULL_PERCENT: string = '100%';
static readonly LAYOUT_WEIGHT: number = 1;
static readonly LABEL_FONT_WEIGHT: number = 300
static readonly HALF_FONT_WEIGHT: number = 450;
static readonly LABEL_BUBBLE_FONT_WEIGHT: number = 700;
static readonly PLACE_HOLDER_FONT_WEIGHT: number = 400;
static readonly LIST_ITEM_HEIGHT: number = 400;
static readonly LIST_ITEM_HEIGHT_TWO: number = 130;
static readonly LIST_HEIGHT: number = 1755;
static readonly ROW_HEIGHT: number = 150;
static readonly LIST_ITEM_ROW_HEIGHT: number = 40;
static readonly AVOID_AREA_HEIGHT: number = 500;
static readonly BUBBLE_AREA_HEIGHT: number = 36;
static readonly BUBBLE_CHECK_HEIGHT: number = 15;
static readonly TEXT_HEIGHT: number = 30;
static readonly ROW_HEIGHT_TWO: number = 30;
static readonly ROW_HEIGHT_THREE: number = 30;
static readonly BUTTON_HEIGHT: number = 40;
static readonly ROW_HEIGHT_FOUR: number = 40;
static readonly TEXT_AREA_HEIGHT: number = 70;
static readonly STACK_HEIGHT: number = 80;
static readonly STACK_HEIGHT_TWO: number = 40;
static readonly TEXT_INPUT_HEIGHT: number = 80;
static readonly IMAGE_HEIGHT: number = 15;
static readonly IMAGE_HEIGHT_TWO: number = 18;
static readonly BORDER_WIDTH: number = 1;
static readonly BORDER_RADIUS: number = 24;
static readonly BORDER_RADIUS_TWO: number = 30;
static readonly BORDER_RADIUS_THREE: number = 10;
static readonly BUBBLE_BORDER_RADIUS: number = 55;
static readonly BUBBLE_BORDER_RADIUS_TWO: number = 10;
static readonly IMAGE_ASPECT_RATIO_ONE: number = 1;
static readonly IMAGE_ASPECT_RATIO_ONE_POINT_SIX: number = 1.6;
static readonly LABEL_NAME_FONTSIZE: number = 16;
static readonly LABEL_FONTSIZE: number = 13;
static readonly HALF_FONTSIZE: number = 18;
static readonly HALF_FONTSIZE_TITLE: number = 19;
static readonly TEXT_FONTSIZE: number = 18;
static readonly BUBBLE_FONTSIZE: number = 12;
static readonly PLACE_HOLDER_FONTSIZE: number = 14;
static readonly BUBBLE_CHECK_FONTSIZE: number = 10;
static readonly HALF_PADDING_BOTTOM: number = 15;
static readonly PADDING_TOP: number = 20;
static readonly PADDING_TOP_TWO: number = 10;
static readonly PADDING_BOTTOM: number = 5;
static readonly PADDING_LEFT: number = 13;
static readonly PADDING_LEFT_TWO: number = 5;
static readonly PADDING_RIGHT: number = 8;
static readonly PADDING: number = 15;
static readonly MARGIN_TOP: number = 10;
static readonly MARGIN_TOP_TWO: number = 25;
static readonly MARGIN_TOP_THREE: number = 45;
static readonly MARGIN_TOP_FOUR: number = 55;
static readonly MARGIN_LEFT: number = 20;
static readonly MARGIN_LEFT_TWO: number = 35;
static readonly MARGIN_LEFT_THREE: number = 5;
static readonly MARGIN_RIGHT: number = 15;
static readonly MARGIN_RIGHT_TWO: number = 5;
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/editaddress/src/main/ets/common/CommonConstants.ets#L19-L97
|
071486fff6af4e722d47dabe724bae014cbd4975
|
gitee
|
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/hosts/bunch_of_tabs.ets
|
arkts
|
loadUrl_onWorkingTab
|
Operations and Actions
Loads a link on the current main tab.
@description Will load url_default_blank() if the home_url of this bunch_of_tabs is not set.
|
loadUrl_onWorkingTab(url: string) {
url = url_meow_to_resource(url);
console.log('[bunch_of_tabs][loadUrl_onWorkingTab] ' + url);
this.Tabs[this.main_tab_idx].controller?.loadUrl(url);
}
|
AST#method_declaration#Left loadUrl_onWorkingTab AST#parameter_list#Left ( AST#parameter#Left url : 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#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left url = AST#expression#Left AST#call_expression#Left AST#expression#Left url_meow_to_resource AST#expression#Right AST#argument_list#Left ( AST#expression#Left url 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 console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left '[bunch_of_tabs][loadUrl_onWorkingTab] ' AST#expression#Right + AST#expression#Left url 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#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#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . Tabs AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . main_tab_idx AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . controller AST#member_expression#Right AST#expression#Right ?. loadUrl AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left url 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
|
loadUrl_onWorkingTab(url: string) {
url = url_meow_to_resource(url);
console.log('[bunch_of_tabs][loadUrl_onWorkingTab] ' + url);
this.Tabs[this.main_tab_idx].controller?.loadUrl(url);
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L63-L67
|
a6c47cbaa8ba1f21272e7989a03ff08ddf09c7fc
|
gitee
|
XiangRui_FuZi/harmony-oscourse
|
da885f9a777a1eace7a07e1cd81137746687974b
|
class1/entry/src/main/ets/model/CommonModel.ets
|
arkts
|
Topic Information.
|
export class TopicInfo {
topicId: string;
title: Resource;
viewCount: string;
constructor(topicId: string, title: Resource, viewCount: string) {
this.topicId = topicId;
this.title = title;
this.viewCount = viewCount;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class TopicInfo AST#class_body#Left { AST#property_declaration#Left topicId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right 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 AST#property_declaration#Left viewCount : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left topicId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left viewCount : 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 . topicId AST#member_expression#Right = AST#expression#Left topicId 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 . title AST#member_expression#Right = AST#expression#Left title 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 . viewCount AST#member_expression#Right = AST#expression#Left viewCount AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class TopicInfo {
topicId: string;
title: Resource;
viewCount: string;
constructor(topicId: string, title: Resource, viewCount: string) {
this.topicId = topicId;
this.title = title;
this.viewCount = viewCount;
}
}
|
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/model/CommonModel.ets#L71-L81
|
48bfb3330e283193a224791a22a94bd03c08b935
|
gitee
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/pages/contacts/ContactEditPage.ets
|
arkts
|
buildBirthdaySection
|
构建生日信息区域
|
@Builder
buildBirthdaySection() {
Column({ space: 16 }) {
Text('生日信息')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
.alignSelf(ItemAlign.Start)
// 生日类型选择
Column({ space: 8 }) {
Text('生日类型')
.fontSize(16)
.fontColor('#333333')
.alignSelf(ItemAlign.Start)
Row({ space: 12 }) {
Button('公历')
.type(ButtonType.Normal)
.fontSize(14)
.fontColor(this.birthdayType === 'solar' ? '#ffffff' : '#666666')
.backgroundColor(this.birthdayType === 'solar' ? '#4ECDC4' : '#f8f9fa')
.border({ width: 1, color: this.birthdayType === 'solar' ? '#4ECDC4' : '#e9ecef' })
.borderRadius(8)
.layoutWeight(1)
.onClick(() => {
this.birthdayType = 'solar';
})
Button('农历')
.type(ButtonType.Normal)
.fontSize(14)
.fontColor(this.birthdayType === 'lunar' ? '#ffffff' : '#666666')
.backgroundColor(this.birthdayType === 'lunar' ? '#4ECDC4' : '#f8f9fa')
.border({ width: 1, color: this.birthdayType === 'lunar' ? '#4ECDC4' : '#e9ecef' })
.borderRadius(8)
.layoutWeight(1)
.onClick(() => {
this.birthdayType = 'lunar';
})
}
.width('100%')
}
if (this.birthdayType === 'solar') {
// 公历生日录入
this.buildSolarBirthdayInput()
} else {
// 农历生日录入
this.buildLunarBirthdayInput()
}
}
.width('100%')
.padding(16)
.backgroundColor('#ffffff')
.borderRadius(12)
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildBirthdaySection 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 16 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 . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' AST#expression#Right ) AST#modifier_chain_expression#Left . alignSelf ( AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . Start 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 8 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 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' AST#expression#Right ) AST#modifier_chain_expression#Left . alignSelf ( AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . Start 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 Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 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 '公历' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 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 . birthdayType AST#member_expression#Right AST#expression#Right === AST#expression#Left 'solar' AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '#ffffff' AST#expression#Right : AST#expression#Left '#666666' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( 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 . birthdayType AST#member_expression#Right AST#expression#Right === AST#expression#Left 'solar' AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '#4ECDC4' AST#expression#Right : AST#expression#Left '#f8f9fa' AST#expression#Right AST#conditional_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#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . birthdayType AST#member_expression#Right AST#expression#Right === AST#expression#Left 'solar' AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '#4ECDC4' AST#expression#Right : AST#expression#Left '#e9ecef' AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . birthdayType AST#member_expression#Right = AST#expression#Left 'solar' 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#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 Button ( AST#expression#Left '农历' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 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 . birthdayType AST#member_expression#Right AST#expression#Right === AST#expression#Left 'lunar' AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '#ffffff' AST#expression#Right : AST#expression#Left '#666666' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( 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 . birthdayType AST#member_expression#Right AST#expression#Right === AST#expression#Left 'lunar' AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '#4ECDC4' AST#expression#Right : AST#expression#Left '#f8f9fa' AST#expression#Right AST#conditional_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#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . birthdayType AST#member_expression#Right AST#expression#Right === AST#expression#Left 'lunar' AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '#4ECDC4' AST#expression#Right : AST#expression#Left '#e9ecef' AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . birthdayType AST#member_expression#Right = AST#expression#Left 'lunar' 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#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 . 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#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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . birthdayType AST#member_expression#Right AST#expression#Right === AST#expression#Left 'solar' 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 this AST#expression#Right . buildSolarBirthdayInput 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 } 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 . buildLunarBirthdayInput 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 '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 12 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#builder_function_body#Right AST#method_declaration#Right
|
@Builder
buildBirthdaySection() {
Column({ space: 16 }) {
Text('生日信息')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
.alignSelf(ItemAlign.Start)
Column({ space: 8 }) {
Text('生日类型')
.fontSize(16)
.fontColor('#333333')
.alignSelf(ItemAlign.Start)
Row({ space: 12 }) {
Button('公历')
.type(ButtonType.Normal)
.fontSize(14)
.fontColor(this.birthdayType === 'solar' ? '#ffffff' : '#666666')
.backgroundColor(this.birthdayType === 'solar' ? '#4ECDC4' : '#f8f9fa')
.border({ width: 1, color: this.birthdayType === 'solar' ? '#4ECDC4' : '#e9ecef' })
.borderRadius(8)
.layoutWeight(1)
.onClick(() => {
this.birthdayType = 'solar';
})
Button('农历')
.type(ButtonType.Normal)
.fontSize(14)
.fontColor(this.birthdayType === 'lunar' ? '#ffffff' : '#666666')
.backgroundColor(this.birthdayType === 'lunar' ? '#4ECDC4' : '#f8f9fa')
.border({ width: 1, color: this.birthdayType === 'lunar' ? '#4ECDC4' : '#e9ecef' })
.borderRadius(8)
.layoutWeight(1)
.onClick(() => {
this.birthdayType = 'lunar';
})
}
.width('100%')
}
if (this.birthdayType === 'solar') {
this.buildSolarBirthdayInput()
} else {
this.buildLunarBirthdayInput()
}
}
.width('100%')
.padding(16)
.backgroundColor('#ffffff')
.borderRadius(12)
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactEditPage.ets#L515-L571
|
6e4c2a8c28655d11e2ae153cb76911c56a9f74b7
|
github
|
IceYuanyyy/OxHornCampus.git
|
bb5686f77fa36db89687502e35898cda218d601f
|
entry/src/main/ets/pages/IntroductionPage.ets
|
arkts
|
pageTransition
|
The transition animation from page to page.
|
pageTransition() {
PageTransitionEnter({ duration: Const.SHARED_DURATION })
.slide(SlideEffect.Bottom)
.scale({
x: 0,
y: 0,
z: 0,
centerX: Const.HALF_PERCENT,
centerY: Const.HALF_PERCENT
})
PageTransitionExit({ delay: Const.SWIPER_DURATION })
.slide(SlideEffect.Bottom)
.scale({
x: 0,
y: 0,
z: 0,
centerX: Const.HALF_PERCENT,
centerY: Const.HALF_PERCENT
})
}
|
AST#method_declaration#Left pageTransition 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 PageTransitionEnter ( AST#component_parameters#Left { AST#component_parameter#Left duration : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . SHARED_DURATION AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . slide ( AST#expression#Left AST#member_expression#Left AST#expression#Left SlideEffect AST#expression#Right . Bottom AST#member_expression#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 0 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#property_assignment#Left AST#property_name#Left z AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left centerX AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . HALF_PERCENT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left centerY AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . HALF_PERCENT 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#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 PageTransitionExit ( AST#component_parameters#Left { AST#component_parameter#Left delay : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . SWIPER_DURATION AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . slide ( AST#expression#Left AST#member_expression#Left AST#expression#Left SlideEffect AST#expression#Right . Bottom AST#member_expression#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 0 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#property_assignment#Left AST#property_name#Left z AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left centerX AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . HALF_PERCENT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left centerY AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . HALF_PERCENT 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
pageTransition() {
PageTransitionEnter({ duration: Const.SHARED_DURATION })
.slide(SlideEffect.Bottom)
.scale({
x: 0,
y: 0,
z: 0,
centerX: Const.HALF_PERCENT,
centerY: Const.HALF_PERCENT
})
PageTransitionExit({ delay: Const.SWIPER_DURATION })
.slide(SlideEffect.Bottom)
.scale({
x: 0,
y: 0,
z: 0,
centerX: Const.HALF_PERCENT,
centerY: Const.HALF_PERCENT
})
}
|
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/pages/IntroductionPage.ets#L117-L136
|
e20b8d13e0dd793b5a207734a0411a9edc4d46b8
|
github
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/common/components/Sounds/Cloud/CSoundDbAccessor/CSoundDbAccessor.ets
|
arkts
|
createCSoundFromRs
|
MARK: - 结果集转换
|
private createCSoundFromRs(rs: relationalStore.ResultSet): CDBSound {
const sound = new CDBSound();
sound.idxx = rs.getLong(rs.getColumnIndex(Tables.CSound.Col.idxx));
sound.lang = ResultSetTool.decodeString(rs, Tables.CSound.Col.lang);
sound.text = ResultSetTool.decodeString(rs, Tables.CSound.Col.text);
sound.data = rs.getBlob(rs.getColumnIndex(Tables.CSound.Col.data));
return sound;
}
|
AST#method_declaration#Left private createCSoundFromRs AST#parameter_list#Left ( AST#parameter#Left rs : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ResultSet 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 CDBSound AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left sound = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CDBSound 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 sound AST#expression#Right . idxx AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left rs AST#expression#Right . getLong 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 rs AST#expression#Right . getColumnIndex 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#member_expression#Left AST#expression#Left Tables AST#expression#Right . CSound AST#member_expression#Right AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . idxx 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#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 sound AST#expression#Right . lang AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ResultSetTool AST#expression#Right . decodeString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left rs AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Tables AST#expression#Right . CSound AST#member_expression#Right AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . lang 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#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left sound AST#expression#Right . text AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ResultSetTool AST#expression#Right . decodeString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left rs AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Tables AST#expression#Right . CSound AST#member_expression#Right AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . text 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#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left sound AST#expression#Right . data AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left rs AST#expression#Right . getBlob 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 rs AST#expression#Right . getColumnIndex 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#member_expression#Left AST#expression#Left Tables AST#expression#Right . CSound AST#member_expression#Right AST#expression#Right . Col AST#member_expression#Right 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#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left sound AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private createCSoundFromRs(rs: relationalStore.ResultSet): CDBSound {
const sound = new CDBSound();
sound.idxx = rs.getLong(rs.getColumnIndex(Tables.CSound.Col.idxx));
sound.lang = ResultSetTool.decodeString(rs, Tables.CSound.Col.lang);
sound.text = ResultSetTool.decodeString(rs, Tables.CSound.Col.text);
sound.data = rs.getBlob(rs.getColumnIndex(Tables.CSound.Col.data));
return sound;
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/CSoundDbAccessor/CSoundDbAccessor.ets#L139-L146
|
b3152b1fb7d64974248527570893e1acd27b2387
|
github
|
bigbear20240612/planner_build-.git
|
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
|
entry/src/main/ets/common/utils/DateUtils.ets
|
arkts
|
getTodayKey
|
获取今天的日期键(用于数据存储)
@returns YYYY-MM-DD 格式的今天日期键
|
static getTodayKey(): string {
return DateUtils.formatDate(new Date(), 'YYYY-MM-DD');
}
|
AST#method_declaration#Left static getTodayKey AST#parameter_list#Left ( ) 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 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#expression#Left 'YYYY-MM-DD' 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 getTodayKey(): string {
return DateUtils.formatDate(new Date(), 'YYYY-MM-DD');
}
|
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/DateUtils.ets#L37-L39
|
c12a37ceb49f8c9747f5da0bc947e660785c116b
|
github
|
fourseas1998/hos.RankingDemo.git
|
5a98167826252c3c2b5ac58fa9a3db29d5f49d02
|
entry/src/main/ets/view/ListItemComponent.ets
|
arkts
|
NormalText
|
排行-非前三个的容器样式
|
@Builder NormalText(){
Text(this.index.toString())
.width(ListItemComponentStyle.TEXT_RANKING_SIZE)
.lineHeight(ListItemComponentStyle.TEXT_RANKING_SIZE)
.fontWeight(FontWeight.Bold)
.fontSize(FontSize.SMALL)
.textAlign(TextAlign.Center)
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right NormalText 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 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 . index 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 . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left ListItemComponentStyle AST#expression#Right . TEXT_RANKING_SIZE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . lineHeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left ListItemComponentStyle AST#expression#Right . TEXT_RANKING_SIZE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontSize AST#expression#Right . SMALL AST#member_expression#Right 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#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder NormalText(){
Text(this.index.toString())
.width(ListItemComponentStyle.TEXT_RANKING_SIZE)
.lineHeight(ListItemComponentStyle.TEXT_RANKING_SIZE)
.fontWeight(FontWeight.Bold)
.fontSize(FontSize.SMALL)
.textAlign(TextAlign.Center)
}
|
https://github.com/fourseas1998/hos.RankingDemo.git/blob/5a98167826252c3c2b5ac58fa9a3db29d5f49d02/entry/src/main/ets/view/ListItemComponent.ets#L82-L89
|
36de67cf1793ca18dabba1b3106d0a61bbacfb9a
|
github
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/views/login/ResetPasswordView.ets
|
arkts
|
/ 参数类型
|
export interface Param {
email: string
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface Param AST#object_type#Left { AST#type_member#Left email : AST#type_annotation#Left AST#primary_type#Left string 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 Param {
email: string
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/login/ResetPasswordView.ets#L24-L26
|
c0402255d226aeb3e28979851ee3d9735377082c
|
github
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/model/DataModel.ets
|
arkts
|
getData
|
获取指定索引数据
@param index
@returns
|
public getData(index: number): Comment {
return this.commentArray[index];
}
|
AST#method_declaration#Left public getData 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 Comment AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . commentArray AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public getData(index: number): Comment {
return this.commentArray[index];
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/model/DataModel.ets#L47-L49
|
c6d5a08ab40e843f3edaf81fe37991dfb2d48db1
|
gitee
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/feedback/src/main/ets/navigation/FeedbackGraph.ets
|
arkts
|
register
|
注册反馈模块导航路由
|
register(): void {
RouteBuild.register(FeedbackRoutes.List, wrapBuilder(FeedbackListNav));
RouteBuild.register(FeedbackRoutes.Submit, wrapBuilder(FeedbackSubmitNav));
}
|
AST#method_declaration#Left register 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 RouteBuild AST#expression#Right . register AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left FeedbackRoutes AST#expression#Right . List AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#argument_list#Left ( AST#expression#Left FeedbackListNav 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RouteBuild AST#expression#Right . register AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left FeedbackRoutes AST#expression#Right . Submit AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#argument_list#Left ( AST#expression#Left FeedbackSubmitNav 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#builder_function_body#Right AST#method_declaration#Right
|
register(): void {
RouteBuild.register(FeedbackRoutes.List, wrapBuilder(FeedbackListNav));
RouteBuild.register(FeedbackRoutes.Submit, wrapBuilder(FeedbackSubmitNav));
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/feedback/src/main/ets/navigation/FeedbackGraph.ets#L14-L17
|
bfd7dcca525680652051f305e3de8233b94889f1
|
github
|
jxdiaodeyi/YX_Sports.git
|
af5346bd3d5003c33c306ff77b4b5e9184219893
|
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/action/ToastUtil.ets
|
arkts
|
showLong
|
弹出土司,时长为:10s,距离底部默认为80vp
@param message 提示消息
@param options (距离屏幕底部的位置、是否显示在应用之上)
|
static showLong(message: string | Resource, options: ToastOptions = new ToastOptions()) {
if (message || (typeof message === 'string' && message.length > 0)) {
options = ToastUtil.initToastDefault(options, 2);
let toastOptions = options as promptAction.ShowToastOptions;
toastOptions.message = message;
promptAction.showToast(toastOptions);
}
}
|
AST#method_declaration#Left static showLong AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource 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 ToastOptions 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 ToastOptions 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#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 message AST#expression#Right || AST#expression#Left AST#parenthesized_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#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left message AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left message AST#expression#Right AST#binary_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#parenthesized_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#assignment_expression#Left options = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ToastUtil AST#expression#Right . initToastDefault AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left options AST#expression#Right , AST#expression#Left 2 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#variable_declaration#Left let AST#variable_declarator#Left toastOptions = AST#expression#Left AST#as_expression#Left AST#expression#Left options AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left promptAction . ShowToastOptions 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 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left toastOptions AST#expression#Right . message AST#member_expression#Right = AST#expression#Left message 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 promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left toastOptions 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#method_declaration#Right
|
static showLong(message: string | Resource, options: ToastOptions = new ToastOptions()) {
if (message || (typeof message === 'string' && message.length > 0)) {
options = ToastUtil.initToastDefault(options, 2);
let toastOptions = options as promptAction.ShowToastOptions;
toastOptions.message = message;
promptAction.showToast(toastOptions);
}
}
|
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/action/ToastUtil.ets#L75-L82
|
c2ba4b638b17ed9ea63237739f12cf1e0986d656
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/ResUtil.ets
|
arkts
|
isRawDir
|
用户判断指定路径是否是rawfile下的目录(true:表示是rawfile下的目录,false:表示不是rawfile下的目录)
@param path rawfile路径。
@returns
|
static isRawDir(path: string): boolean {
return ResUtil.getResourceManager().isRawDir(path);
}
|
AST#method_declaration#Left static isRawDir AST#parameter_list#Left ( AST#parameter#Left path : 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 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ResUtil 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 . isRawDir AST#member_expression#Right 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static isRawDir(path: string): boolean {
return ResUtil.getResourceManager().isRawDir(path);
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L566-L568
|
4b034cbce9576ba49d81bb14524ad9dbb2fde61b
|
gitee
|
BohanSu/LumosAgent-HarmonyOS.git
|
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
|
entry/src/main/ets/model/DailySummary.ets
|
arkts
|
toRow
|
Convert to database row format
|
toRow(): DailySummaryData {
return {
date: this.date,
summary: this.summary,
key_topics: JSON.stringify(this.keyTopics),
tasks_created: this.tasksCreated,
memos_created: this.memosCreated,
mood_trend: this.moodTrend,
timestamp: this.timestamp
};
}
|
AST#method_declaration#Left toRow AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left DailySummaryData AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left date AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . date AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left summary AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . summary AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left key_topics AST#property_name#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . keyTopics AST#member_expression#Right 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 tasks_created AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tasksCreated AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left memos_created AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . memosCreated AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left mood_trend AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . moodTrend AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left timestamp AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timestamp AST#member_expression#Right 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#method_declaration#Right
|
toRow(): DailySummaryData {
return {
date: this.date,
summary: this.summary,
key_topics: JSON.stringify(this.keyTopics),
tasks_created: this.tasksCreated,
memos_created: this.memosCreated,
mood_trend: this.moodTrend,
timestamp: this.timestamp
};
}
|
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/model/DailySummary.ets#L91-L101
|
451abe26ffae84900a32ce09bed15fd7eabb7ea5
|
github
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/utils/url_tools.ets
|
arkts
|
Domains that can be loaded and displayed in web components
@returns ['http', 'https', 'meow', 'resource', 'file']
|
export function viewable_domains() {
return ['http', 'https', 'meow', 'resource', 'file'];
}
|
AST#export_declaration#Left export AST#function_declaration#Left function viewable_domains AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#array_literal#Left [ AST#expression#Left 'http' AST#expression#Right , AST#expression#Left 'https' AST#expression#Right , AST#expression#Left 'meow' AST#expression#Right , AST#expression#Left 'resource' AST#expression#Right , AST#expression#Left 'file' AST#expression#Right ] AST#array_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 viewable_domains() {
return ['http', 'https', 'meow', 'resource', 'file'];
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/url_tools.ets#L301-L303
|
1ce5e59c7d577a8b60a59eec195c5f778f63f330
|
gitee
|
|
openharmony-sig/knowledge_demo_smart_home
|
6cdf5d81ef84217f386c4200bfc4124a0ded5a0d
|
FA/DistScheduleEts/entry/src/main/ets/common/service/distScheduleService.ets
|
arkts
|
数字管家服务端调用类
|
export class DistScheduleService {
// static distScheduleServer: string = "http://81.71.17.188:8080/distschedule-api"
static distScheduleServer: string = "http://139.9.102.131:8080/distschedule-api"
static readTimeout: number = 3000
static connectTimeout: number = 3000
/**
* 根据手机号,获取用户信息
* @param phone 手机号
*/
static async getUserInfo(phone: string) {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/user/phone/${phone}`,
{
method: RequestMethod.GET,
header: {
'Content-Type': 'application/json'
},
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
// @ts-ignore
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
/**
* 根据用户id,获取设备列表
* @param phone 手机号
*/
static async getDeviceListByUserId(userId: string) {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/device/userId/${userId}`,
{
method: RequestMethod.GET,
header: {
'Content-Type': 'application/json'
},
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
// @ts-ignore
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
/**
* 获取设备类型
*/
static async getDeviceTypes() {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/devicetype`,
{
method: RequestMethod.GET,
header: {
'Content-Type': 'application/json'
},
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
// @ts-ignore
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
/**
* 根据设备ID获取设备信息
*/
static async getDeviceInfo(deviceId: string, userId: string) {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/device/${deviceId}`,
{
method: RequestMethod.GET,
header: {
'userId': `${userId}`
},
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
// @ts-ignore
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
/**
* 根据品类ID获取品类名字作为默认名字
* @param productId 品类ID
*/
static async getNameByProId(productId: string) {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/devicetype/productId/${productId}`,
{
method: RequestMethod.GET,
header: {
'Content-Type': 'application/json'
},
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
// @ts-ignore
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
/**
* 创建设备
* @param deviceId 设备ID,name 设备名称,ownerId 所有者ID
*/
static async createDevice(deviceId: string, name: string, ownerId: string, secret: string, typeId: number) {
let postData = {
id: deviceId,
name: name,
ownerId: ownerId,
secret: secret,
typeId: typeId
}
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/device`,
{
method: RequestMethod.POST,
header: {
'Content-Type': 'application/json'
},
extraData: postData,
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
// @ts-ignore
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
/**
* 根据设备ID获取设备信息
*/
static async deleteDevice(deviceId: string, userId: string) {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/device/${deviceId}`,
{
method: RequestMethod.DELETE,
header: {
'userId': `${userId}`
},
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
// @ts-ignore
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
/**
* 根据日程ID删除日程
*/
static async deleteSchedule(scheduleId: string, userId: string) {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/schedule/${scheduleId}`,
{
method: RequestMethod.DELETE,
header: {
'userId': `${userId}`
},
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
// @ts-ignore
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
/**
* 根据时间获取当前的日程数据
*
*/
static async getSchedule(userId: string, startTime: string, endTime: string) {
let httpRequest = http.createHttp();
var urlObject = new Url.URL(`${DistScheduleService.distScheduleServer}/schedule/query?startTime=${startTime}&endTime=${endTime}`);
let data = await httpRequest.request(
// `${DistScheduleService.distScheduleServer}/schedule/query?startTime=${startTime}&endTime=${endTime}`,
urlObject.toString(),
{
method: RequestMethod.GET,
header: {
'userId': `${userId}`
},
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
// @ts-ignore
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
/**
* 按名称搜索日程
*
*/
static async searchSchedule(userId: string, strSearch: string) {
let httpRequest = http.createHttp();
var urlObject = new Url.URL(`${DistScheduleService.distScheduleServer}/schedule/search?name=${strSearch}`);
let data = await httpRequest.request(
urlObject.toString(),
{
method: RequestMethod.GET,
header: {
'userId': `${userId}`
},
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
// @ts-ignore
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
/**
* 根据用户id,查询家庭信息
*
*/
static async getFamilyById(userId: string) {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/family/userId/${userId}`,
{
method: RequestMethod.GET,
header: {
'Content-Type': 'application/json'
},
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
// @ts-ignore
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
/**
* 根据familyId,查询家庭成员信息
*
*/
static async getMemberByFamilyId(familyId: string) {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/family/${familyId}/member`,
{
method: RequestMethod.GET,
header: {
'Content-Type': 'application/json'
},
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
// @ts-ignore
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
/**
* 发送设备控制命令
* @param phone 手机号
*/
static async sendDeviceCommand(deviceId:string, postData:DeviceCommandModel) {
let command = {
commandName: postData.commandName,
serviceId: postData.serviceId,
value: postData.value,
}
let httpRequest = http.createHttp();
LogUtil.info(TAG,"sendDeviceCommand:" + JSON.stringify(command))
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/device/${deviceId}/sendCommand`,
{
method: RequestMethod.POST,
header: {
'Content-Type': 'application/json'
},
extraData: command,
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
// @ts-ignore
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
/**
* 创建日程
*
*/
static async addSchedule(postData:AddScheduleModel) {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/schedule`,
{
method: RequestMethod.POST,
header: {
'Content-Type': 'application/json'
},
extraData: postData,
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
// @ts-ignore
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class DistScheduleService AST#class_body#Left { // static distScheduleServer: string = "http://81.71.17.188:8080/distschedule-api" AST#property_declaration#Left static distScheduleServer : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "http://139.9.102.131:8080/distschedule-api" AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readTimeout : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 3000 AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static connectTimeout : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 3000 AST#expression#Right /**
* 根据手机号,获取用户信息
* @param phone 手机号
*/ AST#property_declaration#Right AST#method_declaration#Left static async getUserInfo AST#parameter_list#Left ( AST#parameter#Left phone : 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 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 data = 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 httpRequest AST#expression#Right AST#await_expression#Right AST#expression#Right . request 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 DistScheduleService AST#expression#Right . distScheduleServer AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right /user/phone/ AST#template_substitution#Left $ { AST#expression#Left phone AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right , 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 RequestMethod AST#expression#Right . GET AST#member_expression#Right 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/json' 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 readTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . readTimeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . connectTimeout 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 AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // @ts-ignore 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 JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . result 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 AST#member_expression#Left AST#expression#Left result AST#expression#Right . success 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 result AST#expression#Right . result 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#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#member_expression#Left AST#expression#Left result AST#expression#Right . message AST#member_expression#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#method_declaration#Right /**
* 根据用户id,获取设备列表
* @param phone 手机号
*/ AST#method_declaration#Left static async getDeviceListByUserId AST#parameter_list#Left ( AST#parameter#Left userId : 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 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 data = 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 httpRequest AST#expression#Right AST#await_expression#Right AST#expression#Right . request 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 DistScheduleService AST#expression#Right . distScheduleServer AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right /device/userId/ AST#template_substitution#Left $ { AST#expression#Left userId AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right , 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 RequestMethod AST#expression#Right . GET AST#member_expression#Right 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/json' 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 readTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . readTimeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . connectTimeout 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 AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // @ts-ignore 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 JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . result 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 AST#member_expression#Left AST#expression#Left result AST#expression#Right . success 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 result AST#expression#Right . result 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#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#member_expression#Left AST#expression#Left result AST#expression#Right . message AST#member_expression#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#method_declaration#Right /**
* 获取设备类型
*/ AST#method_declaration#Left static async getDeviceTypes AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { 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 data = 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 httpRequest AST#expression#Right AST#await_expression#Right AST#expression#Right . request 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 DistScheduleService AST#expression#Right . distScheduleServer AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right /devicetype ` AST#template_literal#Right AST#expression#Right , 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 RequestMethod AST#expression#Right . GET AST#member_expression#Right 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/json' 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 readTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . readTimeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . connectTimeout 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 AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // @ts-ignore 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 JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . result 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 AST#member_expression#Left AST#expression#Left result AST#expression#Right . success 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 result AST#expression#Right . result 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#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#member_expression#Left AST#expression#Left result AST#expression#Right . message AST#member_expression#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#method_declaration#Right /**
* 根据设备ID获取设备信息
*/ AST#method_declaration#Left static async getDeviceInfo AST#parameter_list#Left ( AST#parameter#Left deviceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left userId : 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 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 data = 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 httpRequest AST#expression#Right AST#await_expression#Right AST#expression#Right . request 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 DistScheduleService AST#expression#Right . distScheduleServer AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right /device/ AST#template_substitution#Left $ { AST#expression#Left deviceId AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right , 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 RequestMethod AST#expression#Right . GET AST#member_expression#Right 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 'userId' AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left userId AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right 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 readTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . readTimeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . connectTimeout 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 AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // @ts-ignore 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 JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . result 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 AST#member_expression#Left AST#expression#Left result AST#expression#Right . success 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 result AST#expression#Right . result 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#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#member_expression#Left AST#expression#Left result AST#expression#Right . message AST#member_expression#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#method_declaration#Right /**
* 根据品类ID获取品类名字作为默认名字
* @param productId 品类ID
*/ AST#method_declaration#Left static async getNameByProId AST#parameter_list#Left ( AST#parameter#Left productId : 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 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 data = 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 httpRequest AST#expression#Right AST#await_expression#Right AST#expression#Right . request 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 DistScheduleService AST#expression#Right . distScheduleServer AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right /devicetype/productId/ AST#template_substitution#Left $ { AST#expression#Left productId AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right , 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 RequestMethod AST#expression#Right . GET AST#member_expression#Right 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/json' 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 readTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . readTimeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . connectTimeout 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 AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // @ts-ignore 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 JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . result 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 AST#member_expression#Left AST#expression#Left result AST#expression#Right . success 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 result AST#expression#Right . result 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#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#member_expression#Left AST#expression#Left result AST#expression#Right . message AST#member_expression#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#method_declaration#Right /**
* 创建设备
* @param deviceId 设备ID,name 设备名称,ownerId 所有者ID
*/ AST#method_declaration#Left static async createDevice AST#parameter_list#Left ( AST#parameter#Left deviceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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 ownerId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left secret : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left typeId : 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#variable_declaration#Left let AST#variable_declarator#Left postData = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left deviceId AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left name AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left ownerId AST#property_name#Right : AST#expression#Left ownerId AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left secret AST#property_name#Right : AST#expression#Left secret AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left typeId AST#property_name#Right : AST#expression#Left typeId 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 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 data = 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 httpRequest AST#expression#Right AST#await_expression#Right AST#expression#Right . request 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 DistScheduleService AST#expression#Right . distScheduleServer AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right /device ` AST#template_literal#Right AST#expression#Right , 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 RequestMethod AST#expression#Right . POST AST#member_expression#Right 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/json' 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 extraData AST#property_name#Right : AST#expression#Left postData AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left readTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . readTimeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . connectTimeout 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 AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // @ts-ignore 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 JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . result 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 AST#member_expression#Left AST#expression#Left result AST#expression#Right . success 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 result AST#expression#Right . result 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#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#member_expression#Left AST#expression#Left result AST#expression#Right . message AST#member_expression#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#method_declaration#Right /**
* 根据设备ID获取设备信息
*/ AST#method_declaration#Left static async deleteDevice AST#parameter_list#Left ( AST#parameter#Left deviceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left userId : 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 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 data = 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 httpRequest AST#expression#Right AST#await_expression#Right AST#expression#Right . request 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 DistScheduleService AST#expression#Right . distScheduleServer AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right /device/ AST#template_substitution#Left $ { AST#expression#Left deviceId AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right , 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 RequestMethod AST#expression#Right . DELETE AST#member_expression#Right 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 'userId' AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left userId AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right 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 readTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . readTimeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . connectTimeout 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 AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // @ts-ignore 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 JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . result 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 AST#member_expression#Left AST#expression#Left result AST#expression#Right . success 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 result AST#expression#Right . result 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#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#member_expression#Left AST#expression#Left result AST#expression#Right . message AST#member_expression#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#method_declaration#Right /**
* 根据日程ID删除日程
*/ AST#method_declaration#Left static async deleteSchedule AST#parameter_list#Left ( AST#parameter#Left scheduleId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left userId : 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 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 data = 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 httpRequest AST#expression#Right AST#await_expression#Right AST#expression#Right . request 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 DistScheduleService AST#expression#Right . distScheduleServer AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right /schedule/ AST#template_substitution#Left $ { AST#expression#Left scheduleId AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right , 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 RequestMethod AST#expression#Right . DELETE AST#member_expression#Right 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 'userId' AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left userId AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right 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 readTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . readTimeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . connectTimeout 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 AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // @ts-ignore 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 JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . result 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 AST#member_expression#Left AST#expression#Left result AST#expression#Right . success 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 result AST#expression#Right . result 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#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#member_expression#Left AST#expression#Left result AST#expression#Right . message AST#member_expression#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#method_declaration#Right /**
* 根据时间获取当前的日程数据
*
*/ AST#method_declaration#Left static async getSchedule AST#parameter_list#Left ( AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left startTime : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left endTime : 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 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 var AST#variable_declarator#Left urlObject = 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 Url AST#expression#Right AST#new_expression#Right AST#expression#Right . URL 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 DistScheduleService AST#expression#Right . distScheduleServer AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right /schedule/query?startTime= AST#template_substitution#Left $ { AST#expression#Left startTime AST#expression#Right } AST#template_substitution#Right &endTime= AST#template_substitution#Left $ { AST#expression#Left endTime 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#variable_declaration#Left let AST#variable_declarator#Left data = 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 httpRequest AST#expression#Right AST#await_expression#Right AST#expression#Right . request AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( // `${DistScheduleService.distScheduleServer}/schedule/query?startTime=${startTime}&endTime=${endTime}`, AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left urlObject 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#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 RequestMethod AST#expression#Right . GET AST#member_expression#Right 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 'userId' AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left userId AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right 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 readTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . readTimeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . connectTimeout 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 AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // @ts-ignore 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 JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . result 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 AST#member_expression#Left AST#expression#Left result AST#expression#Right . success 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 result AST#expression#Right . result 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#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#member_expression#Left AST#expression#Left result AST#expression#Right . message AST#member_expression#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#method_declaration#Right /**
* 按名称搜索日程
*
*/ AST#method_declaration#Left static async searchSchedule AST#parameter_list#Left ( AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left strSearch : 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 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 var AST#variable_declarator#Left urlObject = 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 Url AST#expression#Right AST#new_expression#Right AST#expression#Right . URL 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 DistScheduleService AST#expression#Right . distScheduleServer AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right /schedule/search?name= AST#template_substitution#Left $ { AST#expression#Left strSearch 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#variable_declaration#Left let AST#variable_declarator#Left data = 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 httpRequest AST#expression#Right AST#await_expression#Right AST#expression#Right . request 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 urlObject 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#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 RequestMethod AST#expression#Right . GET AST#member_expression#Right 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 'userId' AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left userId AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right 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 readTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . readTimeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . connectTimeout 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 AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // @ts-ignore 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 JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . result 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 AST#member_expression#Left AST#expression#Left result AST#expression#Right . success 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 result AST#expression#Right . result 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#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#member_expression#Left AST#expression#Left result AST#expression#Right . message AST#member_expression#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#method_declaration#Right /**
* 根据用户id,查询家庭信息
*
*/ AST#method_declaration#Left static async getFamilyById AST#parameter_list#Left ( AST#parameter#Left userId : 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 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 data = 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 httpRequest AST#expression#Right AST#await_expression#Right AST#expression#Right . request 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 DistScheduleService AST#expression#Right . distScheduleServer AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right /family/userId/ AST#template_substitution#Left $ { AST#expression#Left userId AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right , 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 RequestMethod AST#expression#Right . GET AST#member_expression#Right 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/json' 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 readTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . readTimeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . connectTimeout 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 AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // @ts-ignore 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 JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . result 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 AST#member_expression#Left AST#expression#Left result AST#expression#Right . success 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 result AST#expression#Right . result 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#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#member_expression#Left AST#expression#Left result AST#expression#Right . message AST#member_expression#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#method_declaration#Right /**
* 根据familyId,查询家庭成员信息
*
*/ AST#method_declaration#Left static async getMemberByFamilyId AST#parameter_list#Left ( AST#parameter#Left familyId : 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 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 data = 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 httpRequest AST#expression#Right AST#await_expression#Right AST#expression#Right . request 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 DistScheduleService AST#expression#Right . distScheduleServer AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right /family/ AST#template_substitution#Left $ { AST#expression#Left familyId AST#expression#Right } AST#template_substitution#Right /member ` AST#template_literal#Right AST#expression#Right , 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 RequestMethod AST#expression#Right . GET AST#member_expression#Right 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/json' 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 readTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . readTimeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . connectTimeout 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 AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // @ts-ignore 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 JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . result 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 AST#member_expression#Left AST#expression#Left result AST#expression#Right . success 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 result AST#expression#Right . result 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#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#member_expression#Left AST#expression#Left result AST#expression#Right . message AST#member_expression#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#method_declaration#Right /**
* 发送设备控制命令
* @param phone 手机号
*/ AST#method_declaration#Left static async sendDeviceCommand AST#parameter_list#Left ( AST#parameter#Left deviceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left postData : AST#type_annotation#Left AST#primary_type#Left DeviceCommandModel 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 command = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left commandName AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left postData AST#expression#Right . commandName AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left serviceId AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left postData AST#expression#Right . serviceId AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left postData AST#expression#Right . value 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#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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil 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 "sendDeviceCommand:" 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 command 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 data = 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 httpRequest AST#expression#Right AST#await_expression#Right AST#expression#Right . request 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 DistScheduleService AST#expression#Right . distScheduleServer AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right /device/ AST#template_substitution#Left $ { AST#expression#Left deviceId AST#expression#Right } AST#template_substitution#Right /sendCommand ` AST#template_literal#Right AST#expression#Right , 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 RequestMethod AST#expression#Right . POST AST#member_expression#Right 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/json' 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 extraData AST#property_name#Right : AST#expression#Left command AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left readTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . readTimeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . connectTimeout 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 AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // @ts-ignore 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 JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . result 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 AST#member_expression#Left AST#expression#Left result AST#expression#Right . success 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 result AST#expression#Right . result 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#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#member_expression#Left AST#expression#Left result AST#expression#Right . message AST#member_expression#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#method_declaration#Right /**
* 创建日程
*
*/ AST#method_declaration#Left static async addSchedule AST#parameter_list#Left ( AST#parameter#Left postData : AST#type_annotation#Left AST#primary_type#Left AddScheduleModel 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 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 data = 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 httpRequest AST#expression#Right AST#await_expression#Right AST#expression#Right . request 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 DistScheduleService AST#expression#Right . distScheduleServer AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right /schedule ` AST#template_literal#Right AST#expression#Right , 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 RequestMethod AST#expression#Right . POST AST#member_expression#Right 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/json' 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 extraData AST#property_name#Right : AST#expression#Left postData AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left readTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . readTimeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . connectTimeout 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 AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // @ts-ignore 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 JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . result 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 AST#member_expression#Left AST#expression#Left result AST#expression#Right . success 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 result AST#expression#Right . result 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#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#member_expression#Left AST#expression#Left result AST#expression#Right . message AST#member_expression#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#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class DistScheduleService {
static distScheduleServer: string = "http://139.9.102.131:8080/distschedule-api"
static readTimeout: number = 3000
static connectTimeout: number = 3000
static async getUserInfo(phone: string) {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/user/phone/${phone}`,
{
method: RequestMethod.GET,
header: {
'Content-Type': 'application/json'
},
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
static async getDeviceListByUserId(userId: string) {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/device/userId/${userId}`,
{
method: RequestMethod.GET,
header: {
'Content-Type': 'application/json'
},
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
static async getDeviceTypes() {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/devicetype`,
{
method: RequestMethod.GET,
header: {
'Content-Type': 'application/json'
},
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
static async getDeviceInfo(deviceId: string, userId: string) {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/device/${deviceId}`,
{
method: RequestMethod.GET,
header: {
'userId': `${userId}`
},
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
static async getNameByProId(productId: string) {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/devicetype/productId/${productId}`,
{
method: RequestMethod.GET,
header: {
'Content-Type': 'application/json'
},
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
static async createDevice(deviceId: string, name: string, ownerId: string, secret: string, typeId: number) {
let postData = {
id: deviceId,
name: name,
ownerId: ownerId,
secret: secret,
typeId: typeId
}
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/device`,
{
method: RequestMethod.POST,
header: {
'Content-Type': 'application/json'
},
extraData: postData,
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
static async deleteDevice(deviceId: string, userId: string) {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/device/${deviceId}`,
{
method: RequestMethod.DELETE,
header: {
'userId': `${userId}`
},
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
static async deleteSchedule(scheduleId: string, userId: string) {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/schedule/${scheduleId}`,
{
method: RequestMethod.DELETE,
header: {
'userId': `${userId}`
},
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
static async getSchedule(userId: string, startTime: string, endTime: string) {
let httpRequest = http.createHttp();
var urlObject = new Url.URL(`${DistScheduleService.distScheduleServer}/schedule/query?startTime=${startTime}&endTime=${endTime}`);
let data = await httpRequest.request(
urlObject.toString(),
{
method: RequestMethod.GET,
header: {
'userId': `${userId}`
},
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
static async searchSchedule(userId: string, strSearch: string) {
let httpRequest = http.createHttp();
var urlObject = new Url.URL(`${DistScheduleService.distScheduleServer}/schedule/search?name=${strSearch}`);
let data = await httpRequest.request(
urlObject.toString(),
{
method: RequestMethod.GET,
header: {
'userId': `${userId}`
},
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
static async getFamilyById(userId: string) {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/family/userId/${userId}`,
{
method: RequestMethod.GET,
header: {
'Content-Type': 'application/json'
},
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
static async getMemberByFamilyId(familyId: string) {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/family/${familyId}/member`,
{
method: RequestMethod.GET,
header: {
'Content-Type': 'application/json'
},
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
static async sendDeviceCommand(deviceId:string, postData:DeviceCommandModel) {
let command = {
commandName: postData.commandName,
serviceId: postData.serviceId,
value: postData.value,
}
let httpRequest = http.createHttp();
LogUtil.info(TAG,"sendDeviceCommand:" + JSON.stringify(command))
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/device/${deviceId}/sendCommand`,
{
method: RequestMethod.POST,
header: {
'Content-Type': 'application/json'
},
extraData: command,
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
static async addSchedule(postData:AddScheduleModel) {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/schedule`,
{
method: RequestMethod.POST,
header: {
'Content-Type': 'application/json'
},
extraData: postData,
readTimeout: DistScheduleService.readTimeout,
connectTimeout: DistScheduleService.connectTimeout
}
);
let result = JSON.parse(data.result)
if (result.success) {
return result.result
}
throw new Error(result.message)
}
}
|
https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/common/service/distScheduleService.ets#L37-L452
|
3d4b6121b7f3e684dee01c89280b92017cbf69d9
|
gitee
|
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
core/designsystem/src/main/ets/constants/LayoutPercent.ets
|
arkts
|
10% 百分比
|
export const P10: string = "10%";
|
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left P10 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "10%" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
|
export const P10: string = "10%";
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/constants/LayoutPercent.ets#L19-L19
|
48ac166ff57352e8be081a096dc4e7ebfaa7bde7
|
github
|
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ChartData.ets
|
arkts
|
arrayToList
|
Created because Arrays.asList(...) does not support modification.
@param array
@return
|
private arrayToList(array: T[]): JArrayList<T> {
let list = new JArrayList<T>();
for (let i = 0; i < array.length; i++) {
let data: T = array[i];
list.add(data);
}
return list;
}
|
AST#method_declaration#Left private arrayToList AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] 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 AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T 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 list = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left JArrayList AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T 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 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 array 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 let AST#variable_declarator#Left data : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left array 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left list AST#expression#Right . add 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#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left list AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private arrayToList(array: T[]): JArrayList<T> {
let list = new JArrayList<T>();
for (let i = 0; i < array.length; i++) {
let data: T = array[i];
list.add(data);
}
return list;
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ChartData.ets#L83-L92
|
c335d69ed41d86231eb115d92b9fb2d2d5373694
|
gitee
|
mayuanwei/harmonyOS_bilibili
|
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
|
Q1/grammar/entry/src/main/ets/pages/LifeCycle1.ets
|
arkts
|
onPageShow
|
页面显示
|
onPageShow() {
console.log('page1...onPageShow')
}
|
AST#method_declaration#Left onPageShow 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 console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'page1...onPageShow' 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
|
onPageShow() {
console.log('page1...onPageShow')
}
|
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/Q1/grammar/entry/src/main/ets/pages/LifeCycle1.ets#L45-L47
|
19ba059078110cce4739d31c216b586b6f0c6ce5
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/healthchart/src/main/ets/view/LineCharts.ets
|
arkts
|
customUi
|
图表的Marker(标志气泡)组件 图表Marker(标志气泡)组件
|
@Builder
customUi() {
// 是否在图表content内
if (this.customUiInfo.isInbounds && this.customUiInfo.data) {
Column() {
Text(this.customUiInfo.getFormattedValue())
.fontColor(Color.White)
.fontSize($r('app.integer.bar_chart_health_font_size_twelve'))
.fontWeight(FontWeight.Bold)
Text(`${this.customUiInfo.type === HEART_RATE ? HEART_RATES : STEP_NUMBER}: ${JSON.stringify(this.customUiInfo.data.getY())}`)
.fontColor(Color.White)
.fontSize($r('app.integer.bar_chart_health_font_size_twelve'))
}
.padding($r('app.integer.bar_chart_health_padding_four'))
.borderRadius($r('app.integer.bar_chart_health_radius_six'))
.border({
width: $r('app.integer.bar_chart_health_border_width_one'),
color: this.customUiInfo.type === HEART_RATE ? Color.Orange : Color.Blue
})
.backgroundColor($r('app.color.bar_chart_health_bg_color'))
.width(this.customUiInfo.width)
.height(this.customUiInfo.height)
.margin({ left: this.customUiInfo.x, top: this.customUiInfo.y })
.alignItems(HorizontalAlign.Start)
.justifyContent(FlexAlign.Center)
.onClick(() => {
this.customUiInfo.showUi = false;
})
}
}
// 图表数据初始化
aboutToAppear(): void {
// 构建Marker组件
this.customUiInfo = new CustomUiInfo(this.type, CUSTOM_WIDTH, CUSTOM_HEIGHT);
// TODO 知识点:必须初始化图表配置构建类
this.model = new LineChartModel();
this.model.setPinchZoom(false);
this.model.setDrawGridBackground(false);
// TODO 知识点:配置图表指定样式,各部件间没有先后之分
// 获取图表描述部件,设置图表描述部件不可用,即图表不进行绘制描述部件
const description: Description | null = this.model.getDescription();
if (description) {
description.setEnabled(false);
}
// 设置X轴信息
this.xAxis = this.model.getXAxis();
if (this.xAxis) {
//设置标签位置
this.xAxis.setPosition(XAxisPosition.BOTTOM);
// 设置X轴是否绘制网格线
this.xAxis.setDrawGridLines(true);
this.xAxis.setGranularity(1);
// 设置数据的格式转换器
this.xAxis.setValueFormatter(new XValueFormatter());
// 设置绘制标签个数
this.xAxis.setLabelCount(10);
this.xAxis.enableGridDashedLine(2, 2, 0);
}
// 设置图表左Y轴信息
this.leftAxis = this.model.getAxisLeft();
if (this.leftAxis) {
this.leftAxis.setLabelCount(4, true);
this.leftAxis.setDrawGridLines(true);
// 设置图表左Y轴是否在数据后绘制限制线
this.leftAxis.setDrawGridLinesBehindData(true);
this.leftAxis.setPosition(YAxisLabelPosition.OUTSIDE_CHART);
this.leftAxis.setAxisMinimum(0);
// 设置图表左Y轴数据的格式转换器
this.leftAxis.setValueFormatter(new YValueFormatter());
this.leftAxis.setEnabled(true);
this.leftAxis.enableGridDashedLine(2, 2, 0);
}
// 设置图表右Y轴信息
this.rightAxis = this.model.getAxisRight();
if (this.rightAxis) {
// 设置图表右Y轴是否显示
this.rightAxis.setEnabled(false);
}
// 获取图表图例部件,设置图表图例部件不可用
const legend: Legend | null = this.model.getLegend();
if (legend) {
legend.setEnabled(true);
// 设置图例类型
legend.setForm(LegendForm.LINE);
// 设置图例文本大小
legend.setTextSize(TEXT_SIZE);
// 设置图例方向为水平
legend.setOrientation(LegendOrientation.HORIZONTAL);
// 设置图例垂直对齐方式为顶部
legend.setVerticalAlignment(LegendVerticalAlignment.TOP);
// 设置图例水平对齐方式为左对齐
legend.setHorizontalAlignment(LegendHorizontalAlignment.LEFT);
}
// TODO 知识点:将数据与图表配置类绑定
this.model.setData(this.lineData);
// 设置模型是否可缩放
this.model.setScaleEnabled(false);
this.lineData = this.getLineData();
if (this.model) {
this.model.setData(this.lineData);
this.model.invalidate();
}
}
// 生成线形图数据
private getLineData(): LineData {
const START: number = 0;
const values: JArrayList<EntryOhos> = new JArrayList<EntryOhos>();
const values2: JArrayList<EntryOhos> = new JArrayList<EntryOhos>();
for (let i = START; i < this.todayData.length; i++) {
values.add(new EntryOhos(i, this.todayData[i]));
}
for (let i = START; i < this.referenceData.length; i++) {
values2.add(new EntryOhos(i, this.referenceData[i]));
}
const dataSetList: JArrayList<ILineDataSet> = new JArrayList<ILineDataSet>();
const dataSet = new LineDataSet(values, '今日');
// 设置数据高亮颜色
dataSet.setHighLightColor(Color.Red);
// 设置数据高亮线的宽度
dataSet.setHighlightLineWidth(0.1);
// 不绘制数据值
dataSet.setDrawValues(false);
dataSet.setLineWidth(1.5);
dataSet.setDrawIcons(false);
// 设置曲线为贝塞尔曲线模式
dataSet.setMode(Mode.CUBIC_BEZIER);
// 折线点不画圆圈
dataSet.setDrawCircles(false);
// 设置曲线颜色
dataSet.setColorByColor(this.customUiInfo.type === HEART_RATE ? Color.Orange : Color.Blue);
const gradientFillColor = new JArrayList<ChartColorStop>();
gradientFillColor.add([this.customUiInfo.type === HEART_RATE ? HEART_FILL_COLOR3 : STEP_FILL_COLOR3, 0.2]);
gradientFillColor.add([this.customUiInfo.type === HEART_RATE ? HEART_FILL_COLOR2 : STEP_FILL_COLOR2, 0.6]);
gradientFillColor.add([this.customUiInfo.type === HEART_RATE ? HEART_FILL_COLOR1 : STEP_FILL_COLOR1, 1.0]);
// 设置渐变色填充
dataSet.setGradientFillColor(gradientFillColor);
dataSet.setDrawFilled(true);
dataSetList.add(dataSet);
const dataSet2 = new LineDataSet(values2, REFERENCE);
dataSet2.setHighLightColor(Color.Black);
dataSet2.setHighlightLineWidth(0.1);
dataSet2.setDrawValues(false);
dataSet2.setLineWidth(1.5);
dataSet2.setDrawIcons(false);
dataSet2.setMode(Mode.CUBIC_BEZIER);
dataSet2.setDrawCircles(false);
dataSet2.setColorByColor(Color.Green);
dataSetList.add(dataSet2);
return new LineData(dataSetList);
}
build() {
LineChart({
model: this.model,
// 自定义 ui: 传入 builder
customUiBuilder: this.customUi,
// 通过什么事件触发
customUiTriggerEvent: EventType.SingleTap,
// 自定义ui的位置信息
customUiInfo: this.customUiInfo,
})
.id(this.type === HEART_RATE ? 'heartRate' : 'stepNumber')
.width($r('app.string.bar_chart_health_layout_full_size'))
.height($r('app.string.bar_chart_health_layout_forty'))
.margin({ top: $r('app.integer.bar_chart_health_margin_five'), bottom: $r('app.integer.bar_chart_health_margin_twenty') })
}
}
// 设置X轴数据的格式转换器
class XValueFormatter implements IAxisValueFormatter {
getFormattedValue(value: number, axis: AxisBase): string {
switch (value) {
case 0:
return '0:00';
case 3:
return '3:00';
case 6:
return '6:00';
case 9:
return '9:00';
case 12:
return '12:00';
case 15:
return '15:00';
case 18:
return '18:00';
case 21:
return '21:00';
case 24:
return '+1';
case 27:
return '3:00';
}
return value + '';
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right customUi AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 是否在图表content内 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 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 . customUiInfo AST#member_expression#Right AST#expression#Right . isInbounds AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . customUiInfo AST#member_expression#Right AST#expression#Right . data AST#member_expression#Right AST#expression#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . customUiInfo AST#member_expression#Right AST#expression#Right . getFormattedValue 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#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.bar_chart_health_font_size_twelve' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold 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 Text ( AST#ERROR#Left ` AST#template_substitution#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 . customUiInfo AST#member_expression#Right AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left HEART_RATE AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left ? AST#ERROR#Left HEART_RATES : STEP_NUMBER } : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#state_binding_expression#Left $ AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left JSON AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . stringify AST#member_expression#Right AST#state_binding_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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . customUiInfo AST#member_expression#Right AST#expression#Right . data AST#member_expression#Right AST#expression#Right . getY 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 } ` )
.fontColor(Color.White)
.fontSize( $ r AST#ERROR#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#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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left 'app.integer.bar_chart_health_font_size_twelve' AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#ERROR#Left ) } AST#ERROR#Right . padding AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.bar_chart_health_padding_four' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . borderRadius AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.bar_chart_health_radius_six' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . border 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 width AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.bar_chart_health_border_width_one' 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#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . customUiInfo AST#member_expression#Right AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left HEART_RATE AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Orange AST#member_expression#Right AST#expression#Right : AST#expression#Left Color AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Blue 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 . backgroundColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.bar_chart_health_bg_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . width 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 . customUiInfo 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 . height 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 . customUiInfo 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 . margin 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 left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . customUiInfo AST#member_expression#Right AST#expression#Right . x AST#member_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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . customUiInfo AST#member_expression#Right AST#expression#Right . y 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 . alignItems AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . justifyContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onClick 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . customUiInfo AST#member_expression#Right AST#expression#Right . showUi 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#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Right } AST#template_substitution#Right
}
// 图表数据初始化
aboutToAppear(): void {
// 构建Marker组件
this.customUiInfo = new CustomUiInfo(this.type, CUSTOM_WIDTH, CUSTOM_HEIGHT);
// TODO 知识点:必须初始化图表配置构建类
this.model = new LineChartModel();
this.model.setPinchZoom(false);
this.model.setDrawGridBackground(false);
// TODO 知识点:配置图表指定样式,各部件间没有先后之分
// 获取图表描述部件,设置图表描述部件不可用,即图表不进行绘制描述部件
const description: Description | null = this.model.getDescription();
if (description) {
description.setEnabled(false);
}
// 设置X轴信息
this.xAxis = this.model.getXAxis();
if (this.xAxis) {
//设置标签位置
this.xAxis.setPosition(XAxisPosition.BOTTOM);
// 设置X轴是否绘制网格线
this.xAxis.setDrawGridLines(true);
this.xAxis.setGranularity(1);
// 设置数据的格式转换器
this.xAxis.setValueFormatter(new XValueFormatter());
// 设置绘制标签个数
this.xAxis.setLabelCount(10);
this.xAxis.enableGridDashedLine(2, 2, 0);
}
// 设置图表左Y轴信息
this.leftAxis = this.model.getAxisLeft();
if (this.leftAxis) {
this.leftAxis.setLabelCount(4, true);
this.leftAxis.setDrawGridLines(true);
// 设置图表左Y轴是否在数据后绘制限制线
this.leftAxis.setDrawGridLinesBehindData(true);
this.leftAxis.setPosition(YAxisLabelPosition.OUTSIDE_CHART);
this.leftAxis.setAxisMinimum(0);
// 设置图表左Y轴数据的格式转换器
this.leftAxis.setValueFormatter(new YValueFormatter());
this.leftAxis.setEnabled(true);
this.leftAxis.enableGridDashedLine(2, 2, 0);
}
// 设置图表右Y轴信息
this.rightAxis = this.model.getAxisRight();
if (this.rightAxis) {
// 设置图表右Y轴是否显示
this.rightAxis.setEnabled(false);
}
// 获取图表图例部件,设置图表图例部件不可用
const legend: Legend | null = this.model.getLegend();
if (legend) {
legend.setEnabled(true);
// 设置图例类型
legend.setForm(LegendForm.LINE);
// 设置图例文本大小
legend.setTextSize(TEXT_SIZE);
// 设置图例方向为水平
legend.setOrientation(LegendOrientation.HORIZONTAL);
// 设置图例垂直对齐方式为顶部
legend.setVerticalAlignment(LegendVerticalAlignment.TOP);
// 设置图例水平对齐方式为左对齐
legend.setHorizontalAlignment(LegendHorizontalAlignment.LEFT);
}
// TODO 知识点:将数据与图表配置类绑定
this.model.setData(this.lineData);
// 设置模型是否可缩放
this.model.setScaleEnabled(false);
this.lineData = this.getLineData();
if (this.model) {
this.model.setData(this.lineData);
this.model.invalidate();
}
}
// 生成线形图数据
private getLineData(): LineData {
const START: number = 0;
const values: JArrayList<EntryOhos> = new JArrayList<EntryOhos>();
const values2: JArrayList<EntryOhos> = new JArrayList<EntryOhos>();
for (let i = START; i < this.todayData.length; i++) {
values.add(new EntryOhos(i, this.todayData[i]));
}
for (let i = START; i < this.referenceData.length; i++) {
values2.add(new EntryOhos(i, this.referenceData[i]));
}
const dataSetList: JArrayList<ILineDataSet> = new JArrayList<ILineDataSet>();
const dataSet = new LineDataSet(values, '今日');
// 设置数据高亮颜色
dataSet.setHighLightColor(Color.Red);
// 设置数据高亮线的宽度
dataSet.setHighlightLineWidth(0.1);
// 不绘制数据值
dataSet.setDrawValues(false);
dataSet.setLineWidth(1.5);
dataSet.setDrawIcons(false);
// 设置曲线为贝塞尔曲线模式
dataSet.setMode(Mode.CUBIC_BEZIER);
// 折线点不画圆圈
dataSet.setDrawCircles(false);
// 设置曲线颜色
dataSet.setColorByColor(this.customUiInfo.type === HEART_RATE ? Color.Orange : Color.Blue);
const gradientFillColor = new JArrayList<ChartColorStop>();
gradientFillColor.add([this.customUiInfo.type === HEART_RATE ? HEART_FILL_COLOR3 : STEP_FILL_COLOR3, 0.2]);
gradientFillColor.add([this.customUiInfo.type === HEART_RATE ? HEART_FILL_COLOR2 : STEP_FILL_COLOR2, 0.6]);
gradientFillColor.add([this.customUiInfo.type === HEART_RATE ? HEART_FILL_COLOR1 : STEP_FILL_COLOR1, 1.0]);
// 设置渐变色填充
dataSet.setGradientFillColor(gradientFillColor);
dataSet.setDrawFilled(true);
dataSetList.add(dataSet);
const dataSet2 = new LineDataSet(values2, REFERENCE);
dataSet2.setHighLightColor(Color.Black);
dataSet2.setHighlightLineWidth(0.1);
dataSet2.setDrawValues(false);
dataSet2.setLineWidth(1.5);
dataSet2.setDrawIcons(false);
dataSet2.setMode(Mode.CUBIC_BEZIER);
dataSet2.setDrawCircles(false);
dataSet2.setColorByColor(Color.Green);
dataSetList.add(dataSet2);
return new LineData(dataSetList);
}
build() {
LineChart({
model: this.model,
// 自定义 ui: 传入 builder
customUiBuilder: this.customUi,
// 通过什么事件触发
customUiTriggerEvent: EventType.SingleTap,
// 自定义ui的位置信息
customUiInfo: this.customUiInfo,
})
.id(this.type === HEART_RATE ? 'heartRate' : 'stepNumber')
.width( $ r AST#ERROR#Right AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left 'app.string.bar_chart_health_layout_full_size' AST#expression#Right ) AST#parenthesized_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.string.bar_chart_health_layout_forty' 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 top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.bar_chart_health_margin_five' 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.integer.bar_chart_health_margin_twenty' 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#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 // 设置X轴数据的格式转换器 AST#expression_statement#Left AST#expression#Left class AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left XValueFormatter AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left implements AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left IAxisValueFormatter AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left getFormattedValue AST#property_name#Right 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 axis : AST#type_annotation#Left AST#primary_type#Left AxisBase 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left switch AST#expression#Right AST#argument_list#Left ( AST#expression#Left value 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#object_literal#Left { AST#property_assignment#Left AST#property_name#Left case AST#property_name#Right AST#ERROR#Left 0 AST#ERROR#Right : AST#expression#Left return AST#expression#Right AST#property_assignment#Right AST#object_literal#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left '0:00' AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 3 AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : AST#ERROR#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left '3:00' AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 6 AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : AST#ERROR#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left '6:00' AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 9 AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : AST#ERROR#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left '9:00' AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 12 AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : AST#ERROR#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left '12:00' AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 15 AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : AST#ERROR#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left '15:00' AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 18 AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : AST#ERROR#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left '18:00' AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 21 AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : AST#ERROR#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left '21:00' AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 24 AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : AST#ERROR#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left '+1' AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 27 AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : AST#ERROR#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left '3:00' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#property_assignment#Right AST#object_literal#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 value AST#expression#Right + AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
customUi() {
if (this.customUiInfo.isInbounds && this.customUiInfo.data) {
Column() {
Text(this.customUiInfo.getFormattedValue())
.fontColor(Color.White)
.fontSize($r('app.integer.bar_chart_health_font_size_twelve'))
.fontWeight(FontWeight.Bold)
Text(`${this.customUiInfo.type === HEART_RATE ? HEART_RATES : STEP_NUMBER}: ${JSON.stringify(this.customUiInfo.data.getY())}`)
.fontColor(Color.White)
.fontSize($r('app.integer.bar_chart_health_font_size_twelve'))
}
.padding($r('app.integer.bar_chart_health_padding_four'))
.borderRadius($r('app.integer.bar_chart_health_radius_six'))
.border({
width: $r('app.integer.bar_chart_health_border_width_one'),
color: this.customUiInfo.type === HEART_RATE ? Color.Orange : Color.Blue
})
.backgroundColor($r('app.color.bar_chart_health_bg_color'))
.width(this.customUiInfo.width)
.height(this.customUiInfo.height)
.margin({ left: this.customUiInfo.x, top: this.customUiInfo.y })
.alignItems(HorizontalAlign.Start)
.justifyContent(FlexAlign.Center)
.onClick(() => {
this.customUiInfo.showUi = false;
})
}
}
// 图表数据初始化
aboutToAppear(): void {
// 构建Marker组件
this.customUiInfo = new CustomUiInfo(this.type, CUSTOM_WIDTH, CUSTOM_HEIGHT);
// TODO 知识点:必须初始化图表配置构建类
this.model = new LineChartModel();
this.model.setPinchZoom(false);
this.model.setDrawGridBackground(false);
// TODO 知识点:配置图表指定样式,各部件间没有先后之分
// 获取图表描述部件,设置图表描述部件不可用,即图表不进行绘制描述部件
const description: Description | null = this.model.getDescription();
if (description) {
description.setEnabled(false);
}
// 设置X轴信息
this.xAxis = this.model.getXAxis();
if (this.xAxis) {
//设置标签位置
this.xAxis.setPosition(XAxisPosition.BOTTOM);
// 设置X轴是否绘制网格线
this.xAxis.setDrawGridLines(true);
this.xAxis.setGranularity(1);
// 设置数据的格式转换器
this.xAxis.setValueFormatter(new XValueFormatter());
// 设置绘制标签个数
this.xAxis.setLabelCount(10);
this.xAxis.enableGridDashedLine(2, 2, 0);
}
// 设置图表左Y轴信息
this.leftAxis = this.model.getAxisLeft();
if (this.leftAxis) {
this.leftAxis.setLabelCount(4, true);
this.leftAxis.setDrawGridLines(true);
// 设置图表左Y轴是否在数据后绘制限制线
this.leftAxis.setDrawGridLinesBehindData(true);
this.leftAxis.setPosition(YAxisLabelPosition.OUTSIDE_CHART);
this.leftAxis.setAxisMinimum(0);
// 设置图表左Y轴数据的格式转换器
this.leftAxis.setValueFormatter(new YValueFormatter());
this.leftAxis.setEnabled(true);
this.leftAxis.enableGridDashedLine(2, 2, 0);
}
// 设置图表右Y轴信息
this.rightAxis = this.model.getAxisRight();
if (this.rightAxis) {
// 设置图表右Y轴是否显示
this.rightAxis.setEnabled(false);
}
// 获取图表图例部件,设置图表图例部件不可用
const legend: Legend | null = this.model.getLegend();
if (legend) {
legend.setEnabled(true);
// 设置图例类型
legend.setForm(LegendForm.LINE);
// 设置图例文本大小
legend.setTextSize(TEXT_SIZE);
// 设置图例方向为水平
legend.setOrientation(LegendOrientation.HORIZONTAL);
// 设置图例垂直对齐方式为顶部
legend.setVerticalAlignment(LegendVerticalAlignment.TOP);
// 设置图例水平对齐方式为左对齐
legend.setHorizontalAlignment(LegendHorizontalAlignment.LEFT);
}
// TODO 知识点:将数据与图表配置类绑定
this.model.setData(this.lineData);
// 设置模型是否可缩放
this.model.setScaleEnabled(false);
this.lineData = this.getLineData();
if (this.model) {
this.model.setData(this.lineData);
this.model.invalidate();
}
}
// 生成线形图数据
private getLineData(): LineData {
const START: number = 0;
const values: JArrayList<EntryOhos> = new JArrayList<EntryOhos>();
const values2: JArrayList<EntryOhos> = new JArrayList<EntryOhos>();
for (let i = START; i < this.todayData.length; i++) {
values.add(new EntryOhos(i, this.todayData[i]));
}
for (let i = START; i < this.referenceData.length; i++) {
values2.add(new EntryOhos(i, this.referenceData[i]));
}
const dataSetList: JArrayList<ILineDataSet> = new JArrayList<ILineDataSet>();
const dataSet = new LineDataSet(values, '今日');
// 设置数据高亮颜色
dataSet.setHighLightColor(Color.Red);
// 设置数据高亮线的宽度
dataSet.setHighlightLineWidth(0.1);
// 不绘制数据值
dataSet.setDrawValues(false);
dataSet.setLineWidth(1.5);
dataSet.setDrawIcons(false);
// 设置曲线为贝塞尔曲线模式
dataSet.setMode(Mode.CUBIC_BEZIER);
// 折线点不画圆圈
dataSet.setDrawCircles(false);
// 设置曲线颜色
dataSet.setColorByColor(this.customUiInfo.type === HEART_RATE ? Color.Orange : Color.Blue);
const gradientFillColor = new JArrayList<ChartColorStop>();
gradientFillColor.add([this.customUiInfo.type === HEART_RATE ? HEART_FILL_COLOR3 : STEP_FILL_COLOR3, 0.2]);
gradientFillColor.add([this.customUiInfo.type === HEART_RATE ? HEART_FILL_COLOR2 : STEP_FILL_COLOR2, 0.6]);
gradientFillColor.add([this.customUiInfo.type === HEART_RATE ? HEART_FILL_COLOR1 : STEP_FILL_COLOR1, 1.0]);
// 设置渐变色填充
dataSet.setGradientFillColor(gradientFillColor);
dataSet.setDrawFilled(true);
dataSetList.add(dataSet);
const dataSet2 = new LineDataSet(values2, REFERENCE);
dataSet2.setHighLightColor(Color.Black);
dataSet2.setHighlightLineWidth(0.1);
dataSet2.setDrawValues(false);
dataSet2.setLineWidth(1.5);
dataSet2.setDrawIcons(false);
dataSet2.setMode(Mode.CUBIC_BEZIER);
dataSet2.setDrawCircles(false);
dataSet2.setColorByColor(Color.Green);
dataSetList.add(dataSet2);
return new LineData(dataSetList);
}
build() {
LineChart({
model: this.model,
// 自定义 ui: 传入 builder
customUiBuilder: this.customUi,
// 通过什么事件触发
customUiTriggerEvent: EventType.SingleTap,
// 自定义ui的位置信息
customUiInfo: this.customUiInfo,
})
.id(this.type === HEART_RATE ? 'heartRate' : 'stepNumber')
.width($r('app.string.bar_chart_health_layout_full_size'))
.height($r('app.string.bar_chart_health_layout_forty'))
.margin({ top: $r('app.integer.bar_chart_health_margin_five'), bottom: $r('app.integer.bar_chart_health_margin_twenty') })
}
}
class XValueFormatter implements IAxisValueFormatter {
getFormattedValue(value: number, axis: AxisBase): string {
switch (value) {
case 0:
return '0:00';
case 3:
return '3:00';
case 6:
return '6:00';
case 9:
return '9:00';
case 12:
return '12:00';
case 15:
return '15:00';
case 18:
return '18:00';
case 21:
return '21:00';
case 24:
return '+1';
case 27:
return '3:00';
}
return value + '';
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/healthchart/src/main/ets/view/LineCharts.ets#L74-L271
|
1b536c0eea43329c308cd04a6e883ae06ea35f43
|
gitee
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/DataRenderer.ets
|
arkts
|
drawHighlighted
|
Draws all highlight indicators for the values that are currently highlighted.
@param c
@param indices the highlighted values
|
public abstract drawHighlighted(indices: Highlight[]): Paint[];
|
AST#method_declaration#Left public abstract drawHighlighted AST#parameter_list#Left ( AST#parameter#Left indices : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Highlight [ ] 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 AST#array_type#Left Paint [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
|
public abstract drawHighlighted(indices: Highlight[]): Paint[];
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/DataRenderer.ets#L193-L193
|
ffb7bf4f9a661c39c3bb56b04525b6fa14ab74b4
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/common/i18n/I18nManager.ets
|
arkts
|
getCurrentLanguageInfo
|
获取当前语言信息
|
getCurrentLanguageInfo(): LanguageInfo | undefined {
return this.supportedLanguages.get(this.currentLanguage);
}
|
AST#method_declaration#Left getCurrentLanguageInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left LanguageInfo 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#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 . supportedLanguages AST#member_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 this AST#expression#Right . currentLanguage 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
|
getCurrentLanguageInfo(): LanguageInfo | undefined {
return this.supportedLanguages.get(this.currentLanguage);
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/I18nManager.ets#L366-L368
|
9042708fe47838d8c5d1003e05c4962b91897576
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/BatteryStatsUtil.ets
|
arkts
|
getItemDataHardware
|
获取硬件耗电信息
@return {BatteryStatsModel} new BatteryStatsModel()
|
getItemDataHardware(type: batteryStats.ConsumptionType) {
let power = 0;
let percent = 0;
try {
// 根据耗电类型获取耗电百分比。
percent = batteryStats.getHardwareUnitPowerPercent(type);
} catch (err) {
logger.info(TAG, `getHardwareUnitPowerPercent failed:${type}, ${err}`);
}
let itemInfo: BatteryStatsModel = new BatteryStatsModel();
itemInfo.power = power;
itemInfo.percent = percent;
itemInfo.icon = this.getHardwareIcon(type);
itemInfo.name = this.getHardwareName(type);
return itemInfo;
}
|
AST#method_declaration#Left getItemDataHardware AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left batteryStats . ConsumptionType AST#qualified_type#Right 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 power = 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 percent = 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left percent = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left batteryStats AST#expression#Right . getHardwareUnitPowerPercent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type 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#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 . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` getHardwareUnitPowerPercent failed: AST#template_substitution#Left $ { AST#expression#Left type AST#expression#Right } AST#template_substitution#Right , 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#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left itemInfo : AST#type_annotation#Left AST#primary_type#Left BatteryStatsModel 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 BatteryStatsModel 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 itemInfo AST#expression#Right . power AST#member_expression#Right = AST#expression#Left power 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 itemInfo AST#expression#Right . percent AST#member_expression#Right = AST#expression#Left percent 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 itemInfo AST#expression#Right . icon 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 . getHardwareIcon AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type 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 AST#member_expression#Left AST#expression#Left itemInfo AST#expression#Right . name 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 . getHardwareName AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type 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#return_statement#Left return AST#expression#Left itemInfo AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getItemDataHardware(type: batteryStats.ConsumptionType) {
let power = 0;
let percent = 0;
try {
percent = batteryStats.getHardwareUnitPowerPercent(type);
} catch (err) {
logger.info(TAG, `getHardwareUnitPowerPercent failed:${type}, ${err}`);
}
let itemInfo: BatteryStatsModel = new BatteryStatsModel();
itemInfo.power = power;
itemInfo.percent = percent;
itemInfo.icon = this.getHardwareIcon(type);
itemInfo.name = this.getHardwareName(type);
return itemInfo;
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/BatteryStatsUtil.ets#L207-L222
|
34d25d590076e20c70ef30baffedc2ce7f8a2a23
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/LogUtil.ets
|
arkts
|
setHilog
|
日志打印方式
@param isHilog,true-hilog、false-console
|
public static setHilog(isHilog: boolean) {
LogUtil.isHilog = isHilog;
}
|
AST#method_declaration#Left public static setHilog AST#parameter_list#Left ( AST#parameter#Left isHilog : 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#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . isHilog AST#member_expression#Right = AST#expression#Left isHilog AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public static setHilog(isHilog: boolean) {
LogUtil.isHilog = isHilog;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LogUtil.ets#L77-L79
|
bc0f88443e6a12e00089adab5215403d6d7b05a0
|
gitee
|
common-apps/ZRouter
|
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
|
RouterApi/src/main/ets/api/Router.ets
|
arkts
|
pushByStackName
|
@deprecated
@param stackName
@param name
@param param
@param animated
|
public static pushByStackName(stackName: string, name: string, param?: ObjectOrNull,
animated: boolean = true) {
ZRouter.getRouterMgr().pushByStackName(stackName, name, param, animated)
}
|
AST#method_declaration#Left public static pushByStackName AST#parameter_list#Left ( AST#parameter#Left stackName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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 ObjectOrNull AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left animated : 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#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 . pushByStackName AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left stackName AST#expression#Right , AST#expression#Left name AST#expression#Right , AST#expression#Left param AST#expression#Right , AST#expression#Left animated 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 pushByStackName(stackName: string, name: string, param?: ObjectOrNull,
animated: boolean = true) {
ZRouter.getRouterMgr().pushByStackName(stackName, name, param, animated)
}
|
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L583-L586
|
d6edc7ca9c914334f6e83bb08d7c5d3546c6ed27
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/pipwindow/src/main/ets/model/AVPlayer.ets
|
arkts
|
getPlay
|
播放视频
|
getPlay() {
if (this.isCreate) {
this.flag = true; // 视频准备完毕
this.avPlayer.play();
}
}
|
AST#method_declaration#Left getPlay AST#parameter_list#Left ( ) AST#parameter_list#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 this AST#expression#Right . isCreate 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 . flag 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . play 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#builder_function_body#Right AST#method_declaration#Right
|
getPlay() {
if (this.isCreate) {
this.flag = true;
this.avPlayer.play();
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pipwindow/src/main/ets/model/AVPlayer.ets#L85-L90
|
e71cbdbd5dd108890effd37a389fae845e219c79
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/Base64Util.ets
|
arkts
|
decodeSync
|
解码,通过输入参数解码后输出对应Uint8Array对象。
@param array
@returns
|
static decodeSync(array: Uint8Array | string, options?: util.Type): Uint8Array {
const base64 = new util.Base64Helper();
const 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 const 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 const 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 {
const base64 = new util.Base64Helper();
const result = base64.decodeSync(array, options);
return result;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/Base64Util.ets#L85-L89
|
d9027ba0421e42d1ab4beeca398b01d7e1d6ee2d
|
gitee
|
zhongte/TaoYao
|
80850f3800dd6037216d3f7c58a2bf34a881c93f
|
taoyao/src/main/ets/shijing/taoyao/picker/document/DocumentBuilder.ets
|
arkts
|
setDefaultFilePathUri
|
指定选择的文件或者目录路径(可选)
@param defaultFilePathUri
@returns
|
public setDefaultFilePathUri(defaultFilePathUri: string): DocumentBuilder {
this._defaultFilePathUri = defaultFilePathUri
return this
}
|
AST#method_declaration#Left public setDefaultFilePathUri AST#parameter_list#Left ( AST#parameter#Left defaultFilePathUri : 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 DocumentBuilder 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 . _defaultFilePathUri AST#member_expression#Right = AST#expression#Left defaultFilePathUri 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
|
public setDefaultFilePathUri(defaultFilePathUri: string): DocumentBuilder {
this._defaultFilePathUri = defaultFilePathUri
return this
}
|
https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/picker/document/DocumentBuilder.ets#L44-L47
|
e6f8f0169d9fca118522c18f8914ed888039409e
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/notification/NotificationManager.ets
|
arkts
|
calculateDaysUntilBirthday
|
计算距离生日的天数
|
private calculateDaysUntilBirthday(birthdayStr: string, today: Date): number {
const birthday = new Date(birthdayStr);
const thisYear = today.getFullYear();
const thisYearBirthday = new Date(thisYear, birthday.getMonth(), birthday.getDate());
let targetDate = thisYearBirthday;
if (thisYearBirthday < today) {
targetDate = new Date(thisYear + 1, birthday.getMonth(), birthday.getDate());
}
const diffTime = targetDate.getTime() - today.getTime();
return Math.ceil(diffTime / (1000 * 60 * 60 * 24));
}
|
AST#method_declaration#Left private calculateDaysUntilBirthday AST#parameter_list#Left ( AST#parameter#Left birthdayStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left today : AST#type_annotation#Left AST#primary_type#Left Date 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 birthday = 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#expression#Left birthdayStr 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 thisYear = 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 thisYearBirthday = 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#expression#Left thisYear AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left birthday 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left birthday 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#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 targetDate = AST#expression#Left thisYearBirthday 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 thisYearBirthday AST#expression#Right < AST#expression#Left today 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 targetDate = 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#expression#Left AST#binary_expression#Left AST#expression#Left thisYear AST#expression#Right + AST#expression#Left 1 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 birthday 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left birthday 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#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#variable_declaration#Left const AST#variable_declarator#Left diffTime = 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 targetDate 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#expression#Left today AST#expression#Right AST#binary_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#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 Math AST#expression#Right . ceil AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left diffTime AST#expression#Right / AST#expression#Left AST#parenthesized_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 1000 AST#expression#Right * AST#expression#Left 60 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left 60 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left 24 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private calculateDaysUntilBirthday(birthdayStr: string, today: Date): number {
const birthday = new Date(birthdayStr);
const thisYear = today.getFullYear();
const thisYearBirthday = new Date(thisYear, birthday.getMonth(), birthday.getDate());
let targetDate = thisYearBirthday;
if (thisYearBirthday < today) {
targetDate = new Date(thisYear + 1, birthday.getMonth(), birthday.getDate());
}
const diffTime = targetDate.getTime() - today.getTime();
return Math.ceil(diffTime / (1000 * 60 * 60 * 24));
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationManager.ets#L327-L339
|
9c1e93c72e8209ae93ed7c9c62d063bda7774ea9
|
github
|
sithvothykiv/dialog_hub.git
|
b676c102ef2d05f8994d170abe48dcc40cd39005
|
custom_dialog/src/main/ets/model/base/INavDialogParams.ets
|
arkts
|
navigation弹窗页面参数
|
export interface IDialogParams<T extends IBaseDialogOptions> {//, V extends IObservedData
builder?: WrappedBuilder<[T]>
options?: T
// observedData?: V
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface IDialogParams AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left IBaseDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#object_type#Left { //, V extends IObservedData AST#type_member#Left builder ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right ] AST#tuple_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#type_member#Right AST#type_member#Left options ? : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right // observedData?: V } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface IDialogParams<T extends IBaseDialogOptions> {
builder?: WrappedBuilder<[T]>
options?: T
}
|
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/base/INavDialogParams.ets#L7-L11
|
3a196a818eb648dc2423ac9adfcb43379b791281
|
github
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/h5cache/src/main/ets/common/DiskCacheManager.ets
|
arkts
|
submitToDisk
|
保存数据到磁盘中
@param key 键值
@param data 数据
|
submitToDisk(url: string, data: ResponseDataType) {
this.cache.set(url, data);
}
|
AST#method_declaration#Left submitToDisk AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left ResponseDataType 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cache AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left url 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#builder_function_body#Right AST#method_declaration#Right
|
submitToDisk(url: string, data: ResponseDataType) {
this.cache.set(url, data);
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/src/main/ets/common/DiskCacheManager.ets#L55-L57
|
c51a418edda26f0e293f2f8225c77f86870595b9
|
gitee
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
feature/demo/src/main/ets/view/ScreenAdaptDemoPage.ets
|
arkts
|
GridItemCard
|
网格卡片
@param {number} index - 序号
@returns {void} 无返回值
|
@Builder
private GridItemCard(index: number): void {
Column() {
this.CardTitle($r("app.string.demo_screen_adapt_grid_item_format", index));
SpaceVerticalSmall();
this.CardDesc($r("app.string.demo_screen_adapt_grid_desc"));
}
.width(P100)
.padding($r("app.float.space_padding_medium"))
.backgroundColor($r("app.color.bg_white"))
.borderRadius($r("app.float.radius_medium"));
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private GridItemCard 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#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 this AST#expression#Right . CardTitle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_screen_adapt_grid_item_format" AST#expression#Right , AST#expression#Left index AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#ui_custom_component_statement#Left SpaceVerticalSmall ( ) ; AST#ui_custom_component_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 . CardDesc AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_screen_adapt_grid_desc" AST#expression#Right ) AST#resource_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 . width ( AST#expression#Left P100 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.space_padding_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.bg_white" 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_medium" 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#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
private GridItemCard(index: number): void {
Column() {
this.CardTitle($r("app.string.demo_screen_adapt_grid_item_format", index));
SpaceVerticalSmall();
this.CardDesc($r("app.string.demo_screen_adapt_grid_desc"));
}
.width(P100)
.padding($r("app.float.space_padding_medium"))
.backgroundColor($r("app.color.bg_white"))
.borderRadius($r("app.float.radius_medium"));
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/ScreenAdaptDemoPage.ets#L145-L158
|
27934b09c4c9bce269152ecb1ac93cb1df5eda67
|
github
|
2763981847/Accounting-app.git
|
cf8302a42588ecce1561b82e8533798157157257
|
entry/src/main/ets/pages/StatisticPage.ets
|
arkts
|
渲染页面
|
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#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
|
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#L37-L182
|
c75968b5df08cdcdd9bc899312c06cb150fdb7d5
|
github
|
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
api/@ohos.atomicservice.AtomicServiceWeb.d.ets
|
arkts
|
refresh
|
Refreshes the current URL.
@throws { BusinessError } 17100001 - Init error. The AtomicServiceWebController must be associated with a
AtomicServiceWeb component.
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12
|
refresh(): void;
|
AST#method_declaration#Left refresh 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#method_declaration#Right
|
refresh(): void;
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L392-L392
|
957cfed28ba9b2de1c03fcc78e891ba9030ebe11
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/UdpClient_Server.ets
|
arkts
|
closeConnection
|
关闭连接
|
closeConnection() {
let tcpMessage: TcpMessage = {
type: 'disConnect'
};
workerPort.postMessage(tcpMessage);
workerPort.onmessage = (e: MessageEvents) => {
const response: TcpMessage = e.data;
if (response.type === 'close success') {
this.msgHistory += `Connection closed.\n`;
} else if (response.type === 'close fail') {
this.msgHistory += `Close failed\n`;
}
}
}
|
AST#method_declaration#Left closeConnection AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left tcpMessage : AST#type_annotation#Left AST#primary_type#Left TcpMessage AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left type AST#property_name#Right : AST#expression#Left 'disConnect' 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 workerPort AST#expression#Right . postMessage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tcpMessage 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 workerPort AST#expression#Right . onmessage AST#member_expression#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left e : AST#type_annotation#Left AST#primary_type#Left MessageEvents 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 const AST#variable_declarator#Left response : AST#type_annotation#Left AST#primary_type#Left TcpMessage AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . data 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left 'close success' 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 . msgHistory AST#member_expression#Right += AST#expression#Left AST#template_literal#Left ` Connection closed. \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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left 'close fail' 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 . msgHistory AST#member_expression#Right += AST#expression#Left AST#template_literal#Left ` Close failed \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#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#block_statement#Right AST#method_declaration#Right
|
closeConnection() {
let tcpMessage: TcpMessage = {
type: 'disConnect'
};
workerPort.postMessage(tcpMessage);
workerPort.onmessage = (e: MessageEvents) => {
const response: TcpMessage = e.data;
if (response.type === 'close success') {
this.msgHistory += `Connection closed.\n`;
} else if (response.type === 'close fail') {
this.msgHistory += `Close failed\n`;
}
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/UdpClient_Server.ets#L266-L282
|
3af7e8f3bb3ae9b9e89b9cb272b085ea415ec9bf
|
gitee
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
api/@ohos.atomicservice.AtomicServiceNavigation.d.ets
|
arkts
|
Indicates the options of Navigation's Titlebar.
@typedef TitleOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12
|
export interface TitleOptions {
/**
* Background color.
*
* @type { ?ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
backgroundColor?: ResourceColor;
/**
* Whether to enable the blur effect.
*
* @type { ?boolean }.
* @default true
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
isBlurEnabled?: boolean;
/**
* Set title bar style.
*
* @type { ?BarStyle }
* @default BarStyle.STANDARD
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
barStyle?: BarStyle;
/**
* Set title bar type.
*
* @type { ?TitleBarType }
* @default TitleBarType.ROUND_ICON
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
titleBarType?: TitleBarType;
/**
* Set title bar icon.
*
* @type { ?(Resource | SymbolGlyphModifier) }
* @default atomicservice icon
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
titleIcon?: Resource | SymbolGlyphModifier;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface TitleOptions AST#object_type#Left { /**
* Background color.
*
* @type { ?ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left backgroundColor ? : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* Whether to enable the blur effect.
*
* @type { ?boolean }.
* @default true
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left isBlurEnabled ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* Set title bar style.
*
* @type { ?BarStyle }
* @default BarStyle.STANDARD
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left barStyle ? : AST#type_annotation#Left AST#primary_type#Left BarStyle AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* Set title bar type.
*
* @type { ?TitleBarType }
* @default TitleBarType.ROUND_ICON
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/ AST#type_member#Left titleBarType ? : AST#type_annotation#Left AST#primary_type#Left TitleBarType AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* Set title bar icon.
*
* @type { ?(Resource | SymbolGlyphModifier) }
* @default atomicservice icon
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/ AST#type_member#Left titleIcon ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left SymbolGlyphModifier AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface TitleOptions {
backgroundColor?: ResourceColor;
isBlurEnabled?: boolean;
barStyle?: BarStyle;
titleBarType?: TitleBarType;
titleIcon?: Resource | SymbolGlyphModifier;
}
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceNavigation.d.ets#L318-L372
|
2086ff08d66a4f09b78242fc9a60b9d4e50f1ad7
|
gitee
|
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/BookDetailPage.ets
|
arkts
|
recordDividerStyle
|
分割线样式
|
@Extend(Divider)
function recordDividerStyle() {
.vertical(true)
.width(0.5)
.height(24)
.color('#40ffffff')
}
|
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Divider AST#expression#Right ) AST#decorator#Right function recordDividerStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . vertical ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 0.5 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left '#40ffffff' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right } AST#extend_function_body#Right AST#decorated_function_declaration#Right
|
@Extend(Divider)
function recordDividerStyle() {
.vertical(true)
.width(0.5)
.height(24)
.color('#40ffffff')
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/BookDetailPage.ets#L29-L35
|
8cf55adb3ef52914d6e5fbe0af1827ca27a18391
|
github
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/renderer/CombinedChartRenderer.ets
|
arkts
|
getSubRenderer
|
Returns the sub-renderer object at the specified index.
@param index
@return
|
public getSubRenderer(index: number): DataRenderer | null {
if (index >= this.mRenderers.size() || index < 0)
return null;
else
return this.mRenderers.get(index);
}
|
AST#method_declaration#Left public getSubRenderer 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#union_type#Left AST#primary_type#Left DataRenderer AST#primary_type#Right | AST#primary_type#Left null 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#binary_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 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 . mRenderers AST#member_expression#Right AST#expression#Right . size 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 index AST#expression#Right AST#binary_expression#Right 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 AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right else 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 . mRenderers AST#member_expression#Right AST#expression#Right . get 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#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public getSubRenderer(index: number): DataRenderer | null {
if (index >= this.mRenderers.size() || index < 0)
return null;
else
return this.mRenderers.get(index);
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/CombinedChartRenderer.ets#L182-L187
|
d28a7ac1854da730a5e1058832979c4ec91afdbd
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/ArkWeb/ManageWebPageInteracts/entry/src/main/ets/pages/OnIntKbdAttachSysCustIn.ets
|
arkts
|
customKeyboardBuilder
|
自定义键盘组件Builder
|
@Builder
customKeyboardBuilder() {
// 这里实现自定义键盘组件,对接WebKeyboardController实现输入、删除、关闭等操作。
Row() {
Text('finish')
.fontSize(20)
.fontColor(Color.Blue)
.onClick(() => {
this.webKeyboardController.close();
})
// 插入字符。
Button('insertText').onClick(() => {
this.webKeyboardController.insertText('insert ');
}).margin({
bottom: 200,
});
// 从后往前删除length参数指定长度的字符。
Button('deleteForward').onClick(() => {
this.webKeyboardController.deleteForward(1);
}).margin({
bottom: 200,
});
// 从前往后删除length参数指定长度的字符。
Button('deleteBackward').onClick(() => {
this.webKeyboardController.deleteBackward(1);
}).margin({
left: -220,
});
// 插入功能按键。
Button('sendFunctionKey').onClick(() => {
this.webKeyboardController.sendFunctionKey(6);
})
}
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right customKeyboardBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 这里实现自定义键盘组件,对接WebKeyboardController实现输入、删除、关闭等操作。 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 'finish' 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 Color AST#expression#Right . Blue AST#member_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 { 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 . webKeyboardController 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#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 'insertText' 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#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 . webKeyboardController AST#member_expression#Right AST#expression#Right . insertText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'insert ' 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#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 200 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#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right // 从后往前删除length参数指定长度的字符。 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'deleteForward' 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#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 . webKeyboardController AST#member_expression#Right AST#expression#Right . deleteForward AST#member_expression#Right 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#block_statement#Right AST#arrow_function#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 bottom AST#property_name#Right : AST#expression#Left 200 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#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right // 从前往后删除length参数指定长度的字符。 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'deleteBackward' 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#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 . webKeyboardController AST#member_expression#Right AST#expression#Right . deleteBackward AST#member_expression#Right 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#block_statement#Right AST#arrow_function#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 left AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 220 AST#expression#Right AST#unary_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 Button ( AST#expression#Left 'sendFunctionKey' 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#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 . webKeyboardController AST#member_expression#Right AST#expression#Right . sendFunctionKey AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 6 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#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#builder_function_body#Right AST#method_declaration#Right
|
@Builder
customKeyboardBuilder() {
Row() {
Text('finish')
.fontSize(20)
.fontColor(Color.Blue)
.onClick(() => {
this.webKeyboardController.close();
})
Button('insertText').onClick(() => {
this.webKeyboardController.insertText('insert ');
}).margin({
bottom: 200,
});
Button('deleteForward').onClick(() => {
this.webKeyboardController.deleteForward(1);
}).margin({
bottom: 200,
});
Button('deleteBackward').onClick(() => {
this.webKeyboardController.deleteBackward(1);
}).margin({
left: -220,
});
Button('sendFunctionKey').onClick(() => {
this.webKeyboardController.sendFunctionKey(6);
})
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageInteracts/entry/src/main/ets/pages/OnIntKbdAttachSysCustIn.ets#L38-L71
|
a518b827dfe5324850ee13861509e603de4e0712
|
gitee
|
kaina404/HarmonyStock.git
|
99233a46fb0dfb21e02294c730fd80e2fb404f9b
|
entry/src/main/ets/pages/component/WuDangBuySellComponent.ets
|
arkts
|
WuDangBuySellComponent
|
买卖五档的基础组件
|
@Component
export struct WuDangBuySellComponent {
@Prop wuDangData: WuDangData
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private drawRect: DrawRect //可绘制内容的Rect
private canvasW: number //整个画布的宽度
private canvasH: number //整个画布的高度
private canvasDrawMargin = 10 //画布的边距
build() {
Column() {
if (this.wuDangData == undefined || this.wuDangData.buy == undefined || this.wuDangData.sell == undefined || this.wuDangData.buy.length <= 0 && this.wuDangData.sell.length <= 0) {
LoadingProgress()
} else {
Canvas(this.context)
.onReady(() => {
this.canvasW = this.context.width
this.canvasH = this.context.height
this.drawRect = new DrawRect(this.canvasDrawMargin, this.canvasDrawMargin, this.canvasW - this.canvasDrawMargin * 2, this.canvasH - this.canvasDrawMargin * 2)
this._drawUI()
})
}
}
}
//清空画布的所有内容
_clearCanvas() {
this.context.clearRect(0, 0, this.canvasW, this.canvasH)
}
//绘制UI
_drawUI() {
this._clearCanvas()
this._drawWuDangUI()
}
_drawWuDangUI() {
//根据drawRect的高度+买卖总计多少条数据 进行
// 反推计算出字体的大小,然后再绘制列表数据
//每个文字的高度
const itemTextHeight = this.drawRect.height / (this.wuDangData.sell.length + this.wuDangData.buy.length + 1)
const priceRect = new DrawRect(this.drawRect.startX, this.drawRect.startY, this.drawRect.width, itemTextHeight)
//反推计算每个文字的大小
//计算出最大的价格
var maxPrice = this.wuDangData.sell[0].price
var maxAmount = this.wuDangData.sell[0].amount
var allBuyAmount = 0
var allSellAmount = 0
this.wuDangData.sell.forEach((item) => {
if (item.price > maxPrice) {
maxPrice = item.price
}
if (item.amount > maxAmount) {
maxAmount = item.amount
}
allSellAmount += item.amount
})
this.wuDangData.buy.forEach((item) => {
if (item.price > maxPrice) {
maxPrice = item.price
}
if (item.amount > maxAmount) {
maxAmount = item.amount
}
allBuyAmount += item.amount
})
this.context.font = getTextMaxFontSize(this.context, priceRect, '25px', '卖1' + " " + maxPrice + " " + maxAmount)
this.wuDangData.sell.forEach((value: WuDangPrice, index) => {
//卖1
this.context.textAlign = 'left'
this.context.textBaseline = 'top'
this.context.fillStyle = '#737F8A'
this.context.fillText('卖' + (5 - index), 0, index * itemTextHeight)
//价格
this.context.textAlign = 'center'
this.context.textBaseline = 'top'
this.context.fillStyle = '#e2233e'
this.context.fillText(value.price.toString(), this.drawRect.width / 2, index * itemTextHeight)
//量
this.context.textAlign = 'right'
this.context.textBaseline = 'top'
this.context.fillStyle = '#000000'
this.context.fillText(value.amount.toString(), this.drawRect.getEndX(), index * itemTextHeight)
})
//绘制买卖力量对比量横线
const buyLength = (allBuyAmount / allBuyAmount + allSellAmount) * this.drawRect.width
//买横线
this.context.fillStyle = "#e2233e"
this.context.fillRect(this.drawRect.startX, this.drawRect.height / 2, buyLength, 2)
//卖横线
this.context.fillStyle = "#228B22"
this.context.fillRect(this.drawRect.width / 2, this.drawRect.height / 2, this.drawRect.width - buyLength, 2)
this.wuDangData.buy.forEach((value: WuDangPrice, index) => {
//买1
this.context.textAlign = 'left'
this.context.textBaseline = 'top'
this.context.fillStyle = '#737F8A'
this.context.fillText('买' + index, 0, (index + 1 + this.wuDangData.sell.length) * itemTextHeight)
//价格
this.context.textAlign = 'center'
this.context.textBaseline = 'top'
this.context.fillStyle = '#e2233e'
this.context.fillText(value.price.toString(), this.drawRect.width / 2, (index + 1 + this.wuDangData.sell.length) * itemTextHeight)
//量
this.context.textAlign = 'right'
this.context.textBaseline = 'top'
this.context.fillStyle = '#000000'
this.context.fillText(value.amount.toString(), this.drawRect.getEndX(), (index + 1 + this.wuDangData.sell.length) * itemTextHeight)
})
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct WuDangBuySellComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right wuDangData : AST#type_annotation#Left AST#primary_type#Left WuDangData AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#property_declaration#Left private settings : AST#type_annotation#Left AST#primary_type#Left RenderingContextSettings 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 RenderingContextSettings AST#expression#Right AST#new_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 AST#property_declaration#Right AST#property_declaration#Left private context : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D 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 CanvasRenderingContext2D AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . settings 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 drawRect : AST#type_annotation#Left AST#primary_type#Left DrawRect AST#primary_type#Right AST#type_annotation#Right //可绘制内容的Rect AST#property_declaration#Right AST#property_declaration#Left private canvasW : 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 private canvasH : 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 private canvasDrawMargin = AST#expression#Left 10 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 Column ( ) AST#container_content_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#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#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#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#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 . wuDangData AST#member_expression#Right AST#expression#Right == AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . wuDangData AST#member_expression#Right AST#expression#Right . buy AST#member_expression#Right AST#expression#Right == AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . wuDangData AST#member_expression#Right AST#expression#Right . sell AST#member_expression#Right AST#expression#Right == AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . wuDangData AST#member_expression#Right AST#expression#Right . buy 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#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . wuDangData AST#member_expression#Right AST#expression#Right . sell 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left LoadingProgress ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . onReady ( 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 . canvasW AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . width 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 this AST#expression#Right . canvasH AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . height 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 this AST#expression#Right . drawRect AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left DrawRect AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . canvasDrawMargin AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . canvasDrawMargin AST#member_expression#Right AST#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#member_expression#Left AST#expression#Left this AST#expression#Right . canvasW AST#member_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . canvasDrawMargin AST#member_expression#Right AST#expression#Right * AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#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#member_expression#Left AST#expression#Left this AST#expression#Right . canvasH AST#member_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . canvasDrawMargin 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#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 . _drawUI 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_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#build_body#Right AST#build_method#Right //清空画布的所有内容 AST#method_declaration#Left _clearCanvas 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#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . clearRect 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . canvasW AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . canvasH 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 //绘制UI AST#method_declaration#Left _drawUI 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 this AST#expression#Right . _clearCanvas 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 this AST#expression#Right . _drawWuDangUI 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 AST#method_declaration#Left _drawWuDangUI AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //根据drawRect的高度+买卖总计多少条数据 进行 // 反推计算出字体的大小,然后再绘制列表数据 //每个文字的高度 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left itemTextHeight = 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 . drawRect AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right / AST#expression#Left AST#parenthesized_expression#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 AST#member_expression#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . wuDangData AST#member_expression#Right AST#expression#Right . sell AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . wuDangData AST#member_expression#Right AST#expression#Right . buy 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#parenthesized_expression#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#variable_declaration#Left const AST#variable_declarator#Left priceRect = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left DrawRect AST#expression#Right AST#new_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 . drawRect AST#member_expression#Right AST#expression#Right . startX AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . drawRect AST#member_expression#Right AST#expression#Right . startY AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . drawRect AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right , AST#expression#Left itemTextHeight 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 var AST#variable_declarator#Left maxPrice = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . wuDangData AST#member_expression#Right AST#expression#Right . sell AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . price 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 var AST#variable_declarator#Left maxAmount = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . wuDangData AST#member_expression#Right AST#expression#Right . sell AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . amount 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 var AST#variable_declarator#Left allBuyAmount = 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 var AST#variable_declarator#Left allSellAmount = AST#expression#Left AST#assignment_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 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 AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 0 AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . wuDangData AST#member_expression#Right AST#expression#Right . sell 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 AST#parameter_list#Left ( AST#parameter#Left item 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 item AST#expression#Right . price AST#member_expression#Right AST#expression#Right > AST#expression#Left maxPrice 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 maxPrice = AST#expression#Left AST#member_expression#Left AST#expression#Left item 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#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 item AST#expression#Right . amount AST#member_expression#Right AST#expression#Right > AST#expression#Left maxAmount 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 maxAmount = AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . amount 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left allSellAmount += AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . amount 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#ERROR#Left this AST#ERROR#Right . wuDangData AST#member_expression#Right AST#expression#Right . buy 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 AST#parameter_list#Left ( AST#parameter#Left item 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 item AST#expression#Right . price AST#member_expression#Right AST#expression#Right > AST#expression#Left maxPrice 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 maxPrice = AST#expression#Left AST#member_expression#Left AST#expression#Left item 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#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 item AST#expression#Right . amount AST#member_expression#Right AST#expression#Right > AST#expression#Left maxAmount 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 maxAmount = AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . amount 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left allBuyAmount += AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . amount 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#ERROR#Left this AST#ERROR#Right . context AST#member_expression#Right AST#expression#Right . font AST#member_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#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left getTextMaxFontSize AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right , AST#expression#Left priceRect AST#expression#Right , AST#expression#Left '25px' AST#expression#Right , AST#expression#Left AST#binary_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 '卖1' AST#expression#Right + AST#expression#Left " " AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left maxPrice AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left " " AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left maxAmount AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . wuDangData AST#member_expression#Right AST#expression#Right . sell 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 AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left WuDangPrice AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { //卖1 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . textAlign AST#member_expression#Right = AST#expression#Left 'left' 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . textBaseline AST#member_expression#Right = AST#expression#Left 'top' 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . fillStyle AST#member_expression#Right = AST#expression#Left '#737F8A' 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 . context AST#member_expression#Right AST#expression#Right . fillText AST#member_expression#Right AST#expression#Right AST#argument_list#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 5 AST#expression#Right - AST#expression#Left index 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#expression#Left 0 AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right * AST#expression#Left itemTextHeight 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . textAlign AST#member_expression#Right = AST#expression#Left 'center' 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . textBaseline AST#member_expression#Right = AST#expression#Left 'top' 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . fillStyle AST#member_expression#Right = AST#expression#Left '#e2233e' 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 . context AST#member_expression#Right AST#expression#Right . fillText 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 value AST#expression#Right . price 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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . drawRect AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right * AST#expression#Left itemTextHeight 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . textAlign AST#member_expression#Right = AST#expression#Left '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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . textBaseline AST#member_expression#Right = AST#expression#Left 'top' 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . fillStyle AST#member_expression#Right = AST#expression#Left '#000000' 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 . context AST#member_expression#Right AST#expression#Right . fillText 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 value 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . drawRect AST#member_expression#Right AST#expression#Right . getEndX 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 index AST#expression#Right * AST#expression#Left itemTextHeight 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#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_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 buyLength = AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_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#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left allBuyAmount AST#expression#Right / AST#expression#Left allBuyAmount AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left allSellAmount AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . drawRect AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right //买横线 AST#ERROR#Left this AST#ERROR#Right . context AST#member_expression#Right AST#expression#Right . fillStyle AST#member_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#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#assignment_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 AST#member_expression#Left AST#expression#Left "#e2233e" AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . context AST#member_expression#Right AST#expression#Right . fillRect 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 . drawRect AST#member_expression#Right AST#expression#Right . startX AST#member_expression#Right AST#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 . drawRect AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left buyLength AST#expression#Right , AST#expression#Left 2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right //卖横线 AST#ERROR#Left this AST#ERROR#Right . context AST#member_expression#Right AST#expression#Right . fillStyle AST#member_expression#Right = AST#expression#Left "#228B22" AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . context AST#member_expression#Right AST#expression#Right . fillRect 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 . drawRect AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#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 . drawRect AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#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 . drawRect AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right - AST#expression#Left buyLength AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left 2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . wuDangData AST#member_expression#Right AST#expression#Right . buy 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 AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left WuDangPrice AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { //买1 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . textAlign AST#member_expression#Right = AST#expression#Left 'left' 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . textBaseline AST#member_expression#Right = AST#expression#Left 'top' 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . fillStyle AST#member_expression#Right = AST#expression#Left '#737F8A' 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 . context AST#member_expression#Right AST#expression#Right . fillText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left '买' AST#expression#Right + AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_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#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#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . wuDangData AST#member_expression#Right AST#expression#Right . sell AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left itemTextHeight 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . textAlign AST#member_expression#Right = AST#expression#Left 'center' 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . textBaseline AST#member_expression#Right = AST#expression#Left 'top' 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . fillStyle AST#member_expression#Right = AST#expression#Left '#e2233e' 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 . context AST#member_expression#Right AST#expression#Right . fillText 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 value AST#expression#Right . price 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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . drawRect AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_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#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#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . wuDangData AST#member_expression#Right AST#expression#Right . sell AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left itemTextHeight 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . textAlign AST#member_expression#Right = AST#expression#Left '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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . textBaseline AST#member_expression#Right = AST#expression#Left 'top' 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . fillStyle AST#member_expression#Right = AST#expression#Left '#000000' 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 . context AST#member_expression#Right AST#expression#Right . fillText 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 value 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . drawRect AST#member_expression#Right AST#expression#Right . getEndX 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#parenthesized_expression#Left ( AST#expression#Left AST#member_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#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#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . wuDangData AST#member_expression#Right AST#expression#Right . sell AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left itemTextHeight 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#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct WuDangBuySellComponent {
@Prop wuDangData: WuDangData
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private drawRect: DrawRect
private canvasW: number
private canvasH: number
private canvasDrawMargin = 10
build() {
Column() {
if (this.wuDangData == undefined || this.wuDangData.buy == undefined || this.wuDangData.sell == undefined || this.wuDangData.buy.length <= 0 && this.wuDangData.sell.length <= 0) {
LoadingProgress()
} else {
Canvas(this.context)
.onReady(() => {
this.canvasW = this.context.width
this.canvasH = this.context.height
this.drawRect = new DrawRect(this.canvasDrawMargin, this.canvasDrawMargin, this.canvasW - this.canvasDrawMargin * 2, this.canvasH - this.canvasDrawMargin * 2)
this._drawUI()
})
}
}
}
_clearCanvas() {
this.context.clearRect(0, 0, this.canvasW, this.canvasH)
}
_drawUI() {
this._clearCanvas()
this._drawWuDangUI()
}
_drawWuDangUI() {
const itemTextHeight = this.drawRect.height / (this.wuDangData.sell.length + this.wuDangData.buy.length + 1)
const priceRect = new DrawRect(this.drawRect.startX, this.drawRect.startY, this.drawRect.width, itemTextHeight)
var maxPrice = this.wuDangData.sell[0].price
var maxAmount = this.wuDangData.sell[0].amount
var allBuyAmount = 0
var allSellAmount = 0
this.wuDangData.sell.forEach((item) => {
if (item.price > maxPrice) {
maxPrice = item.price
}
if (item.amount > maxAmount) {
maxAmount = item.amount
}
allSellAmount += item.amount
})
this.wuDangData.buy.forEach((item) => {
if (item.price > maxPrice) {
maxPrice = item.price
}
if (item.amount > maxAmount) {
maxAmount = item.amount
}
allBuyAmount += item.amount
})
this.context.font = getTextMaxFontSize(this.context, priceRect, '25px', '卖1' + " " + maxPrice + " " + maxAmount)
this.wuDangData.sell.forEach((value: WuDangPrice, index) => {
this.context.textAlign = 'left'
this.context.textBaseline = 'top'
this.context.fillStyle = '#737F8A'
this.context.fillText('卖' + (5 - index), 0, index * itemTextHeight)
this.context.textAlign = 'center'
this.context.textBaseline = 'top'
this.context.fillStyle = '#e2233e'
this.context.fillText(value.price.toString(), this.drawRect.width / 2, index * itemTextHeight)
this.context.textAlign = 'right'
this.context.textBaseline = 'top'
this.context.fillStyle = '#000000'
this.context.fillText(value.amount.toString(), this.drawRect.getEndX(), index * itemTextHeight)
})
const buyLength = (allBuyAmount / allBuyAmount + allSellAmount) * this.drawRect.width
this.context.fillStyle = "#e2233e"
this.context.fillRect(this.drawRect.startX, this.drawRect.height / 2, buyLength, 2)
this.context.fillStyle = "#228B22"
this.context.fillRect(this.drawRect.width / 2, this.drawRect.height / 2, this.drawRect.width - buyLength, 2)
this.wuDangData.buy.forEach((value: WuDangPrice, index) => {
this.context.textAlign = 'left'
this.context.textBaseline = 'top'
this.context.fillStyle = '#737F8A'
this.context.fillText('买' + index, 0, (index + 1 + this.wuDangData.sell.length) * itemTextHeight)
this.context.textAlign = 'center'
this.context.textBaseline = 'top'
this.context.fillStyle = '#e2233e'
this.context.fillText(value.price.toString(), this.drawRect.width / 2, (index + 1 + this.wuDangData.sell.length) * itemTextHeight)
this.context.textAlign = 'right'
this.context.textBaseline = 'top'
this.context.fillStyle = '#000000'
this.context.fillText(value.amount.toString(), this.drawRect.getEndX(), (index + 1 + this.wuDangData.sell.length) * itemTextHeight)
})
}
}
|
https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/pages/component/WuDangBuySellComponent.ets#L8-L121
|
0d7da6506591968bad0366bfe2c8598024f2287f
|
github
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/data/src/main/ets/repository/AuthRepository.ets
|
arkts
|
getCaptcha
|
获取图片验证码
@returns {Promise<NetworkResponse<Captcha>>} 图片验证码
|
async getCaptcha(): Promise<NetworkResponse<Captcha>> {
return this.networkDataSource.getCaptcha();
}
|
AST#method_declaration#Left async getCaptcha 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 Captcha 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 . getCaptcha 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
|
async getCaptcha(): Promise<NetworkResponse<Captcha>> {
return this.networkDataSource.getCaptcha();
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/AuthRepository.ets#L89-L91
|
46c908644bce94c84f946ddf926276aab71b859c
|
github
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/main/src/main/ets/viewmodel/HomeViewModel.ets
|
arkts
|
requestListData
|
重写请求列表数据方法来实现全部商品分页
@return 商品分页数据流
|
protected requestListData(): Promise<NetworkResponse<NetworkPageData<Goods>>> {
const request = new GoodsSearchRequest();
request.page = this.currentPage;
request.size = this.pageSize;
return this.goodsRepository.getGoodsPage(request);
}
|
AST#method_declaration#Left protected requestListData 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 AST#generic_type#Left NetworkPageData AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Goods 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#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 request = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left GoodsSearchRequest 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 request AST#expression#Right . page AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentPage 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 request AST#expression#Right . size AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pageSize 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#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 . goodsRepository AST#member_expression#Right AST#expression#Right . getGoodsPage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left request 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
|
protected requestListData(): Promise<NetworkResponse<NetworkPageData<Goods>>> {
const request = new GoodsSearchRequest();
request.page = this.currentPage;
request.size = this.pageSize;
return this.goodsRepository.getGoodsPage(request);
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/HomeViewModel.ets#L31-L36
|
2f911d443a145d410f38940f7edff83a95239295
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/PreferencesUtil.ets
|
arkts
|
getStringSync
|
获取string类型的缓存值
@param key
@returns
|
static getStringSync(key: string, defValue: string = "",
preferenceName: string = PreferencesUtil.defaultPreferenceName): string {
return PreferencesUtil.getSync(key, defValue, preferenceName) as string;
}
|
AST#method_declaration#Left static getStringSync AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defValue : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right AST#parameter#Right , AST#parameter#Left preferenceName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left PreferencesUtil AST#expression#Right . defaultPreferenceName AST#member_expression#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#return_statement#Left return AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PreferencesUtil AST#expression#Right . getSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left defValue AST#expression#Right , AST#expression#Left preferenceName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getStringSync(key: string, defValue: string = "",
preferenceName: string = PreferencesUtil.defaultPreferenceName): string {
return PreferencesUtil.getSync(key, defValue, preferenceName) as string;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreferencesUtil.ets#L129-L132
|
89fc00cdfe21671d892a7a795c0d70a4e6476dc5
|
gitee
|
tomorrowKreswell/Ledger.git
|
1f2783ae70b8540d677af8a27f29db1b4089ea69
|
ledger/entry/src/main/ets/view/AddDialogComponent.ets
|
arkts
|
构建对话框内容
|
build() {
Column({ space: CommonConstants.SPACE_M }) {
// 关闭按钮
Image($rawfile('half.png'))
.width($r('app.float.component_size_L'))
.height($r('app.float.component_size_S'))
.onClick(() => {
this.controller?.close();
})
// 顶部标签页切换
Tabs({ barPosition: BarPosition.Start, index: this.curIndex }) {
// 支出标签页
TabContent() {
// 支出类型列表
Grid(this.scroller) {
ForEach(this.payList, (item: AccountClassification) => {
GridItem() {
Column() {
Image(this.curType === item.typeText ? item.iconSelected : item.icon)
.width($r('app.float.image_size'))
.aspectRatio(CommonConstants.FULL_SIZE)
Text(item.typeText)
.fontSize($r('app.float.font_size_S'))
.fontColor(this.curType === item.typeText ? Color.White : $r('app.color.main_color'))
.margin({ top: $r('app.float.edge_size_S') })
}
.width($r('app.float.component_size_LP'))
.aspectRatio(CommonConstants.FULL_SIZE)
.padding({ top: $r('app.float.edge_size_M') })
.margin({ top: $r('app.float.edge_size_MP'), left: $r('app.float.edge_size_M') })
.align(Alignment.TopStart)
.backgroundColor(this.curType === item.typeText ? $r('app.color.main_color') : $r('app.color.background_color'))
.borderRadius($r('app.float.radius_size_S'))
.onClick(() => {
this.selectAccount(item);
})
}
})
}
.columnsTemplate('1fr 1fr 1fr 1fr')
.scrollBar(BarState.Off)
}
|
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#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 Image ( AST#expression#Left AST#call_expression#Left AST#expression#Left $rawfile AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'half.png' AST#expression#Right ) AST#argument_list#Right AST#call_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_L' AST#expression#Right ) AST#resource_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_S' 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#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#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 Tabs ( AST#component_parameters#Left { AST#component_parameter#Left barPosition : AST#expression#Left AST#member_expression#Left AST#expression#Left BarPosition AST#expression#Right . Start AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left index : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . curIndex AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ERROR#Left { // 支出标签页 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TabContent ( ) AST#ui_component#Right AST#ERROR#Left { // 支出类型列表 Grid ( this AST#ERROR#Right AST#modifier_chain_expression#Left . scroller AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ) AST#ERROR#Right { AST#property_name#Left ForEach AST#property_name#Right ( this AST#ERROR#Right AST#modifier_chain_expression#Left . payList AST#ERROR#Left , AST#ERROR#Right ( AST#expression#Left AST#arrow_function#Left item : AST#type_annotation#Left AST#primary_type#Left AccountClassification AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left ) AST#ERROR#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left GridItem 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 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 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 Column AST#property_name#Right 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left Image AST#expression#Right AST#argument_list#Left ( 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 this AST#expression#Right . curType AST#member_expression#Right AST#expression#Right === AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#Right . typeText AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . iconSelected AST#member_expression#Right AST#expression#Right : AST#expression#Left item AST#expression#Right AST#conditional_expression#Right AST#expression#Right . icon AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.image_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . aspectRatio 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 . FULL_SIZE 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 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 Text AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . typeText AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . fontSize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( 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#argument_list#Right AST#call_expression#Right AST#expression#Right . fontColor AST#member_expression#Right AST#expression#Right AST#argument_list#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 this AST#expression#Right . curType AST#member_expression#Right AST#expression#Right === AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#Right . typeText AST#member_expression#Right 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#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#argument_list#Right AST#call_expression#Right AST#expression#Right . margin 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 top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.edge_size_S' AST#expression#Right ) AST#resource_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#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.component_size_LP' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . aspectRatio 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 . FULL_SIZE AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padding 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 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#argument_list#Right AST#call_expression#Right AST#expression#Right . margin 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 top 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#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#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . align AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . TopStart AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . backgroundColor AST#member_expression#Right AST#expression#Right AST#argument_list#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 this AST#expression#Right . curType AST#member_expression#Right AST#expression#Right === AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#Right . typeText AST#member_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#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#conditional_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . borderRadius AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( 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#argument_list#Right AST#call_expression#Right AST#expression#Right . onClick 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectAccount 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#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#arrow_function#Right AST#expression#Right AST#ERROR#Left } AST#ERROR#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 . columnsTemplate ( AST#expression#Left '1fr 1fr 1fr 1fr' 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#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
|
build() {
Column({ space: CommonConstants.SPACE_M }) {
Image($rawfile('half.png'))
.width($r('app.float.component_size_L'))
.height($r('app.float.component_size_S'))
.onClick(() => {
this.controller?.close();
})
Tabs({ barPosition: BarPosition.Start, index: this.curIndex }) {
TabContent() {
Grid(this.scroller) {
ForEach(this.payList, (item: AccountClassification) => {
GridItem() {
Column() {
Image(this.curType === item.typeText ? item.iconSelected : item.icon)
.width($r('app.float.image_size'))
.aspectRatio(CommonConstants.FULL_SIZE)
Text(item.typeText)
.fontSize($r('app.float.font_size_S'))
.fontColor(this.curType === item.typeText ? Color.White : $r('app.color.main_color'))
.margin({ top: $r('app.float.edge_size_S') })
}
.width($r('app.float.component_size_LP'))
.aspectRatio(CommonConstants.FULL_SIZE)
.padding({ top: $r('app.float.edge_size_M') })
.margin({ top: $r('app.float.edge_size_MP'), left: $r('app.float.edge_size_M') })
.align(Alignment.TopStart)
.backgroundColor(this.curType === item.typeText ? $r('app.color.main_color') : $r('app.color.background_color'))
.borderRadius($r('app.float.radius_size_S'))
.onClick(() => {
this.selectAccount(item);
})
}
})
}
.columnsTemplate('1fr 1fr 1fr 1fr')
.scrollBar(BarState.Off)
}
|
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/view/AddDialogComponent.ets#L61-L104
|
eefeec5888c4967761f2ed55b3347049f8768186
|
github
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/citysearch/src/main/ets/view/CitySearch.ets
|
arkts
|
CitySearch
|
功能说明: 本示例介绍城市选择场景的使用:通过AlphabetIndexer实现首字母快速定位城市的索引条导航
推荐场景: 首字母快速定位的列表场景
核心组件:
1. AlphabetListView: 列表视图
实现步骤:
1. 数据准备。初始化城市列表和热门城市列表数组。
@example
// 热门城市列表
hotCityList: HotCityListItemView[] = [];
城市列表
cityList: CityListItemView[] = [];
aboutToAppear(): void {
CITY_DATA.forEach((cityItem: CityType) => {
this.cityList.push(new CityListItemView(cityItem, wrapBuilder(cityListItemSection)))
})
HOT_CITY.forEach((hotCityItem: string) => {
this.hotCityList.push(new HotCityListItemView(hotCityItem, wrapBuilder(hotCitySection)))
})
}
以上代码中,HotCityListItemView为热门城市列表项的类,CityListItemView为城市列表项的类。两者都包含列表项、
列表项视图,开发者可以自行配置,也可以使用默认的属性配置。
2. 构建自定义城市视图。
AlphabetListView({
hotSelectList: this.hotCityList,
hotSelectListTitle: $r('app.string.citysearch_hotCity'),
alphabetSelectList: this.cityList,
hotSelectHandle: (hotSelectValue: string) => {
this.hotSelectHandle(hotSelectValue);
},
alphabetSelectHandle: (alphabetSelectValue: string) => {
this.alphabetSelectHandle(alphabetSelectValue);
}
})
|
@Component
export struct CitySearch {
// 搜索值
@State changeValue: string = '';
// 热门城市列表
hotCityList: HotListItemView[] = [];
// 城市列表
cityList: AlphabetListItemView[] = [];
// 占位
placeholder: string = CommonConstants.PLACE_HOLDER_TEXT;
// 搜索控制器
controller: SearchController = new SearchController();
// 是否展示搜索结果列表
@State isSearchState: boolean = false;
// 搜索结果
@State searchList: string[] = [];
/**
* 弹窗函数
*/
showToast() {
promptAction.showToast({
message: $r('app.string.citysearch_only_show_for_ux')
})
}
aboutToAppear(): void {
CITY_DATA.forEach((cityItem: AlphabetListItemType) => {
this.cityList.push(new AlphabetListItemView(cityItem, wrapBuilder(cityListItemSection)))
})
HOT_CITY.forEach((hotCityItem: string) => {
this.hotCityList.push(new HotListItemView(hotCityItem, wrapBuilder(hotCitySection)))
})
}
build() {
Column() {
// 搜索框
Search({ value: this.changeValue, placeholder: this.placeholder, controller: this.controller })
.id('searchCity')
.searchButton(SEARCH_BUTTON_TEXT)
.width(CommonConstants.VIEW_FULL)
.height($r('app.integer.citysearch_search_height'))
.margin({ left: $r('app.integer.citysearch_search_margin_left') })
.backgroundColor($r('app.color.citysearch_search_bgc'))
.placeholderColor(Color.Grey)
.placeholderFont({ size: $r('app.integer.citysearch_placeholderFont_size'), weight: CommonConstants.WEIGHT })
.textFont({ size: $r('app.integer.citysearch_placeholderFont_size'), weight: CommonConstants.WEIGHT })
.onSubmit((value: string) => {
// 如果没有输入数据,就使用占位符作为默认数据
if (value.length === 0) {
value = this.placeholder;
}
// 将值赋值给changeValue
this.changeValue = value;
this.isSearchState = true;
this.searchCityList(value);
if (this.searchList.length === 0) {
this.showToast();
}
})
.onChange((value: string) => {
this.changeValue = value;
// 搜索
this.searchCityList(value);
if (value.length === 0) {
// 关闭搜索列表
this.isSearchState = false;
// 清空数据
this.searchList.splice(0, this.searchList.length);
} else {
this.changeValue = value;
// 搜索
this.searchCityList(value);
this.isSearchState = true;
if (this.searchList.length === 0) {
this.showToast();
}
}
})
/**
* 城市列表组件
* @param hotSelectList - 热门选择列表
* @param alphabetSelectList - 字母选择数据列表
* @param hotSelectListTitle - 热门选择列表标题
* @param hotSelectHandle - 点击热门选择列表项处理逻辑
* @param alphabetSelectHandle - 点击字母列表项处理逻辑
*/
AlphabetListView({
hotSelectList: this.hotCityList,
hotSelectListTitle: $r('app.string.citysearch_hotCity'),
alphabetSelectList: this.cityList,
hotSelectHandle: (hotSelectValue: string) => {
this.hotCityHandle(hotSelectValue);
},
alphabetSelectHandle: (alphabetSelectValue: string) => {
this.cityHandle(alphabetSelectValue);
}
})
.margin({ top: $r('app.integer.citysearch_list_margin_top') })/**
* 性能知识点:由于需要通过搜索按钮频繁的控制自定义组件的显隐状态,因此推荐使用显隐控制替代条件渲染,
* 参考合理选择条件渲染和显隐控制文章:
* https://gitee.com/harmonyos-cases/cases/blob/master/docs/performance/proper-choice-between-if-and-visibility.md
*/
.visibility(this.isSearchState ? Visibility.None : Visibility.Visible)
.layoutWeight(1)
/**
* 搜索组件,将数据传递到搜索列表
* @param searchList: 搜索列表数据
* @param changeValue: 选定的城市
*/
SearchView({ searchList: $searchList, changeValue: $changeValue })
.width(CommonConstants.VIEW_FULL)
.layoutWeight(1)
.visibility(this.isSearchState ? Visibility.Visible : Visibility.None)
}
.width(CommonConstants.VIEW_FULL)
.height(CommonConstants.VIEW_FULL)
.padding({ left: $r('app.integer.citysearch_padding_left'), right: $r('app.integer.citysearch_padding_right') })
.backgroundColor($r('app.color.citysearch_bgc'))
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Start)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
}
// 搜索城市展示逻辑
searchCityList(value: string) {
let cityNames: string[] = [];
CITY_DATA.forEach(item => {
if (item.name.includes(value.toUpperCase())) {
// 当搜索城市拼音首字母,将相关城市信息展示。例如输入"a",会出现"阿尔山"、"阿勒泰地区"、"安庆"、"安阳"。
// 输入"b",会出现"北京"、"亳州"、"包头"、"宝鸡"。
cityNames = item.dataList;
return;
}
item.dataList.forEach(cityName => {
// 当搜索汉字,会进行模糊搜索,将相关城市信息展示。例如搜索"长":展示"长沙","长春"。
if (cityName.includes(value)) {
cityNames.push(cityName);
}
})
})
// 判断是否有输入的值
if (value.length !== 0) {
this.searchList = cityNames;
} else {
this.searchList = [];
}
}
cityHandle(alphabetSelectValue: string) {
// TODO:待开发者根据选定列表的城市名称时执行的逻辑操作,比如说筛选等
// 当前调用Toast显示提示:此样式仅为案例展示
promptAction.showToast({ message: $r('app.string.citysearch_only_show_ui') });
}
hotCityHandle(hotSelectValue: string) {
this.changeValue = hotSelectValue;
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CitySearch AST#component_body#Left { // 搜索值 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right changeValue : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right // 热门城市列表 AST#property_declaration#Left hotCityList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left HotListItemView [ ] 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 cityList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left AlphabetListItemView [ ] 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 placeholder : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . PLACE_HOLDER_TEXT AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 搜索控制器 AST#property_declaration#Left controller : AST#type_annotation#Left AST#primary_type#Left SearchController 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 SearchController 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 AST#decorator#Left @ State AST#decorator#Right isSearchState : 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 @ State AST#decorator#Right searchList : 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#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 弹窗函数
*/ AST#method_declaration#Left showToast 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 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#resource_expression#Left $r ( AST#expression#Left 'app.string.citysearch_only_show_for_ux' AST#expression#Right ) AST#resource_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#expression_statement#Right } AST#builder_function_body#Right AST#method_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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CITY_DATA 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 cityItem : AST#type_annotation#Left AST#primary_type#Left AlphabetListItemType 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . cityList AST#member_expression#Right AST#expression#Right . push 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 AlphabetListItemView AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left cityItem AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#argument_list#Left ( AST#expression#Left cityListItemSection 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#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 HOT_CITY 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 hotCityItem : 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hotCityList AST#member_expression#Right AST#expression#Right . push 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 HotListItemView AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left hotCityItem AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#argument_list#Left ( AST#expression#Left hotCitySection 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#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 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 Search ( AST#component_parameters#Left { AST#component_parameter#Left value : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . changeValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left placeholder : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . placeholder AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left controller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left 'searchCity' AST#expression#Right ) AST#modifier_chain_expression#Left . searchButton ( AST#expression#Left SEARCH_BUTTON_TEXT AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . VIEW_FULL 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.integer.citysearch_search_height' 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 left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.citysearch_search_margin_left' 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.citysearch_search_bgc' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . placeholderColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Grey AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . placeholderFont ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.citysearch_placeholderFont_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left weight AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . WEIGHT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textFont ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.citysearch_placeholderFont_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left weight AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . WEIGHT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onSubmit ( 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left value 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 value = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . placeholder 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 // 将值赋值给changeValue 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 . changeValue 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#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSearchState 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 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 . searchCityList AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left value 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . searchList 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showToast 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 . 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 . changeValue 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#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 . searchCityList AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left value 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 value 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 . isSearchState 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#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 . searchList AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . searchList AST#member_expression#Right AST#expression#Right . length 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 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 . changeValue 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#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 . searchCityList AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left value 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 . isSearchState 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 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 . searchList 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showToast 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#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#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 /**
* 城市列表组件
* @param hotSelectList - 热门选择列表
* @param alphabetSelectList - 字母选择数据列表
* @param hotSelectListTitle - 热门选择列表标题
* @param hotSelectHandle - 点击热门选择列表项处理逻辑
* @param alphabetSelectHandle - 点击字母列表项处理逻辑
*/ AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AlphabetListView ( AST#component_parameters#Left { AST#component_parameter#Left hotSelectList : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hotCityList AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left hotSelectListTitle : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.citysearch_hotCity' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left alphabetSelectList : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cityList AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left hotSelectHandle : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left hotSelectValue : 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hotCityHandle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left hotSelectValue 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#component_parameter#Right , AST#component_parameter#Left alphabetSelectHandle : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left alphabetSelectValue : 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cityHandle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left alphabetSelectValue 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#component_parameter#Right } AST#component_parameters#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 AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.citysearch_list_margin_top' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) /**
* 性能知识点:由于需要通过搜索按钮频繁的控制自定义组件的显隐状态,因此推荐使用显隐控制替代条件渲染,
* 参考合理选择条件渲染和显隐控制文章:
* https://gitee.com/harmonyos-cases/cases/blob/master/docs/performance/proper-choice-between-if-and-visibility.md
*/ AST#modifier_chain_expression#Left . visibility ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSearchState AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . None AST#member_expression#Right AST#expression#Right : AST#expression#Left Visibility AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Visible AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 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 /**
* 搜索组件,将数据传递到搜索列表
* @param searchList: 搜索列表数据
* @param changeValue: 选定的城市
*/ AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left SearchView ( AST#component_parameters#Left { AST#component_parameter#Left searchList : AST#expression#Left $searchList AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left changeValue : AST#expression#Left $changeValue 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 . VIEW_FULL AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . visibility ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSearchState AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . Visible AST#member_expression#Right AST#expression#Right : AST#expression#Left Visibility AST#expression#Right AST#conditional_expression#Right AST#expression#Right . None 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 . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . VIEW_FULL 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 . VIEW_FULL 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.integer.citysearch_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.integer.citysearch_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 . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.citysearch_bgc' AST#expression#Right ) AST#resource_expression#Right 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#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 . expandSafeArea ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaType AST#expression#Right . SYSTEM AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaEdge AST#expression#Right . BOTTOM AST#member_expression#Right AST#expression#Right ] AST#array_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#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right // 搜索城市展示逻辑 AST#method_declaration#Left searchCityList 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#variable_declaration#Left let AST#variable_declarator#Left cityNames : 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#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 CITY_DATA AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left item => 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#member_expression#Left AST#expression#Left item AST#expression#Right . name AST#member_expression#Right AST#expression#Right . includes 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 value 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#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { // 当搜索城市拼音首字母,将相关城市信息展示。例如输入"a",会出现"阿尔山"、"阿勒泰地区"、"安庆"、"安阳"。 // 输入"b",会出现"北京"、"亳州"、"包头"、"宝鸡"。 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left cityNames = AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . dataList 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#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#member_expression#Left AST#expression#Left item AST#expression#Right . dataList 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 cityName => 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 cityName AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left value 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 cityNames AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left cityName 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#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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left value 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 . searchList AST#member_expression#Right = AST#expression#Left cityNames 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 . searchList 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#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left cityHandle AST#parameter_list#Left ( AST#parameter#Left alphabetSelectValue : 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#builder_function_body#Left { // TODO:待开发者根据选定列表的城市名称时执行的逻辑操作,比如说筛选等 // 当前调用Toast显示提示:此样式仅为案例展示 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#resource_expression#Left $r ( AST#expression#Left 'app.string.citysearch_only_show_ui' AST#expression#Right ) AST#resource_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#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left hotCityHandle AST#parameter_list#Left ( AST#parameter#Left hotSelectValue : 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#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 . changeValue AST#member_expression#Right = AST#expression#Left hotSelectValue AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct CitySearch {
@State changeValue: string = '';
hotCityList: HotListItemView[] = [];
cityList: AlphabetListItemView[] = [];
placeholder: string = CommonConstants.PLACE_HOLDER_TEXT;
controller: SearchController = new SearchController();
@State isSearchState: boolean = false;
@State searchList: string[] = [];
showToast() {
promptAction.showToast({
message: $r('app.string.citysearch_only_show_for_ux')
})
}
aboutToAppear(): void {
CITY_DATA.forEach((cityItem: AlphabetListItemType) => {
this.cityList.push(new AlphabetListItemView(cityItem, wrapBuilder(cityListItemSection)))
})
HOT_CITY.forEach((hotCityItem: string) => {
this.hotCityList.push(new HotListItemView(hotCityItem, wrapBuilder(hotCitySection)))
})
}
build() {
Column() {
Search({ value: this.changeValue, placeholder: this.placeholder, controller: this.controller })
.id('searchCity')
.searchButton(SEARCH_BUTTON_TEXT)
.width(CommonConstants.VIEW_FULL)
.height($r('app.integer.citysearch_search_height'))
.margin({ left: $r('app.integer.citysearch_search_margin_left') })
.backgroundColor($r('app.color.citysearch_search_bgc'))
.placeholderColor(Color.Grey)
.placeholderFont({ size: $r('app.integer.citysearch_placeholderFont_size'), weight: CommonConstants.WEIGHT })
.textFont({ size: $r('app.integer.citysearch_placeholderFont_size'), weight: CommonConstants.WEIGHT })
.onSubmit((value: string) => {
if (value.length === 0) {
value = this.placeholder;
}
this.changeValue = value;
this.isSearchState = true;
this.searchCityList(value);
if (this.searchList.length === 0) {
this.showToast();
}
})
.onChange((value: string) => {
this.changeValue = value;
this.searchCityList(value);
if (value.length === 0) {
this.isSearchState = false;
this.searchList.splice(0, this.searchList.length);
} else {
this.changeValue = value;
this.searchCityList(value);
this.isSearchState = true;
if (this.searchList.length === 0) {
this.showToast();
}
}
})
AlphabetListView({
hotSelectList: this.hotCityList,
hotSelectListTitle: $r('app.string.citysearch_hotCity'),
alphabetSelectList: this.cityList,
hotSelectHandle: (hotSelectValue: string) => {
this.hotCityHandle(hotSelectValue);
},
alphabetSelectHandle: (alphabetSelectValue: string) => {
this.cityHandle(alphabetSelectValue);
}
})
.margin({ top: $r('app.integer.citysearch_list_margin_top') })
.visibility(this.isSearchState ? Visibility.None : Visibility.Visible)
.layoutWeight(1)
SearchView({ searchList: $searchList, changeValue: $changeValue })
.width(CommonConstants.VIEW_FULL)
.layoutWeight(1)
.visibility(this.isSearchState ? Visibility.Visible : Visibility.None)
}
.width(CommonConstants.VIEW_FULL)
.height(CommonConstants.VIEW_FULL)
.padding({ left: $r('app.integer.citysearch_padding_left'), right: $r('app.integer.citysearch_padding_right') })
.backgroundColor($r('app.color.citysearch_bgc'))
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Start)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
}
城市展示逻辑
searchCityList(value: string) {
let cityNames: string[] = [];
CITY_DATA.forEach(item => {
if (item.name.includes(value.toUpperCase())) {
cityNames = item.dataList;
return;
}
item.dataList.forEach(cityName => {
if (cityName.includes(value)) {
cityNames.push(cityName);
}
})
})
if (value.length !== 0) {
this.searchList = cityNames;
} else {
this.searchList = [];
}
}
cityHandle(alphabetSelectValue: string) {
promptAction.showToast({ message: $r('app.string.citysearch_only_show_ui') });
}
hotCityHandle(hotSelectValue: string) {
this.changeValue = hotSelectValue;
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/citysearch/src/main/ets/view/CitySearch.ets#L65-L226
|
8fa072995d79d0d3cd664e562031424ba319b54b
|
gitee
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/ui/src/main/ets/component/empty/EmptyError.ets
|
arkts
|
EmptyError
|
@file 错误缺省页
@author Joker.X
|
@ComponentV2
export struct EmptyError {
/**
* 描述文案
*/
@Param
description: ResourceStr = $r("app.string.empty_error");
/**
* 操作按钮文案(仅当 onAction 存在时展示)
*/
@Param
actionText: ResourceStr = $r("app.string.click_retry");
/**
* 操作按钮点击回调(不传则不展示按钮)
*/
@Param
onAction: (() => void) | undefined = undefined;
/**
* 构建错误缺省页视图
* @returns {void} 无返回值
*/
build(): void {
Empty({
description: this.description,
imageRes: $r("app.media.ic_empty_page"),
actionText: this.actionText,
onAction: this.onAction
});
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct EmptyError AST#component_body#Left { /**
* 描述文案
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right description : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.empty_error" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right /**
* 操作按钮文案(仅当 onAction 存在时展示)
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right actionText : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.click_retry" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right /**
* 操作按钮点击回调(不传则不展示按钮)
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right onAction : 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_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 /**
* 构建错误缺省页视图
* @returns {void} 无返回值
*/ 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 Empty ( AST#component_parameters#Left { AST#component_parameter#Left description : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . description AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left imageRes : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.ic_empty_page" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left actionText : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . actionText AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onAction : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onAction 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 EmptyError {
@Param
description: ResourceStr = $r("app.string.empty_error");
@Param
actionText: ResourceStr = $r("app.string.click_retry");
@Param
onAction: (() => void) | undefined = undefined;
build(): void {
Empty({
description: this.description,
imageRes: $r("app.media.ic_empty_page"),
actionText: this.actionText,
onAction: this.onAction
});
}
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/empty/EmptyError.ets#L7-L39
|
780934134bf8e8b2b7530d4213fb9639bba1cd4f
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/DateUtil.ets
|
arkts
|
getToday
|
获取今天的日期
@returns
|
static getToday(): Date {
return new Date();
}
|
AST#method_declaration#Left static getToday AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Date 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 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getToday(): Date {
return new Date();
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L83-L85
|
76349661039fe60713a85f37655de6adb2fc4fba
|
gitee
|
sea5241/PictureSelector
|
09bac407ebd61100d1ccbf6e6d3b6349cb0013d7
|
selector/src/main/ets/model/MediaData.ets
|
arkts
|
媒体文件数据
@Author sea
@Date 2024/7/8
|
export class MediaData {
path: string;
constructor(path: string) {
this.path = path;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class MediaData AST#class_body#Left { AST#property_declaration#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left path : 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 . path AST#member_expression#Right = AST#expression#Left path AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class MediaData {
path: string;
constructor(path: string) {
this.path = path;
}
}
|
https://github.com/sea5241/PictureSelector/blob/09bac407ebd61100d1ccbf6e6d3b6349cb0013d7/selector/src/main/ets/model/MediaData.ets#L6-L12
|
a840383d10fc7671a50bbc778a59b5a7945a25f7
|
gitee
|
|
jjjjjjava/ffmpeg_tools.git
|
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
|
src/main/ets/ffmpeg/FFmpegManager.ets
|
arkts
|
executeTask
|
执行单个任务
注意:taskFailed/failCode/failMsg 必须是局部变量,确保多任务环境下状态隔离
|
private async executeTask(task: Task): Promise<void> {
FLog.info(FFmpegManager.TAG, `Executing task: ${task.getId()}`);
// 回调:开始
this.dispatchCallback(task, 'start');
// 任务级别的状态变量(局部变量,确保多任务状态隔离)
let taskFailed = false;
let failCode = 0;
let failMsg = '';
try {
const commands = task.getCommands();
await FFMpegUtils.executeFFmpegCommand({
cmds: commands,
onFFmpegProgress: (progress: number) => {
if (!task.isCancelled()) {
task.updateProgress(progress / 100);
this.dispatchCallback(task, 'progress', progress / 100);
}
},
onFFmpegFail: (code: number, msg: string) => {
FLog.error(FFmpegManager.TAG, `Task failed: ${task.getId()}, code=${code}, msg=${msg}`);
taskFailed = true;
failCode = code;
failMsg = msg;
},
onFFmpegSuccess: () => {
FLog.info(FFmpegManager.TAG, `Task success: ${task.getId()}`);
}
});
// 根据实际执行结果分发回调
if (task.isCancelled()) {
this.dispatchCallback(task, 'cancelled');
} else if (taskFailed) {
this.dispatchCallback(task, 'failure');
this.dispatchCallback(task, 'error', new Error(`FFmpeg error: code=${failCode}, msg=${failMsg}`));
} else {
this.dispatchCallback(task, 'success');
}
} catch (error) {
FLog.error(FFmpegManager.TAG, `Task error: ${task.getId()}, ${error}`);
if (!task.isCancelled()) {
this.dispatchCallback(task, 'failure');
this.dispatchCallback(task, 'error', error as Error);
}
}
}
|
AST#method_declaration#Left private async executeTask AST#parameter_list#Left ( AST#parameter#Left task : AST#type_annotation#Left AST#primary_type#Left Task 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left FLog 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 FFmpegManager AST#expression#Right . TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Executing task: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . getId AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dispatchCallback AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left task AST#expression#Right , AST#expression#Left 'start' 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 taskFailed = 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#variable_declaration#Left let AST#variable_declarator#Left failCode = 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 failMsg = AST#expression#Left '' 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 const AST#variable_declarator#Left commands = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . getCommands 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#await_expression#Left await AST#expression#Left FFMpegUtils AST#expression#Right AST#await_expression#Right AST#expression#Right . executeFFmpegCommand 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 cmds AST#property_name#Right : AST#expression#Left commands AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onFFmpegProgress AST#property_name#Right : AST#expression#Left AST#arrow_function#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#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#unary_expression#Left ! AST#expression#Left task AST#expression#Right AST#unary_expression#Right AST#expression#Right . isCancelled AST#member_expression#Right 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 AST#member_expression#Left AST#expression#Left task AST#expression#Right . updateProgress AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left progress AST#expression#Right / AST#expression#Left 100 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 this AST#expression#Right . dispatchCallback AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left task AST#expression#Right , AST#expression#Left 'progress' AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left progress AST#expression#Right / AST#expression#Left 100 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#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onFFmpegFail AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left code : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left msg : 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left FLog 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 FFmpegManager AST#expression#Right . TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Task failed: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . getId AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right , code= AST#template_substitution#Left $ { AST#expression#Left code AST#expression#Right } AST#template_substitution#Right , msg= AST#template_substitution#Left $ { AST#expression#Left msg 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 taskFailed = 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#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left failCode = AST#expression#Left code 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 failMsg = AST#expression#Left msg 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#property_assignment#Left AST#property_name#Left onFFmpegSuccess 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 FLog 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 FFmpegManager AST#expression#Right . TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Task success: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . getId AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) 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#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#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . isCancelled AST#member_expression#Right 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . dispatchCallback AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left task AST#expression#Right , AST#expression#Left 'cancelled' 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 taskFailed 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 . dispatchCallback AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left task AST#expression#Right , AST#expression#Left 'failure' 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 this AST#expression#Right . dispatchCallback AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left task AST#expression#Right , AST#expression#Left 'error' AST#expression#Right , 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 ` FFmpeg error: code= AST#template_substitution#Left $ { AST#expression#Left failCode AST#expression#Right } AST#template_substitution#Right , msg= AST#template_substitution#Left $ { AST#expression#Left failMsg 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#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 this AST#expression#Right . dispatchCallback AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left task AST#expression#Right , AST#expression#Left 'success' 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#if_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 FLog 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 FFmpegManager AST#expression#Right . TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Task error: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . getId AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right , 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#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 task AST#expression#Right AST#unary_expression#Right AST#expression#Right . isCancelled AST#member_expression#Right 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . dispatchCallback AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left task AST#expression#Right , AST#expression#Left 'failure' 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 this AST#expression#Right . dispatchCallback AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left task AST#expression#Right , AST#expression#Left 'error' AST#expression#Right , 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#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#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private async executeTask(task: Task): Promise<void> {
FLog.info(FFmpegManager.TAG, `Executing task: ${task.getId()}`);
this.dispatchCallback(task, 'start');
let taskFailed = false;
let failCode = 0;
let failMsg = '';
try {
const commands = task.getCommands();
await FFMpegUtils.executeFFmpegCommand({
cmds: commands,
onFFmpegProgress: (progress: number) => {
if (!task.isCancelled()) {
task.updateProgress(progress / 100);
this.dispatchCallback(task, 'progress', progress / 100);
}
},
onFFmpegFail: (code: number, msg: string) => {
FLog.error(FFmpegManager.TAG, `Task failed: ${task.getId()}, code=${code}, msg=${msg}`);
taskFailed = true;
failCode = code;
failMsg = msg;
},
onFFmpegSuccess: () => {
FLog.info(FFmpegManager.TAG, `Task success: ${task.getId()}`);
}
});
if (task.isCancelled()) {
this.dispatchCallback(task, 'cancelled');
} else if (taskFailed) {
this.dispatchCallback(task, 'failure');
this.dispatchCallback(task, 'error', new Error(`FFmpeg error: code=${failCode}, msg=${failMsg}`));
} else {
this.dispatchCallback(task, 'success');
}
} catch (error) {
FLog.error(FFmpegManager.TAG, `Task error: ${task.getId()}, ${error}`);
if (!task.isCancelled()) {
this.dispatchCallback(task, 'failure');
this.dispatchCallback(task, 'error', error as Error);
}
}
}
|
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegManager.ets#L280-L334
|
f3fe3c97561a6ae6b3b9760debb2a595929d0b8d
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/ComponentFactory.ets
|
arkts
|
toArray
|
获取注册标题集合
@returns: 包含所有注册标题的数组
|
public toArray(): string[] {
if (this.keys.length > 0) {
return this.keys;
}
let array: string[] = [];
let keys: IterableIterator<string> = this.tabsInfo.keys()
for (let keysElement of keys) {
array.push(keysElement);
}
return array;
}
|
AST#method_declaration#Left public toArray AST#parameter_list#Left ( ) AST#parameter_list#Right : 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#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 . keys 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#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . keys 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 let AST#variable_declarator#Left array : 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#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 let AST#variable_declarator#Left keys : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left IterableIterator 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#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 . tabsInfo 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#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( let keysElement of AST#expression#Left keys 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 array AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left keysElement 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#return_statement#Left return AST#expression#Left array AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public toArray(): string[] {
if (this.keys.length > 0) {
return this.keys;
}
let array: string[] = [];
let keys: IterableIterator<string> = this.tabsInfo.keys()
for (let keysElement of keys) {
array.push(keysElement);
}
return array;
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/ComponentFactory.ets#L85-L95
|
5f1d0b4a52892efa6b82ca80b33d8d6bd2c98a52
|
gitee
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/views/setting/AdviceView.ets
|
arkts
|
refreshUIState
|
=== 功能方法 === 刷新UI状态
|
private refreshUIState() {
if (this.pickedUri) {
this.isSendButtonEnabled = true
}else{
const trimmedContent = this.content.trim();
this.characterCount = trimmedContent.length;
this.isSendButtonEnabled =
this.characterCount > this.MIN_COUNT &&
this.characterCount <= this.MAX_COUNT;
}
}
|
AST#method_declaration#Left private refreshUIState AST#parameter_list#Left ( ) AST#parameter_list#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 this AST#expression#Right . pickedUri 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 . isSendButtonEnabled 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 } else { AST#expression_statement#Left AST#expression#Left const AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left trimmedContent = 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 . content AST#member_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 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 . characterCount AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left trimmedContent AST#expression#Right . length 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 this AST#expression#Right . isSendButtonEnabled 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 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 . characterCount AST#member_expression#Right AST#expression#Right > AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . MIN_COUNT AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . characterCount AST#member_expression#Right AST#expression#Right <= AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . MAX_COUNT 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#builder_function_body#Right AST#method_declaration#Right
|
private refreshUIState() {
if (this.pickedUri) {
this.isSendButtonEnabled = true
}else{
const trimmedContent = this.content.trim();
this.characterCount = trimmedContent.length;
this.isSendButtonEnabled =
this.characterCount > this.MIN_COUNT &&
this.characterCount <= this.MAX_COUNT;
}
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/setting/AdviceView.ets#L159-L170
|
61b2e93db305fb805950ae18f1de3c340e76b15c
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/game/GameificationService.ets
|
arkts
|
连击数据接口
|
export interface StreakData {
type: string;
current: number;
best: number;
lastActionDate: string;
isActive: boolean;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface StreakData AST#object_type#Left { AST#type_member#Left type : 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 current : 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 best : 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 lastActionDate : 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 isActive : AST#type_annotation#Left AST#primary_type#Left boolean 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 StreakData {
type: string;
current: number;
best: number;
lastActionDate: string;
isActive: boolean;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L190-L196
|
36412e6655768269c840dfd3128c0a2811f5ec1f
|
github
|
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/model/src/main/ets/request/CreateOrderRequest.ets
|
arkts
|
@param {CreateOrderInit} init - 初始化数据
|
constructor(init: CreateOrderInit) {
this.addressId = init.addressId;
this.goodsList = init.goodsList.map((g) => new SelectedGoods(g));
if (init.remark !== undefined) {
this.remark = init.remark;
}
if (init.couponId !== undefined) {
this.couponId = init.couponId;
}
if (init.title !== undefined) {
this.title = init.title;
}
}
|
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left init : AST#type_annotation#Left AST#primary_type#Left CreateOrderInit 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 . addressId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . addressId 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 this AST#expression#Right . goodsList AST#member_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 init AST#expression#Right . goodsList 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 AST#parameter_list#Left ( AST#parameter#Left g AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left SelectedGoods AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left g 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#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 AST#member_expression#Left AST#expression#Left init AST#expression#Right . remark 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 . remark AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . remark 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . couponId 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 . couponId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . couponId 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . title 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 . title AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . title 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#block_statement#Right AST#constructor_declaration#Right
|
constructor(init: CreateOrderInit) {
this.addressId = init.addressId;
this.goodsList = init.goodsList.map((g) => new SelectedGoods(g));
if (init.remark !== undefined) {
this.remark = init.remark;
}
if (init.couponId !== undefined) {
this.couponId = init.couponId;
}
if (init.title !== undefined) {
this.title = init.title;
}
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/CreateOrderRequest.ets#L86-L98
|
bcb88e940459fb4cdeaa614c3152ec4332514cf0
|
github
|
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
bptaMultiWindow/entry/src/main/ets/components/WindowUtil.ets
|
arkts
|
recover
|
[EndExclude recover] [StartExclude maximize]
|
recover(): void {
try {
if (this.mainWindowClass!.getWindowStatus() === window.WindowStatusType.FULL_SCREEN) {
this.mainWindowClass!.recover()
.then(() => {
hilog.info(0x0000, 'testTag', '%{public}s', `Succeed in recovering the window.`);
})
.catch((err: BusinessError) => {
hilog.error(0x0000, 'testTag', `Failed to recover the window. Code: ${err.code}, message: ${err.message}`,
JSON.stringify(err) ?? '');
});
}
} catch (error) {
hilog.warn(0x000, 'testTag', `getWindowStatus failed, code: ${error.code}, message: ${error.message}`);
}
}
|
AST#method_declaration#Left recover 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#try_statement#Left try AST#block_statement#Left { 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mainWindowClass AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . getWindowStatus 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 window AST#expression#Right AST#binary_expression#Right AST#expression#Right . WindowStatusType AST#member_expression#Right AST#expression#Right . FULL_SCREEN 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 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#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mainWindowClass AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . recover 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#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 . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'testTag' AST#expression#Right , AST#expression#Left '%{public}s' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Succeed in recovering the window. ` 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#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 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 'testTag' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to recover the window. Code: 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: 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#expression#Left AST#binary_expression#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#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#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#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 . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x000 AST#expression#Right , AST#expression#Left 'testTag' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` getWindowStatus failed, code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error 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#block_statement#Right AST#method_declaration#Right
|
recover(): void {
try {
if (this.mainWindowClass!.getWindowStatus() === window.WindowStatusType.FULL_SCREEN) {
this.mainWindowClass!.recover()
.then(() => {
hilog.info(0x0000, 'testTag', '%{public}s', `Succeed in recovering the window.`);
})
.catch((err: BusinessError) => {
hilog.error(0x0000, 'testTag', `Failed to recover the window. Code: ${err.code}, message: ${err.message}`,
JSON.stringify(err) ?? '');
});
}
} catch (error) {
hilog.warn(0x000, 'testTag', `getWindowStatus failed, code: ${error.code}, message: ${error.message}`);
}
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/bptaMultiWindow/entry/src/main/ets/components/WindowUtil.ets#L50-L65
|
9ce38d11f7bc13bab097ca7f366fe4ff7b8937a8
|
gitee
|
cljhwt/Gemini3_to_ArkTS.git
|
11507c45be72ecccef2f757eaf024c2b8617ad34
|
ArtTs-Demo/ImageGetAndSave-master/entry/src/main/ets/common/utils/Utils.ets
|
arkts
|
Copy the source image into sandbox.
@param src - source image path
@param path - sandbox path
@returns Promise<string>
|
export async function copyImg2Sandbox(src: string, path: string): Promise<string> {
try {
let srcImage = fs.openSync(src, fs.OpenMode.READ_ONLY);
let destImage = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
fs.copyFileSync(srcImage.fd, destImage.fd);
fs.closeSync(srcImage);
fs.closeSync(destImage);
} catch (error) {
let err = error as BusinessError;
hilog.error(0x0000, 'copyImg2Sandbox', `copyImg2Sandbox failed, error code=${err.code}, message=${err.message}`);
}
return path;
}
|
AST#export_declaration#Left export AST#function_declaration#Left async function copyImg2Sandbox AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left path : 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left srcImage = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . openSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left src AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . READ_ONLY 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 destImage = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . openSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left path AST#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 AST#member_expression#Left AST#expression#Left fs AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . READ_WRITE AST#member_expression#Right AST#expression#Right | AST#expression#Left fs AST#expression#Right AST#binary_expression#Right AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . CREATE 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . copyFileSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left srcImage AST#expression#Right . fd AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left destImage AST#expression#Right . fd 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 fs AST#expression#Right . closeSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left srcImage 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 fs AST#expression#Right . closeSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left destImage 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#variable_declaration#Left let AST#variable_declarator#Left err = 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 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 'copyImg2Sandbox' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` copyImg2Sandbox failed, error code= 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= 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#return_statement#Left return AST#expression#Left path 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 copyImg2Sandbox(src: string, path: string): Promise<string> {
try {
let srcImage = fs.openSync(src, fs.OpenMode.READ_ONLY);
let destImage = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
fs.copyFileSync(srcImage.fd, destImage.fd);
fs.closeSync(srcImage);
fs.closeSync(destImage);
} catch (error) {
let err = error as BusinessError;
hilog.error(0x0000, 'copyImg2Sandbox', `copyImg2Sandbox failed, error code=${err.code}, message=${err.message}`);
}
return path;
}
|
https://github.com/cljhwt/Gemini3_to_ArkTS.git/blob/11507c45be72ecccef2f757eaf024c2b8617ad34/ArtTs-Demo/ImageGetAndSave-master/entry/src/main/ets/common/utils/Utils.ets#L29-L41
|
aaf81ad762ba7b771f78c9a12273680c6d95d035
|
github
|
|
sithvothykiv/dialog_hub.git
|
b676c102ef2d05f8994d170abe48dcc40cd39005
|
custom_dialog/src/main/ets/core/proxy/ToastIconBuilderProxy.ets
|
arkts
|
icon
|
展示的图片资源
@param icon 支持ResourceStr或PixelMap对象
@param iconSize 图片尺寸 默认:{ width: 64vp, height: 64vp }
@returns
|
icon(icon: ResourceStr | PixelMap, iconSize?: SizeOptions) {
this.builderOptions.icon = icon
this.builderOptions.iconSize = iconSize
return this
}
|
AST#method_declaration#Left icon AST#parameter_list#Left ( AST#parameter#Left icon : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceStr AST#primary_type#Right | AST#primary_type#Left PixelMap AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left iconSize ? : AST#type_annotation#Left AST#primary_type#Left SizeOptions 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#member_expression#Left AST#expression#Left this AST#expression#Right . builderOptions AST#member_expression#Right AST#expression#Right . icon AST#member_expression#Right = AST#expression#Left icon 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#member_expression#Left AST#expression#Left this AST#expression#Right . builderOptions AST#member_expression#Right AST#expression#Right . iconSize AST#member_expression#Right = AST#expression#Left iconSize 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
|
icon(icon: ResourceStr | PixelMap, iconSize?: SizeOptions) {
this.builderOptions.icon = icon
this.builderOptions.iconSize = iconSize
return this
}
|
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/ToastIconBuilderProxy.ets#L50-L54
|
b91beb0c014e61ef1db05df0bb890a3593f62ac4
|
github
|
chongzi/Lucky-ArkTs.git
|
84fc104d4a68def780a483e2543ebf9f53e793fd
|
entry/src/main/ets/pages/QuestionBankPage.ets
|
arkts
|
aboutToAppear
|
控制题目类型展开状态
|
aboutToAppear() {
// 处理路由参数
const params = router.getParams() as Record<string, string>
if (params && params.category) {
this.selectedCategory = params.category
}
this.loadQuestions()
}
|
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 处理路由参数 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left params = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . getParams 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#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#as_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 params AST#expression#Right && AST#expression#Left params AST#expression#Right AST#binary_expression#Right AST#expression#Right . category 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 . selectedCategory AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . category 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loadQuestions 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#method_declaration#Right
|
aboutToAppear() {
const params = router.getParams() as Record<string, string>
if (params && params.category) {
this.selectedCategory = params.category
}
this.loadQuestions()
}
|
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/pages/QuestionBankPage.ets#L44-L51
|
1a7db1b728dcc2ebfbc9c883187ff67226d62c0c
|
github
|
seasonZhu/HarmonyStudy.git
|
b55e58c962e9b39d5211337590bdd45f2c2349b3
|
entry/src/main/ets/pages/WebExample.ets
|
arkts
|
WebExample
|
应用侧调用前端页面函数
https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/web-in-app-frontend-page-function-invoking-V5
前端页面调用应用侧函数
https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/web-in-page-app-function-invoking-V5
|
@Entry({routeName: RouterName.WebExample})
@Component
export struct WebExample {
webviewController: webview.WebviewController = new webview.WebviewController();
// 声明需要注册的对象
@State javaScriptObject: JavaScriptInterface = new JavaScriptInterface();
build() {
Navigation() {
Column() {
// Web组件加载本地index.html页面
Web({ src: $rawfile('index.html'), controller: this.webviewController})
// 将对象注入到web端,javaScriptProxy可以不停的链式调用
.javaScriptProxy({
/// 原生侧传入的对象
object: this.javaScriptObject,
/// 在js侧对象的名称
name: "javaScriptObject",
/// 方法名
methodList: ["showMessage", "downloadImage"],
controller: this.webviewController
})
}
}
.title("Web与鸿蒙原生交互")
.mode(NavigationMode.Auto)
.titleMode(NavigationTitleMode.Mini)
.height('100%')
.width('100%')
.menus(this.getButton())
}
@Builder
getButton() {
Button('runJavaScript')
.onClick(async () => {
let map: Record<string, string> = {
"type": "commit",
"message": "this is a message from Flutter"
};
let jsonString = JSONUtil.beanToJsonStr(map)
/// 这种交互,不支持原生向JS传递参数
//let javaScriptCallbackResult = this.webviewController.runJavaScript(`sendMessageToDiscussList(${jsonString})`);
// 前端页面函数无参时,将param删除。
let javaScriptCallbackResult = await this.webviewController.runJavaScript(`harmonyOSCallJS()`)
ToastUtil.showToast(javaScriptCallbackResult)
})
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left routeName AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left RouterName AST#expression#Right . WebExample AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct WebExample AST#component_body#Left { AST#property_declaration#Left webviewController : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left webview . WebviewController 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#new_expression#Left new AST#expression#Left webview AST#expression#Right AST#new_expression#Right AST#expression#Right . WebviewController 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 javaScriptObject : AST#type_annotation#Left AST#primary_type#Left JavaScriptInterface 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 JavaScriptInterface 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#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Navigation ( ) 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 { // Web组件加载本地index.html页面 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Web ( AST#component_parameters#Left { AST#component_parameter#Left src : AST#expression#Left AST#call_expression#Left AST#expression#Left $rawfile AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'index.html' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left controller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webviewController AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right // 将对象注入到web端,javaScriptProxy可以不停的链式调用 AST#modifier_chain_expression#Left . javaScriptProxy ( AST#expression#Left AST#object_literal#Left { /// 原生侧传入的对象 AST#property_assignment#Left AST#property_name#Left object AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . javaScriptObject AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , /// 在js侧对象的名称 AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left "javaScriptObject" AST#expression#Right AST#property_assignment#Right , /// 方法名 AST#property_assignment#Left AST#property_name#Left methodList AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left "showMessage" AST#expression#Right , AST#expression#Left "downloadImage" AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left controller AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webviewController AST#member_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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . title ( AST#expression#Left "Web与鸿蒙原生交互" AST#expression#Right ) AST#modifier_chain_expression#Left . mode ( AST#expression#Left AST#member_expression#Left AST#expression#Left NavigationMode AST#expression#Right . Auto AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . titleMode ( AST#expression#Left AST#member_expression#Left AST#expression#Left NavigationTitleMode AST#expression#Right . Mini AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . menus ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getButton AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_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#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right getButton 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 Button ( AST#expression#Left 'runJavaScript' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left async AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left map : 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#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "type" AST#property_name#Right : AST#expression#Left "commit" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "message" AST#property_name#Right : AST#expression#Left "this is a message from Flutter" 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 jsonString = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSONUtil AST#expression#Right . beanToJsonStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left map AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right /// 这种交互,不支持原生向JS传递参数 //let javaScriptCallbackResult = this.webviewController.runJavaScript(`sendMessageToDiscussList(${jsonString})`); // 前端页面函数无参时,将param删除。 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left javaScriptCallbackResult = AST#expression#Left AST#call_expression#Left 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#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 . webviewController AST#member_expression#Right AST#expression#Right . runJavaScript AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` harmonyOSCallJS() ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left To AST#ERROR#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left tUtil . showToast AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left javaScriptCallbackResult 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#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Entry({routeName: RouterName.WebExample})
@Component
export struct WebExample {
webviewController: webview.WebviewController = new webview.WebviewController();
@State javaScriptObject: JavaScriptInterface = new JavaScriptInterface();
build() {
Navigation() {
Column() {
Web({ src: $rawfile('index.html'), controller: this.webviewController})
.javaScriptProxy({
object: this.javaScriptObject,
name: "javaScriptObject",
methodList: ["showMessage", "downloadImage"],
controller: this.webviewController
})
}
}
.title("Web与鸿蒙原生交互")
.mode(NavigationMode.Auto)
.titleMode(NavigationTitleMode.Mini)
.height('100%')
.width('100%')
.menus(this.getButton())
}
@Builder
getButton() {
Button('runJavaScript')
.onClick(async () => {
let map: Record<string, string> = {
"type": "commit",
"message": "this is a message from Flutter"
};
let jsonString = JSONUtil.beanToJsonStr(map)
let javaScriptCallbackResult = await this.webviewController.runJavaScript(`harmonyOSCallJS()`)
ToastUtil.showToast(javaScriptCallbackResult)
})
}
}
|
https://github.com/seasonZhu/HarmonyStudy.git/blob/b55e58c962e9b39d5211337590bdd45f2c2349b3/entry/src/main/ets/pages/WebExample.ets#L63-L113
|
f625730cbf97149651619e8b9015e78930a221d7
|
github
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/common/utils/DeviceUtils.ets
|
arkts
|
getDeviceType
|
获取设备类型
|
static getDeviceType(): string {
return DeviceUtil.DEVICE_TYPE;
}
|
AST#method_declaration#Left static getDeviceType AST#parameter_list#Left ( ) 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#member_expression#Left AST#expression#Left DeviceUtil AST#expression#Right . DEVICE_TYPE AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getDeviceType(): string {
return DeviceUtil.DEVICE_TYPE;
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DeviceUtils.ets#L48-L50
|
a4fcadc768d03746f9fb6c983a2215259fd0bf0f
|
github
|
weiwei0928/Eyepetizer-harmony.git
|
fd5947c6f616c22d42256f36ba752093b782a910
|
entry/src/main/ets/http/AxiosHttpRequest.ets
|
arkts
|
request
|
类型参数的作用,T决定AxiosResponse实例中data的类型
|
request<T = CommonType>(config?: HttpRequestConfig): Promise<T> {
return new Promise<T>((resolve, reject) => {
this.instance
// 发送请求
.request<CommonType, T>(config)
.then(res => {
resolve(res);
})
.catch((err:CommonType) => {
loge("网络请求Request异常:", err?.toString()??"")
errorHandler(err)
if (err) {
reject(err);
}
});
});
}
|
AST#method_declaration#Left request AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left CommonType AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left config ? : AST#type_annotation#Left AST#primary_type#Left HttpRequestConfig 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 T 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#new_expression#Left new AST#expression#Left Promise AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left resolve AST#parameter#Right , AST#parameter#Left reject 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 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 . instance AST#member_expression#Right AST#expression#Right // 发送请求 . request AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left CommonType AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left config 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 res => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left resolve 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#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#primary_type#Left CommonType 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 loge AST#expression#Right AST#argument_list#Left ( AST#expression#Left "网络请求Request异常:" AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left err 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#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 errorHandler 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#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left err AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left reject 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#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#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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
request<T = CommonType>(config?: HttpRequestConfig): Promise<T> {
return new Promise<T>((resolve, reject) => {
this.instance
.request<CommonType, T>(config)
.then(res => {
resolve(res);
})
.catch((err:CommonType) => {
loge("网络请求Request异常:", err?.toString()??"")
errorHandler(err)
if (err) {
reject(err);
}
});
});
}
|
https://github.com/weiwei0928/Eyepetizer-harmony.git/blob/fd5947c6f616c22d42256f36ba752093b782a910/entry/src/main/ets/http/AxiosHttpRequest.ets#L67-L83
|
070e40c47ab2ea5070052d3926a528c1fb0bf963
|
github
|
openharmony/xts_acts
|
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
|
arkcompiler/esmodule/esmodule_dynamicimport/hardephar/Index.ets
|
arkts
|
MainPage
|
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 { MainPage, add } from './src/main/ets/components/mainpage/MainPage'
|
AST#export_declaration#Left export { MainPage , add } from './src/main/ets/components/mainpage/MainPage' AST#export_declaration#Right
|
export { MainPage, add } from './src/main/ets/components/mainpage/MainPage'
|
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkcompiler/esmodule/esmodule_dynamicimport/hardephar/Index.ets#L16-L16
|
f421879f8a9b2e5a27792de3429eaaa888bc2b39
|
gitee
|
zl3624/harmonyos_network_samples
|
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
|
code/udp/UdpDemo/entry/src/main/ets/pages/Index.ets
|
arkts
|
bind2Port
|
绑定本地端口
|
async bind2Port() {
//本地地址
let localAddress = { address: "0.0.0.0", port: this.localPort, family: 1 }
await udpSocket.bind(localAddress)
.then(() => {
this.msgHistory = 'bind success' + "\r\n";
})
.catch((e) => {
this.msgHistory = 'bind fail' + e.message + "\r\n";
})
//收到消息时的处理
udpSocket.on("message", async (value) => {
let msg = buf2String(value.message)
let remoteIP = value.remoteInfo.address
let remotePort = value.remoteInfo.port.toString()
//对端ip地址和端口的字符串形式
let remoteAddr = "[" + remoteIP + ":" + remotePort + "]:"
let time = await getCurrentTimeString()
this.msgHistory += remoteAddr + msg + time + "\r\n"
this.scroller.scrollEdge(Edge.Bottom)
})
}
|
AST#method_declaration#Left async bind2Port AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //本地地址 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left localAddress = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left address AST#property_name#Right : AST#expression#Left "0.0.0.0" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left port AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . localPort AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left family AST#property_name#Right : AST#expression#Left 1 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 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#await_expression#Left await AST#expression#Left udpSocket AST#expression#Right AST#await_expression#Right AST#expression#Right . bind AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left localAddress 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#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 'bind success' 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 'bind fail' 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#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left udpSocket AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "message" AST#expression#Right , AST#expression#Left AST#arrow_function#Left async AST#parameter_list#Left ( AST#parameter#Left value AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left msg = AST#expression#Left AST#call_expression#Left AST#expression#Left buf2String AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . message 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 remoteIP = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . remoteInfo AST#member_expression#Right AST#expression#Right . address 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 remotePort = 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#member_expression#Left AST#expression#Left value AST#expression#Right . remoteInfo AST#member_expression#Right AST#expression#Right . port 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#variable_declarator#Right //对端ip地址和端口的字符串形式 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left remoteAddr = AST#expression#Left AST#binary_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 "[" AST#expression#Right + AST#expression#Left remoteIP AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ":" AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left remotePort AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left "]:" 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 time = AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left getCurrentTimeString AST#expression#Right AST#await_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . msgHistory AST#member_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#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left remoteAddr AST#expression#Right + AST#expression#Left msg AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left time AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left "\r\n" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . scroller AST#member_expression#Right AST#expression#Right . scrollEdge AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Edge AST#expression#Right . Bottom 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#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#block_statement#Right AST#method_declaration#Right
|
async bind2Port() {
let localAddress = { address: "0.0.0.0", port: this.localPort, family: 1 }
await udpSocket.bind(localAddress)
.then(() => {
this.msgHistory = 'bind success' + "\r\n";
})
.catch((e) => {
this.msgHistory = 'bind fail' + e.message + "\r\n";
})
udpSocket.on("message", async (value) => {
let msg = buf2String(value.message)
let remoteIP = value.remoteInfo.address
let remotePort = value.remoteInfo.port.toString()
let remoteAddr = "[" + remoteIP + ":" + remotePort + "]:"
let time = await getCurrentTimeString()
this.msgHistory += remoteAddr + msg + time + "\r\n"
this.scroller.scrollEdge(Edge.Bottom)
})
}
|
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/udp/UdpDemo/entry/src/main/ets/pages/Index.ets#L150-L173
|
fa331da9f4c0600af27c7aebe7871dc7fff2cd42
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/groupavatar/src/main/ets/datasource/GroupAvatarModel.ets
|
arkts
|
群头像数据结构
|
export interface GroupAvatarModel {
src: ResourceStr | image.PixelMap;
width: number;
height: number;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface GroupAvatarModel AST#object_type#Left { AST#type_member#Left src : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceStr AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left width : 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 height : 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 GroupAvatarModel {
src: ResourceStr | image.PixelMap;
width: number;
height: number;
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/groupavatar/src/main/ets/datasource/GroupAvatarModel.ets#L20-L24
|
4c3a2ca683deb884db46e20f9939ec74d48f797f
|
gitee
|
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/module_city_select/src/main/ets/components/SingleBtn.ets
|
arkts
|
SingleBtn
|
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.
|
@ComponentV2
export struct SingleBtn {
@Param city: string = '';
@Param fgColor: ResourceColor = Color.Black;
@Event onClickEvent: () => void = () => {
};
build() {
Button() {
Text(this.city)
.fontSize(14)
.fontColor(this.fgColor)
.fontWeight(500)
.textAlign(TextAlign.Center)
.constraintSize({ minWidth: 44 })
}
.backgroundColor($r('app.color.grey_5'))
.padding({
top: 4,
bottom: 4,
left: 8,
right: 8,
})
.onClick(() => {
this.onClickEvent();
})
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SingleBtn AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right city : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right fgColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Event AST#decorator#Right onClickEvent : 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#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) 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#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( ) 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 this AST#expression#Right . city AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fgColor AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left 500 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 . constraintSize ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left minWidth AST#property_name#Right : AST#expression#Left 44 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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.grey_5' 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 top AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 8 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onClickEvent 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#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 SingleBtn {
@Param city: string = '';
@Param fgColor: ResourceColor = Color.Black;
@Event onClickEvent: () => void = () => {
};
build() {
Button() {
Text(this.city)
.fontSize(14)
.fontColor(this.fgColor)
.fontWeight(500)
.textAlign(TextAlign.Center)
.constraintSize({ minWidth: 44 })
}
.backgroundColor($r('app.color.grey_5'))
.padding({
top: 4,
bottom: 4,
left: 8,
right: 8,
})
.onClick(() => {
this.onClickEvent();
})
}
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/module_city_select/src/main/ets/components/SingleBtn.ets#L16-L43
|
25e59889df2f3bfc8ef1b847cb1f5bf1be93acfc
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/crypto/RSA.ets
|
arkts
|
verifySync
|
对数据进行验签,同步
@param dataBlob 待验签数据
@param signDataBlob 签名数据
@param pubKey 公钥
@param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、、等)。
@returns
|
static verifySync(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, algName: string = 'RSA1024|PKCS1|SHA256'): boolean {
return CryptoUtil.verifySync(dataBlob, signDataBlob, pubKey, algName);
}
|
AST#method_declaration#Left static verifySync AST#parameter_list#Left ( AST#parameter#Left dataBlob : 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 signDataBlob : 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 pubKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PubKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'RSA1024|PKCS1|SHA256' AST#expression#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#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 . verifySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dataBlob AST#expression#Right , AST#expression#Left signDataBlob AST#expression#Right , AST#expression#Left pubKey AST#expression#Right , AST#expression#Left algName 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 verifySync(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, algName: string = 'RSA1024|PKCS1|SHA256'): boolean {
return CryptoUtil.verifySync(dataBlob, signDataBlob, pubKey, algName);
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/RSA.ets#L274-L276
|
9b301592300b748e86be49b90626b7ca8dda3f1b
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/BasicFeature/Notification/CustomNotification/notification/src/main/ets/notification/NotificationContentUtil.ets
|
arkts
|
initNotificationPictureContent
|
init picture notification content
@param basicContent
@param notificationBriefText
@param notificationExpandedTitle
@param notificationPicture
@return return the created NotificationContent
|
initNotificationPictureContent(basicContent: notification.NotificationBasicContent, notificationBriefText: string, notificationExpandedTitle: string, notificationPicture: image.PixelMap): notification.NotificationContent {
return {
contentType: notification.ContentType.NOTIFICATION_CONTENT_PICTURE, // 通知内容类型
picture: {
title: basicContent.title, // 通知标题
text: basicContent.text, // 通知内容
additionalText: basicContent.additionalText ? basicContent.additionalText : '', // 通知次要内容,是对通知内容的补充
briefText: notificationBriefText, // 通知概要内容,是对通知内容的总结
expandedTitle: notificationExpandedTitle, // 通知展开时的标题
picture: notificationPicture // 通知的图片
}
};
}
|
AST#method_declaration#Left initNotificationPictureContent AST#parameter_list#Left ( AST#parameter#Left basicContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notification . NotificationBasicContent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left notificationBriefText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left notificationExpandedTitle : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left notificationPicture : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap 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 AST#qualified_type#Left notification . NotificationContent 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#object_literal#Left { AST#property_assignment#Left AST#property_name#Left contentType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notification 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 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 basicContent AST#expression#Right . title 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 basicContent AST#expression#Right . text AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // 通知内容 AST#property_assignment#Left AST#property_name#Left additionalText AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left basicContent AST#expression#Right . additionalText AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left basicContent AST#expression#Right . additionalText AST#member_expression#Right AST#expression#Right : AST#expression#Left '' AST#expression#Right AST#conditional_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 notificationBriefText AST#expression#Right AST#property_assignment#Right , // 通知概要内容,是对通知内容的总结 AST#property_assignment#Left AST#property_name#Left expandedTitle AST#property_name#Right : AST#expression#Left notificationExpandedTitle AST#expression#Right AST#property_assignment#Right , // 通知展开时的标题 AST#property_assignment#Left AST#property_name#Left picture AST#property_name#Right : AST#expression#Left notificationPicture 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
initNotificationPictureContent(basicContent: notification.NotificationBasicContent, notificationBriefText: string, notificationExpandedTitle: string, notificationPicture: image.PixelMap): notification.NotificationContent {
return {
contentType: notification.ContentType.NOTIFICATION_CONTENT_PICTURE,
picture: {
title: basicContent.title,
text: basicContent.text,
additionalText: basicContent.additionalText ? basicContent.additionalText : '',
briefText: notificationBriefText,
expandedTitle: notificationExpandedTitle,
picture: notificationPicture
}
};
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Notification/CustomNotification/notification/src/main/ets/notification/NotificationContentUtil.ets#L89-L101
|
2ec32572d6324e11d3b2da8336cf009f72285419
|
gitee
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_crypto_dto/src/main/ets/crypto/encryption/SHA1.ets
|
arkts
|
hash
|
bits per input character. 8 - ASCII; 16 - Unicode
散列哈希算法
@param value
@returns
|
static hash(value: string): OutDTO<string> {
let hash = new SHA1();
return OutDTO.OKByDataRow('SHA1散列算法成功~', hash.hex_sha1(value));
}
|
AST#method_declaration#Left static hash 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#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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left hash = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left SHA1 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#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 'SHA1散列算法成功~' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hash AST#expression#Right . hex_sha1 AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left value 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 hash(value: string): OutDTO<string> {
let hash = new SHA1();
return OutDTO.OKByDataRow('SHA1散列算法成功~', hash.hex_sha1(value));
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/SHA1.ets#L37-L40
|
09c4b7b2d98b6fb19a72ae5aa1111f3a442a8bc0
|
gitee
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/managers/member/EncourageManager.ets
|
arkts
|
getRewardCount
|
获取奖励数量(类似Swift中的rewardCount计算属性)
合并了原RewardPool.getRewardForType的功能
|
static getRewardCount(type: EncourageType): number {
switch (type) {
case EncourageType.wordPronRewardAd:
return EncourageTypeHelper.rewardAd[0] || 10; // 默认值
case EncourageType.wordPronShareApp:
return EncourageTypeHelper.shareApp[0] || 30; // 默认值
default:
return 0;
}
|
AST#method_declaration#Left static getRewardCount AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left EncourageType 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#expression_statement#Left AST#expression#Left switch AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left ( AST#expression#Left type AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EncourageType AST#expression#Right . wordPronRewardAd AST#member_expression#Right AST#expression#Right AST#expression_statement#Right : AST#ERROR#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EncourageTypeHelper AST#expression#Right . rewardAd AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right || AST#expression#Left 10 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right // 默认值 AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EncourageType AST#expression#Right . wordPronShareApp AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : AST#ERROR#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EncourageTypeHelper AST#expression#Right . shareApp AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right || AST#expression#Left 30 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right // 默认值 AST#statement#Left AST#expression_statement#Left AST#expression#Left default AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 0 AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getRewardCount(type: EncourageType): number {
switch (type) {
case EncourageType.wordPronRewardAd:
return EncourageTypeHelper.rewardAd[0] || 10;
case EncourageType.wordPronShareApp:
return EncourageTypeHelper.shareApp[0] || 30;
default:
return 0;
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/EncourageManager.ets#L63-L71
|
105674232686062f277c5a7cad250c7e0cf01a81
|
github
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/webDavService/WebdavService.ets
|
arkts
|
copy
|
复制方法
|
copy(value:string){
let pasteData: pasteboard.PasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN,value);
const systemPasteboard = pasteboard.getSystemPasteboard()
systemPasteboard.setData(pasteData)
promptAction.showToast({
message: '复制成功',
duration: 1000,
})
}
|
AST#method_declaration#Left copy 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#variable_declaration#Left let AST#variable_declarator#Left pasteData : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left pasteboard . PasteData 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 pasteboard AST#expression#Right . createData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left pasteboard AST#expression#Right . MIMETYPE_TEXT_PLAIN AST#member_expression#Right AST#expression#Right , AST#expression#Left value 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 systemPasteboard = 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 pasteboard AST#expression#Right . getSystemPasteboard AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left systemPasteboard AST#ERROR#Right . setData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pasteData AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left promptAction AST#ERROR#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 1000 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#block_statement#Right AST#method_declaration#Right
|
copy(value:string){
let pasteData: pasteboard.PasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN,value);
const systemPasteboard = pasteboard.getSystemPasteboard()
systemPasteboard.setData(pasteData)
promptAction.showToast({
message: '复制成功',
duration: 1000,
})
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/webDavService/WebdavService.ets#L142-L150
|
90a65b886ea617c4fdcc51b508e7c153825afad8
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/theme/ThemeManager.ets
|
arkts
|
主题配置接口
|
export interface ThemeConfig {
mode: ThemeMode;
type: ThemeType;
colorTheme: ColorTheme;
fontConfig: FontConfig;
animationConfig: AnimationConfig;
customizations: {
enableGradients: boolean;
enableShadows: boolean;
enableBlur: boolean;
borderRadius: number;
cardElevation: number;
iconStyle: 'filled' | 'outlined' | 'rounded';
};
|
AST#export_declaration#Left export AST#interface_declaration#Left interface ThemeConfig AST#ERROR#Left { AST#type_member#Left mode : AST#type_annotation#Left AST#primary_type#Left ThemeMode AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left type : AST#type_annotation#Left AST#primary_type#Left ThemeType AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left colorTheme : AST#type_annotation#Left AST#primary_type#Left ColorTheme AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left fontConfig : AST#type_annotation#Left AST#primary_type#Left FontConfig AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left animationConfig : AST#type_annotation#Left AST#primary_type#Left AnimationConfig AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; customizations : AST#ERROR#Right AST#object_type#Left { AST#type_member#Left enableGradients : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left enableShadows : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left enableBlur : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left borderRadius : 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 cardElevation : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#ERROR#Left iconStyle : 'filled' | 'outlined' | 'rounded' ; AST#ERROR#Right } AST#object_type#Right AST#interface_declaration#Right ; AST#export_declaration#Right
|
export interface ThemeConfig {
mode: ThemeMode;
type: ThemeType;
colorTheme: ColorTheme;
fontConfig: FontConfig;
animationConfig: AnimationConfig;
customizations: {
enableGradients: boolean;
enableShadows: boolean;
enableBlur: boolean;
borderRadius: number;
cardElevation: number;
iconStyle: 'filled' | 'outlined' | 'rounded';
};
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L97-L110
|
e689e45eebf255f3f39c35b507345fcef5b3268d
|
github
|
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/managers/plan/plancurve/Plan.ets
|
arkts
|
getLearns
|
/ 学习记录
|
getLearns(): Learn[] {
return this.learns;
}
|
AST#method_declaration#Left getLearns AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Learn [ ] AST#array_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 this AST#expression#Right . learns AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getLearns(): Learn[] {
return this.learns;
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L90-L92
|
e30f1647bd5e53c58a087aad9685ebf5e6557c27
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/product/entry/src/main/ets/constants/HelperConstants.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 class HelperConstants {
static readonly HELPER_URL_PROTOTYPE: string = "https://gitee.com/harmonyos-cases/cases/blob/master/CommonAppDevelopment/feature/{placeholder}/README.md";
static readonly HELPER_URL_PROTOTYPE_PERFERMANCE: string = "https://gitee.com/harmonyos-cases/cases/blob/master/CommonAppDevelopment/feature/perfermance/{placeholder}/README.md";
static readonly HELPER_URL_HOME: string = "https://gitee.com/harmonyos-cases/cases/blob/master/README.md";
static readonly ANIMATION_DURATION: number = 300;
static readonly IDE_PLUGIN_URL:string = "https://gitee.com/harmonyos-cases/cases/blob/master/plugin/README.md";
}
|
AST#export_declaration#Left export AST#class_declaration#Left class HelperConstants AST#class_body#Left { AST#property_declaration#Left static readonly HELPER_URL_PROTOTYPE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "https://gitee.com/harmonyos-cases/cases/blob/master/CommonAppDevelopment/feature/{placeholder}/README.md" AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly HELPER_URL_PROTOTYPE_PERFERMANCE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "https://gitee.com/harmonyos-cases/cases/blob/master/CommonAppDevelopment/feature/perfermance/{placeholder}/README.md" AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly HELPER_URL_HOME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "https://gitee.com/harmonyos-cases/cases/blob/master/README.md" AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly ANIMATION_DURATION : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 300 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly IDE_PLUGIN_URL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "https://gitee.com/harmonyos-cases/cases/blob/master/plugin/README.md" AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class HelperConstants {
static readonly HELPER_URL_PROTOTYPE: string = "https://gitee.com/harmonyos-cases/cases/blob/master/CommonAppDevelopment/feature/{placeholder}/README.md";
static readonly HELPER_URL_PROTOTYPE_PERFERMANCE: string = "https://gitee.com/harmonyos-cases/cases/blob/master/CommonAppDevelopment/feature/perfermance/{placeholder}/README.md";
static readonly HELPER_URL_HOME: string = "https://gitee.com/harmonyos-cases/cases/blob/master/README.md";
static readonly ANIMATION_DURATION: number = 300;
static readonly IDE_PLUGIN_URL:string = "https://gitee.com/harmonyos-cases/cases/blob/master/plugin/README.md";
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/product/entry/src/main/ets/constants/HelperConstants.ets#L16-L22
|
47de690d6e6f11fa7c9d8152ee5fc73e1bad02ad
|
gitee
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.