diff --git a/OAT.xml b/OAT.xml index 00823cbb19069888bca94342a2f5cb785651c7a6..c7b991c95ef3d25e762cfc5c033cbadd484faf85 100644 --- a/OAT.xml +++ b/OAT.xml @@ -209,6 +209,24 @@ Note:If the text contains special characters, please escape them according to th + + + + + + + + + + + + + + + + + + @@ -1488,7 +1506,7 @@ Note:If the text contains special characters, please escape them according to th - + @@ -2224,6 +2242,11 @@ Note:If the text contains special characters, please escape them according to th + + + + + diff --git a/code/ArkTS1.2/ContainernestedslideSample/entry/build-profile.json5 b/code/ArkTS1.2/ContainernestedslideSample/entry/build-profile.json5 index 8ac81840b69fd7c78c2024c6570ed01e4292cf6d..36f9e65afb2abbbbdda625e86543807eee16240c 100644 --- a/code/ArkTS1.2/ContainernestedslideSample/entry/build-profile.json5 +++ b/code/ArkTS1.2/ContainernestedslideSample/entry/build-profile.json5 @@ -1,6 +1,31 @@ +/** + * + * Copyright (c) 2025 Huawei Device Co., Ltd. + * + * All rights reserved. + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice,this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS, + * + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + { "apiType": "stageMode", - "arkTSVersion": "1.2", "buildOption": { }, "buildOptionSet": [ diff --git a/code/ArkTS1.2/ContainernestedslideSample/entry/hvigorfile.ts b/code/ArkTS1.2/ContainernestedslideSample/entry/hvigorfile.ts index c6edcd90486dd5a853cf7d34c8647f08414ca7a3..8f830cdfd5bfdd8bde92ebfc27fc0562423dca3d 100644 --- a/code/ArkTS1.2/ContainernestedslideSample/entry/hvigorfile.ts +++ b/code/ArkTS1.2/ContainernestedslideSample/entry/hvigorfile.ts @@ -1,3 +1,29 @@ +/** + * + * Copyright (c) 2025 Huawei Device Co., Ltd. + * + * All rights reserved. + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice,this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS, + * + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + import { hapTasks } from '@ohos/hvigor-ohos-plugin'; export default { diff --git a/code/ArkTS1.2/ContainernestedslideSample/entry/oh-package.json5 b/code/ArkTS1.2/ContainernestedslideSample/entry/oh-package.json5 index 248c3b7541a589682a250f86a6d3ecf7414d2d6a..39ab3f901494a87d5ab258dfaa9e6882de1f5166 100644 --- a/code/ArkTS1.2/ContainernestedslideSample/entry/oh-package.json5 +++ b/code/ArkTS1.2/ContainernestedslideSample/entry/oh-package.json5 @@ -1,3 +1,29 @@ +/** + * + * Copyright (c) 2025 Huawei Device Co., Ltd. + * + * All rights reserved. + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice,this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS, + * + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + { "name": "entry", "version": "1.0.0", diff --git a/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/ets/components/CommentPage.ets b/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/ets/components/CommentPage.ets index 2e08beb392d7df66b843f288f3b62f20e6031e06..fbc61b194b9e00118343b9a927b0ce5ab5675786 100644 --- a/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/ets/components/CommentPage.ets +++ b/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/ets/components/CommentPage.ets @@ -1,20 +1,33 @@ -/* +/** + * * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * All rights reserved. + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice,this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. * - * 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. + * THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS, + * + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + import { NewsCommentModel } from '../model/NewsCommentModel'; -import { Date, Column, Row, VerticalAlign, HorizontalAlign, Image, $r, Text, Span, ImageFit, Blank, Margin, Padding, Component } from '@ohos.arkui.component'; -import { State, StateDecoratedVariable, MutableState, stateOf, observableProxy } from '@ohos.arkui.stateManagement'; +import { Date, Column, Row, VerticalAlign, HorizontalAlign, Image, $r, Text, Span, ImageFit, Blank, Margin, + Padding, Component } from '@ohos.arkui.component'; +import { State, MutableState, stateOf, observableProxy } from '@ohos.arkui.stateManagement' const FONT_WEIGHT_FIVE_HUNDRED = 500; const FONT_WEIGHT_FOUR_HUNDRED = 400; @@ -22,6 +35,7 @@ const FONT_WEIGHT_FOUR_HUNDRED = 400; @Component export struct CommentPage { commonData: NewsCommentModel = new NewsCommentModel('', '', '', '', '', '', new Date()); + build() { Column() { Row() { @@ -37,11 +51,6 @@ export struct CommentPage { .fontSize(14) .fontWeight(FONT_WEIGHT_FIVE_HUNDRED) .fontColor('#000000') - Span((new Date().getTime() - this.commonData.commentTime.getTime()) / 1000 <= 5 ? ' 刚刚·杭州' : ' 昨天23:24·杭州') - .fontSize(14) - .fontWeight(FONT_WEIGHT_FOUR_HUNDRED) - .opacity(0.5) - .fontColor('#000000') } .width('80%') .margin({ bottom: 6 } as Margin) diff --git a/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/ets/entryability/EntryAbility.ets b/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/ets/entryability/EntryAbility.ets index fe3b52c13f8a90b35013af247f9b5b01443c2fcf..0ec1e50072e5222f0cf60bc4c743bd0d58fc210a 100644 --- a/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/ets/entryability/EntryAbility.ets +++ b/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/ets/entryability/EntryAbility.ets @@ -1,17 +1,3 @@ -/* - * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ import UIAbility from '@ohos.app.ability.UIAbility'; import AbilityConstant from '@ohos.app.ability.AbilityConstant'; import Want from '@ohos.app.ability.Want'; diff --git a/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/ets/mock/NewsDetailData.ets b/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/ets/mock/NewsDetailData.ets index 553624dc01967b043ca04f37a863fff636ec4f37..8ffc083f638202c03726f9706611584c5a4f983e 100644 --- a/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/ets/mock/NewsDetailData.ets +++ b/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/ets/mock/NewsDetailData.ets @@ -1,30 +1,59 @@ -/* +/** + * * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * All rights reserved. + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice,this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. * - * 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. + * THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS, + * + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + import { NewsCommentModel } from '../model/NewsCommentModel'; import { $r } from '@ohos.arkui.component'; export function mockData(): Array { const commentList: Array = new Array(); - commentList.push(new NewsCommentModel('1', $r('app.media.news_image_1'), '你若安好便是晴天', '', '', '国足加油!国足必胜!', new Date('2024-11-01 23:00:00'))) - commentList.push(new NewsCommentModel('2', $r('app.media.news_image_2'), '天要下雨娘要嫁人', '', '', '来点信心,加油加油~', new Date('2024-11-01 23:00:00'))) - commentList.push(new NewsCommentModel('3', $r('app.media.news_image_3'), '太阳打北边出来了', '', '', '下一场什么时候,有直播吗', new Date('2024-11-01 23:00:00'))) - commentList.push(new NewsCommentModel('4', $r('app.media.news_image_4'), '西红柿炒鸡蛋蛋卷(特辣)', '', '', '教练组的战术调整值得肯定,尤其是在中场控制方面有所改善。', new Date('2024-11-01 23:00:00'))) - commentList.push(new NewsCommentModel('5', $r('app.media.news_image_6'), '东边有个塔玛,西边有个喇嘛', '', '', '期待他们在未来的比赛中继续进步!', new Date('2024-11-01 23:00:00'))) - commentList.push(new NewsCommentModel('7', $r('app.media.news_image_7'), '天青色等烟雨而我在等你', '', '', '希望他们能在接下来的比赛中继续发挥,成为球队的中坚力量。',new Date('2024-11-01 23:00:00'))) - commentList.push(new NewsCommentModel('8', $r('app.media.news_image_8'), '大事不妙了', '', '', '与世界强队的差距依然显著,继续努力吧。', new Date('2024-11-01 23:00:00'))) - commentList.push(new NewsCommentModel('9', $r('app.media.news_image_5'), '小猫带耳机', '', '', '国足必胜,加油加油。', new Date('2024-11-01 23:00:00'))) + commentList.push(new NewsCommentModel( + '1', $r('app.media.news_image_1'), '你若安好便是晴天', '', '', '国足加油!国足必胜!', new Date('2024-11-01 23:00:00')) + ) + commentList.push(new NewsCommentModel( + '2', $r('app.media.news_image_2'), '天要下雨娘要嫁人', '', '', '来点信心,加油加油~', new Date('2024-11-01 23:00:00')) + ) + commentList.push(new NewsCommentModel( + '3', $r('app.media.news_image_3'), '太阳打北边出来了', '', '', '下一场什么时候,有直播吗', new Date('2024-11-01 23:00:00')) + ) + commentList.push(new NewsCommentModel( + '4', $r('app.media.news_image_4'), '西红柿炒鸡蛋蛋卷(特辣)', '', '', '教练组的战术调整值得肯定,尤其是在中场控制方面有所改善。', + new Date('2024-11-01 23:00:00')) + ) + commentList.push(new NewsCommentModel( + '5', $r('app.media.news_image_6'), '东边有个塔玛,西边有个喇嘛', '', '', '期待他们在未来的比赛中继续进步!', new Date('2024-11-01 23:00:00')) + ) + commentList.push(new NewsCommentModel( + '7', $r('app.media.news_image_7'), '等烟雨而我在等你', '', '', '希望接下来的比赛中继续发挥,成为球队的中坚力量。',new Date('2024-11-01 23:00:00')) + ) + commentList.push(new NewsCommentModel( + '8', $r('app.media.news_image_8'), '大事不妙了', '', '', '与世界强队的差距依然显著,继续努力吧。', new Date('2024-11-01 23:00:00')) + ) + commentList.push(new NewsCommentModel( + '9', $r('app.media.news_image_5'), '小猫带耳机', '', '', '国足必胜,加油加油。', new Date('2024-11-01 23:00:00')) + ) return commentList; } diff --git a/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/ets/model/NewsCommentModel.ets b/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/ets/model/NewsCommentModel.ets index 03c10526ed8190501efc715cae7e7f293831dff9..a338c54e72da6ecadbec5556355113cf44562c9c 100644 --- a/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/ets/model/NewsCommentModel.ets +++ b/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/ets/model/NewsCommentModel.ets @@ -1,17 +1,29 @@ -/* +/** + * * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * All rights reserved. + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice,this + * list of conditions and the following disclaimer. * - * 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. + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS, + * + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + import { ResourceStr, Date, DataChangeListener, IDataSource } from '@ohos.arkui.component'; /** @@ -32,10 +44,9 @@ export class NewsCommentModel { public text: string; // 回复时间 public commentTime: Date; - // 评论下的回复列表 - constructor(id: string, url: ResourceStr, user: string, replyId: string, - replyUser: string, text: string, commentTime: Date) { + constructor( + id: string, url: ResourceStr, user: string, replyId: string, replyUser: string, text: string, commentTime: Date) { this.id = id; this.url = url; this.user = user; diff --git a/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/ets/pages/CommentInputPage.ets b/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/ets/pages/CommentInputPage.ets new file mode 100644 index 0000000000000000000000000000000000000000..ff3aa2d76ff113183a2507329cfbcc66b3c12a24 --- /dev/null +++ b/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/ets/pages/CommentInputPage.ets @@ -0,0 +1,63 @@ +/** + * + * Copyright (c) 2025 Huawei Device Co., Ltd. + * + * All rights reserved. + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice,this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS, + * + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import { UIContext } from '@ohos.arkui.UIContext'; +import { Column, Row, TextInput, EditableTextOnChangeCallback, Button, ClickEvent, Padding, + Margin, Entry, Component } from '@ohos.arkui.component'; +import { AppStorage, State, MutableState, stateOf, observableProxy } from '@ohos.arkui.stateManagement'; + +@Entry +@Component +struct CommentInputPage { + @State text: string = ''; + + build() { + Row() { + TextInput({ placeholder: '@', text: this.text }) + .layoutWeight(1) + .height(40) + .padding({ left: 10, right: 50, top: 3, bottom: 3 } as Padding) + .onChange((textInComment: string) => { + this.text = textInComment; + } as EditableTextOnChangeCallback) + + Button('发布') + .width(60) + .height(30) + .borderRadius(15) + .backgroundColor('#ed394b') + .fontColor('#ffffff') + .margin({ left: 10 } as Margin) + .onClick((e: ClickEvent) => { + AppStorage.setOrCreate('PropA', this.text); + this.getUIContext().getRouter().back(); + }) + } + .width('100%') + .padding(10) + .height(50) + } +} \ No newline at end of file diff --git a/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/ets/pages/Index.ets b/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/ets/pages/Index.ets index 13ee2940ba8bdd181f50c8f4aebdf2665f1e2177..375dddfabf38766b02fed3f8f4f2be6bd94f5d6c 100644 --- a/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/ets/pages/Index.ets +++ b/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/ets/pages/Index.ets @@ -1,26 +1,41 @@ -/* +/** + * * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * All rights reserved. + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice,this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. * - * 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. + * THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS, + * + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { memo, __memo_context_type, __memo_id_type } from '@ohos.arkui.stateManagement' + +import { memo, __memo_context_type, __memo_id_type } from "@ohos.arkui.stateManagement"; import { curUser, mockData } from '../mock/NewsDetailData'; import { NewsCommentModel } from '../model/NewsCommentModel'; import { CommentPage } from '../components/CommentPage'; import { UIContext } from '@ohos.arkui.UIContext'; -import hilog from '@ohos.hilog' +import hilog from '@ohos.hilog'; import util from '@ohos.util'; -import { Row, FlexAlign, HorizontalAlign, Column, Stack, Alignment, Image, ImageFit, $r, Text, TextAlign, ImageSpan, ImageSpanAlignment, Span, Scroll, ScrollState, OnScrollFrameBeginHandlerResult, OnScrollFrameBeginCallback, Scroller, ScrollDirection, ScrollAlign, BarState, Search, List, ListItem, ListItemAlign, ForEach, Blank, Color, Margin, Padding, Builder, ClickEvent, Component, UserView } from '@ohos.arkui.component' -import { AppStorage, StorageProp, State, StateDecoratedVariable, MutableState, stateOf, observableProxy } from '@ohos.arkui.stateManagement' +import { Row, FlexAlign, HorizontalAlign, Column, Stack, Alignment, Image, ImageFit, $r, Text, TextAlign, ImageSpan, + ImageSpanAlignment, Span, Scroll, ScrollState, OnScrollFrameBeginHandlerResult, OnScrollFrameBeginCallback, + Scroller, ScrollDirection, ScrollAlign, BarState, Search, List, ListItem, ListItemAlign, ForEach, Blank, Color, + Margin, Padding, Builder, ClickEvent, Component, UserView } from "@ohos.arkui.component"; +import { AppStorage, StorageProp, State, MutableState, stateOf, observableProxy } from "@ohos.arkui.stateManagement"; const SEARCH_BUTTON: string = '搜索'; AppStorage.setOrCreate('PropA', ''); @@ -45,7 +60,9 @@ struct MyStateSample { publishComment(): void { const uuid: string = util.generateRandomUUID(); - const comment: NewsCommentModel = new NewsCommentModel(uuid, $r('app.media.news_user_select'), this.curUser, '', '', this.storage, new Date()); + const comment: NewsCommentModel = new NewsCommentModel( + uuid, $r('app.media.news_user_select'), this.curUser, '', '', this.storage, new Date() + ); this.commentList.unshift(comment); this.commentList = [...this.commentList]; this.listScroller.scrollToIndex(0, true, ScrollAlign.START); @@ -53,13 +70,13 @@ struct MyStateSample { build() { Column() { - this.title() + this.title(); Scroll(this.scroller) { Column() { - this.newsBuilder() - this.CommentTitle() - this.listBuilder() + this.newsBuilder(); + this.CommentTitle(); + this.listBuilder(); } .width('100%') } @@ -76,7 +93,7 @@ struct MyStateSample { .border({ width: 1, color: '#eeeeee' }) .padding({ left: 15 } as Padding) .onClick((e: ClickEvent) => { - this.getUIContext().getRouter().pushUrl({ url: 'pages/CommentInputPage' }); + this.getUIContext().getRouter().pushUrl({ url: "pages/CommentInputPage" }); }) PublishView() } @@ -176,11 +193,19 @@ struct MyStateSample { .borderRadius(6) .margin({ top: 10, bottom: 10 } as Margin) Text('直播吧10月15日讯 ;对于今晚国足主场对阵印尼的18强赛第4轮比赛,上观新闻发文进行了分析,认为国足对阵印尼67年不败金身若被破,主教练伊万科维奇很可能会就此下课。\n\n' + - '10月15日,青岛青春足球场,克罗地亚籍主教练伊万科维奇执教的中国男足,将在这里交锋2026美加墨世界杯亚洲区18强赛C组的第四个对手——印尼队。尽管历史数据一片光明:国足对阵印尼足球已保持67年不败,历史上更有多次5比0的大比分赢球,然而,保守固执的伊万科维奇用兵迟缓,印尼足球通过归化迅速提升实力,国足此番交锋印尼很有可能迎来颠覆此前历史数据的惊人一幕。\n\n' + - '客场负于澳大利亚队后,中国队主教练伊万科维奇曾表示,对阵印尼队是“真正战斗的开始”。伊万的目标很明确:前三场的对手——日本、沙特和澳大利亚队,都是亚洲一流强队,国足连输三场从结果来说是赛前能想到的;但是,如果要争取小组第四,以获得下阶段比赛的资格,国足就要力争在主场击败印尼队,全取三分。\n\n' + - '其实,在伊万科维奇执教国足在大连11打10竟也能被少一人的沙特队逆转后,中国足协就有过换帅的想法,但被更高层面的机构否定。逃过一劫的伊万科维奇继续获得了两轮执教机会,但更衣室内球员对他的信任已经降至冰点,全国媒体、球迷也缺乏对这位老帅的足够信任。毕竟,国足3场丢了12个球,其中6个都是头球、4个是定位球失分,这些数据足以表明,伊万科维奇领衔的教练组工作不及格,备战不到位。此外,伊万科维奇在人员选拔、战术设计、临场指挥、责任担当等诸多环节,也存在不小的争议。\n\n' + - '有媒体也直接提问伊万科维奇,“过去三场比赛都有补时丢球、定位球失球,教练组是否解决了问题,你的压力大不大?”这位70岁老帅的回答,其实更多像是推卸责任,他再一次甩锅给球员,“我们在补时丢了一些球,具体是5个球,其中有4个是定位球。球员的注意力要更集中,我们要更强调注意力集中到最后一分钟,但不可忽视的是,前三个对手都是小组最强的球队,是亚洲一流球队,长期参加世界杯,比赛难度可想而知。我作为职业教练,四十年的执教经历让我有能力抵抗压力。有机会挑战压力时,我也愿意承担压力。”\n\n' + - '尽管伊万科维奇在输球后从来只会甩锅,但如果此番国足在主场依旧无法取得满意的成绩,遭遇世预赛史无前例的四连败。尤其是国足对阵印尼67年不败金身在青岛被破,第四次引发广大球迷、媒体对教练组的强烈质疑,中国足协大概率会考虑换帅事宜。') + '10月15日,青岛青春足球场,克罗地亚籍主教练伊万科维奇执教的中国男足,将在这里交锋2026美加墨世界杯亚洲区18强赛C组的第四个对手——印尼队。' + + '尽管历史数据一片光明:国足对阵印尼足球已保持67年不败,历史上更有多次5比0的大比分赢球,然而,保守固执的伊万科维奇用兵迟缓,印尼足球通过归化迅速提升实力,' + + '国足此番交锋印尼很有可能迎来颠覆此前历史数据的惊人一幕。\n\n' + + '客场负于澳大利亚队后,中国队主教练伊万科维奇曾表示,对阵印尼队是“真正战斗的开始”。伊万的目标很明确:前三场的对手——日本、沙特和澳大利亚队,都是亚洲一流强队,' + + '国足连输三场从结果来说是赛前能想到的;但是,如果要争取小组第四,以获得下阶段比赛的资格,国足就要力争在主场击败印尼队,全取三分。\n\n' + + '其实,在伊万科维奇执教国足在大连11打10竟也能被少一人的沙特队逆转后,中国足协就有过换帅的想法,但被更高层面的机构否定。逃过一劫的伊万科维奇继续获得了两轮执教机会,' + + '但更衣室内球员对他的信任已经降至冰点,全国媒体、球迷也缺乏对这位老帅的足够信任。毕竟,国足3场丢了12个球,其中6个都是头球、4个是定位球失分,这些数据足以表明,' + + '伊万科维奇领衔的教练组工作不及格,备战不到位。此外,伊万科维奇在人员选拔、战术设计、临场指挥、责任担当等诸多环节,也存在不小的争议。\n\n' + + '有媒体也直接提问伊万科维奇,“过去三场比赛都有补时丢球、定位球失球,教练组是否解决了问题,你的压力大不大?”这位70岁老帅的回答,其实更多像是推卸责任,他再一次甩锅给球员,' + + '“我们在补时丢了一些球,具体是5个球,其中有4个是定位球。球员的注意力要更集中,我们要更强调注意力集中到最后一分钟,但不可忽视的是,前三个对手都是小组最强的球队,是亚洲一流球队,' + + '长期参加世界杯,比赛难度可想而知。我作为职业教练,四十年的执教经历让我有能力抵抗压力。有机会挑战压力时,我也愿意承担压力。”\n\n' + + '尽管伊万科维奇在输球后从来只会甩锅,但如果此番国足在主场依旧无法取得满意的成绩,遭遇世预赛史无前例的四连败。尤其是国足对阵印尼67年不败金身在青岛被破,第四次引发广大球迷、' + + '媒体对教练组的强烈质疑,中国足协大概率会考虑换帅事宜。') .fontSize(18) .lineHeight(20) .margin({ top: 10, bottom: 20 } as Margin) diff --git a/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/module.json5 b/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/module.json5 index be9a180b17d16103d064486125aa400d38c538ba..cca7656f5308dac3ecbf78c69f40fb1c89c8ec6a 100644 --- a/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/module.json5 +++ b/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/module.json5 @@ -1,3 +1,29 @@ +/** + * + * Copyright (c) 2025 Huawei Device Co., Ltd. + * + * All rights reserved. + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice,this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS, + * + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + { "module": { "name": "entry", @@ -5,13 +31,14 @@ "description": "$string:module_desc", "mainElement": "EntryAbility", "deviceTypes": [ - "default", + "phone", "tablet", + "2in1" ], "requestPermissions": [ { "name": "ohos.permission.INTERNET" - } + }, ], "deliveryWithInstall": true, "installationFree": false, diff --git a/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/resources/base/profile/main_pages.json b/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/resources/base/profile/main_pages.json index 33a191c20c13d6f76b284811c3ef8923be39c88b..8d14454d75e4f0bfd8192dcd481552ea144cbd63 100644 --- a/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/resources/base/profile/main_pages.json +++ b/code/ArkTS1.2/ContainernestedslideSample/entry/src/main/resources/base/profile/main_pages.json @@ -3,4 +3,4 @@ "pages/Index", "pages/CommentInputPage" ] -} \ No newline at end of file +} diff --git a/code/ArkTS1.2/ContainernestedslideSample/ohosTest.md b/code/ArkTS1.2/ContainernestedslideSample/ohosTest.md index 6eee4f85025653311c789ec40358ab7e6acbf725..c8bc08fe70d45fd9d0fd780cafece6817ef43af0 100644 --- a/code/ArkTS1.2/ContainernestedslideSample/ohosTest.md +++ b/code/ArkTS1.2/ContainernestedslideSample/ohosTest.md @@ -4,6 +4,5 @@ | 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 | |-----------------------------------|-------------------------------------|----------------------|------------------------------------|------|------| -| 页面滑动切换 | 1. 需在真机测试
2. 构建并安装测试hap
3.启动测试hap| 1、触摸tab内容滑动,距离不足一半
2、tab内容滑动距离大于一半 | 1、背景条自动回弹
2、背景条会移动到下一个页签,页面切换成功 | 否 | Pass | | 页面滑动是否正常显示 | 1. 需在真机测试
2. 构建并安装测试hap
3.启动测试hap| 1、进入页面,滑动页面到底部
2、在页面底部时,滑动页面到顶部 | 1、可以滑动到底,无明显卡顿
2、可以滑动到顶,无明显卡顿| 否 | Pass | | 发布或回复评论 | 1. 需在真机测试
2. 构建并安装测试hap
3.启动测试hap| 1、输入内容,点击发布按钮
2、点击"回复",评论内容,点击发布按钮 | 1、新增评论在评论顶最新一条出现
2、评论的文字成功显示 | 否 | Pass | \ No newline at end of file