Compare commits
5
Commits
59999031eb
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2dd4c077af | ||
|
|
fe3a2e6cc0 | ||
|
|
adc8a1cfda | ||
|
|
bed2e9a75b | ||
|
|
aacb90d355 |
@@ -27,11 +27,6 @@ export const INFO_IMAGE_LIGHT =
|
|||||||
'https://u.thsi.cn/imgsrc/bbs/e1e9b6d81b9f4f6fa817cbeb71e98ff1.png';
|
'https://u.thsi.cn/imgsrc/bbs/e1e9b6d81b9f4f6fa817cbeb71e98ff1.png';
|
||||||
export const INFO_IMAGE_DARK =
|
export const INFO_IMAGE_DARK =
|
||||||
'https://u.thsi.cn/imgsrc/bbs/19f7f20bcf800ec2b8e9fc0fa0d73369.png';
|
'https://u.thsi.cn/imgsrc/bbs/19f7f20bcf800ec2b8e9fc0fa0d73369.png';
|
||||||
export const EMPTY_IMAGE_LIGHT =
|
|
||||||
'https://u.thsi.cn/imgsrc/bbs/8eee9cd4fa7e359032de11a3f7c2a70b_300_230.png';
|
|
||||||
export const EMPTY_IMAGE_DARK =
|
|
||||||
'https://u.thsi.cn/imgsrc/bbs/1c4e679244ed87231befad2b04cddfe2_300_230.png';
|
|
||||||
|
|
||||||
// 字段黑名单:过滤 field_list 中不应展示的字段
|
// 字段黑名单:过滤 field_list 中不应展示的字段
|
||||||
export const BLACK_LIST: string[] = [
|
export const BLACK_LIST: string[] = [
|
||||||
'合约代码',
|
'合约代码',
|
||||||
|
|||||||
@@ -25,17 +25,18 @@ export const MOCK_RAW_TABS: RawPickTabItem[] = [
|
|||||||
{ contract: 'ZN2506', market: '70', contract_name: '沪锌2506', main_contract_type: '1' },
|
{ contract: 'ZN2506', market: '70', contract_name: '沪锌2506', main_contract_type: '1' },
|
||||||
],
|
],
|
||||||
field_list: [
|
field_list: [
|
||||||
|
{ key: '仓单单日增减量', type: 'DOUBLE', unit: '张' },
|
||||||
{ key: '成交量', type: 'DOUBLE', unit: '手' },
|
{ key: '成交量', type: 'DOUBLE', unit: '手' },
|
||||||
{ key: '持仓量', type: 'DOUBLE', unit: '手' },
|
{ key: '持仓量', type: 'DOUBLE', unit: '手' },
|
||||||
{ key: '合约代码', type: 'STRING', unit: '' }, // 黑名单,不展示
|
{ key: '合约代码', type: 'STRING', unit: '' }, // 黑名单,不展示
|
||||||
{ key: '最新涨跌幅', type: 'DOUBLE', unit: '%' }, // 黑名单,不展示
|
{ key: '最新涨跌幅', type: 'DOUBLE', unit: '%' }, // 黑名单,不展示
|
||||||
],
|
],
|
||||||
origin_result_list: [
|
origin_result_list: [
|
||||||
{ '成交量': 123000, '持仓量': 456000, '合约代码': 'CU2506', '最新涨跌幅': 1.85 },
|
{ '仓单单日增减量': 1250, '成交量': 123000, '持仓量': 456000, '合约代码': 'CU2506', '最新涨跌幅': 1.85 },
|
||||||
{ '成交量': 31000, '持仓量': 182000, '合约代码': 'CU2507', '最新涨跌幅': 1.62 },
|
{ '仓单单日增减量': -860, '成交量': 31000, '持仓量': 182000, '合约代码': 'CU2507', '最新涨跌幅': 1.62 },
|
||||||
{ '成交量': 57000, '持仓量': 224000, '合约代码': 'NI2506', '最新涨跌幅': 0.94 },
|
{ '仓单单日增减量': 420, '成交量': 57000, '持仓量': 224000, '合约代码': 'NI2506', '最新涨跌幅': 0.94 },
|
||||||
{ '成交量': 44000, '持仓量': 198000, '合约代码': 'AL2506', '最新涨跌幅': 0.76 },
|
{ '仓单单日增减量': -315, '成交量': 44000, '持仓量': 198000, '合约代码': 'AL2506', '最新涨跌幅': 0.76 },
|
||||||
{ '成交量': 28000, '持仓量': 143000, '合约代码': 'ZN2506', '最新涨跌幅': 0.61 },
|
{ '仓单单日增减量': 980, '成交量': 28000, '持仓量': 143000, '合约代码': 'ZN2506', '最新涨跌幅': 0.61 },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ import {
|
|||||||
EventListener,
|
EventListener,
|
||||||
} from '../common/EventEmitter';
|
} from '../common/EventEmitter';
|
||||||
import {
|
import {
|
||||||
EMPTY_IMAGE_DARK,
|
|
||||||
EMPTY_IMAGE_LIGHT,
|
|
||||||
INFO_IMAGE_DARK,
|
INFO_IMAGE_DARK,
|
||||||
INFO_IMAGE_LIGHT,
|
INFO_IMAGE_LIGHT,
|
||||||
RIGHT_ARROW_DARK,
|
RIGHT_ARROW_DARK,
|
||||||
@@ -43,6 +41,10 @@ export struct AiPickNodeComponent {
|
|||||||
|
|
||||||
// Tab 状态及滚动区域
|
// Tab 状态及滚动区域
|
||||||
@State tabIdx: number = 0;
|
@State tabIdx: number = 0;
|
||||||
|
|
||||||
|
private getUrl(resource: Resource): string {
|
||||||
|
return getContext(this).resourceManager.getStringSync(resource);
|
||||||
|
}
|
||||||
@State tabViewportWidth: number = 0;
|
@State tabViewportWidth: number = 0;
|
||||||
@State tabContentWidth: number = 0;
|
@State tabContentWidth: number = 0;
|
||||||
@State tabScrollOffset: number = 0;
|
@State tabScrollOffset: number = 0;
|
||||||
@@ -192,7 +194,7 @@ export struct AiPickNodeComponent {
|
|||||||
// 跳转到一句话定制策略主页。
|
// 跳转到一句话定制策略主页。
|
||||||
// todo: 后续跳转为真实的客户端页面。
|
// todo: 后续跳转为真实的客户端页面。
|
||||||
private jumpToNewHome(): void {
|
private jumpToNewHome(): void {
|
||||||
const pageUrl = 'https://fupage.10jqka.com.cn/ai-web/ai-diagnosis-home.html?sync=1';
|
const pageUrl: string = this.getUrl($r('app.string.ai_pick_home_url'));
|
||||||
const clientUrl =
|
const clientUrl =
|
||||||
`client://client.html?action=ymtz^ishiddenbar=1^mode=new^webid=2804^url=${pageUrl}^title=AI选期`;
|
`client://client.html?action=ymtz^ishiddenbar=1^mode=new^webid=2804^url=${pageUrl}^title=AI选期`;
|
||||||
console.info(`[AiPick] home url: ${clientUrl}`);
|
console.info(`[AiPick] home url: ${clientUrl}`);
|
||||||
@@ -209,7 +211,7 @@ export struct AiPickNodeComponent {
|
|||||||
// 跳转到策略详情页。
|
// 跳转到策略详情页。
|
||||||
// todo: 后续跳转为真实的客户端页面。
|
// todo: 后续跳转为真实的客户端页面。
|
||||||
private jumpToStrategyDetail(strategy: PickStrategy): void {
|
private jumpToStrategyDetail(strategy: PickStrategy): void {
|
||||||
const pageUrl = 'https://fupage.10jqka.com.cn/ai-web/ai-diagnosis-detail.html' +
|
const pageUrl: string = this.getUrl($r('app.string.ai_pick_strategy_detail_url')) +
|
||||||
`?id=${strategy.id}&type=${strategy.periodType}&name=${encodeURIComponent(strategy.name)}`;
|
`?id=${strategy.id}&type=${strategy.periodType}&name=${encodeURIComponent(strategy.name)}`;
|
||||||
const clientUrl =
|
const clientUrl =
|
||||||
`client://client.html?action=ymtz^ishiddenbar=1^mode=new^webid=2804^url=${pageUrl}^title=AI选期`;
|
`client://client.html?action=ymtz^ishiddenbar=1^mode=new^webid=2804^url=${pageUrl}^title=AI选期`;
|
||||||
@@ -230,7 +232,7 @@ export struct AiPickNodeComponent {
|
|||||||
// 跳转到策略标签页。
|
// 跳转到策略标签页。
|
||||||
// todo: 后续跳转为真实的客户端页面。
|
// todo: 后续跳转为真实的客户端页面。
|
||||||
private jumpToLabel(strategy: PickStrategy, label: string): void {
|
private jumpToLabel(strategy: PickStrategy, label: string): void {
|
||||||
const pageUrl = 'https://fupage.10jqka.com.cn/ai-web/ai-diagnosis-label.html' +
|
const pageUrl: string = this.getUrl($r('app.string.ai_pick_strategy_label_url')) +
|
||||||
`?id=${strategy.id}&type=${strategy.periodType}&label=${encodeURIComponent(label)}`;
|
`?id=${strategy.id}&type=${strategy.periodType}&label=${encodeURIComponent(label)}`;
|
||||||
const clientUrl =
|
const clientUrl =
|
||||||
`client://client.html?action=ymtz^ishiddenbar=1^mode=new^webid=2804^url=${pageUrl}^title=AI选期`;
|
`client://client.html?action=ymtz^ishiddenbar=1^mode=new^webid=2804^url=${pageUrl}^title=AI选期`;
|
||||||
@@ -509,15 +511,27 @@ export struct AiPickNodeComponent {
|
|||||||
Row({ space: 8 }) {
|
Row({ space: 8 }) {
|
||||||
Text(formatColName(this.cardData.tabs[this.tabIdx].keysList[0]))
|
Text(formatColName(this.cardData.tabs[this.tabIdx].keysList[0]))
|
||||||
.fontSize(14)
|
.fontSize(14)
|
||||||
|
.maxFontSize(14)
|
||||||
|
.minFontSize(9)
|
||||||
|
.maxLines(1)
|
||||||
|
.heightAdaptivePolicy(TextHeightAdaptivePolicy.MIN_FONT_SIZE_FIRST)
|
||||||
.fontColor($r('app.color.text_tertiary'))
|
.fontColor($r('app.color.text_tertiary'))
|
||||||
.width('35%')
|
.width('35%')
|
||||||
Text(formatColName(this.cardData.tabs[this.tabIdx].keysList[1]))
|
Text(formatColName(this.cardData.tabs[this.tabIdx].keysList[1]))
|
||||||
.fontSize(14)
|
.fontSize(14)
|
||||||
|
.maxFontSize(14)
|
||||||
|
.minFontSize(9)
|
||||||
|
.maxLines(1)
|
||||||
|
.heightAdaptivePolicy(TextHeightAdaptivePolicy.MIN_FONT_SIZE_FIRST)
|
||||||
.fontColor($r('app.color.text_tertiary'))
|
.fontColor($r('app.color.text_tertiary'))
|
||||||
.layoutWeight(1)
|
.layoutWeight(1)
|
||||||
.textAlign(TextAlign.End)
|
.textAlign(TextAlign.End)
|
||||||
Text(formatColName(this.cardData.tabs[this.tabIdx].keysList[2]))
|
Text(formatColName(this.cardData.tabs[this.tabIdx].keysList[2]))
|
||||||
.fontSize(14)
|
.fontSize(14)
|
||||||
|
.maxFontSize(14)
|
||||||
|
.minFontSize(9)
|
||||||
|
.maxLines(1)
|
||||||
|
.heightAdaptivePolicy(TextHeightAdaptivePolicy.MIN_FONT_SIZE_FIRST)
|
||||||
.fontColor($r('app.color.text_tertiary'))
|
.fontColor($r('app.color.text_tertiary'))
|
||||||
.layoutWeight(1)
|
.layoutWeight(1)
|
||||||
.textAlign(TextAlign.End)
|
.textAlign(TextAlign.End)
|
||||||
@@ -596,6 +610,11 @@ export struct AiPickNodeComponent {
|
|||||||
(item: PickContractItem) =>
|
(item: PickContractItem) =>
|
||||||
`${item.contract}_${item.market}_${item.price ?? ''}_${item.priceChg ?? ''}`,
|
`${item.contract}_${item.market}_${item.price ?? ''}_${item.priceChg ?? ''}`,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Divider()
|
||||||
|
.width('100%')
|
||||||
|
.strokeWidth(1)
|
||||||
|
.color($r('app.color.divider_color'))
|
||||||
}
|
}
|
||||||
.width('100%')
|
.width('100%')
|
||||||
}
|
}
|
||||||
@@ -625,7 +644,9 @@ export struct AiPickNodeComponent {
|
|||||||
@Builder
|
@Builder
|
||||||
EmptyState(message: ResourceStr) {
|
EmptyState(message: ResourceStr) {
|
||||||
Column() {
|
Column() {
|
||||||
Image(this.isDarkMode ? EMPTY_IMAGE_DARK : EMPTY_IMAGE_LIGHT)
|
Image(this.isDarkMode ?
|
||||||
|
$r('app.string.ai_pick_empty_image_dark_url') :
|
||||||
|
$r('app.string.ai_pick_empty_image_light_url'))
|
||||||
.width(100)
|
.width(100)
|
||||||
.height(100)
|
.height(100)
|
||||||
Text(message)
|
Text(message)
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import router from '@ohos.router';
|
import router from '@ohos.router';
|
||||||
|
import { common } from '@kit.AbilityKit';
|
||||||
|
import { preferences } from '@kit.ArkData';
|
||||||
import {
|
import {
|
||||||
CardData,
|
CardData,
|
||||||
PeriodRange,
|
PeriodRange,
|
||||||
@@ -28,9 +30,8 @@ import {
|
|||||||
|
|
||||||
const NORMAL_SIZE = 3;
|
const NORMAL_SIZE = 3;
|
||||||
const MAX_SIZE = 5;
|
const MAX_SIZE = 5;
|
||||||
const UNFOLDED_STORAGE_KEY = 'firstPageMarketRankingUnfolded';
|
const SP_FILE_NAME_FIRST_PAGE_MARKET_RANKING = 'sp_file_name_first_page_market_ranking';
|
||||||
|
const SP_KEY_FIRST_PAGE_MARKET_RANKING_EXPAND = 'sp_key_first_page_market_ranking_expand';
|
||||||
PersistentStorage.persistProp<boolean>(UNFOLDED_STORAGE_KEY, false);
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
export struct MarketRankingNodeComponent {
|
export struct MarketRankingNodeComponent {
|
||||||
@@ -42,7 +43,7 @@ export struct MarketRankingNodeComponent {
|
|||||||
// Tab 选中/展开状态是纯 UI 交互状态,留在 View 里
|
// Tab 选中/展开状态是纯 UI 交互状态,留在 View 里
|
||||||
@State primaryIdx: number = 0;
|
@State primaryIdx: number = 0;
|
||||||
@State secondaryIdx: number = 0;
|
@State secondaryIdx: number = 0;
|
||||||
@StorageLink(UNFOLDED_STORAGE_KEY) unfolded: boolean = false;
|
@State unfolded: boolean = false;
|
||||||
@State tabViewportWidth: number = 0;
|
@State tabViewportWidth: number = 0;
|
||||||
@State tabContentWidth: number = 0;
|
@State tabContentWidth: number = 0;
|
||||||
@State tabScrollOffset: number = 0;
|
@State tabScrollOffset: number = 0;
|
||||||
@@ -56,6 +57,7 @@ export struct MarketRankingNodeComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
aboutToAppear(): void {
|
aboutToAppear(): void {
|
||||||
|
this.initUnfoldedState();
|
||||||
this.updateCardConfig();
|
this.updateCardConfig();
|
||||||
emitter.on(EVENT_TCP_RECONNECT, this.tcpReconnectListener);
|
emitter.on(EVENT_TCP_RECONNECT, this.tcpReconnectListener);
|
||||||
if (!this.firstPageVisible) {
|
if (!this.firstPageVisible) {
|
||||||
@@ -527,6 +529,46 @@ export struct MarketRankingNodeComponent {
|
|||||||
// 以下是UI相关
|
// 以下是UI相关
|
||||||
private toggleUnfolded(): void {
|
private toggleUnfolded(): void {
|
||||||
this.unfolded = !this.unfolded;
|
this.unfolded = !this.unfolded;
|
||||||
|
try {
|
||||||
|
const store: preferences.Preferences | undefined = this.getPreferenceStore();
|
||||||
|
if (store === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
store.putSync(SP_KEY_FIRST_PAGE_MARKET_RANKING_EXPAND, this.unfolded);
|
||||||
|
store.flush().catch((error: Error) => {
|
||||||
|
console.error(`[MarketRanking] persist unfolded state failed: ${error.message}`);
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`[MarketRanking] persist unfolded state failed: ${JSON.stringify(error)}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private initUnfoldedState(): void {
|
||||||
|
try {
|
||||||
|
const store: preferences.Preferences | undefined = this.getPreferenceStore();
|
||||||
|
if (store === undefined) {
|
||||||
|
this.unfolded = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.unfolded =
|
||||||
|
store.getSync(SP_KEY_FIRST_PAGE_MARKET_RANKING_EXPAND, false) as boolean;
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`[MarketRanking] read unfolded state failed: ${JSON.stringify(error)}`);
|
||||||
|
this.unfolded = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private getPreferenceStore(): preferences.Preferences | undefined {
|
||||||
|
try {
|
||||||
|
const context: common.UIAbilityContext =
|
||||||
|
this.getUIContext().getHostContext() as common.UIAbilityContext;
|
||||||
|
return preferences.getPreferencesSync(context, {
|
||||||
|
name: SP_FILE_NAME_FIRST_PAGE_MARKET_RANKING,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`[MarketRanking] get preference store failed: ${JSON.stringify(error)}`);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private showTabGradient(): boolean {
|
private showTabGradient(): boolean {
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
{ "name": "color_fall", "value": "#07AB4B" },
|
{ "name": "color_fall", "value": "#07AB4B" },
|
||||||
{ "name": "color_orange", "value": "#FF661A" },
|
{ "name": "color_orange", "value": "#FF661A" },
|
||||||
{ "name": "bg_orange", "value": "#1AFF661A" },
|
{ "name": "bg_orange", "value": "#1AFF661A" },
|
||||||
{ "name": "transparent_white", "value": "#00FFFFFF" },
|
|
||||||
{ "name": "tab_gradient_start", "value": "#00FFFFFF" }
|
{ "name": "tab_gradient_start", "value": "#00FFFFFF" }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"string": [
|
||||||
|
{
|
||||||
|
"name": "ai_pick_empty_image_light_url",
|
||||||
|
"value": "https://u.thsi.cn/imgsrc/bbs/8eee9cd4fa7e359032de11a3f7c2a70b_300_230.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ai_pick_empty_image_dark_url",
|
||||||
|
"value": "https://u.thsi.cn/imgsrc/bbs/1c4e679244ed87231befad2b04cddfe2_300_230.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ai_pick_home_url",
|
||||||
|
"value": "https://fupage.10jqka.com.cn/ai-web/ai-diagnosis-home.html?sync=1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ai_pick_strategy_detail_url",
|
||||||
|
"value": "https://fupage.10jqka.com.cn/ai-web/ai-diagnosis-detail.html"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ai_pick_strategy_label_url",
|
||||||
|
"value": "https://fupage.10jqka.com.cn/ai-web/ai-diagnosis-label.html"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user