|
@@ -1,20 +1,76 @@
|
|
|
-@Entry
|
|
|
+import { SZYXLocalStorageHelper, SZYXLocalStorageKeys, WindowHelper } from '@szyx/sdk_base';
|
|
|
+import { RouterBuilder, RouterKeys } from './RouterBuilder';
|
|
|
+
|
|
|
+@Entry(SZYXLocalStorageHelper.storage)
|
|
|
@Component
|
|
|
struct Index {
|
|
|
+ @Provide('pageInfos') pageInfos: NavPathStack = new NavPathStack()
|
|
|
@State message: string = 'Hello World';
|
|
|
+ @State isLoading: boolean = false
|
|
|
+ @State isOut: boolean = false
|
|
|
+ @LocalStorageLink(SZYXLocalStorageKeys.HttpHandlerListLength) @Watch('loadingChange') handlerLength: number = 0
|
|
|
+
|
|
|
+ loadingChange() {
|
|
|
+ if (this.handlerLength > 0 && !this.isLoading && !this.isOut) {
|
|
|
+ this.isOut = true
|
|
|
+ setTimeout(() => {
|
|
|
+ this.isOut = false
|
|
|
+ if (this.handlerLength > 0) {
|
|
|
+ this.isLoading = true
|
|
|
+ }
|
|
|
+ }, 300)
|
|
|
+ } else if (this.handlerLength == 0) {
|
|
|
+ this.isLoading = false
|
|
|
+ this.isOut = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ aboutToAppear(): void {
|
|
|
+ WindowHelper.setWindowLayoutFullScreen(true)
|
|
|
+ WindowHelper.hideStatusBar()
|
|
|
+ }
|
|
|
|
|
|
build() {
|
|
|
- RelativeContainer() {
|
|
|
- Text(this.message)
|
|
|
- .id('HelloWorld')
|
|
|
- .fontSize(50)
|
|
|
- .fontWeight(FontWeight.Bold)
|
|
|
- .alignRules({
|
|
|
- center: { anchor: '__container__', align: VerticalAlign.Center },
|
|
|
- middle: { anchor: '__container__', align: HorizontalAlign.Center }
|
|
|
+ Stack() {
|
|
|
+ Navigation(this.pageInfos) {
|
|
|
+ Column() {
|
|
|
+
|
|
|
+ Text(this.message)
|
|
|
+ .id('HelloWorld')
|
|
|
+ .fontSize(50)
|
|
|
+ .fontWeight(FontWeight.Bold)
|
|
|
+ .alignRules({
|
|
|
+ center: { anchor: '__container__', align: VerticalAlign.Center },
|
|
|
+ middle: { anchor: '__container__', align: HorizontalAlign.Center }
|
|
|
+ })
|
|
|
+ .onClick(() => {
|
|
|
+ this.pageInfos.pushPathByName(RouterKeys.Login, undefined)
|
|
|
+ })
|
|
|
+
|
|
|
+ }.width('100%').height('100%')
|
|
|
+ .linearGradient({
|
|
|
+ // 0点方向顺时针旋转为正向角度,线性渐变起始角度的默认值为180°
|
|
|
+ colors: [
|
|
|
+ [0xC1E7FC, 0], // 颜色断点1的颜色和比重,对应组件在180°方向上的起始位置
|
|
|
+ [0xffffff, 1.0],// 颜色断点2的颜色和比重,对应组件在180°方向上的终点位置
|
|
|
+ ]
|
|
|
})
|
|
|
+
|
|
|
+ }.navDestination(RouterBuilder).hideTitleBar(true)
|
|
|
+
|
|
|
+ Column() {
|
|
|
+ LoadingProgress()
|
|
|
+ .color(Color.White)
|
|
|
+ .width(80).height(80)
|
|
|
+ Text('努力加载中..')
|
|
|
+ .fontSize(16)
|
|
|
+ .fontColor(Color.White)
|
|
|
+ }
|
|
|
+ .visibility(this.isLoading ? Visibility.Visible : Visibility.None)
|
|
|
+ .width('100%')
|
|
|
+ .height('100%')
|
|
|
+ .backgroundColor('#40000000')
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
}
|
|
|
- .height('100%')
|
|
|
- .width('100%')
|
|
|
}
|
|
|
}
|