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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
Million-mo/tree-sitter-arkts.git
|
2fd0ad75e2d848709edcf4be038f27b178114ef6
|
examples/event_handling.ets
|
arkts
|
handleDrag
|
拖拽事件处理
|
private handleDrag(event: DragEvent) {
this.dragOffset.x = event.getX()
this.dragOffset.y = event.getY()
this.eventData.gestureInfo = `拖拽位置: (${Math.round(this.dragOffset.x)}, ${Math.round(this.dragOffset.y)})`
}
|
AST#method_declaration#Left private handleDrag AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left DragEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dragOffset AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . getX AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dragOffset AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . getY AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . eventData AST#member_expression#Right AST#expression#Right . gestureInfo AST#member_expression#Right = 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 Math AST#expression#Right . round 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 . dragOffset AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right , AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . round 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 . dragOffset AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right 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#assignment_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
private handleDrag(event: DragEvent) {
this.dragOffset.x = event.getX()
this.dragOffset.y = event.getY()
this.eventData.gestureInfo = `拖拽位置: (${Math.round(this.dragOffset.x)}, ${Math.round(this.dragOffset.y)})`
}
|
https://github.com/Million-mo/tree-sitter-arkts.git/blob/2fd0ad75e2d848709edcf4be038f27b178114ef6/examples/event_handling.ets#L56-L60
|
0244ac0454e5a32dc0fa16365be70844e1cea6de
|
github
|
open9527/OpenHarmony
|
fdea69ed722d426bf04e817ec05bff4002e81a4e
|
libs/core/src/main/ets/utils/NetConnectionUtils.ets
|
arkts
|
网络相关工具类
需要ohos.permission.GET_NETWORK_INFO权限。
|
export class NetConnectionUtils {
private constructor() {
}
private static netConnection: connection.NetConnection;
/**
* 检查默认数据网络是否被激活
*/
static hasDefaultNet(): Promise<boolean> {
return connection.hasDefaultNet();
}
/**
* 检查默认数据网络是否被激活
*/
static hasDefaultNetSync(): boolean {
return connection.hasDefaultNetSync();
}
/**
* 判断当前网络是否是Wi-Fi,否则是移动流量热点网络。
*/
static async hasNetWiFi(): Promise<boolean> {
let net = await connection.getDefaultNet();
let netCapabilities = await connection.getNetCapabilities(net);
let networkCap = netCapabilities.networkCap;
if (networkCap) { //判断是否具有NET_CAPABILITY_NOT_METERED属性,如果具有NET_CAPABILITY_NOT_METERED,说明是普通Wi-Fi,否则是移动流量热点网络。
return networkCap.indexOf(connection.NetCap.NET_CAPABILITY_NOT_METERED) >= 0
}
return false;
}
/**
* 获取网络类型
*/
static async getNetBearType(): Promise<connection.NetBearType> {
let net = await connection.getDefaultNet();
let netCapabilities = await connection.getNetCapabilities(net);
let netBearType = netCapabilities.bearerTypes[0];
return netBearType;
}
/**
* 获取当前设备的IP地址(设备连接Wi-Fi后)
*/
static getIpAddress() {
let ipAddress = wifiManager.getIpInfo().ipAddress;
let ip =
(ipAddress >>> 24) + "." + (ipAddress >> 16 & 0xFF) + "." + (ipAddress >> 8 & 0xFF) + "." + (ipAddress & 0xFF);
return ip;
}
/**
* 订阅指定网络状态变化的通知,支持多事件监听回调。
* @param netAvailableCallback 订阅网络可用事件回调。
* @param netUnavailableCallback 订阅网络不可用事件回调。
* @param netCapabilitiesChangeCallback 订阅网络能力变化事件回调。比如切换Wi-Fi、切换VPN、切换为手机流量。
* @param netConnectionPropertiesChangeCallback 订阅网络连接信息变化事件回调。比如更改Wi-Fi、切换Wi-Fi、切换蜂窝网络。
* @param netBlockStatusChangeCallback 订阅网络阻塞状态事件回调。
* @param netLostCallback 订阅网络丢失事件回调。
*/
static register(netAvailableCallback?: Callback<connection.NetHandle>,
netUnavailableCallback?: Callback<void>,
netCapabilitiesChangeCallback?: Callback<connection.NetCapabilityInfo>,
netConnectionPropertiesChangeCallback?: Callback<connection.NetConnectionPropertyInfo>,
netBlockStatusChangeCallback?: Callback<connection.NetBlockStatusInfo>,
netLostCallback?: Callback<connection.NetHandle>) {
if (!NetConnectionUtils.netConnection) {
NetConnectionUtils.netConnection = connection.createNetConnection(); //创建NetConnection对象
}
//先使用register接口注册订阅事件
NetConnectionUtils.netConnection.register((error: BusinessError) => {
if (error) {
LogUtils.error('NetworkUtil-', `register-异常 ~ code: ${error.code} -·- message: ${error.message}`);
}
});
if (netAvailableCallback) {
NetConnectionUtils.netConnection.on('netAvailable', netAvailableCallback); //订阅网络可用事件。
}
if (netUnavailableCallback) {
NetConnectionUtils.netConnection.on('netUnavailable', netUnavailableCallback); //订阅网络不可用事件。
}
if (netCapabilitiesChangeCallback) {
NetConnectionUtils.netConnection.on('netCapabilitiesChange',
netCapabilitiesChangeCallback); //订阅网络能力变化事件。比如切换Wi-Fi、切换VPN、切换为手机流量。
}
if (netConnectionPropertiesChangeCallback) {
NetConnectionUtils.netConnection.on('netConnectionPropertiesChange',
netConnectionPropertiesChangeCallback); //订阅网络连接信息变化事件。比如更改Wi-Fi、切换Wi-Fi、切换蜂窝网络。
}
if (netBlockStatusChangeCallback) {
NetConnectionUtils.netConnection.on('netBlockStatusChange', netBlockStatusChangeCallback); //订阅网络阻塞状态事件。
}
if (netLostCallback) {
NetConnectionUtils.netConnection.on('netLost', netLostCallback); //订阅网络丢失事件。
}
}
/**
* 取消订阅默认网络状态变化的通知。
*/
static unregister() {
if (NetConnectionUtils.netConnection) {
NetConnectionUtils.netConnection.unregister((error: BusinessError) => {
if (error) {
LogUtils.error('NetworkUtil-', `unregister-异常 ~ code: ${error.code} -·- message: ${error.message}`);
}
});
}
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class NetConnectionUtils 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#property_declaration#Left private static netConnection : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetConnection AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* 检查默认数据网络是否被激活
*/ AST#method_declaration#Left static hasDefaultNet AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left connection AST#expression#Right . hasDefaultNet 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#method_declaration#Left static hasDefaultNetSync 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 connection AST#expression#Right . hasDefaultNetSync 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 /**
* 判断当前网络是否是Wi-Fi,否则是移动流量热点网络。
*/ AST#method_declaration#Left static async hasNetWiFi AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left net = 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 connection AST#expression#Right AST#await_expression#Right AST#expression#Right . getDefaultNet AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left netCapabilities = 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 connection AST#expression#Right AST#await_expression#Right AST#expression#Right . getNetCapabilities AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left net 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 networkCap = AST#expression#Left AST#member_expression#Left AST#expression#Left netCapabilities AST#expression#Right . networkCap 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 networkCap AST#expression#Right ) AST#block_statement#Left { //判断是否具有NET_CAPABILITY_NOT_METERED属性,如果具有NET_CAPABILITY_NOT_METERED,说明是普通Wi-Fi,否则是移动流量热点网络。 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left networkCap AST#expression#Right . indexOf 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 connection AST#expression#Right . NetCap AST#member_expression#Right AST#expression#Right . NET_CAPABILITY_NOT_METERED 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#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#boolean_literal#Left false AST#boolean_literal#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 getNetBearType AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetBearType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left net = 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 connection AST#expression#Right AST#await_expression#Right AST#expression#Right . getDefaultNet AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left netCapabilities = 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 connection AST#expression#Right AST#await_expression#Right AST#expression#Right . getNetCapabilities AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left net 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 netBearType = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left netCapabilities AST#expression#Right . bearerTypes AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left netBearType AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取当前设备的IP地址(设备连接Wi-Fi后)
*/ AST#method_declaration#Left static getIpAddress AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left ipAddress = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left wifiManager AST#expression#Right . getIpInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . ipAddress 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 ip = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left ipAddress AST#expression#Right >>> AST#expression#Left 24 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right + AST#expression#Left "." AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left ipAddress AST#expression#Right >> AST#expression#Left 16 AST#expression#Right AST#binary_expression#Right AST#expression#Right & AST#expression#Left 0xFF AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left "." AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left ipAddress AST#expression#Right >> AST#expression#Left 8 AST#expression#Right AST#binary_expression#Right AST#expression#Right & AST#expression#Left 0xFF AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left "." AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left ipAddress AST#expression#Right & AST#expression#Left 0xFF AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left ip AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 订阅指定网络状态变化的通知,支持多事件监听回调。
* @param netAvailableCallback 订阅网络可用事件回调。
* @param netUnavailableCallback 订阅网络不可用事件回调。
* @param netCapabilitiesChangeCallback 订阅网络能力变化事件回调。比如切换Wi-Fi、切换VPN、切换为手机流量。
* @param netConnectionPropertiesChangeCallback 订阅网络连接信息变化事件回调。比如更改Wi-Fi、切换Wi-Fi、切换蜂窝网络。
* @param netBlockStatusChangeCallback 订阅网络阻塞状态事件回调。
* @param netLostCallback 订阅网络丢失事件回调。
*/ AST#method_declaration#Left static register AST#parameter_list#Left ( AST#parameter#Left netAvailableCallback ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetHandle AST#qualified_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#parameter#Right , AST#parameter#Left netUnavailableCallback ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left 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#parameter#Right , AST#parameter#Left netCapabilitiesChangeCallback ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetCapabilityInfo AST#qualified_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#parameter#Right , AST#parameter#Left netConnectionPropertiesChangeCallback ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetConnectionPropertyInfo AST#qualified_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#parameter#Right , AST#parameter#Left netBlockStatusChangeCallback ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetBlockStatusInfo AST#qualified_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#parameter#Right , AST#parameter#Left netLostCallback ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetHandle AST#qualified_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#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#unary_expression#Left ! AST#expression#Left NetConnectionUtils AST#expression#Right AST#unary_expression#Right AST#expression#Right . netConnection 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 NetConnectionUtils AST#expression#Right . netConnection AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left connection AST#expression#Right . createNetConnection 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 //创建NetConnection对象 } AST#ui_if_statement#Right AST#ui_control_flow#Right //先使用register接口注册订阅事件 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 NetConnectionUtils AST#expression#Right . netConnection AST#member_expression#Right AST#expression#Right . register 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 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 LogUtils AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'NetworkUtil-' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` register-异常 ~ code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right -·- message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left netAvailableCallback 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 NetConnectionUtils AST#expression#Right . netConnection AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'netAvailable' AST#expression#Right , AST#expression#Left netAvailableCallback 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left netUnavailableCallback 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 NetConnectionUtils AST#expression#Right . netConnection AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'netUnavailable' AST#expression#Right , AST#expression#Left netUnavailableCallback 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left netCapabilitiesChangeCallback 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 NetConnectionUtils AST#expression#Right . netConnection AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'netCapabilitiesChange' AST#expression#Right , AST#expression#Left netCapabilitiesChangeCallback AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right //订阅网络能力变化事件。比如切换Wi-Fi、切换VPN、切换为手机流量。 } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left netConnectionPropertiesChangeCallback 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 NetConnectionUtils AST#expression#Right . netConnection AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'netConnectionPropertiesChange' AST#expression#Right , AST#expression#Left netConnectionPropertiesChangeCallback AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right //订阅网络连接信息变化事件。比如更改Wi-Fi、切换Wi-Fi、切换蜂窝网络。 } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left netBlockStatusChangeCallback 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 NetConnectionUtils AST#expression#Right . netConnection AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'netBlockStatusChange' AST#expression#Right , AST#expression#Left netBlockStatusChangeCallback 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left netLostCallback 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 NetConnectionUtils AST#expression#Right . netConnection AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'netLost' AST#expression#Right , AST#expression#Left netLostCallback AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right //订阅网络丢失事件。 } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 取消订阅默认网络状态变化的通知。
*/ AST#method_declaration#Left static unregister AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left NetConnectionUtils AST#expression#Right . netConnection 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 AST#member_expression#Left AST#expression#Left NetConnectionUtils AST#expression#Right . netConnection AST#member_expression#Right AST#expression#Right . unregister 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 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 LogUtils AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'NetworkUtil-' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` unregister-异常 ~ code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right -·- message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#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#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class NetConnectionUtils {
private constructor() {
}
private static netConnection: connection.NetConnection;
static hasDefaultNet(): Promise<boolean> {
return connection.hasDefaultNet();
}
static hasDefaultNetSync(): boolean {
return connection.hasDefaultNetSync();
}
static async hasNetWiFi(): Promise<boolean> {
let net = await connection.getDefaultNet();
let netCapabilities = await connection.getNetCapabilities(net);
let networkCap = netCapabilities.networkCap;
if (networkCap) {
return networkCap.indexOf(connection.NetCap.NET_CAPABILITY_NOT_METERED) >= 0
}
return false;
}
static async getNetBearType(): Promise<connection.NetBearType> {
let net = await connection.getDefaultNet();
let netCapabilities = await connection.getNetCapabilities(net);
let netBearType = netCapabilities.bearerTypes[0];
return netBearType;
}
static getIpAddress() {
let ipAddress = wifiManager.getIpInfo().ipAddress;
let ip =
(ipAddress >>> 24) + "." + (ipAddress >> 16 & 0xFF) + "." + (ipAddress >> 8 & 0xFF) + "." + (ipAddress & 0xFF);
return ip;
}
static register(netAvailableCallback?: Callback<connection.NetHandle>,
netUnavailableCallback?: Callback<void>,
netCapabilitiesChangeCallback?: Callback<connection.NetCapabilityInfo>,
netConnectionPropertiesChangeCallback?: Callback<connection.NetConnectionPropertyInfo>,
netBlockStatusChangeCallback?: Callback<connection.NetBlockStatusInfo>,
netLostCallback?: Callback<connection.NetHandle>) {
if (!NetConnectionUtils.netConnection) {
NetConnectionUtils.netConnection = connection.createNetConnection();
}
NetConnectionUtils.netConnection.register((error: BusinessError) => {
if (error) {
LogUtils.error('NetworkUtil-', `register-异常 ~ code: ${error.code} -·- message: ${error.message}`);
}
});
if (netAvailableCallback) {
NetConnectionUtils.netConnection.on('netAvailable', netAvailableCallback);
}
if (netUnavailableCallback) {
NetConnectionUtils.netConnection.on('netUnavailable', netUnavailableCallback);
}
if (netCapabilitiesChangeCallback) {
NetConnectionUtils.netConnection.on('netCapabilitiesChange',
netCapabilitiesChangeCallback);
}
if (netConnectionPropertiesChangeCallback) {
NetConnectionUtils.netConnection.on('netConnectionPropertiesChange',
netConnectionPropertiesChangeCallback);
}
if (netBlockStatusChangeCallback) {
NetConnectionUtils.netConnection.on('netBlockStatusChange', netBlockStatusChangeCallback);
}
if (netLostCallback) {
NetConnectionUtils.netConnection.on('netLost', netLostCallback);
}
}
static unregister() {
if (NetConnectionUtils.netConnection) {
NetConnectionUtils.netConnection.unregister((error: BusinessError) => {
if (error) {
LogUtils.error('NetworkUtil-', `unregister-异常 ~ code: ${error.code} -·- message: ${error.message}`);
}
});
}
}
}
|
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/NetConnectionUtils.ets#L11-L127
|
5c7c0e8a68781392d51192934774bb6013c241f2
|
gitee
|
|
BohanSu/LumosAgent-HarmonyOS.git
|
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
|
entry/src/main/ets/common/Constants.ets
|
arkts
|
Application Constants
Central configuration for the Lumos Agent application
|
export class Constants {
// Database Configuration
static readonly DB_NAME: string = 'lumos.db';
static readonly DB_SECURITY_LEVEL: number = 1; // S1 level
// Table Names
static readonly TABLE_TASKS: string = 'tasks';
static readonly TABLE_MEMOS: string = 'memos';
static readonly TABLE_MOOD_ENTRIES: string = 'mood_entries';
static readonly TABLE_CHAT_LOGS: string = 'chat_logs';
static readonly TABLE_DAILY_SUMMARIES: string = 'daily_summaries';
// DeepSeek API Configuration
// 注意:API密钥现在通过ConfigService安全存储,不再硬编码
static readonly DEEPSEEK_BASE_URL: string = 'https://api.deepseek.com';
static readonly DEEPSEEK_MODEL: string = 'deepseek-chat';
static readonly DEEPSEEK_CHAT_ENDPOINT: string = '/v1/chat/completions';
// UI Constants
static readonly CHAT_INPUT_HEIGHT: number = 60;
static readonly TASK_CARD_HEIGHT: number = 80;
static readonly MEMO_CARD_HEIGHT: number = 60;
static readonly BORDER_RADIUS: number = 24; // Super rounded
static readonly PADDING: number = 20;
// Colors - Black Gold Luxury Design (黑金极奢风)
static readonly PRIMARY_COLOR: string = '#D4AF37'; // 香槟金
static readonly SECONDARY_COLOR: string = '#1E293B'; // 曜石黑
static readonly ACCENT_COLOR: string = '#F59E0B'; // 琥珀金
static readonly CYBER_CYAN: string = '#E2E8F0'; // 铂金银 (替代原本的青色,保持冷色调点缀)
// 背景系统(极夜黑金)
static readonly BACKGROUND_COLOR: string = '#050505'; // 极致深黑
static readonly BACKGROUND_GRADIENT_START: string = '#000000';
static readonly BACKGROUND_GRADIENT_MID: string = '#0F0F12';
static readonly BACKGROUND_GRADIENT_END: string = '#1A1810'; // 微微泛金的黑
// 玻璃态效果 (黑金质感)
static readonly GLASS_BACKGROUND: string = 'rgba(20, 20, 20, 0.7)'; // 更深的玻璃底色,增加对比度
static readonly GLASS_BORDER: string = 'rgba(212, 175, 55, 0.3)'; // 金色边框微光
static readonly GLASS_BLUR: number = 50; // 更强的模糊质感
static readonly GLASS_SHADOW: string = 'rgba(212, 175, 55, 0.15)'; // 金色阴影
// 文字颜色
static readonly TEXT_PRIMARY: string = '#F8FAFC'; // 纯白
static readonly TEXT_SECONDARY: string = '#94A3B8'; // 银灰
static readonly TEXT_HINT: string = '#64748B'; // 深灰,增加可读性
static readonly TEXT_GLOW: string = '#FCD34D'; // 金色光晕
static readonly TEXT_INVERSE: string = '#0F172A'; // 反色文本(用于亮色背景)
// 情绪色彩(保持高饱和度但偏向暖色调以契合黑金)
static readonly SUCCESS_COLOR: string = '#10B981'; // 祖母绿 (保持)
static readonly WARNING_COLOR: string = '#F59E0B'; // 琥珀
static readonly ERROR_COLOR: string = '#EF4444'; // 宝石红
// 情绪专用色(用于粒子球 - 调整为更有辨识度的色系)
static readonly EMOTION_HAPPY: string = '#FDE047'; // 明亮黄色 - 阳光般的快乐
static readonly EMOTION_EXCITED: string = '#EC4899'; // 粉红色 - 热情洋溢
static readonly EMOTION_SAD: string = '#60A5FA'; // 蓝色 - 忧郁平静
static readonly EMOTION_ANGRY: string = '#EF4444'; // 红色 - 愤怒炽热
static readonly EMOTION_CALM: string = '#34D399'; // 绿色 - 平和宁静
static readonly EMOTION_SURPRISED: string = '#A78BFA'; // 紫色 - 惊讶神秘
static readonly EMOTION_NEUTRAL: string = '#94A3B8'; // 灰蓝 - 中性平和
// Agent Messages
static readonly MSG_TASK_CREATED: string = '已规划。';
static readonly MSG_MEMO_SAVED: string = '已记忆。';
static readonly MSG_ERROR: string = '信号中断。';
static readonly MSG_LOADING: string = 'Lumos 正在连接...';
}
|
AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { // Database Configuration AST#property_declaration#Left static readonly DB_NAME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'lumos.db' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly DB_SECURITY_LEVEL : 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 // S1 level // Table Names AST#property_declaration#Left static readonly TABLE_TASKS : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'tasks' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly TABLE_MEMOS : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'memos' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly TABLE_MOOD_ENTRIES : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'mood_entries' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly TABLE_CHAT_LOGS : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'chat_logs' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly TABLE_DAILY_SUMMARIES : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'daily_summaries' AST#expression#Right ; AST#property_declaration#Right // DeepSeek API Configuration // 注意:API密钥现在通过ConfigService安全存储,不再硬编码 AST#property_declaration#Left static readonly DEEPSEEK_BASE_URL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'https://api.deepseek.com' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly DEEPSEEK_MODEL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'deepseek-chat' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly DEEPSEEK_CHAT_ENDPOINT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '/v1/chat/completions' AST#expression#Right ; AST#property_declaration#Right // UI Constants AST#property_declaration#Left static readonly CHAT_INPUT_HEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 60 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly TASK_CARD_HEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 80 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly MEMO_CARD_HEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 60 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly BORDER_RADIUS : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 24 AST#expression#Right ; AST#property_declaration#Right // Super rounded AST#property_declaration#Left static readonly PADDING : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 20 AST#expression#Right ; AST#property_declaration#Right // Colors - Black Gold Luxury Design (黑金极奢风) AST#property_declaration#Left static readonly PRIMARY_COLOR : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#D4AF37' AST#expression#Right ; AST#property_declaration#Right // 香槟金 AST#property_declaration#Left static readonly SECONDARY_COLOR : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#1E293B' AST#expression#Right ; AST#property_declaration#Right // 曜石黑 AST#property_declaration#Left static readonly ACCENT_COLOR : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#F59E0B' AST#expression#Right ; AST#property_declaration#Right // 琥珀金 AST#property_declaration#Left static readonly CYBER_CYAN : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#E2E8F0' AST#expression#Right ; AST#property_declaration#Right // 铂金银 (替代原本的青色,保持冷色调点缀) // 背景系统(极夜黑金) AST#property_declaration#Left static readonly BACKGROUND_COLOR : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#050505' AST#expression#Right ; AST#property_declaration#Right // 极致深黑 AST#property_declaration#Left static readonly BACKGROUND_GRADIENT_START : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#000000' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly BACKGROUND_GRADIENT_MID : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#0F0F12' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly BACKGROUND_GRADIENT_END : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#1A1810' AST#expression#Right ; AST#property_declaration#Right // 微微泛金的黑 // 玻璃态效果 (黑金质感) AST#property_declaration#Left static readonly GLASS_BACKGROUND : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'rgba(20, 20, 20, 0.7)' AST#expression#Right ; AST#property_declaration#Right // 更深的玻璃底色,增加对比度 AST#property_declaration#Left static readonly GLASS_BORDER : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'rgba(212, 175, 55, 0.3)' AST#expression#Right ; AST#property_declaration#Right // 金色边框微光 AST#property_declaration#Left static readonly GLASS_BLUR : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 50 AST#expression#Right ; AST#property_declaration#Right // 更强的模糊质感 AST#property_declaration#Left static readonly GLASS_SHADOW : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'rgba(212, 175, 55, 0.15)' AST#expression#Right ; AST#property_declaration#Right // 金色阴影 // 文字颜色 AST#property_declaration#Left static readonly TEXT_PRIMARY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#F8FAFC' AST#expression#Right ; AST#property_declaration#Right // 纯白 AST#property_declaration#Left static readonly TEXT_SECONDARY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#94A3B8' AST#expression#Right ; AST#property_declaration#Right // 银灰 AST#property_declaration#Left static readonly TEXT_HINT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#64748B' AST#expression#Right ; AST#property_declaration#Right // 深灰,增加可读性 AST#property_declaration#Left static readonly TEXT_GLOW : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#FCD34D' AST#expression#Right ; AST#property_declaration#Right // 金色光晕 AST#property_declaration#Left static readonly TEXT_INVERSE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#0F172A' AST#expression#Right ; AST#property_declaration#Right // 反色文本(用于亮色背景) // 情绪色彩(保持高饱和度但偏向暖色调以契合黑金) AST#property_declaration#Left static readonly SUCCESS_COLOR : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#10B981' AST#expression#Right ; AST#property_declaration#Right // 祖母绿 (保持) AST#property_declaration#Left static readonly WARNING_COLOR : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#F59E0B' AST#expression#Right ; AST#property_declaration#Right // 琥珀 AST#property_declaration#Left static readonly ERROR_COLOR : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#EF4444' AST#expression#Right ; AST#property_declaration#Right // 宝石红 // 情绪专用色(用于粒子球 - 调整为更有辨识度的色系) AST#property_declaration#Left static readonly EMOTION_HAPPY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#FDE047' AST#expression#Right ; AST#property_declaration#Right // 明亮黄色 - 阳光般的快乐 AST#property_declaration#Left static readonly EMOTION_EXCITED : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#EC4899' AST#expression#Right ; AST#property_declaration#Right // 粉红色 - 热情洋溢 AST#property_declaration#Left static readonly EMOTION_SAD : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#60A5FA' AST#expression#Right ; AST#property_declaration#Right // 蓝色 - 忧郁平静 AST#property_declaration#Left static readonly EMOTION_ANGRY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#EF4444' AST#expression#Right ; AST#property_declaration#Right // 红色 - 愤怒炽热 AST#property_declaration#Left static readonly EMOTION_CALM : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#34D399' AST#expression#Right ; AST#property_declaration#Right // 绿色 - 平和宁静 AST#property_declaration#Left static readonly EMOTION_SURPRISED : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#A78BFA' AST#expression#Right ; AST#property_declaration#Right // 紫色 - 惊讶神秘 AST#property_declaration#Left static readonly EMOTION_NEUTRAL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#94A3B8' AST#expression#Right ; AST#property_declaration#Right // 灰蓝 - 中性平和 // Agent Messages AST#property_declaration#Left static readonly MSG_TASK_CREATED : 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 static readonly MSG_MEMO_SAVED : 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 static readonly MSG_ERROR : 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 static readonly MSG_LOADING : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'Lumos 正在连接...' AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class Constants {
static readonly DB_NAME: string = 'lumos.db';
static readonly DB_SECURITY_LEVEL: number = 1;
static readonly TABLE_TASKS: string = 'tasks';
static readonly TABLE_MEMOS: string = 'memos';
static readonly TABLE_MOOD_ENTRIES: string = 'mood_entries';
static readonly TABLE_CHAT_LOGS: string = 'chat_logs';
static readonly TABLE_DAILY_SUMMARIES: string = 'daily_summaries';
static readonly DEEPSEEK_BASE_URL: string = 'https://api.deepseek.com';
static readonly DEEPSEEK_MODEL: string = 'deepseek-chat';
static readonly DEEPSEEK_CHAT_ENDPOINT: string = '/v1/chat/completions';
static readonly CHAT_INPUT_HEIGHT: number = 60;
static readonly TASK_CARD_HEIGHT: number = 80;
static readonly MEMO_CARD_HEIGHT: number = 60;
static readonly BORDER_RADIUS: number = 24;
static readonly PADDING: number = 20;
static readonly PRIMARY_COLOR: string = '#D4AF37';
static readonly SECONDARY_COLOR: string = '#1E293B';
static readonly ACCENT_COLOR: string = '#F59E0B';
static readonly CYBER_CYAN: string = '#E2E8F0';
static readonly BACKGROUND_COLOR: string = '#050505';
static readonly BACKGROUND_GRADIENT_START: string = '#000000';
static readonly BACKGROUND_GRADIENT_MID: string = '#0F0F12';
static readonly BACKGROUND_GRADIENT_END: string = '#1A1810';
static readonly GLASS_BACKGROUND: string = 'rgba(20, 20, 20, 0.7)';
static readonly GLASS_BORDER: string = 'rgba(212, 175, 55, 0.3)';
static readonly GLASS_BLUR: number = 50;
static readonly GLASS_SHADOW: string = 'rgba(212, 175, 55, 0.15)';
static readonly TEXT_PRIMARY: string = '#F8FAFC';
static readonly TEXT_SECONDARY: string = '#94A3B8';
static readonly TEXT_HINT: string = '#64748B';
static readonly TEXT_GLOW: string = '#FCD34D';
static readonly TEXT_INVERSE: string = '#0F172A';
static readonly SUCCESS_COLOR: string = '#10B981';
static readonly WARNING_COLOR: string = '#F59E0B';
static readonly ERROR_COLOR: string = '#EF4444';
static readonly EMOTION_HAPPY: string = '#FDE047';
static readonly EMOTION_EXCITED: string = '#EC4899';
static readonly EMOTION_SAD: string = '#60A5FA';
static readonly EMOTION_ANGRY: string = '#EF4444';
static readonly EMOTION_CALM: string = '#34D399';
static readonly EMOTION_SURPRISED: string = '#A78BFA';
static readonly EMOTION_NEUTRAL: string = '#94A3B8';
static readonly MSG_TASK_CREATED: string = '已规划。';
static readonly MSG_MEMO_SAVED: string = '已记忆。';
static readonly MSG_ERROR: string = '信号中断。';
static readonly MSG_LOADING: string = 'Lumos 正在连接...';
}
|
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/Constants.ets#L6-L75
|
581c330d98310dc3df0cca9ba2f1b638daef7b78
|
github
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/handwritingtoimage/src/main/ets/model/RenderNodeModel.ets
|
arkts
|
makeNode
|
实例绑定的NodeContainer组件的宽,单位px MyNodeController实例绑定的NodeContainer创建时触发,创建根节点rootNode并将其挂载至NodeContainer
|
makeNode(uiContext: UIContext): FrameNode {
this.rootNode = new FrameNode(uiContext);
if (this.rootNode !== null) {
this.rootRenderNode = this.rootNode.getRenderNode();
}
return this.rootNode;
}
|
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#primary_type#Left FrameNode 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 . rootNode 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#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 . 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rootRenderNode 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 . rootNode AST#member_expression#Right AST#expression#Right . getRenderNode 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#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rootNode AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
makeNode(uiContext: UIContext): FrameNode {
this.rootNode = new FrameNode(uiContext);
if (this.rootNode !== null) {
this.rootRenderNode = this.rootNode.getRenderNode();
}
return this.rootNode;
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/handwritingtoimage/src/main/ets/model/RenderNodeModel.ets#L56-L62
|
1bb8517d8e9d6badd11374d2b552295db24dc9a6
|
gitee
|
openharmony-tpc/ImageKnife
|
bc55de9e2edd79ed4646ce37177ad94b432874f7
|
library/src/main/ets/model/ImageKnifeData.ets
|
arkts
|
request子线程处理时的返回
|
export interface RequestJobResult {
pixelMap: PixelMap | string | undefined
bufferSize: number
fileKey: string
loadFail?: string,
size?:Size,
type?: string,
pixelMapList?:Array<PixelMap>,
delayList?: Array<number>,
imageKnifeData?: ImageKnifeData,
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface RequestJobResult AST#object_type#Left { AST#type_member#Left pixelMap : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left PixelMap AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left bufferSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left fileKey : 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 loadFail ? : 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 size ? : AST#type_annotation#Left AST#primary_type#Left Size AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , AST#type_member#Left type ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , AST#type_member#Left pixelMapList ? : 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 PixelMap AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , AST#type_member#Left delayList ? : 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#type_member#Right , AST#type_member#Left imageKnifeData ? : AST#type_annotation#Left AST#primary_type#Left ImageKnifeData 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 RequestJobResult {
pixelMap: PixelMap | string | undefined
bufferSize: number
fileKey: string
loadFail?: string,
size?:Size,
type?: string,
pixelMapList?:Array<PixelMap>,
delayList?: Array<number>,
imageKnifeData?: ImageKnifeData,
}
|
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/model/ImageKnifeData.ets#L115-L125
|
40bd1d445709055f92bed9db41df9005ce68b450
|
gitee
|
|
sithvothykiv/dialog_hub.git
|
b676c102ef2d05f8994d170abe48dcc40cd39005
|
custom_dialog/src/main/ets/utils/Constraint.ets
|
arkts
|
暂时 这么定通用action,用来统一添加close
|
export type GenericOnAction<T extends ESObject[]> = (...args: T) => void;
|
AST#export_declaration#Left export AST#type_declaration#Left type GenericOnAction AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ESObject [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left ... args : 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 void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right ; AST#type_declaration#Right AST#export_declaration#Right
|
export type GenericOnAction<T extends ESObject[]> = (...args: T) => void;
|
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/Constraint.ets#L8-L8
|
ed95a3c376d90b48395f85951d7c55e1b518771c
|
github
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/SystemFeature/Security/DLPManager/entry/src/main/ets/pages/Index.ets
|
arkts
|
setSandboxFile
|
设置沙箱保留
|
async setSandboxFile(docUris: Array<string>): Promise<void> {
try {
dlpPermission.setRetentionState(docUris); // 设置沙箱保留
} catch (err) {
Logger.error(TAG, 'setRetentionState error:' + (err as BusinessError).code + (err as BusinessError).message);
}
}
|
AST#method_declaration#Left async setSandboxFile AST#parameter_list#Left ( AST#parameter#Left docUris : 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 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dlpPermission AST#expression#Right . setRetentionState AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left docUris 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 TAG AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'setRetentionState error:' AST#expression#Right + AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left err AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . code AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left err AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async setSandboxFile(docUris: Array<string>): Promise<void> {
try {
dlpPermission.setRetentionState(docUris);
} catch (err) {
Logger.error(TAG, 'setRetentionState error:' + (err as BusinessError).code + (err as BusinessError).message);
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLPManager/entry/src/main/ets/pages/Index.ets#L232-L238
|
b74b291ad9786e0316dfa5576a1e32fac2216e1f
|
gitee
|
iotjin/JhHarmonyDemo.git
|
819e6c3b1db9984c042a181967784550e171b2e8
|
JhCommon/src/main/ets/JhCommon/components/JhProgressHUD.ets
|
arkts
|
initXTPromptHUDConfig
|
/ 全局参数配置 / API文档 https://gitee.com/kukumalu/xthud
|
private static initXTPromptHUDConfig(context: UIContext) {
XTPromptHUD.globalConfigToast(context, (options: XTHUDToastOptions) => {
options.isQueueMode = true // 同时只显示一个
options.isModal = true // 是否为全屏,屏蔽交互
options.closeOnPressBack = false // 控制是否点击系统返回键时关闭 HUD,默认 false,开启后触发返回关闭会执行 onCancel
options.closeOnClickOutside = false // 控制是否点击 HUD 背景时关闭(isModal 为 true 时生效),默认 false,开启后触发点击背景关闭会执行 onCancel
options.fontSize = _fontSize
options.font = {
size: _fontSize,
// weight: 600
}
options.borderRadius = _radius
options.backgroundColor = _loadingBgColor
options.hidingDelay = _closeTime
options.iconSize = { width: 30, height: 30 }
options.textPadding = {
top: 16,
bottom: 16,
left: 24,
right: 24,
}
})
XTPromptHUD.globalConfigLoading(context, (options: XTHUDLoadingOptions) => {
options.isModal = true // 是否为全屏,屏蔽交互
options.closeOnPressBack = false // 控制是否点击系统返回键时关闭 HUD,默认 false,开启后触发返回关闭会执行 onCancel
options.closeOnClickOutside = false // 控制是否点击 HUD 背景时关闭(isModal 为 true 时生效),默认 false,开启后触发点击背景关闭会执行 onCancel
options.fontSize = _fontSize
options.font = {
size: _fontSize,
// weight: 600,
}
options.borderRadius = _radius
options.backgroundColor = _loadingBgColor
options.iconSize = { width: 50, height: 50 }
options.iconMargin = {
top: 16,
bottom: 8,
left: 24,
right: 24,
}
options.textPadding = {
top: 0,
bottom: 16,
left: 24,
right: 24
}
})
XTPromptHUD.globalConfigProgress(context, (options: XTHUDProgressOptions) => {
options.isModal = true // 是否为全屏,屏蔽交互
options.closeOnPressBack = false // 控制是否点击系统返回键时关闭 HUD,默认 false,开启后触发返回关闭会执行 onCancel
options.closeOnClickOutside = false // 控制是否点击 HUD 背景时关闭(isModal 为 true 时生效),默认 false,开启后触发点击背景关闭会执行 onCancel
options.fontSize = _fontSize
options.font = {
size: _fontSize,
// weight: 600
}
options.borderRadius = _radius
options.backgroundColor = _loadingBgColor
options.iconSize = { width: 50, height: 50 }
options.iconMargin = {
top: 24,
bottom: 16,
left: 36,
right: 36,
}
options.textPadding = {
top: 0,
bottom: 16,
left: 24,
right: 24
}
options.strokeWidth = 5
options.progressFontSize = 5
options.progressFont = {
size: 12,
weight: 600
}
options.progressTextColor = Color.White
// options.autoHideWhenProgressCompletion = false
})
XTPromptHUD.globalConfigCustomHUD(context, (options: XTHUDReactiveBaseOptions) => {
options.isModal = true // 是否为全屏,屏蔽交互
options.closeOnPressBack = false // 控制是否点击系统返回键时关闭 HUD,默认 false,开启后触发返回关闭会执行 onCancel
options.closeOnClickOutside = false // 控制是否点击 HUD 背景时关闭(isModal 为 true 时生效),默认 false,开启后触发点击背景关闭会执行 onCancel
options.maskColor = _loadingBgColor
// options.maskColor = '#33000000'
})
}
|
AST#method_declaration#Left private static initXTPromptHUDConfig AST#parameter_list#Left ( AST#parameter#Left context : 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#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 XTPromptHUD AST#expression#Right . globalConfigToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left XTHUDToastOptions 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 options AST#expression#Right . isQueueMode 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 options AST#expression#Right . isModal 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 options AST#expression#Right . closeOnPressBack 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 // 控制是否点击系统返回键时关闭 HUD,默认 false,开启后触发返回关闭会执行 onCancel AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . closeOnClickOutside 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 // 控制是否点击 HUD 背景时关闭(isModal 为 true 时生效),默认 false,开启后触发点击背景关闭会执行 onCancel AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . fontSize AST#member_expression#Right = AST#expression#Left _fontSize 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 options AST#expression#Right . font AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left _fontSize AST#expression#Right AST#property_assignment#Right , // weight: 600 } AST#object_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 options AST#expression#Right . borderRadius AST#member_expression#Right = AST#expression#Left _radius 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 options AST#expression#Right . backgroundColor AST#member_expression#Right = AST#expression#Left _loadingBgColor 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 options AST#expression#Right . hidingDelay AST#member_expression#Right = AST#expression#Left _closeTime 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 options AST#expression#Right . iconSize AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 30 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left 30 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . textPadding AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left XTPromptHUD AST#expression#Right . globalConfigLoading AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left XTHUDLoadingOptions 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 options AST#expression#Right . isModal 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 options AST#expression#Right . closeOnPressBack 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 // 控制是否点击系统返回键时关闭 HUD,默认 false,开启后触发返回关闭会执行 onCancel AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . closeOnClickOutside 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 // 控制是否点击 HUD 背景时关闭(isModal 为 true 时生效),默认 false,开启后触发点击背景关闭会执行 onCancel AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . fontSize AST#member_expression#Right = AST#expression#Left _fontSize 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 options AST#expression#Right . font AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left _fontSize AST#expression#Right AST#property_assignment#Right , // weight: 600, } AST#object_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 options AST#expression#Right . borderRadius AST#member_expression#Right = AST#expression#Left _radius 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 options AST#expression#Right . backgroundColor AST#member_expression#Right = AST#expression#Left _loadingBgColor 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 options AST#expression#Right . iconSize AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 50 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left 50 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . iconMargin AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 16 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#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . textPadding AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left XTPromptHUD AST#expression#Right . globalConfigProgress AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left XTHUDProgressOptions 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 options AST#expression#Right . isModal 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 options AST#expression#Right . closeOnPressBack 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 // 控制是否点击系统返回键时关闭 HUD,默认 false,开启后触发返回关闭会执行 onCancel AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . closeOnClickOutside 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 // 控制是否点击 HUD 背景时关闭(isModal 为 true 时生效),默认 false,开启后触发点击背景关闭会执行 onCancel AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . fontSize AST#member_expression#Right = AST#expression#Left _fontSize 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 options AST#expression#Right . font AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left _fontSize AST#expression#Right AST#property_assignment#Right , // weight: 600 } AST#object_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 options AST#expression#Right . borderRadius AST#member_expression#Right = AST#expression#Left _radius 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 options AST#expression#Right . backgroundColor AST#member_expression#Right = AST#expression#Left _loadingBgColor 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 options AST#expression#Right . iconSize AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 50 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left 50 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . iconMargin AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 36 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 36 AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . textPadding AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . strokeWidth AST#member_expression#Right = AST#expression#Left 5 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 options AST#expression#Right . progressFontSize AST#member_expression#Right = AST#expression#Left 5 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 options AST#expression#Right . progressFont AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left weight AST#property_name#Right : AST#expression#Left 600 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . progressTextColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right // options.autoHideWhenProgressCompletion = false } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left XTPromptHUD AST#expression#Right . globalConfigCustomHUD AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left XTHUDReactiveBaseOptions 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 options AST#expression#Right . isModal 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 options AST#expression#Right . closeOnPressBack 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 // 控制是否点击系统返回键时关闭 HUD,默认 false,开启后触发返回关闭会执行 onCancel AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . closeOnClickOutside 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 // 控制是否点击 HUD 背景时关闭(isModal 为 true 时生效),默认 false,开启后触发点击背景关闭会执行 onCancel AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . maskColor AST#member_expression#Right = AST#expression#Left _loadingBgColor AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right // options.maskColor = '#33000000' } 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
|
private static initXTPromptHUDConfig(context: UIContext) {
XTPromptHUD.globalConfigToast(context, (options: XTHUDToastOptions) => {
options.isQueueMode = true
options.isModal = true
options.closeOnPressBack = false
options.closeOnClickOutside = false
options.fontSize = _fontSize
options.font = {
size: _fontSize,
}
options.borderRadius = _radius
options.backgroundColor = _loadingBgColor
options.hidingDelay = _closeTime
options.iconSize = { width: 30, height: 30 }
options.textPadding = {
top: 16,
bottom: 16,
left: 24,
right: 24,
}
})
XTPromptHUD.globalConfigLoading(context, (options: XTHUDLoadingOptions) => {
options.isModal = true
options.closeOnPressBack = false
options.closeOnClickOutside = false
options.fontSize = _fontSize
options.font = {
size: _fontSize,
,
}
options.borderRadius = _radius
options.backgroundColor = _loadingBgColor
options.iconSize = { width: 50, height: 50 }
options.iconMargin = {
top: 16,
bottom: 8,
left: 24,
right: 24,
}
options.textPadding = {
top: 0,
bottom: 16,
left: 24,
right: 24
}
})
XTPromptHUD.globalConfigProgress(context, (options: XTHUDProgressOptions) => {
options.isModal = true
options.closeOnPressBack = false
options.closeOnClickOutside = false
options.fontSize = _fontSize
options.font = {
size: _fontSize,
}
options.borderRadius = _radius
options.backgroundColor = _loadingBgColor
options.iconSize = { width: 50, height: 50 }
options.iconMargin = {
top: 24,
bottom: 16,
left: 36,
right: 36,
}
options.textPadding = {
top: 0,
bottom: 16,
left: 24,
right: 24
}
options.strokeWidth = 5
options.progressFontSize = 5
options.progressFont = {
size: 12,
weight: 600
}
options.progressTextColor = Color.White
})
XTPromptHUD.globalConfigCustomHUD(context, (options: XTHUDReactiveBaseOptions) => {
options.isModal = true
options.closeOnPressBack = false
options.closeOnClickOutside = false
options.maskColor = _loadingBgColor
})
}
|
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhProgressHUD.ets#L98-L187
|
567eaa57e2ce6abb1982950a1ef3931e81a7e564
|
github
|
fengmingdev/protobuf-arkts-generator.git
|
75888d404fd6ce52a046cba2a94807ecf1350147
|
runtime/arkpb/util.ets
|
arkts
|
Parse google.protobuf.Duration from string
|
export function durationFromJson(str: string): DurationParts {
if (typeof str !== 'string' || !str.endsWith('s')) throw new Error('invalid duration')
const body = str.slice(0, -1)
const m = body.match(/^(-?)(\d+)(?:\.(\d{1,9}))?$/)
if (!m) throw new Error('invalid duration')
const neg = m[1] === '-'
const sec = BigInt(m[2])
let nanos = 0
if (m[3]) {
const frac = m[3]
const pad = frac + '0'.repeat(9 - frac.length)
nanos = parseInt(pad, 10)
}
if (neg) {
return new DurationParts(-sec, -nanos)
}
return new DurationParts(sec, nanos)
}
|
AST#export_declaration#Left export AST#function_declaration#Left function durationFromJson 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_list#Right : AST#type_annotation#Left AST#primary_type#Left DurationParts AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left str AST#expression#Right AST#unary_expression#Right AST#expression#Right !== AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left str AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . endsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 's' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'invalid duration' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#throw_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left body = 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#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#ERROR#Left const m = AST#expression#Left AST#member_expression#Left AST#expression#Left body AST#expression#Right . match AST#member_expression#Right AST#expression#Right AST#ERROR#Left ( / AST#ERROR#Right ^ ( - AST#ERROR#Left ? ) AST#ERROR#Right ( AST#ERROR#Left \d AST#ERROR#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#unary_expression#Left + AST#ERROR#Left ) AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#expression#Right AST#ERROR#Left ? : AST#ERROR#Left \ . AST#parameter_list#Left ( AST#ERROR#Left \d { 1 , 9 } AST#ERROR#Right ) AST#parameter_list#Right ) ? $ / ) if AST#ERROR#Right ( AST#ERROR#Right ! AST#non_null_assertion_expression#Right AST#expression#Right AST#ERROR#Left m AST#ERROR#Right ) AST#parenthesized_expression#Right AST#expression#Right throw AST#ERROR#Right AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'invalid duration' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left neg = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left m AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right === AST#expression#Left '-' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left sec = AST#expression#Left AST#call_expression#Left AST#expression#Left BigInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left m AST#expression#Right [ AST#expression#Left 2 AST#expression#Right ] AST#subscript_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 nanos = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left m AST#expression#Right [ AST#expression#Left 3 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left frac = AST#expression#Left AST#subscript_expression#Left AST#expression#Left m AST#expression#Right [ AST#expression#Left 3 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pad AST#ERROR#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 frac AST#expression#Right + AST#expression#Left '0' AST#expression#Right AST#binary_expression#Right AST#expression#Right . repeat 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 9 AST#expression#Right - AST#expression#Left frac 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 nanos AST#ERROR#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left parseInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left pad AST#expression#Right , AST#expression#Left 10 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left neg AST#expression#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 DurationParts AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#unary_expression#Left - AST#expression#Left sec AST#expression#Right AST#unary_expression#Right AST#expression#Right , AST#expression#Left AST#unary_expression#Left - AST#expression#Left nanos 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#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#new_expression#Left new AST#expression#Left DurationParts AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sec AST#expression#Right , AST#expression#Left nanos 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 durationFromJson(str: string): DurationParts {
if (typeof str !== 'string' || !str.endsWith('s')) throw new Error('invalid duration')
const body = str.slice(0, -1)
const m = body.match(/^(-?)(\d+)(?:\.(\d{1,9}))?$/)
if (!m) throw new Error('invalid duration')
const neg = m[1] === '-'
const sec = BigInt(m[2])
let nanos = 0
if (m[3]) {
const frac = m[3]
const pad = frac + '0'.repeat(9 - frac.length)
nanos = parseInt(pad, 10)
}
if (neg) {
return new DurationParts(-sec, -nanos)
}
return new DurationParts(sec, nanos)
}
|
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/util.ets#L183-L200
|
e6f58a6f7de920a3a817eae769e8ec019b01e811
|
github
|
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/datas/myData/WordUserDbAccess.ets
|
arkts
|
insertOrUpdateOnlineDataForWord
|
MARK: - 插入或更新删除单词数据(对应Java的insertOrRemoveDeleteWordDataForWord) async insertOrRemoveDeleteWordDataForWord(wordUser: WordUser): Promise<void> { if (!this.db) return; let sql: string; let params: ParamType[]; if (wordUser.deleted) { // 插入或更新 sql = `REPLACE INTO ${Tables.DeleteWord.NAME} ( ${Tables.DeleteWord.Col.TITLE_EN}, ${Tables.DeleteWord.Col.DELETED} ) VALUES(?, ?)`; params = [ wordUser.titleEnEncodeToBase64, //未加盐的base64编码字符做为UserData主键 WordUser.Deleted_Yes ]; } else { // 移除 sql = `DELETE FROM ${Tables.DeleteWord.NAME} WHERE ${Tables.DeleteWord.Col.TITLE_EN} = ?`; params = [wordUser.titleEnEncodeToBase64];//未加盐的base64编码字符做为UserData主键 } try { await this.db.updateDb(sql, params); } catch (e) { DebugLog.e(`WordUserDbAccess >>> insertOrRemoveDeleteWordDataForWord: ${e}`); } }
插入或更新 WordTable 数据
逻辑:
1. 根据 titleEn(Base64,不加盐)先删除旧数据
2. 再插入完整 WordTable 记录
|
async insertOrUpdateOnlineDataForWord(word: WordDetail): Promise<void> {
if (!this.db) return;
const titleEn: string | null = word.titleEn;
if (!titleEn) return;
// 仅 Base64 编码(不加盐)
const titleEnBase64: string | null = word.titleEnEncodeToBase64;
if (!titleEnBase64) return;
// ============================================================
// MARK: - 删除旧数据
// ============================================================
const sqlDelete: string = `
DELETE FROM ${WordTable.TableOnline_Name}
WHERE SUBSTR(
${WordTable.Col.TITLEEN},
${DB.salt} + 1,
LENGTH(${WordTable.Col.TITLEEN}) - ${DB.salt}
) = ?
`;
const paramsDelete: ParamType[] = [
titleEnBase64 // 仅 Base64 编码
];
// ============================================================
// MARK: - 插入新数据
// ============================================================
const sqlInsert: string = `
INSERT INTO ${WordTable.TableOnline_Name} (
${WordTable.Col.IDX},
${WordTable.Col.PARTID},
${WordTable.Col.PARTNAME},
${WordTable.Col.UNITID},
${WordTable.Col.UNITNAME},
${WordTable.Col.UNITNO},
${WordTable.Col.TITLEEN},
${WordTable.Col.PRONEN},
${WordTable.Col.PRONUS},
${WordTable.Col.TITLECN1},
${WordTable.Col.TITLECN2},
${WordTable.Col.TITLECN3},
${WordTable.Col.WORDIMAGE},
${WordTable.Col.WORDCHANGE},
${WordTable.Col.SYNWORDS},
${WordTable.Col.ASYNWORDS},
${WordTable.Col.EXAMPLEEN1},
${WordTable.Col.EXAMPLECN1},
${WordTable.Col.EXAMPLEEN2},
${WordTable.Col.EXAMPLECN2},
${WordTable.Col.EXAMPLEEN3},
${WordTable.Col.EXAMPLECN3},
${WordTable.Col.USEDPHRASE},
${WordTable.Col.EN2EN},
${WordTable.Col.DISCRIMINATE}
) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
`;
const paramsInsert: ParamType[] = [
word.idx,
word.partId,
StringEncoder.encodeAndAddSalt(word.partName),
word.unitId,
StringEncoder.encodeAndAddSalt(word.unitName),
word.unitNo,
word.titleEnEncodeAndAddSalt, // 加密 + 加盐(与 Word 表统一)
StringEncoder.encodeAndAddSalt(word.pronEn),
StringEncoder.encodeAndAddSalt(word.pronUs),
StringEncoder.encodeAndAddSalt(word.titleCn1),
StringEncoder.encodeAndAddSalt(word.titleCn2),
StringEncoder.encodeAndAddSalt(word.titleCn3),
StringEncoder.encodeAndAddSalt(word.wordImage),
StringEncoder.encodeAndAddSalt(word.wordChange),
StringEncoder.encodeAndAddSalt(word.synWords),
StringEncoder.encodeAndAddSalt(word.asynWords),
StringEncoder.encodeAndAddSalt(word.exampleEn1),
StringEncoder.encodeAndAddSalt(word.titleCn1),
StringEncoder.encodeAndAddSalt(word.exampleEn2),
StringEncoder.encodeAndAddSalt(word.exampleCn2),
StringEncoder.encodeAndAddSalt(word.exampleEn3),
StringEncoder.encodeAndAddSalt(word.exampleCn3),
StringEncoder.encodeAndAddSalt(word.usedPhrase),
StringEncoder.encodeAndAddSalt(word.en2En),
StringEncoder.encodeAndAddSalt(word.discriminate)
];
// ============================================================
// MARK: - 执行
// ============================================================
try {
DebugLog.d(sqlDelete);
DebugLog.d(JSON.stringify(paramsDelete));
await this.db.updateDb(sqlDelete, paramsDelete);
DebugLog.d(sqlInsert);
DebugLog.d(JSON.stringify(paramsInsert));
await this.db.updateDb(sqlInsert, paramsInsert);
} catch (e) {
DebugLog.e(`WordDbAccess >>> insertOrUpdateOnlineDataForWord: ${e}`);
}
}
|
AST#method_declaration#Left async insertOrUpdateOnlineDataForWord AST#parameter_list#Left ( AST#parameter#Left word : AST#type_annotation#Left AST#primary_type#Left WordDetail 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#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 . db AST#member_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#variable_declaration#Left const AST#variable_declarator#Left titleEn : 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#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . titleEn 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 titleEn 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 // 仅 Base64 编码(不加盐) AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left titleEnBase64 : 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#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . titleEnEncodeToBase64 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 titleEnBase64 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 // ============================================================ // MARK: - 删除旧数据 // ============================================================ AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left sqlDelete : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#template_literal#Left `
DELETE FROM AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . TableOnline_Name AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right
WHERE SUBSTR(
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . TITLEEN 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 DB AST#expression#Right . salt AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right + 1,
LENGTH( AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . TITLEEN 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 DB AST#expression#Right . salt AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right
) = ?
` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left paramsDelete : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ParamType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left titleEnBase64 AST#expression#Right // 仅 Base64 编码 ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // ============================================================ // MARK: - 插入新数据 // ============================================================ AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left sqlInsert : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#template_literal#Left `
INSERT INTO AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . TableOnline_Name AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right (
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . IDX AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . PARTID AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . PARTNAME AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . UNITID AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . UNITNAME AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . UNITNO AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . TITLEEN AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . PRONEN AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . PRONUS AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . TITLECN1 AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . TITLECN2 AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . TITLECN3 AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . WORDIMAGE AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . WORDCHANGE AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . SYNWORDS AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . ASYNWORDS AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . EXAMPLEEN1 AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . EXAMPLECN1 AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . EXAMPLEEN2 AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . EXAMPLECN2 AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . EXAMPLEEN3 AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . EXAMPLECN3 AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . USEDPHRASE AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . EN2EN AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . DISCRIMINATE AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right
) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left paramsInsert : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ParamType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . idx AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . partId AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StringEncoder AST#expression#Right . encodeAndAddSalt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . partName AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . unitId AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StringEncoder AST#expression#Right . encodeAndAddSalt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . unitName AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . unitNo AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . titleEnEncodeAndAddSalt AST#member_expression#Right AST#expression#Right , // 加密 + 加盐(与 Word 表统一) AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StringEncoder AST#expression#Right . encodeAndAddSalt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . pronEn 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 StringEncoder AST#expression#Right . encodeAndAddSalt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . pronUs 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 StringEncoder AST#expression#Right . encodeAndAddSalt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . titleCn1 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 StringEncoder AST#expression#Right . encodeAndAddSalt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . titleCn2 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 StringEncoder AST#expression#Right . encodeAndAddSalt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . titleCn3 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 StringEncoder AST#expression#Right . encodeAndAddSalt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . wordImage 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 StringEncoder AST#expression#Right . encodeAndAddSalt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . wordChange 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 StringEncoder AST#expression#Right . encodeAndAddSalt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . synWords 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 StringEncoder AST#expression#Right . encodeAndAddSalt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . asynWords 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 StringEncoder AST#expression#Right . encodeAndAddSalt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . exampleEn1 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 StringEncoder AST#expression#Right . encodeAndAddSalt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . titleCn1 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 StringEncoder AST#expression#Right . encodeAndAddSalt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . exampleEn2 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 StringEncoder AST#expression#Right . encodeAndAddSalt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . exampleCn2 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 StringEncoder AST#expression#Right . encodeAndAddSalt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . exampleEn3 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 StringEncoder AST#expression#Right . encodeAndAddSalt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . exampleCn3 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 StringEncoder AST#expression#Right . encodeAndAddSalt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . usedPhrase 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 StringEncoder AST#expression#Right . encodeAndAddSalt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . en2En 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 StringEncoder AST#expression#Right . encodeAndAddSalt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . discriminate AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // ============================================================ // MARK: - 执行 // ============================================================ AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DebugLog AST#expression#Right . d AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sqlDelete 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 DebugLog AST#expression#Right . d 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 paramsDelete AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#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 . db AST#member_expression#Right AST#expression#Right . updateDb AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sqlDelete AST#expression#Right , AST#expression#Left paramsDelete 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 DebugLog AST#expression#Right . d AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sqlInsert 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 DebugLog AST#expression#Right . d 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 paramsInsert AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#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 . db AST#member_expression#Right AST#expression#Right . updateDb AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sqlInsert AST#expression#Right , AST#expression#Left paramsInsert AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DebugLog AST#expression#Right . e AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` WordDbAccess >>> insertOrUpdateOnlineDataForWord: AST#template_substitution#Left $ { AST#expression#Left e 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
|
async insertOrUpdateOnlineDataForWord(word: WordDetail): Promise<void> {
if (!this.db) return;
const titleEn: string | null = word.titleEn;
if (!titleEn) return;
const titleEnBase64: string | null = word.titleEnEncodeToBase64;
if (!titleEnBase64) return;
const sqlDelete: string = `
DELETE FROM ${WordTable.TableOnline_Name}
WHERE SUBSTR(
${WordTable.Col.TITLEEN},
${DB.salt} + 1,
LENGTH(${WordTable.Col.TITLEEN}) - ${DB.salt}
) = ?
`;
const paramsDelete: ParamType[] = [
titleEnBase64
];
const sqlInsert: string = `
INSERT INTO ${WordTable.TableOnline_Name} (
${WordTable.Col.IDX},
${WordTable.Col.PARTID},
${WordTable.Col.PARTNAME},
${WordTable.Col.UNITID},
${WordTable.Col.UNITNAME},
${WordTable.Col.UNITNO},
${WordTable.Col.TITLEEN},
${WordTable.Col.PRONEN},
${WordTable.Col.PRONUS},
${WordTable.Col.TITLECN1},
${WordTable.Col.TITLECN2},
${WordTable.Col.TITLECN3},
${WordTable.Col.WORDIMAGE},
${WordTable.Col.WORDCHANGE},
${WordTable.Col.SYNWORDS},
${WordTable.Col.ASYNWORDS},
${WordTable.Col.EXAMPLEEN1},
${WordTable.Col.EXAMPLECN1},
${WordTable.Col.EXAMPLEEN2},
${WordTable.Col.EXAMPLECN2},
${WordTable.Col.EXAMPLEEN3},
${WordTable.Col.EXAMPLECN3},
${WordTable.Col.USEDPHRASE},
${WordTable.Col.EN2EN},
${WordTable.Col.DISCRIMINATE}
) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
`;
const paramsInsert: ParamType[] = [
word.idx,
word.partId,
StringEncoder.encodeAndAddSalt(word.partName),
word.unitId,
StringEncoder.encodeAndAddSalt(word.unitName),
word.unitNo,
word.titleEnEncodeAndAddSalt,
StringEncoder.encodeAndAddSalt(word.pronEn),
StringEncoder.encodeAndAddSalt(word.pronUs),
StringEncoder.encodeAndAddSalt(word.titleCn1),
StringEncoder.encodeAndAddSalt(word.titleCn2),
StringEncoder.encodeAndAddSalt(word.titleCn3),
StringEncoder.encodeAndAddSalt(word.wordImage),
StringEncoder.encodeAndAddSalt(word.wordChange),
StringEncoder.encodeAndAddSalt(word.synWords),
StringEncoder.encodeAndAddSalt(word.asynWords),
StringEncoder.encodeAndAddSalt(word.exampleEn1),
StringEncoder.encodeAndAddSalt(word.titleCn1),
StringEncoder.encodeAndAddSalt(word.exampleEn2),
StringEncoder.encodeAndAddSalt(word.exampleCn2),
StringEncoder.encodeAndAddSalt(word.exampleEn3),
StringEncoder.encodeAndAddSalt(word.exampleCn3),
StringEncoder.encodeAndAddSalt(word.usedPhrase),
StringEncoder.encodeAndAddSalt(word.en2En),
StringEncoder.encodeAndAddSalt(word.discriminate)
];
try {
DebugLog.d(sqlDelete);
DebugLog.d(JSON.stringify(paramsDelete));
await this.db.updateDb(sqlDelete, paramsDelete);
DebugLog.d(sqlInsert);
DebugLog.d(JSON.stringify(paramsInsert));
await this.db.updateDb(sqlInsert, paramsInsert);
} catch (e) {
DebugLog.e(`WordDbAccess >>> insertOrUpdateOnlineDataForWord: ${e}`);
}
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/myData/WordUserDbAccess.ets#L236-L339
|
6260caf2a9d315d4c00ba3f07c1331a4bf7483e8
|
github
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
HapAndHarDependHar/entry/oh_modules/har_library/oh_modules/har_common/Index.ets
|
arkts
|
funcResult
|
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 { funcResult } from './src/main/ets/utils/Utils';
|
AST#export_declaration#Left export { funcResult } from './src/main/ets/utils/Utils' ; AST#export_declaration#Right
|
export { funcResult } from './src/main/ets/utils/Utils';
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/HapAndHarDependHar/entry/oh_modules/har_library/oh_modules/har_common/Index.ets#L16-L16
|
810d88a39f395b78b41f78bb267fd7b540c94ea1
|
gitee
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/order/src/main/ets/view/OrderDetailPage.ets
|
arkts
|
OrderInfoTitle
|
订单信息标题
@returns {void} 无返回值
|
@Builder
private OrderInfoTitle() {
TitleWithLine({
text: $r("app.string.order_info")
});
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private OrderInfoTitle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left TitleWithLine ( AST#component_parameters#Left { AST#component_parameter#Left text : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.order_info" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
private OrderInfoTitle() {
TitleWithLine({
text: $r("app.string.order_info")
});
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderDetailPage.ets#L335-L340
|
7d91b39c5e7f68925be2f1645382f95611bc5606
|
github
|
jxdiaodeyi/YX_Sports.git
|
af5346bd3d5003c33c306ff77b4b5e9184219893
|
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM2.ets
|
arkts
|
TODO SM2加解密
author: 桃花镇童长老ᥫ᭡
since: 2024/07/01
|
export class SM2 {
/**
* 加密,异步
* @param data 加密或者解密的数据。data不能为null。
* @param pubKey 指定加密公钥。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合,默认SM2_256|SM3。
* @returns
*/
static async encrypt(data: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey,
transformation: string = 'SM2_256|SM3'): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.encrypt(data, pubKey, null, transformation);
}
/**
* 加密,同步
* @param data 加密或者解密的数据。data不能为null。
* @param pubKey 指定加密公钥。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合。
* @returns
*/
static encryptSync(data: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey,
transformation: string = 'SM2_256|SM3'): cryptoFramework.DataBlob {
return CryptoUtil.encryptSync(data, pubKey, null, transformation);
}
/**
* 解密,异步
* @param data 加密或者解密的数据。data不能为null。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合。
* @param priKey 指定解密私钥。
*/
static async decrypt(data: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey,
transformation: string = 'SM2_256|SM3'): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.decrypt(data, priKey, null, transformation);
}
/**
* 解密,同步
* @param data 加密或者解密的数据。data不能为null。
* @param priKey 指定解密私钥。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合。
*/
static decryptSync(data: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey,
transformation: string = 'SM2_256|SM3'): cryptoFramework.DataBlob {
return CryptoUtil.decryptSync(data, priKey, null, transformation);
}
/**
* 生成非对称密钥KeyPair,异步
* @param algName 待生成对称密钥生成器的算法名称(SM2_256、SM2)
* @returns
*/
static async generateKeyPair(algName: string = 'SM2_256'): Promise<cryptoFramework.KeyPair> {
return CryptoUtil.generateKeyPair(algName);
}
/**
* 生成非对称密钥KeyPair,同步
* @param algName 待生成对称密钥生成器的算法名称(SM2_256、SM2)
* @returns
*/
static generateKeyPairSync(algName: string = 'SM2_256'): cryptoFramework.KeyPair {
return CryptoUtil.generateKeyPairSync(algName);
}
/**
* 获取转换的非对称密钥KeyPair,异步
* @param pubKey 公钥字符串
* @param priKey 私钥字符串
* @param keyCoding 秘钥的编码方式(base64/hex/utf8/utf-8)
* @param algName 待生成对称密钥生成器的算法名称(SM2_256、SM2)
* @returns
*/
static async getConvertKeyPair(pubKey: string | Uint8Array | cryptoFramework.DataBlob | null,
priKey: string | Uint8Array | cryptoFramework.DataBlob | null, keyCoding: crypto.BhuCoding,
algName: string = 'SM2_256'): Promise<cryptoFramework.KeyPair> {
return CryptoUtil.getConvertKeyPair(algName, pubKey, priKey, keyCoding);
}
/**
* 获取转换的非对称密钥KeyPair,同步
* @param pubKey 公钥字符串
* @param priKey 私钥字符串
* @param keyCoding 秘钥的编码方式(base64/hex/utf8/utf-8)
* @param algName 待生成对称密钥生成器的算法名称(SM2_256、SM2)
* @returns
*/
static getConvertKeyPairSync(pubKey: string | Uint8Array | cryptoFramework.DataBlob | null,
priKey: string | Uint8Array | cryptoFramework.DataBlob | null, keyCoding: crypto.BhuCoding,
algName: string = 'SM2_256'): cryptoFramework.KeyPair {
return CryptoUtil.getConvertKeyPairSync(algName, pubKey, priKey, keyCoding);
}
/**
* 获取转换SM2公钥, 将16进制的C1C2C3格式的SM2公钥转换为鸿蒙所需的ASN.1格式公钥字符串
* @param pubKey 16进制的公钥字符串
* @returns 转换后的公钥字符串
*/
static getSM2PubKey(strPubKey: string): cryptoFramework.PubKey {
strPubKey = strPubKey.startsWith("04") ? strPubKey.slice(2) : strPubKey;
let px = strPubKey.substring(0, strPubKey.length / 2); //截取x参数
let py = strPubKey.substring(strPubKey.length / 2); //截取y参数
//转16进制放入对应的位置 04+x+y
let pk: cryptoFramework.Point = {
x: BigInt("0x" + px),
y: BigInt("0x" + py)
}
//构建SM2公钥参数对象
let keyPair: cryptoFramework.ECCPubKeySpec = {
params: cryptoFramework.ECCKeyUtil.genECCCommonParamsSpec('NID_sm2'),
pk: pk,
algName: 'SM2',
specType: cryptoFramework.AsyKeySpecType.PUBLIC_KEY_SPEC
}
let keyPairGenerator = cryptoFramework.createAsyKeyGeneratorBySpec(keyPair); //创建密钥生成器
let pubKey: cryptoFramework.PubKey = keyPairGenerator.generatePubKeySync(); //生成uint8Array格式密钥,转换成鸿蒙所需公钥
return pubKey;
}
/**
* 获取转换SM2私钥
* @param key 传入的密钥数据,未序列化的原始裸数据
* @returns
*/
static getSM2PriKey(key: string): cryptoFramework.PriKey {
key = StrUtil.startsWith(key, "0x") ? key : `0x${key}`;
let sk: bigint = BigInt(key);
let priKey: cryptoFramework.ECCPriKeySpec = {
params: cryptoFramework.ECCKeyUtil.genECCCommonParamsSpec('NID_sm2'),
sk: sk,
algName: "SM2",
specType: cryptoFramework.AsyKeySpecType.PRIVATE_KEY_SPEC
}
let KeyPairGenerator = cryptoFramework.createAsyKeyGeneratorBySpec(priKey);
return KeyPairGenerator.generatePriKeySync();
}
/**
* 获取转换SM2密文格式,ASN.1格式转换为C1C2C3或C1C3C2
* @param cipherText ASN.1格式的SM2密文参数
* @param cipherMode 0-C1C2C3 、1-C1C3C2,默认为0
* @returns
*/
static getCipherTextSpec(cipherText: cryptoFramework.DataBlob, mode: number = 0): string {
try {
let spec: cryptoFramework.SM2CipherTextSpec =
cryptoFramework.SM2CryptoUtil.getCipherTextSpec(cipherText, 'C1C3C2');
let startPre = "04";
// bigint 转十六进制需要补零,参考BC转换
let c1x = CryptoHelper.toHexWithPaddingZero(spec.xCoordinate);
let c1y = CryptoHelper.toHexWithPaddingZero(spec.yCoordinate);
let c3 = buffer.from(spec.hashData).toString('hex');
let c2 = buffer.from(spec.cipherTextData).toString('hex');
if (mode === 0) {
return (startPre + c1x + c1y + c2 + c3).toUpperCase();
} else {
return (startPre + c1x + c1y + c3 + c2).toUpperCase();
}
} catch (err) {
let e: BusinessError = err as BusinessError;
LogUtil.error(`getCipherTextSpec error, ${e.code}, ${e.message}`);
}
return "";
}
/**
* 对数据进行签名,异步
* @param dataBlob 待签名数据
* @param priKey 私钥
* @param algName 指定签名算法(SM2_256|SM3、SM2|SM3)。
* @returns
*/
static async sign(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey,
algName: string = 'SM2_256|SM3'): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.sign(dataBlob, priKey, algName);
}
/**
* 对数据进行签名,同步
* @param dataBlob 待签名数据
* @param priKey 私钥
* @param algName 指定签名算法(SM2_256|SM3、SM2|SM3)。
* @returns
*/
static signSync(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey,
algName: string = 'SM2_256|SM3'): cryptoFramework.DataBlob {
return CryptoUtil.signSync(dataBlob, priKey, algName);
}
/**
* 对数据进行验签,异步
* @param dataBlob 待验签数据
* @param signDataBlob 签名数据
* @param pubKey 公钥
* @param algName 指定签名算法(SM2_256|SM3、SM2|SM3)。
* @returns
*/
static async verify(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string = 'SM2_256|SM3'): Promise<boolean> {
return CryptoUtil.verify(dataBlob, signDataBlob, pubKey, algName);
}
/**
* 对数据进行验签,同步
* @param dataBlob 待验签数据
* @param signDataBlob 签名数据
* @param pubKey 公钥
* @param algName 指定签名算法(SM2_256|SM3、SM2|SM3)。
* @returns
*/
static verifySync(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string = 'SM2_256|SM3'): boolean {
return CryptoUtil.verifySync(dataBlob, signDataBlob, pubKey, algName);
}
/**
* 对数据进行分段签名,异步
* @param data 待签名数据
* @param priKey 私钥
* @param algName 指定签名算法(SM2_256|SM3、SM2|SM3)。
* @param len 自定义的数据拆分长度,此处取128
* @returns
*/
static async signSegment(data: Uint8Array, priKey: cryptoFramework.PriKey, algName: string = 'SM2_256|SM3',
len: number = 128): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.signSegment(data, priKey, algName, len);
}
/**
* 对数据进行分段签名,同步
* @param data 待签名数据
* @param priKey 私钥
* @param algName 指定签名算法(SM2_256|SM3、SM2|SM3)。
* @param len 自定义的数据拆分长度,此处取64
* @returns
*/
static signSegmentSync(data: Uint8Array, priKey: cryptoFramework.PriKey, algName: string = 'SM2_256|SM3',
len: number = 128): cryptoFramework.DataBlob {
return CryptoUtil.signSegmentSync(data, priKey, algName, len);
}
/**
* 对数据进行分段验签,异步
* @param data 待验签数据
* @param signDataBlob 签名数据
* @param pubKey 公钥
* @param algName 指定签名算法(SM2_256|SM3、SM2|SM3)。
* @param len 自定义的数据拆分长度,此处取128
* @returns
*/
static async verifySegment(data: Uint8Array, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey,
algName: string = 'SM2_256|SM3', len: number = 128): Promise<boolean> {
return CryptoUtil.verifySegment(data, signDataBlob, pubKey, algName, len);
}
/**
* 对数据进行分段验签,同步
* @param data 待验签数据
* @param signDataBlob 签名数据
* @param pubKey 公钥
* @param algName 指定签名算法(SM2_256|SM3、SM2|SM3)。
* @param len 自定义的数据拆分长度,此处取128
* @returns
*/
static verifySegmentSync(data: Uint8Array, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey,
algName: string = 'SM2_256|SM3', len: number = 128): boolean {
return CryptoUtil.verifySegmentSync(data, signDataBlob, pubKey, algName, len);
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class SM2 AST#class_body#Left { /**
* 加密,异步
* @param data 加密或者解密的数据。data不能为null。
* @param pubKey 指定加密公钥。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合,默认SM2_256|SM3。
* @returns
*/ AST#method_declaration#Left static async encrypt AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PubKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left transformation : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SM2_256|SM3' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#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 CryptoUtil AST#expression#Right . encrypt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left pubKey AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left transformation AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 加密,同步
* @param data 加密或者解密的数据。data不能为null。
* @param pubKey 指定加密公钥。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合。
* @returns
*/ AST#method_declaration#Left static encryptSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PubKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left transformation : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SM2_256|SM3' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . encryptSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left pubKey AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left transformation AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 解密,异步
* @param data 加密或者解密的数据。data不能为null。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合。
* @param priKey 指定解密私钥。
*/ AST#method_declaration#Left static async decrypt AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PriKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left transformation : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SM2_256|SM3' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#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 CryptoUtil AST#expression#Right . decrypt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left priKey AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left transformation AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 解密,同步
* @param data 加密或者解密的数据。data不能为null。
* @param priKey 指定解密私钥。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合。
*/ AST#method_declaration#Left static decryptSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PriKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left transformation : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SM2_256|SM3' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . decryptSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left priKey AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left transformation AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 生成非对称密钥KeyPair,异步
* @param algName 待生成对称密钥生成器的算法名称(SM2_256、SM2)
* @returns
*/ AST#method_declaration#Left static async generateKeyPair AST#parameter_list#Left ( AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SM2_256' 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 AST#qualified_type#Left cryptoFramework . KeyPair AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . generateKeyPair AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 生成非对称密钥KeyPair,同步
* @param algName 待生成对称密钥生成器的算法名称(SM2_256、SM2)
* @returns
*/ AST#method_declaration#Left static generateKeyPairSync AST#parameter_list#Left ( AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SM2_256' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . KeyPair AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . generateKeyPairSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取转换的非对称密钥KeyPair,异步
* @param pubKey 公钥字符串
* @param priKey 私钥字符串
* @param keyCoding 秘钥的编码方式(base64/hex/utf8/utf-8)
* @param algName 待生成对称密钥生成器的算法名称(SM2_256、SM2)
* @returns
*/ AST#method_declaration#Left static async getConvertKeyPair AST#parameter_list#Left ( AST#parameter#Left pubKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob 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#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob 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#parameter#Right , AST#parameter#Left keyCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . BhuCoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SM2_256' 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 AST#qualified_type#Left cryptoFramework . KeyPair AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . getConvertKeyPair AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName AST#expression#Right , AST#expression#Left pubKey AST#expression#Right , AST#expression#Left priKey AST#expression#Right , AST#expression#Left keyCoding 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 /**
* 获取转换的非对称密钥KeyPair,同步
* @param pubKey 公钥字符串
* @param priKey 私钥字符串
* @param keyCoding 秘钥的编码方式(base64/hex/utf8/utf-8)
* @param algName 待生成对称密钥生成器的算法名称(SM2_256、SM2)
* @returns
*/ AST#method_declaration#Left static getConvertKeyPairSync AST#parameter_list#Left ( AST#parameter#Left pubKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob 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#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob 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#parameter#Right , AST#parameter#Left keyCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . BhuCoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SM2_256' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . KeyPair AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . getConvertKeyPairSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName AST#expression#Right , AST#expression#Left pubKey AST#expression#Right , AST#expression#Left priKey AST#expression#Right , AST#expression#Left keyCoding 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 /**
* 获取转换SM2公钥, 将16进制的C1C2C3格式的SM2公钥转换为鸿蒙所需的ASN.1格式公钥字符串
* @param pubKey 16进制的公钥字符串
* @returns 转换后的公钥字符串
*/ AST#method_declaration#Left static getSM2PubKey AST#parameter_list#Left ( AST#parameter#Left strPubKey : 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#qualified_type#Left cryptoFramework . PubKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left strPubKey = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left strPubKey AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "04" 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 strPubKey AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left strPubKey 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#variable_declaration#Left let AST#variable_declarator#Left px = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left strPubKey AST#expression#Right . substring 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#member_expression#Left AST#expression#Left strPubKey AST#expression#Right . length AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //截取x参数 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left py = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left strPubKey AST#expression#Right . substring 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 strPubKey AST#expression#Right . length AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //截取y参数 //转16进制放入对应的位置 04+x+y AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left pk : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . Point AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left BigInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left "0x" AST#expression#Right + AST#expression#Left px AST#expression#Right AST#binary_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 y AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left BigInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left "0x" AST#expression#Right + AST#expression#Left py AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right //构建SM2公钥参数对象 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyPair : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . ECCPubKeySpec AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left params 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 cryptoFramework AST#expression#Right . ECCKeyUtil AST#member_expression#Right AST#expression#Right . genECCCommonParamsSpec AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'NID_sm2' 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 pk AST#property_name#Right : AST#expression#Left pk AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left algName AST#property_name#Right : AST#expression#Left 'SM2' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left specType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . AsyKeySpecType AST#member_expression#Right AST#expression#Right . PUBLIC_KEY_SPEC AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyPairGenerator = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createAsyKeyGeneratorBySpec AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left keyPair 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 pubKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PubKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left keyPairGenerator AST#expression#Right . generatePubKeySync 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 //生成uint8Array格式密钥,转换成鸿蒙所需公钥 AST#statement#Left AST#return_statement#Left return AST#expression#Left pubKey AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取转换SM2私钥
* @param key 传入的密钥数据,未序列化的原始裸数据
* @returns
*/ AST#method_declaration#Left static getSM2PriKey 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 AST#qualified_type#Left cryptoFramework . PriKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left key = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StrUtil AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left "0x" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#ERROR#Left ? AST#ERROR#Left key : AST#ERROR#Right AST#expression#Left AST#template_literal#Left ` 0x AST#template_substitution#Left $ { AST#expression#Left key AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left sk : AST#type_annotation#Left AST#primary_type#Left bigint AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left BigInt 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 priKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . ECCPriKeySpec AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left params 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 cryptoFramework AST#expression#Right . ECCKeyUtil AST#member_expression#Right AST#expression#Right . genECCCommonParamsSpec AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'NID_sm2' 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 sk AST#property_name#Right : AST#expression#Left sk AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left algName AST#property_name#Right : AST#expression#Left "SM2" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left specType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . AsyKeySpecType AST#member_expression#Right AST#expression#Right . PRIVATE_KEY_SPEC AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left KeyPairGenerator = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createAsyKeyGeneratorBySpec AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left priKey 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 KeyPairGenerator AST#expression#Right . generatePriKeySync 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 /**
* 获取转换SM2密文格式,ASN.1格式转换为C1C2C3或C1C3C2
* @param cipherText ASN.1格式的SM2密文参数
* @param cipherMode 0-C1C2C3 、1-C1C3C2,默认为0
* @returns
*/ AST#method_declaration#Left static getCipherTextSpec AST#parameter_list#Left ( AST#parameter#Left cipherText : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left 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 string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left spec : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SM2CipherTextSpec AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . SM2CryptoUtil AST#member_expression#Right AST#expression#Right . getCipherTextSpec AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left cipherText AST#expression#Right , AST#expression#Left 'C1C3C2' 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 startPre = AST#expression#Left "04" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // bigint 转十六进制需要补零,参考BC转换 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left c1x = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . toHexWithPaddingZero AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . xCoordinate 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 c1y = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . toHexWithPaddingZero AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . yCoordinate 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 c3 = 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 buffer AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . hashData AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'hex' 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 c2 = 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 buffer AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . cipherTextData AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'hex' 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 mode AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#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#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left startPre AST#expression#Right + AST#expression#Left c1x AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left c1y AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left c2 AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left c3 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . toUpperCase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left startPre AST#expression#Right + AST#expression#Left c1x AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left c1y AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left c3 AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left c2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . toUpperCase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_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#variable_declaration#Left let AST#variable_declarator#Left e : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left err AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` getCipherTextSpec error, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . code 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 e AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left "" AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 对数据进行签名,异步
* @param dataBlob 待签名数据
* @param priKey 私钥
* @param algName 指定签名算法(SM2_256|SM3、SM2|SM3)。
* @returns
*/ AST#method_declaration#Left static async sign AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PriKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SM2_256|SM3' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#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 CryptoUtil AST#expression#Right . sign AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dataBlob AST#expression#Right , AST#expression#Left priKey AST#expression#Right , AST#expression#Left algName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 对数据进行签名,同步
* @param dataBlob 待签名数据
* @param priKey 私钥
* @param algName 指定签名算法(SM2_256|SM3、SM2|SM3)。
* @returns
*/ AST#method_declaration#Left static signSync AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PriKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SM2_256|SM3' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . signSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dataBlob AST#expression#Right , AST#expression#Left priKey AST#expression#Right , AST#expression#Left algName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 对数据进行验签,异步
* @param dataBlob 待验签数据
* @param signDataBlob 签名数据
* @param pubKey 公钥
* @param algName 指定签名算法(SM2_256|SM3、SM2|SM3)。
* @returns
*/ AST#method_declaration#Left static async verify AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left signDataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PubKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SM2_256|SM3' 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 boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . verify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dataBlob AST#expression#Right , AST#expression#Left signDataBlob AST#expression#Right , AST#expression#Left pubKey AST#expression#Right , AST#expression#Left algName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 对数据进行验签,同步
* @param dataBlob 待验签数据
* @param signDataBlob 签名数据
* @param pubKey 公钥
* @param algName 指定签名算法(SM2_256|SM3、SM2|SM3)。
* @returns
*/ AST#method_declaration#Left static verifySync AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left signDataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PubKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SM2_256|SM3' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . verifySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dataBlob AST#expression#Right , AST#expression#Left signDataBlob AST#expression#Right , AST#expression#Left pubKey AST#expression#Right , AST#expression#Left algName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 对数据进行分段签名,异步
* @param data 待签名数据
* @param priKey 私钥
* @param algName 指定签名算法(SM2_256|SM3、SM2|SM3)。
* @param len 自定义的数据拆分长度,此处取128
* @returns
*/ AST#method_declaration#Left static async signSegment AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PriKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SM2_256|SM3' AST#expression#Right AST#parameter#Right , AST#parameter#Left len : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 128 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 AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . signSegment AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left priKey AST#expression#Right , AST#expression#Left algName AST#expression#Right , AST#expression#Left len AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 对数据进行分段签名,同步
* @param data 待签名数据
* @param priKey 私钥
* @param algName 指定签名算法(SM2_256|SM3、SM2|SM3)。
* @param len 自定义的数据拆分长度,此处取64
* @returns
*/ AST#method_declaration#Left static signSegmentSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PriKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SM2_256|SM3' AST#expression#Right AST#parameter#Right , AST#parameter#Left len : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 128 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . signSegmentSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left priKey AST#expression#Right , AST#expression#Left algName AST#expression#Right , AST#expression#Left len AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 对数据进行分段验签,异步
* @param data 待验签数据
* @param signDataBlob 签名数据
* @param pubKey 公钥
* @param algName 指定签名算法(SM2_256|SM3、SM2|SM3)。
* @param len 自定义的数据拆分长度,此处取128
* @returns
*/ AST#method_declaration#Left static async verifySegment AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left signDataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PubKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SM2_256|SM3' AST#expression#Right AST#parameter#Right , AST#parameter#Left len : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 128 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 boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . verifySegment AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left signDataBlob AST#expression#Right , AST#expression#Left pubKey AST#expression#Right , AST#expression#Left algName AST#expression#Right , AST#expression#Left len AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 对数据进行分段验签,同步
* @param data 待验签数据
* @param signDataBlob 签名数据
* @param pubKey 公钥
* @param algName 指定签名算法(SM2_256|SM3、SM2|SM3)。
* @param len 自定义的数据拆分长度,此处取128
* @returns
*/ AST#method_declaration#Left static verifySegmentSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left signDataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PubKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SM2_256|SM3' AST#expression#Right AST#parameter#Right , AST#parameter#Left len : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 128 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . verifySegmentSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left signDataBlob AST#expression#Right , AST#expression#Left pubKey AST#expression#Right , AST#expression#Left algName AST#expression#Right , AST#expression#Left len AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class SM2 {
static async encrypt(data: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey,
transformation: string = 'SM2_256|SM3'): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.encrypt(data, pubKey, null, transformation);
}
static encryptSync(data: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey,
transformation: string = 'SM2_256|SM3'): cryptoFramework.DataBlob {
return CryptoUtil.encryptSync(data, pubKey, null, transformation);
}
static async decrypt(data: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey,
transformation: string = 'SM2_256|SM3'): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.decrypt(data, priKey, null, transformation);
}
static decryptSync(data: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey,
transformation: string = 'SM2_256|SM3'): cryptoFramework.DataBlob {
return CryptoUtil.decryptSync(data, priKey, null, transformation);
}
static async generateKeyPair(algName: string = 'SM2_256'): Promise<cryptoFramework.KeyPair> {
return CryptoUtil.generateKeyPair(algName);
}
static generateKeyPairSync(algName: string = 'SM2_256'): cryptoFramework.KeyPair {
return CryptoUtil.generateKeyPairSync(algName);
}
static async getConvertKeyPair(pubKey: string | Uint8Array | cryptoFramework.DataBlob | null,
priKey: string | Uint8Array | cryptoFramework.DataBlob | null, keyCoding: crypto.BhuCoding,
algName: string = 'SM2_256'): Promise<cryptoFramework.KeyPair> {
return CryptoUtil.getConvertKeyPair(algName, pubKey, priKey, keyCoding);
}
static getConvertKeyPairSync(pubKey: string | Uint8Array | cryptoFramework.DataBlob | null,
priKey: string | Uint8Array | cryptoFramework.DataBlob | null, keyCoding: crypto.BhuCoding,
algName: string = 'SM2_256'): cryptoFramework.KeyPair {
return CryptoUtil.getConvertKeyPairSync(algName, pubKey, priKey, keyCoding);
}
static getSM2PubKey(strPubKey: string): cryptoFramework.PubKey {
strPubKey = strPubKey.startsWith("04") ? strPubKey.slice(2) : strPubKey;
let px = strPubKey.substring(0, strPubKey.length / 2);
let py = strPubKey.substring(strPubKey.length / 2);
let pk: cryptoFramework.Point = {
x: BigInt("0x" + px),
y: BigInt("0x" + py)
}
let keyPair: cryptoFramework.ECCPubKeySpec = {
params: cryptoFramework.ECCKeyUtil.genECCCommonParamsSpec('NID_sm2'),
pk: pk,
algName: 'SM2',
specType: cryptoFramework.AsyKeySpecType.PUBLIC_KEY_SPEC
}
let keyPairGenerator = cryptoFramework.createAsyKeyGeneratorBySpec(keyPair);
let pubKey: cryptoFramework.PubKey = keyPairGenerator.generatePubKeySync();
return pubKey;
}
static getSM2PriKey(key: string): cryptoFramework.PriKey {
key = StrUtil.startsWith(key, "0x") ? key : `0x${key}`;
let sk: bigint = BigInt(key);
let priKey: cryptoFramework.ECCPriKeySpec = {
params: cryptoFramework.ECCKeyUtil.genECCCommonParamsSpec('NID_sm2'),
sk: sk,
algName: "SM2",
specType: cryptoFramework.AsyKeySpecType.PRIVATE_KEY_SPEC
}
let KeyPairGenerator = cryptoFramework.createAsyKeyGeneratorBySpec(priKey);
return KeyPairGenerator.generatePriKeySync();
}
static getCipherTextSpec(cipherText: cryptoFramework.DataBlob, mode: number = 0): string {
try {
let spec: cryptoFramework.SM2CipherTextSpec =
cryptoFramework.SM2CryptoUtil.getCipherTextSpec(cipherText, 'C1C3C2');
let startPre = "04";
let c1x = CryptoHelper.toHexWithPaddingZero(spec.xCoordinate);
let c1y = CryptoHelper.toHexWithPaddingZero(spec.yCoordinate);
let c3 = buffer.from(spec.hashData).toString('hex');
let c2 = buffer.from(spec.cipherTextData).toString('hex');
if (mode === 0) {
return (startPre + c1x + c1y + c2 + c3).toUpperCase();
} else {
return (startPre + c1x + c1y + c3 + c2).toUpperCase();
}
} catch (err) {
let e: BusinessError = err as BusinessError;
LogUtil.error(`getCipherTextSpec error, ${e.code}, ${e.message}`);
}
return "";
}
static async sign(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey,
algName: string = 'SM2_256|SM3'): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.sign(dataBlob, priKey, algName);
}
static signSync(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey,
algName: string = 'SM2_256|SM3'): cryptoFramework.DataBlob {
return CryptoUtil.signSync(dataBlob, priKey, algName);
}
static async verify(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string = 'SM2_256|SM3'): Promise<boolean> {
return CryptoUtil.verify(dataBlob, signDataBlob, pubKey, algName);
}
static verifySync(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string = 'SM2_256|SM3'): boolean {
return CryptoUtil.verifySync(dataBlob, signDataBlob, pubKey, algName);
}
static async signSegment(data: Uint8Array, priKey: cryptoFramework.PriKey, algName: string = 'SM2_256|SM3',
len: number = 128): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.signSegment(data, priKey, algName, len);
}
static signSegmentSync(data: Uint8Array, priKey: cryptoFramework.PriKey, algName: string = 'SM2_256|SM3',
len: number = 128): cryptoFramework.DataBlob {
return CryptoUtil.signSegmentSync(data, priKey, algName, len);
}
static async verifySegment(data: Uint8Array, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey,
algName: string = 'SM2_256|SM3', len: number = 128): Promise<boolean> {
return CryptoUtil.verifySegment(data, signDataBlob, pubKey, algName, len);
}
static verifySegmentSync(data: Uint8Array, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey,
algName: string = 'SM2_256|SM3', len: number = 128): boolean {
return CryptoUtil.verifySegmentSync(data, signDataBlob, pubKey, algName, len);
}
}
|
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM2.ets#L30-L312
|
08df43568b2b0901c2069a6ae7f40be2787299cf
|
github
|
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
ImageEditTaskPool/entry/src/main/ets/view/WorkerPort.ets
|
arkts
|
execColorInfo
|
Picture pixel calculation
|
function execColorInfo(bufferArray: ArrayBuffer, last: number, cur: number, hsvIndex: number) {
// ...
const newBufferArr = bufferArray;
let colorInfo = new Uint8Array(newBufferArr);
for (let i = 0; i < colorInfo?.length; i += CommonConstants.PIXEL_STEP) {
const hsv = rgb2hsv(colorInfo[i + RGBIndex.RED], colorInfo[i + RGBIndex.GREEN], colorInfo[i + RGBIndex.BLUE]);
let rate = cur / last;
hsv[hsvIndex] *= rate;
const rgb: ESObject = hsv2rgb(hsv[HSVIndex.HUE], hsv[HSVIndex.SATURATION], hsv[HSVIndex.VALUE]);
colorInfo[i + RGBIndex.RED] = rgb[RGBIndex.RED];
colorInfo[i + RGBIndex.GREEN] = rgb[RGBIndex.GREEN];
colorInfo[i + RGBIndex.BLUE] = rgb[RGBIndex.BLUE];
}
return newBufferArr;
}
|
AST#function_declaration#Left function execColorInfo AST#parameter_list#Left ( AST#parameter#Left bufferArray : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left last : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cur : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left hsvIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // ... AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left newBufferArr = AST#expression#Left bufferArray 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 colorInfo = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Uint8Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left newBufferArr AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left colorInfo AST#expression#Right AST#binary_expression#Right AST#expression#Right ?. length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#assignment_expression#Left i += AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . PIXEL_STEP AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left hsv = AST#expression#Left AST#call_expression#Left AST#expression#Left rgb2hsv AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left colorInfo AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left RGBIndex AST#expression#Right AST#binary_expression#Right AST#expression#Right . RED AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left colorInfo AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left RGBIndex AST#expression#Right AST#binary_expression#Right AST#expression#Right . GREEN AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left colorInfo AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left RGBIndex AST#expression#Right AST#binary_expression#Right AST#expression#Right . BLUE AST#member_expression#Right AST#expression#Right ] AST#subscript_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 rate = AST#expression#Left AST#binary_expression#Left AST#expression#Left cur AST#expression#Right / AST#expression#Left last 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#subscript_expression#Left AST#expression#Left hsv AST#expression#Right [ AST#expression#Left hsvIndex AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left * = rate AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left rgb : 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 hsv2rgb AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left hsv AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left HSVIndex AST#expression#Right . HUE AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left hsv AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left HSVIndex AST#expression#Right . SATURATION AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left hsv AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left HSVIndex AST#expression#Right . VALUE AST#member_expression#Right AST#expression#Right ] AST#subscript_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#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left colorInfo AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left RGBIndex AST#expression#Right AST#binary_expression#Right AST#expression#Right . RED AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = rgb AST#ERROR#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left RGBIndex AST#expression#Right . RED AST#member_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#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left colorInfo AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left RGBIndex AST#expression#Right AST#binary_expression#Right AST#expression#Right . GREEN AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = rgb AST#ERROR#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left RGBIndex AST#expression#Right . GREEN AST#member_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#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left colorInfo AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left RGBIndex AST#expression#Right AST#binary_expression#Right AST#expression#Right . BLUE AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = rgb AST#ERROR#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left RGBIndex AST#expression#Right . BLUE AST#member_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#return_statement#Left return AST#expression#Left newBufferArr AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
|
function execColorInfo(bufferArray: ArrayBuffer, last: number, cur: number, hsvIndex: number) {
const newBufferArr = bufferArray;
let colorInfo = new Uint8Array(newBufferArr);
for (let i = 0; i < colorInfo?.length; i += CommonConstants.PIXEL_STEP) {
const hsv = rgb2hsv(colorInfo[i + RGBIndex.RED], colorInfo[i + RGBIndex.GREEN], colorInfo[i + RGBIndex.BLUE]);
let rate = cur / last;
hsv[hsvIndex] *= rate;
const rgb: ESObject = hsv2rgb(hsv[HSVIndex.HUE], hsv[HSVIndex.SATURATION], hsv[HSVIndex.VALUE]);
colorInfo[i + RGBIndex.RED] = rgb[RGBIndex.RED];
colorInfo[i + RGBIndex.GREEN] = rgb[RGBIndex.GREEN];
colorInfo[i + RGBIndex.BLUE] = rgb[RGBIndex.BLUE];
}
return newBufferArr;
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ImageEditTaskPool/entry/src/main/ets/view/WorkerPort.ets#L25-L39
|
753b01a27397c9cb6bcda762131573e0ec211af4
|
gitee
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/blocks/modules/meowTabsVertical.ets
|
arkts
|
is_right_align
|
Data
|
is_right_align() {
return (this.preferred_hand_left_or_right == 'right' && !this.preferred_hand_reverse_tabs_panel) ||
(!(this.preferred_hand_left_or_right == 'right') && this.preferred_hand_reverse_tabs_panel);
}
|
AST#method_declaration#Left is_right_align AST#parameter_list#Left ( ) AST#parameter_list#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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . preferred_hand_left_or_right AST#member_expression#Right AST#expression#Right == AST#expression#Left 'right' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . preferred_hand_reverse_tabs_panel AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right || AST#expression#Left AST#parenthesized_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 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 . preferred_hand_left_or_right AST#member_expression#Right AST#expression#Right == AST#expression#Left 'right' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . preferred_hand_reverse_tabs_panel AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
is_right_align() {
return (this.preferred_hand_left_or_right == 'right' && !this.preferred_hand_reverse_tabs_panel) ||
(!(this.preferred_hand_left_or_right == 'right') && this.preferred_hand_reverse_tabs_panel);
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowTabsVertical.ets#L269-L272
|
862044df5ee5a66310a208793df2f5e272160c80
|
gitee
|
openharmony/xts_acts
|
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
|
arkcompiler/esmodule/esmodule_dynamicimport/Sharelibraryhsp/src/main/ets/utils/Calc.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 function add(a:number, b:number): number{
return a + b;
}
|
AST#export_declaration#Left export AST#function_declaration#Left function add AST#parameter_list#Left ( AST#parameter#Left a : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left b : 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 a AST#expression#Right + AST#expression#Left b AST#expression#Right AST#binary_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 add(a:number, b:number): number{
return a + b;
}
|
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkcompiler/esmodule/esmodule_dynamicimport/Sharelibraryhsp/src/main/ets/utils/Calc.ets#L16-L18
|
ed5f385efc986657a9ad5e063bdef0bf61628a5d
|
gitee
|
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
NavigationRouter/RouterModule/Index.ets
|
arkts
|
RouterModule
|
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 { RouterModule } from './src/main/ets/utils/RouterModule';
|
AST#export_declaration#Left export { RouterModule } from './src/main/ets/utils/RouterModule' ; AST#export_declaration#Right
|
export { RouterModule } from './src/main/ets/utils/RouterModule';
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NavigationRouter/RouterModule/Index.ets#L16-L16
|
131c2363ec7c17a37af0b929e6d798a2af82fe43
|
gitee
|
EL233/WeChat-HarmonyOS.git
|
b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e
|
entry/src/main/ets/view/PersonalInformation.ets
|
arkts
|
兴趣项列表
|
constructor(hobbyItems: HobbyItem[]) {
this.hobbyItems = hobbyItems; // 初始化兴趣项列表
}
|
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left hobbyItems : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left HobbyItem [ ] 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hobbyItems AST#member_expression#Right = AST#expression#Left hobbyItems 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(hobbyItems: HobbyItem[]) {
this.hobbyItems = hobbyItems;
}
|
https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/view/PersonalInformation.ets#L25-L27
|
48309da146f020ae087b0874cddb14aefce9a334
|
github
|
|
didi/dimina.git
|
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
|
harmony/dimina/src/main/ets/Utils/DMPWindowUtils.ets
|
arkts
|
getBottomSafeArea
|
系统返回的单位应该是px
@param _windowStage
@returns
|
public static getBottomSafeArea(_windowStage: window.WindowStage): number {
let windowClass: window.Window = _windowStage.getMainWindowSync(); // 获取应用主窗口
// 2. 获取布局避让遮挡的区域
let type = window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR; // 以导航条避让为例
let avoidArea = windowClass.getWindowAvoidArea(type);
return avoidArea.bottomRect.height; // 获取到导航条区域的高度
}
|
AST#method_declaration#Left public static getBottomSafeArea AST#parameter_list#Left ( AST#parameter#Left _windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage 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 number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#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 _windowStage AST#expression#Right . getMainWindowSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 获取应用主窗口 // 2. 获取布局避让遮挡的区域 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left type = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left window AST#expression#Right . AvoidAreaType AST#member_expression#Right AST#expression#Right . TYPE_NAVIGATION_INDICATOR 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 avoidArea = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left windowClass AST#expression#Right . getWindowAvoidArea 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left avoidArea AST#expression#Right . bottomRect AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right // 获取到导航条区域的高度 } AST#block_statement#Right AST#method_declaration#Right
|
public static getBottomSafeArea(_windowStage: window.WindowStage): number {
let windowClass: window.Window = _windowStage.getMainWindowSync();
let type = window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR;
let avoidArea = windowClass.getWindowAvoidArea(type);
return avoidArea.bottomRect.height;
}
|
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Utils/DMPWindowUtils.ets#L60-L66
|
1ea5f990046ac05b2c5f2ab0a48db4481caf4972
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/view/YearViewItem.ets
|
arkts
|
YearViewItem
|
时间计算工具类
年视图子组件
|
@Component
export struct YearViewItem {
// 年视图离屏画布列表
@State yearViewList: Array<OffscreenCanvas> = [];
@Prop @Watch('updateYearData') year: number;
// 年视图月份点击回调
onMonthClick: (year: number, month: number) => void = () => {
};
/**
* 更新年数据
*/
updateYearData() {
this.yearViewList = [];
for (let i = 1; i <= Constants.MONTHS_NUM; i++) {
this.yearViewList.push(new OffscreenCanvas(this.year, i));
}
}
aboutToAppear(): void {
// 添加年视图中每个月的离屏画布对象。一个画布对象绘制一个月数据。
for (let i = 1; i <= Constants.MONTHS_NUM; i++) {
this.yearViewList.push(new OffscreenCanvas(this.year, i));
}
}
build() {
Grid() {
ForEach(this.yearViewList, (monthItem: OffscreenCanvas) => {
GridItem() {
// TODO: 高性能知识点: 年视图使用Canvas绘制显示年视图中每个月,以减少节点数量,同时使用OffscreenCanvasRenderingContext2D离
// 屏绘制,将需要绘制的内容先绘制在缓存区,然后将其转换成图片,一次性绘制到canvas上,以加快绘制速度。
Canvas(monthItem.context)
.width($r('app.string.calendar_switch_full_size'))
.height($r('app.string.calendar_switch_full_size'))
.onReady(() => {
// 绘制年视图中一个月的数据
let isTodayMoth: boolean =
monthItem.year === Constants.TODAY_YEAR && monthItem.month === Constants.TODAY_MONTH;
// 画月
monthItem.offContext.font = Constants.YEAR_VIEW_MONTH_FONT[CommonData.DEVICE_TYPE];
monthItem.offContext.fillStyle = isTodayMoth ? Color.Red : Color.Black;
monthItem.offContext.fillText(Constants.MONTHS[monthItem.month-1],
Constants.YEAR_VIEW_INIT_THREE[CommonData.DEVICE_TYPE],
Constants.YEAR_VIEW_MONTH_HEIGHT[CommonData.DEVICE_TYPE]);
// 水平偏移
let horizontalOffset = Constants.YEAR_VIEW_INIT_THREE[CommonData.DEVICE_TYPE];
// 画星期
monthItem.offContext.font = Constants.YEAR_VIEW_WEEK_FONT[CommonData.DEVICE_TYPE];
for (let i = 0; i < Constants.WEEKS.length; i++) {
// 星期六,日字体颜色设置灰色
if (i === 0 || i === 6) {
monthItem.offContext.fillStyle = Constants.YEAR_VIEW_FONT_COLOR;
}
monthItem.offContext.fillText(Constants.WEEKS[i], horizontalOffset,
Constants.YEAR_VIEW_WEEK_HEIGHT[CommonData.DEVICE_TYPE]);
monthItem.offContext.fillStyle = Color.Black;
horizontalOffset += Constants.YEAR_VIEW_HORIZONTAL_OFFSET[CommonData.DEVICE_TYPE];
}
// 获取月份日期前占位个数
const INTERVAL_COUNT: number = TimeUtils.getWeekDay(monthItem.year, monthItem.month, 1);
// 画日期
monthItem.offContext.font = Constants.YEAR_VIEW_DAY_FONT[CommonData.DEVICE_TYPE];
monthItem.offContext.fillStyle = Color.Black;
// 获取每个月的总天数
const TOTAL_DAYS_IN_MONTH: number = TimeUtils.getMonthDays(monthItem.year, monthItem.month);
// 获取一个月占几周。向上取整
const WEEK_LENGTH = Math.ceil((INTERVAL_COUNT + TOTAL_DAYS_IN_MONTH) / 7);
// 初始化绘制日期。从1号开始绘制
let dayIndex = 1;
// 日期垂直偏移
let verticalOffset = Constants.YEAR_VIEW_DAY_HEIGHT[CommonData.DEVICE_TYPE];
for (let i = 0; i < WEEK_LENGTH; i++) {
horizontalOffset = Constants.YEAR_VIEW_INIT_THREE[CommonData.DEVICE_TYPE];
// 画一周
for (let j = 1; j <= Constants.DAYS_IN_WEEK; j++) {
if (i === 0 && j <= INTERVAL_COUNT) {
// 月份日期前占位
} else {
// 判断绘制的日期是不是今天。如果是今天,日期绘制圆圈红色背景,白色字体。如果不是今天,黑色字体
if (isTodayMoth && Constants.TODAY === dayIndex) {
// 画圆圈
monthItem.offContext.fillStyle = Color.Red;
// 绘制弧线路径。这里绘制圆圈。arc入参分别是弧线圆心的x坐标值,弧线圆心的y坐标值,弧线的圆半径,弧线的起始弧度,弧线的
// 终止弧度。5和3是圆圈x,y坐标绘制位置的微调值
monthItem.offContext.arc(horizontalOffset + 5 +
Constants.YEAR_VIEW_X_AXIS[CommonData.DEVICE_TYPE],
verticalOffset - 3 - Constants.YEAR_VIEW_Y_AXIS[CommonData.DEVICE_TYPE],
Constants.YEAR_VIEW_TODAY_RADIUS[CommonData.DEVICE_TYPE], Constants.DEFAULT,
Constants.YEAR_VIEW_TODAY_END_ANGLE[CommonData.DEVICE_TYPE]);
// 对封闭路径进行填充。
monthItem.offContext.fill();
// 设置白色字体
monthItem.offContext.fillStyle = Color.White;
} else {
if (j === 1 || j === 7) {
// 星期日和星期六字体设置灰色
monthItem.offContext.fillStyle = Constants.YEAR_VIEW_FONT_COLOR;
} else {
monthItem.offContext.fillStyle = Color.Black;
}
}
// 画日期
if (dayIndex < 10) {
// 日期1-9号,字体水平位置微调3vp
monthItem.offContext.fillText(dayIndex.toString(), 3 + horizontalOffset, verticalOffset);
} else {
monthItem.offContext.fillText(dayIndex.toString(), horizontalOffset, verticalOffset);
}
// 画线。如果是农历初一,则日期底部加下划线
if (TimeUtils.isLunarFirstDayOfMonth(monthItem.year, monthItem.month, dayIndex)) {
monthItem.offContext.font = Constants.YEAR_VIEW_UNDERLINE[CommonData.DEVICE_TYPE];
monthItem.offContext.fillStyle = Color.Red;
monthItem.offContext.fillText('_', 1 + horizontalOffset, verticalOffset);
monthItem.offContext.font = Constants.YEAR_VIEW_DAY_FONT[CommonData.DEVICE_TYPE];
}
// 重置日期字体颜色
monthItem.offContext.fillStyle = Color.Black;
dayIndex++;
}
// 日期绘制水平偏移
horizontalOffset += Constants.YEAR_VIEW_HORIZONTAL_OFFSET[CommonData.DEVICE_TYPE];
if (dayIndex > TOTAL_DAYS_IN_MONTH) {
break;
}
}
// 周绘制垂直偏移
verticalOffset += Constants.YEAR_VIEW_VERTICAL_OFFSET[CommonData.DEVICE_TYPE];
}
// 从OffscreenCanvas组件中最近渲染的图像创建一个ImageBitmap对象
const IMAGE = monthItem.offContext.transferToImageBitmap();
// 显示给定的ImageBitmap对象
monthItem.context.transferFromImageBitmap(IMAGE);
})
}
.height($r('app.string.calendar_switch_size_twenty_three'))
.width($r('app.string.calendar_switch_size_twenty_five'))
.onClick(() => {
this.onMonthClick(monthItem.year, monthItem.month);
})
}, (monthItem: OffscreenCanvas) => monthItem.year + '' + monthItem.month + '' + CommonData.DEVICE_TYPE)
}
.onSizeChange(() => {
if (CommonData.IS_FOLD) {
// 折叠屏展开态和折叠态尺寸变化时需要刷新当前年视图
this.updateYearData();
}
})
.scrollBar(BarState.Off)
.columnsTemplate('1fr 1fr 1fr')
.columnsGap($r('app.integer.calendar_switch_columns_gap'))
.rowsGap($r('app.integer.calendar_switch_rows_gap'))
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct YearViewItem AST#component_body#Left { // 年视图离屏画布列表 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right yearViewList : 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 OffscreenCanvas 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 AST#decorator#Left @ Prop AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'updateYearData' AST#expression#Right ) AST#decorator#Right year : 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 onMonthClick : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ; AST#property_declaration#Right /**
* 更新年数据
*/ AST#method_declaration#Left updateYearData 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 . yearViewList AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 1 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right <= AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . MONTHS_NUM AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . yearViewList AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left OffscreenCanvas 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 . year AST#member_expression#Right AST#expression#Right , AST#expression#Left i AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right 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#block_statement#Left { // 添加年视图中每个月的离屏画布对象。一个画布对象绘制一个月数据。 AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 1 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right <= AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . MONTHS_NUM AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . yearViewList AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left OffscreenCanvas 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 . year AST#member_expression#Right AST#expression#Right , AST#expression#Left i AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Grid ( ) 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 . yearViewList AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left monthItem : AST#type_annotation#Left AST#primary_type#Left OffscreenCanvas 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 GridItem ( ) AST#container_content_body#Left { // TODO: 高性能知识点: 年视图使用Canvas绘制显示年视图中每个月,以减少节点数量,同时使用OffscreenCanvasRenderingContext2D离 // 屏绘制,将需要绘制的内容先绘制在缓存区,然后将其转换成图片,一次性绘制到canvas上,以加快绘制速度。 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( AST#expression#Left AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . context 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.string.calendar_switch_full_size' 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.string.calendar_switch_full_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onReady ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 绘制年视图中一个月的数据 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left isTodayMoth : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 monthItem AST#expression#Right . year AST#member_expression#Right AST#expression#Right === AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . TODAY_YEAR AST#member_expression#Right AST#expression#Right && AST#expression#Left monthItem AST#expression#Right AST#binary_expression#Right AST#expression#Right . month AST#member_expression#Right AST#expression#Right === AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . TODAY_MONTH 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 AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . offContext AST#member_expression#Right AST#expression#Right . font AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . YEAR_VIEW_MONTH_FONT AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonData AST#expression#Right . DEVICE_TYPE AST#member_expression#Right 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 AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . offContext AST#member_expression#Right AST#expression#Right . fillStyle AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left isTodayMoth AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Red AST#member_expression#Right AST#expression#Right : AST#expression#Left Color AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Black AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . offContext AST#member_expression#Right AST#expression#Right . fillText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . MONTHS AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . month AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . YEAR_VIEW_INIT_THREE AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonData AST#expression#Right . DEVICE_TYPE AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . YEAR_VIEW_MONTH_HEIGHT AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonData AST#expression#Right . DEVICE_TYPE AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 水平偏移 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left horizontalOffset = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . YEAR_VIEW_INIT_THREE AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonData AST#expression#Right . DEVICE_TYPE AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 画星期 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . offContext AST#member_expression#Right AST#expression#Right . font AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . YEAR_VIEW_WEEK_FONT AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonData AST#expression#Right . DEVICE_TYPE AST#member_expression#Right 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#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . WEEKS AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { // 星期六,日字体颜色设置灰色 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right === AST#expression#Left 6 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . offContext AST#member_expression#Right AST#expression#Right . fillStyle AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . YEAR_VIEW_FONT_COLOR 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 AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . offContext AST#member_expression#Right AST#expression#Right . fillText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . WEEKS AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left horizontalOffset AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . YEAR_VIEW_WEEK_HEIGHT AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonData AST#expression#Right . DEVICE_TYPE AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . offContext AST#member_expression#Right AST#expression#Right . fillStyle AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black 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 horizontalOffset += AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . YEAR_VIEW_HORIZONTAL_OFFSET AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonData AST#expression#Right . DEVICE_TYPE AST#member_expression#Right 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#block_statement#Right AST#for_statement#Right AST#statement#Right // 获取月份日期前占位个数 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left INTERVAL_COUNT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TimeUtils AST#expression#Right . getWeekDay AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . year AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . month AST#member_expression#Right AST#expression#Right , AST#expression#Left 1 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 AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . offContext AST#member_expression#Right AST#expression#Right . font AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . YEAR_VIEW_DAY_FONT AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonData AST#expression#Right . DEVICE_TYPE AST#member_expression#Right 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 AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . offContext AST#member_expression#Right AST#expression#Right . fillStyle AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black 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 TOTAL_DAYS_IN_MONTH : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TimeUtils AST#expression#Right . getMonthDays AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . year AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . month 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 const AST#variable_declarator#Left WEEK_LENGTH = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . ceil AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left INTERVAL_COUNT AST#expression#Right + AST#expression#Left TOTAL_DAYS_IN_MONTH AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left 7 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 // 初始化绘制日期。从1号开始绘制 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left dayIndex = AST#expression#Left 1 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 verticalOffset = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . YEAR_VIEW_DAY_HEIGHT AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonData AST#expression#Right . DEVICE_TYPE AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#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 WEEK_LENGTH AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left horizontalOffset = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . YEAR_VIEW_INIT_THREE AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonData AST#expression#Right . DEVICE_TYPE AST#member_expression#Right 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#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left j = AST#expression#Left 1 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right <= AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . DAYS_IN_WEEK AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left j AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right <= AST#expression#Left INTERVAL_COUNT AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 月份日期前占位 } 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 isTodayMoth AST#expression#Right && AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . TODAY AST#member_expression#Right AST#expression#Right === AST#expression#Left dayIndex 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 AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . offContext AST#member_expression#Right AST#expression#Right . fillStyle AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Red AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 绘制弧线路径。这里绘制圆圈。arc入参分别是弧线圆心的x坐标值,弧线圆心的y坐标值,弧线的圆半径,弧线的起始弧度,弧线的 // 终止弧度。5和3是圆圈x,y坐标绘制位置的微调值 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 monthItem AST#expression#Right . offContext AST#member_expression#Right AST#expression#Right . arc AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left horizontalOffset AST#expression#Right + AST#expression#Left 5 AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . YEAR_VIEW_X_AXIS AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonData AST#expression#Right . DEVICE_TYPE AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_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 verticalOffset AST#expression#Right - AST#expression#Left 3 AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . YEAR_VIEW_Y_AXIS AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonData AST#expression#Right . DEVICE_TYPE AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . YEAR_VIEW_TODAY_RADIUS AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonData AST#expression#Right . DEVICE_TYPE AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . DEFAULT AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . YEAR_VIEW_TODAY_END_ANGLE AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonData AST#expression#Right . DEVICE_TYPE AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 对封闭路径进行填充。 AST#statement#Left AST#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 monthItem AST#expression#Right . offContext AST#member_expression#Right AST#expression#Right . fill 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 AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . offContext AST#member_expression#Right AST#expression#Right . fillStyle AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right AST#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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right === AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right === AST#expression#Left 7 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . offContext AST#member_expression#Right AST#expression#Right . fillStyle AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . YEAR_VIEW_FONT_COLOR 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 AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . offContext AST#member_expression#Right AST#expression#Right . fillStyle AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black 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#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left dayIndex AST#expression#Right < AST#expression#Left 10 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 日期1-9号,字体水平位置微调3vp 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 monthItem AST#expression#Right . offContext AST#member_expression#Right AST#expression#Right . fillText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dayIndex AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 3 AST#expression#Right + AST#expression#Left horizontalOffset AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left verticalOffset 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 monthItem AST#expression#Right . offContext AST#member_expression#Right AST#expression#Right . fillText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dayIndex AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left horizontalOffset AST#expression#Right , AST#expression#Left verticalOffset AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 画线。如果是农历初一,则日期底部加下划线 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TimeUtils AST#expression#Right . isLunarFirstDayOfMonth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . year AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . month AST#member_expression#Right AST#expression#Right , AST#expression#Left dayIndex 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 AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . offContext AST#member_expression#Right AST#expression#Right . font AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . YEAR_VIEW_UNDERLINE AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonData AST#expression#Right . DEVICE_TYPE AST#member_expression#Right 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 AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . offContext AST#member_expression#Right AST#expression#Right . fillStyle AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Red AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . offContext AST#member_expression#Right AST#expression#Right . fillText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '_' AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 1 AST#expression#Right + AST#expression#Left horizontalOffset AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left verticalOffset AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . offContext AST#member_expression#Right AST#expression#Right . font AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . YEAR_VIEW_DAY_FONT AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonData AST#expression#Right . DEVICE_TYPE AST#member_expression#Right 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#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 AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . offContext AST#member_expression#Right AST#expression#Right . fillStyle AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black 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 dayIndex 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left horizontalOffset += AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . YEAR_VIEW_HORIZONTAL_OFFSET AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonData AST#expression#Right . DEVICE_TYPE AST#member_expression#Right 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left dayIndex AST#expression#Right > AST#expression#Left TOTAL_DAYS_IN_MONTH 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#block_statement#Right AST#for_statement#Right AST#statement#Right // 周绘制垂直偏移 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left verticalOffset += AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . YEAR_VIEW_VERTICAL_OFFSET AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonData AST#expression#Right . DEVICE_TYPE AST#member_expression#Right 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#block_statement#Right AST#for_statement#Right AST#statement#Right // 从OffscreenCanvas组件中最近渲染的图像创建一个ImageBitmap对象 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left IMAGE = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . offContext AST#member_expression#Right AST#expression#Right . transferToImageBitmap 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 // 显示给定的ImageBitmap对象 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 monthItem AST#expression#Right . context AST#member_expression#Right AST#expression#Right . transferFromImageBitmap AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left IMAGE 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.calendar_switch_size_twenty_three' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.calendar_switch_size_twenty_five' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onMonthClick AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . year AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . month AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 monthItem : AST#type_annotation#Left AST#primary_type#Left OffscreenCanvas AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => 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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left monthItem AST#expression#Right . year AST#member_expression#Right AST#expression#Right + AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left monthItem AST#expression#Right AST#binary_expression#Right AST#expression#Right . month AST#member_expression#Right AST#expression#Right + AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left CommonData AST#expression#Right AST#binary_expression#Right AST#expression#Right . DEVICE_TYPE AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . onSizeChange ( 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 CommonData AST#expression#Right . IS_FOLD 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 . updateYearData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Off AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . columnsTemplate ( AST#expression#Left '1fr 1fr 1fr' AST#expression#Right ) AST#modifier_chain_expression#Left . columnsGap ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.calendar_switch_columns_gap' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . rowsGap ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.calendar_switch_rows_gap' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct YearViewItem {
@State yearViewList: Array<OffscreenCanvas> = [];
@Prop @Watch('updateYearData') year: number;
onMonthClick: (year: number, month: number) => void = () => {
};
updateYearData() {
this.yearViewList = [];
for (let i = 1; i <= Constants.MONTHS_NUM; i++) {
this.yearViewList.push(new OffscreenCanvas(this.year, i));
}
}
aboutToAppear(): void {
for (let i = 1; i <= Constants.MONTHS_NUM; i++) {
this.yearViewList.push(new OffscreenCanvas(this.year, i));
}
}
build() {
Grid() {
ForEach(this.yearViewList, (monthItem: OffscreenCanvas) => {
GridItem() {
Canvas(monthItem.context)
.width($r('app.string.calendar_switch_full_size'))
.height($r('app.string.calendar_switch_full_size'))
.onReady(() => {
let isTodayMoth: boolean =
monthItem.year === Constants.TODAY_YEAR && monthItem.month === Constants.TODAY_MONTH;
monthItem.offContext.font = Constants.YEAR_VIEW_MONTH_FONT[CommonData.DEVICE_TYPE];
monthItem.offContext.fillStyle = isTodayMoth ? Color.Red : Color.Black;
monthItem.offContext.fillText(Constants.MONTHS[monthItem.month-1],
Constants.YEAR_VIEW_INIT_THREE[CommonData.DEVICE_TYPE],
Constants.YEAR_VIEW_MONTH_HEIGHT[CommonData.DEVICE_TYPE]);
let horizontalOffset = Constants.YEAR_VIEW_INIT_THREE[CommonData.DEVICE_TYPE];
monthItem.offContext.font = Constants.YEAR_VIEW_WEEK_FONT[CommonData.DEVICE_TYPE];
for (let i = 0; i < Constants.WEEKS.length; i++) {
if (i === 0 || i === 6) {
monthItem.offContext.fillStyle = Constants.YEAR_VIEW_FONT_COLOR;
}
monthItem.offContext.fillText(Constants.WEEKS[i], horizontalOffset,
Constants.YEAR_VIEW_WEEK_HEIGHT[CommonData.DEVICE_TYPE]);
monthItem.offContext.fillStyle = Color.Black;
horizontalOffset += Constants.YEAR_VIEW_HORIZONTAL_OFFSET[CommonData.DEVICE_TYPE];
}
const INTERVAL_COUNT: number = TimeUtils.getWeekDay(monthItem.year, monthItem.month, 1);
monthItem.offContext.font = Constants.YEAR_VIEW_DAY_FONT[CommonData.DEVICE_TYPE];
monthItem.offContext.fillStyle = Color.Black;
const TOTAL_DAYS_IN_MONTH: number = TimeUtils.getMonthDays(monthItem.year, monthItem.month);
const WEEK_LENGTH = Math.ceil((INTERVAL_COUNT + TOTAL_DAYS_IN_MONTH) / 7);
let dayIndex = 1;
let verticalOffset = Constants.YEAR_VIEW_DAY_HEIGHT[CommonData.DEVICE_TYPE];
for (let i = 0; i < WEEK_LENGTH; i++) {
horizontalOffset = Constants.YEAR_VIEW_INIT_THREE[CommonData.DEVICE_TYPE];
for (let j = 1; j <= Constants.DAYS_IN_WEEK; j++) {
if (i === 0 && j <= INTERVAL_COUNT) {
} else {
if (isTodayMoth && Constants.TODAY === dayIndex) {
monthItem.offContext.fillStyle = Color.Red;
monthItem.offContext.arc(horizontalOffset + 5 +
Constants.YEAR_VIEW_X_AXIS[CommonData.DEVICE_TYPE],
verticalOffset - 3 - Constants.YEAR_VIEW_Y_AXIS[CommonData.DEVICE_TYPE],
Constants.YEAR_VIEW_TODAY_RADIUS[CommonData.DEVICE_TYPE], Constants.DEFAULT,
Constants.YEAR_VIEW_TODAY_END_ANGLE[CommonData.DEVICE_TYPE]);
monthItem.offContext.fill();
monthItem.offContext.fillStyle = Color.White;
} else {
if (j === 1 || j === 7) {
monthItem.offContext.fillStyle = Constants.YEAR_VIEW_FONT_COLOR;
} else {
monthItem.offContext.fillStyle = Color.Black;
}
}
if (dayIndex < 10) {
monthItem.offContext.fillText(dayIndex.toString(), 3 + horizontalOffset, verticalOffset);
} else {
monthItem.offContext.fillText(dayIndex.toString(), horizontalOffset, verticalOffset);
}
if (TimeUtils.isLunarFirstDayOfMonth(monthItem.year, monthItem.month, dayIndex)) {
monthItem.offContext.font = Constants.YEAR_VIEW_UNDERLINE[CommonData.DEVICE_TYPE];
monthItem.offContext.fillStyle = Color.Red;
monthItem.offContext.fillText('_', 1 + horizontalOffset, verticalOffset);
monthItem.offContext.font = Constants.YEAR_VIEW_DAY_FONT[CommonData.DEVICE_TYPE];
}
monthItem.offContext.fillStyle = Color.Black;
dayIndex++;
}
horizontalOffset += Constants.YEAR_VIEW_HORIZONTAL_OFFSET[CommonData.DEVICE_TYPE];
if (dayIndex > TOTAL_DAYS_IN_MONTH) {
break;
}
}
verticalOffset += Constants.YEAR_VIEW_VERTICAL_OFFSET[CommonData.DEVICE_TYPE];
}
const IMAGE = monthItem.offContext.transferToImageBitmap();
monthItem.context.transferFromImageBitmap(IMAGE);
})
}
.height($r('app.string.calendar_switch_size_twenty_three'))
.width($r('app.string.calendar_switch_size_twenty_five'))
.onClick(() => {
this.onMonthClick(monthItem.year, monthItem.month);
})
}, (monthItem: OffscreenCanvas) => monthItem.year + '' + monthItem.month + '' + CommonData.DEVICE_TYPE)
}
.onSizeChange(() => {
if (CommonData.IS_FOLD) {
this.updateYearData();
}
})
.scrollBar(BarState.Off)
.columnsTemplate('1fr 1fr 1fr')
.columnsGap($r('app.integer.calendar_switch_columns_gap'))
.rowsGap($r('app.integer.calendar_switch_rows_gap'))
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/view/YearViewItem.ets#L24-L178
|
6842ca0eb2cc807d560cf68e9722f2fcaf47dc75
|
gitee
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
api/@system.router.d.ets
|
arkts
|
clear
|
Clears all historical pages and retains only the current page at the top of the stack.
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 3
@deprecated since 8
|
static clear(): void;
|
AST#method_declaration#Left static clear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
|
static clear(): void;
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.router.d.ets#L291-L291
|
75e65bca9943b97c47ecac87fc5b898f0762a64c
|
gitee
|
Active-hue/ArkTS-Accounting.git
|
c432916d305b407557f08e35017c3fd70668e441
|
entry/src/main/ets/pages/Main.ets
|
arkts
|
StatisticsPage
|
统计页面
|
@Builder
StatisticsPage() {
Column() {
// 滚动内容区域
Scroll() {
Column() {
// 支出/收入 Tab 切换
Row() {
// 支出 Tab
Column() {
Text('支出')
.fontSize(18)
.fontColor(this.statisticsTabIndex === 0 ? '#333333' : '#999999')
.fontWeight(FontWeight.Bold)
.padding({ bottom: 8 })
// 下划线
Divider()
.strokeWidth(2)
.color(this.statisticsTabIndex === 0 ? '#5B7FFF' : 'transparent')
.width(40)
}
.alignItems(HorizontalAlign.Center)
.onClick(() => {
this.statisticsTabIndex = 0;
})
// 收入 Tab
Column() {
Text('收入')
.fontSize(18)
.fontColor(this.statisticsTabIndex === 1 ? '#333333' : '#999999')
.fontWeight(FontWeight.Bold)
.padding({ bottom: 8 })
// 下划线
Divider()
.strokeWidth(2)
.color(this.statisticsTabIndex === 1 ? '#5B7FFF' : 'transparent')
.width(40)
}
.alignItems(HorizontalAlign.Center)
.margin({ left: 30 })
.onClick(() => {
this.statisticsTabIndex = 1;
})
}
.width('100%')
.justifyContent(FlexAlign.Start)
.padding({ left: 20, right: 20, top: 16, bottom: 8 })
// 月份选择器
Row() {
Text(`${this.selectedYear}年 ${this.selectedMonth}月`)
.fontSize(14)
.fontColor('#333333')
Text('▼')
.fontSize(10)
.fontColor('#999999')
.margin({ left: 6 })
}
.padding({ left: 20, right: 20, top: 0, bottom: 0 })
.onClick(() => {
this.showDatePicker = true;
})
// 收入支出统计卡片
Row() {
// 支出
Column() {
Text('支出')
.fontSize(12)
.fontColor('#999999')
.margin({ bottom: 4 })
Text(this.monthExpense)
.fontSize(18)
.fontColor('#333333')
.fontWeight(FontWeight.Bold)
}
.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
// 收入
Column() {
Text('收入')
.fontSize(12)
.fontColor('#999999')
.margin({ bottom: 4 })
Text(this.monthIncome)
.fontSize(18)
.fontColor('#333333')
.fontWeight(FontWeight.Bold)
}
.layoutWeight(1)
.alignItems(HorizontalAlign.Center)
// 结余
Column() {
Text('结余')
.fontSize(12)
.fontColor('#999999')
.margin({ bottom: 4 })
Text(this.monthBalance)
.fontSize(18)
.fontColor('#333333')
.fontWeight(FontWeight.Bold)
}
.layoutWeight(1)
.alignItems(HorizontalAlign.End)
}
.width('90%')
.padding(24)
.margin({ top: 4, bottom: 8 })
.backgroundColor('#FFFFFF')
.borderRadius(12)
// 支出/收入占比
if ((this.statisticsTabIndex === 0 && this.categoryStatsList.length > 0) ||
(this.statisticsTabIndex === 1 && this.incomeCategoryStatsList.length > 0)) {
Column() {
// 标题
Row() {
Text(this.statisticsTabIndex === 0 ? '支出占比' : '收入占比')
.fontSize(16)
.fontColor('#333333')
.fontWeight(FontWeight.Bold)
Blank()
Text('›')
.fontSize(24)
.fontColor('#CCCCCC')
}
.width('100%')
.padding({ left: 16, right: 16, top: 16, bottom: 12 })
// 环形图和金额
Row() {
// 环形图
Stack() {
// 绘制环形图的各个部分
if (this.statisticsTabIndex === 0 && this.categoryStatsList.length > 0) {
ForEach(this.categoryStatsList, (item: CategoryStats, index: number) => {
this.PieSlice(item, index)
}, (item: CategoryStats) => item.category)
} else if (this.statisticsTabIndex === 1 && this.incomeCategoryStatsList.length > 0) {
ForEach(this.incomeCategoryStatsList, (item: CategoryStats, index: number) => {
this.PieSliceIncome(item, index)
}, (item: CategoryStats) => item.category)
}
}
.width(180)
.height(180)
// 金额文字 - 在圆环右侧紧挨着,使用负margin靠近
Text(this.statisticsTabIndex === 0 ? this.monthExpense : this.monthIncome)
.fontSize(24)
.fontColor('#333333')
.fontWeight(FontWeight.Bold)
.margin({ left: -90, top: -110 })
}
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.width('100%')
.margin({ top: 16, bottom: -100 })
// 分类列表
Column() {
ForEach(this.statisticsTabIndex === 0 ? this.categoryStatsList : this.incomeCategoryStatsList,
(item: CategoryStats, index: number) => {
Row() {
// 颜色标识
Circle()
.width(8)
.height(8)
.fill(item.color)
.margin({ right: 8 })
Text(item.category)
.fontSize(14)
.fontColor('#666666')
.layoutWeight(1)
Text(`${item.percentage.toFixed(1)}%`)
.fontSize(14)
.fontColor('#333333')
.fontWeight(FontWeight.Medium)
}
.width('100%')
.padding({ left: 16, right: 16, top: 8, bottom: 8 })
}, (item: CategoryStats) => item.category)
}
.width('100%')
.padding({ bottom: 12 })
}
.width('90%')
.backgroundColor('#FFFFFF')
.borderRadius(12)
.margin({ bottom: 16 })
// 支出/收入榜单
Column() {
// 标题
Row() {
Text(this.statisticsTabIndex === 0 ? '支出榜单' : '收入榜单')
.fontSize(16)
.fontColor('#333333')
.fontWeight(FontWeight.Bold)
Blank()
Text('›')
.fontSize(24)
.fontColor('#CCCCCC')
}
.width('100%')
.padding({ left: 16, right: 16, top: 16, bottom: 12 })
// 榜单列表
Column() {
ForEach(this.statisticsTabIndex === 0 ? this.categoryStatsList : this.incomeCategoryStatsList,
(item: CategoryStats, index: number) => {
Column() {
Row() {
// 图标
Stack() {
Circle()
.width(40)
.height(40)
.fill(item.color)
Image($r(`app.media.category_${item.icon}`))
.width(24)
.height(24)
.fillColor('#FFFFFF')
}
.margin({ right: 12 })
Column() {
Text(item.category)
.fontSize(15)
.fontColor('#333333')
.margin({ bottom: 4 })
Text(`${item.percentage.toFixed(1)}%`)
.fontSize(12)
.fontColor('#999999')
}
.alignItems(HorizontalAlign.Start)
Blank()
Text(`¥${item.amount.toFixed(2)}`)
.fontSize(16)
.fontColor('#333333')
.fontWeight(FontWeight.Medium)
}
.width('100%')
.padding({ left: 16, right: 16, top: 12, bottom: 12 })
// 分隔线
if (index < (this.statisticsTabIndex === 0 ? this.categoryStatsList.length : this.incomeCategoryStatsList.length) - 1) {
Divider()
.strokeWidth(1)
.color('#F0F0F0')
.margin({ left: 68, right: 16 })
}
}
}, (item: CategoryStats) => item.category)
}
.width('100%')
}
.width('90%')
.backgroundColor('#FFFFFF')
.borderRadius(12)
.margin({ bottom: 16 })
} else {
// 无数据提示
Column() {
Image($r('app.media.empty_bill'))
.width(120)
.height(120)
.objectFit(ImageFit.Contain)
.opacity(0.5)
.margin({ bottom: 20 })
Text(this.statisticsTabIndex === 0 ? '暂无支出数据' : '暂无收入数据')
.fontSize(16)
.fontColor('#999999')
}
.width('100%')
.padding({ top: 40, bottom: 100 })
.justifyContent(FlexAlign.Center)
}
}
.width('100%')
.alignItems(HorizontalAlign.Center)
}
.layoutWeight(1)
.scrollBar(BarState.Auto)
.edgeEffect(EdgeEffect.Spring)
.align(Alignment.Top)
}
.width('100%')
.height('100%')
.backgroundColor('#E3ECFF')
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right StatisticsPage 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#container_content_body#Left { // 滚动内容区域 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 支出/收入 Tab 切换 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // 支出 Tab AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '支出' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 18 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . statisticsTabIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '#333333' AST#expression#Right : AST#expression#Left '#999999' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 . strokeWidth ( AST#expression#Left 2 AST#expression#Right ) AST#modifier_chain_expression#Left . color ( 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 . statisticsTabIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '#5B7FFF' AST#expression#Right : AST#expression#Left 'transparent' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 40 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 . 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 . 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 . statisticsTabIndex 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#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 // 收入 Tab AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '收入' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 18 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . statisticsTabIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '#333333' AST#expression#Right : AST#expression#Left '#999999' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 . strokeWidth ( AST#expression#Left 2 AST#expression#Right ) AST#modifier_chain_expression#Left . color ( 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 . statisticsTabIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '#5B7FFF' AST#expression#Right : AST#expression#Left 'transparent' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 40 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 . 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 . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left 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 . 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 . statisticsTabIndex 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#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 . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 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 16 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#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 月份选择器 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedYear 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 this AST#expression#Right . selectedMonth 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 '#333333' 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 10 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#999999' 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 6 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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 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 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . 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 . showDatePicker 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#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 Row ( ) AST#container_content_body#Left { // 支出 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '支出' AST#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 '#999999' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 4 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . monthExpense AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 18 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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 Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '收入' AST#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 '#999999' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 4 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . monthIncome AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 18 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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 . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 结余 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '结余' AST#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 '#999999' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 4 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . monthBalance AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 18 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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 . End 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 '90%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( 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 top AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#FFFFFF' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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#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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . statisticsTabIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . categoryStatsList 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#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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . statisticsTabIndex 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 . incomeCategoryStatsList 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 标题 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . statisticsTabIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '支出占比' AST#expression#Right : AST#expression#Left '收入占比' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left 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 . fontSize ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#CCCCCC' 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 . 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 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom 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#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 Stack ( ) AST#container_content_body#Left { // 绘制环形图的各个部分 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . statisticsTabIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . categoryStatsList 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#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . categoryStatsList 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 CategoryStats 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . PieSlice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right , AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#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 CategoryStats AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . category AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#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 AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . statisticsTabIndex 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 . incomeCategoryStatsList 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#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . incomeCategoryStatsList 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 CategoryStats 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . PieSliceIncome AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right , AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#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 CategoryStats AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . category AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#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 . width ( AST#expression#Left 180 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 180 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 金额文字 - 在圆环右侧紧挨着,使用负margin靠近 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#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . statisticsTabIndex 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 . monthExpense AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . monthIncome AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' 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 . 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 90 AST#expression#Right AST#unary_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#unary_expression#Left - AST#expression#Left 110 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#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 VerticalAlign 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 . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 100 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#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#ui_control_flow#Left AST#for_each_statement#Left ForEach ( 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 . statisticsTabIndex 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 . categoryStatsList AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . incomeCategoryStatsList 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 CategoryStats AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // 颜色标识 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Circle ( ) 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#Left . fill ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . color AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 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#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 . category AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#666666' 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#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#member_expression#Left AST#expression#Left item AST#expression#Right . percentage AST#member_expression#Right AST#expression#Right . toFixed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#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 '#333333' 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#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 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#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 CategoryStats AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . category AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . 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 bottom 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#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 '90%' 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 . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom 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#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 支出/收入榜单 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 标题 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left 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#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . statisticsTabIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '支出榜单' AST#expression#Right : AST#expression#Left '收入榜单' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left 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 . fontSize ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#CCCCCC' 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 . 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 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom 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#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#ui_control_flow#Left AST#for_each_statement#Left ForEach ( 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 . statisticsTabIndex 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 . categoryStatsList AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . incomeCategoryStatsList 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 CategoryStats AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // 图标 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Circle ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . fill ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . color 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 Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left AST#template_literal#Left ` app.media.category_ AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . icon AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right 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 . fillColor ( AST#expression#Left '#FFFFFF' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . category AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 15 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 4 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 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 item AST#expression#Right . percentage AST#member_expression#Right AST#expression#Right . toFixed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right % ` AST#template_literal#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 '#999999' 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#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#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 item AST#expression#Right . amount AST#member_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 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' 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#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 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 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom 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#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 index AST#expression#Right < AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . statisticsTabIndex 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . categoryStatsList AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . incomeCategoryStatsList AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_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 Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . strokeWidth ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left '#F0F0F0' 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 68 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#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_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 CategoryStats AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . category AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . 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 '90%' 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 . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom 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#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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.empty_bill' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 120 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 120 AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Contain AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left 0.5 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . statisticsTabIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '暂无支出数据' AST#expression#Right : AST#expression#Left '暂无收入数据' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#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 '#999999' 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 . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 40 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 100 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 . 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#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 . 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#Left . edgeEffect ( AST#expression#Left AST#member_expression#Left AST#expression#Left EdgeEffect AST#expression#Right . Spring AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . align ( AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . Top AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#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 . backgroundColor ( AST#expression#Left '#E3ECFF' 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#builder_function_body#Right AST#method_declaration#Right
|
@Builder
StatisticsPage() {
Column() {
Scroll() {
Column() {
Row() {
Column() {
Text('支出')
.fontSize(18)
.fontColor(this.statisticsTabIndex === 0 ? '#333333' : '#999999')
.fontWeight(FontWeight.Bold)
.padding({ bottom: 8 })
Divider()
.strokeWidth(2)
.color(this.statisticsTabIndex === 0 ? '#5B7FFF' : 'transparent')
.width(40)
}
.alignItems(HorizontalAlign.Center)
.onClick(() => {
this.statisticsTabIndex = 0;
})
Column() {
Text('收入')
.fontSize(18)
.fontColor(this.statisticsTabIndex === 1 ? '#333333' : '#999999')
.fontWeight(FontWeight.Bold)
.padding({ bottom: 8 })
Divider()
.strokeWidth(2)
.color(this.statisticsTabIndex === 1 ? '#5B7FFF' : 'transparent')
.width(40)
}
.alignItems(HorizontalAlign.Center)
.margin({ left: 30 })
.onClick(() => {
this.statisticsTabIndex = 1;
})
}
.width('100%')
.justifyContent(FlexAlign.Start)
.padding({ left: 20, right: 20, top: 16, bottom: 8 })
Row() {
Text(`${this.selectedYear}年 ${this.selectedMonth}月`)
.fontSize(14)
.fontColor('#333333')
Text('▼')
.fontSize(10)
.fontColor('#999999')
.margin({ left: 6 })
}
.padding({ left: 20, right: 20, top: 0, bottom: 0 })
.onClick(() => {
this.showDatePicker = true;
})
Row() {
Column() {
Text('支出')
.fontSize(12)
.fontColor('#999999')
.margin({ bottom: 4 })
Text(this.monthExpense)
.fontSize(18)
.fontColor('#333333')
.fontWeight(FontWeight.Bold)
}
.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
Column() {
Text('收入')
.fontSize(12)
.fontColor('#999999')
.margin({ bottom: 4 })
Text(this.monthIncome)
.fontSize(18)
.fontColor('#333333')
.fontWeight(FontWeight.Bold)
}
.layoutWeight(1)
.alignItems(HorizontalAlign.Center)
Column() {
Text('结余')
.fontSize(12)
.fontColor('#999999')
.margin({ bottom: 4 })
Text(this.monthBalance)
.fontSize(18)
.fontColor('#333333')
.fontWeight(FontWeight.Bold)
}
.layoutWeight(1)
.alignItems(HorizontalAlign.End)
}
.width('90%')
.padding(24)
.margin({ top: 4, bottom: 8 })
.backgroundColor('#FFFFFF')
.borderRadius(12)
/收入占比
if ((this.statisticsTabIndex === 0 && this.categoryStatsList.length > 0) ||
(this.statisticsTabIndex === 1 && this.incomeCategoryStatsList.length > 0)) {
Column() {
Row() {
Text(this.statisticsTabIndex === 0 ? '支出占比' : '收入占比')
.fontSize(16)
.fontColor('#333333')
.fontWeight(FontWeight.Bold)
Blank()
Text('›')
.fontSize(24)
.fontColor('#CCCCCC')
}
.width('100%')
.padding({ left: 16, right: 16, top: 16, bottom: 12 })
Row() {
Stack() {
if (this.statisticsTabIndex === 0 && this.categoryStatsList.length > 0) {
ForEach(this.categoryStatsList, (item: CategoryStats, index: number) => {
this.PieSlice(item, index)
}, (item: CategoryStats) => item.category)
} else if (this.statisticsTabIndex === 1 && this.incomeCategoryStatsList.length > 0) {
ForEach(this.incomeCategoryStatsList, (item: CategoryStats, index: number) => {
this.PieSliceIncome(item, index)
}, (item: CategoryStats) => item.category)
}
}
.width(180)
.height(180)
Text(this.statisticsTabIndex === 0 ? this.monthExpense : this.monthIncome)
.fontSize(24)
.fontColor('#333333')
.fontWeight(FontWeight.Bold)
.margin({ left: -90, top: -110 })
}
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.width('100%')
.margin({ top: 16, bottom: -100 })
Column() {
ForEach(this.statisticsTabIndex === 0 ? this.categoryStatsList : this.incomeCategoryStatsList,
(item: CategoryStats, index: number) => {
Row() {
Circle()
.width(8)
.height(8)
.fill(item.color)
.margin({ right: 8 })
Text(item.category)
.fontSize(14)
.fontColor('#666666')
.layoutWeight(1)
Text(`${item.percentage.toFixed(1)}%`)
.fontSize(14)
.fontColor('#333333')
.fontWeight(FontWeight.Medium)
}
.width('100%')
.padding({ left: 16, right: 16, top: 8, bottom: 8 })
}, (item: CategoryStats) => item.category)
}
.width('100%')
.padding({ bottom: 12 })
}
.width('90%')
.backgroundColor('#FFFFFF')
.borderRadius(12)
.margin({ bottom: 16 })
/收入榜单
Column() {
Row() {
Text(this.statisticsTabIndex === 0 ? '支出榜单' : '收入榜单')
.fontSize(16)
.fontColor('#333333')
.fontWeight(FontWeight.Bold)
Blank()
Text('›')
.fontSize(24)
.fontColor('#CCCCCC')
}
.width('100%')
.padding({ left: 16, right: 16, top: 16, bottom: 12 })
Column() {
ForEach(this.statisticsTabIndex === 0 ? this.categoryStatsList : this.incomeCategoryStatsList,
(item: CategoryStats, index: number) => {
Column() {
Row() {
Stack() {
Circle()
.width(40)
.height(40)
.fill(item.color)
Image($r(`app.media.category_${item.icon}`))
.width(24)
.height(24)
.fillColor('#FFFFFF')
}
.margin({ right: 12 })
Column() {
Text(item.category)
.fontSize(15)
.fontColor('#333333')
.margin({ bottom: 4 })
Text(`${item.percentage.toFixed(1)}%`)
.fontSize(12)
.fontColor('#999999')
}
.alignItems(HorizontalAlign.Start)
Blank()
Text(`¥${item.amount.toFixed(2)}`)
.fontSize(16)
.fontColor('#333333')
.fontWeight(FontWeight.Medium)
}
.width('100%')
.padding({ left: 16, right: 16, top: 12, bottom: 12 })
if (index < (this.statisticsTabIndex === 0 ? this.categoryStatsList.length : this.incomeCategoryStatsList.length) - 1) {
Divider()
.strokeWidth(1)
.color('#F0F0F0')
.margin({ left: 68, right: 16 })
}
}
}, (item: CategoryStats) => item.category)
}
.width('100%')
}
.width('90%')
.backgroundColor('#FFFFFF')
.borderRadius(12)
.margin({ bottom: 16 })
} else {
Column() {
Image($r('app.media.empty_bill'))
.width(120)
.height(120)
.objectFit(ImageFit.Contain)
.opacity(0.5)
.margin({ bottom: 20 })
Text(this.statisticsTabIndex === 0 ? '暂无支出数据' : '暂无收入数据')
.fontSize(16)
.fontColor('#999999')
}
.width('100%')
.padding({ top: 40, bottom: 100 })
.justifyContent(FlexAlign.Center)
}
}
.width('100%')
.alignItems(HorizontalAlign.Center)
}
.layoutWeight(1)
.scrollBar(BarState.Auto)
.edgeEffect(EdgeEffect.Spring)
.align(Alignment.Top)
}
.width('100%')
.height('100%')
.backgroundColor('#E3ECFF')
}
|
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Main.ets#L857-L1158
|
718150cda28a2aa27aca81de0c726cedc14d7bc7
|
github
|
harmonyos/samples
|
f5d967efaa7666550ee3252d118c3c73a77686f5
|
HarmonyOS_NEXT/DFX/AppRecovery/entry/src/main/ets/ability/SecondAbility.ets
|
arkts
|
restoreLocalStorage
|
Read previous saved status from want if we are launched by appRecovery
|
restoreLocalStorage(want: Want) : void {
if (want.parameters !== undefined) {
this.storage.setOrCreate<string>('FaultTriggerPageString', want.parameters['FaultTriggerPageString'] as string);
this.storage.setOrCreate<number>('FaultTriggerPageCounter', want.parameters['FaultTriggerPageCounter'] as number);
}
}
|
AST#method_declaration#Left restoreLocalStorage 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_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 want AST#expression#Right . parameters AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . storage AST#member_expression#Right AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left 'FaultTriggerPageString' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left want AST#expression#Right . parameters AST#member_expression#Right AST#expression#Right [ AST#expression#Left 'FaultTriggerPageString' AST#expression#Right ] AST#subscript_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#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 . storage AST#member_expression#Right AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left 'FaultTriggerPageCounter' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left want AST#expression#Right . parameters AST#member_expression#Right AST#expression#Right [ AST#expression#Left 'FaultTriggerPageCounter' AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
restoreLocalStorage(want: Want) : void {
if (want.parameters !== undefined) {
this.storage.setOrCreate<string>('FaultTriggerPageString', want.parameters['FaultTriggerPageString'] as string);
this.storage.setOrCreate<number>('FaultTriggerPageCounter', want.parameters['FaultTriggerPageCounter'] as number);
}
}
|
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/DFX/AppRecovery/entry/src/main/ets/ability/SecondAbility.ets#L32-L37
|
e0f71015a86c0daede5105e0ebdfdfb73b2f4fe4
|
gitee
|
open9527/OpenHarmony
|
fdea69ed722d426bf04e817ec05bff4002e81a4e
|
libs/core/src/main/ets/utils/StringUtils.ets
|
arkts
|
isNotEmpty
|
判断字符串是否为非空。true为非空空,否则false
@param str
@returns
|
static isNotEmpty(str: string | undefined | null) {
return false == StringUtils.isEmpty(str);
}
|
AST#method_declaration#Left static isNotEmpty AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right | AST#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#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#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right == AST#expression#Left StringUtils AST#expression#Right AST#binary_expression#Right AST#expression#Right . isEmpty AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str 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 isNotEmpty(str: string | undefined | null) {
return false == StringUtils.isEmpty(str);
}
|
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/StringUtils.ets#L48-L50
|
668cb9eaf68f87bcaa8e209ef048d423b3a2e18f
|
gitee
|
YShelter/Accouting_ArkTS.git
|
8c663c85f2c11738d4eabf269c23dc1ec84eb013
|
entry/src/main/ets/Viewmodel/AccountingInfo.ets
|
arkts
|
储存记账信息的数据结构
|
export default class AccountingInfo {
id: number;
date: string;
amount: number;
category: string;
typeName: string;
icon: string;
remark: string;
constructor(id: number, date: string, amount: number, category: string, typeName: string, icon: string, remark: string,) {
this.id = id;
this.date = date;
this.amount = amount;
this.category = category;
this.typeName = typeName;
this.icon = icon;
this.remark = remark;
}
}
|
AST#export_declaration#Left export default AST#class_declaration#Left class AccountingInfo AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left date : 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 amount : 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 category : 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 typeName : 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 icon : 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 remark : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left amount : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left category : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left typeName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left icon : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left remark : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . id AST#member_expression#Right = AST#expression#Left id AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . date AST#member_expression#Right = AST#expression#Left date 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 . amount AST#member_expression#Right = AST#expression#Left amount 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 . category AST#member_expression#Right = AST#expression#Left category 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 . typeName AST#member_expression#Right = AST#expression#Left typeName 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 . icon AST#member_expression#Right = AST#expression#Left icon 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 . remark AST#member_expression#Right = AST#expression#Left remark AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export default class AccountingInfo {
id: number;
date: string;
amount: number;
category: string;
typeName: string;
icon: string;
remark: string;
constructor(id: number, date: string, amount: number, category: string, typeName: string, icon: string, remark: string,) {
this.id = id;
this.date = date;
this.amount = amount;
this.category = category;
this.typeName = typeName;
this.icon = icon;
this.remark = remark;
}
}
|
https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/Viewmodel/AccountingInfo.ets#L5-L24
|
43eb86b2ba4ef76c84bf699c36f4ab9022aa1692
|
github
|
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_rcp/src/main/ets/rcp/efRcpConfig.ets
|
arkts
|
系统框架级别请求响应码对象
|
export class sysCodeEvent {
/**
* 请求响应码监听-业务自行处理数据
*/
listener: (code: number) => void = () => {
};
}
|
AST#export_declaration#Left export AST#class_declaration#Left class sysCodeEvent AST#class_body#Left { /**
* 请求响应码监听-业务自行处理数据
*/ AST#property_declaration#Left listener : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left code : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class sysCodeEvent {
listener: (code: number) => void = () => {
};
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/efRcpConfig.ets#L45-L51
|
eae13ffa50e247aa5c58366f468c89a3d7ab5b66
|
gitee
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/BasicFeature/Security/KeyManager/entry/src/main/ets/client/LocalClient.ets
|
arkts
|
encryption
|
加密
|
async encryption(message: string): Promise<string> {
if (!this.publicKey) {
sendProcessMessage("本地未找到公钥,开始下载...", MessagePosition.Right);
// 获取公钥
await this.downloadPublicKey();
sendProcessMessage("公钥下载成功", MessagePosition.Right);
}
if (this.aesKey === "") {
sendProcessMessage("本地未找到AES密钥,开始生成...", MessagePosition.Right);
// 生成AES密钥
this.aesKey = await generateAesKey();
sendProcessMessage(`AES密钥生成成功,密钥:${this.aesKey},开始发送到服务端...`, MessagePosition.Right);
// 将AES密钥发送到服务端
await this.sendAesKeyToServer();
}
sendProcessMessage(`客户端开始加密数据...`, MessagePosition.Right);
let encryptionResult: string = await aesGcmEncrypt(message, this.aesKey);
sendProcessMessage(`客户端加密成功,加密结果:${encryptionResult}`, MessagePosition.Right);
// 使用AES加密数据
return encryptionResult;
}
|
AST#method_declaration#Left async encryption AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left 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#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#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . publicKey AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left sendProcessMessage ( AST#expression#Left "本地未找到公钥,开始下载..." AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left MessagePosition AST#expression#Right . Right 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#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 . downloadPublicKey AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left sendProcessMessage ( AST#expression#Left "公钥下载成功" AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left MessagePosition AST#expression#Right . Right 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#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 . aesKey AST#member_expression#Right AST#expression#Right === AST#expression#Left "" 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 sendProcessMessage ( AST#expression#Left "本地未找到AES密钥,开始生成..." AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left MessagePosition AST#expression#Right . Right AST#member_expression#Right 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 // 生成AES密钥 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . aesKey AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left generateAesKey AST#expression#Right AST#await_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left sendProcessMessage ( AST#expression#Left AST#template_literal#Left ` AES密钥生成成功,密钥: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . aesKey AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,开始发送到服务端... ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left MessagePosition AST#expression#Right . Right 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 // 将AES密钥发送到服务端 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 . sendAesKeyToServer AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_custom_component_statement#Left sendProcessMessage ( AST#expression#Left AST#template_literal#Left ` 客户端开始加密数据... ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left MessagePosition AST#expression#Right . Right AST#member_expression#Right AST#expression#Right ) ; AST#ui_custom_component_statement#Right AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left encryptionResult AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left aesGcmEncrypt AST#expression#Right AST#await_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left message AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . aesKey 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#ui_custom_component_statement#Left sendProcessMessage ( AST#expression#Left AST#template_literal#Left ` 客户端加密成功,加密结果: AST#template_substitution#Left $ { AST#expression#Left encryptionResult AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left MessagePosition AST#expression#Right . Right AST#member_expression#Right AST#expression#Right ) ; AST#ui_custom_component_statement#Right // 使用AES加密数据 AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left encryptionResult AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
async encryption(message: string): Promise<string> {
if (!this.publicKey) {
sendProcessMessage("本地未找到公钥,开始下载...", MessagePosition.Right);
await this.downloadPublicKey();
sendProcessMessage("公钥下载成功", MessagePosition.Right);
}
if (this.aesKey === "") {
sendProcessMessage("本地未找到AES密钥,开始生成...", MessagePosition.Right);
this.aesKey = await generateAesKey();
sendProcessMessage(`AES密钥生成成功,密钥:${this.aesKey},开始发送到服务端...`, MessagePosition.Right);
await this.sendAesKeyToServer();
}
sendProcessMessage(`客户端开始加密数据...`, MessagePosition.Right);
let encryptionResult: string = await aesGcmEncrypt(message, this.aesKey);
sendProcessMessage(`客户端加密成功,加密结果:${encryptionResult}`, MessagePosition.Right);
return encryptionResult;
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Security/KeyManager/entry/src/main/ets/client/LocalClient.ets#L80-L100
|
1046d179ca60401d790b5f6393c02aada714e4a3
|
gitee
|
didi/dimina.git
|
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
|
harmony/dimina/src/main/ets/Service/DMPSendableObjects.ets
|
arkts
|
初始化引擎用的数据结构
|
export class initPayload {
command: string;
context: common.UIAbilityContext;
appIndex: number;
isDebugMode: boolean;
constructor(command: string, appIndex: number, context: common.UIAbilityContext, isDebugMode: boolean) {
this.command = command;
this.appIndex = appIndex;
this.context = context;
this.isDebugMode = isDebugMode;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class initPayload AST#class_body#Left { AST#property_declaration#Left command : 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 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 AST#property_declaration#Left appIndex : 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 isDebugMode : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left command : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left appIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isDebugMode : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . command AST#member_expression#Right = AST#expression#Left command 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 . appIndex AST#member_expression#Right = AST#expression#Left appIndex 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 . context AST#member_expression#Right = AST#expression#Left context 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 . isDebugMode AST#member_expression#Right = AST#expression#Left isDebugMode AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class initPayload {
command: string;
context: common.UIAbilityContext;
appIndex: number;
isDebugMode: boolean;
constructor(command: string, appIndex: number, context: common.UIAbilityContext, isDebugMode: boolean) {
this.command = command;
this.appIndex = appIndex;
this.context = context;
this.isDebugMode = isDebugMode;
}
}
|
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Service/DMPSendableObjects.ets#L60-L72
|
c028ba6aa96c63f72eb7e54e9bb5328ee63be1f1
|
github
|
|
common-apps/ZRouter
|
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
|
RouterApi/src/main/ets/lifecycle/LifecycleRegistry.ets
|
arkts
|
addObserver
|
添加生命周期观察者
@param observer
@param inRootView 当前页面是否是Navigation根视图中 可选参数
|
public addObserver<T extends ILifecycleObserver>(observer: T, inRootView: boolean = false) {
RouterMgr.getInstance().lifecycleMgr.addObserver(observer, this.targetClassName, inRootView);
}
|
AST#method_declaration#Left public addObserver AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left ILifecycleObserver AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left observer : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left inRootView : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RouterMgr 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 . lifecycleMgr AST#member_expression#Right AST#expression#Right . addObserver AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left observer AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetClassName AST#member_expression#Right AST#expression#Right , AST#expression#Left inRootView 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 addObserver<T extends ILifecycleObserver>(observer: T, inRootView: boolean = false) {
RouterMgr.getInstance().lifecycleMgr.addObserver(observer, this.targetClassName, inRootView);
}
|
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/lifecycle/LifecycleRegistry.ets#L31-L34
|
2d05395e547053e53740e2f2dd80623c3ab28431
|
gitee
|
JinnyWang-Space/guanlanwenjuan.git
|
601c4aa6c427e643d7bf42bc21945f658738e38c
|
entry/src/main/ets/pages/Index.ets
|
arkts
|
refreshChange
|
实时监听是否刷新全部问卷列表
|
@Monitor('refresh')
async refreshChange() {
if (this.refresh) {
// 刷新所有问卷信息
this.surveys = await this.distributedDB.getAllSurveys();
// 刷新侧边栏主列表
this.getSBMainItem();
// 刷新侧边栏主列表 item 的数量
this.getSBMainItemNum();
// 刷新完毕
this.refresh = false;
}
}
|
AST#method_declaration#Left AST#decorator#Left @ Monitor ( AST#expression#Left 'refresh' AST#expression#Right ) AST#decorator#Right async refreshChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . refresh 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 . surveys AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . distributedDB AST#member_expression#Right AST#expression#Right . getAllSurveys 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 . getSBMainItem 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 // 刷新侧边栏主列表 item 的数量 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 . getSBMainItemNum 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 . refresh 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#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Monitor('refresh')
async refreshChange() {
if (this.refresh) {
this.surveys = await this.distributedDB.getAllSurveys();
this.getSBMainItem();
item 的数量
this.getSBMainItemNum();
this.refresh = false;
}
}
|
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/pages/Index.ets#L238-L250
|
c4e66b66a0468966746f7384b1e8e13e3c043fd9
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/common/types/SettingsTypes.ets
|
arkts
|
主题配置接口
|
export interface ThemeConfig {
mode: ThemeMode;
primaryColor: string;
accentColor: string;
customColors?: Record<string, string>;
animationEnabled: boolean;
animationDuration: number;
fontSize: FontSize;
borderRadius: BorderRadius;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface ThemeConfig AST#object_type#Left { AST#type_member#Left mode : AST#type_annotation#Left AST#primary_type#Left ThemeMode AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left primaryColor : 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 accentColor : 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 customColors ? : 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#type_member#Right ; AST#type_member#Left animationEnabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left animationDuration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left fontSize : AST#type_annotation#Left AST#primary_type#Left FontSize AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left borderRadius : AST#type_annotation#Left AST#primary_type#Left BorderRadius 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 ThemeConfig {
mode: ThemeMode;
primaryColor: string;
accentColor: string;
customColors?: Record<string, string>;
animationEnabled: boolean;
animationDuration: number;
fontSize: FontSize;
borderRadius: BorderRadius;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L29-L38
|
1e7952fcdb3b9887a55d97b2e89b91016e7b1554
|
github
|
|
jerryzhou2/ArkTS-news-app.git
|
6dfa8631948f1def4269be5a48554b99ee64a18d
|
fluent-news-homepage-master/entry/src/main/ets/viewmodel/CityDetailData.ets
|
arkts
|
Search for keywords and related city data.
|
export const ALL_CITY2 = [
new CityGroup('a',
uiContext!.getHostContext()!.resourceManager.getStringArrayValueSync($r('app.strarray.city_data_A').id)),
new CityGroup('an',
uiContext!.getHostContext()!.resourceManager.getStringArrayValueSync($r('app.strarray.city_data_an').id)),
new CityGroup('b',
uiContext!.getHostContext()!.resourceManager.getStringArrayValueSync($r('app.strarray.city_data_B').id)),
];
|
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left ALL_CITY2 = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CityGroup AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'a' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left uiContext AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . getHostContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getStringArrayValueSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.strarray.city_data_A' AST#expression#Right ) AST#resource_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#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CityGroup AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'an' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left uiContext AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . getHostContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getStringArrayValueSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.strarray.city_data_an' AST#expression#Right ) AST#resource_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#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CityGroup AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'b' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left uiContext AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . getHostContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getStringArrayValueSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.strarray.city_data_B' AST#expression#Right ) AST#resource_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#argument_list#Right AST#call_expression#Right AST#expression#Right , ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
|
export const ALL_CITY2 = [
new CityGroup('a',
uiContext!.getHostContext()!.resourceManager.getStringArrayValueSync($r('app.strarray.city_data_A').id)),
new CityGroup('an',
uiContext!.getHostContext()!.resourceManager.getStringArrayValueSync($r('app.strarray.city_data_an').id)),
new CityGroup('b',
uiContext!.getHostContext()!.resourceManager.getStringArrayValueSync($r('app.strarray.city_data_B').id)),
];
|
https://github.com/jerryzhou2/ArkTS-news-app.git/blob/6dfa8631948f1def4269be5a48554b99ee64a18d/fluent-news-homepage-master/entry/src/main/ets/viewmodel/CityDetailData.ets#L89-L96
|
ff7863105da3226c5c1bd594592dbbb63e141c8f
|
github
|
|
Rayawa/dashboard.git
|
9107efe7fb69a58d799a378b79ea8ffa4041cec8
|
entry/src/main/ets/common/got.ets
|
arkts
|
request
|
发起HTTP请求
|
async request<T = ArrayBuffer>(
url: string,
options: RequestOptions = {},
): Promise<Response<T>> {
const mergedOptions: RequestOptions = {
...this.defaultOptions,
...options,
url,
};
// 处理查询参数
if (mergedOptions.params) {
const urlObj = new URL(url);
Object.entries(mergedOptions.params).forEach(([key, value]) => {
urlObj.searchParams.append(key, String(value));
});
|
AST#method_declaration#Left async request AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right 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 options : AST#type_annotation#Left AST#primary_type#Left RequestOptions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#parameter#Right , AST#parameter#Left 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 Response 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#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left mergedOptions : AST#type_annotation#Left AST#primary_type#Left RequestOptions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left ... AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . defaultOptions AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left ... AST#expression#Left options AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left url AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 处理查询参数 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left mergedOptions AST#expression#Right . params AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left urlObj = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left URL AST#expression#Right AST#new_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#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 . entries AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left mergedOptions AST#expression#Right . params AST#member_expression#Right 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#ERROR#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left key AST#expression#Right , AST#expression#Left value AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right => AST#ERROR#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left urlObj AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . searchParams AST#member_expression#Right AST#expression#Right . append AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left String AST#expression#Right AST#argument_list#Left ( AST#expression#Left value AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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#ERROR#Right ; AST#method_declaration#Right
|
async request<T = ArrayBuffer>(
url: string,
options: RequestOptions = {},
): Promise<Response<T>> {
const mergedOptions: RequestOptions = {
...this.defaultOptions,
...options,
url,
};
if (mergedOptions.params) {
const urlObj = new URL(url);
Object.entries(mergedOptions.params).forEach(([key, value]) => {
urlObj.searchParams.append(key, String(value));
});
|
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/got.ets#L39-L54
|
d4825fa2395b0dda05dea06b9c79719fe83fe108
|
github
|
common-apps/ZRouter
|
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
|
RouterApi/src/main/ets/lifecycle/LifecycleRegistry.ets
|
arkts
|
@author: HZWei
@date: 2024/10/26
@desc:
|
export class LifecycleRegistry {
private targetClassName: string
private constructor(className: string) {
this.targetClassName = className;
}
public static create(component: object): LifecycleRegistry {
const className = `${component.constructor.name}${SPLIT_SYMBOL}${util.getHash(component)}`
return new LifecycleRegistry(className);
}
/**
* 添加生命周期观察者
* @param observer
* @param inRootView 当前页面是否是Navigation根视图中 可选参数
*/
public addObserver<T extends ILifecycleObserver>(observer: T, inRootView: boolean = false) {
RouterMgr.getInstance().lifecycleMgr.addObserver(observer, this.targetClassName, inRootView);
}
public removeObserver(observer: ILifecycleObserver): boolean {
const isSuccess = RouterMgr.getInstance().lifecycleMgr.removeObserver(observer);
return isSuccess
}
/**
* 添加生命周期监听
* @param callback
* @param inRootView 当前页面是否是Navigation根视图中 可选参数
*/
public addListener(callback: LifecycleCallback, inRootView: boolean = false) {
RouterMgr.getInstance().lifecycleMgr.addListener(callback, this.targetClassName, inRootView);
}
public removeListener(callback: LifecycleCallback): boolean {
return RouterMgr.getInstance().lifecycleMgr.removeListener(callback);
}
// private inRootView() {
// const lastId = RouterMgr.getInstance().getLastNavDestinationId()
// const hasPageBeenLaunched = RouterMgr.getInstance().hasPageBeenLaunched
// Logger.log(`lastId:${lastId} hasPageBeenLaunched:${hasPageBeenLaunched}`)
// return ObjUtil.isEmpty(lastId) && !hasPageBeenLaunched
// }
}
|
AST#export_declaration#Left export AST#class_declaration#Left class LifecycleRegistry AST#class_body#Left { AST#property_declaration#Left private targetClassName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( AST#parameter#Left className : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetClassName AST#member_expression#Right = AST#expression#Left className 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 public static create AST#parameter_list#Left ( AST#parameter#Left component : 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 LifecycleRegistry AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left className = 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 component AST#expression#Right . constructor AST#member_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left SPLIT_SYMBOL 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 util AST#expression#Right . getHash AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left component 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#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#new_expression#Left new AST#expression#Left LifecycleRegistry AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left className AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 添加生命周期观察者
* @param observer
* @param inRootView 当前页面是否是Navigation根视图中 可选参数
*/ AST#method_declaration#Left public addObserver AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left ILifecycleObserver AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left observer : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left inRootView : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RouterMgr 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 . lifecycleMgr AST#member_expression#Right AST#expression#Right . addObserver AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left observer AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetClassName AST#member_expression#Right AST#expression#Right , AST#expression#Left inRootView 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 public removeObserver AST#parameter_list#Left ( AST#parameter#Left observer : AST#type_annotation#Left AST#primary_type#Left ILifecycleObserver 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#variable_declaration#Left const AST#variable_declarator#Left isSuccess = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RouterMgr 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 . lifecycleMgr AST#member_expression#Right AST#expression#Right . removeObserver AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left observer 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 isSuccess AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 添加生命周期监听
* @param callback
* @param inRootView 当前页面是否是Navigation根视图中 可选参数
*/ AST#method_declaration#Left public addListener AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left LifecycleCallback AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left inRootView : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RouterMgr 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 . lifecycleMgr AST#member_expression#Right AST#expression#Right . addListener AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left callback AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetClassName AST#member_expression#Right AST#expression#Right , AST#expression#Left inRootView 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 public removeListener AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left LifecycleCallback 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RouterMgr 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 . lifecycleMgr AST#member_expression#Right AST#expression#Right . removeListener AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left callback AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // private inRootView() { // const lastId = RouterMgr.getInstance().getLastNavDestinationId() // const hasPageBeenLaunched = RouterMgr.getInstance().hasPageBeenLaunched // Logger.log(`lastId:${lastId} hasPageBeenLaunched:${hasPageBeenLaunched}`) // return ObjUtil.isEmpty(lastId) && !hasPageBeenLaunched // } } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class LifecycleRegistry {
private targetClassName: string
private constructor(className: string) {
this.targetClassName = className;
}
public static create(component: object): LifecycleRegistry {
const className = `${component.constructor.name}${SPLIT_SYMBOL}${util.getHash(component)}`
return new LifecycleRegistry(className);
}
public addObserver<T extends ILifecycleObserver>(observer: T, inRootView: boolean = false) {
RouterMgr.getInstance().lifecycleMgr.addObserver(observer, this.targetClassName, inRootView);
}
public removeObserver(observer: ILifecycleObserver): boolean {
const isSuccess = RouterMgr.getInstance().lifecycleMgr.removeObserver(observer);
return isSuccess
}
public addListener(callback: LifecycleCallback, inRootView: boolean = false) {
RouterMgr.getInstance().lifecycleMgr.addListener(callback, this.targetClassName, inRootView);
}
public removeListener(callback: LifecycleCallback): boolean {
return RouterMgr.getInstance().lifecycleMgr.removeListener(callback);
}
}
|
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/lifecycle/LifecycleRegistry.ets#L14-L61
|
4cb2f80735453d51f086f4a794475f0ddb76207b
|
gitee
|
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
api/@ohos.batteryInfo.d.ets
|
arkts
|
Battery health status of a device.
@enum { int }
@syscap SystemCapability.PowerManager.BatteryManager.Core
@since 20
|
export enum BatteryHealthState {
/**
* Unknown state.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/
UNKNOWN,
/**
* The battery is in healthy state.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/
GOOD,
/**
* The battery is overheated.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/
OVERHEAT,
/**
* The battery voltage is over high.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/
OVERVOLTAGE,
/**
* The battery temperature is low.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/
COLD,
/**
* The battery is dead.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/
DEAD
}
|
AST#export_declaration#Left export AST#enum_declaration#Left enum BatteryHealthState AST#enum_body#Left { /**
* Unknown state.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/ AST#enum_member#Left UNKNOWN AST#enum_member#Right , /**
* The battery is in healthy state.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/ AST#enum_member#Left GOOD AST#enum_member#Right , /**
* The battery is overheated.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/ AST#enum_member#Left OVERHEAT AST#enum_member#Right , /**
* The battery voltage is over high.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/ AST#enum_member#Left OVERVOLTAGE AST#enum_member#Right , /**
* The battery temperature is low.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/ AST#enum_member#Left COLD AST#enum_member#Right , /**
* The battery is dead.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/ AST#enum_member#Left DEAD AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
|
export enum BatteryHealthState {
UNKNOWN,
GOOD,
OVERHEAT,
OVERVOLTAGE,
COLD,
DEAD
}
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.batteryInfo.d.ets#L279-L322
|
8ade6acbdc872dc8ccab38a7a209d03daa12c4be
|
gitee
|
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/database/src/main/ets/datasource/footprint/FootprintLocalDataSourceImpl.ets
|
arkts
|
addFootprint
|
添加足迹记录
@param {Footprint} footprint 足迹记录
@returns {Promise<void>} Promise<void>
|
async addFootprint(footprint: Footprint): Promise<void> {
this.orm.save(this.toEntity(footprint));
}
|
AST#method_declaration#Left async addFootprint AST#parameter_list#Left ( AST#parameter#Left footprint : AST#type_annotation#Left AST#primary_type#Left Footprint AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . orm AST#member_expression#Right AST#expression#Right . save AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . toEntity AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left footprint AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
async addFootprint(footprint: Footprint): Promise<void> {
this.orm.save(this.toEntity(footprint));
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/footprint/FootprintLocalDataSourceImpl.ets#L44-L46
|
671a2e63e4545b97e445c0c3bf83580e7f62defb
|
github
|
common-apps/ZRouter
|
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
|
RouterApi/src/main/ets/api/Router.ets
|
arkts
|
removeInterceptor
|
移除拦截器
@param interceptor
@param stackName
@returns true:移除成功,false:移除失败
|
public static removeInterceptor<T extends IInterceptor>(interceptor: T,
stackName: string = DEFAULT_STACK_NAME): boolean {
return ZRouter.getRouterMgr().removeInterceptor<T>(interceptor, stackName)
}
|
AST#method_declaration#Left public static removeInterceptor AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left IInterceptor AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left interceptor : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left stackName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left DEFAULT_STACK_NAME 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ZRouter AST#expression#Right . getRouterMgr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . removeInterceptor AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left interceptor AST#expression#Right , AST#expression#Left stackName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public static removeInterceptor<T extends IInterceptor>(interceptor: T,
stackName: string = DEFAULT_STACK_NAME): boolean {
return ZRouter.getRouterMgr().removeInterceptor<T>(interceptor, stackName)
}
|
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L300-L303
|
cd8e9e01101d9350844d2e6bad338319e6c1d141
|
gitee
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/data/BarDataSet.ets
|
arkts
|
setStackLabels
|
Sets labels for different values of bar-stacks, in case there are one.
@param labels
|
public setStackLabels(labels: string[]): void {
this.mStackLabels = labels;
}
|
AST#method_declaration#Left public setStackLabels AST#parameter_list#Left ( AST#parameter#Left labels : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mStackLabels AST#member_expression#Right = AST#expression#Left labels AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public setStackLabels(labels: string[]): void {
this.mStackLabels = labels;
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BarDataSet.ets#L285-L287
|
b541bb226e1d690ddb134c0b6579f8594e4ab766
|
gitee
|
vhall/VHLive_SDK_Harmony
|
29c820e5301e17ae01bc6bdcc393a4437b518e7c
|
watchKit/src/main/ets/components/menu/VHInviteDialog.ets
|
arkts
|
closePopup
|
关闭弹窗
|
private closePopup() {
this.resetState();
this.controller.close()
}
|
AST#method_declaration#Left private closePopup AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . resetState 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 . controller AST#member_expression#Right AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
private closePopup() {
this.resetState();
this.controller.close()
}
|
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/menu/VHInviteDialog.ets#L54-L57
|
239044d341104d021bfe99bb99d41dcdf2d1412a
|
gitee
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/common/utils/strings/StringPyHelper.ets
|
arkts
|
convertUnicodeForPinyin
|
// 复合字符编码(拼音) 统一转换为复合形式 / 若用拼音保存为文件名时,这时Mac上文件(路径)名的编码形式,码点形式也会被自动转换为复合码形式 / 因为腾讯云Cos上的文件是直接从Mac上传的,所以必须要采用相同的字符形式,才能在Cos的SDK下载时URLEncode地址也一样
|
static convertUnicodeForPinyin(str: string): string {
if (!str || str.length === 0) return str;
///////////////////////////////////////////////////////////////
//通过URL可将码点表示 ---转换成---> 复合码表示,
// "t\u{00f3}u n\u{01ce}o" // 码点直接表示:tóu nǎ
// ↓↓↓↓↓↓↓↓↓↓↓↓
// "to\u{0301}u na\u{030c}o" // 复合码表示: tóu nǎo
///////////////////////////////////////////////////////////////
///可直接使用此方法将预设置码点字符转换为标准的分解字符
// by ko 2020.12.22
return str.normalize('NFD'); // NFD: 标准分解
}
|
AST#method_declaration#Left static convertUnicodeForPinyin 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_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left str AST#expression#Right AST#unary_expression#Right AST#expression#Right || AST#expression#Left str 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#statement#Left AST#return_statement#Left return AST#expression#Left str AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right /////////////////////////////////////////////////////////////// //通过URL可将码点表示 ---转换成---> 复合码表示, // "t\u{00f3}u n\u{01ce}o" // 码点直接表示:tóu nǎ // ↓↓↓↓↓↓↓↓↓↓↓↓ // "to\u{0301}u na\u{030c}o" // 复合码表示: tóu nǎo /////////////////////////////////////////////////////////////// ///可直接使用此方法将预设置码点字符转换为标准的分解字符 // by ko 2020.12.22 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 . normalize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'NFD' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right // NFD: 标准分解 } AST#block_statement#Right AST#method_declaration#Right
|
static convertUnicodeForPinyin(str: string): string {
if (!str || str.length === 0) return str;
return str.normalize('NFD');
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringPyHelper.ets#L7-L20
|
797b2561443df091b8145478181e2b0ebff192ec
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/media/VoiceService.ets
|
arkts
|
语音合成配置接口
|
export interface TTSConfig {
voice: string; // 语音类型
rate: number; // 语速 (0.5-2.0)
pitch: number; // 音调 (0.5-2.0)
volume: number; // 音量 (0-1)
language: string; // 语言
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface TTSConfig AST#object_type#Left { AST#type_member#Left voice : 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 rate : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 语速 (0.5-2.0) AST#type_member#Left pitch : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 音调 (0.5-2.0) AST#type_member#Left volume : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 音量 (0-1) AST#type_member#Left language : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 语言 } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface TTSConfig {
voice: string;
rate: number;
pitch: number;
volume: number;
language: string;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/VoiceService.ets#L28-L34
|
f6eece13de8fde883182001b3f40cd7d64266bcb
|
github
|
|
zhongte/TaoYao
|
80850f3800dd6037216d3f7c58a2bf34a881c93f
|
taoyao/src/main/ets/shijing/taoyao/notification/NotificationPermissionChecker.ets
|
arkts
|
isNotificationEnabled
|
判断是否有通知权限
@returns
|
static isNotificationEnabled(): Promise<boolean>{
return notificationManager.isNotificationEnabled()
}
|
AST#method_declaration#Left static isNotificationEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notificationManager AST#expression#Right . isNotificationEnabled 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 isNotificationEnabled(): Promise<boolean>{
return notificationManager.isNotificationEnabled()
}
|
https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/notification/NotificationPermissionChecker.ets#L10-L12
|
80349367bdb03741e6e90c968d5b8014e64b8bce
|
gitee
|
ericple/oh-bill
|
058af8872c927b9730467798549539e586e275fe
|
entry/src/main/ets/data/balanceTypes.ets
|
arkts
|
Copyright (c) 2023 Ericple OpenBill is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2 THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. See the Mulan PSL v2 for more details.
|
export interface IBillType {
title: string; img: Resource;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface IBillType AST#object_type#Left { AST#type_member#Left title : 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 img : AST#type_annotation#Left AST#primary_type#Left Resource 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 IBillType {
title: string; img: Resource;
}
|
https://github.com/ericple/oh-bill/blob/058af8872c927b9730467798549539e586e275fe/entry/src/main/ets/data/balanceTypes.ets#L8-L10
|
2c49422c030626c887513f684806551846f9fdc9
|
gitee
|
|
openharmony/multimedia_camera_framework
|
9873dd191f59efda885bc06897acf9b0660de8f2
|
frameworks/js/camera_napi/demo/entry/src/main/ets/views/ModeSwitchPage.ets
|
arkts
|
isVideoPhotoFn
|
判断录像或者照片模式
|
isVideoPhotoFn(): void {
if (this.modelBagCol == 'photo' || this.modelBagCol == 'portrait' || this.modelBagCol == 'night') {
CameraService.takePicture();
} else if (this.modelBagCol == 'video' || this.modelBagCol == 'superStab') {
this.isModeBol = false;
if (this.timer !== undefined) {
clearInterval(this.timer);
}
// 开始录制
CameraService.startVideo().then((): void => {
// 计时器
this.timer = setInterval(() => {
this.videoRecodeTime += 1000;
}, 1000);
});
}
}
|
AST#method_declaration#Left isVideoPhotoFn AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . modelBagCol AST#member_expression#Right AST#expression#Right == AST#expression#Left 'photo' AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . modelBagCol AST#member_expression#Right AST#expression#Right == AST#expression#Left 'portrait' AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . modelBagCol AST#member_expression#Right AST#expression#Right == AST#expression#Left 'night' 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 CameraService AST#expression#Right . takePicture 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#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 this AST#expression#Right . modelBagCol AST#member_expression#Right AST#expression#Right == AST#expression#Left 'video' AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . modelBagCol AST#member_expression#Right AST#expression#Right == AST#expression#Left 'superStab' 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 . isModeBol 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#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 . timer AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left clearInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timer 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CameraService AST#expression#Right . startVideo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { // 计时器 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timer 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 . videoRecodeTime 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#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#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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
isVideoPhotoFn(): void {
if (this.modelBagCol == 'photo' || this.modelBagCol == 'portrait' || this.modelBagCol == 'night') {
CameraService.takePicture();
} else if (this.modelBagCol == 'video' || this.modelBagCol == 'superStab') {
this.isModeBol = false;
if (this.timer !== undefined) {
clearInterval(this.timer);
}
CameraService.startVideo().then((): void => {
this.timer = setInterval(() => {
this.videoRecodeTime += 1000;
}, 1000);
});
}
}
|
https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/demo/entry/src/main/ets/views/ModeSwitchPage.ets#L147-L163
|
a2368e571dc5f87d0b2bedee798f4db7a53a3a6e
|
gitee
|
iotjin/JhHarmonyDemo.git
|
819e6c3b1db9984c042a181967784550e171b2e8
|
JhCommon/src/main/ets/JhCommon/utils/JhPreferencesUtils.ets
|
arkts
|
has
|
/ 根据key检查缓存值是否存在
|
public static has(key: string): boolean {
key = JhEncryptUtils.aesEncrypt(key)
return PreferencesUtil.hasSync(key)
}
|
AST#method_declaration#Left public static 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left key = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JhEncryptUtils AST#expression#Right . aesEncrypt 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#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PreferencesUtil AST#expression#Right . hasSync 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 static has(key: string): boolean {
key = JhEncryptUtils.aesEncrypt(key)
return PreferencesUtil.hasSync(key)
}
|
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/utils/JhPreferencesUtils.ets#L74-L77
|
71ef480fe6a0918477c9f552a7b7f9f0e7a14552
|
github
|
common-apps/ZRouter
|
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
|
RouterApi/src/main/ets/api/Router.ets
|
arkts
|
addLifecycleObserver
|
`
添加单个NavDestination页面的生命周期观察者,在NavDestination页面模版模式下才会生效
@param observer
|
public static addLifecycleObserver(observer: LifecycleObserver): TemplateMgr {
return TemplateMgr.getInstance().addObserver(observer)
}
|
AST#method_declaration#Left public static addLifecycleObserver AST#parameter_list#Left ( AST#parameter#Left observer : AST#type_annotation#Left AST#primary_type#Left LifecycleObserver AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TemplateMgr 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 TemplateMgr 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 . addObserver AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left observer AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public static addLifecycleObserver(observer: LifecycleObserver): TemplateMgr {
return TemplateMgr.getInstance().addObserver(observer)
}
|
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L330-L332
|
831ab6d48360e06e3c86e59ac6033fc1c39a6378
|
gitee
|
anhao0226/harmony-music-player.git
|
4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073
|
entry/src/main/ets/view_models/playlist_mode.ets
|
arkts
|
PlaylistResponse
|
export interface PlaylistResponse {
code: number
message?: string
relatedVideos?: any
playlist?: Playlist
urls?: any
privileges?: Privilege[]
sharedPrivilege?: any
resEntrance?: any
fromUsers?: any
fromUserCount?: number
songFromUsers?: any
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface PlaylistResponse AST#object_type#Left { AST#type_member#Left code : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left message ? : 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 relatedVideos ? : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left playlist ? : AST#type_annotation#Left AST#primary_type#Left Playlist AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left urls ? : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left privileges ? : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Privilege [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left sharedPrivilege ? : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left resEntrance ? : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left fromUsers ? : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left fromUserCount ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left songFromUsers ? : AST#type_annotation#Left AST#primary_type#Left any 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 PlaylistResponse {
code: number
message?: string
relatedVideos?: any
playlist?: Playlist
urls?: any
privileges?: Privilege[]
sharedPrivilege?: any
resEntrance?: any
fromUsers?: any
fromUserCount?: number
songFromUsers?: any
}
|
https://github.com/anhao0226/harmony-music-player.git/blob/4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073/entry/src/main/ets/view_models/playlist_mode.ets#L4-L16
|
768ba5fca47a798e7452605d8a45f718af74cd72
|
github
|
|
harmonyos/samples
|
f5d967efaa7666550ee3252d118c3c73a77686f5
|
HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/universal/events/dragEventSample/component/HyperlinkDrag.ets
|
arkts
|
HyperlinkDrag
|
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.
|
@Component
export struct HyperlinkDrag {
@State visible: boolean = true
// 自定义拖拽过程中显示的内容
@Builder pixelMapBuilder() {
Hyperlink("https://www.openharmony.cn", 'OpenHarmony')
.color('#007DFF')
}
build() {
Column() {
Hyperlink("https://www.openharmony.cn", 'OpenHarmony')
.id('hyperlink')
.color('#007DFF')
.visibility(this.visible ? Visibility.Visible : Visibility.Hidden)
.draggable(true)
.onDragStart(() => {
this.visible = false
return this.pixelMapBuilder
})
.onDragEnd(() => {
this.visible = true
})
}
.width(400)
.height(80)
.backgroundColor(0xF9CF93)
.justifyContent(FlexAlign.Center)
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct HyperlinkDrag AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right visible : 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#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right pixelMapBuilder 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 Hyperlink ( AST#expression#Left "https://www.openharmony.cn" AST#expression#Right , AST#expression#Left 'OpenHarmony' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . color ( AST#expression#Left '#007DFF' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#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 Hyperlink ( AST#expression#Left "https://www.openharmony.cn" AST#expression#Right , AST#expression#Left 'OpenHarmony' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left 'hyperlink' AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left '#007DFF' AST#expression#Right ) AST#modifier_chain_expression#Left . visibility ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . visible AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . Visible AST#member_expression#Right AST#expression#Right : AST#expression#Left Visibility AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Hidden AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . draggable ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onDragStart ( 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 . visible 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#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pixelMapBuilder AST#member_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onDragEnd ( 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 . visible 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#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 400 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 80 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 0xF9CF93 AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 HyperlinkDrag {
@State visible: boolean = true
@Builder pixelMapBuilder() {
Hyperlink("https://www.openharmony.cn", 'OpenHarmony')
.color('#007DFF')
}
build() {
Column() {
Hyperlink("https://www.openharmony.cn", 'OpenHarmony')
.id('hyperlink')
.color('#007DFF')
.visibility(this.visible ? Visibility.Visible : Visibility.Hidden)
.draggable(true)
.onDragStart(() => {
this.visible = false
return this.pixelMapBuilder
})
.onDragEnd(() => {
this.visible = true
})
}
.width(400)
.height(80)
.backgroundColor(0xF9CF93)
.justifyContent(FlexAlign.Center)
}
}
|
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/universal/events/dragEventSample/component/HyperlinkDrag.ets#L16-L46
|
9519f3c86c748cad1d80543ad59da2c4f3d65b88
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_web/src/main/ets/utils/Tools.ets
|
arkts
|
getPixelMapFromMedia
|
用户获取resource目录下的media中的图片PixelMap
@param resource 例如:$r("app.media.icon")
@returns
|
static async getPixelMapFromMedia(resource: Resource, options?: image.DecodingOptions): Promise<image.PixelMap> {
let uint8Array = await Tools.getMediaContent(resource);
return await Tools.createImageSource(uint8Array.buffer).createPixelMap(options);
}
|
AST#method_declaration#Left static async getPixelMapFromMedia 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#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . DecodingOptions 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#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#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 uint8Array = 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 Tools AST#expression#Right AST#await_expression#Right AST#expression#Right . getMediaContent 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#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 AST#await_expression#Left await AST#expression#Left Tools AST#expression#Right AST#await_expression#Right AST#expression#Right . createImageSource AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left uint8Array AST#expression#Right . buffer AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . createPixelMap AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left options 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 getPixelMapFromMedia(resource: Resource, options?: image.DecodingOptions): Promise<image.PixelMap> {
let uint8Array = await Tools.getMediaContent(resource);
return await Tools.createImageSource(uint8Array.buffer).createPixelMap(options);
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/Tools.ets#L127-L130
|
6822c55f4f4f948a4a8ee1fa681f0ea0d081758c
|
gitee
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/data/ScatterDataSet.ets
|
arkts
|
setScatterShapeHoleRadius
|
Sets the radius of the hole in the shape (applies to Square, Circle and Triangle)
Set this to <= 0 to remove holes.
@param holeRadius
|
public setScatterShapeHoleRadius(holeRadius: number): void {
this.mScatterShapeHoleRadius = holeRadius;
}
|
AST#method_declaration#Left public setScatterShapeHoleRadius AST#parameter_list#Left ( AST#parameter#Left holeRadius : 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 . mScatterShapeHoleRadius AST#member_expression#Right = AST#expression#Left holeRadius AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public setScatterShapeHoleRadius(holeRadius: number): void {
this.mScatterShapeHoleRadius = holeRadius;
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/ScatterDataSet.ets#L125-L127
|
41a433a3c7cfb8e6bf6706fc3cb694cc6c87f1d7
|
gitee
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/user/src/main/ets/viewmodel/ProfileViewModel.ets
|
arkts
|
@file 个人中心页面 ViewModel
@author Joker.X
|
@ObservedV2
export default class ProfileViewModel extends BaseViewModel {
/**
* 全局用户状态
*/
private readonly userState: UserState = getUserState();
/**
* 退出登录弹窗显示状态
*/
@Trace
showLogoutDialog: boolean = false;
/**
* 页面显示时回调
* @returns {void} 无返回值
*/
aboutToAppear(): void {
this.userState.refreshUserInfo();
}
/**
* 触发退出登录弹窗
* @returns {void} 无返回值
*/
requestLogout(): void {
this.showLogoutDialog = true;
}
/**
* 退出登录点击
* @returns {void} 无返回值
*/
onLogoutClick(): void {
this.requestLogout();
}
/**
* 确认退出登录
* @returns {void} 无返回值
*/
confirmLogout(): void {
this.userState.logout();
this.hideLogoutDialog();
navigateBack();
}
/**
* 隐藏退出登录弹窗
* @returns {void} 无返回值
*/
hideLogoutDialog(): void {
this.showLogoutDialog = false;
}
/**
* 获取用户信息
* @returns {UserState} 用户状态
*/
getUserState(): UserState {
return this.userState;
}
/**
* 获取用户信息
* @returns {User} 用户信息
*/
getUserInfo(): User {
return this.userState.getUserInfo();
}
/**
* 获取头像地址
* @returns {ResourceStr} 头像地址
*/
getAvatarUrl(): ResourceStr {
return this.getUserInfo().avatarUrl;
}
/**
* 获取昵称展示文本
* @returns {ResourceStr} 昵称文本
*/
getNickNameText(): ResourceStr {
return this.getUserInfo().nickName ?? $r("app.string.not_set");
}
/**
* 获取手机号展示文本
* @returns {ResourceStr} 手机号文本
*/
getPhoneText(): ResourceStr {
const phone: string = this.getUserInfo().phone ?? "";
return phone ? phone : $r("app.string.not_bound");
}
/**
* 获取账号展示文本
* @returns {ResourceStr} 账号文本
*/
getAccountText(): ResourceStr {
const id: number | null = this.getUserInfo().id ?? null;
return id ? `${id}` : $r("app.string.not_set");
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class ProfileViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /**
* 全局用户状态
*/ AST#property_declaration#Left private readonly userState : AST#type_annotation#Left AST#primary_type#Left UserState AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left getUserState 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 @ Trace AST#decorator#Right showLogoutDialog : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 页面显示时回调
* @returns {void} 无返回值
*/ AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userState AST#member_expression#Right AST#expression#Right . refreshUserInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 触发退出登录弹窗
* @returns {void} 无返回值
*/ AST#method_declaration#Left requestLogout 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 . showLogoutDialog AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 退出登录点击
* @returns {void} 无返回值
*/ AST#method_declaration#Left onLogoutClick 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 this AST#expression#Right . requestLogout AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 确认退出登录
* @returns {void} 无返回值
*/ AST#method_declaration#Left confirmLogout AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userState AST#member_expression#Right AST#expression#Right . logout AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hideLogoutDialog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#ui_custom_component_statement#Left navigateBack ( ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 隐藏退出登录弹窗
* @returns {void} 无返回值
*/ AST#method_declaration#Left hideLogoutDialog 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 . showLogoutDialog AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 获取用户信息
* @returns {UserState} 用户状态
*/ AST#method_declaration#Left getUserState AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left UserState 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 . userState AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取用户信息
* @returns {User} 用户信息
*/ AST#method_declaration#Left getUserInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left User AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userState AST#member_expression#Right AST#expression#Right . getUserInfo 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 /**
* 获取头像地址
* @returns {ResourceStr} 头像地址
*/ AST#method_declaration#Left getAvatarUrl AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ResourceStr 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 this AST#expression#Right . getUserInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . avatarUrl AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取昵称展示文本
* @returns {ResourceStr} 昵称文本
*/ AST#method_declaration#Left getNickNameText AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ResourceStr 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#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUserInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . nickName AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.not_set" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取手机号展示文本
* @returns {ResourceStr} 手机号文本
*/ AST#method_declaration#Left getPhoneText AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left phone : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUserInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . phone AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#ERROR#Left return AST#expression#Left phone AST#expression#Right ? phone AST#ERROR#Left : AST#ERROR#Left $r ( "app.string.not_bound" ) ; } /**
* 获取账号展示文本
* @returns {ResourceStr} 账号文本
*/ getAccount Text AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right { AST#ERROR#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left id : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number 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#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 this AST#expression#Right . getUserInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . id 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#conditional_expression#Left AST#expression#Left id AST#expression#Right ? AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left id AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.not_set" AST#expression#Right ) AST#resource_expression#Right 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 } AST#class_body#Right AST#class_declaration#Right AST#decorated_export_declaration#Right
|
@ObservedV2
export default class ProfileViewModel extends BaseViewModel {
private readonly userState: UserState = getUserState();
@Trace
showLogoutDialog: boolean = false;
aboutToAppear(): void {
this.userState.refreshUserInfo();
}
requestLogout(): void {
this.showLogoutDialog = true;
}
onLogoutClick(): void {
this.requestLogout();
}
confirmLogout(): void {
this.userState.logout();
this.hideLogoutDialog();
navigateBack();
}
hideLogoutDialog(): void {
this.showLogoutDialog = false;
}
getUserState(): UserState {
return this.userState;
}
getUserInfo(): User {
return this.userState.getUserInfo();
}
getAvatarUrl(): ResourceStr {
return this.getUserInfo().avatarUrl;
}
getNickNameText(): ResourceStr {
return this.getUserInfo().nickName ?? $r("app.string.not_set");
}
getPhoneText(): ResourceStr {
const phone: string = this.getUserInfo().phone ?? "";
return phone ? phone : $r("app.string.not_bound");
}
getAccountText(): ResourceStr {
const id: number | null = this.getUserInfo().id ?? null;
return id ? `${id}` : $r("app.string.not_set");
}
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/ProfileViewModel.ets#L10-L113
|
549d196e79c03aeaf128697d6a671a24e9b58928
|
github
|
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
feature/demo/src/main/ets/viewmodel/DatabaseViewModel.ets
|
arkts
|
refreshList
|
刷新列表
@returns {Promise<void>} Promise<void>
|
async refreshList(): Promise<void> {
await this.runWithLoading(async (): Promise<void> => {
await this.fetchList();
});
}
|
AST#method_declaration#Left async refreshList 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#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . runWithLoading AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left async AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . fetchList AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
async refreshList(): Promise<void> {
await this.runWithLoading(async (): Promise<void> => {
await this.fetchList();
});
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/viewmodel/DatabaseViewModel.ets#L115-L119
|
ebf9f7ea0c39ab83d14a34f703edab9755d982c5
|
github
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/ui/src/main/ets/component/network/BaseNetWorkView.ets
|
arkts
|
渲染网络请求状态视图
@returns {void} 无返回值
|
build() {
Column() {
if (this.uiState === BaseNetWorkUiState.LOADING) {
Column() {
if (this.loadingBuilder) {
this.loadingBuilder();
} else {
this.buildDefaultLoading();
}
}
.transition(TransitionEffect.OPACITY.animation({ duration: 300, curve: Curve.EaseInOut }))
} else if (this.uiState === BaseNetWorkUiState.ERROR) {
Column() {
if (this.errorBuilder) {
this.errorBuilder();
} else {
this.buildDefaultError();
}
}
.transition(TransitionEffect.OPACITY.animation({ duration: 300, curve: Curve.EaseInOut }))
} else {
Column() {
if (this.content) {
this.content();
}
}
.transition(TransitionEffect.OPACITY.animation({ duration: 300, curve: Curve.EaseInOut }))
}
}
}
|
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . uiState AST#member_expression#Right AST#expression#Right === AST#expression#Left BaseNetWorkUiState AST#expression#Right AST#binary_expression#Right AST#expression#Right . LOADING AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loadingBuilder 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 . loadingBuilder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildDefaultLoading AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . transition ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TransitionEffect AST#expression#Right . OPACITY AST#member_expression#Right AST#expression#Right . animation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 300 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseInOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . uiState AST#member_expression#Right AST#expression#Right === AST#expression#Left BaseNetWorkUiState AST#expression#Right AST#binary_expression#Right AST#expression#Right . ERROR AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . errorBuilder 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 . errorBuilder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildDefaultError AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . transition ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TransitionEffect AST#expression#Right . OPACITY AST#member_expression#Right AST#expression#Right . animation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 300 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseInOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content 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 . content AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . transition ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TransitionEffect AST#expression#Right . OPACITY AST#member_expression#Right AST#expression#Right . animation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 300 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseInOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
|
build() {
Column() {
if (this.uiState === BaseNetWorkUiState.LOADING) {
Column() {
if (this.loadingBuilder) {
this.loadingBuilder();
} else {
this.buildDefaultLoading();
}
}
.transition(TransitionEffect.OPACITY.animation({ duration: 300, curve: Curve.EaseInOut }))
} else if (this.uiState === BaseNetWorkUiState.ERROR) {
Column() {
if (this.errorBuilder) {
this.errorBuilder();
} else {
this.buildDefaultError();
}
}
.transition(TransitionEffect.OPACITY.animation({ duration: 300, curve: Curve.EaseInOut }))
} else {
Column() {
if (this.content) {
this.content();
}
}
.transition(TransitionEffect.OPACITY.animation({ duration: 300, curve: Curve.EaseInOut }))
}
}
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/network/BaseNetWorkView.ets#L62-L91
|
35fd3671e09ff8a5238e54e50a12b2a271a538ed
|
github
|
|
iichen-bycode/ArkTsWanandroid.git
|
ad128756a6c703d9a72cf7f6da128c27fc63bd00
|
entry/src/main/ets/http/api.ets
|
arkts
|
首页文章文章
@param date
@returns
|
export function getHomeArticle(page: number) {
return axiosClient.get<HomeArticleModel>({
url: `article/list/${page}/json`,
showLoading: page === 0
})
}
|
AST#export_declaration#Left export AST#function_declaration#Left function getHomeArticle AST#parameter_list#Left ( AST#parameter#Left page : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left axiosClient AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left HomeArticleModel AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left url AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` article/list/ AST#template_substitution#Left $ { AST#expression#Left page AST#expression#Right } AST#template_substitution#Right /json ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left showLoading AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left page AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function getHomeArticle(page: number) {
return axiosClient.get<HomeArticleModel>({
url: `article/list/${page}/json`,
showLoading: page === 0
})
}
|
https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/api.ets#L52-L57
|
40eedd61dcfc9725199ff506cc8acc94ec4b16fa
|
github
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
完整农历系统设计.ets
|
arkts
|
getLunarDayCn
|
获取农历日期中文表示
|
private static getLunarDayCn(lunarDay: number): string {
if (lunarDay < 1 || lunarDay > 30) {
return "未知";
}
return LUNAR_DAYS[lunarDay - 1];
}
|
AST#method_declaration#Left private static getLunarDayCn AST#parameter_list#Left ( AST#parameter#Left lunarDay : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left lunarDay AST#expression#Right < AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left lunarDay AST#expression#Right > AST#expression#Left 30 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#return_statement#Left return AST#expression#Left "未知" 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#subscript_expression#Left AST#expression#Left LUNAR_DAYS AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left lunarDay AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private static getLunarDayCn(lunarDay: number): string {
if (lunarDay < 1 || lunarDay > 30) {
return "未知";
}
return LUNAR_DAYS[lunarDay - 1];
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/完整农历系统设计.ets#L422-L427
|
19af93f4e06cc55804713aca8afd289d0320c735
|
github
|
lulululing/calendar.git
|
c87b7e3ffb50a34941a5db50afe6a513c113bd0b
|
entry/src/main/ets/utils/DateUtil.ets
|
arkts
|
getDaysInMonth
|
获取月份天数
|
static getDaysInMonth(year: number, month: number): number {
return new Date(year, month + 1, 0).getDate()
}
|
AST#method_declaration#Left static getDaysInMonth AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#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 year AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left month AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getDaysInMonth(year: number, month: number): number {
return new Date(year, month + 1, 0).getDate()
}
|
https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/utils/DateUtil.ets#L31-L33
|
24048b4786ecf9c645669119a8e39f8848cbf6be
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/NumberUtil.ets
|
arkts
|
average
|
计算数字的平均值
@param numbers - 要计算的数字列表
@returns 平均值
|
static average(...numbers: number[]): number {
if (numbers.length > 0) {
const sum = numbers.reduce((acc, num) => acc + num, 0);
return sum / numbers.length;
}
return 0;
}
|
AST#method_declaration#Left static average AST#parameter_list#Left ( AST#parameter#Left ... numbers : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_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 numbers 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 const AST#variable_declarator#Left sum = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left numbers AST#expression#Right . reduce AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left acc AST#parameter#Right , AST#parameter#Left num AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#binary_expression#Left AST#expression#Left acc AST#expression#Right + AST#expression#Left num AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left sum AST#expression#Right / AST#expression#Left numbers AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 0 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static average(...numbers: number[]): number {
if (numbers.length > 0) {
const sum = numbers.reduce((acc, num) => acc + num, 0);
return sum / numbers.length;
}
return 0;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NumberUtil.ets#L145-L151
|
d7a7a36224106ec46351ab5d14d1acf8d1b62587
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/ArkWeb/UseOfflineWebComp/entry2/src/main/ets/pages/common.ets
|
arkts
|
webBuilder
|
[Start call_onActive_method_to_pre_render_offline_web_component]
|
@Builder
function webBuilder(data:Data) {
Column() {
Web({ src: data.url, controller: data.controller })
.onPageBegin(() => {
// 调用onActive,开启渲染
data.controller.onActive();
})
// [StartExclude call_onActive_method_to_pre_render_offline_web_component]
.onFirstMeaningfulPaint(() =>{
if (!shouldInactive) {
return;
}
// 在预渲染完成时触发,停止渲染
data.controller.onInactive();
shouldInactive = false;
})
// [EndExclude call_onActive_method_to_pre_render_offline_web_component]
.width('100%')
.height('100%')
}
}
|
AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function webBuilder AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Data 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#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Web ( AST#component_parameters#Left { AST#component_parameter#Left src : AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . url AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left controller : AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . controller AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . onPageBegin ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 调用onActive,开启渲染 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 data AST#expression#Right . controller AST#member_expression#Right AST#expression#Right . onActive 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 ) // [StartExclude call_onActive_method_to_pre_render_offline_web_component] AST#modifier_chain_expression#Left . onFirstMeaningfulPaint ( 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#unary_expression#Left ! AST#expression#Left shouldInactive AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 在预渲染完成时触发,停止渲染 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . controller AST#member_expression#Right AST#expression#Right . onInactive 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 shouldInactive = 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 ) // [EndExclude call_onActive_method_to_pre_render_offline_web_component] 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#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#decorated_function_declaration#Right
|
@Builder
function webBuilder(data:Data) {
Column() {
Web({ src: data.url, controller: data.controller })
.onPageBegin(() => {
data.controller.onActive();
})
.onFirstMeaningfulPaint(() =>{
if (!shouldInactive) {
return;
}
data.controller.onInactive();
shouldInactive = false;
})
.width('100%')
.height('100%')
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/UseOfflineWebComp/entry2/src/main/ets/pages/common.ets#L30-L51
|
e06f8950d380109c10c5c1f50faf93137a6e99c9
|
gitee
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
api/@ohos.file.RecentPhotoComponent.d.ets
|
arkts
|
Recent photo info
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 13
|
export declare class RecentPhotoInfo {
/**
* The dateTaken of photos or videos
*
* @type { ?number }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 13
*/
dateTaken?: number;
/**
* The identifier of photos or videos
*
* @type { ?string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 13
*/
identifier?: string;
}
|
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class RecentPhotoInfo AST#class_body#Left { /**
* The dateTaken of photos or videos
*
* @type { ?number }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 13
*/ AST#property_declaration#Left dateTaken ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* The identifier of photos or videos
*
* @type { ?string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 13
*/ AST#property_declaration#Left identifier ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export declare class RecentPhotoInfo {
dateTaken?: number;
identifier?: string;
}
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.RecentPhotoComponent.d.ets#L174-L194
|
109e059546d43a199d790c313f220a2a1e360c1c
|
gitee
|
|
openharmony/arkui_ace_engine
|
30c7d1ee12fbedf0fabece54291d75897e2ad44f
|
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/ContentModifierHooks.ets
|
arkts
|
@memo
|
export function hookRadioContentModifier(
receiver: ArkRadioComponent, value?: ContentModifier<RadioConfiguration>) {
const wrappedBuilder = value?.applyContent()
if (!wrappedBuilder) {
return
}
const radioBuilder = (parentNode: KPointer, config: RadioConfiguration): KPointer => {
return CallbackTransformer.transformToPeerFromCustomBuilder(
memoWrapper(wrappedBuilder!.builder, [config]))
}
if (value) {
ContentModifierHelper.contentModifierRadio(receiver.getPeer().peer.ptr, value!, radioBuilder)
}
}
|
AST#export_declaration#Left export AST#function_declaration#Left function hookRadioContentModifier AST#parameter_list#Left ( AST#parameter#Left receiver : AST#type_annotation#Left AST#primary_type#Left ArkRadioComponent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ContentModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left RadioConfiguration 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#variable_declaration#Left const AST#variable_declarator#Left wrappedBuilder = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right ?. applyContent 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 wrappedBuilder AST#expression#Right AST#unary_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 const AST#variable_declarator#Left radioBuilder = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left parentNode : AST#type_annotation#Left AST#primary_type#Left KPointer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left RadioConfiguration AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left KPointer 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CallbackTransformer AST#expression#Right . transformToPeerFromCustomBuilder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left memoWrapper AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left wrappedBuilder AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . builder AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left config AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left } if AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left value AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_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#object_literal#Left { AST#property_assignment#Left ContentModifierHelper AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . contentModifierRadio AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left receiver AST#expression#Right . getPeer AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . peer AST#member_expression#Right AST#expression#Right . ptr AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left value AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right , AST#expression#Left radioBuilder 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#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function hookRadioContentModifier(
receiver: ArkRadioComponent, value?: ContentModifier<RadioConfiguration>) {
const wrappedBuilder = value?.applyContent()
if (!wrappedBuilder) {
return
}
const radioBuilder = (parentNode: KPointer, config: RadioConfiguration): KPointer => {
return CallbackTransformer.transformToPeerFromCustomBuilder(
memoWrapper(wrappedBuilder!.builder, [config]))
}
if (value) {
ContentModifierHelper.contentModifierRadio(receiver.getPeer().peer.ptr, value!, radioBuilder)
}
}
|
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/ContentModifierHooks.ets#L162-L175
|
4c714effcea62c4f17681585164854d8e8990425
|
gitee
|
|
openharmony/applications_launcher
|
f75dfb6bf7276e942793b75e7a9081bbcd015843
|
feature/pagedesktop/src/main/ets/default/common/components/FormItem.ets
|
arkts
|
setStartAppInfo
|
set start app info
|
private setStartAppInfo() {
Log.showInfo(TAG, 'app setStartAppInfo');
AppStorage.setOrCreate('startAppItemInfo', this.formItem);
AppStorage.setOrCreate('startAppTypeFromPageDesktop', CommonConstants.OVERLAY_TYPE_CARD);
this.mPageDesktopStartAppHandler.setAppIconSize(this.mFormItemWidth, this.mFormItemHeight);
this.mPageDesktopStartAppHandler.setAppIconInfo();
}
|
AST#method_declaration#Left private setStartAppInfo 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 Log AST#expression#Right . showInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'app setStartAppInfo' 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 AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'startAppItemInfo' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . formItem 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 AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'startAppTypeFromPageDesktop' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . OVERLAY_TYPE_CARD 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . mPageDesktopStartAppHandler AST#member_expression#Right AST#expression#Right . setAppIconSize 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 . mFormItemWidth AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mFormItemHeight 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . mPageDesktopStartAppHandler AST#member_expression#Right AST#expression#Right . setAppIconInfo 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
|
private setStartAppInfo() {
Log.showInfo(TAG, 'app setStartAppInfo');
AppStorage.setOrCreate('startAppItemInfo', this.formItem);
AppStorage.setOrCreate('startAppTypeFromPageDesktop', CommonConstants.OVERLAY_TYPE_CARD);
this.mPageDesktopStartAppHandler.setAppIconSize(this.mFormItemWidth, this.mFormItemHeight);
this.mPageDesktopStartAppHandler.setAppIconInfo();
}
|
https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/feature/pagedesktop/src/main/ets/default/common/components/FormItem.ets#L302-L308
|
05eb2aa9cde1669d2e30d792d8a8093021abd2e6
|
gitee
|
BohanSu/LumosAgent-HarmonyOS.git
|
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
|
entry/src/main/ets/viewmodel/MainViewModel.ets
|
arkts
|
saveChatLog
|
保存聊天记录到数据库
|
private async saveChatLog(content: string, isUser: boolean, emotion: string): Promise<void> {
try {
const chatLog = new ChatLog(
0,
ChatLog.getTodayDateString(),
content,
isUser,
emotion,
Date.now()
);
await this.rdbHelper.insertChatLog(chatLog);
} catch (error) {
console.error(`[MainViewModel] Failed to save chat log: ${JSON.stringify(error)}`);
}
}
|
AST#method_declaration#Left private async saveChatLog AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isUser : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left emotion : 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 chatLog = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ChatLog AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ChatLog AST#expression#Right . getTodayDateString 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 content AST#expression#Right , AST#expression#Left isUser AST#expression#Right , AST#expression#Left emotion AST#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#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#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 . rdbHelper AST#member_expression#Right AST#expression#Right . insertChatLog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left chatLog AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [MainViewModel] Failed to save chat log: 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#block_statement#Right AST#method_declaration#Right
|
private async saveChatLog(content: string, isUser: boolean, emotion: string): Promise<void> {
try {
const chatLog = new ChatLog(
0,
ChatLog.getTodayDateString(),
content,
isUser,
emotion,
Date.now()
);
await this.rdbHelper.insertChatLog(chatLog);
} catch (error) {
console.error(`[MainViewModel] Failed to save chat log: ${JSON.stringify(error)}`);
}
}
|
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L317-L331
|
c7d49843d1ffd32d8103a19263ca1195fea549c4
|
github
|
ni202383/Chenguang-Calendar.git
|
c04543db2c394d662bc1336d098335134ff1e9a5
|
src/main/ets/pages/WeeklyTaskPage.ets
|
arkts
|
addNewTask
|
添加新任务
|
private addNewTask(): void {
if (this.newTaskName.trim() === '') {
console.log('任务名称不能为空');
return;
}
const now = new Date();
const newTask = new TaskTimeRange(
`task_${Date.now()}`,
this.newTaskName.trim(),
new Date(now.getFullYear(), now.getMonth(), now.getDate(), 16, 0),
new Date(now.getFullYear(), now.getMonth(), now.getDate(), 17, 0)
);
this.weeklyTaskTimeRangeList.push(newTask);
this.newTaskName = '';
console.log(`添加新任务: ${newTask.taskName}`);
}
|
AST#method_declaration#Left private addNewTask AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . newTaskName 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#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 console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '任务名称不能为空' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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#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 newTask = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left TaskTimeRange AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` task_ AST#template_substitution#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#template_substitution#Right ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . newTaskName 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#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left now AST#expression#Right . getFullYear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left now AST#expression#Right . getMonth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left now 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 16 AST#expression#Right , AST#expression#Left 0 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#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left now AST#expression#Right . getFullYear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left now AST#expression#Right . getMonth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left now 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 17 AST#expression#Right , 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#member_expression#Left AST#expression#Left this AST#expression#Right . weeklyTaskTimeRangeList AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left newTask 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 . newTaskName 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 添加新任务: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left newTask AST#expression#Right . taskName 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#method_declaration#Right
|
private addNewTask(): void {
if (this.newTaskName.trim() === '') {
console.log('任务名称不能为空');
return;
}
const now = new Date();
const newTask = new TaskTimeRange(
`task_${Date.now()}`,
this.newTaskName.trim(),
new Date(now.getFullYear(), now.getMonth(), now.getDate(), 16, 0),
new Date(now.getFullYear(), now.getMonth(), now.getDate(), 17, 0)
);
this.weeklyTaskTimeRangeList.push(newTask);
this.newTaskName = '';
console.log(`添加新任务: ${newTask.taskName}`);
}
|
https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/src/main/ets/pages/WeeklyTaskPage.ets#L159-L177
|
60182d6fffb8161dca4740a16a7e800a89bdfeae
|
github
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
feature/demo/src/main/ets/view/NavigationWithArgsPage.ets
|
arkts
|
NavigationWithArgsContent
|
带参跳转示例页内容视图
@returns {void} 无返回值
|
@Builder
private NavigationWithArgsContent() {
ColumnCenter() {
Text(this.vm.routeParams.goodsId.toString() ?? $r("app.string.demo_navigation_with_args_value_empty"));
Text(this.vm.routeParams.goodsName ?? $r("app.string.demo_navigation_with_args_value_empty"));
}
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private NavigationWithArgsContent 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 ColumnCenter ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . routeParams AST#member_expression#Right AST#expression#Right . goodsId AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_navigation_with_args_value_empty" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#binary_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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . routeParams AST#member_expression#Right AST#expression#Right . goodsName AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_navigation_with_args_value_empty" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#binary_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#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 NavigationWithArgsContent() {
ColumnCenter() {
Text(this.vm.routeParams.goodsId.toString() ?? $r("app.string.demo_navigation_with_args_value_empty"));
Text(this.vm.routeParams.goodsName ?? $r("app.string.demo_navigation_with_args_value_empty"));
}
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/NavigationWithArgsPage.ets#L34-L40
|
78c80a910c627cbab6f70af52a57d86b5e0aa090
|
github
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/HomePage.ets
|
arkts
|
FlashSaleSection
|
限时精选
|
@Builder
FlashSaleSection() {
Column() {
Column({ space: AppDimensions.spaceMedium }) {
// 标题行
Row() {
Row({ space: AppDimensions.spaceSmall }) {
Text('⏰')
.fontSize(20)
Text('限时精选')
.fontSize(AppTypography.fontSizeLarge)
.fontWeight(AppTypography.fontWeightMedium)
.fontColor(AppColors.textPrimary)
}
Blank()
Text('查看全部')
.fontSize(AppTypography.fontSizeMedium)
.fontColor(AppColors.textSecondary)
}
.width('100%')
// 商品列表
List({ space: AppDimensions.spaceSmall }) {
ForEach(this.flashSaleGoods, (goods: Goods) => {
ListItem() {
this.FlashSaleItem(goods)
}
})
}
.listDirection(Axis.Horizontal)
.scrollBar(BarState.Off)
.width('100%')
.height(180)
}
}
.width('100%')
.backgroundColor(AppColors.surface)
.borderRadius(AppDimensions.radiusMedium)
.padding(AppDimensions.paddingLarge)
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right FlashSaleSection 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#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left 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 Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left AppDimensions AST#expression#Right . spaceSmall AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '⏰' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#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 AST#member_expression#Left AST#expression#Left AppTypography AST#expression#Right . fontSizeLarge 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 . fontWeightMedium 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#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 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 . 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 . 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 . 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 AST#member_expression#Left AST#expression#Left AppDimensions AST#expression#Right . spaceSmall AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . flashSaleGoods AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left 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#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 . FlashSaleItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left goods AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#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 . listDirection ( AST#expression#Left AST#member_expression#Left AST#expression#Left Axis AST#expression#Right . Horizontal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Off AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 180 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#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 . paddingLarge 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
FlashSaleSection() {
Column() {
Column({ space: AppDimensions.spaceMedium }) {
Row() {
Row({ space: AppDimensions.spaceSmall }) {
Text('⏰')
.fontSize(20)
Text('限时精选')
.fontSize(AppTypography.fontSizeLarge)
.fontWeight(AppTypography.fontWeightMedium)
.fontColor(AppColors.textPrimary)
}
Blank()
Text('查看全部')
.fontSize(AppTypography.fontSizeMedium)
.fontColor(AppColors.textSecondary)
}
.width('100%')
List({ space: AppDimensions.spaceSmall }) {
ForEach(this.flashSaleGoods, (goods: Goods) => {
ListItem() {
this.FlashSaleItem(goods)
}
})
}
.listDirection(Axis.Horizontal)
.scrollBar(BarState.Off)
.width('100%')
.height(180)
}
}
.width('100%')
.backgroundColor(AppColors.surface)
.borderRadius(AppDimensions.radiusMedium)
.padding(AppDimensions.paddingLarge)
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/HomePage.ets#L191-L233
|
2e36ff7f0f204cfcaad6bc82eb006b92a15be666
|
github
|
didi/dimina.git
|
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
|
harmony/dimina/src/main/ets/Utils/DMPStack.ets
|
arkts
|
clear
|
清空栈
|
clear(): void {
this._items = [];
}
|
AST#method_declaration#Left clear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#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 . _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#builder_function_body#Right AST#method_declaration#Right
|
clear(): void {
this._items = [];
}
|
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Utils/DMPStack.ets#L34-L36
|
5e906dbb2a60cf5146dc6edf2d9cf47ec8e8292b
|
github
|
tomorrowKreswell/Ledger.git
|
1f2783ae70b8540d677af8a27f29db1b4089ea69
|
ledger/entry/src/main/ets/common/utils/StatisticalUtils.ets
|
arkts
|
计算特定类型账目在指定日期的月收支统计
|
export function monthStatistics(accounts: Array<Account>, accountType: number, date: Date = new Date()): number {
return accounts
.filter((account) => account.accountType === accountType && isSameMonth(date, account.date))
.map((account) => account.amount)
.reduce((total, cur) => total + cur, 0);
}
|
AST#export_declaration#Left export AST#function_declaration#Left function monthStatistics AST#parameter_list#Left ( AST#parameter#Left accounts : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Account AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left accountType : AST#type_annotation#Left AST#primary_type#Left number 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#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#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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left accounts AST#expression#Right . filter 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 account AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_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 account AST#expression#Right . accountType AST#member_expression#Right AST#expression#Right === AST#expression#Left accountType AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left isSameMonth AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left date AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left account AST#expression#Right . date AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . 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 account AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#member_expression#Left AST#expression#Left account AST#expression#Right . amount AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . reduce AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left total AST#parameter#Right , AST#parameter#Left cur AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#binary_expression#Left AST#expression#Left total AST#expression#Right + AST#expression#Left cur AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function monthStatistics(accounts: Array<Account>, accountType: number, date: Date = new Date()): number {
return accounts
.filter((account) => account.accountType === accountType && isSameMonth(date, account.date))
.map((account) => account.amount)
.reduce((total, cur) => total + cur, 0);
}
|
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/utils/StatisticalUtils.ets#L15-L20
|
13f9237bab04275fabc2dab2d6f32f50d08b92d0
|
github
|
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/StringUtil.ets
|
arkts
|
toStr
|
格式化字符串
@param source
@param defaultValue
@returns
|
static toStr(source: string | null | undefined, defaultValue = ''): string {
if (source === null || source === undefined) {
return defaultValue;
}
return String(source);
}
|
AST#method_declaration#Left static toStr AST#parameter_list#Left ( AST#parameter#Left source : 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#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defaultValue = AST#expression#Left '' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left source AST#expression#Right === AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left source AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left defaultValue AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left String AST#expression#Right AST#argument_list#Left ( AST#expression#Left source 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 toStr(source: string | null | undefined, defaultValue = ''): string {
if (source === null || source === undefined) {
return defaultValue;
}
return String(source);
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/StringUtil.ets#L47-L52
|
3c65368caae26d6a1611dc7fc29817cf307d0ce7
|
github
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineScatterCandleRadarDataSet.ets
|
arkts
|
setDrawHighlightIndicators
|
Enables / disables both vertical and horizontal highlight-indicators.
@param enabled
|
public setDrawHighlightIndicators(enabled: boolean): void {
this.setDrawVerticalHighlightIndicator(enabled);
this.setDrawHorizontalHighlightIndicator(enabled);
}
|
AST#method_declaration#Left public setDrawHighlightIndicators AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setDrawVerticalHighlightIndicator AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left enabled 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 . setDrawHorizontalHighlightIndicator AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left enabled 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 setDrawHighlightIndicators(enabled: boolean): void {
this.setDrawVerticalHighlightIndicator(enabled);
this.setDrawHorizontalHighlightIndicator(enabled);
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineScatterCandleRadarDataSet.ets#L60-L63
|
469b7f0ded23a667dc73e279b2f57d300b881b9f
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/crypto/SM4.ets
|
arkts
|
encryptCBCSync
|
加密(CBC模式),同步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@param ivParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(SM4_128|CBC|PKCS7、SM4_128|CBC|PKCS5、等)
@returns
|
static encryptCBCSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
ivParams: cryptoFramework.IvParamsSpec, transformation: string = 'SM4_128|CBC|PKCS7'): cryptoFramework.DataBlob {
return SM4.encryptSync(data, symKey, ivParams, transformation);
}
|
AST#method_declaration#Left static encryptCBCSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ivParams : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . IvParamsSpec AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left transformation : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SM4_128|CBC|PKCS7' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left SM4 AST#expression#Right . encryptSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left ivParams AST#expression#Right , AST#expression#Left transformation AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static encryptCBCSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
ivParams: cryptoFramework.IvParamsSpec, transformation: string = 'SM4_128|CBC|PKCS7'): cryptoFramework.DataBlob {
return SM4.encryptSync(data, symKey, ivParams, transformation);
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM4.ets#L123-L126
|
38d1dddb4fc65759ea57051db211c8fa0f35a444
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/components/CustomCalendar.ets
|
arkts
|
自定义日历类型:YEAR年视图 MONTH月视图 WEEK周视图
|
export enum CalendarViewType {
YEAR, // 年视图
MONTH, // 月视图
WEEK, // 周视图
}
|
AST#export_declaration#Left export AST#enum_declaration#Left enum CalendarViewType AST#enum_body#Left { AST#enum_member#Left YEAR AST#enum_member#Right , // 年视图 AST#enum_member#Left MONTH AST#enum_member#Right , // 月视图 AST#enum_member#Left WEEK AST#enum_member#Right , // 周视图 } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
|
export enum CalendarViewType {
YEAR,
MONTH,
WEEK,
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/components/CustomCalendar.ets#L257-L261
|
838417cb9e00ceb2cc1a18c54c46dda18dffe1df
|
gitee
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/mainpage/WebPage.ets
|
arkts
|
snapShot
|
截图函数。
|
async snapShot() {
// 获取Web页面尺寸
this.getWebSize();
// 截图前的状态初始化
await this.beforeSnapshot();
// TODO: 性能知识点: 使用Canvas离屏绘制在缓冲区拼接截图
const canvasSetting: RenderingContextSettings = new RenderingContextSettings(true);
const offCanvasCtx: OffscreenCanvasRenderingContext2D =
new OffscreenCanvasRenderingContext2D(this.h5Width, this.h5Height, canvasSetting);
// 前置常量
const snipTimes = Math.ceil(this.h5Height / this.webHeight);
logger.info(TAG, `Need to snapshot ${snipTimes} times.`);
const lastTime = snipTimes - 1;
const leftoverHeight = this.h5Height % this.webHeight;
let cropLeftover: image.Region = { x: 0, y: 0, size: { height: 0, width: 0 } }
if (this.WebTouchBottom) {
// 这里要分两种情况,1.滚动到底部时,裁剪应该取最后一张除去重复部分以外的底部
cropLeftover = {
x: 0,
y: vp2px(this.webHeight - leftoverHeight),
size: {
height: vp2px(leftoverHeight),
width: vp2px(this.webWidth)
}
};
} else {
// 2.未滚动到底部时,裁剪应该取最后一张leftoverHeight的上部分
cropLeftover = {
x: 0,
y: 0,
size: {
height: vp2px(leftoverHeight),
width: vp2px(this.webWidth)
}
};
}
// 开始截图
for (let i = 0; i < snipTimes; i++) {
const curSnip = await componentSnapshot.get(Constants.WEB_ID);
// 最后一次截图需要特殊处理,去除重复部分
if (i === lastTime) {
logger.info(TAG, `The last snapshot image height ${leftoverHeight}`);
await curSnip.crop(cropLeftover);
offCanvasCtx.drawImage(curSnip, 0, this.webHeight * i, this.webWidth, leftoverHeight);
} else {
offCanvasCtx.drawImage(curSnip, 0, this.webHeight * i, this.webWidth, this.webHeight);
}
// debug使用,否则影响性能
logger.debug(TAG, `Screenshot ${i}: ${JSON.stringify(await curSnip.getImageInfo())}`);
// 继续滚动
this.webviewController.scrollBy(0, this.webHeight);
// 延时保证滚动完成
await sleep(Constants.SCROLL_DURATION);
}
// 截图后的操作
await this.afterSnapshot();
// 获取pixelMap
this.mergedImage = offCanvasCtx.getPixelMap(0, 0, this.h5Width, this.h5Height);
// 拼接之后修改可动画变量
this.afterGeneratorImage();
}
|
AST#method_declaration#Left async snapShot AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 获取Web页面尺寸 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 . getWebSize 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 AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . beforeSnapshot 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 // TODO: 性能知识点: 使用Canvas离屏绘制在缓冲区拼接截图 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left canvasSetting : AST#type_annotation#Left AST#primary_type#Left RenderingContextSettings AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left RenderingContextSettings AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left offCanvasCtx : AST#type_annotation#Left AST#primary_type#Left OffscreenCanvasRenderingContext2D 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 OffscreenCanvasRenderingContext2D 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 . h5Width AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . h5Height AST#member_expression#Right AST#expression#Right , AST#expression#Left canvasSetting 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 snipTimes = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . ceil AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . h5Height AST#member_expression#Right AST#expression#Right / AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . webHeight AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Need to snapshot AST#template_substitution#Left $ { AST#expression#Left snipTimes AST#expression#Right } AST#template_substitution#Right times. ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left lastTime = AST#expression#Left AST#binary_expression#Left AST#expression#Left snipTimes AST#expression#Right - AST#expression#Left 1 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 leftoverHeight = 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 . h5Height AST#member_expression#Right AST#expression#Right % AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . webHeight 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 cropLeftover : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . Region AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 0 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . WebTouchBottom AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 这里要分两种情况,1.滚动到底部时,裁剪应该取最后一张除去重复部分以外的底部 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left cropLeftover = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left vp2px 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 . webHeight AST#member_expression#Right AST#expression#Right - AST#expression#Left leftoverHeight AST#expression#Right AST#binary_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 size AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left vp2px AST#expression#Right AST#argument_list#Left ( AST#expression#Left leftoverHeight 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 width AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left vp2px AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webWidth AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { // 2.未滚动到底部时,裁剪应该取最后一张leftoverHeight的上部分 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left cropLeftover = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left vp2px AST#expression#Right AST#argument_list#Left ( AST#expression#Left leftoverHeight 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 width AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left vp2px AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webWidth AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 开始截图 AST#statement#Left AST#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 snipTimes 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 const AST#variable_declarator#Left curSnip = 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 componentSnapshot AST#expression#Right AST#await_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . WEB_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 AST#binary_expression#Left AST#expression#Left i AST#expression#Right === AST#expression#Left lastTime 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 logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` The last snapshot image height AST#template_substitution#Left $ { AST#expression#Left leftoverHeight AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left curSnip AST#expression#Right AST#await_expression#Right AST#expression#Right . crop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left cropLeftover 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 offCanvasCtx AST#expression#Right . drawImage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left curSnip 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 this AST#expression#Right . webHeight AST#member_expression#Right AST#expression#Right * AST#expression#Left i AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webWidth AST#member_expression#Right AST#expression#Right , AST#expression#Left leftoverHeight 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 offCanvasCtx AST#expression#Right . drawImage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left curSnip 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 this AST#expression#Right . webHeight AST#member_expression#Right AST#expression#Right * AST#expression#Left i AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webWidth AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webHeight 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 // debug使用,否则影响性能 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 TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Screenshot AST#template_substitution#Left $ { AST#expression#Left i 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 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 AST#await_expression#Left await AST#expression#Left curSnip AST#expression#Right AST#await_expression#Right AST#expression#Right . getImageInfo 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#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 继续滚动 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webviewController AST#member_expression#Right AST#expression#Right . scrollBy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webHeight AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 延时保证滚动完成 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left sleep AST#expression#Right AST#await_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . SCROLL_DURATION AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right // 截图后的操作 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . afterSnapshot 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 // 获取pixelMap 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 . mergedImage AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left offCanvasCtx AST#expression#Right . getPixelMap AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . h5Width AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . h5Height 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 this AST#expression#Right . afterGeneratorImage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async snapShot() {
this.getWebSize();
await this.beforeSnapshot();
const canvasSetting: RenderingContextSettings = new RenderingContextSettings(true);
const offCanvasCtx: OffscreenCanvasRenderingContext2D =
new OffscreenCanvasRenderingContext2D(this.h5Width, this.h5Height, canvasSetting);
const snipTimes = Math.ceil(this.h5Height / this.webHeight);
logger.info(TAG, `Need to snapshot ${snipTimes} times.`);
const lastTime = snipTimes - 1;
const leftoverHeight = this.h5Height % this.webHeight;
let cropLeftover: image.Region = { x: 0, y: 0, size: { height: 0, width: 0 } }
if (this.WebTouchBottom) {
cropLeftover = {
x: 0,
y: vp2px(this.webHeight - leftoverHeight),
size: {
height: vp2px(leftoverHeight),
width: vp2px(this.webWidth)
}
};
} else {
cropLeftover = {
x: 0,
y: 0,
size: {
height: vp2px(leftoverHeight),
width: vp2px(this.webWidth)
}
};
}
for (let i = 0; i < snipTimes; i++) {
const curSnip = await componentSnapshot.get(Constants.WEB_ID);
if (i === lastTime) {
logger.info(TAG, `The last snapshot image height ${leftoverHeight}`);
await curSnip.crop(cropLeftover);
offCanvasCtx.drawImage(curSnip, 0, this.webHeight * i, this.webWidth, leftoverHeight);
} else {
offCanvasCtx.drawImage(curSnip, 0, this.webHeight * i, this.webWidth, this.webHeight);
}
logger.debug(TAG, `Screenshot ${i}: ${JSON.stringify(await curSnip.getImageInfo())}`);
this.webviewController.scrollBy(0, this.webHeight);
await sleep(Constants.SCROLL_DURATION);
}
await this.afterSnapshot();
this.mergedImage = offCanvasCtx.getPixelMap(0, 0, this.h5Width, this.h5Height);
this.afterGeneratorImage();
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/mainpage/WebPage.ets#L198-L259
|
520fe065b6b31793470eb10278df4cbcebaaffbd
|
gitee
|
htliang128/arkts_oss.git
|
9da4a87c36272873c649f556854bd793ac337a18
|
htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets
|
arkts
|
getCertificatePinning
|
Getter and setter for certificatePinning
|
getCertificatePinning(): http.CertificatePinning | http.CertificatePinning[] | undefined {
return this.certificatePinning;
}
|
AST#method_declaration#Left getCertificatePinning AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left http . CertificatePinning AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left http . CertificatePinning AST#qualified_type#Right AST#primary_type#Right AST#ERROR#Left [ ] AST#ERROR#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#member_expression#Left AST#expression#Left this AST#expression#Right . certificatePinning AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getCertificatePinning(): http.CertificatePinning | http.CertificatePinning[] | undefined {
return this.certificatePinning;
}
|
https://github.com/htliang128/arkts_oss.git/blob/9da4a87c36272873c649f556854bd793ac337a18/htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets#L191-L193
|
b60c7890f3244190a29799b4e88d4499e3cd6320
|
github
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
JSCrash/entry/src/main/ets/pages/utils.ets
|
arkts
|
showError
|
Outputs error-level logs.
@param tag Identifies the log tag.
@param format Indicates the log format string.
@param args Indicates the log parameters.
@since 7
|
static showError(tag: string): void {
if (Log.isLoggable(tag, hilog.LogLevel.ERROR)) {
hilog.error(DOMAIN, TAG, tag + SYMBOL);
}
}
|
AST#method_declaration#Left static showError AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#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 Log AST#expression#Right . isLoggable AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tag AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . LogLevel AST#member_expression#Right AST#expression#Right . ERROR 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#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 DOMAIN AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left tag AST#expression#Right + AST#expression#Left SYMBOL 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#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
static showError(tag: string): void {
if (Log.isLoggable(tag, hilog.LogLevel.ERROR)) {
hilog.error(DOMAIN, TAG, tag + SYMBOL);
}
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/JSCrash/entry/src/main/ets/pages/utils.ets#L64-L68
|
8ce2cf927c641a4accc16c9b27fcda246db738a3
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/imagemosaic/Index.ets
|
arkts
|
ImageMosaicViewComponent
|
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 { ImageMosaicViewComponent } from './src/main/ets/view/ImageMosaicView';
|
AST#export_declaration#Left export { ImageMosaicViewComponent } from './src/main/ets/view/ImageMosaicView' ; AST#export_declaration#Right
|
export { ImageMosaicViewComponent } from './src/main/ets/view/ImageMosaicView';
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagemosaic/Index.ets#L16-L16
|
700cebd105397529033d0fafce04a9b3486d77ca
|
gitee
|
zqaini002/YaoYaoLingXian.git
|
5095b12cbeea524a87c42d0824b1702978843d39
|
YaoYaoLingXian/entry/src/main/ets/utils/StorageUtils.ets
|
arkts
|
init
|
初始化存储
|
public async init() {
try {
if (!this.preferences) {
const context = getContext();
this.preferences = await dataPreferences.getPreferences(context, PREFERENCES_NAME);
console.info('存储初始化成功');
}
} catch (error) {
console.error('存储初始化失败:', error);
throw new Error('存储初始化失败');
}
}
|
AST#method_declaration#Left public async init AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#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 . preferences AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left context = 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#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 . preferences AST#member_expression#Right = 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 dataPreferences AST#expression#Right AST#await_expression#Right AST#expression#Right . getPreferences AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left PREFERENCES_NAME 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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '存储初始化成功' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '存储初始化失败:' 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#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#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public async init() {
try {
if (!this.preferences) {
const context = getContext();
this.preferences = await dataPreferences.getPreferences(context, PREFERENCES_NAME);
console.info('存储初始化成功');
}
} catch (error) {
console.error('存储初始化失败:', error);
throw new Error('存储初始化失败');
}
}
|
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/StorageUtils.ets#L13-L24
|
d3c596d376bd5687e5a4311ee2670564b34dd2ed
|
github
|
OHPG/FinVideo.git
|
2b288396af5b2a20a24575faa317b46214965391
|
entry/src/main/ets/data/Repository.ets
|
arkts
|
getMovie
|
获取电影信息
@param id 电影id
@returns
|
public getMovie(id: string): Promise<FinItem> {
return this.requireApi().getMovie(id)
}
|
AST#method_declaration#Left public getMovie AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left FinItem AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . requireApi AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getMovie AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left id AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public getMovie(id: string): Promise<FinItem> {
return this.requireApi().getMovie(id)
}
|
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/data/Repository.ets#L79-L81
|
3d2e5069b212b9bc5ff561b39a266405c2b1ec5d
|
github
|
liuchao0739/arkTS_universal_starter.git
|
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
|
entry/src/main/ets/core/storage/StorageManager.ets
|
arkts
|
setStringWithExpire
|
设置带过期时间的值
|
static async setStringWithExpire(key: string, value: string, expireDays: number): Promise<void> {
await StorageManager.setString(key, value);
const expireTime = Date.now() + expireDays * 24 * 60 * 60 * 1000;
await StorageManager.setNumber(`${key}_timestamp`, expireTime);
}
|
AST#method_declaration#Left static async setStringWithExpire AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left expireDays : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#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 StorageManager AST#expression#Right AST#await_expression#Right AST#expression#Right . setString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left value AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left expireTime = 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 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 expireDays AST#expression#Right * AST#expression#Left 24 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left 60 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left 60 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left 1000 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#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 StorageManager AST#expression#Right AST#await_expression#Right AST#expression#Right . setNumber 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 key AST#expression#Right } AST#template_substitution#Right _timestamp ` AST#template_literal#Right AST#expression#Right , AST#expression#Left expireTime 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
|
static async setStringWithExpire(key: string, value: string, expireDays: number): Promise<void> {
await StorageManager.setString(key, value);
const expireTime = Date.now() + expireDays * 24 * 60 * 60 * 1000;
await StorageManager.setNumber(`${key}_timestamp`, expireTime);
}
|
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/storage/StorageManager.ets#L274-L278
|
95ab8fd6498ace958960bc34cad17bbd8ab0c7c3
|
github
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/datas/basedict/utils/BaseWordUtility.ets
|
arkts
|
getFirstPartFromText
|
从指定的中文翻译中获取第一个分号前的部分(包含词性.意思,如: n.食物)
|
static getFirstPartFromText(srcText: string): string {
let strComma = BaseWordUtility.STR_COMMA_HALF;
let strComma2 = BaseWordUtility.STR_COMMA_FULL;
let strCommaSub = BaseWordUtility.STR_COMMA_SUB_HALF;
let strCommaSub2 = BaseWordUtility.STR_COMMA_SUB_FULL;
let str = srcText;
const indexNoFound = -1;
// (1) 首先按换行符分割出第一行
let index = str.indexOf("\n");
if (index !== indexNoFound) {
str = str.substring(0, index);
}
// (2) 查找第二个间隔符之前的部分
index = str.indexOf(strComma, str.indexOf(strComma) + 1);
if (index !== indexNoFound) {
str = str.substring(0, index);
} else {
index = str.indexOf(strComma2, str.indexOf(strComma2) + 1);
if (index !== indexNoFound) {
str = str.substring(0, index);
}
}
// (3) 若太长了,则只查找第一个间隔符之前的部分
let strLength = BaseWordUtility.getLengthOfStringWithoutKind(str);
if (strLength > 11) {
index = str.indexOf(strComma);
if (index !== indexNoFound) {
str = str.substring(0, index);
} else {
index = str.indexOf(strComma2);
if (index !== indexNoFound) {
str = str.substring(0, index);
}
}
}
///////////////////////////////////////////////
// 再次用 逗号检查
strLength = BaseWordUtility.getLengthOfStringWithoutKind(str);
if (strLength > 13) {
// (4) 查找第二个 子间隔符 之前的部分
index = str.indexOf(strCommaSub2, str.indexOf(strCommaSub2) + 1);
if (index !== indexNoFound) {
str = str.substring(0, index);
} else {
index = str.indexOf(strCommaSub, str.indexOf(strCommaSub) + 1);
if (index !== indexNoFound) {
str = str.substring(0, index);
}
}
}
// (5) 若太长了,则只查找第一个 子间隔符 之前的部分
strLength = BaseWordUtility.getLengthOfStringWithoutKind(str);
if (strLength > 13) {
index = str.indexOf(strCommaSub2);
if (index !== indexNoFound) {
str = str.substring(0, index);
} else {
index = str.indexOf(strCommaSub);
if (index !== indexNoFound) {
str = str.substring(0, index);
}
}
}
///////////////////////////////////////////////
return str;
}
|
AST#method_declaration#Left static getFirstPartFromText AST#parameter_list#Left ( AST#parameter#Left srcText : 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 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 strComma = AST#expression#Left AST#member_expression#Left AST#expression#Left BaseWordUtility AST#expression#Right . STR_COMMA_HALF 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 strComma2 = AST#expression#Left AST#member_expression#Left AST#expression#Left BaseWordUtility AST#expression#Right . STR_COMMA_FULL 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 strCommaSub = AST#expression#Left AST#member_expression#Left AST#expression#Left BaseWordUtility AST#expression#Right . STR_COMMA_SUB_HALF 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 strCommaSub2 = AST#expression#Left AST#member_expression#Left AST#expression#Left BaseWordUtility AST#expression#Right . STR_COMMA_SUB_FULL 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 str = AST#expression#Left srcText 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 indexNoFound = AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // (1) 首先按换行符分割出第一行 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left index = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "\n" 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 index AST#expression#Right !== AST#expression#Left indexNoFound 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 str = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left index 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 // (2) 查找第二个间隔符之前的部分 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left index = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strComma 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 str AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strComma AST#expression#Right ) 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#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right !== AST#expression#Left indexNoFound 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 str = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left index = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strComma2 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 str AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strComma2 AST#expression#Right ) 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#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right !== AST#expression#Left indexNoFound 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 str = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left index 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#if_statement#Right AST#statement#Right // (3) 若太长了,则只查找第一个间隔符之前的部分 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left strLength = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left BaseWordUtility AST#expression#Right . getLengthOfStringWithoutKind AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str 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 strLength AST#expression#Right > AST#expression#Left 11 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 index = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strComma AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right !== AST#expression#Left indexNoFound 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 str = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left index = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strComma2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right !== AST#expression#Left indexNoFound 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 str = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left index 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#if_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 strLength = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left BaseWordUtility AST#expression#Right . getLengthOfStringWithoutKind AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left strLength AST#expression#Right > AST#expression#Left 13 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // (4) 查找第二个 子间隔符 之前的部分 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left index = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strCommaSub2 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 str AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strCommaSub2 AST#expression#Right ) 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#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right !== AST#expression#Left indexNoFound 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 str = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left index = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strCommaSub 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 str AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strCommaSub AST#expression#Right ) 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#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right !== AST#expression#Left indexNoFound 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 str = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left index 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // (5) 若太长了,则只查找第一个 子间隔符 之前的部分 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left strLength = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left BaseWordUtility AST#expression#Right . getLengthOfStringWithoutKind AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left strLength AST#expression#Right > AST#expression#Left 13 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 index = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strCommaSub2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right !== AST#expression#Left indexNoFound 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 str = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left index = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strCommaSub AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right !== AST#expression#Left indexNoFound 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 str = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left index 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#if_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 str AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getFirstPartFromText(srcText: string): string {
let strComma = BaseWordUtility.STR_COMMA_HALF;
let strComma2 = BaseWordUtility.STR_COMMA_FULL;
let strCommaSub = BaseWordUtility.STR_COMMA_SUB_HALF;
let strCommaSub2 = BaseWordUtility.STR_COMMA_SUB_FULL;
let str = srcText;
const indexNoFound = -1;
let index = str.indexOf("\n");
if (index !== indexNoFound) {
str = str.substring(0, index);
}
index = str.indexOf(strComma, str.indexOf(strComma) + 1);
if (index !== indexNoFound) {
str = str.substring(0, index);
} else {
index = str.indexOf(strComma2, str.indexOf(strComma2) + 1);
if (index !== indexNoFound) {
str = str.substring(0, index);
}
}
let strLength = BaseWordUtility.getLengthOfStringWithoutKind(str);
if (strLength > 11) {
index = str.indexOf(strComma);
if (index !== indexNoFound) {
str = str.substring(0, index);
} else {
index = str.indexOf(strComma2);
if (index !== indexNoFound) {
str = str.substring(0, index);
}
}
}
strLength = BaseWordUtility.getLengthOfStringWithoutKind(str);
if (strLength > 13) {
index = str.indexOf(strCommaSub2, str.indexOf(strCommaSub2) + 1);
if (index !== indexNoFound) {
str = str.substring(0, index);
} else {
index = str.indexOf(strCommaSub, str.indexOf(strCommaSub) + 1);
if (index !== indexNoFound) {
str = str.substring(0, index);
}
}
}
strLength = BaseWordUtility.getLengthOfStringWithoutKind(str);
if (strLength > 13) {
index = str.indexOf(strCommaSub2);
if (index !== indexNoFound) {
str = str.substring(0, index);
} else {
index = str.indexOf(strCommaSub);
if (index !== indexNoFound) {
str = str.substring(0, index);
}
}
}
return str;
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/basedict/utils/BaseWordUtility.ets#L41-L113
|
101f5d73ec324165d7434bc0cb74d597cce7709d
|
github
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets
|
arkts
|
animateXY
|
Animates values along both the X and Y axes, in a linear fashion.
@param durationMillisX animation duration along the X axis
@param durationMillisY animation duration along the Y axis
|
public animateXY(durationMillisX: number, durationMillisY: number) {
animateXY(durationMillisX, durationMillisY, Easing.Linear, Easing.Linear);
}
|
AST#method_declaration#Left public animateXY AST#parameter_list#Left ( AST#parameter#Left durationMillisX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left durationMillisY : 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#ui_custom_component_statement#Left animateXY ( AST#expression#Left durationMillisX AST#expression#Right , AST#expression#Left durationMillisY AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left Easing AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left Easing AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public animateXY(durationMillisX: number, durationMillisY: number) {
animateXY(durationMillisX, durationMillisY, Easing.Linear, Easing.Linear);
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets#L74-L76
|
996cc61156c889cc89e95e171fe2bd0ed305d5cc
|
gitee
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
api/@ohos.deviceInfo.d.ets
|
arkts
|
get
|
Obtains the build time.
@syscap SystemCapability.Startup.SystemInfo
@crossplatform
@since 20
@arkts 1.2
|
static get buildTime(): string;
|
AST#method_declaration#Left static get AST#ERROR#Left build Time 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 buildTime(): string;
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L360-L360
|
3701ba75de54fc7c33b7b7f2265c4c8d8c24208a
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/notification/NotificationManager.ets
|
arkts
|
performPeriodicTasks
|
执行定期任务
|
private async performPeriodicTasks(): Promise<void> {
try {
// 清理过期的智能建议
this.cleanExpiredSuggestions();
// 生成新的智能建议
await this.generateSmartSuggestions();
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION,
`Failed to perform periodic tasks: ${error}`);
}
}
|
AST#method_declaration#Left private async performPeriodicTasks AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 清理过期的智能建议 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cleanExpiredSuggestions 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 AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . generateSmartSuggestions 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#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_NOTIFICATION AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to perform periodic tasks: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private async performPeriodicTasks(): Promise<void> {
try {
this.cleanExpiredSuggestions();
await this.generateSmartSuggestions();
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION,
`Failed to perform periodic tasks: ${error}`);
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationManager.ets#L519-L531
|
798ee387a5af3f83eb63a84718908216af7c5102
|
github
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
PowerAnalysis/LowerPowerSample/entry/src/main/ets/pages/buffer_power_example.ets
|
arkts
|
MyVideoComponent
|
[End buffer_power_case_1] [Start buffer_power_case_2]
|
@Component
export struct MyVideoComponent {
@State videoSrc: Resource | string = $r('app.media.test_video');
private controller: VideoController = new VideoController();
build() {
Column() {
Video({
src: this.videoSrc,
controller: this.controller,
})
.width(300)
.height(200)
.onPrepared(() => {
this.controller.start();
})
// 确保视频组件完全可见时播放,完全不可见时停止
.onVisibleAreaChange([0.0], (isExpanding: boolean, currentRatio: number) => {
if (isExpanding && currentRatio >= 1.0) {
console.info('Component is completely visiable.');
if (this.controller) {
this.controller.start();
}
}
if (!isExpanding && currentRatio <= 0.0) {
console.info('Component is completely invisible.');
if (this.controller) {
this.controller.pause();
}
}
})
}
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MyVideoComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right videoSrc : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.test_video' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private controller : AST#type_annotation#Left AST#primary_type#Left VideoController 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 VideoController AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Video ( AST#component_parameters#Left { AST#component_parameter#Left src : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . videoSrc AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left controller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 300 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 200 AST#expression#Right ) AST#modifier_chain_expression#Left . onPrepared ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right . 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#block_statement#Right AST#arrow_function#Right AST#expression#Right ) // 确保视频组件完全可见时播放,完全不可见时停止 AST#modifier_chain_expression#Left . onVisibleAreaChange ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0.0 AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left isExpanding : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left currentRatio : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left isExpanding AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left currentRatio AST#expression#Right >= AST#expression#Left 1.0 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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Component is completely visiable.' 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 this AST#expression#Right . controller 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#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left isExpanding AST#expression#Right AST#unary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left currentRatio AST#expression#Right <= AST#expression#Left 0.0 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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Component is completely invisible.' 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 this AST#expression#Right . controller 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 . 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#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct MyVideoComponent {
@State videoSrc: Resource | string = $r('app.media.test_video');
private controller: VideoController = new VideoController();
build() {
Column() {
Video({
src: this.videoSrc,
controller: this.controller,
})
.width(300)
.height(200)
.onPrepared(() => {
this.controller.start();
})
.onVisibleAreaChange([0.0], (isExpanding: boolean, currentRatio: number) => {
if (isExpanding && currentRatio >= 1.0) {
console.info('Component is completely visiable.');
if (this.controller) {
this.controller.start();
}
}
if (!isExpanding && currentRatio <= 0.0) {
console.info('Component is completely invisible.');
if (this.controller) {
this.controller.pause();
}
}
})
}
}
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/PowerAnalysis/LowerPowerSample/entry/src/main/ets/pages/buffer_power_example.ets#L49-L84
|
f0edcce84161bf395e627edb89c571d653507fd7
|
gitee
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/data/src/main/ets/repository/OrderCacheStoreRepository.ets
|
arkts
|
loadCarts
|
读取选中的购物车项
@returns {Promise<Cart[] | null>} 购物车列表,不存在返回 null
|
loadCarts(): Promise<Cart[] | null> {
return this.dataSource.getCarts();
}
|
AST#method_declaration#Left loadCarts 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#union_type#Left AST#primary_type#Left AST#array_type#Left Cart [ ] AST#array_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right . getCarts 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
|
loadCarts(): Promise<Cart[] | null> {
return this.dataSource.getCarts();
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/OrderCacheStoreRepository.ets#L39-L41
|
b7a0f1d5deb26e703facf459e328ce260105f117
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/utils/BuilderNodePool.ets
|
arkts
|
makeNode
|
创建节点
|
makeNode(uiContext: UIContext): FrameNode | null {
if (!this.node) {
this.node = new BuilderNode(uiContext);
this.node.build(this.builder, this.data);
} else {
this.update(this.data);
}
return this.node.getFrameNode();
}
|
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#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#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . node 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 . node 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#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 . node AST#member_expression#Right AST#expression#Right . build 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 . builder AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . data AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . update 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 . data 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 return 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 . node 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#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
makeNode(uiContext: UIContext): FrameNode | null {
if (!this.node) {
this.node = new BuilderNode(uiContext);
this.node.build(this.builder, this.data);
} else {
this.update(this.data);
}
return this.node.getFrameNode();
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/utils/BuilderNodePool.ets#L41-L49
|
89beaa11a01c6114423e1765bba83eb74189d03b
|
gitee
|
zqaini002/YaoYaoLingXian.git
|
5095b12cbeea524a87c42d0824b1702978843d39
|
YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets
|
arkts
|
获取用户今日任务
@param userId 用户ID
@param page 页码
@param size 每页大小
@returns 今日任务列表
|
export function getTodayTasks(userId: number, page: number = 0, size: number = 5): Promise<PageResponse<Task>> {
const params: TaskQueryParams = { page, size };
try {
return request<PageResponse<Task>>(
RequestMethod.GET,
`/tasks/user/${userId}/today`,
params
);
} catch (error) {
console.error(`获取今日任务列表失败: ${error instanceof Error ? error.message : String(error)}`);
throw new Error(`获取今日任务列表失败: ${error instanceof Error ? error.message : String(error)}`);
}
}
|
AST#export_declaration#Left export AST#function_declaration#Left function getTodayTasks AST#parameter_list#Left ( AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left page : 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#Left size : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 5 AST#expression#Right AST#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 PageResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Task 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 params : AST#type_annotation#Left AST#primary_type#Left TaskQueryParams AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left page AST#property_assignment#Right , AST#property_assignment#Left size 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left request AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left PageResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Task 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#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left RequestMethod AST#expression#Right . GET AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` /tasks/user/ AST#template_substitution#Left $ { AST#expression#Left userId AST#expression#Right } AST#template_substitution#Right /today ` AST#template_literal#Right AST#expression#Right , AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 获取今日任务列表失败: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left error AST#expression#Right instanceof AST#expression#Left Error AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right : AST#expression#Left String AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 获取今日任务列表失败: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left error AST#expression#Right instanceof AST#expression#Left Error AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right : AST#expression#Left String AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function getTodayTasks(userId: number, page: number = 0, size: number = 5): Promise<PageResponse<Task>> {
const params: TaskQueryParams = { page, size };
try {
return request<PageResponse<Task>>(
RequestMethod.GET,
`/tasks/user/${userId}/today`,
params
);
} catch (error) {
console.error(`获取今日任务列表失败: ${error instanceof Error ? error.message : String(error)}`);
throw new Error(`获取今日任务列表失败: ${error instanceof Error ? error.message : String(error)}`);
}
}
|
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets#L77-L89
|
0d43e23f42edff68bef76647f6f0ecc68d117034
|
github
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/palette/src/main/ets/model/RenderNodeModel.ets
|
arkts
|
makeNode
|
从NodeController根节点获取的RenderNode,用于添加和删除新创建的MyRenderNode实例 MyNodeController实例绑定的NodeContainer创建时触发,创建根节点rootNode并将其挂载至NodeContainer
|
makeNode(uiContext: UIContext): FrameNode {
this.rootNode = new FrameNode(uiContext);
if (this.rootNode !== null) {
this.rootRenderNode = this.rootNode.getRenderNode();
}
return this.rootNode;
}
|
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#primary_type#Left FrameNode 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 . rootNode 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#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 . 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rootRenderNode 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 . rootNode AST#member_expression#Right AST#expression#Right . getRenderNode 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#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rootNode AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
makeNode(uiContext: UIContext): FrameNode {
this.rootNode = new FrameNode(uiContext);
if (this.rootNode !== null) {
this.rootRenderNode = this.rootNode.getRenderNode();
}
return this.rootNode;
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/palette/src/main/ets/model/RenderNodeModel.ets#L65-L71
|
36a7b592ddb9ea1154ed7b19d9b95b17bcb7c999
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/SuperFeature/DistributedAppDev/ArkTSDistributedCalc/entry/src/main/ets/model/ImageList.ets
|
arkts
|
Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export class ImageList {
image: Resource
value: string
constructor
|
AST#export_declaration#Left export AST#ERROR#Left class ImageList { image : Resource value : string AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right
|
export class ImageList {
image: Resource
value: string
constructor
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/DistributedAppDev/ArkTSDistributedCalc/entry/src/main/ets/model/ImageList.ets#L15-L19
|
f2240c5c0260e7e101865e7194aaf4963397d317
|
gitee
|
|
L1rics06/arkTS-.git
|
991fd131bfdb11e2933152133c97453d86092ac0
|
entry/src/main/ets/pages/titileComponent.ets
|
arkts
|
CustomTitle
|
自定义标题栏组件(移除了@Entry)
|
@Entry
@Component
export struct CustomTitle {
@Prop title: string = '默认标题';
@Prop showBack: boolean = true;
build() {
Row() {
if (this.showBack) {
// 使用系统图标代替自定义图标
Image($r('app.media.back'))
.width(24)
.height(24)
.margin({ left: 16 })
.onClick(() => {
router.back();
})
}
Text(this.title)
.fontSize(20)
.fontWeight(FontWeight.Bold)
.margin({ left: this.showBack ? 16 : 32 })
.textAlign(TextAlign.Center)
.flexGrow(1)
}
.width('100%')
.height(48)
.alignItems(VerticalAlign.Center)
.backgroundColor('#FFFFFF')
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct CustomTitle AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right title : 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 @ Prop AST#decorator#Right showBack : 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#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showBack 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.back' 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 . margin ( 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#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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#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 Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . title AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . 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#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showBack AST#member_expression#Right AST#expression#Right ? AST#expression#Left 16 AST#expression#Right : AST#expression#Left 32 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . 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 . flexGrow ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 48 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 '#FFFFFF' 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
|
@Entry
@Component
export struct CustomTitle {
@Prop title: string = '默认标题';
@Prop showBack: boolean = true;
build() {
Row() {
if (this.showBack) {
Image($r('app.media.back'))
.width(24)
.height(24)
.margin({ left: 16 })
.onClick(() => {
router.back();
})
}
Text(this.title)
.fontSize(20)
.fontWeight(FontWeight.Bold)
.margin({ left: this.showBack ? 16 : 32 })
.textAlign(TextAlign.Center)
.flexGrow(1)
}
.width('100%')
.height(48)
.alignItems(VerticalAlign.Center)
.backgroundColor('#FFFFFF')
}
}
|
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/titileComponent.ets#L4-L35
|
acd71274bba572f8bbd4eb83f48235bfe3294b14
|
github
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
api/@ohos.atomicservice.AtomicServiceNavigation.d.ets
|
arkts
|
Indicates the options of Navigation's gradientBackground.
@typedef GradientBackground
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 18
|
export interface GradientBackground {
/**
* the primaryColor of Background.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
primaryColor: ResourceColor;
/**
* the secondaryColor of Background.
*
* @type { ?ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
secondaryColor?: ResourceColor;
/**
* the theme color of Background.
*
* @type { ?BackgroundTheme }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
backgroundTheme?: BackgroundTheme;
/**
* the blend mode of background color.
*
* @type { ?MixMode }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
mixMode?: MixMode;
/**
* the opacity of background colors.
*
* @type { ?GradientAlpha }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
alpha?: GradientAlpha;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface GradientBackground AST#object_type#Left { /**
* the primaryColor of Background.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/ AST#type_member#Left primaryColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* the secondaryColor of Background.
*
* @type { ?ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/ AST#type_member#Left secondaryColor ? : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* the theme color of Background.
*
* @type { ?BackgroundTheme }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/ AST#type_member#Left backgroundTheme ? : AST#type_annotation#Left AST#primary_type#Left BackgroundTheme AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* the blend mode of background color.
*
* @type { ?MixMode }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/ AST#type_member#Left mixMode ? : AST#type_annotation#Left AST#primary_type#Left MixMode AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* the opacity of background colors.
*
* @type { ?GradientAlpha }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/ AST#type_member#Left alpha ? : AST#type_annotation#Left AST#primary_type#Left GradientAlpha 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 GradientBackground {
primaryColor: ResourceColor;
secondaryColor?: ResourceColor;
backgroundTheme?: BackgroundTheme;
mixMode?: MixMode;
alpha?: GradientAlpha;
}
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceNavigation.d.ets#L382-L432
|
14584f08e6ef88bd66029431327cc712fdbb1fd2
|
gitee
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/videocreategif/src/main/ets/components/SelectGifTimeFrameView.ets
|
arkts
|
SelectGifTimeFrameView
|
选取生成gif时间片段页面
|
@Component
export struct SelectGifTimeFrameView {
@State promptText: string = '';
@State ratio: number = 1.0;
@Prop @Watch("watchPlayEvent") playEvent: number = 0;
@State mVideoThumbOption: VideoThumbOption = {
videoThumbs: [],
videoThumbWidth: 0
};
@State progress: number = 0;
private seekBarWidth: number = 0; // 选取gif时间段组件的宽度
private seekBarHeight: number = 0; // 选取gif时间段组件的高度
private avPlayer?: media.AVPlayer;
private surfaceId: string = '';
private xComponentController: XComponentController = new XComponentController();
private isCreate: boolean = false; // 视频播放器是否被创建
/************************ 必传参数 *********************************/
private srcFilePath: string = ''; // 视频文件路径
private maxTime: number = 10; // 最大时间间隔,单位秒
private minTime: number = 5; // 最小时间间隔,单位秒
private startTime: number = 0; // 开始时间,单位毫秒
private endTime: number = 0; // 结束时间,单位毫秒
private currentStartTime: number = 0; // 当前选取的开始时间,单位毫秒
private currentEndTime: number = 0; // 当前选取的结束时间,单位毫秒
private videoWidth: number = 1; // 视频宽度
private videoHeight: number = 1; // 视频高度
private thumbWidth: number = 12; // 拖动bar宽度
private back?: () => void; // 按返回按钮的处理
private startCreateGif?: (startTime: number, endTime: number, src: string) => void; // 创建gif的处理
/*******************************************************************/
private videoThumbCount: number = 0; // 视频小图数量
private startTruncationTime: number = 0; // 截取gif的起始时间
private endTruncationTime: number = 0; // 截断gif的结束时间
private rangeSeekBarListener: RangeSeekBarListener = {
onRangeSeekBarValuesChanged: (minValue: number, maxValue: number): void => {
// 截取时间段设置
this.startTruncationTime = Math.floor(minValue);
this.endTruncationTime = Math.floor(maxValue);
let duration = Math.floor((this.endTruncationTime - this.startTruncationTime) / 1000);
this.promptText = getContext(this).resourceManager.getStringSync($r('app.string.video_create_gif_select_prompt').id, `${duration}`, `${this.maxTime}`);
this.progress = 0;
this.avPlayer?.play();
this.seekTo(this.startTruncationTime);
}
}
private watchPlayEvent() {
this.avPlayer?.play();
}
aboutToAppear() {
this.initThumbList();
}
async aboutToDisappear():Promise<void> {
// 保证页面销毁 如果还有取帧行为应该及时停止该子线程操作
MP4Parser.stopGetFrame();
if (this.isCreate) {
this.setOffCallback();
await this.avPlayer?.stop();
await this.avPlayer?.release();
this.isCreate = false;
}
}
/**
* 设置AVPlayer播放时间的监听
*/
timeUpdate(): void {
this.avPlayer?.on('timeUpdate', (time: number) => {
// 播放占比情况
if (this.avPlayer) {
let currentProgress = (this.avPlayer?.currentTime - this.startTruncationTime) * (1.0) / (this.endTruncationTime - this.startTruncationTime);
if (currentProgress <= 0) {
currentProgress = 0;
}
if (currentProgress >= 1) {
currentProgress = 1;
}
this.progress = currentProgress;
}
// 当播放的时间大于等于截止时间时候,回到开始截取的地方重新播放
if (this.avPlayer && this.avPlayer.currentTime >= this.endTruncationTime) {
this.avPlayer?.play(); // 如果不调用,在线视频的方式会被暂停
this.seekTo(this.startTruncationTime);
this.progress = 0;
}
})
}
/**
* 移除播放状态机AVPlayerState切换的事件监听和播放时间监听
* @returns
*/
setOffCallback(): void {
if (this.avPlayer) {
this.avPlayer?.off('timeUpdate');
this.avPlayer?.off('stateChange');
}
}
/**
* 设置播放状态机AVPlayerState切换的事件
* @returns
*/
async setStateChangeCallback(): Promise<void> {
if (this.avPlayer) {
this.avPlayer?.on('stateChange', async (state, reason) => {
switch (state) {
case 'idle':
logger.info('state idle called');
break;
case 'initialized':
logger.info('state initialized called');
this.avPlayer!.surfaceId = this.surfaceId;
this.avPlayer!.prepare();
break;
case 'prepared':
this.videoPrepared();
this.avPlayer?.play();
this.seekTo(this.startTruncationTime);
break;
case 'playing':
logger.info('state playing called');
break;
case 'paused':
logger.info('state paused called');
break;
case 'completed':
logger.info('state completed called');
this.seekTo(this.startTruncationTime);
this.progress = 0;
break;
case 'stopped':
logger.info('state stopped called');
break;
case 'released':
logger.info('state released called');
break;
case 'error':
logger.info('state error called');
break;
default:
logger.info('state unknown called');
break;
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SelectGifTimeFrameView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right promptText : 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 ratio : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1.0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left "watchPlayEvent" AST#expression#Right ) AST#decorator#Right playEvent : 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 mVideoThumbOption : AST#type_annotation#Left AST#primary_type#Left VideoThumbOption AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left videoThumbs AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left videoThumbWidth AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right progress : 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 seekBarWidth : 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 // 选取gif时间段组件的宽度 AST#property_declaration#Left private seekBarHeight : 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 // 选取gif时间段组件的高度 AST#property_declaration#Left private avPlayer ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left media . AVPlayer AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private surfaceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private xComponentController : AST#type_annotation#Left AST#primary_type#Left XComponentController 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 XComponentController AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private isCreate : 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 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 private maxTime : 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 private minTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 5 AST#expression#Right ; AST#property_declaration#Right // 最小时间间隔,单位秒 AST#property_declaration#Left private startTime : 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 endTime : 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 currentStartTime : 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 currentEndTime : 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 videoWidth : 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 private videoHeight : 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 private thumbWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 12 AST#expression#Right ; AST#property_declaration#Right // 拖动bar宽度 AST#property_declaration#Left private back ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 按返回按钮的处理 AST#property_declaration#Left private startCreateGif ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left startTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left endTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 创建gif的处理 /*******************************************************************/ AST#property_declaration#Left private videoThumbCount : 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 startTruncationTime : 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 // 截取gif的起始时间 AST#property_declaration#Left private endTruncationTime : 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 // 截断gif的结束时间 AST#property_declaration#Left private rangeSeekBarListener : AST#type_annotation#Left AST#primary_type#Left RangeSeekBarListener AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onRangeSeekBarValuesChanged AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left minValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left maxValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { // 截取时间段设置 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . startTruncationTime AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left minValue AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . endTruncationTime AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left maxValue AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left duration = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . endTruncationTime AST#member_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . startTruncationTime AST#member_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#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 . promptText AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#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 AST#resource_expression#Left $r ( AST#expression#Left 'app.string.video_create_gif_select_prompt' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left duration AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . maxTime 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#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 . progress 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right ?. play AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 . seekTo 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 . startTruncationTime AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_declaration#Right AST#method_declaration#Left private watchPlayEvent 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 . avPlayer AST#member_expression#Right AST#expression#Right ?. play AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . initThumbList AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left async aboutToDisappear 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#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 MP4Parser AST#expression#Right . stopGetFrame AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isCreate AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setOffCallback 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 AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right ?. stop 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 AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right ?. release 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 . isCreate 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#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 设置AVPlayer播放时间的监听
*/ AST#method_declaration#Left timeUpdate AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right ?. on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'timeUpdate' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left time : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#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 . avPlayer AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left currentProgress = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right ?. currentTime AST#member_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . startTruncationTime AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left 1.0 AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right / AST#expression#Left AST#parenthesized_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 . endTruncationTime AST#member_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . startTruncationTime AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left currentProgress 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 currentProgress = 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#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left currentProgress 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 currentProgress = 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . progress AST#member_expression#Right = AST#expression#Left currentProgress 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 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 . avPlayer AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . currentTime AST#member_expression#Right AST#expression#Right >= AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . endTruncationTime 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 . avPlayer AST#member_expression#Right AST#expression#Right ?. play AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 . seekTo 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 . startTruncationTime 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 . progress 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#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 /**
* 移除播放状态机AVPlayerState切换的事件监听和播放时间监听
* @returns
*/ AST#method_declaration#Left setOffCallback AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right ?. off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'timeUpdate' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right ?. off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'stateChange' 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 /**
* 设置播放状态机AVPlayerState切换的事件
* @returns
*/ AST#method_declaration#Left async setStateChangeCallback AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left : 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 { if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right ?. on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'stateChange' AST#expression#Right , AST#ERROR#Left async AST#parameter_list#Left ( AST#parameter#Left state AST#parameter#Right , AST#parameter#Left reason AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left => { AST#ERROR#Left AST#property_name#Left switch AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left state AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 'idle' AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Right : AST#qualified_type#Left logger . info AST#qualified_type#Right ( 'state idle called' ) ; AST#ERROR#Right AST#statement#Left AST#break_statement#Left break ; AST#break_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 'initialized' AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Right : AST#qualified_type#Left logger . info AST#qualified_type#Right ( AST#ERROR#Right AST#expression#Left 'state initialized called' 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . surfaceId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . surfaceId 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 AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . prepare 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 break 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 'prepared' AST#expression#Right AST#expression_statement#Right : AST#ERROR#Left AST#qualified_type#Left this . videoPrepared AST#qualified_type#Right AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Right ; AST#method_declaration#Right AST#method_declaration#Left this AST#ERROR#Left . avPlayer ?. play AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right ; AST#method_declaration#Right AST#method_declaration#Left this AST#ERROR#Left . seekTo AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left this AST#parameter#Right AST#ERROR#Left . startTruncationTime AST#ERROR#Right ) AST#parameter_list#Right ; AST#method_declaration#Right AST#property_declaration#Left break ; AST#property_declaration#Right AST#property_declaration#Left case AST#ERROR#Left 'playing' AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left logger . info AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left ( 'state playing called' ) AST#ERROR#Right ; AST#property_declaration#Right AST#property_declaration#Left break ; AST#property_declaration#Right AST#property_declaration#Left case AST#ERROR#Left 'paused' AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left logger . info AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left ( 'state paused called' ) AST#ERROR#Right ; AST#property_declaration#Right AST#property_declaration#Left break ; AST#property_declaration#Right AST#property_declaration#Left case AST#ERROR#Left 'completed' AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left logger . info AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left ( 'state completed called' ) AST#ERROR#Right ; AST#property_declaration#Right AST#method_declaration#Left this AST#ERROR#Left . seekTo AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left this AST#parameter#Right AST#ERROR#Left . startTruncationTime AST#ERROR#Right ) AST#parameter_list#Right ; AST#method_declaration#Right AST#property_declaration#Left this AST#ERROR#Left . progress AST#ERROR#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left break ; AST#property_declaration#Right AST#property_declaration#Left case AST#ERROR#Left 'stopped' AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left logger . info AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left ( 'state stopped called' ) AST#ERROR#Right ; AST#property_declaration#Right AST#property_declaration#Left break ; AST#property_declaration#Right AST#property_declaration#Left case AST#ERROR#Left 'released' AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left logger . info AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left ( 'state released called' ) AST#ERROR#Right ; AST#property_declaration#Right AST#property_declaration#Left break ; AST#property_declaration#Right AST#property_declaration#Left case AST#ERROR#Left 'error' AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left logger . info AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left ( 'state error called' ) AST#ERROR#Right ; AST#property_declaration#Right AST#property_declaration#Left break ; AST#property_declaration#Right AST#property_declaration#Left default : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left logger . info AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left ( 'state unknown called' ) AST#ERROR#Right ; AST#property_declaration#Right AST#property_declaration#Left break ; AST#property_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct SelectGifTimeFrameView {
@State promptText: string = '';
@State ratio: number = 1.0;
@Prop @Watch("watchPlayEvent") playEvent: number = 0;
@State mVideoThumbOption: VideoThumbOption = {
videoThumbs: [],
videoThumbWidth: 0
};
@State progress: number = 0;
private seekBarWidth: number = 0;
private seekBarHeight: number = 0;
private avPlayer?: media.AVPlayer;
private surfaceId: string = '';
private xComponentController: XComponentController = new XComponentController();
private isCreate: boolean = false;
private srcFilePath: string = '';
private maxTime: number = 10;
private minTime: number = 5;
private startTime: number = 0;
private endTime: number = 0;
private currentStartTime: number = 0;
private currentEndTime: number = 0;
private videoWidth: number = 1;
private videoHeight: number = 1;
private thumbWidth: number = 12;
private back?: () => void;
private startCreateGif?: (startTime: number, endTime: number, src: string) => void;
private videoThumbCount: number = 0;
private startTruncationTime: number = 0;
private endTruncationTime: number = 0;
private rangeSeekBarListener: RangeSeekBarListener = {
onRangeSeekBarValuesChanged: (minValue: number, maxValue: number): void => {
this.startTruncationTime = Math.floor(minValue);
this.endTruncationTime = Math.floor(maxValue);
let duration = Math.floor((this.endTruncationTime - this.startTruncationTime) / 1000);
this.promptText = getContext(this).resourceManager.getStringSync($r('app.string.video_create_gif_select_prompt').id, `${duration}`, `${this.maxTime}`);
this.progress = 0;
this.avPlayer?.play();
this.seekTo(this.startTruncationTime);
}
}
private watchPlayEvent() {
this.avPlayer?.play();
}
aboutToAppear() {
this.initThumbList();
}
async aboutToDisappear():Promise<void> {
MP4Parser.stopGetFrame();
if (this.isCreate) {
this.setOffCallback();
await this.avPlayer?.stop();
await this.avPlayer?.release();
this.isCreate = false;
}
}
timeUpdate(): void {
this.avPlayer?.on('timeUpdate', (time: number) => {
if (this.avPlayer) {
let currentProgress = (this.avPlayer?.currentTime - this.startTruncationTime) * (1.0) / (this.endTruncationTime - this.startTruncationTime);
if (currentProgress <= 0) {
currentProgress = 0;
}
if (currentProgress >= 1) {
currentProgress = 1;
}
this.progress = currentProgress;
}
if (this.avPlayer && this.avPlayer.currentTime >= this.endTruncationTime) {
this.avPlayer?.play();
this.seekTo(this.startTruncationTime);
this.progress = 0;
}
})
}
setOffCallback(): void {
if (this.avPlayer) {
this.avPlayer?.off('timeUpdate');
this.avPlayer?.off('stateChange');
}
}
async setStateChangeCallback(): Promise<void> {
if (this.avPlayer) {
this.avPlayer?.on('stateChange', async (state, reason) => {
switch (state) {
case 'idle':
logger.info('state idle called');
break;
case 'initialized':
logger.info('state initialized called');
this.avPlayer!.surfaceId = this.surfaceId;
this.avPlayer!.prepare();
break;
case 'prepared':
this.videoPrepared();
this.avPlayer?.play();
this.seekTo(this.startTruncationTime);
break;
case 'playing':
logger.info('state playing called');
break;
case 'paused':
logger.info('state paused called');
break;
case 'completed':
logger.info('state completed called');
this.seekTo(this.startTruncationTime);
this.progress = 0;
break;
case 'stopped':
logger.info('state stopped called');
break;
case 'released':
logger.info('state released called');
break;
case 'error':
logger.info('state error called');
break;
default:
logger.info('state unknown called');
break;
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocreategif/src/main/ets/components/SelectGifTimeFrameView.ets#L27-L192
|
6cf0fb86e00057428cdba33a2f98d70bde884b06
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/mediafullscreen/src/main/ets/view/MediaFullScreen.ets
|
arkts
|
MediaFullScreenComponent
|
组件zIndex
功能描述: 本示例介绍了使用@ohos.multimedia.media接口和@ohos.window接口配合XComponent组件实现媒体全屏的功能。
推荐场景: 多用于首页瀑布流媒体播放等场景
核心组件:
1. window
2. XComponent
实现步骤:
1. 在自定义组件XVideoComponent内调用changeOrientation方法,实现媒体全屏效果。
2. 调用@ohos.window的getLastWindow方法获取当前应用内最上层的子窗口,若无应用子窗口,则返回应用主窗口。
3. 利用获取到的窗口对象,调用setWindowSystemBarEnable方法设置窗口是否显示导航栏和状态栏。
4. 调用窗口对象的setPreferredOrientation方法设置窗口旋转方向和重力感应。
5. 调用窗口对象的setWindowLayoutFullScreen方法实现沉浸式布局。
|
@Component
export struct MediaFullScreenComponent {
popPage: (() => void) | undefined = undefined;
@State maskShow: boolean = false; // 遮罩层是否显示
@State isLandscape: boolean = false; // 是否横屏状态
@State cachedCountNumber: number = 6; // 懒加载缓存数
@State contentData: FlowItemContentsData = new FlowItemContentsData(); // 瀑布流内容
@State selectedVideo: string = ''; // 选择的视频名称
@Provide pageMediaFullScreen: NavPathStack = new NavPathStack();
@State videoLocation: Area = {
// 视频在屏幕中的位置信息
width: 0,
height: 0,
position: { x: 0, y: 0 },
globalPosition: { x: 0, y: 0 }
};
async aboutToAppear() {
// 获取JSON中的列表数据
const jsonObj: JsonObject = new JsonObject(JSON_URI);
const array = await jsonObj.getFlowItemContentObj();
this.contentData.pushData(array);
}
async aboutToDisappear() {
// 销毁组件时恢复window方向
const currentWindow = await window.getLastWindow(getContext(this));
currentWindow.setWindowSystemBarEnable(WINDOW_SYSTEM_BAR);
}
build() {
// 应用主页用NavDestination承载,用于显示Navigation的内容区
Navigation(this.pageMediaFullScreen) {
}
.mode(NavigationMode.Stack)
.onAppear(() => {
this.pageMediaFullScreen.pushPathByName("MediaFullScreen", null, false);
})
// 创建NavDestination组件,需使用此组件的onBackPressed回调拦截返回事件
.navDestination(this.videoArea)
}
@Builder
videoArea() {
// 性能知识点: 功能是以har的形式集成在主工程中,没有@Entry修饰的组件,无法使用@Entry组件的onBackPress生命周期函数。
NavDestination() {
Column() {
// 引入自定义视频组件
XVideoComponent({
fileName: this.selectedVideo,
videoLocation: this.videoLocation,
isLandscape: this.isLandscape,
maskShow: this.maskShow
})
Column() {
}
.width($r('app.string.media_full_screen_layout_100'))
.height($r('app.string.media_full_screen_layout_100'))
.backgroundColor(Color.Transparent)
.position({ x: 0, y: 0 })
.zIndex(VIDEO_Z_INDEX)
.visibility(this.maskShow ? Visibility.Visible : Visibility.None)
WaterFlow() {
// 性能知识点: LazyForEach 懒加载优化,详情请见 https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/performance/lazyforeach_optimization.md/
LazyForEach(this.contentData, (moment: FlowItemContent, index: number) => {
FlowItem() {
ReusableComponent({
index,
moment,
selectedVideo: this.selectedVideo,
videoLocation: this.videoLocation,
maskShow: this.maskShow
})
}
.width($r('app.string.media_full_screen_video_width'))
}, (moment: FlowItemContent) => moment.id)
}
.columnsTemplate('1fr 1fr')
.columnsGap($r('app.integer.media_full_screen_main_page_row_padding_left'))
.rowsGap($r('app.integer.media_full_screen_main_page_row_padding_left'))
.cachedCount(this.cachedCountNumber) // 懒加载缓存配置
.width($r('app.string.media_full_screen_layout_100'))
.height($r('app.string.media_full_screen_layout_100'))
.clip(false)
}
.backgroundColor($r('app.color.media_full_screen_search_border_color'))
.height($r('app.string.media_full_screen_layout_100'))
.layoutWeight(LAYOUT_WEIGHT)
.clip(true)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
}
.hideTitleBar(true)
// TODO:知识点:返回时进行判断,如果在非全屏状态则返回首页,否则仅退出全屏
.onBackPressed(() => {
if (this.selectedVideo === '') {
if (this.popPage) {
this.popPage();
} else {
// 未传入返回接口时给出弹框提示
promptAction.showToast({
message: $r('app.string.media_full_screen_back_error_message'),
duration: 1000
})
}
return true;
} else {
this.maskShow = false;
this.isLandscape = !this.isLandscape;
return true;
}
})
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MediaFullScreenComponent AST#component_body#Left { AST#property_declaration#Left popPage : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right ) AST#parenthesized_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right maskShow : 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 isLandscape : 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 cachedCountNumber : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 6 AST#expression#Right ; AST#property_declaration#Right // 懒加载缓存数 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right contentData : AST#type_annotation#Left AST#primary_type#Left FlowItemContentsData 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 FlowItemContentsData 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 selectedVideo : 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 @ Provide AST#decorator#Right pageMediaFullScreen : AST#type_annotation#Left AST#primary_type#Left NavPathStack 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 NavPathStack 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 videoLocation : AST#type_annotation#Left AST#primary_type#Left Area AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { // 视频在屏幕中的位置信息 AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left position AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left globalPosition AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left async aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 获取JSON中的列表数据 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left jsonObj : AST#type_annotation#Left AST#primary_type#Left JsonObject 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 JsonObject AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left JSON_URI 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 array = 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 jsonObj AST#expression#Right AST#await_expression#Right AST#expression#Right . getFlowItemContentObj 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#member_expression#Left AST#expression#Left this AST#expression#Right . contentData AST#member_expression#Right AST#expression#Right . pushData 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#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left async aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 销毁组件时恢复window方向 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left currentWindow = 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 window AST#expression#Right AST#await_expression#Right AST#expression#Right . getLastWindow 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#expression#Left this 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 currentWindow AST#expression#Right . setWindowSystemBarEnable AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left WINDOW_SYSTEM_BAR 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#build_method#Left build ( ) AST#build_body#Left { // 应用主页用NavDestination承载,用于显示Navigation的内容区 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Navigation ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pageMediaFullScreen AST#member_expression#Right AST#expression#Right ) AST#container_content_body#Left { } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . mode ( AST#expression#Left AST#member_expression#Left AST#expression#Left NavigationMode AST#expression#Right . Stack AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onAppear ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#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 . pageMediaFullScreen AST#member_expression#Right AST#expression#Right . pushPathByName AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "MediaFullScreen" AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_literal#Right 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#arrow_function#Right AST#expression#Right ) // 创建NavDestination组件,需使用此组件的onBackPressed回调拦截返回事件 AST#modifier_chain_expression#Left . navDestination ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . videoArea 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#build_body#Right AST#build_method#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right videoArea AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 性能知识点: 功能是以har的形式集成在主工程中,没有@Entry修饰的组件,无法使用@Entry组件的onBackPress生命周期函数。 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#container_content_body#Left { // 引入自定义视频组件 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left XVideoComponent ( AST#component_parameters#Left { AST#component_parameter#Left fileName : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedVideo AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left videoLocation : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . videoLocation AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isLandscape : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isLandscape AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left maskShow : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . maskShow AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#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 Column ( ) AST#container_content_body#Left { } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.media_full_screen_layout_100' 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.string.media_full_screen_layout_100' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Transparent AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left VIDEO_Z_INDEX AST#expression#Right ) AST#modifier_chain_expression#Left . visibility ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . maskShow AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . Visible AST#member_expression#Right AST#expression#Right : AST#expression#Left Visibility AST#expression#Right AST#conditional_expression#Right AST#expression#Right . None AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 WaterFlow ( ) AST#container_content_body#Left { // 性能知识点: LazyForEach 懒加载优化,详情请见 https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/performance/lazyforeach_optimization.md/ 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 . contentData AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left moment : AST#type_annotation#Left AST#primary_type#Left FlowItemContent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left FlowItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ReusableComponent ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left index AST#property_assignment#Right , AST#property_assignment#Left moment AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left selectedVideo AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedVideo AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left videoLocation AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . videoLocation AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left maskShow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . maskShow AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.media_full_screen_video_width' AST#expression#Right ) AST#resource_expression#Right AST#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 moment : AST#type_annotation#Left AST#primary_type#Left FlowItemContent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#member_expression#Left AST#expression#Left moment AST#expression#Right . id AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#lazy_for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . columnsTemplate ( AST#expression#Left '1fr 1fr' AST#expression#Right ) AST#modifier_chain_expression#Left . columnsGap ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.media_full_screen_main_page_row_padding_left' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . rowsGap ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.media_full_screen_main_page_row_padding_left' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . cachedCount ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cachedCountNumber AST#member_expression#Right AST#expression#Right ) // 懒加载缓存配置 AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.media_full_screen_layout_100' 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.string.media_full_screen_layout_100' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . clip ( AST#expression#Left AST#boolean_literal#Left false 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#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.media_full_screen_search_border_color' 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.string.media_full_screen_layout_100' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left LAYOUT_WEIGHT AST#expression#Right ) AST#modifier_chain_expression#Left . clip ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . expandSafeArea ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaType AST#expression#Right . SYSTEM AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaEdge AST#expression#Right . BOTTOM AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . hideTitleBar ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) // TODO:知识点:返回时进行判断,如果在非全屏状态则返回首页,否则仅退出全屏 AST#modifier_chain_expression#Left . onBackPressed ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedVideo 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . popPage 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 . popPage 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#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#resource_expression#Left $r ( AST#expression#Left 'app.string.media_full_screen_back_error_message' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 1000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_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 . maskShow 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 . isLandscape 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 . isLandscape AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#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#builder_function_body#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct MediaFullScreenComponent {
popPage: (() => void) | undefined = undefined;
@State maskShow: boolean = false;
@State isLandscape: boolean = false;
@State cachedCountNumber: number = 6;
@State contentData: FlowItemContentsData = new FlowItemContentsData();
@State selectedVideo: string = '';
@Provide pageMediaFullScreen: NavPathStack = new NavPathStack();
@State videoLocation: Area = {
width: 0,
height: 0,
position: { x: 0, y: 0 },
globalPosition: { x: 0, y: 0 }
};
async aboutToAppear() {
const jsonObj: JsonObject = new JsonObject(JSON_URI);
const array = await jsonObj.getFlowItemContentObj();
this.contentData.pushData(array);
}
async aboutToDisappear() {
const currentWindow = await window.getLastWindow(getContext(this));
currentWindow.setWindowSystemBarEnable(WINDOW_SYSTEM_BAR);
}
build() {
Navigation(this.pageMediaFullScreen) {
}
.mode(NavigationMode.Stack)
.onAppear(() => {
this.pageMediaFullScreen.pushPathByName("MediaFullScreen", null, false);
})
.navDestination(this.videoArea)
}
@Builder
videoArea() {
NavDestination() {
Column() {
XVideoComponent({
fileName: this.selectedVideo,
videoLocation: this.videoLocation,
isLandscape: this.isLandscape,
maskShow: this.maskShow
})
Column() {
}
.width($r('app.string.media_full_screen_layout_100'))
.height($r('app.string.media_full_screen_layout_100'))
.backgroundColor(Color.Transparent)
.position({ x: 0, y: 0 })
.zIndex(VIDEO_Z_INDEX)
.visibility(this.maskShow ? Visibility.Visible : Visibility.None)
WaterFlow() {
LazyForEach(this.contentData, (moment: FlowItemContent, index: number) => {
FlowItem() {
ReusableComponent({
index,
moment,
selectedVideo: this.selectedVideo,
videoLocation: this.videoLocation,
maskShow: this.maskShow
})
}
.width($r('app.string.media_full_screen_video_width'))
}, (moment: FlowItemContent) => moment.id)
}
.columnsTemplate('1fr 1fr')
.columnsGap($r('app.integer.media_full_screen_main_page_row_padding_left'))
.rowsGap($r('app.integer.media_full_screen_main_page_row_padding_left'))
.cachedCount(this.cachedCountNumber)
.width($r('app.string.media_full_screen_layout_100'))
.height($r('app.string.media_full_screen_layout_100'))
.clip(false)
}
.backgroundColor($r('app.color.media_full_screen_search_border_color'))
.height($r('app.string.media_full_screen_layout_100'))
.layoutWeight(LAYOUT_WEIGHT)
.clip(true)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
}
.hideTitleBar(true)
.onBackPressed(() => {
if (this.selectedVideo === '') {
if (this.popPage) {
this.popPage();
} else {
promptAction.showToast({
message: $r('app.string.media_full_screen_back_error_message'),
duration: 1000
})
}
return true;
} else {
this.maskShow = false;
this.isLandscape = !this.isLandscape;
return true;
}
})
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/mediafullscreen/src/main/ets/view/MediaFullScreen.ets#L44-L158
|
7574667275aeff638d7084d8e7ba6595e5e1a053
|
gitee
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
feature/demo/src/main/ets/view/NavigationResultPage.ets
|
arkts
|
NavigationResultContent
|
结果回传示例页内容视图
@returns {void} 无返回值
|
@Builder
private NavigationResultContent() {
MediumPaddingVerticalScroll() {
ColumnBase({ widthValue: P100 }) {
this.InputSection();
};
};
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private NavigationResultContent 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 MediumPaddingVerticalScroll ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ColumnBase ( AST#component_parameters#Left { AST#component_parameter#Left widthValue : AST#expression#Left P100 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . InputSection 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#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
private NavigationResultContent() {
MediumPaddingVerticalScroll() {
ColumnBase({ widthValue: P100 }) {
this.InputSection();
};
};
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/NavigationResultPage.ets#L35-L42
|
ef97ff6c18fe4d46f19d41eb6f738caae993cd41
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets
|
arkts
|
stopContinuousTask
|
结束后台任务
@returns {void}
|
stopContinuousTask(): void {
// 避免重新停止后台任务
if (!this.isBackgroundTaskRunning) {
return;
}
// TODO:知识点:停止后台任务
backgroundTaskManager.stopBackgroundRunning(this.bindContext!).then(() => {
console.info(`Succeeded in operationing stopBackgroundRunning.`);
this.isBackgroundTaskRunning = false;
}).catch((err: BusinessError) => {
console.error(`Failed to operation stopBackgroundRunning. Code is ${err.code}, message is ${err.message}`);
});
}
|
AST#method_declaration#Left stopContinuousTask 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 . isBackgroundTaskRunning 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 // TODO:知识点:停止后台任务 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 backgroundTaskManager AST#expression#Right . stopBackgroundRunning 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 this AST#expression#Right . bindContext AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_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_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 ` Succeeded in operationing stopBackgroundRunning. ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isBackgroundTaskRunning AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to operation stopBackgroundRunning. Code is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
stopContinuousTask(): void {
if (!this.isBackgroundTaskRunning) {
return;
}
backgroundTaskManager.stopBackgroundRunning(this.bindContext!).then(() => {
console.info(`Succeeded in operationing stopBackgroundRunning.`);
this.isBackgroundTaskRunning = false;
}).catch((err: BusinessError) => {
console.error(`Failed to operation stopBackgroundRunning. Code is ${err.code}, message is ${err.message}`);
});
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets#L320-L333
|
c446b848e7b7664afb311b87f02f939bfab6eba1
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/WindowUtil.ets
|
arkts
|
isLayoutFullScreen
|
判断窗口是否为沉浸式,默认为false。true表示沉浸式;false表示非沉浸式。
@param windowClass 不传该值,默认主窗口。
@returns
|
static isLayoutFullScreen(windowClass: window.Window = AppUtil.getMainWindow()): boolean {
return WindowUtil.getWindowProperties(windowClass).isLayoutFullScreen;
}
|
AST#method_declaration#Left static isLayoutFullScreen 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 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 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 . isLayoutFullScreen AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static isLayoutFullScreen(windowClass: window.Window = AppUtil.getMainWindow()): boolean {
return WindowUtil.getWindowProperties(windowClass).isLayoutFullScreen;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L99-L101
|
6ca6e2de9bd679b9986f1423250d5ffc0e6ce06e
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/ai/ChatbotEngine.ets
|
arkts
|
步骤类型枚举
|
export enum StepType {
PROMPT = 'prompt',
COLLECT_INPUT = 'collect_input',
VALIDATE = 'validate',
CONFIRM = 'confirm',
EXECUTE = 'execute',
COMPLETE = 'complete'
}
|
AST#export_declaration#Left export AST#enum_declaration#Left enum StepType AST#enum_body#Left { AST#enum_member#Left PROMPT = AST#expression#Left 'prompt' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left COLLECT_INPUT = AST#expression#Left 'collect_input' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left VALIDATE = AST#expression#Left 'validate' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left CONFIRM = AST#expression#Left 'confirm' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left EXECUTE = AST#expression#Left 'execute' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left COMPLETE = AST#expression#Left 'complete' AST#expression#Right AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
|
export enum StepType {
PROMPT = 'prompt',
COLLECT_INPUT = 'collect_input',
VALIDATE = 'validate',
CONFIRM = 'confirm',
EXECUTE = 'execute',
COMPLETE = 'complete'
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/ChatbotEngine.ets#L59-L66
|
b27e7d382d604c74398a89350c398372a530fd80
|
github
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/editaddress/src/main/ets/model/Address.ets
|
arkts
|
表单验证的数据结构
@param {string} name 收件人
@param {string} areaName 省市区
@param {number | number []} provinceArr 处理后的省市区数组
@param {string} area 详细地址
@param {string} phone 手机号
@param {string} tag 地址标签
|
export class Address {
name: string = '';
areaName: string = '';
provinceArr: number | number [] = [0, 0, 0];
area: string = '';
phone: string = '';
tag: string = '';
constructor(name: string, areaName: string, provinceArr: number | number [], area: string, phone: string,
tag: string) {
this.name = name;
this.provinceArr = provinceArr;
this.areaName = areaName;
this.area = area;
this.phone = phone;
this.tag = tag;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class Address AST#class_body#Left { AST#property_declaration#Left name : 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 areaName : 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 provinceArr : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left area : 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 phone : 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 tag : 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#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left areaName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left provinceArr : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left area : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left phone : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . name AST#member_expression#Right = AST#expression#Left name AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . provinceArr AST#member_expression#Right = AST#expression#Left provinceArr 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 . areaName AST#member_expression#Right = AST#expression#Left areaName 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 . area AST#member_expression#Right = AST#expression#Left area 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 . phone AST#member_expression#Right = AST#expression#Left phone 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 . tag AST#member_expression#Right = AST#expression#Left tag AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class Address {
name: string = '';
areaName: string = '';
provinceArr: number | number [] = [0, 0, 0];
area: string = '';
phone: string = '';
tag: string = '';
constructor(name: string, areaName: string, provinceArr: number | number [], area: string, phone: string,
tag: string) {
this.name = name;
this.provinceArr = provinceArr;
this.areaName = areaName;
this.area = area;
this.phone = phone;
this.tag = tag;
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/editaddress/src/main/ets/model/Address.ets#L25-L42
|
ac79dec4bd859b72a500df4cff48590540b927b7
|
gitee
|
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
NavigationRouter/RouterModule/src/main/ets/utils/RouterModule.ets
|
arkts
|
pop
|
[End static_async_push] [Start static_pop] 通过路由栈名routerName获取对应的NavPathStack对象,并使用该对象的pop方法实现返回上个路由
|
public static pop(routerName: string): void {
RouterModule.getRouter(routerName).pop();
}
|
AST#method_declaration#Left public static pop AST#parameter_list#Left ( AST#parameter#Left routerName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RouterModule AST#expression#Right . getRouter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left routerName AST#expression#Right ) AST#argument_list#Right AST#call_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#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public static pop(routerName: string): void {
RouterModule.getRouter(routerName).pop();
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NavigationRouter/RouterModule/src/main/ets/utils/RouterModule.ets#L64-L66
|
48b5fcd20f7ed4e81706182da25beecfa0ad1836
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/components/CustomCalendar.ets
|
arkts
|
自定义日历控制器。用于控制年、月、周视图间切换场景下刷新日期数据。
|
export class CalendarController {
// 视图刷新接口
public swiperRefresh = (value: CalendarViewType) => {
};
// 视图刷新接口(仅用于在年视图上点击月份切换到月视图时刷新)
public swiperYearToMonthRefresh = (year: number, month: number) => {
};
// 日程点数据刷新接口
public schedulePointRefresh = () => {
};
}
|
AST#export_declaration#Left export AST#class_declaration#Left class CalendarController AST#class_body#Left { // 视图刷新接口 AST#property_declaration#Left public swiperRefresh = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left CalendarViewType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ; AST#property_declaration#Right // 视图刷新接口(仅用于在年视图上点击月份切换到月视图时刷新) AST#property_declaration#Left public swiperYearToMonthRefresh = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ; AST#property_declaration#Right // 日程点数据刷新接口 AST#property_declaration#Left public schedulePointRefresh = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class CalendarController {
public swiperRefresh = (value: CalendarViewType) => {
};
(仅用于在年视图上点击月份切换到月视图时刷新)
public swiperYearToMonthRefresh = (year: number, month: number) => {
};
public schedulePointRefresh = () => {
};
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/components/CustomCalendar.ets#L244-L254
|
8646042c000a0959c6608f2daed0c54dfa3f6c8a
|
gitee
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/WaterFlowDataSource.ets
|
arkts
|
deleteLastItem
|
删除最后一个元素
|
public deleteLastItem(): void {
this.dataArray.splice(-1, 1);
this.notifyDataDelete(this.dataArray.length);
}
|
AST#method_declaration#Left public deleteLastItem AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#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#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 . notifyDataDelete 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 . dataArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public deleteLastItem(): void {
this.dataArray.splice(-1, 1);
this.notifyDataDelete(this.dataArray.length);
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/WaterFlowDataSource.ets#L163-L166
|
7c5c9ff2b178e01c3c31d7ea2c3d5fe0b7a85697
|
gitee
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.