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
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DbUtil.ets
arkts
queryForList
查询数据 @param predicates 条件 @param columns @returns
queryForList<T> (predicates: relationalStore.RdbPredicates, columns: ColumnInfo[]): Promise<T[]> { return new Promise((resolve, reject) => { this.rdbStore?.query(predicates, columns.map(info => info.columnName), (err, result) => { if (err) { Logger.error(`[${CommonConstants.RDB_TAG}]`,'查询失败!',JSON.stringify(err)); reject(err); } else { Logger.debug(`[${CommonConstants.RDB_TAG}]`,'查询成功!查询行数:', result.rowCount.toString()); resolve(this.parseResultSet(result, columns)); result.close(); } }) }); }
AST#method_declaration#Left queryForList AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left predicates : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . RdbPredicates AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left columns : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ColumnInfo [ ] 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 Promise AST#type_arguments#Left < 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#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#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#member_expression#Left AST#expression#Left this AST#expression#Right . rdbStore AST#member_expression#Right AST#expression#Right ?. query AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left predicates AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left columns AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left info => AST#expression#Left AST#member_expression#Left AST#expression#Left info AST#expression#Right . columnName 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#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right , AST#parameter#Left result AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left 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 AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [ AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . RDB_TAG AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ] ` AST#template_literal#Right AST#expression#Right , AST#expression#Left '查询失败!' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left 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 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 Logger AST#expression#Right . debug 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 CommonConstants AST#expression#Right . RDB_TAG AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ] ` AST#template_literal#Right AST#expression#Right , AST#expression#Left '查询成功!查询行数:' 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 result AST#expression#Right . rowCount 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#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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parseResultSet AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left result AST#expression#Right , AST#expression#Left columns AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#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
queryForList<T> (predicates: relationalStore.RdbPredicates, columns: ColumnInfo[]): Promise<T[]> { return new Promise((resolve, reject) => { this.rdbStore?.query(predicates, columns.map(info => info.columnName), (err, result) => { if (err) { Logger.error(`[${CommonConstants.RDB_TAG}]`,'查询失败!',JSON.stringify(err)); reject(err); } else { Logger.debug(`[${CommonConstants.RDB_TAG}]`,'查询成功!查询行数:', result.rowCount.toString()); resolve(this.parseResultSet(result, columns)); result.close(); } }) }); }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DbUtil.ets#L188-L201
688e43b57446628880098e2835f5ac292fae54e0
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/view/MePage.ets
arkts
buildUserInfoTitle
构建用户信息标题区域 @returns {void} 无返回值
@Builder private buildUserInfoTitle(): void { ColumnStart() { Text(this.getDisplayName()) .fontSize($r("app.float.display_medium")) .fontColor($r("app.color.text_primary")) .fontWeight(FontWeight.Medium); SpaceVerticalXSmall(); this.buildUserPhoneLine(); } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildUserInfoTitle 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ColumnStart ( ) 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 this AST#expression#Right . getDisplayName 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.display_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.text_primary" 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 . Medium 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#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#ui_custom_component_statement#Left SpaceVerticalXSmall ( ) ; 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 . buildUserPhoneLine 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#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 private buildUserInfoTitle(): void { ColumnStart() { Text(this.getDisplayName()) .fontSize($r("app.float.display_medium")) .fontColor($r("app.color.text_primary")) .fontWeight(FontWeight.Medium); SpaceVerticalXSmall(); this.buildUserPhoneLine(); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/MePage.ets#L159-L171
a11e1820462901ff6d54045dd37c75174fba9cd7
github
euler1129/Cloud-flash-payment.git
dfb70c1c67b3b69447f4384661e16b60f40495de
entry/src/main/ets/pages/card/components/ShowCardArea.ets
arkts
watchCurrentCardNum
监听传回来的值
watchCurrentCardNum () { if (this.saveCardNum1) { console.log('saveCardNum', this.saveCardNum1.substr(-4)) const list = JSON.parse(JSON.stringify(this.addDoneCardInfo)) const addIndex = list[1].cardList.length + 1 list[1].cardList.push({ id: `creditCard_${addIndex}`, img: $r('app.media.auth_card_default_card_ec'), cardName: `新增银行${addIndex}`, cardNum: this.saveCardNum1.substr(-4), money: '4000', isTransfer: true }) this.addDoneCardInfo = [] setTimeout(()=>{ this.addDoneCardInfo = list this.dealTypeToList() // 置空 AppStorage.SetOrCreate('saveCardNum', '') }, 300) } }
AST#method_declaration#Left watchCurrentCardNum 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 this AST#expression#Right . saveCardNum1 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 console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'saveCardNum' 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 . saveCardNum1 AST#member_expression#Right AST#expression#Right . substr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#unary_expression#Left - AST#expression#Left 4 AST#expression#Right AST#unary_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#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left list = 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#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 . addDoneCardInfo 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#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left addIndex = AST#expression#Left AST#assignment_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#binary_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 list AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . cardList AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#subscript_expression#Left AST#expression#Left 1 AST#expression#Right AST#ERROR#Left list AST#ERROR#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . cardList AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` creditCard_ AST#template_substitution#Left $ { AST#expression#Left addIndex AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left img AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.auth_card_default_card_ec' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left cardName AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` 新增银行 AST#template_substitution#Left $ { AST#expression#Left addIndex AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left cardNum AST#property_name#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 . saveCardNum1 AST#member_expression#Right AST#expression#Right . substr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#unary_expression#Left - AST#expression#Left 4 AST#expression#Right AST#unary_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 money AST#property_name#Right : AST#expression#Left '4000' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left isTransfer AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . addDoneCardInfo AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#ERROR#Left setTimeout AST#ERROR#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 . addDoneCardInfo AST#member_expression#Right = AST#expression#Left list 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 . dealTypeToList AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right // 置空 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . SetOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'saveCardNum' AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 300 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
watchCurrentCardNum () { if (this.saveCardNum1) { console.log('saveCardNum', this.saveCardNum1.substr(-4)) const list = JSON.parse(JSON.stringify(this.addDoneCardInfo)) const addIndex = list[1].cardList.length + 1 list[1].cardList.push({ id: `creditCard_${addIndex}`, img: $r('app.media.auth_card_default_card_ec'), cardName: `新增银行${addIndex}`, cardNum: this.saveCardNum1.substr(-4), money: '4000', isTransfer: true }) this.addDoneCardInfo = [] setTimeout(()=>{ this.addDoneCardInfo = list this.dealTypeToList() AppStorage.SetOrCreate('saveCardNum', '') }, 300) } }
https://github.com/euler1129/Cloud-flash-payment.git/blob/dfb70c1c67b3b69447f4384661e16b60f40495de/entry/src/main/ets/pages/card/components/ShowCardArea.ets#L26-L51
c6f23d0dff8c14743e3d4a65c6f238948bfae27d
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildSync.ets
arkts
handle
假设client类型为any,实际应根据具体类型替换
handle(data: any): void { // 应用约束10:显式指定参数和返回类型,避免any this.client = this.client; const guild = this.client.guilds.get(data.id); if (guild) { if (data.presences) { // 应用约束41:使用常规for循环替代for..in for (let presence of data.presences) { guild._setPresence(presence.user.id, presence); } } if (data.members) { for (let syncMember of data.members) { const member = guild.members.get(syncMember.user.id); if (member) { guild._updateMember(member, syncMember); } else { guild._addMember(syncMember, false); } } } // 应用约束36:使用属性判断替代in运算符 if (data.hasOwnProperty('large')) { guild.large = data.large; } } }
AST#method_declaration#Left handle AST#parameter_list#Left ( AST#parameter#Left data : 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 void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 应用约束10:显式指定参数和返回类型,避免any 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 . client AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . client 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#variable_declaration#Left const AST#variable_declarator#Left guild = 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 . client AST#member_expression#Right AST#expression#Right . guilds 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 data AST#expression#Right . id 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 guild 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 data AST#expression#Right . presences AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 应用约束41:使用常规for循环替代for..in AST#statement#Left AST#for_statement#Left for ( let presence of AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . presences 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 guild AST#expression#Right . _setPresence 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 presence AST#expression#Right . user AST#member_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right , AST#expression#Left presence AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . members AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( let syncMember of AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . members AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left member = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left guild AST#expression#Right . members 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 AST#member_expression#Left AST#expression#Left syncMember AST#expression#Right . user AST#member_expression#Right AST#expression#Right . id 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 member 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 guild AST#expression#Right . _updateMember AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left member AST#expression#Right , AST#expression#Left syncMember 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 guild AST#expression#Right . _addMember AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left syncMember AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 应用约束36:使用属性判断替代in运算符 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 data AST#expression#Right . hasOwnProperty AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'large' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left guild AST#expression#Right . large AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . large 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
handle(data: any): void { this.client = this.client; const guild = this.client.guilds.get(data.id); if (guild) { if (data.presences) { for (let presence of data.presences) { guild._setPresence(presence.user.id, presence); } } if (data.members) { for (let syncMember of data.members) { const member = guild.members.get(syncMember.user.id); if (member) { guild._updateMember(member, syncMember); } else { guild._addMember(syncMember, false); } } } if (data.hasOwnProperty('large')) { guild.large = data.large; } } }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildSync.ets#L8-L36
4c36c07c0be49f86a1f88a81d5d5238f3146d9a6
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/ObjectUtil.ets
arkts
getHash
获取对象的Hash值。如果是第一次获取,则计算Hash值并保存到对象的Hash域(返回随机的Hash值);如果不是第一次获取,则从Hash域中获取并返回Hash值(同一对象多次返回值保持不变)。 @param object @returns
static getHash(object: object): number { return util.getHash(object); }
AST#method_declaration#Left static getHash AST#parameter_list#Left ( AST#parameter#Left object : 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#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 util AST#expression#Right . getHash AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left object 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 getHash(object: object): number { return util.getHash(object); }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/ObjectUtil.ets#L8-L10
ad3227d32e208d8ff3848713c00b65ad45f3ba62
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/paintcomponent/src/main/ets/view/PaintComponent.ets
arkts
changeProgressNum
改变进度 @param isIncrease 是否增加
changeProgressNum(isIncrease: boolean) { // 根据isIncrease来决定是对progressNum自增还是自减 isIncrease ? this.progressNum += Constants.PROGRESS_STEP : this.progressNum -= Constants.PROGRESS_STEP; this.changeColor(); this.pathCommands = this.getPathCommands(this.progressNum); }
AST#method_declaration#Left changeProgressNum AST#parameter_list#Left ( AST#parameter#Left isIncrease : 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 { // 根据isIncrease来决定是对progressNum自增还是自减 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left isIncrease AST#expression#Right ? AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . progressNum AST#member_expression#Right += AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . PROGRESS_STEP AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . progressNum AST#member_expression#Right -= AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . PROGRESS_STEP 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . changeColor 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pathCommands 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 . getPathCommands 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 . progressNum AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
changeProgressNum(isIncrease: boolean) { isIncrease ? this.progressNum += Constants.PROGRESS_STEP : this.progressNum -= Constants.PROGRESS_STEP; this.changeColor(); this.pathCommands = this.getPathCommands(this.progressNum); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/paintcomponent/src/main/ets/view/PaintComponent.ets#L122-L127
b8987aaaf6539c6175aca1f8938d85abc0d5dcd8
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/model/src/main/ets/request/PageRequest.ets
arkts
@param {Partial<PageRequest>} init - 初始化数据
constructor(init?: Partial<PageRequest>) { if (!init) return; this.page = init.page ?? this.page; this.size = init.size ?? this.size; this.sort = init.sort ?? this.sort; }
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 PageRequest 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#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . page 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 . page AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . page 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 . size 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 . size AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . size 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 . sort 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 . sort AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . sort 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
constructor(init?: Partial<PageRequest>) { if (!init) return; this.page = init.page ?? this.page; this.size = init.size ?? this.size; this.sort = init.sort ?? this.sort; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/PageRequest.ets#L22-L27
dc4365f7a68b401f6f5a8720d8f42783a87dd55f
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/nativesavepictosandbox/src/main/ets/view/NativePictureToSandboxView.ets
arkts
NativePictureToSandboxViewComponent
功能描述: 本示例主要介绍Native如何将网络上的图片及Rawfile中的图片保存到应用沙箱中。 推荐场景: 将网络上的图片及Rawfile中的图片保存到应用沙箱中 核心组件: 1. saveImageOfInternetCallback 2. saveImageOfRawfileCallback 实现步骤: 1. 调用native侧saveImageOfInternetCallback接口,将返回的沙箱路径转换为Uri路径后绑定到Image组件 2. 调用native侧saveImageOfRawfileCallback接口,将返回的沙箱路径转换为Uri路径后绑定到Image组件
@Component export struct NativePictureToSandboxViewComponent { private resMgr = getContext().resourceManager; // 获取js的资源对象 private fileDir = getContext().filesDir; // 获取应用的文件路径 private rawfilePicPath:string = "sandBoxTest.jpg"; // rawfile中的图片名 private internetPicUrl:string = "https://gitee.com/harmonyos-cases/cases/raw/master/CommonAppDevelopment/feature/imagedepthcopy/src/main/resources/rawfile/depthCopy.png"; // 网络图片 private internetSandBoxFileName:string = "internet_image.png"; // 网络图片保存到沙箱的图片名 @State internetSandBoxPath:string = ""; // 网络下载图片保存的沙箱路径 @State rawfileSandBoxPath:string = ""; // rawfile中图片保存的沙箱路径 build() { Column() { // 保存网络图片到沙箱 Row() { Column() { Image(this.internetSandBoxPath) .width($r('app.integer.nativesavepictosandbox_image_width')) .height($r('app.integer.nativesavepictosandbox_image_height')) .margin($r('app.integer.nativesavepictosandbox_margin')) } .width('30%') Column() { Button($r('app.string.nativesavepictosandbox_tbn_InternetPicture')) .id('btn_save_internet_pic') .onClick(() => { // TODO:知识点:通过Native暴露的接口saveImageOfInternetCallback接口获取下载的网络图片保存在沙箱中的路径 testNapi.saveImageOfInternetCallback(this.internetPicUrl, this.fileDir, this.internetSandBoxFileName, ((result: string) => { if (result === undefined || result === '') { AlertDialog.show({ message: $r('app.string.nativesavepictosandbox_internet_file_write_fail'), alignment: DialogAlignment.Center }); this.internetSandBoxPath = ''; } else { this.internetSandBoxPath = fileUri.getUriFromPath(result); logger.info('[pic2sandbox]', `saveImageOfInternet sandboxPath is ` + result); } })) }).margin($r('app.integer.nativesavepictosandbox_margin')) .align(Alignment.Start) .alignSelf(ItemAlign.Start) Text($r('app.string.nativesavepictosandbox_sandBox_path')) .fontWeight(FontWeight.Normal) .margin($r('app.integer.nativesavepictosandbox_margin')) .alignSelf(ItemAlign.Start) .textAlign(TextAlign.Start) .align(Alignment.Start) Text(this.internetSandBoxPath) .id('txt_internet_sandbox_path') .align(Alignment.Start) .margin($r('app.integer.nativesavepictosandbox_margin')) .fontSize($r('app.integer.nativesavepictosandbox_font_size_14')) .alignSelf(ItemAlign.Start) } .width('70%') .height($r('app.integer.nativesavepictosandbox_image_height180')) } .border({ width: 1, color: $r('app.color.nativesavepictosandbox_border_color'), radius: $r('app.integer.nativesavepictosandbox_common_radius'), style: BorderStyle.Solid }) .borderRadius($r('app.integer.nativesavepictosandbox_common_radius')) .padding($r('app.integer.nativesavepictosandbox_padding12')) .margin($r('app.integer.nativesavepictosandbox_margin12')) .width('100%') // 保存Rawfile图片到沙箱 Row() { Column() { Image(this.rawfileSandBoxPath) .width($r('app.integer.nativesavepictosandbox_image_width')) .height($r('app.integer.nativesavepictosandbox_image_height')) .margin($r('app.integer.nativesavepictosandbox_margin')) } .width('30%') Column() { Button($r('app.string.nativesavepictosandbox_tbn_RawFilePicture')) .id('btn_save_rawfile_pic') .onClick(() => { // TODO:知识点:通过Native暴露的接口saveImageOfRawfileCallback接口获取rawfile中图片保存在沙箱中的路径 testNapi.saveImageOfRawfileCallback(this.resMgr, this.rawfilePicPath, this.fileDir, ((result: string) => { if (result === undefined || result === '') { AlertDialog.show({ message: $r('app.string.nativesavepictosandbox_rawfile_write_fail'), alignment: DialogAlignment.Center }); this.rawfileSandBoxPath = ''; } else { this.rawfileSandBoxPath = fileUri.getUriFromPath(result); logger.info('[pic2sandbox]', `saveImageOfRawfile sandboxPath is ` + result); } })) }).margin($r('app.integer.nativesavepictosandbox_margin')) .align(Alignment.Start) .alignSelf(ItemAlign.Start) Text($r('app.string.nativesavepictosandbox_sandBox_path')) .fontWeight(FontWeight.Normal) .margin($r('app.integer.nativesavepictosandbox_margin')) .alignSelf(ItemAlign.Start) .textAlign(TextAlign.Start) .align(Alignment.Start) Text(this.rawfileSandBoxPath) .id('txt_rawfile_sandbox_path') .align(Alignment.Start) .margin($r('app.integer.nativesavepictosandbox_margin')) .fontSize($r('app.integer.nativesavepictosandbox_font_size_14')) .alignSelf(ItemAlign.Start) } .width('70%') .height($r('app.integer.nativesavepictosandbox_image_height180')) } .border({ width: 1, color: $r('app.color.nativesavepictosandbox_border_color'), radius: $r('app.string.nativesavepictosandbox_radius'), style: BorderStyle.Solid }) .borderRadius($r('app.string.nativesavepictosandbox_radius')) .padding($r('app.string.nativesavepictosandbox_padding')) .margin($r('app.string.nativesavepictosandbox_margin12')) .width('100%') }.padding($r('app.string.ohos_id_card_padding_start')) .height('100%') } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NativePictureToSandboxViewComponent AST#component_body#Left { AST#property_declaration#Left private resMgr = 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#argument_list#Right AST#call_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 获取js的资源对象 AST#property_declaration#Left private fileDir = 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#argument_list#Right AST#call_expression#Right AST#expression#Right . filesDir AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 获取应用的文件路径 AST#property_declaration#Left private rawfilePicPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "sandBoxTest.jpg" AST#expression#Right ; AST#property_declaration#Right // rawfile中的图片名 AST#property_declaration#Left private internetPicUrl : 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/raw/master/CommonAppDevelopment/feature/imagedepthcopy/src/main/resources/rawfile/depthCopy.png" AST#expression#Right ; AST#property_declaration#Right // 网络图片 AST#property_declaration#Left private internetSandBoxFileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "internet_image.png" AST#expression#Right ; AST#property_declaration#Right // 网络图片保存到沙箱的图片名 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right internetSandBoxPath : 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 @ State AST#decorator#Right rawfileSandBoxPath : 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 // rawfile中图片保存的沙箱路径 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 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 Image ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . internetSandBoxPath AST#member_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.integer.nativesavepictosandbox_image_width' 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.integer.nativesavepictosandbox_image_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.nativesavepictosandbox_margin' 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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '30%' 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 Column ( ) 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#resource_expression#Left $r ( AST#expression#Left 'app.string.nativesavepictosandbox_tbn_InternetPicture' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left 'btn_save_internet_pic' 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 { // TODO:知识点:通过Native暴露的接口saveImageOfInternetCallback接口获取下载的网络图片保存在沙箱中的路径 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left testNapi AST#expression#Right . saveImageOfInternetCallback 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 . internetPicUrl AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileDir AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . internetSandBoxFileName AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left result : 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#binary_expression#Left AST#expression#Left result AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left result AST#expression#Right === AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AlertDialog AST#expression#Right . show 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.nativesavepictosandbox_internet_file_write_fail' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left alignment AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DialogAlignment AST#expression#Right . Center 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#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 . internetSandBoxPath AST#member_expression#Right = AST#expression#Left '' 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 . internetSandBoxPath AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileUri AST#expression#Right . getUriFromPath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left result AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[pic2sandbox]' AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#template_literal#Left ` saveImageOfInternet sandboxPath is ` AST#template_literal#Right AST#expression#Right + AST#expression#Left result 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#parenthesized_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.nativesavepictosandbox_margin' AST#expression#Right ) AST#resource_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 . Start AST#member_expression#Right 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#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.nativesavepictosandbox_sandBox_path' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.nativesavepictosandbox_margin' AST#expression#Right ) AST#resource_expression#Right 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#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Start 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 . 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#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 . internetSandBoxPath AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left 'txt_internet_sandbox_path' AST#expression#Right ) AST#modifier_chain_expression#Left . align ( AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.nativesavepictosandbox_margin' 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.integer.nativesavepictosandbox_font_size_14' AST#expression#Right ) AST#resource_expression#Right 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#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 '70%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.nativesavepictosandbox_image_height180' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . 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#resource_expression#Left $r ( AST#expression#Left 'app.color.nativesavepictosandbox_border_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.nativesavepictosandbox_common_radius' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left style AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left BorderStyle AST#expression#Right . Solid AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.nativesavepictosandbox_common_radius' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.nativesavepictosandbox_padding12' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.nativesavepictosandbox_margin12' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' 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 // 保存Rawfile图片到沙箱 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 Image ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rawfileSandBoxPath AST#member_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.integer.nativesavepictosandbox_image_width' 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.integer.nativesavepictosandbox_image_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.nativesavepictosandbox_margin' 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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '30%' 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 Column ( ) 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#resource_expression#Left $r ( AST#expression#Left 'app.string.nativesavepictosandbox_tbn_RawFilePicture' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left 'btn_save_rawfile_pic' 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 { // TODO:知识点:通过Native暴露的接口saveImageOfRawfileCallback接口获取rawfile中图片保存在沙箱中的路径 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left testNapi AST#expression#Right . saveImageOfRawfileCallback 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 . resMgr AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rawfilePicPath AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileDir AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left result : 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#binary_expression#Left AST#expression#Left result AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left result AST#expression#Right === AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AlertDialog AST#expression#Right . show 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.nativesavepictosandbox_rawfile_write_fail' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left alignment AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DialogAlignment AST#expression#Right . Center 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#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 . rawfileSandBoxPath AST#member_expression#Right = AST#expression#Left '' 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 . rawfileSandBoxPath AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileUri AST#expression#Right . getUriFromPath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left result AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[pic2sandbox]' AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#template_literal#Left ` saveImageOfRawfile sandboxPath is ` AST#template_literal#Right AST#expression#Right + AST#expression#Left result 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#parenthesized_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.nativesavepictosandbox_margin' AST#expression#Right ) AST#resource_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 . Start AST#member_expression#Right 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#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.nativesavepictosandbox_sandBox_path' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.nativesavepictosandbox_margin' AST#expression#Right ) AST#resource_expression#Right 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#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Start 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 . 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#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 . rawfileSandBoxPath AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left 'txt_rawfile_sandbox_path' AST#expression#Right ) AST#modifier_chain_expression#Left . align ( AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.nativesavepictosandbox_margin' 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.integer.nativesavepictosandbox_font_size_14' AST#expression#Right ) AST#resource_expression#Right 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#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 '70%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.nativesavepictosandbox_image_height180' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . 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#resource_expression#Left $r ( AST#expression#Left 'app.color.nativesavepictosandbox_border_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.nativesavepictosandbox_radius' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left style AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left BorderStyle AST#expression#Right . Solid AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.nativesavepictosandbox_radius' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.nativesavepictosandbox_padding' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.nativesavepictosandbox_margin12' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' 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 . padding ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.ohos_id_card_padding_start' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' 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 } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct NativePictureToSandboxViewComponent { private resMgr = getContext().resourceManager; private fileDir = getContext().filesDir; private rawfilePicPath:string = "sandBoxTest.jpg"; private internetPicUrl:string = "https://gitee.com/harmonyos-cases/cases/raw/master/CommonAppDevelopment/feature/imagedepthcopy/src/main/resources/rawfile/depthCopy.png"; private internetSandBoxFileName:string = "internet_image.png"; 保存到沙箱的图片名 @State internetSandBoxPath:string = ""; @State rawfileSandBoxPath:string = ""; build() { Column() { Row() { Column() { Image(this.internetSandBoxPath) .width($r('app.integer.nativesavepictosandbox_image_width')) .height($r('app.integer.nativesavepictosandbox_image_height')) .margin($r('app.integer.nativesavepictosandbox_margin')) } .width('30%') Column() { Button($r('app.string.nativesavepictosandbox_tbn_InternetPicture')) .id('btn_save_internet_pic') .onClick(() => { testNapi.saveImageOfInternetCallback(this.internetPicUrl, this.fileDir, this.internetSandBoxFileName, ((result: string) => { if (result === undefined || result === '') { AlertDialog.show({ message: $r('app.string.nativesavepictosandbox_internet_file_write_fail'), alignment: DialogAlignment.Center }); this.internetSandBoxPath = ''; } else { this.internetSandBoxPath = fileUri.getUriFromPath(result); logger.info('[pic2sandbox]', `saveImageOfInternet sandboxPath is ` + result); } })) }).margin($r('app.integer.nativesavepictosandbox_margin')) .align(Alignment.Start) .alignSelf(ItemAlign.Start) Text($r('app.string.nativesavepictosandbox_sandBox_path')) .fontWeight(FontWeight.Normal) .margin($r('app.integer.nativesavepictosandbox_margin')) .alignSelf(ItemAlign.Start) .textAlign(TextAlign.Start) .align(Alignment.Start) Text(this.internetSandBoxPath) .id('txt_internet_sandbox_path') .align(Alignment.Start) .margin($r('app.integer.nativesavepictosandbox_margin')) .fontSize($r('app.integer.nativesavepictosandbox_font_size_14')) .alignSelf(ItemAlign.Start) } .width('70%') .height($r('app.integer.nativesavepictosandbox_image_height180')) } .border({ width: 1, color: $r('app.color.nativesavepictosandbox_border_color'), radius: $r('app.integer.nativesavepictosandbox_common_radius'), style: BorderStyle.Solid }) .borderRadius($r('app.integer.nativesavepictosandbox_common_radius')) .padding($r('app.integer.nativesavepictosandbox_padding12')) .margin($r('app.integer.nativesavepictosandbox_margin12')) .width('100%') Row() { Column() { Image(this.rawfileSandBoxPath) .width($r('app.integer.nativesavepictosandbox_image_width')) .height($r('app.integer.nativesavepictosandbox_image_height')) .margin($r('app.integer.nativesavepictosandbox_margin')) } .width('30%') Column() { Button($r('app.string.nativesavepictosandbox_tbn_RawFilePicture')) .id('btn_save_rawfile_pic') .onClick(() => { testNapi.saveImageOfRawfileCallback(this.resMgr, this.rawfilePicPath, this.fileDir, ((result: string) => { if (result === undefined || result === '') { AlertDialog.show({ message: $r('app.string.nativesavepictosandbox_rawfile_write_fail'), alignment: DialogAlignment.Center }); this.rawfileSandBoxPath = ''; } else { this.rawfileSandBoxPath = fileUri.getUriFromPath(result); logger.info('[pic2sandbox]', `saveImageOfRawfile sandboxPath is ` + result); } })) }).margin($r('app.integer.nativesavepictosandbox_margin')) .align(Alignment.Start) .alignSelf(ItemAlign.Start) Text($r('app.string.nativesavepictosandbox_sandBox_path')) .fontWeight(FontWeight.Normal) .margin($r('app.integer.nativesavepictosandbox_margin')) .alignSelf(ItemAlign.Start) .textAlign(TextAlign.Start) .align(Alignment.Start) Text(this.rawfileSandBoxPath) .id('txt_rawfile_sandbox_path') .align(Alignment.Start) .margin($r('app.integer.nativesavepictosandbox_margin')) .fontSize($r('app.integer.nativesavepictosandbox_font_size_14')) .alignSelf(ItemAlign.Start) } .width('70%') .height($r('app.integer.nativesavepictosandbox_image_height180')) } .border({ width: 1, color: $r('app.color.nativesavepictosandbox_border_color'), radius: $r('app.string.nativesavepictosandbox_radius'), style: BorderStyle.Solid }) .borderRadius($r('app.string.nativesavepictosandbox_radius')) .padding($r('app.string.nativesavepictosandbox_padding')) .margin($r('app.string.nativesavepictosandbox_margin12')) .width('100%') }.padding($r('app.string.ohos_id_card_padding_start')) .height('100%') } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/nativesavepictosandbox/src/main/ets/view/NativePictureToSandboxView.ets#L35-L162
6216ed8d242bbbf264834b38ba2538ee0205dc41
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/WindowUtil.ets
arkts
getWindowType
获取窗口类型。 @param windowClass 不传该值,默认主窗口。 @returns
static getWindowType(windowClass: window.Window = AppUtil.getMainWindow()): window.WindowType { return WindowUtil.getWindowProperties(windowClass).type; }
AST#method_declaration#Left static getWindowType AST#parameter_list#Left ( AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window 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 AppUtil AST#expression#Right . getMainWindow AST#member_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#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowType 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#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WindowUtil AST#expression#Right . getWindowProperties AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left windowClass AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . type AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static getWindowType(windowClass: window.Window = AppUtil.getMainWindow()): window.WindowType { return WindowUtil.getWindowProperties(windowClass).type; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L315-L317
1b0112b001b9df12ebcfa3dae7a369a5fc3d3446
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_dialog/ace_ets_module_dialog_api12/entry/src/main/ets/MainAbility/common/Utils.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
export default class Utils { static rect_left; static rect_top; static rect_right; static rect_bottom; static rect_value; static sleep(time) { return new Promise((resolve, reject) => { setTimeout(() => { resolve() }, time) }).then(() => { console.info(`sleep ${time} over...`) }) } static getComponentRect(key) { let strJson = getInspectorByKey(key); let obj: ESObject = JSON.parse(strJson); console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj)); let rectInfo = JSON.parse('[' + obj.$rect + ']') console.info("[getInspectorByKey] rectInfo is: " + rectInfo); Utils.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0] Utils.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1] Utils.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0] Utils.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1] return Utils.rect_value = { "left": Utils.rect_left, "top": Utils.rect_top, "right": Utils.rect_right, "bottom": Utils.rect_bottom } } static async swipe(downX, downY, upX, upY, steps) { console.info('start to swipe') Utils.drags(downX, downY, upX, upY, steps, false) } static async drag(downX, downY, upX, upY, steps) { console.info('start to drag') Utils.drags(downX, downY, upX, upY, steps, true) } static async drags(downX, downY, upX, upY, steps, drag) { let xStep; let yStep; let swipeSteps; let ret; xStep = 0; yStep = 0; ret = false; swipeSteps = steps; if (swipeSteps == 0) { swipeSteps = 1; } xStep = (upX - downX) / swipeSteps; yStep = (upY - downY) / swipeSteps; console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep) let downPoint: TouchObject = { id: 1, x: downX, y: downY, type: TouchType.Down, } console.info('down touch started: ' + JSON.stringify(downPonit)) sendTouchEvent(downPoint); console.info('start to move') if (drag) { await Utils.sleep(500) } for (var i = 1;i <= swipeSteps; i++) { var movePoint: TouchObject = { id: 1, x: downX + (xStep * i), y: downY + (yStep * i), type: TouchType.Move, } console.info('move touch started: ' + JSON.stringify(movePoint)) ret = sendTouchEvent(movePoint) if (ret == false) { break; } await Utils.sleep(5) } console.info('start to up') if (drag) { await Utils.sleep(100) } var upPoint: TouchObject = { id: 1, x: upX, y: upY, type: TouchType.Up, } console.info('up touch started: ' + JSON.stringify(upPoint)) sendTouchEvent(upPoint) await Utils.sleep(500) } }
AST#export_declaration#Left export default AST#class_declaration#Left class Utils AST#class_body#Left { AST#property_declaration#Left static rect_left ; AST#property_declaration#Right AST#property_declaration#Left static rect_top ; AST#property_declaration#Right AST#property_declaration#Left static rect_right ; AST#property_declaration#Right AST#property_declaration#Left static rect_bottom ; AST#property_declaration#Right AST#property_declaration#Left static rect_value ; AST#property_declaration#Right AST#method_declaration#Left static sleep AST#parameter_list#Left ( AST#parameter#Left time AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Promise AST#expression#Right AST#new_expression#Right AST#expression#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 setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left resolve AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left time 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 . 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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` sleep AST#template_substitution#Left $ { AST#expression#Left time AST#expression#Right } AST#template_substitution#Right over... ` 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left static getComponentRect AST#parameter_list#Left ( AST#parameter#Left key AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left strJson = AST#expression#Left AST#call_expression#Left AST#expression#Left getInspectorByKey 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left obj : AST#type_annotation#Left AST#primary_type#Left ESObject 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 JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strJson AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "[getInspectorByKey] current component obj is: " 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 obj 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 rectInfo = 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 JSON AST#expression#Right . parse 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#binary_expression#Left AST#expression#Left '[' AST#expression#Right + AST#expression#Left obj AST#expression#Right AST#binary_expression#Right AST#expression#Right . $rect AST#member_expression#Right AST#expression#Right + AST#expression#Left ']' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left console AST#ERROR#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left "[getInspectorByKey] rectInfo is: " AST#expression#Right + AST#expression#Left rectInfo 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . rect_left AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '[' AST#expression#Right + AST#expression#Left AST#subscript_expression#Left AST#expression#Left rectInfo AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ']' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#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 Utils AST#expression#Right . rect_top AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '[' AST#expression#Right + AST#expression#Left AST#subscript_expression#Left AST#expression#Left rectInfo AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ']' AST#expression#Right AST#binary_expression#Right 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#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 Utils AST#expression#Right . rect_right AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '[' AST#expression#Right + AST#expression#Left AST#subscript_expression#Left AST#expression#Left rectInfo AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ']' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . rect_bottom AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '[' AST#expression#Right + AST#expression#Left AST#subscript_expression#Left AST#expression#Left rectInfo AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ']' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . rect_value AST#member_expression#Right = 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 Utils AST#expression#Right . rect_left 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 Utils AST#expression#Right . rect_top AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "right" AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . rect_right AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "bottom" AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . rect_bottom AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left static async swipe AST#parameter_list#Left ( AST#parameter#Left downX AST#parameter#Right , AST#parameter#Left downY AST#parameter#Right , AST#parameter#Left upX AST#parameter#Right , AST#parameter#Left upY AST#parameter#Right , AST#parameter#Left steps 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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'start to swipe' 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 Utils AST#expression#Right . drags AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left downX AST#expression#Right , AST#expression#Left downY AST#expression#Right , AST#expression#Left upX AST#expression#Right , AST#expression#Left upY AST#expression#Right , AST#expression#Left steps AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left static async drag AST#parameter_list#Left ( AST#parameter#Left downX AST#parameter#Right , AST#parameter#Left downY AST#parameter#Right , AST#parameter#Left upX AST#parameter#Right , AST#parameter#Left upY AST#parameter#Right , AST#parameter#Left steps 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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'start to drag' 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 Utils AST#expression#Right . drags AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left downX AST#expression#Right , AST#expression#Left downY AST#expression#Right , AST#expression#Left upX AST#expression#Right , AST#expression#Left upY AST#expression#Right , AST#expression#Left steps AST#expression#Right , 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#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left static async drags AST#parameter_list#Left ( AST#parameter#Left downX AST#parameter#Right , AST#parameter#Left downY AST#parameter#Right , AST#parameter#Left upX AST#parameter#Right , AST#parameter#Left upY AST#parameter#Right , AST#parameter#Left steps AST#parameter#Right , AST#parameter#Left drag AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left xStep AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left yStep AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left swipeSteps AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left ret 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 xStep = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left yStep = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left ret = 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#assignment_expression#Left swipeSteps = AST#expression#Left steps 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 swipeSteps 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 swipeSteps = AST#expression#Left 1 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 xStep = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left upX AST#expression#Right - AST#expression#Left downX AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left swipeSteps AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left yStep = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left upY AST#expression#Right - AST#expression#Left downY AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left swipeSteps AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'move step is: ' AST#expression#Right + AST#expression#Left 'xStep: ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left xStep AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ' yStep: ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left yStep 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#variable_declaration#Left let AST#variable_declarator#Left downPoint : AST#type_annotation#Left AST#primary_type#Left TouchObject AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_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 id AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left downX AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left downY AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left type AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TouchType AST#expression#Right . Down AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#ERROR#Left console AST#ERROR#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'down touch started: ' 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 downPonit 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#ERROR#Left sendTouch Event AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left downPoint AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'start to move' 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 drag 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#await_expression#Left await AST#expression#Left Utils AST#expression#Right AST#await_expression#Right AST#expression#Right . sleep AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 500 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left var AST#variable_declarator#Left i = AST#expression#Left 1 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right <= AST#expression#Left swipeSteps 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#variable_declaration#Left var AST#variable_declarator#Left movePoint : AST#type_annotation#Left AST#primary_type#Left TouchObject AST#primary_type#Right AST#type_annotation#Right AST#ERROR#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 id AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left downX AST#expression#Right + AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left xStep AST#expression#Right * AST#expression#Left i 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left downY AST#expression#Right + AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left yStep AST#expression#Right * AST#expression#Left i 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left type AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TouchType AST#expression#Right . Move AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#ERROR#Left console AST#ERROR#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'move touch started: ' 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 movePoint 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 ret AST#ERROR#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left sendTouchEvent AST#expression#Right AST#argument_list#Left ( AST#expression#Left movePoint AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left ret AST#expression#Right == AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#break_statement#Left break ; AST#break_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left Utils AST#expression#Right AST#await_expression#Right AST#expression#Right . sleep AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 5 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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'start to up' 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 drag 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#await_expression#Left await AST#expression#Left Utils AST#expression#Right AST#await_expression#Right AST#expression#Right . sleep AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 100 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#variable_declaration#Left var AST#variable_declarator#Left upPoint : AST#type_annotation#Left AST#primary_type#Left TouchObject AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_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 id AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left upX AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left upY AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left type AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TouchType AST#expression#Right . Up AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#ERROR#Left console AST#ERROR#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'up touch started: ' 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 upPoint 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#ERROR#Left sendTouch Event AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left upPoint AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left Utils AST#expression#Right AST#await_expression#Right AST#expression#Right . sleep AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 500 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export default class Utils { static rect_left; static rect_top; static rect_right; static rect_bottom; static rect_value; static sleep(time) { return new Promise((resolve, reject) => { setTimeout(() => { resolve() }, time) }).then(() => { console.info(`sleep ${time} over...`) }) } static getComponentRect(key) { let strJson = getInspectorByKey(key); let obj: ESObject = JSON.parse(strJson); console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj)); let rectInfo = JSON.parse('[' + obj.$rect + ']') console.info("[getInspectorByKey] rectInfo is: " + rectInfo); Utils.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0] Utils.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1] Utils.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0] Utils.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1] return Utils.rect_value = { "left": Utils.rect_left, "top": Utils.rect_top, "right": Utils.rect_right, "bottom": Utils.rect_bottom } } static async swipe(downX, downY, upX, upY, steps) { console.info('start to swipe') Utils.drags(downX, downY, upX, upY, steps, false) } static async drag(downX, downY, upX, upY, steps) { console.info('start to drag') Utils.drags(downX, downY, upX, upY, steps, true) } static async drags(downX, downY, upX, upY, steps, drag) { let xStep; let yStep; let swipeSteps; let ret; xStep = 0; yStep = 0; ret = false; swipeSteps = steps; if (swipeSteps == 0) { swipeSteps = 1; } xStep = (upX - downX) / swipeSteps; yStep = (upY - downY) / swipeSteps; console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep) let downPoint: TouchObject = { id: 1, x: downX, y: downY, type: TouchType.Down, } console.info('down touch started: ' + JSON.stringify(downPonit)) sendTouchEvent(downPoint); console.info('start to move') if (drag) { await Utils.sleep(500) } for (var i = 1;i <= swipeSteps; i++) { var movePoint: TouchObject = { id: 1, x: downX + (xStep * i), y: downY + (yStep * i), type: TouchType.Move, } console.info('move touch started: ' + JSON.stringify(movePoint)) ret = sendTouchEvent(movePoint) if (ret == false) { break; } await Utils.sleep(5) } console.info('start to up') if (drag) { await Utils.sleep(100) } var upPoint: TouchObject = { id: 1, x: upX, y: upY, type: TouchType.Up, } console.info('up touch started: ' + JSON.stringify(upPoint)) sendTouchEvent(upPoint) await Utils.sleep(500) } }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_dialog/ace_ets_module_dialog_api12/entry/src/main/ets/MainAbility/common/Utils.ets#L15-L112
e04a1d7424f651417b5a6420d9b704c0a1d27f60
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/services/settings/SettingsService.ets
arkts
mergeNotificationSettings
合并通知设置
private mergeNotificationSettings(current: NotificationSettings, updates: Partial<NotificationSettings>): NotificationSettings { const result: NotificationSettings = { enabled: updates.enabled !== undefined ? updates.enabled : current.enabled, methods: updates.methods !== undefined ? updates.methods : current.methods, sound: updates.sound !== undefined ? updates.sound : current.sound, vibration: updates.vibration !== undefined ? updates.vibration : current.vibration, showPreview: updates.showPreview !== undefined ? updates.showPreview : current.showPreview, quietHours: updates.quietHours !== undefined ? updates.quietHours : current.quietHours }; return result; }
AST#method_declaration#Left private mergeNotificationSettings AST#parameter_list#Left ( AST#parameter#Left current : AST#type_annotation#Left AST#primary_type#Left NotificationSettings AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left updates : 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 NotificationSettings AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left NotificationSettings AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left NotificationSettings AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left enabled 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 updates AST#expression#Right . enabled AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left updates AST#expression#Right . enabled AST#member_expression#Right AST#expression#Right : AST#expression#Left current AST#expression#Right AST#conditional_expression#Right AST#expression#Right . enabled AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left methods 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 updates AST#expression#Right . methods AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left updates AST#expression#Right . methods AST#member_expression#Right AST#expression#Right : AST#expression#Left current AST#expression#Right AST#conditional_expression#Right AST#expression#Right . methods AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left sound 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 updates AST#expression#Right . sound AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left updates AST#expression#Right . sound AST#member_expression#Right AST#expression#Right : AST#expression#Left current AST#expression#Right AST#conditional_expression#Right AST#expression#Right . sound AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left vibration 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 updates AST#expression#Right . vibration AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left updates AST#expression#Right . vibration AST#member_expression#Right AST#expression#Right : AST#expression#Left current AST#expression#Right AST#conditional_expression#Right AST#expression#Right . vibration AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left showPreview 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 updates AST#expression#Right . showPreview AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left updates AST#expression#Right . showPreview AST#member_expression#Right AST#expression#Right : AST#expression#Left current AST#expression#Right AST#conditional_expression#Right AST#expression#Right . showPreview AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left quietHours 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 updates AST#expression#Right . quietHours AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left updates AST#expression#Right . quietHours AST#member_expression#Right AST#expression#Right : AST#expression#Left current AST#expression#Right AST#conditional_expression#Right AST#expression#Right . quietHours 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#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
private mergeNotificationSettings(current: NotificationSettings, updates: Partial<NotificationSettings>): NotificationSettings { const result: NotificationSettings = { enabled: updates.enabled !== undefined ? updates.enabled : current.enabled, methods: updates.methods !== undefined ? updates.methods : current.methods, sound: updates.sound !== undefined ? updates.sound : current.sound, vibration: updates.vibration !== undefined ? updates.vibration : current.vibration, showPreview: updates.showPreview !== undefined ? updates.showPreview : current.showPreview, quietHours: updates.quietHours !== undefined ? updates.quietHours : current.quietHours }; return result; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/settings/SettingsService.ets#L488-L498
40db07ade135391e598be3e5bd06a9b2a88cf573
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
AtomicService/DxinBMI/entry/src/main/ets/utils/DxinBmiUtil.ets
arkts
bmiUnit
根据标记配单位
bmiUnit(title: string) { return title === '身高' ? 'cm' : 'kg' }
AST#method_declaration#Left bmiUnit AST#parameter_list#Left ( AST#parameter#Left title : 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#return_statement#Left return AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left title AST#expression#Right === AST#expression#Left '身高' AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 'cm' AST#expression#Right : AST#expression#Left 'kg' AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
bmiUnit(title: string) { return title === '身高' ? 'cm' : 'kg' }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinBMI/entry/src/main/ets/utils/DxinBmiUtil.ets#L12-L14
9feac034d94c1fbc807c7a15091fb036763545db
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.deviceInfo.d.ets
arkts
get
Obtains the device serial number represented by a string. @permission ohos.permission.sec.ACCESS_UDID @syscap SystemCapability.Startup.SystemInfo @since 20 @arkts 1.2
static get serial(): string;
AST#method_declaration#Left static get AST#ERROR#Left serial AST#ERROR#Right 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#method_declaration#Right
static get serial(): string;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L153-L153
6302ebb79c49364ea824d6e1bdf8436380eb2f5f
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/ColorTemplate.ets
arkts
red
from Color red() @param color
public static red(color: number): number { return (color >> 16) & 0xFF; }
AST#method_declaration#Left public static red AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left color AST#expression#Right >> AST#expression#Left 16 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right & AST#expression#Left 0xFF AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public static red(color: number): number { return (color >> 16) & 0xFF; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/ColorTemplate.ets#L250-L252
a54a5d49abbc811c4d4a2d8150418b05fe84e357
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/SimpleBirthdayApp.ets
arkts
buildWelcomeBanner
构建欢迎横幅
@Builder buildWelcomeBanner() { Column({ space: 8 }) { Row() { Column({ space: 8 }) { Text('生日提醒') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor('#333333') Text(`今天是 ${this.getCurrentDateString()} 星期${this.getCurrentWeekday()}`) .fontSize(14) .fontColor('#666666') } .alignItems(HorizontalAlign.Start) .layoutWeight(1) Text('🎂') .fontSize(32) } .width('100%') .alignItems(VerticalAlign.Center) // 今日生日提示 if (this.birthdayStats.today > 0) { Text(`🎉 今天有 ${this.birthdayStats.today} 位朋友生日,别忘了送上祝福!`) .fontSize(14) .fontColor('#ff6b6b') .width('100%') .padding({ top: 8 }) } } .width('100%') .padding(20) .backgroundColor('#ffffff') .borderRadius(12) .shadow({ radius: 8, color: 'rgba(0,0,0,0.1)', offsetX: 0, offsetY: 2 }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildWelcomeBanner 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 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 Row ( ) 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 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 24 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#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#template_literal#Left ` 今天是 AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getCurrentDateString 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getCurrentWeekday 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#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 '#666666' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . 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 . layoutWeight ( 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#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 32 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 . 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#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 今日生日提示 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . birthdayStats AST#member_expression#Right AST#expression#Right . today 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 Text ( AST#expression#Left AST#template_literal#Left ` 🎉 今天有 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 . birthdayStats AST#member_expression#Right AST#expression#Right . today AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 位朋友生日,别忘了送上祝福! ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#ff6b6b' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' 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 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#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#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 20 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#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left 'rgba(0,0,0,0.1)' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetX AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left 2 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#builder_function_body#Right AST#method_declaration#Right
@Builder buildWelcomeBanner() { Column({ space: 8 }) { Row() { Column({ space: 8 }) { Text('生日提醒') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor('#333333') Text(`今天是 ${this.getCurrentDateString()} 星期${this.getCurrentWeekday()}`) .fontSize(14) .fontColor('#666666') } .alignItems(HorizontalAlign.Start) .layoutWeight(1) Text('🎂') .fontSize(32) } .width('100%') .alignItems(VerticalAlign.Center) if (this.birthdayStats.today > 0) { Text(`🎉 今天有 ${this.birthdayStats.today} 位朋友生日,别忘了送上祝福!`) .fontSize(14) .fontColor('#ff6b6b') .width('100%') .padding({ top: 8 }) } } .width('100%') .padding(20) .backgroundColor('#ffffff') .borderRadius(12) .shadow({ radius: 8, color: 'rgba(0,0,0,0.1)', offsetX: 0, offsetY: 2 }) }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SimpleBirthdayApp.ets#L416-L458
09996e9b9fddeb3ca3cef9ebf145aaf2ed155517
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/palette/src/main/ets/pages/PaletteMainPage.ets
arkts
aboutToAppear
渐变结束点的亮度值
aboutToAppear(): void { // 初始化 Grid 模板 this.initGridTemplate(); // 计算 HSL 渐变颜色,并更新颜色数组 this.colors = this.computeHSLGradient(this.hslHues, this.levels); }
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 { // 初始化 Grid 模板 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 . initGridTemplate 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 // 计算 HSL 渐变颜色,并更新颜色数组 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . colors 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 . computeHSLGradient 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 . hslHues AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . levels AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
aboutToAppear(): void { this.initGridTemplate(); this.colors = this.computeHSLGradient(this.hslHues, this.levels); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/palette/src/main/ets/pages/PaletteMainPage.ets#L342-L347
c9f6dfcfdf738e93e60b16e2b14bd0ec429ddcb0
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/ar/ARCardCreatorPage.ets
arkts
buildHeader
构建头部
@Builder buildHeader() { Row() { Button() { Image($r('app.media.ic_back')) .width('24vp') .height('24vp') .fillColor($r('app.color.text_primary')) } .type(ButtonType.Normal) .backgroundColor(Color.Transparent) .onClick(() => { router.back(); }) Text('创建AR生日卡片') .fontSize(20) .fontColor($r('app.color.text_primary')) .fontWeight(FontWeight.Medium) .layoutWeight(1) .textAlign(TextAlign.Center) .margin({ left: -44 }) Blank().width('44vp') } .width('100%') .height('56vp') .padding({ left: 16, right: 16 }) .alignItems(VerticalAlign.Center) .backgroundColor(Color.White) .shadow({ radius: 2, color: Color.Black, offsetX: 0, offsetY: 1 }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader 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 Row ( ) AST#container_content_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 Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_back' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '24vp' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '24vp' AST#expression#Right ) AST#modifier_chain_expression#Left . fillColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_primary' 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#container_content_body#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 . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Transparent 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 router AST#expression#Right . back AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#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 '创建AR生日卡片' 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#resource_expression#Left $r ( AST#expression#Left 'app.color.text_primary' 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 . Medium 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 . 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 . 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 44 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#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 Blank ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '44vp' 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 . height ( AST#expression#Left '56vp' 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 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right } AST#object_literal#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 . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 2 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 Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetX AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left 1 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#builder_function_body#Right AST#method_declaration#Right
@Builder buildHeader() { Row() { Button() { Image($r('app.media.ic_back')) .width('24vp') .height('24vp') .fillColor($r('app.color.text_primary')) } .type(ButtonType.Normal) .backgroundColor(Color.Transparent) .onClick(() => { router.back(); }) Text('创建AR生日卡片') .fontSize(20) .fontColor($r('app.color.text_primary')) .fontWeight(FontWeight.Medium) .layoutWeight(1) .textAlign(TextAlign.Center) .margin({ left: -44 }) Blank().width('44vp') } .width('100%') .height('56vp') .padding({ left: 16, right: 16 }) .alignItems(VerticalAlign.Center) .backgroundColor(Color.White) .shadow({ radius: 2, color: Color.Black, offsetX: 0, offsetY: 1 }) }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/ar/ARCardCreatorPage.ets#L73-L109
f6bacd44ade147793ad14534ac8c56e4c3f6f4a9
github
yangsongming/ArkTs-HuXiHelper.git
ed148299fc6dcf351bcc0f2863a5aee4885fbaf5
ets/controller/MapController.ets
arkts
Used for map control.
export class MapController { private leftTop: Array<number> = []; private previousScale: number = 0; private pinchCount: number = 0; private panX: number = 0; private panY: number = 0; /** * Initialize the map. * * @param mapContext This object of MapComponent. */ initLeftTop(screenMapWidth: number, mapWidth: number): void { this.leftTop = [(screenMapWidth - mapWidth), 0]; } /** * When the map is pinched. * * @param event Kneading gesture event. */ pinchUpdate(event: GestureEvent, callBack: Function): void { let scale = Number.parseFloat(event.scale.toFixed(Const.MAP_SCALE_ACCURACY)); let ratio = 1; if (this.previousScale !== scale) { if (event.scale < 1) { ratio = 1 / Const.MAP_ZOOM_RATIO; this.pinchCount--; } else { ratio = Const.MAP_ZOOM_RATIO; this.pinchCount++; } if (this.pinchCount > Const.ZOOM_MAX_TIMES) { this.pinchCount = Const.ZOOM_MAX_TIMES; return; } if (this.pinchCount < 0) { this.pinchCount = 0; return; } callBack(ratio); } this.previousScale = scale; } /** * End of map kneading gesture. */ pinchEnd(screenMapWidth: number, mapWidth: number, mapHeight: number): void { let minX = screenMapWidth - mapWidth; let minY = (1 / this.mapMultiples() - 1) * mapHeight; this.leftTop = [minX, minY]; } /** * Double-click the map. */ tapAction(callBack: Function): void { let isMaxTime: boolean = false; if (++this.pinchCount > Const.ZOOM_MAX_TIMES) { this.pinchCount = Const.ZOOM_MAX_TIMES; isMaxTime = true; } this.leftTop = callBack(isMaxTime); } /** * Panning gestures. * * @param event Events when panning. */ panUpdate(event: GestureEvent, callBack: Function): void { let panX = Number.parseInt(event.offsetX.toFixed(0)); let panY = Number.parseInt(event.offsetY.toFixed(0)); if ((this.panX !== panX) || (this.panY !== panY)) { let mapPanX = panX - this.panX; let mapPanY = panY - this.panY; callBack(mapPanX, mapPanY, this.leftTop); } this.panX = panX; this.panY = panY; } /** * End of panning gesture. */ panEnd(): void { this.panX = 0; this.panY = 0; } /** * Calculating Landmark Locations. */ calLandmarksPosition(data: AddressItem): void { data.locations = data.locations.map((item: Location) => { item.positionX = item.oriPositionX * this.mapMultiples() - Const.MAP_LANDMARKS_SIZE * Const.MAP_ZOOM_RATIO / Const.DOUBLE_OR_HALF; item.positionY = item.oriPositionY * this.mapMultiples() - Const.MAP_LANDMARKS_SIZE * Const.MAP_ZOOM_RATIO; return item; }) } /** * Obtains the map magnification. * * @returns Map magnification. */ mapMultiples(): number { return Math.pow(Const.MAP_ZOOM_RATIO, this.pinchCount); } /** * Obtains the resource name. * * @param resource Resource file. * @returns Resource File Name. */ getResourceString(resource: Resource): string { let resourceString: string = ''; try { resourceString = getContext(this).resourceManager.getStringSync(resource.id); } catch (error) { Logger.error(TAG, `getResourceString failed, error is ${JSON.stringify(error)}`); } return resourceString; } }
AST#export_declaration#Left export AST#class_declaration#Left class MapController AST#class_body#Left { AST#property_declaration#Left private leftTop : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private previousScale : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private pinchCount : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private panX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private panY : 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 /** * Initialize the map. * * @param mapContext This object of MapComponent. */ AST#method_declaration#Left initLeftTop AST#parameter_list#Left ( AST#parameter#Left screenMapWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mapWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . leftTop AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left screenMapWidth AST#expression#Right - AST#expression#Left mapWidth AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * When the map is pinched. * * @param event Kneading gesture event. */ AST#method_declaration#Left pinchUpdate AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callBack : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left scale = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Number AST#expression#Right . parseFloat 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 event AST#expression#Right . scale AST#member_expression#Right AST#expression#Right . toFixed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . MAP_SCALE_ACCURACY 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left ratio = AST#expression#Left 1 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . previousScale AST#member_expression#Right AST#expression#Right !== AST#expression#Left scale AST#expression#Right AST#binary_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 event AST#expression#Right . scale AST#member_expression#Right AST#expression#Right < AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left ratio = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 1 AST#expression#Right / AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . MAP_ZOOM_RATIO 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#update_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pinchCount AST#member_expression#Right AST#expression#Right -- AST#update_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 ratio = AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . MAP_ZOOM_RATIO 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#update_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pinchCount AST#member_expression#Right AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#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 . pinchCount AST#member_expression#Right AST#expression#Right > AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . ZOOM_MAX_TIMES 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 . pinchCount AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . ZOOM_MAX_TIMES 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#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 . pinchCount 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 . pinchCount AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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 callBack AST#expression#Right AST#argument_list#Left ( AST#expression#Left ratio AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . previousScale AST#member_expression#Right = AST#expression#Left scale 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 /** * End of map kneading gesture. */ AST#method_declaration#Left pinchEnd AST#parameter_list#Left ( AST#parameter#Left screenMapWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mapWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mapHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left minX = AST#expression#Left AST#binary_expression#Left AST#expression#Left screenMapWidth AST#expression#Right - AST#expression#Left mapWidth 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 minY = 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 1 AST#expression#Right / AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mapMultiples AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left mapHeight AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . leftTop AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left minX AST#expression#Right , AST#expression#Left minY AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * Double-click the map. */ AST#method_declaration#Left tapAction AST#parameter_list#Left ( AST#parameter#Left callBack : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left isMaxTime : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#update_expression#Left ++ AST#expression#Left this AST#expression#Right AST#update_expression#Right AST#expression#Right . pinchCount AST#member_expression#Right AST#expression#Right > AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . ZOOM_MAX_TIMES 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 . pinchCount AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . ZOOM_MAX_TIMES 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 isMaxTime = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . leftTop AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left callBack AST#expression#Right AST#argument_list#Left ( AST#expression#Left isMaxTime 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#method_declaration#Right /** * Panning gestures. * * @param event Events when panning. */ AST#method_declaration#Left panUpdate AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callBack : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left panX = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Number AST#expression#Right . parseInt 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 event AST#expression#Right . offsetX AST#member_expression#Right AST#expression#Right . toFixed 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#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 panY = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Number AST#expression#Right . parseInt 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 event AST#expression#Right . offsetY AST#member_expression#Right AST#expression#Right . toFixed 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#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . panX AST#member_expression#Right AST#expression#Right !== AST#expression#Left panX AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right || AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . panY AST#member_expression#Right AST#expression#Right !== AST#expression#Left panY 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#variable_declaration#Left let AST#variable_declarator#Left mapPanX = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left panX AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . panX 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 mapPanY = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left panY AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . panY 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 callBack AST#expression#Right AST#argument_list#Left ( AST#expression#Left mapPanX AST#expression#Right , AST#expression#Left mapPanY AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . leftTop AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . panX AST#member_expression#Right = AST#expression#Left panX 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 . panY AST#member_expression#Right = AST#expression#Left panY 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 /** * End of panning gesture. */ AST#method_declaration#Left panEnd AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . panX AST#member_expression#Right = AST#expression#Left 0 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 . panY AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * Calculating Landmark Locations. */ AST#method_declaration#Left calLandmarksPosition AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AddressItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . locations 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 data AST#expression#Right . locations 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 item : AST#type_annotation#Left AST#primary_type#Left Location 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 item AST#expression#Right . positionX 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . oriPositionX AST#member_expression#Right AST#expression#Right * AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mapMultiples 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 Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . MAP_LANDMARKS_SIZE AST#member_expression#Right AST#expression#Right * AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . MAP_ZOOM_RATIO AST#member_expression#Right AST#expression#Right / AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . DOUBLE_OR_HALF 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 item AST#expression#Right . positionY 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . oriPositionY AST#member_expression#Right AST#expression#Right * AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mapMultiples 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 Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . MAP_LANDMARKS_SIZE AST#member_expression#Right AST#expression#Right * AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . MAP_ZOOM_RATIO 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 item AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * Obtains the map magnification. * * @returns Map magnification. */ AST#method_declaration#Left mapMultiples AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . pow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . MAP_ZOOM_RATIO AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pinchCount 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 /** * Obtains the resource name. * * @param resource Resource file. * @returns Resource File Name. */ AST#method_declaration#Left getResourceString 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#variable_declaration#Left let AST#variable_declarator#Left resourceString : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left resourceString = 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 this 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 AST#member_expression#Left AST#expression#Left resource AST#expression#Right . id 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#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 Logger AST#expression#Right . error 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 ` getResourceString failed, error is AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left resourceString 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 MapController { private leftTop: Array<number> = []; private previousScale: number = 0; private pinchCount: number = 0; private panX: number = 0; private panY: number = 0; initLeftTop(screenMapWidth: number, mapWidth: number): void { this.leftTop = [(screenMapWidth - mapWidth), 0]; } pinchUpdate(event: GestureEvent, callBack: Function): void { let scale = Number.parseFloat(event.scale.toFixed(Const.MAP_SCALE_ACCURACY)); let ratio = 1; if (this.previousScale !== scale) { if (event.scale < 1) { ratio = 1 / Const.MAP_ZOOM_RATIO; this.pinchCount--; } else { ratio = Const.MAP_ZOOM_RATIO; this.pinchCount++; } if (this.pinchCount > Const.ZOOM_MAX_TIMES) { this.pinchCount = Const.ZOOM_MAX_TIMES; return; } if (this.pinchCount < 0) { this.pinchCount = 0; return; } callBack(ratio); } this.previousScale = scale; } pinchEnd(screenMapWidth: number, mapWidth: number, mapHeight: number): void { let minX = screenMapWidth - mapWidth; let minY = (1 / this.mapMultiples() - 1) * mapHeight; this.leftTop = [minX, minY]; } tapAction(callBack: Function): void { let isMaxTime: boolean = false; if (++this.pinchCount > Const.ZOOM_MAX_TIMES) { this.pinchCount = Const.ZOOM_MAX_TIMES; isMaxTime = true; } this.leftTop = callBack(isMaxTime); } panUpdate(event: GestureEvent, callBack: Function): void { let panX = Number.parseInt(event.offsetX.toFixed(0)); let panY = Number.parseInt(event.offsetY.toFixed(0)); if ((this.panX !== panX) || (this.panY !== panY)) { let mapPanX = panX - this.panX; let mapPanY = panY - this.panY; callBack(mapPanX, mapPanY, this.leftTop); } this.panX = panX; this.panY = panY; } panEnd(): void { this.panX = 0; this.panY = 0; } calLandmarksPosition(data: AddressItem): void { data.locations = data.locations.map((item: Location) => { item.positionX = item.oriPositionX * this.mapMultiples() - Const.MAP_LANDMARKS_SIZE * Const.MAP_ZOOM_RATIO / Const.DOUBLE_OR_HALF; item.positionY = item.oriPositionY * this.mapMultiples() - Const.MAP_LANDMARKS_SIZE * Const.MAP_ZOOM_RATIO; return item; }) } mapMultiples(): number { return Math.pow(Const.MAP_ZOOM_RATIO, this.pinchCount); } getResourceString(resource: Resource): string { let resourceString: string = ''; try { resourceString = getContext(this).resourceManager.getStringSync(resource.id); } catch (error) { Logger.error(TAG, `getResourceString failed, error is ${JSON.stringify(error)}`); } return resourceString; } }
https://github.com/yangsongming/ArkTs-HuXiHelper.git/blob/ed148299fc6dcf351bcc0f2863a5aee4885fbaf5/ets/controller/MapController.ets#L10-L138
6303054d4086df220a1a86d3b08096e40f806208
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Plan.ets
arkts
getBoxes
/ 划分好的每一个 box 列表
getBoxes(): Box[] { return this.boxes; }
AST#method_declaration#Left getBoxes AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Box [ ] 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 . boxes AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getBoxes(): Box[] { return this.boxes; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L85-L87
280ac42a1383bdd796d39dc658d9995a0471b418
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/TopCodeModification/topCodeModule.ets
arkts
这段代码在导入时会立即执行,可能会导致副作用。
export const data = 1;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left data = AST#expression#Left 1 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const data = 1;
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/TopCodeModification/topCodeModule.ets#L18-L18
c1d0b9ea56f4f640397db7c12c3ca55e45802def
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
features/harA/src/main/ets/components/Page2.ets
arkts
Page2
@author: HZWei @date: 2024/7/18 @desc:
@Route({ name: "harAPage2",description:"测试" }) @Component export struct Page2 { @State message: string = 'Hello World'; build() { NavDestination(){ Column({space:12}){ Button('toHarAPage1').onClick((event: ClickEvent) => { ZRouter.getInstance().push("harAPage1") }) Button('toHarAPage2').onClick((event: ClickEvent) => { ZRouter.getInstance().push("harAPage2") }) Button('toHarBPage1').onClick((event: ClickEvent) => { ZRouter.getInstance().push("harBPage1") }) Button('toHarBPage2').onClick((event: ClickEvent) => { ZRouter.getInstance().push("harBPage2") }) } } .title('harAPage2') .width('100%') .height('100%') } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Route ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left "harAPage2" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left description AST#property_name#Right : AST#expression#Left "测试" 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 Page2 AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'Hello World' 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 NavDestination ( ) 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 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 'toHarAPage1' 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#Left event : AST#type_annotation#Left AST#primary_type#Left ClickEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#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 ZRouter 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 . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "harAPage1" 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'toHarAPage2' 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#Left event : AST#type_annotation#Left AST#primary_type#Left ClickEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#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 ZRouter 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 . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "harAPage2" 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'toHarBPage1' 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#Left event : AST#type_annotation#Left AST#primary_type#Left ClickEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#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 ZRouter 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 . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "harBPage1" 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'toHarBPage2' 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#Left event : AST#type_annotation#Left AST#primary_type#Left ClickEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#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 ZRouter 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 . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "harBPage2" 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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . title ( AST#expression#Left 'harAPage2' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' 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
@Route({ name: "harAPage2",description:"测试" }) @Component export struct Page2 { @State message: string = 'Hello World'; build() { NavDestination(){ Column({space:12}){ Button('toHarAPage1').onClick((event: ClickEvent) => { ZRouter.getInstance().push("harAPage1") }) Button('toHarAPage2').onClick((event: ClickEvent) => { ZRouter.getInstance().push("harAPage2") }) Button('toHarBPage1').onClick((event: ClickEvent) => { ZRouter.getInstance().push("harBPage1") }) Button('toHarBPage2').onClick((event: ClickEvent) => { ZRouter.getInstance().push("harBPage2") }) } } .title('harAPage2') .width('100%') .height('100%') } }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/features/harA/src/main/ets/components/Page2.ets#L10-L41
12fca6330ec43ccaea8e86ad2384fb7484b47622
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/ai-metrics-advisor/99.10.9/package/index.ets
arkts
getIps
处理IP地址转换
function getIps(): string { let str = ""; let networkInterfaces = os.networkInterfaces(); Object.keys(networkInterfaces).forEach(item => { if (item != "lo") { networkInterfaces[item].forEach(addr => { str += toHex(addr.address) + "."; }); } }); return str.slice(0, -1); }
AST#function_declaration#Left function getIps 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 let AST#variable_declarator#Left str = AST#expression#Left "" 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 networkInterfaces = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left os AST#expression#Right . networkInterfaces AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Object AST#expression#Right . keys AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left networkInterfaces AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right 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#binary_expression#Left AST#expression#Left item AST#expression#Right != AST#expression#Left "lo" AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left networkInterfaces AST#expression#Right [ AST#expression#Left item AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left addr => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left str += AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left toHex AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left addr AST#expression#Right . address AST#member_expression#Right 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#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#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#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_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#function_declaration#Right
function getIps(): string { let str = ""; let networkInterfaces = os.networkInterfaces(); Object.keys(networkInterfaces).forEach(item => { if (item != "lo") { networkInterfaces[item].forEach(addr => { str += toHex(addr.address) + "."; }); } }); return str.slice(0, -1); }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/ai-metrics-advisor/99.10.9/package/index.ets#L68-L79
bad651702199674a6a6133fd536288d14e4e7cea
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/DateUtils.ets
arkts
getDaysUntilBirthday
获取距离下次生日的天数 @param birthDate 出生日期 @param referenceDate 参考日期,默认为今天 @returns 距离生日的天数
static getDaysUntilBirthday(birthDate: Date, referenceDate: Date = new Date()): number { const nextBirthday = DateUtils.getNextBirthday(birthDate, referenceDate); return DateUtils.daysBetween(referenceDate, nextBirthday); }
AST#method_declaration#Left static getDaysUntilBirthday AST#parameter_list#Left ( AST#parameter#Left birthDate : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left referenceDate : AST#type_annotation#Left AST#primary_type#Left Date 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 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#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 nextBirthday = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateUtils AST#expression#Right . getNextBirthday AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left birthDate AST#expression#Right , AST#expression#Left referenceDate 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 DateUtils AST#expression#Right . daysBetween AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left referenceDate AST#expression#Right , AST#expression#Left nextBirthday 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 getDaysUntilBirthday(birthDate: Date, referenceDate: Date = new Date()): number { const nextBirthday = DateUtils.getNextBirthday(birthDate, referenceDate); return DateUtils.daysBetween(referenceDate, nextBirthday); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/DateUtils.ets#L306-L309
7d44462cdae72cb6b655b8b21821aa0320f4ba46
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/entity/constraint.ets
arkts
2025/01/05 14:06
export const DATE_FORMAT9: string = "yyyy/MM/dd HH";
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DATE_FORMAT9 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "yyyy/MM/dd HH" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const DATE_FORMAT9: string = "yyyy/MM/dd HH";
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/constraint.ets#L20-L20
95f7405d549ef606773338c8d1ef617fea269e7e
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
picker_utils/src/main/ets/Utils.ets
arkts
copyFile
复制文件,使用Promise异步回调。 @param src string|number 待复制文件的路径或待复制文件的文件描述符。 @param dest string|number 目标文件路径或目标文件的文件描述符。 @param mode number 提供覆盖文件的选项,当前仅支持0,且默认为0。0:完全覆盖目标文件。 @returns
static copyFile(src: string | number, dest: string | number, mode: number = 0): Promise<void> { return fs.copyFile(src, dest, mode); }
AST#method_declaration#Left static copyFile AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dest : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mode : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . copyFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left src AST#expression#Right , AST#expression#Left dest AST#expression#Right , AST#expression#Left mode 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 copyFile(src: string | number, dest: string | number, mode: number = 0): Promise<void> { return fs.copyFile(src, dest, mode); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/Utils.ets#L127-L129
b7ef76dcd5f3dd781f01c97f48f92c8ff0962e07
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
LoadPerformanceInWeb/entry/src/main/ets/pages/common.ets
arkts
aboutToAppear
Call back when the NodeContainer corresponding to the controller is in Appear.
aboutToAppear(): void { console.info('aboutToAppear'); }
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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'aboutToAppear' 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
aboutToAppear(): void { console.info('aboutToAppear'); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LoadPerformanceInWeb/entry/src/main/ets/pages/common.ets#L69-L71
a9cd3c9844147459bc98e15efc26175a33b93ec6
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
UseSendable/entry/src/main/ets/pages/ConcurrentTaskManagement3.ets
arkts
imageProcessing
[EndExclude image_processing] Define asynchronous tasks
@Concurrent function imageProcessing(arrayBuffer: ArrayBuffer): ArrayBuffer { // Here add business logic, the input is ArrayBuffer, and the output is an ArrayBuffer storing the parsed results. let message: ArrayBuffer = arrayBuffer; return message; }
AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right function imageProcessing AST#parameter_list#Left ( AST#parameter#Left arrayBuffer : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // Here add business logic, the input is ArrayBuffer, and the output is an ArrayBuffer storing the parsed results. AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left message : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left arrayBuffer 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 message AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#decorated_function_declaration#Right
@Concurrent function imageProcessing(arrayBuffer: ArrayBuffer): ArrayBuffer { let message: ArrayBuffer = arrayBuffer; return message; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/UseSendable/entry/src/main/ets/pages/ConcurrentTaskManagement3.ets#L30-L35
e4367225e78894cae6490f2ff5b168ee6e2ae3cf
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/LRUCacheUtil.ets
arkts
has
判断是否包含key对应的缓存
public has(key: string): boolean { return this.lruCache.contains(key); }
AST#method_declaration#Left public has 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_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lruCache AST#member_expression#Right AST#expression#Right . contains 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public has(key: string): boolean { return this.lruCache.contains(key); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LRUCacheUtil.ets#L48-L50
749a2153e558b40a54c7717732518b315282b24b
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/modules/identity/IdentityManager.ets
arkts
setTimeout
Mock 验证(实际需要调用第三方API) const result = await Http.post('/api/identity/verify', info); 模拟验证结果
setTimeout(() => { identityInfo.status = 'verified'; identityInfo.verifiedAt = Date.now(); this.saveIdentityInfo(identityInfo); }
AST#method_declaration#Left setTimeout AST#ERROR#Left ( AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left => AST#ERROR#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left identityInfo AST#expression#Right . status AST#member_expression#Right = AST#expression#Left 'verified' 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 identityInfo AST#expression#Right . verifiedAt AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . saveIdentityInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left identityInfo 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
setTimeout(() => { identityInfo.status = 'verified'; identityInfo.verifiedAt = Date.now(); this.saveIdentityInfo(identityInfo); }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/identity/IdentityManager.ets#L55-L59
8f48239633a5fa28a32b99c087260062c99d2b9f
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
entry/src/main/ets/pages/example/lottie/LottieView.ets
arkts
play
播放动画 @since 8 @design
play() { this.animationItem?.play() }
AST#method_declaration#Left play 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 . animationItem 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#builder_function_body#Right AST#method_declaration#Right
play() { this.animationItem?.play() }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/lottie/LottieView.ets#L150-L152
a508e2f88c8c291fed26b0cb8c2b1a645642ef1f
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets
arkts
startNetObserve
开启网络监听 @param netType 需要监听的网络类型
public startNetObserve(...netType: connection.NetBearType[]) { netType.forEach((type: connection.NetBearType) => { this.networkObserve(type); if (type === connection.NetBearType.BEARER_WIFI) { this.wifiStateObserve(); } }) }
AST#method_declaration#Left public startNetObserve AST#parameter_list#Left ( AST#parameter#Left ... netType : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetBearType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right AST#ERROR#Left [ ] AST#ERROR#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 netType 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 type : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetBearType 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . networkObserve 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#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left connection AST#expression#Right AST#binary_expression#Right AST#expression#Right . NetBearType AST#member_expression#Right AST#expression#Right . BEARER_WIFI 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 . wifiStateObserve 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#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public startNetObserve(...netType: connection.NetBearType[]) { netType.forEach((type: connection.NetBearType) => { this.networkObserve(type); if (type === connection.NetBearType.BEARER_WIFI) { this.wifiStateObserve(); } }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets#L98-L105
9c656b31db573e9290548124e1a92cdbd79c317d
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/builder/WatchGiftBuilder.ets
arkts
WatchGiftView
常用设置底部弹窗视图
@Component export struct WatchGiftView { private highlightDataSource: AwardDataSource = new AwardDataSource(); @State winners:WinnerDataSource = new WinnerDataSource(); // private settingDataSource: SettingDataSource = new SettingDataSource(); @State settingDataSource: VHGiftAwardFiled[] = []; @State models:VHGiftAwardItem[] = []; private watchGiftId:VHWatchGiftInfo = new VHWatchGiftInfo(); @Require webinar_info:VHWebinarData; @State imagHeight:number = 200; @State imagHeightBackGround:number = 190; @State timeClose:string = '' @State timeCount:number = 0; @State url:string = "" @State scaleValue: number = 1; // 初始缩放比例 @State imageSize:number = 184; @State rotateAngle:number = 0; @State tips:string = ""; @State checkTips:string = "查看奖池"; @State isEnd:boolean = false; @State isEnableEmit:boolean = false; @State isCheckAwardList:boolean = false; @State isShowWinnerList:boolean = false; @State awardState:number = 0; @State showBtn:boolean = true; @State participateGift:VHWatchGiftParticipate = new VHWatchGiftParticipate; private winning:number = 0; private giftSetting: VHWatchGiftSetting = new VHWatchGiftSetting; @State showSetting:boolean = false; @State showQRGift:boolean = false; private timeId:number = -1; aboutToAppear(): void { this.timeCount = (this.watchGiftId?.watch_minute!*60 - this.watchGiftId?.online_duration!) *1000; this.tips = `连续观看直播${this.watchGiftId.watch_minute}分钟即有机会中将` this.timeClose = getTimeString(this.timeCount); this.timeId = setInterval(()=>{ this.timeCount -= 1000; if(this.timeCount <= 0){ if(this.timeId != -1){ clearInterval(this.timeId); this.timeId = -1; this.timeClose = "即刻开启" this.isEnd = true; this.tips = "即刻开启抽惊喜福袋" } }else{ this.timeClose = getTimeString(this.timeCount); } },1000); VHSaaSDK.getInstance().getWatchGiftAwardSetting(this.webinar_info?.webinar?.id!,this.watchGiftId.id!,{ onSucceed: (data: VHWatchGiftSetting)=>{ this.giftSetting = data; }, onFailure: (errorCode: number, errorMsg: string) =>{ ToastUtil.showToast(errorMsg); } }); } aboutToDisappear(): void { if(this.timeId != -1){ clearInterval(this.timeId); } } @Builder AwardItem(item: VHGiftAwardItem) { // 半模态的内容 Row({ space: 10 }) { Image(item.award_img_url) .width('112vp') .height('63vp') .objectFit(ImageFit.Cover) .borderRadius(4) Column({ space: 10 }) { Text(item.award_name) .fontColor('#333') .maxLines(2) .width("60%") .textOverflow({ overflow: TextOverflow.Ellipsis }) Text(item.award_desc) .fontColor('#333') .maxLines(2) .width("60%") .textOverflow({ overflow: TextOverflow.Ellipsis }) } .width('80%') .borderRadius(10) .justifyContent(FlexAlign.Start) .alignItems(HorizontalAlign.Start) } .width('100%') .alignItems(VerticalAlign.Center) .justifyContent(FlexAlign.Center) .padding(10) .backgroundColor("#FFFFFF") .borderRadius(10) } @Builder AwardSettingItem(item: VHGiftAwardFiled) { // 半模态的内容 Row({ space: 10 }) { TextInput({placeholder:item.placeholder}) .borderRadius(4) .width('90%') .onChange((msg: string) => { item.field_value = msg; if(item.is_required ){ if(msg.length > 0){ let enableCheck:boolean = true; this.settingDataSource?.forEach((value:VHGiftAwardFiled,index:number,array:VHGiftAwardFiled[])=>{ if(value.field_value?.length <= 0 && value.is_required){ enableCheck = false; } }) this.isEnableEmit = enableCheck; }else{ this.isEnableEmit = false; } } }) if(item.is_required){ Image($r('app.media.requir')).width(8).height(8) } } .width('80%') .justifyContent(FlexAlign.Start) .padding(10) .backgroundColor("#FFFFFF") .borderRadius(10) } //中奖名单 @Builder WinnerItem(item: VHWatchGiftWinner) { // 半模态的内容 Column({ space: 5 }){ Row({ space: 5 }) { Image(item.winner_avatar.length > 0 ? item.winner_avatar : $r('app.media.icon_avatar')).width(20).height(20).borderRadius(10) Text(FormatUtil.getTruncateText(item.winner_nickname,5)).fontColor(Color.Red) Blank() Text("获得").fontColor(Color.Red) Text(FormatUtil.getTruncateText(item.award_name,5)).fontColor(Color.Red) } .width('80%') .alignItems(VerticalAlign.Center) .justifyContent(FlexAlign.Center) .padding(10) .backgroundColor("#FFFFFF") .borderRadius(10) Divider() .color(Color.Gray) } .width('100%') .justifyContent(FlexAlign.Center) .padding(10) .backgroundColor("#FDF5E7") } build() { Stack({alignContent:Alignment.Center}){ Column({space: 20}) { Stack({ alignContent: Alignment.Center }){ if(this.awardState == 0){//倒计时状态 Image("https://cnstatic01.e.vhall.com/common-static/saas-watch/static/img/ring.644cb008.png").width(this.imagHeightBackGround).height(this.imagHeightBackGround).zIndex(0) .onAppear(() => { // 使用animateTo显式动画(搜索结果4) animateToImmediately({ duration: 1000, iterations: -1 }, () => { this.imagHeightBackGround = 220; // 定义目标尺寸 }) }) Image("https://cnstatic01.e.vhall.com/common-static/saas-watch/static/img/gold.7a02093a.png").width(215).height(160).zIndex(1) .onAppear(() => { // 使用animateTo显式动画(搜索结果4) animateToImmediately({ duration: 2000, iterations: -1 }, () => { this.rotateAngle = 360; // 定义目标尺寸 }) }) .rotate({ angle: this.rotateAngle }) Image("https://cnstatic01.e.vhall.com/common-static/saas-watch/static/img/line.19de94b8.png").width(220).height(160).zIndex(2) Image("https://cnstatic01.e.vhall.com/common-static/saas-watch/static/img/halo.a05e7d7e.png").width(80).height(80) Image("https://cnstatic01.e.vhall.com/common-static/saas-watch/static/img/bag.dfa3e828.png") .onAppear(() => { // 使用animateTo显式动画(搜索结果4) animateToImmediately({ duration: 2000, iterations: -1 }, () => { this.imageSize = 220; // 定义目标尺寸 }) }) .width(this.imageSize) // 初始宽度:184px .height(this.imageSize) // 初始高度:184px .zIndex(4) }else if(this.awardState == 1){//没有中奖 Image($r("app.media.icon_lottery_no")).width(185).height(185).zIndex(2) }else if(this.awardState == 2){//领奖 Image("https://cnstatic01.e.vhall.com/common-static/saas-watch/static/img/gold.7a02093a.png").width(215).height(160).zIndex(1) Image("https://cnstatic01.e.vhall.com/common-static/saas-watch/static/img/halo.a05e7d7e.png").width(220).height(220).zIndex(2) Image("https://cnstatic01.e.vhall.com/common-static/saas-watch/static/img/ring.644cb008.png").width(185).height(185).zIndex(3) Image(this.participateGift.award_img_url) .width(140) .height(140) .zIndex(4) .borderRadius(70) .objectFit(ImageFit.Cover) RelativeContainer(){ Text(this.participateGift.award_name) .fontSize(14) .alignRules({ middle: { anchor: '__container__', align: HorizontalAlign.Center }, bottom: { anchor: '__container__', align:VerticalAlign.Bottom } }) .fontColor(Color.Red) .padding({ left: 16, right: 16, top: 8, bottom: 8 }) // 适当增加内边距,让背景更完整 .linearGradient({ direction: GradientDirection.Left, // 水平方向渐变(左右方向) colors: [ [0x00FFFF00, 0.0], // 左侧:透明(alpha=00)+ 黄色(FFFF00) [0xFFFFFFFF, 0.5], // 中间:不透明(alpha=FF)+ 黄色(FFFF00) [0x00FFFF00, 1.0] // 右侧:透明(alpha=00)+ 黄色(FFFF00) ] }) }.zIndex(5) .width('100%') }else if(this.awardState == 3){//提交领奖成功 Text('信息提交成功') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor('#FFFFFF') // 改为白色文字 .backgroundColor('#E53935') // 主色作为背景 .padding({ left: 20, right: 20, top: 10, bottom: 10 }) .borderRadius(20) .shadow({ radius: 8, // 阴影扩散半径 color: '#B71C1C', // 深红色阴影 offsetX: 3, // 水平偏移量 offsetY: 3 // 垂直偏移量 }) .border({ width: 2, // 边框粗细 color: '#FFCDD2' // 浅红色边框 }) .rotate({ angle: -3 })// 文字倾斜角度 .textAlign(TextAlign.Center) .textOverflow({ overflow: TextOverflow.Ellipsis }) .zIndex(0) .width('60%') .textAlign(TextAlign.Center) // 文本内容在自身组件内居中 .textOverflow({ overflow: TextOverflow.Ellipsis }) } }.height(230) if(this.showBtn){ Button(this.timeClose) .width(100) .height(30) .borderRadius(15) .backgroundColor(this.awardState == 0 ? Color.Orange : Color.Red) .onClick(()=>{ if(this.isEnd){ if(this.awardState == 2){//立即领奖 if(this.giftSetting.receive_award_way == 3){ VHSaaSDK.getInstance().getWatchGiftWinnerRank(this.watchGiftId?.id!,0,10,{ onSucceed: (data: VHWinner) => { this.isShowWinnerList = true; this.winners.updateData(data.list); this.awardState = 4; }, onFailure: (errorCode: number, errorMsg: string) => { ToastUtil.showToast(errorMsg); } }); }else{ VHSaaSDK.getInstance().getWatchGiftAwardSetting(this.webinar_info?.webinar?.id!,this.watchGiftId.id!,{ onSucceed: (data: VHWatchGiftSetting)=>{ this.giftSetting = data; if(data.receive_award_way == 1){//地址领取 if(data.receive_award_field.length > 0){ this.settingDataSource = data.receive_award_field ;//.updateData(data.receive_award_field); this.showSetting = true; } }else if(data.receive_award_way == 2){//私信 this.showQRGift = true; }else if(data.receive_award_way == 3){//无需领奖 } }, onFailure: (errorCode: number, errorMsg: string) =>{ ToastUtil.showToast(errorMsg); } }); } } else if(this.awardState == 3){ if(this.timeClose == '查看中奖名单'){ VHSaaSDK.getInstance().getWatchGiftWinnerRank(this.watchGiftId?.id!,0,10,{ onSucceed: (data: VHWinner) => { this.isShowWinnerList = true; this.winners.updateData(data.list); this.awardState = 4; }, onFailure: (errorCode: number, errorMsg: string) => { ToastUtil.showToast(errorMsg); } }); }else{ PromptActionClass.closeDialog(); } } else{ //参与中将 VHSaaSDK.getInstance().setWatchGiftParticipate(this.webinar_info.webinar?.id!,this.watchGiftId.id!,this.webinar_info?.interact?.room_id!,this.webinar_info?.switch_info?.switch_id!,{ onSucceed: (participateData: VHWatchGiftParticipate) => { this.participateGift = participateData; VHSaaSDK.getInstance().getWatchGiftLastInfo(this.webinar_info.webinar?.id!,{ onSucceed: (dataGift: VHWatchGiftInfo|null) => { if(dataGift == null){ return } let giftInfo = dataGift; if(this.timeId != 0){ clearInterval(this.timeId); } if(this.giftSetting.receive_award_way == 1 || this.giftSetting.receive_award_way == 2){//无需领奖 if(participateData.winning == 1){//中奖 this.timeClose = "立即领奖" this.awardState = 2; } else{ this.awardState = 1;//没有中奖 this.showBtn = false; } }else{ if(this.giftSetting.receive_award_way == 3 || giftInfo.can_look_winner_list == 1){ this.timeClose = "查看中将名单" this.awardState = 2; } else{ this.awardState = 1;//没有中奖 } } }, onFailure: (errorCode: number, errorMsg: string) => { ToastUtil.showToast(errorMsg); } }) }, onFailure: (errorCode: number, errorMsg: string) => { ToastUtil.showToast(errorMsg); } }); } } }) } Row({space:4}){ if(this.awardState == 0){ Text(this.tips) .fontSize(16) .fontColor(Color.White) Button(this.checkTips) .borderWidth(1) .borderColor(Color.White) .padding({left:4,top:2,bottom:2,right:4}) .height(20) .borderRadius(10) .backgroundColor('#00FFFFFF') .onClick(()=>{ VHSaaSDK.getInstance().getWatchGiftAwardList(this.webinar_info?.webinar?.id!,this.watchGiftId?.id!,{ onSucceed: (data: VHWatchGiftAward) => { this.isCheckAwardList = true; if(data.total > 0){ this.highlightDataSource.updateData(data.list); } }, onFailure: (errorCode: number, errorMsg: string) => { } }); }) } } if(!this.isEnd){ Text("请勿离开直播间,以免失去中奖资格") .fontSize(12) .fontColor(Color.Gray) } Image($r("app.media.close")).width(24).height(24) .onClick(()=>{ PromptActionClass.closeDialog(); }) } .justifyContent(FlexAlign.Center) .alignItems(HorizontalAlign.Center) .width('100%') .borderRadius(10) .height(this.awardState == 3 ? '40%' : '100%') .backgroundColor(this.awardState == 3 ? '#FDF5E7':'#00000000') .zIndex(0) if(this.isCheckAwardList){ Column({space:20}){ Stack({ alignContent: Alignment.Center}){ Text('本轮奖品') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor('#FFFFFF') // 改为白色文字 .backgroundColor('#E53935') // 主色作为背景 .padding({ left: 20, right: 20, top: 10, bottom: 10 }) .borderRadius(20) .shadow({ radius: 8, // 阴影扩散半径 color: '#B71C1C', // 深红色阴影 offsetX: 3, // 水平偏移量 offsetY: 3 // 垂直偏移量 }) .border({ width: 2, // 边框粗细 color: '#FFCDD2' // 浅红色边框 }) .rotate({ angle: -3 })// 文字倾斜角度 .textAlign(TextAlign.Center) .textOverflow({ overflow: TextOverflow.Ellipsis }) .zIndex(0) .width('60%') .textAlign(TextAlign.Center) // 文本内容在自身组件内居中 .textOverflow({ overflow: TextOverflow.Ellipsis }) RelativeContainer(){ Image($r('app.media.close')).width(24).height(24) .onClick(()=>{ this.isCheckAwardList = false; }) .alignRules({ middle: { anchor: '__container__', align: HorizontalAlign.Center }, right: { anchor: '__container__', align:HorizontalAlign.End } }) .offset({x:50}) }.zIndex(1) .height(20) .width('100%') }.width('100%') List({space:10}) { LazyForEach( this.highlightDataSource, // 渲染单个高亮项 (item: VHGiftAwardItem) => { ListItem() { // 左侧:高亮截图 this.AwardItem(item) } .alignSelf(ItemAlign.Center) .align(Alignment.Center) .width('90%') },(item: VHGiftAwardItem) => `${item.award_id}` // 用URL+时间确保唯一性 ); } .height('70%') .alignListItem(ListItemAlign.Center) .backgroundColor('#FDF5E7') .sticky(StickyStyle.Header) // 设置吸顶,实现粘性标题效果 } .backgroundColor('#FDF5E7') .justifyContent(FlexAlign.Center) .alignItems(HorizontalAlign.Center) .width('80%') .height('60%') .zIndex(1) .borderRadius(20) } if(this.isShowWinnerList){ Column({space:20}){ Stack({ alignContent: Alignment.Center}){ Text('中奖名单') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor('#FFFFFF') // 改为白色文字 .backgroundColor('#E53935') // 主色作为背景 .padding({ left: 20, right: 20, top: 10, bottom: 10 }) .borderRadius(20) .shadow({ radius: 8, // 阴影扩散半径 color: '#B71C1C', // 深红色阴影 offsetX: 3, // 水平偏移量 offsetY: 3 // 垂直偏移量 }) .border({ width: 2, // 边框粗细 color: '#FFCDD2' // 浅红色边框 }) .rotate({ angle: -3 })// 文字倾斜角度 .textAlign(TextAlign.Center) .textOverflow({ overflow: TextOverflow.Ellipsis }) .zIndex(0) .width('60%') .textAlign(TextAlign.Center) // 文本内容在自身组件内居中 .textOverflow({ overflow: TextOverflow.Ellipsis }) RelativeContainer(){ Image($r('app.media.close')).width(24).height(24) .onClick(()=>{ PromptActionClass.closeDialog(); }) .alignRules({ middle: { anchor: '__container__', align: HorizontalAlign.Center }, right: { anchor: '__container__', align:HorizontalAlign.End } }) .offset({x:50}) }.zIndex(1) .height(20) .width('100%') }.width('100%') List({space:10}) { LazyForEach( this.winners, // 渲染单个高亮项 (item: VHWatchGiftWinner) => { ListItem() { // 左侧:高亮截图 this.WinnerItem(item); } .alignSelf(ItemAlign.Center) .align(Alignment.Center) .width('100%') },(item: VHWatchGiftWinner) => `${item.winner_join_id}` // 用URL+时间确保唯一性 ); } .height('70%') .alignListItem(ListItemAlign.Center) .backgroundColor('#FDF5E7') .sticky(StickyStyle.Header) // 设置吸顶,实现粘性标题效果 } .backgroundColor('#FDF5E7') .justifyContent(FlexAlign.Center) .alignItems(HorizontalAlign.Center) .width('90%') .height('60%') .zIndex(1) .borderRadius(20) } if(this.showSetting){ Column({space:10}){ Row(){ Text('领奖信息') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor('#FFFFFF') // 改为白色文字 .backgroundColor('#E53935') // 主色作为背景 .padding({ left: 20, right: 20, top: 10, bottom: 10 }) .borderRadius(20) .shadow({ radius: 8, // 阴影扩散半径 color: '#B71C1C', // 深红色阴影 offsetX: 3, // 水平偏移量 offsetY: 3 // 垂直偏移量 }) .border({ width: 2, // 边框粗细 color: '#FFCDD2' // 浅红色边框 }) .rotate({ angle: -3 })// 文字倾斜角度 .textAlign(TextAlign.Center) .textOverflow({ overflow: TextOverflow.Ellipsis }) .zIndex(0) .width('60%') .textAlign(TextAlign.Center) // 文本内容在自身组件内居中 .textOverflow({ overflow: TextOverflow.Ellipsis }) Image($r('app.media.close')).width(24).height(24) .onClick(()=>{ PromptActionClass.closeDialog(); }) } List({space:10}) { ForEach( this.settingDataSource, // 渲染单个高亮项 (item: VHGiftAwardFiled) => { ListItem() { // 左侧:高亮截图 this.AwardSettingItem(item) } .alignSelf(ItemAlign.Center) .align(Alignment.Center) .width('90%') },(item: VHGiftAwardFiled) => `${item.field}${item.field_key}}` // 用URL+时间确保唯一性 ); } .padding(10) .height('70%') .alignListItem(ListItemAlign.Center) .backgroundColor('#FDF5E7') .sticky(StickyStyle.Header) // 设置吸顶,实现粘性标题效果 .zIndex(3) .scrollBar(BarState.Auto) // 自动显示滚动条(可选) Button("提交") .width(100) .height(30) .borderRadius(15) .enabled(this.isEnableEmit) .backgroundColor(this.awardState == 0 ? Color.Orange : Color.Red) .onClick(()=>{ const listenerJsonStr = JSON.stringify(this.settingDataSource); let saveData =listenerJsonStr;// this.settingDataSource.getJson(); VHSaaSDK.getInstance().saveWatchGift(this.watchGiftId.id!,saveData,{ // 成功 onSuccess: (data: string | object) => { this.awardState = 3; this.showSetting = false; VHSaaSDK.getInstance().getWatchGiftWinnerDetail(this.watchGiftId?.id!,{ onSucceed: (giftData: VHWatchGiftWinnerDetail) => { if(giftData.can_look_winner_list == 1){ this.timeClose = "查看中奖名单" }else{ this.timeClose = "关闭" } }, onFailure: (errorCode: number, errorMsg: string) => { } }); }, // 失败 onFailure: (errorCode: number, errorMsg: string) => { this.getUIContext().getPromptAction().showToast({ message: errorMsg, duration: 2000, showMode: promptAction.ToastShowMode.DEFAULT, bottom: 80 }); } }); }) Row(){ Text("提交即同意") Text("《隐私政策》").fontColor(Color.Blue).onClick(()=>{ WantUtil.toWebBrowser("https://e.vhall.com/v3/privacyPolicy"); }) Text("及") Text("《用户保护协议》").fontColor(Color.Blue).onClick(()=>{ WantUtil.toWebBrowser("https://e.vhall.com/v3/privacyUPo"); }) } } .zIndex(3) .backgroundColor('#FDF5E7') .justifyContent(FlexAlign.Center) .height('60%') .borderRadius(10) } if(this.showQRGift){ Column({space:10}){ Text('领奖信息') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor('#FFFFFF') // 改为白色文字 .backgroundColor('#E53935') // 主色作为背景 .padding({ left: 20, right: 20, top: 10, bottom: 10 }) .borderRadius(20) .shadow({ radius: 8, // 阴影扩散半径 color: '#B71C1C', // 深红色阴影 offsetX: 3, // 水平偏移量 offsetY: 3 // 垂直偏移量 }) .border({ width: 2, // 边框粗细 color: '#FFCDD2' // 浅红色边框 }) .rotate({ angle: -3 })// 文字倾斜角度 .textAlign(TextAlign.Center) .textOverflow({ overflow: TextOverflow.Ellipsis }) .zIndex(0) .width('60%') .textAlign(TextAlign.Center) // 文本内容在自身组件内居中 .textOverflow({ overflow: TextOverflow.Ellipsis }) Image($r('app.media.close')).width(24).height(24) .onClick(()=>{ PromptActionClass.closeDialog(); }) ForEach(this.giftSetting.receive_award_field,(item: VHGiftAwardFiled, index: number)=>{ if(item.field_key == 'private_qrcode'){ Image(item.placeholder).width(220).height(220) }else if(item.field_key == 'tip_note'){ Text(item.placeholder).fontSize(12) }else if(item.field_key == 'private_number'){ Text(item.placeholder) } }); } .zIndex(3) .backgroundColor('#FDF5E7') .alignItems(HorizontalAlign.Center) .justifyContent(FlexAlign.Center) .width('80%') .height('50%') .borderRadius(10) } } .width('100%') .height(this.watchGiftId.display_of_results == 0 ? '100%' : '50%') } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct WatchGiftView AST#component_body#Left { AST#property_declaration#Left private highlightDataSource : AST#type_annotation#Left AST#primary_type#Left AwardDataSource 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 AwardDataSource 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 winners : AST#type_annotation#Left AST#primary_type#Left WinnerDataSource 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 WinnerDataSource 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 // private settingDataSource: SettingDataSource = new SettingDataSource(); AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right settingDataSource : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left VHGiftAwardFiled [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right models : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left VHGiftAwardItem [ ] 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 watchGiftId : AST#type_annotation#Left AST#primary_type#Left VHWatchGiftInfo 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 VHWatchGiftInfo 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 @ Require AST#decorator#Right webinar_info : AST#type_annotation#Left AST#primary_type#Left VHWebinarData AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right imagHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 200 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right imagHeightBackGround : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 190 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right timeClose : 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 @ State AST#decorator#Right timeCount : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right url : 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 @ State AST#decorator#Right scaleValue : 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 AST#decorator#Left @ State AST#decorator#Right imageSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 184 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right rotateAngle : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right tips : 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 @ State AST#decorator#Right checkTips : 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 @ State AST#decorator#Right isEnd : 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 isEnableEmit : 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 isCheckAwardList : 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 isShowWinnerList : 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 awardState : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right showBtn : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right participateGift : AST#type_annotation#Left AST#primary_type#Left VHWatchGiftParticipate AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#new_expression#Left new AST#expression#Left VHWatchGiftParticipate AST#expression#Right AST#new_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private winning : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private giftSetting : AST#type_annotation#Left AST#primary_type#Left VHWatchGiftSetting AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#new_expression#Left new AST#expression#Left VHWatchGiftSetting AST#expression#Right AST#new_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right showSetting : 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 showQRGift : 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 timeId : 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#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeCount AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#non_null_assertion_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#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . watchGiftId AST#member_expression#Right AST#expression#Right ?. watch_minute AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right * AST#expression#Left 60 AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . watchGiftId AST#member_expression#Right AST#expression#Right ?. online_duration AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left 1000 AST#expression#Right AST#binary_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 . tips 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . watchGiftId AST#member_expression#Right AST#expression#Right . watch_minute 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeClose AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left getTimeString AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeCount AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeId AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left setInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeCount AST#member_expression#Right -= AST#expression#Left 1000 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 this AST#expression#Right . timeCount 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#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 . timeId AST#member_expression#Right AST#expression#Right != AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left clearInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeId 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeId 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#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 . timeClose AST#member_expression#Right = AST#expression#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 this AST#expression#Right . isEnd 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tips AST#member_expression#Right = AST#expression#Left "即刻开启抽惊喜福袋" 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 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 . timeClose AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left getTimeString AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeCount AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 1000 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left VHSaaSDK 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 . getWatchGiftAwardSetting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#non_null_assertion_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 . webinar_info AST#member_expression#Right AST#expression#Right ?. webinar AST#member_expression#Right AST#expression#Right ?. id AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right , AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . watchGiftId AST#member_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onSucceed AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left VHWatchGiftSetting 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 . giftSetting AST#member_expression#Right = AST#expression#Left data AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onFailure AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left errorCode : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left errorMsg : 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 ToastUtil AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left errorMsg 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#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeId AST#member_expression#Right AST#expression#Right != AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right 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 clearInterval ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeId AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right AwardItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left VHGiftAwardItem 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 Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 10 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . award_img_url AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '112vp' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '63vp' AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Cover AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( 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 Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 10 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#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 item AST#expression#Right . award_name AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333' AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left 2 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left "60%" AST#expression#Right ) AST#modifier_chain_expression#Left . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Ellipsis AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . award_desc AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333' AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left 2 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left "60%" AST#expression#Right ) AST#modifier_chain_expression#Left . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Ellipsis AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '80%' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 10 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 . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . 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 . 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 10 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 10 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#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right AwardSettingItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left VHGiftAwardFiled 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 Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 10 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextInput ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . placeholder AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 4 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '90%' AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . field_value AST#member_expression#Right = AST#expression#Left msg AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . is_required AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left msg AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left enableCheck : 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#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#member_expression#Left AST#expression#Left this AST#expression#Right . settingDataSource 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 VHGiftAwardFiled 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#Left array : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left VHGiftAwardFiled [ ] AST#array_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#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 value AST#expression#Right . field_value 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 value AST#expression#Right AST#binary_expression#Right AST#expression#Right . is_required 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 enableCheck = 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#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#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isEnableEmit AST#member_expression#Right = AST#expression#Left enableCheck 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 . isEnableEmit 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#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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . is_required AST#member_expression#Right AST#expression#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.requir' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 8 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#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 '80%' 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 10 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 10 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 //中奖名单 AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right WinnerItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left VHWatchGiftWinner AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { // 半模态的内容 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 5 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#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 5 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#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 item AST#expression#Right . winner_avatar 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 AST#member_expression#Left AST#expression#Left item AST#expression#Right . winner_avatar AST#member_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.icon_avatar' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 10 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left FormatUtil AST#expression#Right . getTruncateText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . winner_nickname AST#member_expression#Right AST#expression#Right , AST#expression#Left 5 AST#expression#Right ) 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 . Red AST#member_expression#Right 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 Blank ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left "获得" AST#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 . Red AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left FormatUtil AST#expression#Right . getTruncateText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . award_name AST#member_expression#Right AST#expression#Right , AST#expression#Left 5 AST#expression#Right ) 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 . Red 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 '80%' 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 . 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 10 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 10 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray 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 '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left "#FDF5E7" 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 AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( AST#component_parameters#Left { AST#component_parameter#Left alignContent : AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#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#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 20 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( AST#component_parameters#Left { AST#component_parameter#Left alignContent : AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) 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 this AST#expression#Right . awardState 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 Image ( AST#expression#Left "https://cnstatic01.e.vhall.com/common-static/saas-watch/static/img/ring.644cb008.png" AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imagHeightBackGround AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imagHeightBackGround AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left 0 AST#expression#Right ) AST#modifier_chain_expression#Left . onAppear ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 使用animateTo显式动画(搜索结果4) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left animateToImmediately AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 1000 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imagHeightBackGround AST#member_expression#Right = AST#expression#Left 220 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 定义目标尺寸 } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left "https://cnstatic01.e.vhall.com/common-static/saas-watch/static/img/gold.7a02093a.png" AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 215 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 160 AST#expression#Right ) AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . onAppear ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 使用animateTo显式动画(搜索结果4) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left animateToImmediately AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rotateAngle AST#member_expression#Right = AST#expression#Left 360 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 定义目标尺寸 } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#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 . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rotateAngle AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left "https://cnstatic01.e.vhall.com/common-static/saas-watch/static/img/line.19de94b8.png" AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 220 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 160 AST#expression#Right ) AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left 2 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 Image ( AST#expression#Left "https://cnstatic01.e.vhall.com/common-static/saas-watch/static/img/halo.a05e7d7e.png" AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 80 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 80 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left "https://cnstatic01.e.vhall.com/common-static/saas-watch/static/img/bag.dfa3e828.png" AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . onAppear ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 使用animateTo显式动画(搜索结果4) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left animateToImmediately AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageSize AST#member_expression#Right = AST#expression#Left 220 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 定义目标尺寸 } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageSize AST#member_expression#Right AST#expression#Right ) // 初始宽度:184px AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageSize AST#member_expression#Right AST#expression#Right ) // 初始高度:184px AST#modifier_chain_expression#Left . zIndex ( 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 } else 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 . awardState AST#member_expression#Right AST#expression#Right == AST#expression#Left 1 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 Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.icon_lottery_no" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 185 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 185 AST#expression#Right ) AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left 2 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 } else 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 . awardState AST#member_expression#Right AST#expression#Right == AST#expression#Left 2 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 Image ( AST#expression#Left "https://cnstatic01.e.vhall.com/common-static/saas-watch/static/img/gold.7a02093a.png" AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 215 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 160 AST#expression#Right ) AST#modifier_chain_expression#Left . zIndex ( 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 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left "https://cnstatic01.e.vhall.com/common-static/saas-watch/static/img/halo.a05e7d7e.png" AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 220 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 220 AST#expression#Right ) AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left 2 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 Image ( AST#expression#Left "https://cnstatic01.e.vhall.com/common-static/saas-watch/static/img/ring.644cb008.png" AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 185 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 185 AST#expression#Right ) AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left 3 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 Image ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . participateGift AST#member_expression#Right AST#expression#Right . award_img_url AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 140 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 140 AST#expression#Right ) AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left 4 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 70 AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Cover AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 RelativeContainer ( ) 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . participateGift AST#member_expression#Right AST#expression#Right . award_name 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 . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left middle 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 . Center AST#member_expression#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 bottom 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 . Bottom AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Red AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#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 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , 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#Left . linearGradient ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left direction AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left GradientDirection AST#expression#Right . Left AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // 水平方向渐变(左右方向) AST#property_assignment#Left AST#property_name#Left colors AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0x00FFFF00 AST#expression#Right , AST#expression#Left 0.0 AST#expression#Right ] AST#array_literal#Right AST#expression#Right , // 左侧:透明(alpha=00)+ 黄色(FFFF00) AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0xFFFFFFFF AST#expression#Right , AST#expression#Left 0.5 AST#expression#Right ] AST#array_literal#Right AST#expression#Right , // 中间:不透明(alpha=FF)+ 黄色(FFFF00) AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0x00FFFF00 AST#expression#Right , AST#expression#Left 1.0 AST#expression#Right ] AST#array_literal#Right AST#expression#Right // 右侧:透明(alpha=00)+ 黄色(FFFF00) ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left 5 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else 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 . awardState AST#member_expression#Right AST#expression#Right == AST#expression#Left 3 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 Text ( AST#expression#Left '信息提交成功' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 24 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 '#FFFFFF' AST#expression#Right ) // 改为白色文字 AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#E53935' 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#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , // 阴影扩散半径 AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left '#B71C1C' AST#expression#Right AST#property_assignment#Right , // 深红色阴影 AST#property_assignment#Left AST#property_name#Left offsetX AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right , // 水平偏移量 AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right // 垂直偏移量 } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right , // 边框粗细 AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left '#FFCDD2' AST#expression#Right AST#property_assignment#Right // 浅红色边框 } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 3 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 . 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 . 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 . zIndex ( AST#expression#Left 0 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '60%' 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 . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Ellipsis AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 } AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_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 . height ( AST#expression#Left 230 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showBtn AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeClose AST#member_expression#Right AST#expression#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 30 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 15 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( 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 . awardState AST#member_expression#Right AST#expression#Right == AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left 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 . Red 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isEnd AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . awardState AST#member_expression#Right AST#expression#Right == AST#expression#Left 2 AST#expression#Right AST#binary_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#member_expression#Left AST#expression#Left this AST#expression#Right . giftSetting AST#member_expression#Right AST#expression#Right . receive_award_way AST#member_expression#Right AST#expression#Right == AST#expression#Left 3 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left VHSaaSDK 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 . getWatchGiftWinnerRank AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . watchGiftId AST#member_expression#Right AST#expression#Right ?. id AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left 10 AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onSucceed AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left VHWinner 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 . isShowWinnerList 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . winners AST#member_expression#Right AST#expression#Right . updateData 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 . list 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . awardState AST#member_expression#Right = AST#expression#Left 4 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 onFailure AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left errorCode : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left errorMsg : 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 ToastUtil AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left errorMsg 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#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left VHSaaSDK 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 . getWatchGiftAwardSetting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#non_null_assertion_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 . webinar_info AST#member_expression#Right AST#expression#Right ?. webinar AST#member_expression#Right AST#expression#Right ?. id AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right , AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . watchGiftId AST#member_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onSucceed AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left VHWatchGiftSetting 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 . giftSetting AST#member_expression#Right = AST#expression#Left data AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . receive_award_way AST#member_expression#Right AST#expression#Right == AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { //地址领取 AST#statement#Left AST#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 data AST#expression#Right . receive_award_field 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . settingDataSource AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . receive_award_field AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //.updateData(data.receive_award_field); 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 . showSetting 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#block_statement#Right AST#if_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 data AST#expression#Right . receive_award_way AST#member_expression#Right AST#expression#Right == AST#expression#Left 2 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 . showQRGift 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#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 data AST#expression#Right . receive_award_way AST#member_expression#Right AST#expression#Right == AST#expression#Left 3 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { //无需领奖 } AST#block_statement#Right AST#if_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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onFailure AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left errorCode : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left errorMsg : 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 ToastUtil AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left errorMsg 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#block_statement#Right AST#if_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 . awardState AST#member_expression#Right AST#expression#Right == AST#expression#Left 3 AST#expression#Right AST#binary_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 this AST#expression#Right . timeClose 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left VHSaaSDK 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 . getWatchGiftWinnerRank AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . watchGiftId AST#member_expression#Right AST#expression#Right ?. id AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left 10 AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onSucceed AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left VHWinner 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 . isShowWinnerList 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . winners AST#member_expression#Right AST#expression#Right . updateData 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 . list 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . awardState AST#member_expression#Right = AST#expression#Left 4 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 onFailure AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left errorCode : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left errorMsg : 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 ToastUtil AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left errorMsg 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#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 PromptActionClass AST#expression#Right . closeDialog 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 else AST#block_statement#Left { //参与中将 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left VHSaaSDK 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 . setWatchGiftParticipate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#non_null_assertion_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 . webinar_info AST#member_expression#Right AST#expression#Right . webinar AST#member_expression#Right AST#expression#Right ?. id AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right , AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . watchGiftId AST#member_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right , AST#expression#Left AST#non_null_assertion_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 . webinar_info AST#member_expression#Right AST#expression#Right ?. interact AST#member_expression#Right AST#expression#Right ?. room_id AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right , AST#expression#Left AST#non_null_assertion_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 . webinar_info AST#member_expression#Right AST#expression#Right ?. switch_info AST#member_expression#Right AST#expression#Right ?. switch_id AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onSucceed AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left participateData : AST#type_annotation#Left AST#primary_type#Left VHWatchGiftParticipate 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 . participateGift AST#member_expression#Right = AST#expression#Left participateData AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left VHSaaSDK 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 . getWatchGiftLastInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#non_null_assertion_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 . webinar_info AST#member_expression#Right AST#expression#Right . webinar AST#member_expression#Right AST#expression#Right ?. id AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onSucceed AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left dataGift : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left VHWatchGiftInfo AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left dataGift AST#expression#Right == AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#ERROR#Left return AST#ERROR#Right } AST#object_literal#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left giftInfo = AST#expression#Left dataGift AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeId 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 clearInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeId 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 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 this AST#expression#Right . giftSetting AST#member_expression#Right AST#expression#Right . receive_award_way AST#member_expression#Right AST#expression#Right == AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . giftSetting AST#member_expression#Right AST#expression#Right . receive_award_way AST#member_expression#Right AST#expression#Right == AST#expression#Left 2 AST#expression#Right AST#binary_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 participateData AST#expression#Right . winning AST#member_expression#Right AST#expression#Right == AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { //中奖 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeClose AST#member_expression#Right = AST#expression#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 this AST#expression#Right . awardState AST#member_expression#Right = AST#expression#Left 2 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 . awardState AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //没有中奖 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showBtn 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#if_statement#Right AST#statement#Right } AST#block_statement#Right else 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#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 this AST#expression#Right . giftSetting AST#member_expression#Right AST#expression#Right . receive_award_way AST#member_expression#Right AST#expression#Right == AST#expression#Left 3 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left giftInfo AST#expression#Right AST#binary_expression#Right AST#expression#Right . can_look_winner_list AST#member_expression#Right AST#expression#Right == AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeClose AST#member_expression#Right = AST#expression#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 this AST#expression#Right . awardState AST#member_expression#Right = AST#expression#Left 2 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 . awardState AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //没有中奖 } AST#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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onFailure AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left errorCode : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left errorMsg : 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 ToastUtil AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left errorMsg 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#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onFailure AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left errorCode : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left errorMsg : 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 ToastUtil AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left errorMsg 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#block_statement#Right AST#if_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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#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 4 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) 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 this AST#expression#Right . awardState 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 Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tips AST#member_expression#Right 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 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#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#member_expression#Left AST#expression#Left this AST#expression#Right . checkTips AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . borderWidth ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . borderColor ( 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 . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#00FFFFFF' 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left VHSaaSDK 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 . getWatchGiftAwardList AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#non_null_assertion_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 . webinar_info AST#member_expression#Right AST#expression#Right ?. webinar AST#member_expression#Right AST#expression#Right ?. id AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right , AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . watchGiftId AST#member_expression#Right AST#expression#Right ?. id AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onSucceed AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left VHWatchGiftAward 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 . isCheckAwardList 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 data AST#expression#Right . total 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . highlightDataSource AST#member_expression#Right AST#expression#Right . updateData 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 . list 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#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onFailure AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left errorCode : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left errorMsg : 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#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#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#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . isEnd AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left "请勿离开直播间,以免失去中奖资格" AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray 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#ui_if_statement#Right AST#ui_control_flow#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.close" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . 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 PromptActionClass AST#expression#Right . closeDialog 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#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 . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( 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 . awardState AST#member_expression#Right AST#expression#Right == AST#expression#Left 3 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '40%' AST#expression#Right : AST#expression#Left '100%' 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 . awardState AST#member_expression#Right AST#expression#Right == AST#expression#Left 3 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '#FDF5E7' AST#expression#Right : AST#expression#Left '#00000000' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left 0 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isCheckAwardList AST#member_expression#Right AST#expression#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 20 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 Stack ( AST#component_parameters#Left { AST#component_parameter#Left alignContent : AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#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 24 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 '#FFFFFF' AST#expression#Right ) // 改为白色文字 AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#E53935' 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#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , // 阴影扩散半径 AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left '#B71C1C' AST#expression#Right AST#property_assignment#Right , // 深红色阴影 AST#property_assignment#Left AST#property_name#Left offsetX AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right , // 水平偏移量 AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right // 垂直偏移量 } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right , // 边框粗细 AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left '#FFCDD2' AST#expression#Right AST#property_assignment#Right // 浅红色边框 } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 3 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 . 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 . 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 . zIndex ( AST#expression#Left 0 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '60%' 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 . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Ellipsis AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left RelativeContainer ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.close' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . 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 . isCheckAwardList 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#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left middle 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 . Center AST#member_expression#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 right 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 . End AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . offset ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 50 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 . zIndex ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' 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 '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 List ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 10 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#lazy_for_each_statement#Left LazyForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . highlightDataSource AST#member_expression#Right AST#expression#Right , // 渲染单个高亮项 AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left VHGiftAwardItem 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . AwardItem 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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . alignSelf ( AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . Center 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 . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '90%' 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#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left VHGiftAwardItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . award_id AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right // 用URL+时间确保唯一性 ) AST#lazy_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 . height ( AST#expression#Left '70%' AST#expression#Right ) AST#modifier_chain_expression#Left . alignListItem ( AST#expression#Left AST#member_expression#Left AST#expression#Left ListItemAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#FDF5E7' AST#expression#Right ) AST#modifier_chain_expression#Left . sticky ( AST#expression#Left AST#member_expression#Left AST#expression#Left StickyStyle AST#expression#Right . Header 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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#FDF5E7' 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 . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '80%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '60%' AST#expression#Right ) AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 20 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#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isShowWinnerList AST#member_expression#Right AST#expression#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 20 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 Stack ( AST#component_parameters#Left { AST#component_parameter#Left alignContent : AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#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 24 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 '#FFFFFF' AST#expression#Right ) // 改为白色文字 AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#E53935' 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#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , // 阴影扩散半径 AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left '#B71C1C' AST#expression#Right AST#property_assignment#Right , // 深红色阴影 AST#property_assignment#Left AST#property_name#Left offsetX AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right , // 水平偏移量 AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right // 垂直偏移量 } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right , // 边框粗细 AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left '#FFCDD2' AST#expression#Right AST#property_assignment#Right // 浅红色边框 } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 3 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 . 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 . 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 . zIndex ( AST#expression#Left 0 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '60%' 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 . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Ellipsis AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left RelativeContainer ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.close' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . 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 PromptActionClass AST#expression#Right . closeDialog 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#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left middle 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 . Center AST#member_expression#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 right 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 . End AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . offset ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 50 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 . zIndex ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' 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 '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 List ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 10 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#lazy_for_each_statement#Left LazyForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . winners AST#member_expression#Right AST#expression#Right , // 渲染单个高亮项 AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left VHWatchGiftWinner 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . WinnerItem 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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . alignSelf ( AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . Center 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 . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' 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#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left VHWatchGiftWinner AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . winner_join_id AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right // 用URL+时间确保唯一性 ) AST#lazy_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 . height ( AST#expression#Left '70%' AST#expression#Right ) AST#modifier_chain_expression#Left . alignListItem ( AST#expression#Left AST#member_expression#Left AST#expression#Left ListItemAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#FDF5E7' AST#expression#Right ) AST#modifier_chain_expression#Left . sticky ( AST#expression#Left AST#member_expression#Left AST#expression#Left StickyStyle AST#expression#Right . Header 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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#FDF5E7' 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 . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '90%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '60%' AST#expression#Right ) AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 20 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#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showSetting AST#member_expression#Right AST#expression#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 10 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 . fontSize ( AST#expression#Left 24 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 '#FFFFFF' AST#expression#Right ) // 改为白色文字 AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#E53935' 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#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , // 阴影扩散半径 AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left '#B71C1C' AST#expression#Right AST#property_assignment#Right , // 深红色阴影 AST#property_assignment#Left AST#property_name#Left offsetX AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right , // 水平偏移量 AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right // 垂直偏移量 } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right , // 边框粗细 AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left '#FFCDD2' AST#expression#Right AST#property_assignment#Right // 浅红色边框 } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 3 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 . 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 . 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 . zIndex ( AST#expression#Left 0 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '60%' 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 . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Ellipsis AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 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.close' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . 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 PromptActionClass AST#expression#Right . closeDialog 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#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 10 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . settingDataSource AST#member_expression#Right AST#expression#Right , // 渲染单个高亮项 AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left VHGiftAwardFiled 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . AwardSettingItem 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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . alignSelf ( AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . Center 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 . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '90%' 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#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left VHGiftAwardFiled AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . field AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . field_key AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right } ` AST#template_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right // 用URL+时间确保唯一性 ) 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 . padding ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '70%' AST#expression#Right ) AST#modifier_chain_expression#Left . alignListItem ( AST#expression#Left AST#member_expression#Left AST#expression#Left ListItemAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#FDF5E7' AST#expression#Right ) AST#modifier_chain_expression#Left . sticky ( AST#expression#Left AST#member_expression#Left AST#expression#Left StickyStyle AST#expression#Right . Header AST#member_expression#Right AST#expression#Right ) // 设置吸顶,实现粘性标题效果 AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left 3 AST#expression#Right ) AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Auto 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 Button ( AST#expression#Left "提交" AST#expression#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 30 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 15 AST#expression#Right ) AST#modifier_chain_expression#Left . enabled ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isEnableEmit AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( 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 . awardState AST#member_expression#Right AST#expression#Right == AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left 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 . Red 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#variable_declaration#Left const AST#variable_declarator#Left listenerJsonStr = 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 . settingDataSource 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 saveData = AST#expression#Left listenerJsonStr AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // this.settingDataSource.getJson(); 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 VHSaaSDK 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 . saveWatchGift AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . watchGiftId AST#member_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right , AST#expression#Left saveData AST#expression#Right , AST#expression#Left AST#object_literal#Left { // 成功 AST#property_assignment#Left AST#property_name#Left onSuccess AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left object AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . awardState AST#member_expression#Right = AST#expression#Left 3 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 . showSetting 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left VHSaaSDK 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 . getWatchGiftWinnerDetail AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . watchGiftId AST#member_expression#Right AST#expression#Right ?. id AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onSucceed AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left giftData : AST#type_annotation#Left AST#primary_type#Left VHWatchGiftWinnerDetail 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 giftData AST#expression#Right . can_look_winner_list AST#member_expression#Right AST#expression#Right == AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeClose AST#member_expression#Right = AST#expression#Left "查看中奖名单" 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 . timeClose AST#member_expression#Right = AST#expression#Left "关闭" AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onFailure AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left errorCode : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left errorMsg : 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#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#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#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right , // 失败 AST#property_assignment#Left AST#property_name#Left onFailure AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left errorCode : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left errorMsg : 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getPromptAction AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right 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 errorMsg AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left showMode AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . ToastShowMode AST#member_expression#Right AST#expression#Right . DEFAULT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 80 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#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#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left "《隐私政策》" AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . 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 WantUtil AST#expression#Right . toWebBrowser AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "https://e.vhall.com/v3/privacyPolicy" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left "及" AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left "《用户保护协议》" AST#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 . 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 WantUtil AST#expression#Right . toWebBrowser AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "https://e.vhall.com/v3/privacyUPo" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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 . zIndex ( AST#expression#Left 3 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#FDF5E7' 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 . height ( AST#expression#Left '60%' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showQRGift AST#member_expression#Right AST#expression#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 10 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 24 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 '#FFFFFF' AST#expression#Right ) // 改为白色文字 AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#E53935' 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#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , // 阴影扩散半径 AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left '#B71C1C' AST#expression#Right AST#property_assignment#Right , // 深红色阴影 AST#property_assignment#Left AST#property_name#Left offsetX AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right , // 水平偏移量 AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right // 垂直偏移量 } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right , // 边框粗细 AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left '#FFCDD2' AST#expression#Right AST#property_assignment#Right // 浅红色边框 } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 3 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 . 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 . 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 . zIndex ( AST#expression#Left 0 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '60%' 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 . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Ellipsis AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 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.close' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . 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 PromptActionClass AST#expression#Right . closeDialog 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#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . giftSetting AST#member_expression#Right AST#expression#Right . receive_award_field AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left VHGiftAwardFiled 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#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 item AST#expression#Right . field_key AST#member_expression#Right AST#expression#Right == AST#expression#Left 'private_qrcode' 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 Image ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . placeholder AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 220 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 220 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_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 . field_key AST#member_expression#Right AST#expression#Right == AST#expression#Left 'tip_note' 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 Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . placeholder AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_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 . field_key AST#member_expression#Right AST#expression#Right == AST#expression#Left 'private_number' 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 Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . placeholder AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_control_flow#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 . zIndex ( AST#expression#Left 3 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#FDF5E7' AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Center AST#member_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 . width ( AST#expression#Left '80%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '50%' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 10 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#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 . height ( 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 . watchGiftId AST#member_expression#Right AST#expression#Right . display_of_results AST#member_expression#Right AST#expression#Right == AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '100%' AST#expression#Right : AST#expression#Left '50%' AST#expression#Right AST#conditional_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 } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct WatchGiftView { private highlightDataSource: AwardDataSource = new AwardDataSource(); @State winners:WinnerDataSource = new WinnerDataSource(); @State settingDataSource: VHGiftAwardFiled[] = []; @State models:VHGiftAwardItem[] = []; private watchGiftId:VHWatchGiftInfo = new VHWatchGiftInfo(); @Require webinar_info:VHWebinarData; @State imagHeight:number = 200; @State imagHeightBackGround:number = 190; @State timeClose:string = '' @State timeCount:number = 0; @State url:string = "" @State scaleValue: number = 1; @State imageSize:number = 184; @State rotateAngle:number = 0; @State tips:string = ""; @State checkTips:string = "查看奖池"; @State isEnd:boolean = false; @State isEnableEmit:boolean = false; @State isCheckAwardList:boolean = false; @State isShowWinnerList:boolean = false; @State awardState:number = 0; @State showBtn:boolean = true; @State participateGift:VHWatchGiftParticipate = new VHWatchGiftParticipate; private winning:number = 0; private giftSetting: VHWatchGiftSetting = new VHWatchGiftSetting; @State showSetting:boolean = false; @State showQRGift:boolean = false; private timeId:number = -1; aboutToAppear(): void { this.timeCount = (this.watchGiftId?.watch_minute!*60 - this.watchGiftId?.online_duration!) *1000; this.tips = `连续观看直播${this.watchGiftId.watch_minute}分钟即有机会中将` this.timeClose = getTimeString(this.timeCount); this.timeId = setInterval(()=>{ this.timeCount -= 1000; if(this.timeCount <= 0){ if(this.timeId != -1){ clearInterval(this.timeId); this.timeId = -1; this.timeClose = "即刻开启" this.isEnd = true; this.tips = "即刻开启抽惊喜福袋" } }else{ this.timeClose = getTimeString(this.timeCount); } },1000); VHSaaSDK.getInstance().getWatchGiftAwardSetting(this.webinar_info?.webinar?.id!,this.watchGiftId.id!,{ onSucceed: (data: VHWatchGiftSetting)=>{ this.giftSetting = data; }, onFailure: (errorCode: number, errorMsg: string) =>{ ToastUtil.showToast(errorMsg); } }); } aboutToDisappear(): void { if(this.timeId != -1){ clearInterval(this.timeId); } } @Builder AwardItem(item: VHGiftAwardItem) { Row({ space: 10 }) { Image(item.award_img_url) .width('112vp') .height('63vp') .objectFit(ImageFit.Cover) .borderRadius(4) Column({ space: 10 }) { Text(item.award_name) .fontColor('#333') .maxLines(2) .width("60%") .textOverflow({ overflow: TextOverflow.Ellipsis }) Text(item.award_desc) .fontColor('#333') .maxLines(2) .width("60%") .textOverflow({ overflow: TextOverflow.Ellipsis }) } .width('80%') .borderRadius(10) .justifyContent(FlexAlign.Start) .alignItems(HorizontalAlign.Start) } .width('100%') .alignItems(VerticalAlign.Center) .justifyContent(FlexAlign.Center) .padding(10) .backgroundColor("#FFFFFF") .borderRadius(10) } @Builder AwardSettingItem(item: VHGiftAwardFiled) { Row({ space: 10 }) { TextInput({placeholder:item.placeholder}) .borderRadius(4) .width('90%') .onChange((msg: string) => { item.field_value = msg; if(item.is_required ){ if(msg.length > 0){ let enableCheck:boolean = true; this.settingDataSource?.forEach((value:VHGiftAwardFiled,index:number,array:VHGiftAwardFiled[])=>{ if(value.field_value?.length <= 0 && value.is_required){ enableCheck = false; } }) this.isEnableEmit = enableCheck; }else{ this.isEnableEmit = false; } } }) if(item.is_required){ Image($r('app.media.requir')).width(8).height(8) } } .width('80%') .justifyContent(FlexAlign.Start) .padding(10) .backgroundColor("#FFFFFF") .borderRadius(10) } @Builder WinnerItem(item: VHWatchGiftWinner) { Column({ space: 5 }){ Row({ space: 5 }) { Image(item.winner_avatar.length > 0 ? item.winner_avatar : $r('app.media.icon_avatar')).width(20).height(20).borderRadius(10) Text(FormatUtil.getTruncateText(item.winner_nickname,5)).fontColor(Color.Red) Blank() Text("获得").fontColor(Color.Red) Text(FormatUtil.getTruncateText(item.award_name,5)).fontColor(Color.Red) } .width('80%') .alignItems(VerticalAlign.Center) .justifyContent(FlexAlign.Center) .padding(10) .backgroundColor("#FFFFFF") .borderRadius(10) Divider() .color(Color.Gray) } .width('100%') .justifyContent(FlexAlign.Center) .padding(10) .backgroundColor("#FDF5E7") } build() { Stack({alignContent:Alignment.Center}){ Column({space: 20}) { Stack({ alignContent: Alignment.Center }){ if(this.awardState == 0){ Image("https://cnstatic01.e.vhall.com/common-static/saas-watch/static/img/ring.644cb008.png").width(this.imagHeightBackGround).height(this.imagHeightBackGround).zIndex(0) .onAppear(() => { animateToImmediately({ duration: 1000, iterations: -1 }, () => { this.imagHeightBackGround = 220; }) }) Image("https://cnstatic01.e.vhall.com/common-static/saas-watch/static/img/gold.7a02093a.png").width(215).height(160).zIndex(1) .onAppear(() => { animateToImmediately({ duration: 2000, iterations: -1 }, () => { this.rotateAngle = 360; }) }) .rotate({ angle: this.rotateAngle }) Image("https://cnstatic01.e.vhall.com/common-static/saas-watch/static/img/line.19de94b8.png").width(220).height(160).zIndex(2) Image("https://cnstatic01.e.vhall.com/common-static/saas-watch/static/img/halo.a05e7d7e.png").width(80).height(80) Image("https://cnstatic01.e.vhall.com/common-static/saas-watch/static/img/bag.dfa3e828.png") .onAppear(() => { animateToImmediately({ duration: 2000, iterations: -1 }, () => { this.imageSize = 220; }) }) .width(this.imageSize) .height(this.imageSize) .zIndex(4) }else if(this.awardState == 1){ Image($r("app.media.icon_lottery_no")).width(185).height(185).zIndex(2) }else if(this.awardState == 2){ Image("https://cnstatic01.e.vhall.com/common-static/saas-watch/static/img/gold.7a02093a.png").width(215).height(160).zIndex(1) Image("https://cnstatic01.e.vhall.com/common-static/saas-watch/static/img/halo.a05e7d7e.png").width(220).height(220).zIndex(2) Image("https://cnstatic01.e.vhall.com/common-static/saas-watch/static/img/ring.644cb008.png").width(185).height(185).zIndex(3) Image(this.participateGift.award_img_url) .width(140) .height(140) .zIndex(4) .borderRadius(70) .objectFit(ImageFit.Cover) RelativeContainer(){ Text(this.participateGift.award_name) .fontSize(14) .alignRules({ middle: { anchor: '__container__', align: HorizontalAlign.Center }, bottom: { anchor: '__container__', align:VerticalAlign.Bottom } }) .fontColor(Color.Red) .padding({ left: 16, right: 16, top: 8, bottom: 8 }) .linearGradient({ direction: GradientDirection.Left, colors: [ [0x00FFFF00, 0.0], [0xFFFFFFFF, 0.5], [0x00FFFF00, 1.0] ] }) }.zIndex(5) .width('100%') }else if(this.awardState == 3){ Text('信息提交成功') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor('#FFFFFF') .backgroundColor('#E53935') .padding({ left: 20, right: 20, top: 10, bottom: 10 }) .borderRadius(20) .shadow({ radius: 8, color: '#B71C1C', offsetX: 3, offsetY: 3 }) .border({ width: 2, color: '#FFCDD2' }) .rotate({ angle: -3 }) .textAlign(TextAlign.Center) .textOverflow({ overflow: TextOverflow.Ellipsis }) .zIndex(0) .width('60%') .textAlign(TextAlign.Center) .textOverflow({ overflow: TextOverflow.Ellipsis }) } }.height(230) if(this.showBtn){ Button(this.timeClose) .width(100) .height(30) .borderRadius(15) .backgroundColor(this.awardState == 0 ? Color.Orange : Color.Red) .onClick(()=>{ if(this.isEnd){ if(this.awardState == 2){ if(this.giftSetting.receive_award_way == 3){ VHSaaSDK.getInstance().getWatchGiftWinnerRank(this.watchGiftId?.id!,0,10,{ onSucceed: (data: VHWinner) => { this.isShowWinnerList = true; this.winners.updateData(data.list); this.awardState = 4; }, onFailure: (errorCode: number, errorMsg: string) => { ToastUtil.showToast(errorMsg); } }); }else{ VHSaaSDK.getInstance().getWatchGiftAwardSetting(this.webinar_info?.webinar?.id!,this.watchGiftId.id!,{ onSucceed: (data: VHWatchGiftSetting)=>{ this.giftSetting = data; if(data.receive_award_way == 1){ if(data.receive_award_field.length > 0){ this.settingDataSource = data.receive_award_field ; this.showSetting = true; } }else if(data.receive_award_way == 2){ this.showQRGift = true; }else if(data.receive_award_way == 3){ } }, onFailure: (errorCode: number, errorMsg: string) =>{ ToastUtil.showToast(errorMsg); } }); } } else if(this.awardState == 3){ if(this.timeClose == '查看中奖名单'){ VHSaaSDK.getInstance().getWatchGiftWinnerRank(this.watchGiftId?.id!,0,10,{ onSucceed: (data: VHWinner) => { this.isShowWinnerList = true; this.winners.updateData(data.list); this.awardState = 4; }, onFailure: (errorCode: number, errorMsg: string) => { ToastUtil.showToast(errorMsg); } }); }else{ PromptActionClass.closeDialog(); } } else{ VHSaaSDK.getInstance().setWatchGiftParticipate(this.webinar_info.webinar?.id!,this.watchGiftId.id!,this.webinar_info?.interact?.room_id!,this.webinar_info?.switch_info?.switch_id!,{ onSucceed: (participateData: VHWatchGiftParticipate) => { this.participateGift = participateData; VHSaaSDK.getInstance().getWatchGiftLastInfo(this.webinar_info.webinar?.id!,{ onSucceed: (dataGift: VHWatchGiftInfo|null) => { if(dataGift == null){ return } let giftInfo = dataGift; if(this.timeId != 0){ clearInterval(this.timeId); } if(this.giftSetting.receive_award_way == 1 || this.giftSetting.receive_award_way == 2){ if(participateData.winning == 1){ this.timeClose = "立即领奖" this.awardState = 2; } else{ this.awardState = 1; this.showBtn = false; } }else{ if(this.giftSetting.receive_award_way == 3 || giftInfo.can_look_winner_list == 1){ this.timeClose = "查看中将名单" this.awardState = 2; } else{ this.awardState = 1; } } }, onFailure: (errorCode: number, errorMsg: string) => { ToastUtil.showToast(errorMsg); } }) }, onFailure: (errorCode: number, errorMsg: string) => { ToastUtil.showToast(errorMsg); } }); } } }) } Row({space:4}){ if(this.awardState == 0){ Text(this.tips) .fontSize(16) .fontColor(Color.White) Button(this.checkTips) .borderWidth(1) .borderColor(Color.White) .padding({left:4,top:2,bottom:2,right:4}) .height(20) .borderRadius(10) .backgroundColor('#00FFFFFF') .onClick(()=>{ VHSaaSDK.getInstance().getWatchGiftAwardList(this.webinar_info?.webinar?.id!,this.watchGiftId?.id!,{ onSucceed: (data: VHWatchGiftAward) => { this.isCheckAwardList = true; if(data.total > 0){ this.highlightDataSource.updateData(data.list); } }, onFailure: (errorCode: number, errorMsg: string) => { } }); }) } } if(!this.isEnd){ Text("请勿离开直播间,以免失去中奖资格") .fontSize(12) .fontColor(Color.Gray) } Image($r("app.media.close")).width(24).height(24) .onClick(()=>{ PromptActionClass.closeDialog(); }) } .justifyContent(FlexAlign.Center) .alignItems(HorizontalAlign.Center) .width('100%') .borderRadius(10) .height(this.awardState == 3 ? '40%' : '100%') .backgroundColor(this.awardState == 3 ? '#FDF5E7':'#00000000') .zIndex(0) if(this.isCheckAwardList){ Column({space:20}){ Stack({ alignContent: Alignment.Center}){ Text('本轮奖品') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor('#FFFFFF') .backgroundColor('#E53935') .padding({ left: 20, right: 20, top: 10, bottom: 10 }) .borderRadius(20) .shadow({ radius: 8, color: '#B71C1C', offsetX: 3, offsetY: 3 }) .border({ width: 2, color: '#FFCDD2' }) .rotate({ angle: -3 }) .textAlign(TextAlign.Center) .textOverflow({ overflow: TextOverflow.Ellipsis }) .zIndex(0) .width('60%') .textAlign(TextAlign.Center) .textOverflow({ overflow: TextOverflow.Ellipsis }) RelativeContainer(){ Image($r('app.media.close')).width(24).height(24) .onClick(()=>{ this.isCheckAwardList = false; }) .alignRules({ middle: { anchor: '__container__', align: HorizontalAlign.Center }, right: { anchor: '__container__', align:HorizontalAlign.End } }) .offset({x:50}) }.zIndex(1) .height(20) .width('100%') }.width('100%') List({space:10}) { LazyForEach( this.highlightDataSource, (item: VHGiftAwardItem) => { ListItem() { this.AwardItem(item) } .alignSelf(ItemAlign.Center) .align(Alignment.Center) .width('90%') },(item: VHGiftAwardItem) => `${item.award_id}` ); } .height('70%') .alignListItem(ListItemAlign.Center) .backgroundColor('#FDF5E7') .sticky(StickyStyle.Header) } .backgroundColor('#FDF5E7') .justifyContent(FlexAlign.Center) .alignItems(HorizontalAlign.Center) .width('80%') .height('60%') .zIndex(1) .borderRadius(20) } if(this.isShowWinnerList){ Column({space:20}){ Stack({ alignContent: Alignment.Center}){ Text('中奖名单') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor('#FFFFFF') .backgroundColor('#E53935') .padding({ left: 20, right: 20, top: 10, bottom: 10 }) .borderRadius(20) .shadow({ radius: 8, color: '#B71C1C', offsetX: 3, offsetY: 3 }) .border({ width: 2, color: '#FFCDD2' }) .rotate({ angle: -3 }) .textAlign(TextAlign.Center) .textOverflow({ overflow: TextOverflow.Ellipsis }) .zIndex(0) .width('60%') .textAlign(TextAlign.Center) .textOverflow({ overflow: TextOverflow.Ellipsis }) RelativeContainer(){ Image($r('app.media.close')).width(24).height(24) .onClick(()=>{ PromptActionClass.closeDialog(); }) .alignRules({ middle: { anchor: '__container__', align: HorizontalAlign.Center }, right: { anchor: '__container__', align:HorizontalAlign.End } }) .offset({x:50}) }.zIndex(1) .height(20) .width('100%') }.width('100%') List({space:10}) { LazyForEach( this.winners, (item: VHWatchGiftWinner) => { ListItem() { this.WinnerItem(item); } .alignSelf(ItemAlign.Center) .align(Alignment.Center) .width('100%') },(item: VHWatchGiftWinner) => `${item.winner_join_id}` ); } .height('70%') .alignListItem(ListItemAlign.Center) .backgroundColor('#FDF5E7') .sticky(StickyStyle.Header) } .backgroundColor('#FDF5E7') .justifyContent(FlexAlign.Center) .alignItems(HorizontalAlign.Center) .width('90%') .height('60%') .zIndex(1) .borderRadius(20) } if(this.showSetting){ Column({space:10}){ Row(){ Text('领奖信息') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor('#FFFFFF') .backgroundColor('#E53935') .padding({ left: 20, right: 20, top: 10, bottom: 10 }) .borderRadius(20) .shadow({ radius: 8, color: '#B71C1C', offsetX: 3, offsetY: 3 }) .border({ width: 2, color: '#FFCDD2' }) .rotate({ angle: -3 }) .textAlign(TextAlign.Center) .textOverflow({ overflow: TextOverflow.Ellipsis }) .zIndex(0) .width('60%') .textAlign(TextAlign.Center) .textOverflow({ overflow: TextOverflow.Ellipsis }) Image($r('app.media.close')).width(24).height(24) .onClick(()=>{ PromptActionClass.closeDialog(); }) } List({space:10}) { ForEach( this.settingDataSource, (item: VHGiftAwardFiled) => { ListItem() { this.AwardSettingItem(item) } .alignSelf(ItemAlign.Center) .align(Alignment.Center) .width('90%') },(item: VHGiftAwardFiled) => `${item.field}${item.field_key}}` ); } .padding(10) .height('70%') .alignListItem(ListItemAlign.Center) .backgroundColor('#FDF5E7') .sticky(StickyStyle.Header) .zIndex(3) .scrollBar(BarState.Auto) Button("提交") .width(100) .height(30) .borderRadius(15) .enabled(this.isEnableEmit) .backgroundColor(this.awardState == 0 ? Color.Orange : Color.Red) .onClick(()=>{ const listenerJsonStr = JSON.stringify(this.settingDataSource); let saveData =listenerJsonStr; VHSaaSDK.getInstance().saveWatchGift(this.watchGiftId.id!,saveData,{ onSuccess: (data: string | object) => { this.awardState = 3; this.showSetting = false; VHSaaSDK.getInstance().getWatchGiftWinnerDetail(this.watchGiftId?.id!,{ onSucceed: (giftData: VHWatchGiftWinnerDetail) => { if(giftData.can_look_winner_list == 1){ this.timeClose = "查看中奖名单" }else{ this.timeClose = "关闭" } }, onFailure: (errorCode: number, errorMsg: string) => { } }); }, onFailure: (errorCode: number, errorMsg: string) => { this.getUIContext().getPromptAction().showToast({ message: errorMsg, duration: 2000, showMode: promptAction.ToastShowMode.DEFAULT, bottom: 80 }); } }); }) Row(){ Text("提交即同意") Text("《隐私政策》").fontColor(Color.Blue).onClick(()=>{ WantUtil.toWebBrowser("https://e.vhall.com/v3/privacyPolicy"); }) Text("及") Text("《用户保护协议》").fontColor(Color.Blue).onClick(()=>{ WantUtil.toWebBrowser("https://e.vhall.com/v3/privacyUPo"); }) } } .zIndex(3) .backgroundColor('#FDF5E7') .justifyContent(FlexAlign.Center) .height('60%') .borderRadius(10) } if(this.showQRGift){ Column({space:10}){ Text('领奖信息') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor('#FFFFFF') .backgroundColor('#E53935') .padding({ left: 20, right: 20, top: 10, bottom: 10 }) .borderRadius(20) .shadow({ radius: 8, color: '#B71C1C', offsetX: 3, offsetY: 3 }) .border({ width: 2, color: '#FFCDD2' }) .rotate({ angle: -3 }) .textAlign(TextAlign.Center) .textOverflow({ overflow: TextOverflow.Ellipsis }) .zIndex(0) .width('60%') .textAlign(TextAlign.Center) .textOverflow({ overflow: TextOverflow.Ellipsis }) Image($r('app.media.close')).width(24).height(24) .onClick(()=>{ PromptActionClass.closeDialog(); }) ForEach(this.giftSetting.receive_award_field,(item: VHGiftAwardFiled, index: number)=>{ if(item.field_key == 'private_qrcode'){ Image(item.placeholder).width(220).height(220) }else if(item.field_key == 'tip_note'){ Text(item.placeholder).fontSize(12) }else if(item.field_key == 'private_number'){ Text(item.placeholder) } }); } .zIndex(3) .backgroundColor('#FDF5E7') .alignItems(HorizontalAlign.Center) .justifyContent(FlexAlign.Center) .width('80%') .height('50%') .borderRadius(10) } } .width('100%') .height(this.watchGiftId.display_of_results == 0 ? '100%' : '50%') } }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/WatchGiftBuilder.ets#L140-L879
e34f67e984f0e50c5363c32701d1bf11e6130036
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/setting/ReclaimView.ets
arkts
buildReclaimContent
构建反馈内容字符串
private async buildReclaimContent(): Promise<string> { let content = `【投诉】${this.content.trim()}\n\n--------------\n`; content += `应用版本: ${BundleUtils.getBundleInfoSync().versionName}\n`; content += `用户ID: ${UserManager.shared.userId}\n`; content += `用户名: ${UserManager.shared.userName}`; return content; }
AST#method_declaration#Left private async buildReclaimContent 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 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 content = AST#expression#Left AST#template_literal#Left ` 【投诉】 AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#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#template_substitution#Right \n \n -------------- \n ` AST#template_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#assignment_expression#Left content += AST#expression#Left AST#template_literal#Left ` 应用版本: AST#template_substitution#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 BundleUtils AST#expression#Right . getBundleInfoSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . versionName AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right \n ` AST#template_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left content += AST#expression#Left AST#template_literal#Left ` 用户ID: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left UserManager AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . userId AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right \n ` AST#template_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left content += AST#expression#Left AST#template_literal#Left ` 用户名: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left UserManager AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . userName 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#statement#Left AST#return_statement#Left return AST#expression#Left content AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private async buildReclaimContent(): Promise<string> { let content = `【投诉】${this.content.trim()}\n\n--------------\n`; content += `应用版本: ${BundleUtils.getBundleInfoSync().versionName}\n`; content += `用户ID: ${UserManager.shared.userId}\n`; content += `用户名: ${UserManager.shared.userName}`; return content; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/setting/ReclaimView.ets#L162-L169
31aac3ca732ea8b2546ac1d25f68d75bdde18c2a
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/limitedheightbottomdialog/Index.ets
arkts
LimitedHeightBottomDialogComponent
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 { LimitedHeightBottomDialogComponent } from './src/main/ets/view/LimitedHeightBottomDialogComponent';
AST#export_declaration#Left export { LimitedHeightBottomDialogComponent } from './src/main/ets/view/LimitedHeightBottomDialogComponent' ; AST#export_declaration#Right
export { LimitedHeightBottomDialogComponent } from './src/main/ets/view/LimitedHeightBottomDialogComponent';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/limitedheightbottomdialog/Index.ets#L15-L15
040eb2d3766298b464a11610a07fef2450d9ab1b
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/utils/DateHelper.ets
arkts
isSameSecond
是否是同一秒
static isSameSecond(selectDate: Date, date: Date): boolean { return DateHelper.isSameMinute(selectDate, date) && selectDate.getSeconds() == date.getSeconds(); }
AST#method_declaration#Left static isSameSecond AST#parameter_list#Left ( AST#parameter#Left selectDate : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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 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#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateHelper AST#expression#Right . isSameMinute AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left selectDate AST#expression#Right , AST#expression#Left date AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left selectDate AST#expression#Right AST#binary_expression#Right AST#expression#Right . getSeconds 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 date AST#expression#Right AST#binary_expression#Right AST#expression#Right . getSeconds 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 isSameSecond(selectDate: Date, date: Date): boolean { return DateHelper.isSameMinute(selectDate, date) && selectDate.getSeconds() == date.getSeconds(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/DateHelper.ets#L151-L153
51c313a74a13da96884e5ae6d09aa62afcc47d65
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/entity/NotificationOptions.ets
arkts
描述多行文本通知。
export interface NotificationMultiLineOptions extends NotificationBasicOptions { briefText: string; //通知概要内容,是对通知内容的总结(不可为空字符串)。 longTitle: string; //通知展开时的标题(不可为空字符串)。 lines: Array<string>; //通知的多行文本。 }
AST#export_declaration#Left export AST#interface_declaration#Left interface NotificationMultiLineOptions AST#extends_clause#Left extends NotificationBasicOptions AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left briefText : 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 longTitle : 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 lines : 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 string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; //通知的多行文本。 } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface NotificationMultiLineOptions extends NotificationBasicOptions { briefText: string; longTitle: string; lines: Array<string>; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/NotificationOptions.ets#L77-L81
3e58401aad2eff5a4d4b699825af7fb23fce2e9a
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/cache/GlobalThis.ets
arkts
@Author csx @DateTime 2024/7/29 11:04:59 @TODO GlobalThis 全局替换版本GlobalThis 单例对象 @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_core
export class GlobalThis { private constructor() { };
AST#export_declaration#Left export AST#class_declaration#Left class GlobalThis AST#class_body#Left { AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right AST#class_body#Right AST#class_declaration#Right ; AST#export_declaration#Right
export class GlobalThis { private constructor() { };
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/cache/GlobalThis.ets#L25-L27
1159f3b7dbbed0e7da7da79538e46aa1d682159f
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Sync.ets
arkts
sign
签名 @param str 需要签名的字符串 @param priKey 私钥 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 @returns string 签名对象
static sign(str: string, priKey: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.sign(str, priKey, 'SM2_256', 'SM2_256|SM3', 256, keyCoding, resultCoding, false); }
AST#method_declaration#Left static sign AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoSyncUtil AST#expression#Right . sign AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left priKey AST#expression#Right , AST#expression#Left 'SM2_256' AST#expression#Right , AST#expression#Left 'SM2_256|SM3' AST#expression#Right , AST#expression#Left 256 AST#expression#Right , AST#expression#Left keyCoding AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static sign(str: string, priKey: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.sign(str, priKey, 'SM2_256', 'SM2_256|SM3', 256, keyCoding, resultCoding, false); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Sync.ets#L70-L73
645811da1e8bd724cb9b5141518b1a56d46f35ff
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.ChipGroup.d.ets
arkts
Defines ChipGroupPaddingOptions. @interface ChipGroupPaddingOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export interface ChipGroupPaddingOptions { /** * Top of chip group padding. * * @type { Length } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ top: Length; /** * Bottom of chip group padding. * * @type { Length } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ bottom: Length; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ChipGroupPaddingOptions AST#object_type#Left { /** * Top of chip group padding. * * @type { Length } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#type_member#Left top : AST#type_annotation#Left AST#primary_type#Left Length AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * Bottom of chip group padding. * * @type { Length } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#type_member#Left bottom : AST#type_annotation#Left AST#primary_type#Left Length 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 ChipGroupPaddingOptions { top: Length; bottom: Length; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ChipGroup.d.ets#L286-L307
44d354670a25d8252d045390170809485342af7f
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Download/Downloader/CosDownloader.ets
arkts
startDownloadIfNeeds
MARK: - 公共方法
public async startDownloadIfNeeds( text: string, finished: (data: Uint8Array | null, error: string | null) => void ) { // 校验text是否有效 if (!text || text.trim().length === 0) { finished(null, "text is empty"); return; } // 检查网络连接(需实现checkConnection方法) if (!NetWorkTool.checkInternetConnection()) { finished(null, "Network is not connectable"); return; } const language = "zh_cn"; const tag = `language:${language}, title:${text}`; // 检查是否已经在下载 if (this.downloadingSet.has(tag)) { DebugLog.i(`Download for ${tag} is already in progress.`); finished(null, "Download is already in progress."); return; } // 标记当前任务正在下载 this.downloadingSet.add(tag); DebugLog.i(`Start downloading sound for ${tag}...`); logEvent("Audio_Cos_Download") //日志 // 执行下载 await this.downloadData(text, (data, error) => { // 下载完成后回调 finished(data, error); // 下载完成,移除标记 this.downloadingSet.delete(tag); }); }
AST#method_declaration#Left public async startDownloadIfNeeds AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left finished : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left error : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { // 校验text是否有效 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left text AST#expression#Right AST#unary_expression#Right AST#expression#Right || AST#expression#Left text AST#expression#Right AST#binary_expression#Right AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left finished ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left "text is empty" AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right // 检查网络连接(需实现checkConnection方法) AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left NetWorkTool AST#expression#Right AST#unary_expression#Right AST#expression#Right . checkInternetConnection AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left finished ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left "Network is not connectable" AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#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 language = AST#expression#Left "zh_cn" AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right 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 tag = AST#expression#Left AST#template_literal#Left ` language: AST#template_substitution#Left $ { AST#expression#Left language AST#expression#Right } AST#template_substitution#Right , title: AST#template_substitution#Left $ { AST#expression#Left text 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . downloadingSet AST#member_expression#Right AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tag AST#expression#Right ) AST#argument_list#Right AST#call_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 DebugLog AST#expression#Right . i AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Download for AST#template_substitution#Left $ { AST#expression#Left tag AST#expression#Right } AST#template_substitution#Right is already in progress. ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left finished ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left "Download is already in progress." AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right // 标记当前任务正在下载 AST#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 . downloadingSet AST#member_expression#Right AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tag 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 DebugLog AST#expression#Right . i AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Start downloading sound for AST#template_substitution#Left $ { AST#expression#Left tag 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left logEvent ( AST#expression#Left "Audio_Cos_Download" AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right //日志 // 执行下载 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . downloadData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left text AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data AST#parameter#Right , AST#parameter#Left error 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 finished AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left error 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 . downloadingSet AST#member_expression#Right AST#expression#Right . delete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tag 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
public async startDownloadIfNeeds( text: string, finished: (data: Uint8Array | null, error: string | null) => void ) { if (!text || text.trim().length === 0) { finished(null, "text is empty"); return; } if (!NetWorkTool.checkInternetConnection()) { finished(null, "Network is not connectable"); return; } const language = "zh_cn"; const tag = `language:${language}, title:${text}`; if (this.downloadingSet.has(tag)) { DebugLog.i(`Download for ${tag} is already in progress.`); finished(null, "Download is already in progress."); return; } this.downloadingSet.add(tag); DebugLog.i(`Start downloading sound for ${tag}...`); logEvent("Audio_Cos_Download") await this.downloadData(text, (data, error) => { finished(data, error); this.downloadingSet.delete(tag); }); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/Downloader/CosDownloader.ets#L119-L158
344d82dc428c710b8d0eedbd7c75cf2d38ec987b
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
NdkDrawing/entry/src/main/ets/view/GlassCoverView.ets
arkts
drawOneCell
Draw a circle according to the specified position and width
private drawOneCell(canvas: CanvasRenderer, x: number, y: number, width: number): void { canvas.moveTo(x + width, y); canvas.arc(x, y, width, 0, Math.PI * 2); }
AST#method_declaration#Left private drawOneCell AST#parameter_list#Left ( AST#parameter#Left canvas : AST#type_annotation#Left AST#primary_type#Left CanvasRenderer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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_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 canvas AST#expression#Right . moveTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left x AST#expression#Right + AST#expression#Left width AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left y 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 canvas AST#expression#Right . arc AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left x AST#expression#Right , AST#expression#Left y AST#expression#Right , AST#expression#Left width AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . PI 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#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
private drawOneCell(canvas: CanvasRenderer, x: number, y: number, width: number): void { canvas.moveTo(x + width, y); canvas.arc(x, y, width, 0, Math.PI * 2); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NdkDrawing/entry/src/main/ets/view/GlassCoverView.ets#L87-L90
63f32de32bf75e5c9dfdfaaa25a6ca03c2f09a45
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
AtomicService/DxinBMI/entry/src/main/ets/utils/DxinScreenManager.ets
arkts
setTopSafeHeight
存储顶部安全区域高度
private setTopSafeHeight(topSafeHeight: number) { this.topSafeHeight = topSafeHeight; }
AST#method_declaration#Left private setTopSafeHeight AST#parameter_list#Left ( AST#parameter#Left topSafeHeight : 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . topSafeHeight AST#member_expression#Right = AST#expression#Left topSafeHeight AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
private setTopSafeHeight(topSafeHeight: number) { this.topSafeHeight = topSafeHeight; }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinBMI/entry/src/main/ets/utils/DxinScreenManager.ets#L68-L70
e37ffead18bbe88a92cc216cb62f1fc8c022adb6
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/library_function/array_lib_func_007_T.ets
arkts
Introduction 库函数-array_shift
export function array_lib_func_007_T(taint_src : string) { let arr : string[] = [taint_src,"a","b"]; let t = arr.shift(); taint.Sink(t!); }
AST#export_declaration#Left export AST#function_declaration#Left function array_lib_func_007_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left arr : 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 taint_src AST#expression#Right , AST#expression#Left "a" AST#expression#Right , AST#expression#Left "b" AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left t = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left arr AST#expression#Right . shift AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left taint AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left t AST#expression#Right ! AST#non_null_assertion_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#function_declaration#Right AST#export_declaration#Right
export function array_lib_func_007_T(taint_src : string) { let arr : string[] = [taint_src,"a","b"]; let t = arr.shift(); taint.Sink(t!); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/array_lib_func_007_T.ets#L6-L10
07395975fe20975d25e979c50e864825c5012a3c
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/component/ImgSheetView.ets
arkts
ImgSheetView
图片内容展示
@Preview @ComponentV2 export struct ImgSheetView { private scroller: Scroller = new Scroller(); @Require @Param options: TISheetOptions; @Local src: string | PixelMap | Resource = ""; aboutToAppear(): void { this.options.backgroundColor = this.options.backgroundColor ?? $r('app.color.main_background'); this.src = this.options.content; } build() { Column() { Scroll(this.scroller) { Image(this.src).width('100%') } .width('calc(100% - 30vp)') .margin({ top: 6, bottom: 30 }) .padding(12) .border({ width: 1, color: Color.Grey, radius: 10, style: BorderStyle.Dashed }) } .width('100%') .backgroundColor(Color.Transparent) .borderRadius(5) .clip(true) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ImgSheetView AST#component_body#Left { AST#property_declaration#Left private scroller : AST#type_annotation#Left AST#primary_type#Left Scroller AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Scroller AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#primary_type#Left TISheetOptions AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right src : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left PixelMap AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . backgroundColor AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . backgroundColor AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.main_background' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#binary_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 . src 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 . options AST#member_expression#Right AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_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 Image ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . src AST#member_expression#Right AST#expression#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 'calc(100% - 30vp)' 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 6 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 30 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Grey AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left style AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left BorderStyle AST#expression#Right . Dashed AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Transparent AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 5 AST#expression#Right ) AST#modifier_chain_expression#Left . clip ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#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
@Preview @ComponentV2 export struct ImgSheetView { private scroller: Scroller = new Scroller(); @Require @Param options: TISheetOptions; @Local src: string | PixelMap | Resource = ""; aboutToAppear(): void { this.options.backgroundColor = this.options.backgroundColor ?? $r('app.color.main_background'); this.src = this.options.content; } build() { Column() { Scroll(this.scroller) { Image(this.src).width('100%') } .width('calc(100% - 30vp)') .margin({ top: 6, bottom: 30 }) .padding(12) .border({ width: 1, color: Color.Grey, radius: 10, style: BorderStyle.Dashed }) } .width('100%') .backgroundColor(Color.Transparent) .borderRadius(5) .clip(true) } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/component/ImgSheetView.ets#L12-L39
ea461352f4192dbc6610c4f215c4554bd57b9fe2
gitee
hai-gou/haigou-harmonys.git
e96c0e599b151920e672d4dfc3a287db9855d368
entry/src/main/ets/config/config.example.ets
arkts
API 基础地址 - 修改为你的后端服务地址 本地开发示例: "http://192.168.x.x:3000/" 生产环境示例: "https://api.example.com/"
export const API_BASE_URL = "http://localhost:3000/" // 请求超时时间 (毫秒)
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left API_BASE_URL = AST#expression#Left "http://localhost:3000/" AST#expression#Right AST#variable_declarator#Right // 请求超时时间 (毫秒) AST#variable_declaration#Right AST#export_declaration#Right
export const API_BASE_URL = "http://localhost:3000/"
https://github.com/hai-gou/haigou-harmonys.git/blob/e96c0e599b151920e672d4dfc3a287db9855d368/entry/src/main/ets/config/config.example.ets#L13-L15
403f2c194ddda166bc66a6b11b7d37686b987348
github
xsdkhlgz/ATSOBJECT_OF_FIRST.git
8c14e875d7ec3f418bb7cdaae123a8fea87a7e76
entry/src/main/ets/model/RecordModel.ets
arkts
deleteById
deleteById(id:number): Promise<number>{ //1.删除条件 let predicates = new relationalStore.RdbPredicates(TABLE_NAME) predicates.equalTo(ID_COLUMN,id) //2.删除 return DbUtil.delete(predicates) }
AST#method_declaration#Left deleteById 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_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { //1.删除条件 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left predicates = 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#new_expression#Left new AST#expression#Left relationalStore AST#expression#Right AST#new_expression#Right AST#expression#Right . RdbPredicates AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TABLE_NAME AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left predicates AST#ERROR#Right . equalTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left ID_COLUMN AST#expression#Right , AST#expression#Left id AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right //2.删除 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 DbUtil AST#expression#Right . delete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left predicates 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
deleteById(id:number): Promise<number>{ let predicates = new relationalStore.RdbPredicates(TABLE_NAME) predicates.equalTo(ID_COLUMN,id) return DbUtil.delete(predicates) }
https://github.com/xsdkhlgz/ATSOBJECT_OF_FIRST.git/blob/8c14e875d7ec3f418bb7cdaae123a8fea87a7e76/entry/src/main/ets/model/RecordModel.ets#L40-L46
8fae1974f36b8bfded5e57b40c92db03ffe9d040
github
openharmony/graphic_graphic_2d
46a11e91c9709942196ad2a7afea2e0fcd1349f3
interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets
arkts
The metrics of an Font. @typedef FontMetrics @syscap SystemCapability.Graphics.Drawing @since 11
export interface FontMetrics { /** * Maximum range above the glyph bounding box. * @type { number } * @syscap SystemCapability.Graphics.Drawing * @since 11 */ top: number; /** * Distance Retained Above Baseline. * @type { number } * @syscap SystemCapability.Graphics.Drawing * @since 11 */ ascent: number; /** * The distance that remains below the baseline. * @type { number } * @syscap SystemCapability.Graphics.Drawing * @since 11 */ descent: number; /** * Maximum range below the glyph bounding box. * @type { number } * @syscap SystemCapability.Graphics.Drawing * @since 11 */ bottom: number; /** * Line Spacing. * @type { number } * @syscap SystemCapability.Graphics.Drawing * @since 11 */ leading: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface FontMetrics AST#object_type#Left { /** * Maximum range above the glyph bounding box. * @type { number } * @syscap SystemCapability.Graphics.Drawing * @since 11 */ AST#type_member#Left top : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * Distance Retained Above Baseline. * @type { number } * @syscap SystemCapability.Graphics.Drawing * @since 11 */ AST#type_member#Left ascent : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * The distance that remains below the baseline. * @type { number } * @syscap SystemCapability.Graphics.Drawing * @since 11 */ AST#type_member#Left descent : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * Maximum range below the glyph bounding box. * @type { number } * @syscap SystemCapability.Graphics.Drawing * @since 11 */ AST#type_member#Left bottom : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * Line Spacing. * @type { number } * @syscap SystemCapability.Graphics.Drawing * @since 11 */ AST#type_member#Left leading : 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 FontMetrics { top: number; ascent: number; descent: number; bottom: number; leading: number; }
https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets#L889-L929
2361cb885a835f3fd776ac5710f5f1aaae50546f
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/RankingDemo/entry/src/main/ets/viewmodel/RankViewModel.ets
arkts
loadRankDataSource1
Load data from the rankData1 of the Mock file.
loadRankDataSource1(): RankData[] { return rankData1; }
AST#method_declaration#Left loadRankDataSource1 AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left RankData [ ] 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 rankData1 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
loadRankDataSource1(): RankData[] { return rankData1; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/RankingDemo/entry/src/main/ets/viewmodel/RankViewModel.ets#L21-L23
080233f5d2d1bda5f4414d6c2804058aa25f7bfc
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/util/src/main/ets/notification/NotificationUtil.ets
arkts
makeRequest
构建通知请求对象 @param {number} notificationId 通知唯一ID @param {NotificationOptions} options 自定义通知配置项 @param {notificationManager.NotificationContent} content 通知内容体 @param {notificationManager.NotificationTemplate} template 可选,通知模板(优先级高于options中的template) @returns {notificationManager.NotificationRequest} 鸿蒙通知请求对象
function makeRequest( notificationId: number, options: NotificationOptions, content: notificationManager.NotificationContent, template?: notificationManager.NotificationTemplate ): notificationManager.NotificationRequest { // 初始化基础请求对象(必选字段:content) const request: notificationManager.NotificationRequest = { content }; // ========== 基础标识/模板相关 ========== request.id = notificationId; // 通知唯一ID if (template) { request.template = template; } if (options.notificationTemplate || PresetNotificationConfig.notificationTemplate) { request.template = template ?? options.notificationTemplate ?? PresetNotificationConfig.notificationTemplate; } // ========== 通道 ========== if (options.channelType || PresetNotificationConfig.channelType) { request.notificationSlotType = options.channelType ?? PresetNotificationConfig.channelType; // 通知通道类型 } // ========== 通知清除/角标相关 ========== request.tapDismissed = options.autoDismissOnTap ?? PresetNotificationConfig.autoDismissOnTap ?? false; // 点击是否自动清除(默认false) if (options.autoRemoveTime || PresetNotificationConfig.autoRemoveTime) { request.autoDeletedTime = options.autoRemoveTime ?? PresetNotificationConfig.autoRemoveTime; // 自动清除时间戳 } if (options.notificationBadgeCount || PresetNotificationConfig.notificationBadgeCount) { request.badgeNumber = options.notificationBadgeCount ?? PresetNotificationConfig.notificationBadgeCount; // 角标显示数量 } if (options.notificationBadgeStyle || PresetNotificationConfig.notificationBadgeStyle) { request.badgeIconStyle = options.notificationBadgeStyle ?? PresetNotificationConfig.notificationBadgeStyle; // 角标样式 } // ========== 通知提醒/展示相关 ========== request.isAlertOnce = options.isOneTimeAlert ?? PresetNotificationConfig.isOneTimeAlert ?? false; // 是否仅单次提醒(默认false) request.isStopwatch = options.showElapsedTime ?? PresetNotificationConfig.showElapsedTime ?? false; // 是否显示已用时间(默认false) request.isCountDown = options.showCountdownTime ?? PresetNotificationConfig.showCountdownTime ?? false; // 是否显示倒计时(默认false) request.isFloatingIcon = options.showStatusBarIcon ?? PresetNotificationConfig.showStatusBarIcon ?? true; // 是否显示状态栏图标(默认true) // ========== 通知内容/资源相关 ========== if (options.label || PresetNotificationConfig.label) { request.label = options.label ?? PresetNotificationConfig.label; // 通知标签 } if (options.actionButtons || PresetNotificationConfig.actionButtons) { request.actionButtons = options.actionButtons ?? PresetNotificationConfig.actionButtons; // 通知操作按钮(最多3个) } if (options.smallIcon || PresetNotificationConfig.smallIcon) { request.smallIcon = options.smallIcon ?? PresetNotificationConfig.smallIcon; // 通知小图标(≤100KB) } if (options.largeIcon || PresetNotificationConfig.largeIcon) { request.largeIcon = options.largeIcon ?? PresetNotificationConfig.largeIcon; // 通知大图标(≤100KB) } if (options.notificationGroupName || PresetNotificationConfig.notificationGroupName) { request.groupName = options.notificationGroupName ?? PresetNotificationConfig.notificationGroupName; // 通知组名称 } if (options.uniqueNotificationId || PresetNotificationConfig.uniqueNotificationId) { request.appMessageId = options.uniqueNotificationId ?? PresetNotificationConfig.uniqueNotificationId; // 通知去重唯一标识 } if (options.customNotificationSound || PresetNotificationConfig.customNotificationSound) { request.sound = options.customNotificationSound ?? PresetNotificationConfig.customNotificationSound; // 自定义通知铃声 } if (options.extensionInfo || PresetNotificationConfig.extensionInfo) { request.extraInfo = options.extensionInfo ?? PresetNotificationConfig.extensionInfo; // 扩展参数 } // ========== 通知交互/行为相关 ========== if (options.wantAgent ?? PresetNotificationConfig.wantAgent) { request.wantAgent = options.wantAgent ?? PresetNotificationConfig.wantAgent; // 点击通知触发的行为意图 } if (options.removeRedirectWantAgent ?? PresetNotificationConfig.removeRedirectWantAgent) { request.removalWantAgent = options.removeRedirectWantAgent ?? PresetNotificationConfig.removeRedirectWantAgent; // 移除通知的重定向意图 } // ========== 分布式通知相关 ========== if (options.distributedNotificationOption ?? PresetNotificationConfig.distributedNotificationOption) { request.distributedOption = options.distributedNotificationOption ?? PresetNotificationConfig.distributedNotificationOption; // 分布式通知配置 } return request; }
AST#function_declaration#Left function makeRequest AST#parameter_list#Left ( AST#parameter#Left notificationId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left NotificationOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationContent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left template ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationTemplate 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 notificationManager . NotificationRequest AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 初始化基础请求对象(必选字段:content) AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left request : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationRequest AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left content 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left request AST#expression#Right . id AST#member_expression#Right = AST#expression#Left notificationId AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 通知唯一ID AST#statement#Left AST#if_statement#Left if ( AST#expression#Left template 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 request AST#expression#Right . template AST#member_expression#Right = AST#expression#Left template AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . notificationTemplate AST#member_expression#Right AST#expression#Right || AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . notificationTemplate 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 request AST#expression#Right . template 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 template AST#expression#Right ?? AST#expression#Left options AST#expression#Right AST#binary_expression#Right AST#expression#Right . notificationTemplate AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . notificationTemplate AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // ========== 通道 ========== AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . channelType AST#member_expression#Right AST#expression#Right || AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . channelType 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 request AST#expression#Right . notificationSlotType AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . channelType AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . channelType 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 AST#member_expression#Left AST#expression#Left request AST#expression#Right . tapDismissed 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#member_expression#Left AST#expression#Left options AST#expression#Right . autoDismissOnTap AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . autoDismissOnTap AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 点击是否自动清除(默认false) AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . autoRemoveTime AST#member_expression#Right AST#expression#Right || AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . autoRemoveTime 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 request AST#expression#Right . autoDeletedTime AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . autoRemoveTime AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . autoRemoveTime AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 自动清除时间戳 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . notificationBadgeCount AST#member_expression#Right AST#expression#Right || AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . notificationBadgeCount 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 request AST#expression#Right . badgeNumber AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . notificationBadgeCount AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . notificationBadgeCount AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 角标显示数量 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . notificationBadgeStyle AST#member_expression#Right AST#expression#Right || AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . notificationBadgeStyle 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 request AST#expression#Right . badgeIconStyle AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . notificationBadgeStyle AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . notificationBadgeStyle 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 AST#member_expression#Left AST#expression#Left request AST#expression#Right . isAlertOnce 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#member_expression#Left AST#expression#Left options AST#expression#Right . isOneTimeAlert AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . isOneTimeAlert AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 是否仅单次提醒(默认false) 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 . isStopwatch 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#member_expression#Left AST#expression#Left options AST#expression#Right . showElapsedTime AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . showElapsedTime AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 是否显示已用时间(默认false) 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 . isCountDown 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#member_expression#Left AST#expression#Left options AST#expression#Right . showCountdownTime AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . showCountdownTime AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 是否显示倒计时(默认false) 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 . isFloatingIcon 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#member_expression#Left AST#expression#Left options AST#expression#Right . showStatusBarIcon AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . showStatusBarIcon AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 是否显示状态栏图标(默认true) // ========== 通知内容/资源相关 ========== AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . label AST#member_expression#Right AST#expression#Right || AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . label 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 request AST#expression#Right . label AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . label AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . label AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 通知标签 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . actionButtons AST#member_expression#Right AST#expression#Right || AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . actionButtons 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 request AST#expression#Right . actionButtons AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . actionButtons AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . actionButtons AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 通知操作按钮(最多3个) } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . smallIcon AST#member_expression#Right AST#expression#Right || AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . smallIcon 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 request AST#expression#Right . smallIcon AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . smallIcon AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . smallIcon AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 通知小图标(≤100KB) } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . largeIcon AST#member_expression#Right AST#expression#Right || AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . largeIcon 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 request AST#expression#Right . largeIcon AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . largeIcon AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . largeIcon AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 通知大图标(≤100KB) } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . notificationGroupName AST#member_expression#Right AST#expression#Right || AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . notificationGroupName 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 request AST#expression#Right . groupName AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . notificationGroupName AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . notificationGroupName AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 通知组名称 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . uniqueNotificationId AST#member_expression#Right AST#expression#Right || AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . uniqueNotificationId 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 request AST#expression#Right . appMessageId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . uniqueNotificationId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . uniqueNotificationId AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 通知去重唯一标识 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . customNotificationSound AST#member_expression#Right AST#expression#Right || AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . customNotificationSound 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 request AST#expression#Right . sound AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . customNotificationSound AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . customNotificationSound AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 自定义通知铃声 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . extensionInfo AST#member_expression#Right AST#expression#Right || AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . extensionInfo 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 request AST#expression#Right . extraInfo AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . extensionInfo AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . extensionInfo AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 扩展参数 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // ========== 通知交互/行为相关 ========== AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . wantAgent AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . wantAgent 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 request AST#expression#Right . wantAgent AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . wantAgent AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . wantAgent AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 点击通知触发的行为意图 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . removeRedirectWantAgent AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . removeRedirectWantAgent 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 request AST#expression#Right . removalWantAgent AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . removeRedirectWantAgent AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . removeRedirectWantAgent AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 移除通知的重定向意图 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // ========== 分布式通知相关 ========== AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . distributedNotificationOption AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . distributedNotificationOption 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 request AST#expression#Right . distributedOption AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . distributedNotificationOption AST#member_expression#Right AST#expression#Right ?? AST#expression#Left PresetNotificationConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . distributedNotificationOption 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#return_statement#Left return AST#expression#Left request AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
function makeRequest( notificationId: number, options: NotificationOptions, content: notificationManager.NotificationContent, template?: notificationManager.NotificationTemplate ): notificationManager.NotificationRequest { const request: notificationManager.NotificationRequest = { content }; request.id = notificationId; if (template) { request.template = template; } if (options.notificationTemplate || PresetNotificationConfig.notificationTemplate) { request.template = template ?? options.notificationTemplate ?? PresetNotificationConfig.notificationTemplate; } if (options.channelType || PresetNotificationConfig.channelType) { request.notificationSlotType = options.channelType ?? PresetNotificationConfig.channelType; } request.tapDismissed = options.autoDismissOnTap ?? PresetNotificationConfig.autoDismissOnTap ?? false; if (options.autoRemoveTime || PresetNotificationConfig.autoRemoveTime) { request.autoDeletedTime = options.autoRemoveTime ?? PresetNotificationConfig.autoRemoveTime; } if (options.notificationBadgeCount || PresetNotificationConfig.notificationBadgeCount) { request.badgeNumber = options.notificationBadgeCount ?? PresetNotificationConfig.notificationBadgeCount; } if (options.notificationBadgeStyle || PresetNotificationConfig.notificationBadgeStyle) { request.badgeIconStyle = options.notificationBadgeStyle ?? PresetNotificationConfig.notificationBadgeStyle; } request.isAlertOnce = options.isOneTimeAlert ?? PresetNotificationConfig.isOneTimeAlert ?? false; request.isStopwatch = options.showElapsedTime ?? PresetNotificationConfig.showElapsedTime ?? false; request.isCountDown = options.showCountdownTime ?? PresetNotificationConfig.showCountdownTime ?? false; request.isFloatingIcon = options.showStatusBarIcon ?? PresetNotificationConfig.showStatusBarIcon ?? true; if (options.label || PresetNotificationConfig.label) { request.label = options.label ?? PresetNotificationConfig.label; } if (options.actionButtons || PresetNotificationConfig.actionButtons) { request.actionButtons = options.actionButtons ?? PresetNotificationConfig.actionButtons; } if (options.smallIcon || PresetNotificationConfig.smallIcon) { request.smallIcon = options.smallIcon ?? PresetNotificationConfig.smallIcon; } if (options.largeIcon || PresetNotificationConfig.largeIcon) { request.largeIcon = options.largeIcon ?? PresetNotificationConfig.largeIcon; } if (options.notificationGroupName || PresetNotificationConfig.notificationGroupName) { request.groupName = options.notificationGroupName ?? PresetNotificationConfig.notificationGroupName; } if (options.uniqueNotificationId || PresetNotificationConfig.uniqueNotificationId) { request.appMessageId = options.uniqueNotificationId ?? PresetNotificationConfig.uniqueNotificationId; } if (options.customNotificationSound || PresetNotificationConfig.customNotificationSound) { request.sound = options.customNotificationSound ?? PresetNotificationConfig.customNotificationSound; } if (options.extensionInfo || PresetNotificationConfig.extensionInfo) { request.extraInfo = options.extensionInfo ?? PresetNotificationConfig.extensionInfo; } if (options.wantAgent ?? PresetNotificationConfig.wantAgent) { request.wantAgent = options.wantAgent ?? PresetNotificationConfig.wantAgent; } if (options.removeRedirectWantAgent ?? PresetNotificationConfig.removeRedirectWantAgent) { request.removalWantAgent = options.removeRedirectWantAgent ?? PresetNotificationConfig.removeRedirectWantAgent; } if (options.distributedNotificationOption ?? PresetNotificationConfig.distributedNotificationOption) { request.distributedOption = options.distributedNotificationOption ?? PresetNotificationConfig.distributedNotificationOption; } return request; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L211-L293
b5d05b7bbbd023594353a36a868102c278f439d0
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/Image/photomodify/src/main/ets/components/feature/PixelMapQueue.ets
arkts
Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
export default class PixelMapQueue { private items: PixelMap[] = []; constructor() { this.items = []; } push(pm: PixelMap): void { this.items.push(pm); } pop(): PixelMap | undefined { return this.items.pop(); } }
AST#export_declaration#Left export default AST#class_declaration#Left class PixelMapQueue AST#class_body#Left { AST#property_declaration#Left private items : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left PixelMap [ ] 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#constructor_declaration#Left constructor 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 . items 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#constructor_declaration#Right AST#method_declaration#Left push AST#parameter_list#Left ( AST#parameter#Left pm : AST#type_annotation#Left AST#primary_type#Left PixelMap 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 . items AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pm 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 pop AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left PixelMap 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 . items AST#member_expression#Right AST#expression#Right . pop 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 } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export default class PixelMapQueue { private items: PixelMap[] = []; constructor() { this.items = []; } push(pm: PixelMap): void { this.items.push(pm); } pop(): PixelMap | undefined { return this.items.pop(); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Image/photomodify/src/main/ets/components/feature/PixelMapQueue.ets#L16-L30
780d06b90f5f6c5c31a923c7a5ea6c16563c7963
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/plan/plan.ets
arkts
getFormattedDate
获取当前时间 返回YYYY-MM-DD
function getFormattedDate() { const date = new Date() const year = date.getFullYear() // 年(4位数字) const month = date.getMonth() + 1 // 月(0-11,需+1) const day = date.getDate() // 日(1-31) // 补零处理,确保月份和日期为两位数 const formattedMonth = month.toString().padStart(2, '0') const formattedDay = day.toString().padStart(2, '0') return `${year}-${formattedMonth}-${formattedDay}` }
AST#function_declaration#Left function getFormattedDate AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left date = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left year = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date 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 // 年(4位数字) AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left month = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date AST#expression#Right . getMonth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right // 月(0-11,需+1) AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left day = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date 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#variable_declarator#Right // 日(1-31) // 补零处理,确保月份和日期为两位数 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left formattedMonth = 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 month AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right , AST#expression#Left '0' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left formattedDay = 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 day AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right , AST#expression#Left '0' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left year AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left formattedMonth AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left formattedDay AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
function getFormattedDate() { const date = new Date() const year = date.getFullYear() const month = date.getMonth() + 1 const day = date.getDate() const formattedMonth = month.toString().padStart(2, '0') const formattedDay = day.toString().padStart(2, '0') return `${year}-${formattedMonth}-${formattedDay}` }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/plan/plan.ets#L114-L124
378f0ad4026527b42f4c431acca40ff2ab45b61b
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/util/StrUtil.ets
arkts
startsWith
检查字符串是否以给定的字符串卡头 @param string 要检索的字符串 @param target 要检索字符 @param position 检索的位置 @returns 如果字符串以字符串开头,那么返回 true,否则返回 false
static startsWith(string: string = '', target: string, position: number = 0): boolean { return string.startsWith(target, position); }
AST#method_declaration#Left static startsWith AST#parameter_list#Left ( AST#parameter#Left string : 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 target : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left position : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#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 string AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left target AST#expression#Right , AST#expression#Left position 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 startsWith(string: string = '', target: string, position: number = 0): boolean { return string.startsWith(target, position); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/StrUtil.ets#L205-L207
42877758d5587d2e1bcb7cf20ffe39333fedb29f
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets
arkts
onSubmitOrderClick
提交订单点击事件 @returns {void} 无返回值
onSubmitOrderClick(): void { const addressId: number | undefined = this.data?.defaultAddress?.id; if (!addressId) { ToastUtils.showError($r("app.string.select_address")); return; } const title: string = this.getPurchaseTitle(); const params: CreateOrderRequest = new CreateOrderRequest({ data: { addressId, goodsList: this.selectedGoodsList, title: title.length > 0 ? title : undefined, remark: this.remark.length > 0 ? this.remark : undefined, couponId: this.selectedCoupon?.id } }); RequestHelper.repository<Order>(this.orderRepository.createOrder(params)) .execute() .then((order: Order): void => { if (this.isFromCart) { void this.deleteCartItems(); } this.navigateToPayment(order); }); }
AST#method_declaration#Left onSubmitOrderClick AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left addressId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . data AST#member_expression#Right AST#expression#Right ?. defaultAddress AST#member_expression#Right AST#expression#Right ?. id 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#unary_expression#Left ! AST#expression#Left addressId AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ToastUtils AST#expression#Right . showError AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.select_address" 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#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 title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getPurchaseTitle 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 params : AST#type_annotation#Left AST#primary_type#Left CreateOrderRequest 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 CreateOrderRequest AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left addressId AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left goodsList AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedGoodsList AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left title 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#property_assignment#Right AST#ERROR#Left ? title : AST#type_annotation#Left AST#primary_type#Left undefined AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right , AST#property_assignment#Left AST#property_name#Left remark 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . remark 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . remark AST#member_expression#Right AST#expression#Right : AST#expression#Left undefined AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left couponId 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 . selectedCoupon AST#member_expression#Right AST#expression#Right ?. id 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#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RequestHelper AST#expression#Right . repository AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Order AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . orderRepository AST#member_expression#Right AST#expression#Right . createOrder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . execute AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left order : AST#type_annotation#Left AST#primary_type#Left Order AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isFromCart 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#unary_expression#Left void AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . deleteCartItems 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#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 . navigateToPayment AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left order AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
onSubmitOrderClick(): void { const addressId: number | undefined = this.data?.defaultAddress?.id; if (!addressId) { ToastUtils.showError($r("app.string.select_address")); return; } const title: string = this.getPurchaseTitle(); const params: CreateOrderRequest = new CreateOrderRequest({ data: { addressId, goodsList: this.selectedGoodsList, title: title.length > 0 ? title : undefined, remark: this.remark.length > 0 ? this.remark : undefined, couponId: this.selectedCoupon?.id } }); RequestHelper.repository<Order>(this.orderRepository.createOrder(params)) .execute() .then((order: Order): void => { if (this.isFromCart) { void this.deleteCartItems(); } this.navigateToPayment(order); }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets#L286-L312
256c471faae623325180b41f1c66492c9f669218
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/widgets/pages/WidgetCard2x4.ets
arkts
onWidgetClick
整个组件点击事件
private onWidgetClick(): void { postCardAction(this, { action: 'router', abilityName: 'EntryAbility', params: { action: 'openApp' } }); }
AST#method_declaration#Left private onWidgetClick AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left postCardAction ( AST#expression#Left this AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left 'router' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left abilityName AST#property_name#Right : AST#expression#Left 'EntryAbility' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left params AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left 'openApp' 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#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
private onWidgetClick(): void { postCardAction(this, { action: 'router', abilityName: 'EntryAbility', params: { action: 'openApp' } }); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/widgets/pages/WidgetCard2x4.ets#L289-L297
0a67d07ad3b80c64f754edf0bb8726e5e34ab568
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/CitySearch/casesfeature/citysearch/src/main/ets/view/SearchView.ets
arkts
SearchView
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.
@Component export struct SearchView { // List组件里可以绑定的可滚动组件的控制器 private scroller: Scroller = new Scroller(); // 搜索列表 @Link searchList: string[]; // 选定的城市 @Link changeValue: string; build() { Stack({ alignContent: Alignment.TopEnd }) { List({ space: 14, initialIndex: 0, scroller: this.scroller }) { ForEach(this.searchList, (item: string) => { ListItem() { Column() { Text(item) .height(30) .fontSize(14) }.onClick(() => { this.changeValue = item; }) } }) } .layoutWeight(1) .edgeEffect(EdgeEffect.None) .divider({ strokeWidth: $r('app.integer.citysearch_divider_strokeWidth'), color: $r('app.color.citysearch_divider_color'), startMargin: $r('app.integer.citysearch_divider_start'), endMargin: $r('app.integer.citysearch_divider_end') }) .listDirection(Axis.Vertical) .sticky(StickyStyle.Header) } .width('100%') .height('100%') .layoutWeight(1) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SearchView AST#component_body#Left { // List组件里可以绑定的可滚动组件的控制器 AST#property_declaration#Left private scroller : AST#type_annotation#Left AST#primary_type#Left Scroller AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Scroller AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // 搜索列表 AST#property_declaration#Left AST#decorator#Left @ Link 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#property_declaration#Right // 选定的城市 AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right changeValue : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( AST#component_parameters#Left { AST#component_parameter#Left alignContent : AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . TopEnd 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 List ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 14 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left initialIndex : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left scroller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scroller 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 . searchList AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left string 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 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 item AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 30 AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . 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 . changeValue AST#member_expression#Right = AST#expression#Left item 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#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#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 . edgeEffect ( AST#expression#Left AST#member_expression#Left AST#expression#Left EdgeEffect AST#expression#Right . None AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . divider ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left strokeWidth AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.citysearch_divider_strokeWidth' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.citysearch_divider_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left startMargin AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.citysearch_divider_start' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left endMargin AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.citysearch_divider_end' 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 . listDirection ( AST#expression#Left AST#member_expression#Left AST#expression#Left Axis AST#expression#Right . Vertical AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . sticky ( AST#expression#Left AST#member_expression#Left AST#expression#Left StickyStyle AST#expression#Right . Header 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#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 '100%' 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 } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct SearchView { private scroller: Scroller = new Scroller(); @Link searchList: string[]; @Link changeValue: string; build() { Stack({ alignContent: Alignment.TopEnd }) { List({ space: 14, initialIndex: 0, scroller: this.scroller }) { ForEach(this.searchList, (item: string) => { ListItem() { Column() { Text(item) .height(30) .fontSize(14) }.onClick(() => { this.changeValue = item; }) } }) } .layoutWeight(1) .edgeEffect(EdgeEffect.None) .divider({ strokeWidth: $r('app.integer.citysearch_divider_strokeWidth'), color: $r('app.color.citysearch_divider_color'), startMargin: $r('app.integer.citysearch_divider_start'), endMargin: $r('app.integer.citysearch_divider_end') }) .listDirection(Axis.Vertical) .sticky(StickyStyle.Header) } .width('100%') .height('100%') .layoutWeight(1) } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CitySearch/casesfeature/citysearch/src/main/ets/view/SearchView.ets#L16-L55
b84311988e56104dc148b3f4a86c47440058660d
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_search_engines.ets
arkts
add_search_engine
Add a new search engine to the current search engine list. @param se A search_engine object, the search engine to be added.
static add_search_engine(se: search_engine) { bunch_of_search_engines.list_of_search_engines.push(se); bunch_of_search_engines.update_last_accessed(); }
AST#method_declaration#Left static add_search_engine AST#parameter_list#Left ( AST#parameter#Left se : AST#type_annotation#Left AST#primary_type#Left search_engine 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 bunch_of_search_engines AST#expression#Right . list_of_search_engines AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left se 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 bunch_of_search_engines AST#expression#Right . update_last_accessed 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
static add_search_engine(se: search_engine) { bunch_of_search_engines.list_of_search_engines.push(se); bunch_of_search_engines.update_last_accessed(); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_search_engines.ets#L39-L42
cf750b55402b2edb32d766bd6b99f40da39b5a10
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/VideoTrimmerOption.ets
arkts
VideoTrimmerOption
视频剪辑参数选项
@Observed export class VideoTrimmerOption { constructor() { this.scaleNum = 100; this.videoMaxTime = 8; this.videoMinTime = 3; this.maxCountRange = 8; this.thumbWidth = 30; this.paddingLineHeight = 10; } // 源文件路径 @Track public srcFilePath: string = ''; // 视频剪辑回调接口 @Track public listener: VideoTrimListener = { onStartTrim() { }, onFinishTrim(outputFile: string) { }, onCancel() { } }; // 视频帧加载回调接口 @Track public loadFrameListener: VideoLoadFramesListener = { onStartLoad() { }, onFinishLoad() { } } // 裁剪事件长度 默认值8秒 @Track public videoMaxTime?: number = 8; // 最小剪辑时间 @Track public videoMinTime?: number = 3; // seekBar的区域内一共有多少张图片 @Track public maxCountRange?: number = 8; // 裁剪视频预览长方形条状左右边缘宽度 @Track public thumbWidth?: number = 30; // 裁剪视频预览长方形条状上下边缘高度 @Track public paddingLineHeight?: number = 10; // 当加载帧没有完成,默认的占位图 @Track public framePlaceholder?: PixelMap; // 裁剪视频预览长方形条状区域背景颜色 @Track public frameBackground?: string; @Track public context?: common.UIAbilityContext; // 裁剪时压缩比率,100 为1:1,即不压缩 @Track public scaleNum?: number = 100; }
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class VideoTrimmerOption AST#class_body#Left { AST#constructor_declaration#Left constructor 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 . scaleNum AST#member_expression#Right = AST#expression#Left 100 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 . videoMaxTime AST#member_expression#Right = AST#expression#Left 8 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 . videoMinTime AST#member_expression#Right = AST#expression#Left 3 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 . maxCountRange AST#member_expression#Right = AST#expression#Left 8 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 . thumbWidth AST#member_expression#Right = AST#expression#Left 30 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 . paddingLineHeight AST#member_expression#Right = AST#expression#Left 10 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#property_declaration#Left AST#decorator#Left @ Track AST#decorator#Right public srcFilePath : 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 @ Track AST#decorator#Right public listener : AST#type_annotation#Left AST#primary_type#Left VideoTrimListener AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onStartTrim AST#property_name#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onFinishTrim AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left outputFile : 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#block_statement#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onCancel AST#property_name#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right // 视频帧加载回调接口 AST#property_declaration#Left AST#decorator#Left @ Track AST#decorator#Right public loadFrameListener : AST#type_annotation#Left AST#primary_type#Left VideoLoadFramesListener AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onStartLoad AST#property_name#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onFinishLoad AST#property_name#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right // 裁剪事件长度 默认值8秒 AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Track AST#decorator#Right public videoMaxTime ? : 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 AST#decorator#Left @ Track AST#decorator#Right public videoMinTime ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 3 AST#expression#Right ; AST#property_declaration#Right // seekBar的区域内一共有多少张图片 AST#property_declaration#Left AST#decorator#Left @ Track AST#decorator#Right public maxCountRange ? : 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 AST#decorator#Left @ Track AST#decorator#Right public thumbWidth ? : 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 AST#decorator#Left @ Track AST#decorator#Right public paddingLineHeight ? : 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 AST#decorator#Left @ Track AST#decorator#Right public framePlaceholder ? : AST#type_annotation#Left AST#primary_type#Left PixelMap AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 裁剪视频预览长方形条状区域背景颜色 AST#property_declaration#Left AST#decorator#Left @ Track AST#decorator#Right public frameBackground ? : 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 AST#decorator#Left @ Track AST#decorator#Right public 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#property_declaration#Right // 裁剪时压缩比率,100 为1:1,即不压缩 AST#property_declaration#Left AST#decorator#Left @ Track AST#decorator#Right public scaleNum ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 100 AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#decorated_export_declaration#Right
@Observed export class VideoTrimmerOption { constructor() { this.scaleNum = 100; this.videoMaxTime = 8; this.videoMinTime = 3; this.maxCountRange = 8; this.thumbWidth = 30; this.paddingLineHeight = 10; } @Track public srcFilePath: string = ''; @Track public listener: VideoTrimListener = { onStartTrim() { }, onFinishTrim(outputFile: string) { }, onCancel() { } }; @Track public loadFrameListener: VideoLoadFramesListener = { onStartLoad() { }, onFinishLoad() { } } @Track public videoMaxTime?: number = 8; @Track public videoMinTime?: number = 3; @Track public maxCountRange?: number = 8; @Track public thumbWidth?: number = 30; @Track public paddingLineHeight?: number = 10; @Track public framePlaceholder?: PixelMap; @Track public frameBackground?: string; @Track public context?: common.UIAbilityContext; @Track public scaleNum?: number = 100; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/VideoTrimmerOption.ets#L23-L69
d8ea076ea25c239d4e7a0e7dd3676bad14f3ab1f
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/DownloadUtils.ets
arkts
requestEnableNotification
申请通知权限
static async requestEnableNotification() { const isNotificationEnabled = NotificationUtils.isNotificationEnabledSync(); if (!isNotificationEnabled) { NotificationUtils.requestEnableNotification(); } }
AST#method_declaration#Left static async requestEnableNotification AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left isNotificationEnabled = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left NotificationUtils AST#expression#Right . isNotificationEnabledSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left isNotificationEnabled AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left NotificationUtils AST#expression#Right . requestEnableNotification 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#method_declaration#Right
static async requestEnableNotification() { const isNotificationEnabled = NotificationUtils.isNotificationEnabledSync(); if (!isNotificationEnabled) { NotificationUtils.requestEnableNotification(); } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/DownloadUtils.ets#L104-L109
03629f6fd6b90fa18f50894f8b15ac089c23ac0f
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/common/resource.ets
arkts
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
export class P2PManager { public resourceToString(resource: Resource): string { return getContext(this).resourceManager.getStringSync(resource); } }
AST#export_declaration#Left export AST#class_declaration#Left class P2PManager AST#class_body#Left { AST#method_declaration#Left public 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 this 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 P2PManager { public resourceToString(resource: Resource): string { return getContext(this).resourceManager.getStringSync(resource); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/common/resource.ets#L16-L20
5b847e43407c4081000da16db799d4f519297876
gitee
DompetApp/Dompet.harmony.git
ba5aae3d265458588a4866a71f9ac55bbd0a4a92
entry/src/main/ets/configure/device.ets
arkts
updateAvoidArea
@throws
updateAvoidArea(refer: window.AvoidAreaOptions) { if (this.orientation !== display.Orientation.PORTRAIT) { return } if (refer.type === window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR) { this.bottom = refer.area.bottomRect.height } if (refer.type === window.AvoidAreaType.TYPE_SYSTEM) { this.top = refer.area.topRect.height } }
AST#method_declaration#Left updateAvoidArea AST#parameter_list#Left ( AST#parameter#Left refer : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . AvoidAreaOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#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 this AST#expression#Right . orientation AST#member_expression#Right AST#expression#Right !== AST#expression#Left display AST#expression#Right AST#binary_expression#Right AST#expression#Right . Orientation AST#member_expression#Right AST#expression#Right . PORTRAIT AST#member_expression#Right AST#expression#Right ) { AST#ERROR#Left return AST#ERROR#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left refer AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left window AST#expression#Right AST#binary_expression#Right AST#expression#Right . AvoidAreaType AST#member_expression#Right AST#expression#Right . TYPE_NAVIGATION_INDICATOR 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 . bottom AST#member_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 refer AST#expression#Right . area AST#member_expression#Right AST#expression#Right . bottomRect 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#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left refer AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left window AST#expression#Right AST#binary_expression#Right AST#expression#Right . AvoidAreaType AST#member_expression#Right AST#expression#Right . TYPE_SYSTEM 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 . top AST#member_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 refer AST#expression#Right . area AST#member_expression#Right AST#expression#Right . topRect 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#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
updateAvoidArea(refer: window.AvoidAreaOptions) { if (this.orientation !== display.Orientation.PORTRAIT) { return } if (refer.type === window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR) { this.bottom = refer.area.bottomRect.height } if (refer.type === window.AvoidAreaType.TYPE_SYSTEM) { this.top = refer.area.topRect.height } }
https://github.com/DompetApp/Dompet.harmony.git/blob/ba5aae3d265458588a4866a71f9ac55bbd0a4a92/entry/src/main/ets/configure/device.ets#L83-L95
b83786d636a96111cdc15d0c9990439ce79b5cd6
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/FavoritesService.ets
arkts
cleanupExpiredData
清理过期数据
async cleanupExpiredData(daysToKeep: number = 30): Promise<void> { const cutoffDate = new Date(); cutoffDate.setDate(cutoffDate.getDate() - daysToKeep); // 清理过期历史记录 const initialHistoryLength = this.generationHistory.length; this.generationHistory = this.generationHistory.filter(h => new Date(h.createdAt) > cutoffDate ); // 清理过期收藏(保留所有收藏,不按时间清理) const removedCount = initialHistoryLength - this.generationHistory.length; if (removedCount > 0) { await this.saveData(); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Cleaned up ${removedCount} expired history records`); } }
AST#method_declaration#Left async cleanupExpiredData AST#parameter_list#Left ( AST#parameter#Left daysToKeep : 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#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#variable_declaration#Left const AST#variable_declarator#Left cutoffDate = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cutoffDate AST#expression#Right . setDate 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 cutoffDate AST#expression#Right . getDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right - AST#expression#Left daysToKeep 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#variable_declaration#Left const AST#variable_declarator#Left initialHistoryLength = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . generationHistory AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . generationHistory 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 this AST#expression#Right . generationHistory AST#member_expression#Right AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left h => AST#expression#Left AST#binary_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#expression#Left AST#member_expression#Left AST#expression#Left h AST#expression#Right . createdAt AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right > AST#expression#Left cutoffDate AST#expression#Right AST#binary_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#variable_declaration#Left const AST#variable_declarator#Left removedCount = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left initialHistoryLength AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . generationHistory AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left removedCount 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 AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . saveData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Cleaned up AST#template_substitution#Left $ { AST#expression#Left removedCount AST#expression#Right } AST#template_substitution#Right expired history records ` 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async cleanupExpiredData(daysToKeep: number = 30): Promise<void> { const cutoffDate = new Date(); cutoffDate.setDate(cutoffDate.getDate() - daysToKeep); const initialHistoryLength = this.generationHistory.length; this.generationHistory = this.generationHistory.filter(h => new Date(h.createdAt) > cutoffDate ); const removedCount = initialHistoryLength - this.generationHistory.length; if (removedCount > 0) { await this.saveData(); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Cleaned up ${removedCount} expired history records`); } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/FavoritesService.ets#L454-L471
ded86507a5a3e2d8a671d808c8b4fc107969aae9
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/BackgroundTaskManagement/ResourceManager/libraryOverlay/src/main/ets/Index.ets
arkts
add
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
export { add } from "./utils/Calc"
AST#export_declaration#Left export { add } from "./utils/Calc" AST#export_declaration#Right
export { add } from "./utils/Calc"
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/BackgroundTaskManagement/ResourceManager/libraryOverlay/src/main/ets/Index.ets#L16-L16
b27400abe963e312ca0195ce13d9f40932b3e768
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/expandtitle/src/main/ets/page/DataSource.ets
arkts
registerDataChangeListener
该方法为框架侧调用,为LazyForEach组件向其数据源处添加listener监听
registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { this.listeners.push(listener); } }
AST#method_declaration#Left registerDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left listener AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right < AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#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 . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left listener AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { this.listeners.push(listener); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/expandtitle/src/main/ets/page/DataSource.ets#L39-L43
86af794033d0e7699fa06a156d484376eda0b211
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/NotificationUtils.ets
arkts
setDefaultConfig
默认配置 设置通知的默认统一配置 @param configs
static setDefaultConfig(configs: (config: NotificationConfig) => void): void { configs(NotificationUtils.defaultConfig); }
AST#method_declaration#Left static setDefaultConfig AST#parameter_list#Left ( AST#parameter#Left configs : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left NotificationConfig AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left configs ( AST#expression#Left AST#member_expression#Left AST#expression#Left NotificationUtils AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
static setDefaultConfig(configs: (config: NotificationConfig) => void): void { configs(NotificationUtils.defaultConfig); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/NotificationUtils.ets#L47-L49
abcb430eb048211ac94c9996221151c4a980a3de
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/constants/AppConstants.ets
arkts
get
动态颜色常量(基于当前主题)
static get PRIMARY_COLOR(): string { return this.getCurrentTheme().colors.primaryColor; }
AST#method_declaration#Left static get AST#ERROR#Left PRIMARY_COLOR AST#ERROR#Right 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 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 . getCurrentTheme AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . colors AST#member_expression#Right AST#expression#Right . primaryColor AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static get PRIMARY_COLOR(): string { return this.getCurrentTheme().colors.primaryColor; }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/constants/AppConstants.ets#L17-L19
d2450299d7d1173011f5445074425ac4521b8b49
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/DeviceUtils.ets
arkts
stopVibration
停止振动(按照VIBRATOR_STOP_MODE_TIME模式),ohos.permission.VIBRATE
static stopVibration(): Promise<void> { return vibrator.stopVibration(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_TIME); }
AST#method_declaration#Left static stopVibration AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left vibrator AST#expression#Right . stopVibration 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 vibrator AST#expression#Right . VibratorStopMode AST#member_expression#Right AST#expression#Right . VIBRATOR_STOP_MODE_TIME 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
static stopVibration(): Promise<void> { return vibrator.stopVibration(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_TIME); }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DeviceUtils.ets#L262-L264
adb44648cd259949803c0f1eaf24379b556ce2de
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SuperFeature/Widget/ArkTSCard/CardInteractionCase/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onNewWant
如果UIAbility已在后台运行,在收到Router事件后会触发onNewWant生命周期回调
onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void { if (want.parameters!['ability.params.stream'] !== undefined) { AppStorage.setOrCreate('imageUri', want.parameters!['ability.params.stream'].toString()); return; } if (want?.parameters?.params) { // want.parameters.params 对应 postCardAction() 中 params 内容 let params: Record<string, Object> = JSON.parse(want.parameters.params as string); this.selectPage = params.targetPage as string; if (this.currentWindowStage !== null) { // 存在窗口时点击卡片后进行页面跳转 this.currentWindowStage.loadContent(`pages/${this.selectPage}`, (err) => { if (err.code) { hilog.error(0x0000, 'testTagSelectPage', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); return; } hilog.info(0x0000, 'testTagSelectPage', 'Succeeded in loading the content.'); }); this.selectPage = ''; } } else { this.selectPage = ''; } }
AST#method_declaration#Left onNewWant AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left AbilityConstant . LaunchParam 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 { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left want AST#expression#Right . parameters AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right [ AST#expression#Left 'ability.params.stream' AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'imageUri' AST#expression#Right , 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#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left want AST#expression#Right . parameters AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right [ AST#expression#Left 'ability.params.stream' AST#expression#Right ] AST#subscript_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#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#member_expression#Left AST#expression#Left want AST#expression#Right ?. parameters AST#member_expression#Right AST#expression#Right ?. params AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // want.parameters.params 对应 postCardAction() 中 params 内容 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left Object 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 JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left want AST#expression#Right . parameters AST#member_expression#Right AST#expression#Right . params AST#member_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#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectPage AST#member_expression#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . targetPage AST#member_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#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 this AST#expression#Right . currentWindowStage AST#member_expression#Right AST#expression#Right !== AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 存在窗口时点击卡片后进行页面跳转 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentWindowStage AST#member_expression#Right AST#expression#Right . loadContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` pages/ AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectPage AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code 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 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 'testTagSelectPage' AST#expression#Right , AST#expression#Left 'Failed to load the content. Cause: %{public}s' 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#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 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 'testTagSelectPage' AST#expression#Right , AST#expression#Left 'Succeeded in loading the content.' 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectPage AST#member_expression#Right = AST#expression#Left '' 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 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 . selectPage AST#member_expression#Right = AST#expression#Left '' 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
onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void { if (want.parameters!['ability.params.stream'] !== undefined) { AppStorage.setOrCreate('imageUri', want.parameters!['ability.params.stream'].toString()); return; } if (want?.parameters?.params) { let params: Record<string, Object> = JSON.parse(want.parameters.params as string); this.selectPage = params.targetPage as string; if (this.currentWindowStage !== null) { this.currentWindowStage.loadContent(`pages/${this.selectPage}`, (err) => { if (err.code) { hilog.error(0x0000, 'testTagSelectPage', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); return; } hilog.info(0x0000, 'testTagSelectPage', 'Succeeded in loading the content.'); }); this.selectPage = ''; } } else { this.selectPage = ''; } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/Widget/ArkTSCard/CardInteractionCase/entry/src/main/ets/entryability/EntryAbility.ets#L38-L61
7f1e2657f73724e85db911f6cc2e16d67c50beb5
gitee
guojiabing/await-to-arkts.git
0b1df61d34006b3d8ca020c89d859ffdc056f7c8
library/src/main/ets/await-to-arkts.ets
arkts
@param { Promise } promise @param { Object= } errorExt - Additional Information you can pass to the err object @return { Promise }
export function to<T, U extends Error = Error>( promise: Promise<T>, errorExt?: object ): Promise<[U, undefined] | [null, T]> { return promise .then<[null, T]>((data: T) => [null, data]) .catch<[U, undefined]>((err: U) => { if (errorExt) { const parsedError = new Object() as U; for (let key of Reflect.ownKeys(err) as string[]) { Reflect.set(parsedError, key, Reflect.get(err, key)) } for (let key of Reflect.ownKeys(errorExt) as string[]) { Reflect.set(parsedError, key, Reflect.get(errorExt, key)) } return [parsedError, undefined]; } return [err, undefined]; }); }
AST#export_declaration#Left export AST#function_declaration#Left function to AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right , AST#type_parameter#Left U extends AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right = AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left promise : 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#parameter#Right , AST#parameter#Left errorExt ? : 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#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left U AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left undefined AST#primary_type#Right AST#type_annotation#Right ] AST#tuple_type#Right AST#primary_type#Right | AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left null 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#tuple_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#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 promise AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left null 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#tuple_type#Right 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 data : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left data AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left U AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left undefined 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#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 U 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 errorExt AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left parsedError = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Object 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 as AST#type_annotation#Left AST#primary_type#Left U 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#for_statement#Left for ( let key of AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Reflect AST#expression#Right . ownKeys 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 as AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#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 Reflect AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left parsedError AST#expression#Right , AST#expression#Left key AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Reflect AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right , AST#expression#Left key AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( let key of AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Reflect AST#expression#Right . ownKeys AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left errorExt AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#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 Reflect AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left parsedError AST#expression#Right , AST#expression#Left key AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Reflect AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left errorExt AST#expression#Right , AST#expression#Left key AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#array_literal#Left [ AST#expression#Left parsedError AST#expression#Right , AST#expression#Left undefined AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#array_literal#Left [ AST#expression#Left err AST#expression#Right , AST#expression#Left undefined AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function to<T, U extends Error = Error>( promise: Promise<T>, errorExt?: object ): Promise<[U, undefined] | [null, T]> { return promise .then<[null, T]>((data: T) => [null, data]) .catch<[U, undefined]>((err: U) => { if (errorExt) { const parsedError = new Object() as U; for (let key of Reflect.ownKeys(err) as string[]) { Reflect.set(parsedError, key, Reflect.get(err, key)) } for (let key of Reflect.ownKeys(errorExt) as string[]) { Reflect.set(parsedError, key, Reflect.get(errorExt, key)) } return [parsedError, undefined]; } return [err, undefined]; }); }
https://github.com/guojiabing/await-to-arkts.git/blob/0b1df61d34006b3d8ca020c89d859ffdc056f7c8/library/src/main/ets/await-to-arkts.ets#L6-L29
a4148cd12c16e47ca1bb542b19a9220c6524f558
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/home/search.ets
arkts
hotSearchItem
**************************************** 热搜榜 *********************************************//
@Builder hotSearchItem(text: string, color: string) { Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { // 热搜图标 Image('image/home/fire.png') .width(24) .height(24) .margin({ right: 12 }) // 热搜文本 Text(text) .fontSize(13) .fontColor(color) .fontWeight(300) } .backgroundColor('#F1F3F2') .height(40) .width(100) .borderRadius(10) .margin({left:5,right:5,bottom:5}) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right hotSearchItem AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left color : 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( AST#component_parameters#Left { AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left alignItems : AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // 热搜图标 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left 'image/home/fire.png' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 12 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 text AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 13 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left color AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left 300 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 . backgroundColor ( AST#expression#Left '#F1F3F2' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 100 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( 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 left AST#property_name#Right : AST#expression#Left 5 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 5 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 5 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#builder_function_body#Right AST#method_declaration#Right
@Builder hotSearchItem(text: string, color: string) { Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { Image('image/home/fire.png') .width(24) .height(24) .margin({ right: 12 }) Text(text) .fontSize(13) .fontColor(color) .fontWeight(300) } .backgroundColor('#F1F3F2') .height(40) .width(100) .borderRadius(10) .margin({left:5,right:5,bottom:5}) }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/home/search.ets#L114-L134
eeb27b2f5cc03d048f31ff4c9655f6ea28892ab7
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets
arkts
onMirrorChange
Rotate and flip.
onMirrorChange(): void { Logger.debug(TAG, 'onMirrorChange'); if (this.isWaitingRefresh) { this.clearDelayRefresh(); this.cropShow.enlargeCropArea(); } else { if (MathUtils.isOddRotation(this.rotationAngle)) { this.isFlipVertically = !this.isFlipVertically; } else { this.isFlipHorizontal = !this.isFlipHorizontal; } this.cropShow.setFlip(this.isFlipHorizontal, this.isFlipVertically); } this.refresh(); }
AST#method_declaration#Left onMirrorChange 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 Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'onMirrorChange' 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#member_expression#Left AST#expression#Left this AST#expression#Right . isWaitingRefresh AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . clearDelayRefresh AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cropShow AST#member_expression#Right AST#expression#Right . enlargeCropArea 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left MathUtils AST#expression#Right . isOddRotation 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 . rotationAngle AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isFlipVertically AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . isFlipVertically AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isFlipHorizontal AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . isFlipHorizontal 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#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 . cropShow AST#member_expression#Right AST#expression#Right . setFlip 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 . isFlipHorizontal AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isFlipVertically AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . refresh 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
onMirrorChange(): void { Logger.debug(TAG, 'onMirrorChange'); if (this.isWaitingRefresh) { this.clearDelayRefresh(); this.cropShow.enlargeCropArea(); } else { if (MathUtils.isOddRotation(this.rotationAngle)) { this.isFlipVertically = !this.isFlipVertically; } else { this.isFlipHorizontal = !this.isFlipHorizontal; } this.cropShow.setFlip(this.isFlipHorizontal, this.isFlipVertically); } this.refresh(); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets#L145-L159
3e092e6399a56cdfb9e51198f48da4736071a91f
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
buildDialogBirthdays
生日信息
@Builder buildDialogBirthdays() { if (this.selectedDateDetail?.birthdays && this.selectedDateDetail.birthdays.length > 0) { Column({ space: 8 }) { Text('今日生日') .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor(this.COLORS.textPrimary) .alignSelf(ItemAlign.Start) Column({ space: 6 }) { ForEach(this.selectedDateDetail.birthdays, (contact: Contact) => { Row({ space: 12 }) { Text('🎂') .fontSize(16) Column({ space: 2 }) { Text(contact.name) .fontSize(14) .fontWeight(FontWeight.Medium) .fontColor(this.COLORS.textPrimary) Text(contact.relation) .fontSize(12) .fontColor(this.COLORS.textSecondary) } .layoutWeight(1) .alignItems(HorizontalAlign.Start) Text('发祝福') .fontSize(12) .fontColor(this.COLORS.whitePrimary) .padding(12) .backgroundColor(this.COLORS.primary) .borderRadius(12) .onClick(() => { promptAction.showToast({ message: `向 ${contact.name} 发送生日祝福`, duration: 1500 }); }) } .width('100%') .padding(8) .backgroundColor('#FEF2F2') .borderRadius(6) }) } .width('100%') } .width('100%') } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildDialogBirthdays 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#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 this AST#expression#Right . selectedDateDetail AST#member_expression#Right AST#expression#Right ?. birthdays AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . selectedDateDetail AST#member_expression#Right AST#expression#Right . birthdays 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 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 . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . textPrimary AST#member_expression#Right 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 6 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedDateDetail AST#member_expression#Right AST#expression#Right . birthdays AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 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 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#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 2 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left contact AST#expression#Right . name 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 . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . textPrimary 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#expression#Left AST#member_expression#Left AST#expression#Left contact AST#expression#Right . relation AST#member_expression#Right 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 . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . textSecondary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#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 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . whitePrimary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . primary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 12 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 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#template_literal#Left ` 向 AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left contact AST#expression#Right . name AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 发送生日祝福 ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 1500 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#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#FEF2F2' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 6 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#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#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder buildDialogBirthdays() { if (this.selectedDateDetail?.birthdays && this.selectedDateDetail.birthdays.length > 0) { Column({ space: 8 }) { Text('今日生日') .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor(this.COLORS.textPrimary) .alignSelf(ItemAlign.Start) Column({ space: 6 }) { ForEach(this.selectedDateDetail.birthdays, (contact: Contact) => { Row({ space: 12 }) { Text('🎂') .fontSize(16) Column({ space: 2 }) { Text(contact.name) .fontSize(14) .fontWeight(FontWeight.Medium) .fontColor(this.COLORS.textPrimary) Text(contact.relation) .fontSize(12) .fontColor(this.COLORS.textSecondary) } .layoutWeight(1) .alignItems(HorizontalAlign.Start) Text('发祝福') .fontSize(12) .fontColor(this.COLORS.whitePrimary) .padding(12) .backgroundColor(this.COLORS.primary) .borderRadius(12) .onClick(() => { promptAction.showToast({ message: `向 ${contact.name} 发送生日祝福`, duration: 1500 }); }) } .width('100%') .padding(8) .backgroundColor('#FEF2F2') .borderRadius(6) }) } .width('100%') } .width('100%') } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L4608-L4660
daa5a2aa2138f389586902802634ddd0e9d01566
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Player/AudioTool.ets
arkts
removeFile
删除指定文件 @param filePath 文件完整路径
static async removeFile(filePath: string): Promise<void> { try { const fileInfo = await fs.stat(filePath); // 10. 正确调用异步方法[8](@ref) if (fileInfo.isFile()) { await fs.unlink(filePath); console.info(`已删除临时文件: ${filePath}`); } } catch (err) { console.error(`删除文件失败: ${err}`); } }
AST#method_declaration#Left static async removeFile AST#parameter_list#Left ( AST#parameter#Left filePath : 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 fileInfo = 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 fs AST#expression#Right AST#await_expression#Right AST#expression#Right . stat AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filePath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 10. 正确调用异步方法[8](@ref) 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 fileInfo AST#expression#Right . isFile 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 AST#await_expression#Left await AST#expression#Left fs AST#expression#Right AST#await_expression#Right AST#expression#Right . unlink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filePath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 已删除临时文件: AST#template_substitution#Left $ { AST#expression#Left filePath 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#if_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 console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 删除文件失败: AST#template_substitution#Left $ { AST#expression#Left 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#block_statement#Right AST#method_declaration#Right
static async removeFile(filePath: string): Promise<void> { try { const fileInfo = await fs.stat(filePath); if (fileInfo.isFile()) { await fs.unlink(filePath); console.info(`已删除临时文件: ${filePath}`); } } catch (err) { console.error(`删除文件失败: ${err}`); } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Player/AudioTool.ets#L94-L105
e9d50e07de748c3b9f48689db3c52b81c78ca368
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/Tools.ets
arkts
toSetting
跳转系统设置页面(配合WantUtil里的URI常量一起使用,可跳转更多的设置页面) @param uri: 传入WantUtil的URI常量,不传默认为设置页面 @param parameters: WantParams参数 @returns
static async toSetting(uri?: string, parameters: Record<string, Object> = { 'pushParams': ArkWebHelper.getContext().abilityInfo.bundleName }): Promise<void> { const want: Want = { bundleName: 'com.huawei.hmos.settings', //设置应用bundleName abilityName: 'com.huawei.hmos.settings.MainAbility', //设置应用abilityName uri: uri, //目标页面 parameters: parameters } return ArkWebHelper.getContext().startAbility(want); }
AST#method_declaration#Left static async toSetting AST#parameter_list#Left ( AST#parameter#Left uri ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left parameters : 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 Object 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 'pushParams' AST#property_name#Right : 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 ArkWebHelper AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . abilityInfo AST#member_expression#Right AST#expression#Right . bundleName AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#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#variable_declaration#Left const AST#variable_declarator#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bundleName AST#property_name#Right : AST#expression#Left 'com.huawei.hmos.settings' AST#expression#Right AST#property_assignment#Right , //设置应用bundleName AST#property_assignment#Left AST#property_name#Left abilityName AST#property_name#Right : AST#expression#Left 'com.huawei.hmos.settings.MainAbility' AST#expression#Right AST#property_assignment#Right , //设置应用abilityName AST#property_assignment#Left AST#property_name#Left uri AST#property_name#Right : AST#expression#Left uri AST#expression#Right AST#property_assignment#Right , //目标页面 AST#property_assignment#Left AST#property_name#Left parameters AST#property_name#Right : AST#expression#Left parameters 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#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 ArkWebHelper AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . startAbility AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left want AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async toSetting(uri?: string, parameters: Record<string, Object> = { 'pushParams': ArkWebHelper.getContext().abilityInfo.bundleName }): Promise<void> { const want: Want = { bundleName: 'com.huawei.hmos.settings', abilityName: 'com.huawei.hmos.settings.MainAbility', uri: uri, parameters: parameters } return ArkWebHelper.getContext().startAbility(want); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/Tools.ets#L88-L96
08eff1447a812b42cc78c7712eb2f82841b93a06
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
NEXT/OneAutumn/entry/src/main/ets/common/OneAutumnUtils.ets
arkts
getRandomIndex
你给我一个数组。我给你从数组中 随机返回一个该数组的索引
getRandomIndex<T>(array: T[]): number { if (array.length === 0) { throw new Error("数组不能为空"); } return Math.floor(Math.random() * array.length); }
AST#method_declaration#Left getRandomIndex AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right 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 number 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 array 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 "数组不能为空" 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#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 . floor 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#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 array AST#expression#Right AST#binary_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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getRandomIndex<T>(array: T[]): number { if (array.length === 0) { throw new Error("数组不能为空"); } return Math.floor(Math.random() * array.length); }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/OneAutumn/entry/src/main/ets/common/OneAutumnUtils.ets#L12-L17
be1ed79e376af2362d3a9c46429cc6ee34328faf
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/vibrateeffect/src/main/ets/VibrateEffect.ets
arkts
startVibrate
触发手机振动效果
startVibrate() { try { // TODO: 知识点:vibrator.startVibration 根据指定振动效果和振动属性触发马达振动 vibrator.startVibration({ type: 'time', // 持续触发马达振动时间600ms duration: CONFIGURATION.VIBRATION_TIME, }, { id: 0, usage: 'alarm', }, (error: BusinessError) => { if (error) { logger.error(`Failed to start vibration. Code: ${error.code}, message: ${error.message}`); return; } }); } catch (err) { logger.error(`An unexpected error occurred. Code: ${err.code}, message: ${err.message}`); } }
AST#method_declaration#Left startVibrate AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // TODO: 知识点:vibrator.startVibration 根据指定振动效果和振动属性触发马达振动 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left vibrator AST#expression#Right . startVibration 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 type AST#property_name#Right : AST#expression#Left 'time' AST#expression#Right AST#property_assignment#Right , // 持续触发马达振动时间600ms AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CONFIGURATION AST#expression#Right . VIBRATION_TIME AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left usage AST#property_name#Right : AST#expression#Left 'alarm' AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error : 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#if_statement#Left if ( AST#expression#Left error 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 . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to start vibration. 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#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#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#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` An unexpected error occurred. 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#block_statement#Right AST#method_declaration#Right
startVibrate() { try { vibrator.startVibration({ type: 'time', duration: CONFIGURATION.VIBRATION_TIME, }, { id: 0, usage: 'alarm', }, (error: BusinessError) => { if (error) { logger.error(`Failed to start vibration. Code: ${error.code}, message: ${error.message}`); return; } }); } catch (err) { logger.error(`An unexpected error occurred. Code: ${err.code}, message: ${err.message}`); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/vibrateeffect/src/main/ets/VibrateEffect.ets#L48-L67
9564cc1e989720382c673f770f10d83537c0ddeb
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/voice/opus/NodeOpusEngine.ets
arkts
应用约束48:显式声明构造函数参数类型
constructor(player: Object) { super(player); // 应用约束7:使用private代替#私有字段 // 应用约束18:移除构造函数参数中的字段声明 // 应用约束30:使用as进行类型转换 this.encoder = new (opus as any).OpusEncoder(this.samplingRate, this.channels); super.init(); }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left player : 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#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left super AST#expression#Right AST#argument_list#Left ( AST#expression#Left player AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 应用约束7:使用private代替#私有字段 // 应用约束18:移除构造函数参数中的字段声明 // 应用约束30:使用as进行类型转换 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 . encoder AST#member_expression#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 AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left opus AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#new_expression#Right AST#expression#Right . OpusEncoder 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 . samplingRate AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . channels 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left super AST#expression#Right . init 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#constructor_declaration#Right
constructor(player: Object) { super(player); this.encoder = new (opus as any).OpusEncoder(this.samplingRate, this.channels); super.init(); }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/voice/opus/NodeOpusEngine.ets#L11-L18
f6621540d1dcb9950708c39e039d1f6c76e247dd
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/HomePage.ets
arkts
GoodsListItem
商品列表项
@Builder GoodsListItem(goods: Goods) { Row({ space: AppDimensions.spaceMedium }) { Image(goods.mainPic) .width(100) .height(100) .borderRadius(AppDimensions.radiusSmall) .objectFit(ImageFit.Cover) Column({ space: AppDimensions.spaceSmall }) { Text(goods.name) .fontSize(AppTypography.fontSizeMedium) .fontColor(AppColors.textPrimary) .maxLines(2) .textOverflow({ overflow: TextOverflow.Ellipsis }) Row({ space: AppDimensions.spaceXSmall }) { Text(`¥${(goods.price / 100).toFixed(2)}`) .fontSize(AppTypography.fontSizeLarge) .fontColor(AppColors.price) .fontWeight(AppTypography.fontWeightBold) if (goods.originalPrice) { Text(`¥${(goods.originalPrice / 100).toFixed(2)}`) .fontSize(AppTypography.fontSizeSmall) .fontColor(AppColors.textTertiary) .decoration({ type: TextDecorationType.LineThrough }) } } if (goods.sales) { Text(`已售 ${goods.sales}`) .fontSize(AppTypography.fontSizeSmall) .fontColor(AppColors.textSecondary) } } .layoutWeight(1) .alignItems(HorizontalAlign.Start) } .width('100%') .backgroundColor(AppColors.surface) .borderRadius(AppDimensions.radiusMedium) .padding(AppDimensions.paddingMedium) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right GoodsListItem AST#parameter_list#Left ( AST#parameter#Left goods : AST#type_annotation#Left AST#primary_type#Left Goods 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 Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left AppDimensions AST#expression#Right . spaceMedium AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#member_expression#Left AST#expression#Left goods AST#expression#Right . mainPic AST#member_expression#Right AST#expression#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 100 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppDimensions AST#expression#Right . radiusSmall AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Cover AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left AppDimensions AST#expression#Right . spaceSmall AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left goods AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppTypography AST#expression#Right . fontSizeMedium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppColors AST#expression#Right . textPrimary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left 2 AST#expression#Right ) AST#modifier_chain_expression#Left . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Ellipsis AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left AppDimensions AST#expression#Right . spaceXSmall 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#template_literal#Left ` ¥ AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left goods AST#expression#Right . price AST#member_expression#Right AST#expression#Right / AST#expression#Left 100 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . toFixed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppTypography AST#expression#Right . fontSizeLarge AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppColors AST#expression#Right . price AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppTypography AST#expression#Right . fontWeightBold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left goods AST#expression#Right . originalPrice AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` ¥ AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left goods AST#expression#Right . originalPrice AST#member_expression#Right AST#expression#Right / AST#expression#Left 100 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . toFixed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppTypography AST#expression#Right . fontSizeSmall AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppColors AST#expression#Right . textTertiary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . decoration ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left type AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextDecorationType AST#expression#Right . LineThrough AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left goods AST#expression#Right . sales AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` 已售 AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left goods AST#expression#Right . sales AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppTypography AST#expression#Right . fontSizeSmall AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppColors AST#expression#Right . textSecondary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#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#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppColors AST#expression#Right . surface AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppDimensions AST#expression#Right . radiusMedium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppDimensions AST#expression#Right . paddingMedium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder GoodsListItem(goods: Goods) { Row({ space: AppDimensions.spaceMedium }) { Image(goods.mainPic) .width(100) .height(100) .borderRadius(AppDimensions.radiusSmall) .objectFit(ImageFit.Cover) Column({ space: AppDimensions.spaceSmall }) { Text(goods.name) .fontSize(AppTypography.fontSizeMedium) .fontColor(AppColors.textPrimary) .maxLines(2) .textOverflow({ overflow: TextOverflow.Ellipsis }) Row({ space: AppDimensions.spaceXSmall }) { Text(`¥${(goods.price / 100).toFixed(2)}`) .fontSize(AppTypography.fontSizeLarge) .fontColor(AppColors.price) .fontWeight(AppTypography.fontWeightBold) if (goods.originalPrice) { Text(`¥${(goods.originalPrice / 100).toFixed(2)}`) .fontSize(AppTypography.fontSizeSmall) .fontColor(AppColors.textTertiary) .decoration({ type: TextDecorationType.LineThrough }) } } if (goods.sales) { Text(`已售 ${goods.sales}`) .fontSize(AppTypography.fontSizeSmall) .fontColor(AppColors.textSecondary) } } .layoutWeight(1) .alignItems(HorizontalAlign.Start) } .width('100%') .backgroundColor(AppColors.surface) .borderRadius(AppDimensions.radiusMedium) .padding(AppDimensions.paddingMedium) }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/HomePage.ets#L295-L338
5008120c14577054f5a6f144d40546a87f32585e
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/Rect.ets
arkts
offsetTo
Offset the rectangle to a specific (left, top) position, keeping its width and height the same. @param newLeft The new "left" coordinate for the rectangle @param newTop The new "top" coordinate for the rectangle
public offsetTo(newLeft: number, newTop: number) { this.right += newLeft - this.left; this.bottom += newTop - this.top; this.left = newLeft; this.top = newTop; }
AST#method_declaration#Left public offsetTo AST#parameter_list#Left ( AST#parameter#Left newLeft : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left newTop : 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . right AST#member_expression#Right += AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left newLeft AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . left 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 . bottom AST#member_expression#Right += AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left newTop AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . top 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 . left AST#member_expression#Right = AST#expression#Left newLeft 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 . top AST#member_expression#Right = AST#expression#Left newTop AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public offsetTo(newLeft: number, newTop: number) { this.right += newLeft - this.left; this.bottom += newTop - this.top; this.left = newLeft; this.top = newTop; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/Rect.ets#L183-L188
480f749d38f365b4483c2f4ad5c34105670d5438
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/decompressfile/src/main/ets/model/FileListDataSource.ets
arkts
pushData
在数据尾部增加一个元素
public pushData(data: FileItem): void { this.fileList.push(data); this.notifyDataAdd(this.fileList.length - 1); }
AST#method_declaration#Left public pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left FileItem 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 . fileList 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 . fileList 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
public pushData(data: FileItem): void { this.fileList.push(data); this.notifyDataAdd(this.fileList.length - 1); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/decompressfile/src/main/ets/model/FileListDataSource.ets#L48-L51
4b180d9d33f35795cbecffc41ec669273e79a5c3
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_defaults.ets
arkts
Default fontSize_Icon_Button for HarmonyOS Symbols. Usually used on buttons, like linysSymbol. @returns 25
export function fontSize_Icon_Button() { return 25; }
AST#export_declaration#Left export AST#function_declaration#Left function fontSize_Icon_Button AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 25 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function fontSize_Icon_Button() { return 25; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_defaults.ets#L41-L43
66d7c275f7757e0417ae096b10e923373e01d160
gitee
Puiching-Memory/HOMOAPP_Q5.git
53e36a21984de7bf41b6fafc840fde013236b9d2
entry/src/main/ets/components/AudioCard.ets
arkts
getButtonIcon
获取按钮图标
private getButtonIcon(): Resource { switch (this.state) { case PlaybackState.PLAYING: return $r('sys.symbol.pause_fill'); case PlaybackState.LOADING: return $r('sys.symbol.arrow_clockwise'); default: return $r('sys.symbol.play_fill'); } }
AST#method_declaration#Left private getButtonIcon AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Resource 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 switch ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . state AST#member_expression#Right AST#expression#Right ) AST#container_content_body#Left { 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 PlaybackState AST#expression#Right . PLAYING AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.symbol.pause_fill' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#expression_statement#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 PlaybackState AST#expression#Right . LOADING AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.symbol.arrow_clockwise' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left default AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.symbol.play_fill' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
private getButtonIcon(): Resource { switch (this.state) { case PlaybackState.PLAYING: return $r('sys.symbol.pause_fill'); case PlaybackState.LOADING: return $r('sys.symbol.arrow_clockwise'); default: return $r('sys.symbol.play_fill'); } }
https://github.com/Puiching-Memory/HOMOAPP_Q5.git/blob/53e36a21984de7bf41b6fafc840fde013236b9d2/entry/src/main/ets/components/AudioCard.ets#L36-L45
10cb709a029a6bacc2a5fb10aa8b76b485731e59
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/BarChartModel.ets
arkts
calcMinMax
@Override
protected calcMinMax(): void { if (!this.mData) { return; } if (this.mXAxis) { if (this.mFitBars) { this.mXAxis.calculate(this.mData.getXMin() - this.mData.getBarWidth() / 2, this.mData.getXMax() + this.mData.getBarWidth() / 2); } else { this.mXAxis.calculate(this.mData.getXMin(), this.mData.getXMax()); } } // calculate axis range (min / max) according to provided data if (this.mAxisLeft) { this.mAxisLeft.calculate(this.mData.getYMin(AxisDependency.LEFT), this.mData.getYMax(AxisDependency.LEFT)); } if (this.mAxisRight) { this.mAxisRight.calculate(this.mData.getYMin(AxisDependency.RIGHT), this.mData.getYMax(AxisDependency.RIGHT)); } }
AST#method_declaration#Left protected calcMinMax AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . mData 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxis AST#member_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 this AST#expression#Right . mFitBars 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#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right . calculate 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 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#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getXMin AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getBarWidth 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 2 AST#expression#Right AST#binary_expression#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 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#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getXMax AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getBarWidth 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 2 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 else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right . calculate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getXMin 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 . mData AST#member_expression#Right AST#expression#Right . getXMax 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#block_statement#Right AST#if_statement#Right AST#statement#Right // calculate axis range (min / max) according to provided data AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisLeft 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#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right . calculate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getYMin AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AxisDependency AST#expression#Right . LEFT AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getYMax AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AxisDependency AST#expression#Right . LEFT 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#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 . mAxisRight 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#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right . calculate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getYMin AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AxisDependency AST#expression#Right . RIGHT AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getYMax AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AxisDependency AST#expression#Right . RIGHT 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#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
protected calcMinMax(): void { if (!this.mData) { return; } if (this.mXAxis) { if (this.mFitBars) { this.mXAxis.calculate(this.mData.getXMin() - this.mData.getBarWidth() / 2, this.mData.getXMax() + this.mData.getBarWidth() / 2); } else { this.mXAxis.calculate(this.mData.getXMin(), this.mData.getXMax()); } } if (this.mAxisLeft) { this.mAxisLeft.calculate(this.mData.getYMin(AxisDependency.LEFT), this.mData.getYMax(AxisDependency.LEFT)); } if (this.mAxisRight) { this.mAxisRight.calculate(this.mData.getYMin(AxisDependency.RIGHT), this.mData.getYMax(AxisDependency.RIGHT)); } }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/BarChartModel.ets#L93-L111
05ee9718f164b256f6b8197cfc5b4c71b9fca3f1
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
LoadPerformanceInWeb/entry/src/main/ets/pages/common.ets
arkts
Used to control and feedback the behavior of nodes on the corresponding NodeContainer, which needs to be used together with NodeContainer
export class MyNodeController extends NodeController { private rootNode: BuilderNode<Data[]> | null = null; private root: FrameNode | null = null; private rootWebviewController: webview.WebviewController | null = null; // The method that must be overridden is used to build the number of nodes and return the nodes to be mounted in the corresponding NodeContainer. // //Called when the corresponding NodeContainer is created, or refreshed by calling the rebuild method. makeNode(uiContext: UIContext): FrameNode | null { console.info(' uicontext is undefined : ' + (uiContext === undefined)); try { if (this.rootNode != null) { const parent: FrameNode = this.rootNode.getFrameNode()?.getParent() as FrameNode; if (parent) { console.info(JSON.stringify(parent.getInspectorInfo())); parent.removeChild(this.rootNode.getFrameNode()); this.root = null; } this.root = new FrameNode(uiContext); this.root.appendChild(this.rootNode.getFrameNode()); // Returns the FrameNode node return this.root; } // Returns a null node that controls the dynamic component to be unbound. return null; } catch (error) { return null; } } // Callback when layout size changes. aboutToResize(size: Size): void { console.info('aboutToResize width : ' + size.width + ' height : ' + size.height); } // Call back when the NodeContainer corresponding to the controller is in Appear. aboutToAppear(): void { console.info('aboutToAppear'); } // Call back when the NodeContainer corresponding to the controller is Disappear. aboutToDisappear(): void { console.info('aboutToDisappear'); } // This function is a user-defined function and can be used as an initialization function. // Initialize builderNode through UIContext, and then initialize the contents in @Builder through the Build interface in BuilderNode. initWeb(url: string, uiContext: UIContext, control: WebviewController): void { if (this.rootNode != null) { return; } // Bind the pre-created WebviewController this.rootWebviewController = control; // Creating a node requires uiContext. this.rootNode = new BuilderNode(uiContext); // Create dynamic Web components this.rootNode.build(wrapBuilder<Data[]>(webBuilder), { url: url, controller: control }); } // This function is a user-defined function and can be used as an initialization function. loadUrl(url: string): void { if (this.rootWebviewController !== null) { try { // Reuse the pre-created components and reload the url. this.rootWebviewController.loadUrl(url); } catch (error) { hilog.info(0x0000, 'testTag', '%{public}s', 'loadUrl fail'); } } } }
AST#export_declaration#Left export AST#class_declaration#Left class MyNodeController extends AST#type_annotation#Left AST#primary_type#Left NodeController AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private rootNode : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left BuilderNode AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Data [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right | AST#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 private root : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left FrameNode 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 private rootWebviewController : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left webview . WebviewController AST#qualified_type#Right 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 // The method that must be overridden is used to build the number of nodes and return the nodes to be mounted in the corresponding NodeContainer. // //Called when the corresponding NodeContainer is created, or refreshed by calling the rebuild method. AST#method_declaration#Left makeNode AST#parameter_list#Left ( AST#parameter#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left FrameNode 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left ' uicontext is undefined : ' AST#expression#Right + AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left uiContext AST#expression#Right === AST#expression#Left undefined 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#expression_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rootNode AST#member_expression#Right AST#expression#Right != AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left parent : AST#type_annotation#Left AST#primary_type#Left FrameNode AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rootNode AST#member_expression#Right AST#expression#Right . getFrameNode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?. getParent 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 FrameNode 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 parent 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 console AST#expression#Right . info 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 JSON AST#expression#Right . stringify 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 parent AST#expression#Right . getInspectorInfo 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#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 parent AST#expression#Right . removeChild AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rootNode AST#member_expression#Right AST#expression#Right . getFrameNode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . root AST#member_expression#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 . root AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left FrameNode AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uiContext 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . root AST#member_expression#Right AST#expression#Right . appendChild AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rootNode AST#member_expression#Right AST#expression#Right . getFrameNode 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 // Returns the FrameNode node AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . root 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 // Returns a null node that controls the dynamic component to be unbound. AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // Callback when layout size changes. AST#method_declaration#Left aboutToResize AST#parameter_list#Left ( AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left Size AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'aboutToResize width : ' AST#expression#Right + AST#expression#Left size AST#expression#Right AST#binary_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right + AST#expression#Left ' height : ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left size AST#expression#Right AST#binary_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right // Call back when the NodeContainer corresponding to the controller is in Appear. 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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'aboutToAppear' 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 // Call back when the NodeContainer corresponding to the controller is Disappear. AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'aboutToDisappear' 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 // This function is a user-defined function and can be used as an initialization function. // Initialize builderNode through UIContext, and then initialize the contents in @Builder through the Build interface in BuilderNode. AST#method_declaration#Left initWeb 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 uiContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left control : AST#type_annotation#Left AST#primary_type#Left WebviewController AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rootNode AST#member_expression#Right AST#expression#Right != AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // Bind the pre-created WebviewController 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 . rootWebviewController AST#member_expression#Right = AST#expression#Left control AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Creating a node requires uiContext. 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 . rootNode AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left BuilderNode AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uiContext 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 // Create dynamic Web components 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 . rootNode AST#member_expression#Right AST#expression#Right . build AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Data [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left webBuilder AST#expression#Right ) 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 url AST#property_name#Right : AST#expression#Left url AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left controller AST#property_name#Right : AST#expression#Left control 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#method_declaration#Right // This function is a user-defined function and can be used as an initialization function. AST#method_declaration#Left loadUrl 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#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rootWebviewController AST#member_expression#Right AST#expression#Right !== AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // Reuse the pre-created components and reload the url. 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 . rootWebviewController 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#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 . 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 'loadUrl fail' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class MyNodeController extends NodeController { private rootNode: BuilderNode<Data[]> | null = null; private root: FrameNode | null = null; private rootWebviewController: webview.WebviewController | null = null; makeNode(uiContext: UIContext): FrameNode | null { console.info(' uicontext is undefined : ' + (uiContext === undefined)); try { if (this.rootNode != null) { const parent: FrameNode = this.rootNode.getFrameNode()?.getParent() as FrameNode; if (parent) { console.info(JSON.stringify(parent.getInspectorInfo())); parent.removeChild(this.rootNode.getFrameNode()); this.root = null; } this.root = new FrameNode(uiContext); this.root.appendChild(this.rootNode.getFrameNode()); return this.root; } return null; } catch (error) { return null; } } aboutToResize(size: Size): void { console.info('aboutToResize width : ' + size.width + ' height : ' + size.height); } aboutToAppear(): void { console.info('aboutToAppear'); } aboutToDisappear(): void { console.info('aboutToDisappear'); } initWeb(url: string, uiContext: UIContext, control: WebviewController): void { if (this.rootNode != null) { return; } this.rootWebviewController = control; this.rootNode = new BuilderNode(uiContext); this.rootNode.build(wrapBuilder<Data[]>(webBuilder), { url: url, controller: control }); } loadUrl(url: string): void { if (this.rootWebviewController !== null) { try { this.rootWebviewController.loadUrl(url); } catch (error) { hilog.info(0x0000, 'testTag', '%{public}s', 'loadUrl fail'); } } } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LoadPerformanceInWeb/entry/src/main/ets/pages/common.ets#L34-L103
f9ef8c0426e84bec7929aa6bad1d9fc9d55b5084
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
picker_utils/src/main/ets/PickerUtil.ets
arkts
saveAudio
通过保存模式拉起audioPicker界面(目前拉起的是documentPicker,audioPicker在规划中),用户可以保存一个或多个音频文件。 @param newFileNames 拉起audioPicker进行保存音频资源的文件名,若无此参数,则默认需要用户自行输入。 @returns 返回保存文件的uri数组。
static async saveAudio(newFileNames?: Array<string>): Promise<Array<string>> { const audioPicker = new picker.AudioViewPicker(getContext()); const audioSaveOptions = new picker.AudioSaveOptions(); if (newFileNames !== undefined && newFileNames.length > 0) { audioSaveOptions.newFileNames = newFileNames; } return audioPicker.save(audioSaveOptions); }
AST#method_declaration#Left static async saveAudio AST#parameter_list#Left ( AST#parameter#Left newFileNames ? : 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 string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left audioPicker = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left picker AST#expression#Right AST#new_expression#Right AST#expression#Right . AudioViewPicker AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left getContext 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 const AST#variable_declarator#Left audioSaveOptions = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left picker AST#expression#Right AST#new_expression#Right AST#expression#Right . AudioSaveOptions AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left newFileNames AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left newFileNames 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#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left audioSaveOptions AST#expression#Right . newFileNames AST#member_expression#Right = AST#expression#Left newFileNames AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left audioPicker AST#expression#Right . save AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left audioSaveOptions AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async saveAudio(newFileNames?: Array<string>): Promise<Array<string>> { const audioPicker = new picker.AudioViewPicker(getContext()); const audioSaveOptions = new picker.AudioSaveOptions(); if (newFileNames !== undefined && newFileNames.length > 0) { audioSaveOptions.newFileNames = newFileNames; } return audioPicker.save(audioSaveOptions); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/PickerUtil.ets#L169-L176
0f16a952718055190f0c5e5587f877c8f26bac02
gitee
jerryzhou2/ArkTS-news-app.git
6dfa8631948f1def4269be5a48554b99ee64a18d
fluent-news-homepage-master/entry/src/main/ets/viewmodel/NewsDataSource.ets
arkts
notifyDataDelete
Notify the LazyForEach component that the subcomponent needs to be deleted from the index corresponding to the index.
notifyDataDelete(index: number): void { this.listeners.forEach(listener => { listener.onDataDelete(index); }) }
AST#method_declaration#Left notifyDataDelete AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left listener => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onDataDelete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
notifyDataDelete(index: number): void { this.listeners.forEach(listener => { listener.onDataDelete(index); }) }
https://github.com/jerryzhou2/ArkTS-news-app.git/blob/6dfa8631948f1def4269be5a48554b99ee64a18d/fluent-news-homepage-master/entry/src/main/ets/viewmodel/NewsDataSource.ets#L81-L85
da0d59cca48d7d7189130f59bcfd382762308250
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
setValueFormatter
Sets the formatter to be used for formatting the axis labels. If no formatter is set, the chart will automatically determine a reasonable formatting (concerning decimals) for all the values that are drawn inside the chart. Use chart.getDefaultValueFormatter() to use the formatter calculated by the chart. @param f
public setValueFormatter(f: IAxisValueFormatter): void { if (!f || f == null) this.mAxisValueFormatter = new DefaultAxisValueFormatter(this.mDecimals); else this.mAxisValueFormatter = f; }
AST#method_declaration#Left public setValueFormatter AST#parameter_list#Left ( AST#parameter#Left f : AST#type_annotation#Left AST#primary_type#Left IAxisValueFormatter AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left f AST#expression#Right AST#unary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left f AST#expression#Right == AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#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 . mAxisValueFormatter AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left DefaultAxisValueFormatter 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 . mDecimals 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 else 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 . mAxisValueFormatter AST#member_expression#Right = AST#expression#Left f AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public setValueFormatter(f: IAxisValueFormatter): void { if (!f || f == null) this.mAxisValueFormatter = new DefaultAxisValueFormatter(this.mDecimals); else this.mAxisValueFormatter = f; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L553-L559
1b2ee147f29c8d28653c25bc8bfe81da7442507c
gitee
wustcat404/time-bar
d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8
entry/src/main/ets/components/VideoView.ets
arkts
onTimeUpdate
Timeline middle line change (when user is dragging). This method is the key place to keep the player and the time bar in sync. It also includes the fix for 'jumping back to the start at the absolute end'. @param _changedPropertyName State property name (unused).
onTimeUpdate(_changedPropertyName: string) { if (!this.controller) { return; } if (!this.videosInfo || (this.videosInfo && this.videosInfo.length === 0)) { return; } // Respond only when the time bar is actively dragged by the user if (PlayStatus.PLAYING !== this.timeBarStatus) { return; } const now = Date.now(); // Refresh suppression window to prevent the player from auto-pushing time bar during drag this.suppressAutoSyncUntil = now + DEFAULT_SUPPRESS_SYNC_MS; const baseMs = this.initialTime; const totalTimelineMs = this.totalTimelineMs || 0; const rawOffset = (this.curTime ?? baseMs) - baseMs; // relative offset (ms) const clampedOffset = clamp(rawOffset, 0, totalTimelineMs); // Locate the segment index (timeline includes gaps) const info = findSegmentIndexByTimeline(this.timelineOffsets ?? [], this.videosInfo, clampedOffset); // Segment changed -> switch source; wait for onPrepared to do accurate seek if (info.index !== -1 && this.curIndex !== info.index) { this.curIndex = info.index; this.isAutoPlay = true; this.isVideoLoading = true; this.pendingSeekSec = null; // reset; will be recalculated below this.oldTime = baseMs + (this.timelineOffsets?.[this.curIndex] ?? 0); } // Detect 'absolute end of the timeline' const playEnd = (this.curIndex === this.videosInfo.length - 1) && (clampedOffset === totalTimelineMs); // Compute in-segment progress (seconds) const segStartMs = this.timelineOffsets?.[this.curIndex] ?? 0; const segDurMs = Number(this.videosInfo[this.curIndex]?.duration) || 0; let videoProgressSec = 0; if (playEnd) { // FIX: when dragging to the absolute end, hold the last frame (duration - epsilon) and pause videoProgressSec = Math.max(0, segDurMs / 1000 - END_EPSILON_SEC); } else if (!info.inGap) { // Normal in-segment preview videoProgressSec = clamp((clampedOffset - segStartMs) / 1000, 0, segDurMs / 1000); } else { // Offset falls into a gap between segments -> snap to the head of the next segment videoProgressSec = 0; } if (this.isVideoLoading || this.durationTime === 0) { // Not prepared yet — cache pending seek this.pendingSeekSec = videoProgressSec; } else { this.controller.setCurrentTime(videoProgressSec, SeekMode.Accurate); } // Playback control during active drag preview if (playEnd) { // Pause and disable auto play to avoid bouncing this.controller.pause(); this.isPlay = false; this.isAutoPlay = false; this.isVideoLoading = false; // Keep suppression to avoid auto-push jitter this.suppressAutoSyncUntil = Date.now() + DEFAULT_SUPPRESS_SYNC_MS; } else { // For other positions, ensure preview is running (decode frames) if (!this.isPlay) { this.controller.start(); this.isPlay = true; } } }
AST#method_declaration#Left onTimeUpdate AST#parameter_list#Left ( AST#parameter#Left _changedPropertyName : 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#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . controller 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . videosInfo 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . videosInfo AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . videosInfo 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#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // Respond only when the time bar is actively dragged by the user 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 PlayStatus AST#expression#Right . PLAYING AST#member_expression#Right AST#expression#Right !== AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . timeBarStatus 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#variable_declaration#Left const AST#variable_declarator#Left now = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // Refresh suppression window to prevent the player from auto-pushing time bar during drag 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 . suppressAutoSyncUntil AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left now AST#expression#Right + AST#expression#Left DEFAULT_SUPPRESS_SYNC_MS AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left baseMs = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . initialTime AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left totalTimelineMs = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . totalTimelineMs AST#member_expression#Right AST#expression#Right || AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left rawOffset = 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#member_expression#Left AST#expression#Left this AST#expression#Right . curTime AST#member_expression#Right AST#expression#Right ?? AST#expression#Left baseMs AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right - AST#expression#Left baseMs AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // relative offset (ms) AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left clampedOffset = AST#expression#Left AST#call_expression#Left AST#expression#Left clamp AST#expression#Right AST#argument_list#Left ( AST#expression#Left rawOffset AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left totalTimelineMs 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 // Locate the segment index (timeline includes gaps) AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left info = AST#expression#Left AST#call_expression#Left AST#expression#Left findSegmentIndexByTimeline AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timelineOffsets AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . videosInfo AST#member_expression#Right AST#expression#Right , AST#expression#Left clampedOffset 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 // Segment changed -> switch source; wait for onPrepared to do accurate seek AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left info AST#expression#Right . index AST#member_expression#Right AST#expression#Right !== AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . curIndex AST#member_expression#Right AST#expression#Right !== AST#expression#Left info AST#expression#Right AST#binary_expression#Right AST#expression#Right . index 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 . curIndex AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left info AST#expression#Right . index 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 . isAutoPlay 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isVideoLoading 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pendingSeekSec AST#member_expression#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // reset; will be recalculated below 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 . oldTime AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left baseMs 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 . timelineOffsets AST#member_expression#Right AST#expression#Right ?. [ AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . curIndex AST#member_expression#Right 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#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // Detect 'absolute end of the timeline' AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left playEnd = 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#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 this AST#expression#Right . curIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . videosInfo 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#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left clampedOffset AST#expression#Right === AST#expression#Left totalTimelineMs 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 // Compute in-segment progress (seconds) AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left segStartMs = 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 . timelineOffsets AST#member_expression#Right AST#expression#Right ?. [ AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . curIndex AST#member_expression#Right 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left segDurMs = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#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 . videosInfo AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . curIndex AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ?. duration AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left videoProgressSec = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left playEnd AST#expression#Right ) AST#block_statement#Left { // FIX: when dragging to the absolute end, hold the last frame (duration - epsilon) and pause AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left videoProgressSec = 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 0 AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left segDurMs AST#expression#Right / AST#expression#Left 1000 AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left END_EPSILON_SEC AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left info AST#expression#Right AST#unary_expression#Right AST#expression#Right . inGap AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // Normal in-segment preview AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left videoProgressSec = AST#expression#Left AST#call_expression#Left AST#expression#Left clamp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left clampedOffset AST#expression#Right - AST#expression#Left segStartMs AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left 1000 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 segDurMs AST#expression#Right / AST#expression#Left 1000 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { // Offset falls into a gap between segments -> snap to the head of the next segment AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left videoProgressSec = AST#expression#Left 0 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#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 . isVideoLoading AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . durationTime 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 { // Not prepared yet — cache pending seek 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 . pendingSeekSec AST#member_expression#Right = AST#expression#Left videoProgressSec 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#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 . setCurrentTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left videoProgressSec AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left SeekMode AST#expression#Right . Accurate 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 // Playback control during active drag preview AST#statement#Left AST#if_statement#Left if ( AST#expression#Left playEnd AST#expression#Right ) AST#block_statement#Left { // Pause and disable auto play to avoid bouncing 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 . pause AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPlay 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isAutoPlay 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isVideoLoading 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 // Keep suppression to avoid auto-push jitter 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 . suppressAutoSyncUntil AST#member_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 Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left DEFAULT_SUPPRESS_SYNC_MS 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 else AST#block_statement#Left { // For other positions, ensure preview is running (decode frames) AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . isPlay 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#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right . start AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPlay 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#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
onTimeUpdate(_changedPropertyName: string) { if (!this.controller) { return; } if (!this.videosInfo || (this.videosInfo && this.videosInfo.length === 0)) { return; } if (PlayStatus.PLAYING !== this.timeBarStatus) { return; } const now = Date.now(); this.suppressAutoSyncUntil = now + DEFAULT_SUPPRESS_SYNC_MS; const baseMs = this.initialTime; const totalTimelineMs = this.totalTimelineMs || 0; const rawOffset = (this.curTime ?? baseMs) - baseMs; const clampedOffset = clamp(rawOffset, 0, totalTimelineMs); const info = findSegmentIndexByTimeline(this.timelineOffsets ?? [], this.videosInfo, clampedOffset); if (info.index !== -1 && this.curIndex !== info.index) { this.curIndex = info.index; this.isAutoPlay = true; this.isVideoLoading = true; this.pendingSeekSec = null; this.oldTime = baseMs + (this.timelineOffsets?.[this.curIndex] ?? 0); } const playEnd = (this.curIndex === this.videosInfo.length - 1) && (clampedOffset === totalTimelineMs); const segStartMs = this.timelineOffsets?.[this.curIndex] ?? 0; const segDurMs = Number(this.videosInfo[this.curIndex]?.duration) || 0; let videoProgressSec = 0; if (playEnd) { videoProgressSec = Math.max(0, segDurMs / 1000 - END_EPSILON_SEC); } else if (!info.inGap) { videoProgressSec = clamp((clampedOffset - segStartMs) / 1000, 0, segDurMs / 1000); } else { videoProgressSec = 0; } if (this.isVideoLoading || this.durationTime === 0) { this.pendingSeekSec = videoProgressSec; } else { this.controller.setCurrentTime(videoProgressSec, SeekMode.Accurate); } if (playEnd) { this.controller.pause(); this.isPlay = false; this.isAutoPlay = false; this.isVideoLoading = false; this.suppressAutoSyncUntil = Date.now() + DEFAULT_SUPPRESS_SYNC_MS; } else { if (!this.isPlay) { this.controller.start(); this.isPlay = true; } } }
https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/entry/src/main/ets/components/VideoView.ets#L238-L315
bf936a1ed2513c8f09d914f8ba6c5e2ce907c8ac
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/todo/TodoEditPage.ets
arkts
aboutToAppear
页面生命周期 - 即将出现
aboutToAppear() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'TodoEditPage aboutToAppear'); // 获取路由参数 const params = appRouter.getCurrentParams(); const paramsRecord = params as Record<string, string>; if (paramsRecord.id) { // 编辑模式 this.editMode = true; this.todoId = paramsRecord.id; this.loadTodo(); } else if (paramsRecord.date) { // 创建模式,带默认日期 this.date = paramsRecord.date; } else { // 创建模式,默认今天 this.date = DateUtils.formatDate(new Date()); } }
AST#method_declaration#Left aboutToAppear 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 AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left 'TodoEditPage aboutToAppear' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 获取路由参数 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left params = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left appRouter AST#expression#Right . getCurrentParams 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 paramsRecord = AST#expression#Left AST#as_expression#Left AST#expression#Left params 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 paramsRecord AST#expression#Right . id 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 . editMode 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . todoId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left paramsRecord AST#expression#Right . id AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loadTodo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left paramsRecord AST#expression#Right . date 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 . date AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left paramsRecord AST#expression#Right . date 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 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 . date AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateUtils AST#expression#Right . formatDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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#method_declaration#Right
aboutToAppear() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'TodoEditPage aboutToAppear'); const params = appRouter.getCurrentParams(); const paramsRecord = params as Record<string, string>; if (paramsRecord.id) { this.editMode = true; this.todoId = paramsRecord.id; this.loadTodo(); } else if (paramsRecord.date) { this.date = paramsRecord.date; } else { this.date = DateUtils.formatDate(new Date()); } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/todo/TodoEditPage.ets#L58-L77
84e381447119e4165205911ea739a6be0410bf23
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
validator/acts_validator/entry/src/main/ets/pages/Camera/CameraPreviewFormat.ets
arkts
dealWithResolutionFn
对分辨率数据处理 获取到需要的格式
dealWithResolutionFn(arr: ResolutionItem[]) { let newResolution : Obj[]= [] arr.forEach((item) => { let indexOf = item.value.indexOf("x") if (indexOf !== -1) { let objW = Number(item.value.slice(0, indexOf)) let objH = Number(item.value.slice(indexOf + 1)) let obj: Obj = { format: 1003, size: { width: objW, height: objH } } newResolution.push(obj) } }) return newResolution }
AST#method_declaration#Left dealWithResolutionFn AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ResolutionItem [ ] AST#array_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 newResolution : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Obj [ ] AST#array_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#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#ERROR#Left arr AST#ERROR#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#variable_declaration#Left let AST#variable_declarator#Left indexOf = 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 . value AST#member_expression#Right AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "x" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left indexOf AST#expression#Right !== AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left objW = AST#expression#Left AST#call_expression#Left AST#expression#Left Number 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 item AST#expression#Right . value AST#member_expression#Right AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left indexOf AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left objH = AST#expression#Left AST#call_expression#Left AST#expression#Left Number 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 item AST#expression#Right . value AST#member_expression#Right AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left indexOf 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#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 obj : AST#type_annotation#Left AST#primary_type#Left Obj AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left format AST#property_name#Right : AST#expression#Left 1003 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left objW AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left objH AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newResolution AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left obj 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#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left newResolution AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
dealWithResolutionFn(arr: ResolutionItem[]) { let newResolution : Obj[]= [] arr.forEach((item) => { let indexOf = item.value.indexOf("x") if (indexOf !== -1) { let objW = Number(item.value.slice(0, indexOf)) let objH = Number(item.value.slice(indexOf + 1)) let obj: Obj = { format: 1003, size: { width: objW, height: objH } } newResolution.push(obj) } }) return newResolution }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/validator/acts_validator/entry/src/main/ets/pages/Camera/CameraPreviewFormat.ets#L132-L150
4b27a7dd09382bc79fb06a76599e028b37582ca7
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildBanAdd.ets
arkts
Emitted whenever a member is banned from a guild. @event Client#guildBanAdd @param {Guild} guild The guild that the ban occurred in @param {User} user The user that was banned 应用约束60: 使用export代替module.exports
export default GuildBanAddHandler;
AST#export_declaration#Left export default AST#expression#Left GuildBanAddHandler AST#expression#Right ; AST#export_declaration#Right
export default GuildBanAddHandler;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildBanAdd.ets#L28-L28
3d80c6092fce662b87fc42fe39aea98d564c775a
github
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
src/main/ets/ffmpeg/TaskConfig.ets
arkts
isUseHardwareDecoder
==================== Getters ====================
public isUseHardwareDecoder(): boolean { return this.useHardwareDecoder; }
AST#method_declaration#Left public isUseHardwareDecoder AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . useHardwareDecoder AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public isUseHardwareDecoder(): boolean { return this.useHardwareDecoder; }
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/TaskConfig.ets#L31-L33
cc531412edecb45ea09590284ab135e64822bea3
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/PieChartModel.ets
arkts
onDraw
@Override
public onDraw(canvas: CanvasRenderingContext2D): void { super.onDraw(canvas); if (this.mData == null) return; this.mRenderer?.drawData(canvas); if (this.valuesToHighlight() && this.mIndicesToHighlight) { this.mRenderer?.drawHighlighted(canvas, this.mIndicesToHighlight); } this.mRenderer?.drawExtras(canvas); this.mRenderer?.drawValues(canvas); this.mLegendRenderer?.renderLegend(canvas); this.drawDescription(canvas); this.drawMarkers(canvas); }
AST#method_declaration#Left public onDraw AST#parameter_list#Left ( AST#parameter#Left canvas : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left super AST#expression#Right . onDraw AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left canvas 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 this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right == AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#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 . mRenderer AST#member_expression#Right AST#expression#Right ?. drawData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left canvas 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 AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . valuesToHighlight AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mIndicesToHighlight 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#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right ?. drawHighlighted AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left canvas AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mIndicesToHighlight AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right ?. drawExtras AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left canvas 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 . mRenderer AST#member_expression#Right AST#expression#Right ?. drawValues AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left canvas 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 . mLegendRenderer AST#member_expression#Right AST#expression#Right ?. renderLegend AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left canvas 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 . drawDescription AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left canvas 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 . drawMarkers AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left canvas AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public onDraw(canvas: CanvasRenderingContext2D): void { super.onDraw(canvas); if (this.mData == null) return; this.mRenderer?.drawData(canvas); if (this.valuesToHighlight() && this.mIndicesToHighlight) { this.mRenderer?.drawHighlighted(canvas, this.mIndicesToHighlight); } this.mRenderer?.drawExtras(canvas); this.mRenderer?.drawValues(canvas); this.mLegendRenderer?.renderLegend(canvas); this.drawDescription(canvas); this.drawMarkers(canvas); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L134-L154
3930d36f553a3b63f3165544cdfc65e66fa5b486
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/LLMConfigManager.ets
arkts
getHttpErrorMessage
获取HTTP错误信息
private getHttpErrorMessage(code: number): string { switch (code) { case 400: return '请求参数错误'; case 401: return 'API密钥无效或已过期'; case 403: return '访问被拒绝,请检查权限'; case 404: return 'API地址不存在'; case 429: return '请求频率过高,已被限流'; case 500: return '服务器内部错误'; case 502: return '网关错误'; case 503: return '服务暂时不可用'; case 504: return '请求超时'; default: return `未知错误 (${code})`; } }
AST#method_declaration#Left private getHttpErrorMessage 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_list#Right : AST#type_annotation#Left AST#primary_type#Left string 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 switch ( AST#expression#Left code AST#expression#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left 400 AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '请求参数错误' AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left 401 AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left 'API密钥无效或已过期' AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left 403 AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '访问被拒绝,请检查权限' AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left 404 AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left 'API地址不存在' AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left 429 AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '请求频率过高,已被限流' AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left 500 AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '服务器内部错误' AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left 502 AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '网关错误' AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left 503 AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '服务暂时不可用' AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left 504 AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '请求超时' AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left default AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#template_literal#Left ` 未知错误 ( AST#template_substitution#Left $ { AST#expression#Left code AST#expression#Right } AST#template_substitution#Right ) ` AST#template_literal#Right AST#expression#Right ; AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
private getHttpErrorMessage(code: number): string { switch (code) { case 400: return '请求参数错误'; case 401: return 'API密钥无效或已过期'; case 403: return '访问被拒绝,请检查权限'; case 404: return 'API地址不存在'; case 429: return '请求频率过高,已被限流'; case 500: return '服务器内部错误'; case 502: return '网关错误'; case 503: return '服务暂时不可用'; case 504: return '请求超时'; default: return `未知错误 (${code})`; } }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/LLMConfigManager.ets#L682-L705
5976df75699e71a22620c64e518eb108851701c3
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets
arkts
staticClear
Called when a cleanup occurs. @since 7 @deprecated since 9 @useinstead AppStorage.Clear
static staticClear(): boolean { return AppStorage.clear() }
AST#method_declaration#Left static staticClear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . clear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static staticClear(): boolean { return AppStorage.clear() }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L214-L216
a4d031068f62cea47131e9cebcecf68c86ca1319
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_component_seven/ace_ets_component_common_seven_attrs_brightness/entry/src/main/ets/MainAbility/view/offset/ListItemGroupView.ets
arkts
ListItemGroupView
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.
@Component export struct ListItemGroupView { @Link _offset: Position; private componentKey: string; private parentWidth: number; private parentHeight: number; private subassemblyWidth: number; private subassemblyHeight: number; private parentComponentKey: string; private referenceComponentKey: string; private projects: string[] = ['Chinese', 'mathematics', 'English'] @Builder itemHead(text: string) { Text(text) .fontSize(20) .backgroundColor(0xAABBCC) .width('100%') .padding(10) } @Builder itemFoot(num: number) { Text('have ' + num + 'classes') .fontSize(16) .backgroundColor(0xAABBCC) .width('100%') .padding(5) } @Builder content(project: string) { Text(project) .width('100%') .height(100) .fontSize(20) .textAlign(TextAlign.Center) .backgroundColor(0xFFFFFF) } build() { List({ space: 20 }) { ListItemGroup({ header: this.itemHead('Monday'), footer: this.itemFoot(this.projects.length) }) { ForEach(this.projects, (project) => { ListItem() { this.content(project) } }, item => item) } .width(this.subassemblyWidth) .height(this.subassemblyHeight) .borderRadius(20) .offset(this._offset) .key(this.componentKey) .divider({ strokeWidth: 1, color: Color.Blue }) // line of demarcation ListItemGroup({ header: this.itemHead('Tuesday'), footer: this.itemFoot(this.projects.length) }) { ForEach(this.projects, (project) => { ListItem() { this.content(project) } }, item => item) } .borderRadius(20) .key(this.referenceComponentKey) .divider({ strokeWidth: 1, color: Color.Blue }) // line of demarcation } .width(this.parentWidth) .height(this.parentHeight) .key(this.parentComponentKey) .sticky(StickyStyle.Header | StickyStyle.Footer) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ListItemGroupView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right _offset : AST#type_annotation#Left AST#primary_type#Left Position AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private componentKey : 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 parentWidth : 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 parentHeight : 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 subassemblyWidth : 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 subassemblyHeight : 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 parentComponentKey : 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 referenceComponentKey : 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 projects : 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 'Chinese' AST#expression#Right , AST#expression#Left 'mathematics' AST#expression#Right , AST#expression#Left 'English' AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_declaration#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right itemHead AST#parameter_list#Left ( AST#parameter#Left text : 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left text 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 . backgroundColor ( AST#expression#Left 0xAABBCC AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 10 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 AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right itemFoot AST#parameter_list#Left ( AST#parameter#Left num : 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#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#binary_expression#Left AST#expression#Left 'have ' AST#expression#Right + AST#expression#Left num AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left 'classes' AST#expression#Right AST#binary_expression#Right 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 . backgroundColor ( AST#expression#Left 0xAABBCC AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 5 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 AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right content AST#parameter_list#Left ( AST#parameter#Left project : 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left project AST#expression#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 100 AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 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 . backgroundColor ( AST#expression#Left 0xFFFFFF 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 AST#build_method#Left build ( ) AST#build_body#Left { 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 20 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 ListItemGroup ( AST#component_parameters#Left { AST#component_parameter#Left header : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemHead AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Monday' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left footer : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemFoot 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 . projects 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#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 . projects AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left project 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left project 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#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left item => AST#expression#Left item AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . subassemblyWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . subassemblyHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . offset ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _offset AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . componentKey AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . divider ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left strokeWidth AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Blue AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // line of demarcation AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItemGroup ( AST#component_parameters#Left { AST#component_parameter#Left header : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemHead AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Tuesday' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left footer : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemFoot 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 . projects 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#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 . projects AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left project 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left project 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#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left item => AST#expression#Left item AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . referenceComponentKey AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . divider ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left strokeWidth AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Blue AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // line of demarcation } 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 this AST#expression#Right . parentWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentComponentKey AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . sticky ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StickyStyle AST#expression#Right . Header AST#member_expression#Right AST#expression#Right | AST#expression#Left StickyStyle AST#expression#Right AST#binary_expression#Right AST#expression#Right . Footer 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#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct ListItemGroupView { @Link _offset: Position; private componentKey: string; private parentWidth: number; private parentHeight: number; private subassemblyWidth: number; private subassemblyHeight: number; private parentComponentKey: string; private referenceComponentKey: string; private projects: string[] = ['Chinese', 'mathematics', 'English'] @Builder itemHead(text: string) { Text(text) .fontSize(20) .backgroundColor(0xAABBCC) .width('100%') .padding(10) } @Builder itemFoot(num: number) { Text('have ' + num + 'classes') .fontSize(16) .backgroundColor(0xAABBCC) .width('100%') .padding(5) } @Builder content(project: string) { Text(project) .width('100%') .height(100) .fontSize(20) .textAlign(TextAlign.Center) .backgroundColor(0xFFFFFF) } build() { List({ space: 20 }) { ListItemGroup({ header: this.itemHead('Monday'), footer: this.itemFoot(this.projects.length) }) { ForEach(this.projects, (project) => { ListItem() { this.content(project) } }, item => item) } .width(this.subassemblyWidth) .height(this.subassemblyHeight) .borderRadius(20) .offset(this._offset) .key(this.componentKey) .divider({ strokeWidth: 1, color: Color.Blue }) ListItemGroup({ header: this.itemHead('Tuesday'), footer: this.itemFoot(this.projects.length) }) { ForEach(this.projects, (project) => { ListItem() { this.content(project) } }, item => item) } .borderRadius(20) .key(this.referenceComponentKey) .divider({ strokeWidth: 1, color: Color.Blue }) } .width(this.parentWidth) .height(this.parentHeight) .key(this.parentComponentKey) .sticky(StickyStyle.Header | StickyStyle.Footer) } }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_seven/ace_ets_component_common_seven_attrs_brightness/entry/src/main/ets/MainAbility/view/offset/ListItemGroupView.ets#L16-L85
92c9ce9a044949fcab4759bcb1f6d9b33f12b641
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Card/StepsCardJS/entry/src/main/ets/entryformability/EntryFormAbility.ets
arkts
updateSensorData
Update Steps.
updateSensorData() { // Get today's steps. DatabaseUtils.createRdbStore(this.context).then((rdbStore: Object | undefined) => { if (!rdbStore) { Logger.error(CommonConstants.ENTRY_FORM_ABILITY_TAG, 'update sensor data rdbStore is null'); return; } let getSensorData: Promise<SensorData> = DatabaseUtils.getSensorData(rdbStore as DataRdb.RdbStore, DateUtils.getDate(0)); getSensorData.then((sensorData: SensorData) => { let stepValue: number = 0; if (sensorData) { stepValue = sensorData.stepsValue; } DatabaseUtils.updateForms(stepValue, rdbStore as DataRdb.RdbStore); }).catch((error: Error) => { Logger.error(CommonConstants.ENTRY_FORM_ABILITY_TAG, 'updateSensor getSensorData err ' + JSON.stringify(error)); }); }).catch((error: Error) => { Logger.error(CommonConstants.ENTRY_FORM_ABILITY_TAG, 'updateSensor rdb err ' + JSON.stringify(error)); }); }
AST#method_declaration#Left updateSensorData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // Get today's steps. 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 DatabaseUtils AST#expression#Right . createRdbStore 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 . context AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left rdbStore : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Object AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left rdbStore AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . ENTRY_FORM_ABILITY_TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left 'update sensor data rdbStore is 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 let AST#variable_declarator#Left getSensorData : 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 SensorData 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 DatabaseUtils AST#expression#Right . getSensorData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left rdbStore AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left DataRdb . RdbStore AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateUtils AST#expression#Right . getDate 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#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left getSensorData 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 sensorData : AST#type_annotation#Left AST#primary_type#Left SensorData 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 stepValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left sensorData AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left stepValue = AST#expression#Left AST#member_expression#Left AST#expression#Left sensorData AST#expression#Right . stepsValue 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 DatabaseUtils AST#expression#Right . updateForms AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left stepValue AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left rdbStore AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left DataRdb . RdbStore AST#qualified_type#Right 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#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 error : AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . ENTRY_FORM_ABILITY_TAG 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#binary_expression#Left AST#expression#Left 'updateSensor getSensorData err ' 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 error 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#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 error : AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . ENTRY_FORM_ABILITY_TAG 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#binary_expression#Left AST#expression#Left 'updateSensor rdb err ' 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 error 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
updateSensorData() { DatabaseUtils.createRdbStore(this.context).then((rdbStore: Object | undefined) => { if (!rdbStore) { Logger.error(CommonConstants.ENTRY_FORM_ABILITY_TAG, 'update sensor data rdbStore is null'); return; } let getSensorData: Promise<SensorData> = DatabaseUtils.getSensorData(rdbStore as DataRdb.RdbStore, DateUtils.getDate(0)); getSensorData.then((sensorData: SensorData) => { let stepValue: number = 0; if (sensorData) { stepValue = sensorData.stepsValue; } DatabaseUtils.updateForms(stepValue, rdbStore as DataRdb.RdbStore); }).catch((error: Error) => { Logger.error(CommonConstants.ENTRY_FORM_ABILITY_TAG, 'updateSensor getSensorData err ' + JSON.stringify(error)); }); }).catch((error: Error) => { Logger.error(CommonConstants.ENTRY_FORM_ABILITY_TAG, 'updateSensor rdb err ' + JSON.stringify(error)); }); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/entryformability/EntryFormAbility.ets#L96-L117
e0961cea454b1958537dd11a25b29981181ff0df
gitee
njkndxz/learn-ArkTs.git
70fabab8ee28e3637329d53a4ec93afc72a001c2
entry/src/main/ets/pages/学习/30.泛型.ets
arkts
fn
泛型: 类型可以作为参数传递,类型是可变的
function fn<T>(param: T): T { return param }
AST#function_declaration#Left function fn AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left param : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left param AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
function fn<T>(param: T): T { return param }
https://github.com/njkndxz/learn-ArkTs.git/blob/70fabab8ee28e3637329d53a4ec93afc72a001c2/entry/src/main/ets/pages/学习/30.泛型.ets#L4-L6
647ec155c78e089809393b86a1c5286fca8e1e75
github
Tianpei-Shi/MusicDash.git
4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5
src/services/CloudDBService.ets
arkts
模拟云数据库配置接口
export interface CloudDBZoneConfig { // 模拟云数据库配置接口 }
AST#export_declaration#Left export AST#interface_declaration#Left interface CloudDBZoneConfig AST#object_type#Left { // 模拟云数据库配置接口 } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface CloudDBZoneConfig { }
https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/services/CloudDBService.ets#L13-L15
95c32794feb60fd50949954670c8d4d1ef356f78
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/ComponetModifier.ets
arkts
Text统一样式类
export class TextModifier implements AttributeModifier<TextAttribute> { private publicFontSize: number | string | Resource = TextConstants.TEXT_FONT_SIZE; private publicLineHeight: number | string | Resource = TextConstants.TEXT_LINE_HEIGHT; applyNormalAttribute(instance: TextAttribute): void { instance.fontSize(this.publicFontSize); instance.lineHeight(this.publicLineHeight); } fontSize(fontSize: number | string | Resource, textType: number = 0) { this.publicFontSize = textType == 1 ? TextConstants.TEXT_FONT_SIZE : fontSize return this } lineHeight(lineHeight: number | string | Resource, textType: number = 0) { this.publicLineHeight = textType == 1 ? TextConstants.TEXT_LINE_HEIGHT : lineHeight return this } }
AST#export_declaration#Left export AST#class_declaration#Left class TextModifier AST#implements_clause#Left implements AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left TextAttribute AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private publicFontSize : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left TextConstants AST#expression#Right . TEXT_FONT_SIZE AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private publicLineHeight : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left TextConstants AST#expression#Right . TEXT_LINE_HEIGHT AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left applyNormalAttribute AST#parameter_list#Left ( AST#parameter#Left instance : AST#type_annotation#Left AST#primary_type#Left TextAttribute 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 instance AST#expression#Right . fontSize 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 . publicFontSize AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left instance AST#expression#Right . lineHeight 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 . publicLineHeight 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 AST#method_declaration#Left fontSize AST#parameter_list#Left ( AST#parameter#Left fontSize : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left textType : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#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 . publicFontSize AST#member_expression#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left textType AST#expression#Right == AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left TextConstants AST#expression#Right . TEXT_FONT_SIZE AST#member_expression#Right AST#expression#Right : AST#expression#Left fontSize AST#expression#Right AST#conditional_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 this AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left lineHeight AST#parameter_list#Left ( AST#parameter#Left lineHeight : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left textType : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#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 . publicLineHeight AST#member_expression#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left textType AST#expression#Right == AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left TextConstants AST#expression#Right . TEXT_LINE_HEIGHT AST#member_expression#Right AST#expression#Right : AST#expression#Left lineHeight AST#expression#Right AST#conditional_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 this 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 TextModifier implements AttributeModifier<TextAttribute> { private publicFontSize: number | string | Resource = TextConstants.TEXT_FONT_SIZE; private publicLineHeight: number | string | Resource = TextConstants.TEXT_LINE_HEIGHT; applyNormalAttribute(instance: TextAttribute): void { instance.fontSize(this.publicFontSize); instance.lineHeight(this.publicLineHeight); } fontSize(fontSize: number | string | Resource, textType: number = 0) { this.publicFontSize = textType == 1 ? TextConstants.TEXT_FONT_SIZE : fontSize return this } lineHeight(lineHeight: number | string | Resource, textType: number = 0) { this.publicLineHeight = textType == 1 ? TextConstants.TEXT_LINE_HEIGHT : lineHeight return this } }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/ComponetModifier.ets#L44-L62
feeec452b7e5668a0a51ed453b761124823a1172
github
2763981847/Klotski.git
35bfb313c07e25ea53d2f4e66df0c441dd51675b
entry/src/main/ets/common/util/GameUtils.ets
arkts
shuffle
打乱函数 @param array 分割后的子图数组 @param cols 分割的列数
public static shuffle(array: Array<CroppedImage>, cols: number): void { // 获取空白图块的索引 let blankIndex = this.getBlankIndex(array); // 定义移动方向,包括左、右、上、下 const n = array.length, direction = [-1, 1, -cols, cols]; // 循环 n*n 次,打乱图块的位置 for (let i = 0; i < n * n; i++) { let nextBlankIndex; // 随机选择一个方向,直到找到有效的下一个空白图块的索引 do { nextBlankIndex = blankIndex + direction[Math.floor(Math.random() * 4)]; // 随机得到的坐标不合法或者在二维化后的子图数组中并不相邻 } while (!this.areIndexesAdjacent(blankIndex, nextBlankIndex, n / cols, cols)); // 交换当前图块和下一个空白图块的位置 [array[blankIndex], array[nextBlankIndex]] = [array[nextBlankIndex], array[blankIndex]]; blankIndex = nextBlankIndex; }
AST#method_declaration#Left public static shuffle AST#parameter_list#Left ( AST#parameter#Left array : 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 CroppedImage 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 cols : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 获取空白图块的索引 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left blankIndex = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getBlankIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left array 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 n = AST#expression#Left AST#member_expression#Left AST#expression#Left array AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right , AST#variable_declarator#Left direction = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right , AST#expression#Left 1 AST#expression#Right , AST#expression#Left AST#unary_expression#Left - AST#expression#Left cols AST#expression#Right AST#unary_expression#Right AST#expression#Right , AST#expression#Left cols AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 循环 n*n 次,打乱图块的位置 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 AST#binary_expression#Left AST#expression#Left n AST#expression#Right * AST#expression#Left n AST#expression#Right AST#binary_expression#Right 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#variable_declaration#Left let AST#variable_declarator#Left nextBlankIndex AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 随机选择一个方向,直到找到有效的下一个空白图块的索引 AST#statement#Left AST#expression_statement#Left AST#expression#Left do AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left { AST#property_name#Left nextBlankIndex AST#property_name#Right = blankIndex AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#unary_expression#Left + AST#expression#Left direction AST#expression#Right AST#unary_expression#Right AST#expression#Right [ AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#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 4 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ] AST#subscript_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#while_statement#Left while ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . areIndexesAdjacent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left blankIndex AST#expression#Right , AST#expression#Left nextBlankIndex AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left n AST#expression#Right / AST#expression#Left cols AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left cols AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#while_statement#Right AST#statement#Right // 交换当前图块和下一个空白图块的位置 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left array AST#expression#Right [ AST#expression#Left blankIndex AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left array AST#expression#Right [ AST#expression#Left nextBlankIndex AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#ERROR#Left = AST#ERROR#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left array AST#expression#Right [ AST#expression#Left nextBlankIndex AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left , array AST#ERROR#Right [ AST#expression#Left blankIndex AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_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 blankIndex = AST#expression#Left nextBlankIndex 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
public static shuffle(array: Array<CroppedImage>, cols: number): void { let blankIndex = this.getBlankIndex(array); const n = array.length, direction = [-1, 1, -cols, cols]; for (let i = 0; i < n * n; i++) { let nextBlankIndex; do { nextBlankIndex = blankIndex + direction[Math.floor(Math.random() * 4)]; } while (!this.areIndexesAdjacent(blankIndex, nextBlankIndex, n / cols, cols)); [array[blankIndex], array[nextBlankIndex]] = [array[nextBlankIndex], array[blankIndex]]; blankIndex = nextBlankIndex; }
https://github.com/2763981847/Klotski.git/blob/35bfb313c07e25ea53d2f4e66df0c441dd51675b/entry/src/main/ets/common/util/GameUtils.ets#L14-L30
df28fe781d526a87e209b51a1dea928952ba2bfa
github