Skip to content

Commit

Permalink
订阅源跳转Web页面
Browse files Browse the repository at this point in the history
订阅源跳转Web页面
  • Loading branch information
MaoXiaoone committed Jul 17, 2024
1 parent 416e953 commit 6473597
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,16 @@ export default struct SubscriptionContent{
span:1
}){
Row(){
this.contentCoverBuilder(item.sourceName, item.sourceIcon)
this.contentCoverBuilder(item)
}
.onClick(()=>{
router.pushUrl({
url: 'pages/view/Subscription/rssWebView',
params: {
url: item.sourceUrl
}
})
})
.gesture(
LongPressGesture({ repeat: true,duration:1000 })
.onAction((event: GestureEvent) => {
Expand All @@ -131,8 +139,16 @@ export default struct SubscriptionContent{
ForEach(this.contentList,(item:rssSources,index:number)=>{
if (index >= 2) {
GridCol(){
this.contentListBuilder(item.sourceName, item.sourceIcon)
this.contentListBuilder(item)
}
.onClick(()=>{
router.pushUrl({
url: 'pages/view/Subscription/rssWebView',
params: {
url: item.sourceUrl
}
})
})
.gesture(
LongPressGesture({ repeat: true,duration:500 })
.onAction((event: GestureEvent) => {
Expand Down Expand Up @@ -237,7 +253,7 @@ export default struct SubscriptionContent{
}

@Builder
contentCoverBuilder(title:string, icon:string| Resource){
contentCoverBuilder(item:rssSources){
Row({
space:12
}){
Expand All @@ -249,7 +265,7 @@ export default struct SubscriptionContent{
.width(ImageConstants.IMG_WIDTH_40)
.height(ImageConstants.IMG_HEIGHT_40)
.borderRadius(4)
Text(title)
Text(item.sourceName)
.font({
size:14,
weight:FontConstants.FONT_WEIGHT_500,
Expand All @@ -267,7 +283,7 @@ export default struct SubscriptionContent{
}

@Builder
contentListBuilder(title:string, icon:string| Resource){
contentListBuilder(item:rssSources){
Column({
space: CommonConstants.SPACE_6
}){
Expand All @@ -280,7 +296,7 @@ export default struct SubscriptionContent{
.height(ImageConstants.IMG_HEIGHT_40)
.borderRadius(4)

Text(`${title}`).fontSize(10)
Text(`${item.sourceName}`).fontSize(10)
.fontColor($r('app.string.color_black_88'))
.lineHeight(18)
.fontFamily(CommonConstants.FAMILY_PingFANG)
Expand Down
42 changes: 42 additions & 0 deletions entry/src/main/ets/pages/view/Subscription/rssWebView.ets
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import web_webview from '@ohos.web.webview'
import { router } from '@kit.ArkUI';
import { showMessage } from '../../../componets/common/promptShow';

interface RouteParams {
url: string,
}

@Entry
@Component
struct RssWebView {
@State sourcesUrl:string = ''
@StorageLink('topRectHeight') topRectHeight: number = 0
@StorageLink('bottomRectHeight') bottomRectHeight: number = 0
aboutToAppear(): void {
const params = router.getParams() as RouteParams;
this.sourcesUrl = params.url
showMessage(this.sourcesUrl)
console.log("url:" + this.sourcesUrl)
}
controller: web_webview.WebviewController = new web_webview.WebviewController()
build() {
Column(){
Row({ space: 15 }) {
Image($r('app.media.return_left'))
.width(25)
.height(25)
.onClick(()=>{
router.back()
})
}
.height(30)
.margin({left:5})
.width("100%")
Column(){
Web({ src: this.sourcesUrl, controller: this.controller })
}

}
.padding({top:this.topRectHeight, bottom:this.bottomRectHeight + 20})
}
}
3 changes: 2 additions & 1 deletion entry/src/main/resources/base/profile/main_pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"pages/view/Reader/ReaderPage",
"pages/view/Find/BookSource/Index",
"pages/view/Find/BookSource/AddSourcePage",
"pages/view/Subscription/components/SubscriptionSearch"
"pages/view/Subscription/components/SubscriptionSearch",
"pages/view/Subscription/rssWebView"
]
}

0 comments on commit 6473597

Please sign in to comment.