|
|
@@ -0,0 +1,83 @@
|
|
|
+import { KnowledgeMapContent, Section } from '../view/KnowledgeMapContent';
|
|
|
+import { NavBarItem, NavBarItemType } from '../view/NavBarItem';
|
|
|
+import { BusinessError } from '@kit.BasicServicesKit';
|
|
|
+import { util } from '@kit.ArkTS';
|
|
|
+
|
|
|
+@Preview
|
|
|
+@Component
|
|
|
+export struct KnowledgeMap {
|
|
|
+ @Provide('knowledgeMapPageStack') knowledgeMapPageStack: NavPathStack = new NavPathStack();
|
|
|
+ @State navBarList: NavBarItemType[] =
|
|
|
+ [{ order: '01', title: '准备学习' }, { order: '02', title: '构建应用' }, { order: '03', title: '应用测试' },
|
|
|
+ { order: '04', title: '上架' }, { order: '05', title: '运营增长' }, { order: '06', title: '商业变现' },
|
|
|
+ { order: '07', title: '跟多' }];
|
|
|
+ @State sections: Section[] = [];
|
|
|
+ @State currentNavBarIndex: number = -1;
|
|
|
+
|
|
|
+ @Builder
|
|
|
+ PageMap(name: string) {
|
|
|
+ if (name === 'KnowledgeMapContent') {
|
|
|
+ KnowledgeMapContent({ section: this.sections[this.currentNavBarIndex] });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ aboutToAppear(): void {
|
|
|
+ this.getSections();
|
|
|
+ }
|
|
|
+
|
|
|
+ build() {
|
|
|
+ Navigation(this.knowledgeMapPageStack) {
|
|
|
+ Scroll() {
|
|
|
+ Column() {
|
|
|
+ Text('知识图谱')
|
|
|
+ .fontFamily("HarmonyHeiTi-Bold")
|
|
|
+ .fontSize(24)
|
|
|
+ .fontColor(Color.Black)
|
|
|
+ .textAlign(TextAlign.Start)
|
|
|
+ .lineHeight(33)
|
|
|
+ .fontWeight(700)
|
|
|
+ .width('100%')
|
|
|
+
|
|
|
+ Image($r('app.media.knowledge_map_banner')).width('100%').borderRadius(16).margin({ top: 19, bottom: 8 })
|
|
|
+
|
|
|
+ Text('通过循序渐进的学习路径,无经验和有经验的开发者都可以轻松掌握ArkTS语言声明式开发范式,体验更简洁、更友好的HarmonyOS应用开发旅程。')
|
|
|
+ .fontFamily('HarmonyHeiTi')
|
|
|
+ .fontSize(14)
|
|
|
+ .fontColor('rgba(0,0,0,0.60)')
|
|
|
+ .fontWeight(600)
|
|
|
+ .textAlign(TextAlign.Start)
|
|
|
+
|
|
|
+ List({ space: 12 }) {
|
|
|
+ ForEach(this.navBarList, (item: NavBarItemType) => {
|
|
|
+ ListItem() {
|
|
|
+ NavBarItem({ navBarItem: item, currentNavBarIndex: this.currentNavBarIndex })
|
|
|
+ }.width('100%')
|
|
|
+ }, (item: NavBarItemType) => item.title)
|
|
|
+ }.width('100%').margin({ top: 24 })
|
|
|
+ }.padding({
|
|
|
+ top: 12,
|
|
|
+ right: 16,
|
|
|
+ bottom: 12,
|
|
|
+ left: 16
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .backgroundColor("#F1F3F5")
|
|
|
+ .align(Alignment.TopStart)
|
|
|
+ .constraintSize({ minHeight: '100%' })
|
|
|
+ .edgeEffect(EdgeEffect.Spring)
|
|
|
+ }.hideTitleBar(true).navDestination(this.PageMap).mode(NavigationMode.Stack)
|
|
|
+ }
|
|
|
+
|
|
|
+ private getSections() {
|
|
|
+ try {
|
|
|
+ this.getUIContext().getHostContext()?.resourceManager.getRawFileContent("MapData.json",
|
|
|
+ (_err: BusinessError, value: Uint8Array) => {
|
|
|
+ const textDecoder = util.TextDecoder.create('utf-8', { ignoreBOM: true });
|
|
|
+ const res = textDecoder.decodeToString(value)
|
|
|
+ this.sections = JSON.parse(res) as Section[]
|
|
|
+ });
|
|
|
+ } catch (err) {
|
|
|
+ console.error(`callback getRawFileContent failed, err is ${JSON.stringify(err)}`);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|