zhenghy
@@ -8,6 +8,7 @@ import { ENewspaperCalendarDialog } from '../dialog/ENewspaperCalendarDialog'; @@ -8,6 +8,7 @@ import { ENewspaperCalendarDialog } from '../dialog/ENewspaperCalendarDialog';
8 import font from '@ohos.font'; 8 import font from '@ohos.font';
9 import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog'; 9 import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog';
10 import { RMCalendarBean } from './calendar/RMCalendarBean'; 10 import { RMCalendarBean } from './calendar/RMCalendarBean';
  11 +import { newsSkeleton } from './skeleton/newsSkeleton';
11 12
12 @Component 13 @Component
13 export struct ENewspaperPageComponent { 14 export struct ENewspaperPageComponent {
@@ -63,13 +64,15 @@ export struct ENewspaperPageComponent { @@ -63,13 +64,15 @@ export struct ENewspaperPageComponent {
63 customStyle: true, 64 customStyle: true,
64 }) 65 })
65 //文字报纸弹框 66 //文字报纸弹框
66 - listDialogController: CustomDialogController = new CustomDialogController({  
67 - builder: ENewspaperListDialog({  
68 - newspaperListBean: this.newspaperListBean  
69 - }),  
70 - alignment: DialogAlignment.Bottom,  
71 - offset: { dx: 0, dy: 0 }  
72 - }) 67 + @State isOpenListDialog: boolean = false
  68 +
  69 + // listDialogController: CustomDialogController = new CustomDialogController({
  70 + // builder: ENewspaperListDialog({
  71 + // newspaperListBean: this.newspaperListBean
  72 + // }),
  73 + // alignment: DialogAlignment.Bottom,
  74 + // offset: { dx: 0, dy: 0 }
  75 + // })
73 76
74 async aboutToAppear() { 77 async aboutToAppear() {
75 //获取宽高尺寸 78 //获取宽高尺寸
@@ -95,184 +98,207 @@ export struct ENewspaperPageComponent { @@ -95,184 +98,207 @@ export struct ENewspaperPageComponent {
95 } 98 }
96 99
97 build() { 100 build() {
98 - RelativeContainer() { 101 + Stack() {
99 RelativeContainer() { 102 RelativeContainer() {
100 - Image($r('app.media.icon_arrow_down'))  
101 - .height($r('app.float.top_arrow_size'))  
102 - .width($r('app.float.top_arrow_size')) 103 + RelativeContainer() {
  104 + Image($r('app.media.icon_arrow_down'))
  105 + .height($r('app.float.top_arrow_size'))
  106 + .width($r('app.float.top_arrow_size'))
  107 + .alignRules({
  108 + left: { anchor: "__container__", align: HorizontalAlign.Start },
  109 + center: { anchor: "__container__", align: VerticalAlign.Center }
  110 + })
  111 + .id('e_newspaper_back')
  112 + .onClick((event: ClickEvent) => {
  113 + router.back()
  114 + })
  115 +
  116 + Row() {
  117 + Text(this.calendarDate?.replace('-', '.')?.replace('-', '.'))
  118 + .fontSize($r('app.float.font_size_20'))
  119 + .fontColor($r('app.color.white'))
  120 + .fontFamily('BebasNeue_Regular')
  121 + .fontWeight(FontWeight.Regular)
  122 +
  123 + Image($r('app.media.icon_triangle'))
  124 + .width($r('app.float.border_radius_6'))
  125 + .height($r('app.float.border_radius_6'))
  126 + .margin({ left: 2, bottom: 5 })
  127 + }
  128 + .alignItems(VerticalAlign.Bottom)
103 .alignRules({ 129 .alignRules({
104 - left: { anchor: "__container__", align: HorizontalAlign.Start }, 130 + middle: { anchor: "__container__", align: HorizontalAlign.Center },
105 center: { anchor: "__container__", align: VerticalAlign.Center } 131 center: { anchor: "__container__", align: VerticalAlign.Center }
106 }) 132 })
107 - .id('e_newspaper_back') 133 + .id('e_newspaper_date')
  134 + .onClick(() => {
  135 + this.calendarDialogShow = !this.calendarDialogShow
  136 + if (this.calendarDialogShow) {
  137 + this.calendarDialogController.open()
  138 + } else {
  139 + this.calendarDialogController.close()
  140 + }
  141 + })
  142 +
  143 + Image($r('app.media.icon_share'))
  144 + .height($r('app.float.top_arrow_size'))
  145 + .width($r('app.float.top_arrow_size'))
  146 + .alignRules({
  147 + right: { anchor: "__container__", align: HorizontalAlign.End },
  148 + center: { anchor: "__container__", align: VerticalAlign.Center }
  149 + })
  150 + .id('e_newspaper_share')
  151 + }
  152 + .margin({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') })
  153 + .height($r('app.float.top_bar_height'))
  154 + .alignRules({
  155 + top: { anchor: '__container__', align: VerticalAlign.Top },
  156 + left: { anchor: '__container__', align: HorizontalAlign.Start },
  157 + right: { anchor: '__container__', align: HorizontalAlign.End }
  158 + })
  159 + .id('e_newspaper_top')
  160 +
  161 + if (!this.newspaperListBean || !this.newspaperListBean.list || this.newspaperListBean.list.length == 0) {
  162 + newsSkeleton()
  163 + .alignRules({
  164 + top: { anchor: "e_newspaper_top", align: VerticalAlign.Bottom },
  165 + middle: { anchor: "__container__", align: HorizontalAlign.Center }
  166 + })
  167 + .id('news_skeleton_id')
  168 + .width('100%')
  169 + .height(px2vp(this.picHeight) + 32)
  170 + .margin({ top: 35, left: 10, right: 10 })
  171 + }
  172 +
  173 + if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
  174 + Swiper(this.swiperController) {
  175 + ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => {
  176 + ENewspaperItemComponent({ newspaperListItemBean: item })
  177 + })
  178 + }
  179 + .index(this.swiperIndex)
  180 + .width('100%')
  181 + .height(px2vp(this.picHeight) + 32)
  182 + .vertical(true)
  183 + .autoPlay(false)
  184 + .cachedCount(3)
  185 + .indicator(false)
  186 + .loop(false)
  187 + .displayCount(1)
  188 + .margin({ top: 35, left: 10, right: 10 })
  189 + .id('e_newspaper_content')
  190 + .alignRules({
  191 + top: { anchor: "e_newspaper_top", align: VerticalAlign.Bottom },
  192 + middle: { anchor: "__container__", align: HorizontalAlign.Center }
  193 + })
  194 + .onChange((index: number) => {
  195 + this.currentPageNum = this.newspaperListBean?.list[index]?.pageNum
  196 + this.swiperIndex = index
  197 + })
  198 +
  199 + Image($r('app.media.newspaper_shadow'))
  200 + .height($r('app.float.vp_12'))
  201 + .margin({ left: 20, right: 20, top: -1 })
  202 + .objectFit(ImageFit.Contain)
  203 + .alignRules({
  204 + top: { anchor: "e_newspaper_content", align: VerticalAlign.Bottom },
  205 + left: { anchor: 'e_newspaper_content', align: HorizontalAlign.Start },
  206 + right: { anchor: 'e_newspaper_content', align: HorizontalAlign.End }
  207 + })
  208 + .id('e_newspaper_shadow')
  209 +
  210 + Row() {
  211 + Text(this.swiperIndex + 1 == this.newspaperListBean?.list?.length ? '已到底部,可以选择其他日期' : '滑动查看下一版')
  212 + .fontColor(Color.White)
  213 + .fontSize($r('app.float.font_size_14'))
  214 + Image($r('app.media.icon_next_page'))
  215 + .width($r('app.float.vp_16'))
  216 + .height($r('app.float.vp_16'))
  217 + .visibility(this.swiperIndex + 1 == this.newspaperListBean?.list?.length ? Visibility.None : Visibility.Visible)
  218 + }
  219 + .justifyContent(FlexAlign.Center)
  220 + .margin({ top: $r('app.float.margin_16') })
  221 + .alignRules({
  222 + top: { anchor: "e_newspaper_shadow", align: VerticalAlign.Bottom },
  223 + middle: { anchor: "__container__", align: HorizontalAlign.Center }
  224 + })
  225 + .id('e_newspaper_next')
108 .onClick((event: ClickEvent) => { 226 .onClick((event: ClickEvent) => {
109 - router.back() 227 + this.swiperController.showNext()
110 }) 228 })
  229 + }
111 230
112 Row() { 231 Row() {
113 - Text(this.calendarDate?.replace('-', '.')?.replace('-', '.'))  
114 - .fontSize($r('app.float.font_size_20')) 232 + Text(this.currentPageNum)
  233 + .fontSize($r('app.float.font_size_36'))
115 .fontColor($r('app.color.white')) 234 .fontColor($r('app.color.white'))
116 .fontFamily('BebasNeue_Regular') 235 .fontFamily('BebasNeue_Regular')
117 - .fontWeight(FontWeight.Regular) 236 + Text('版')
  237 + .fontSize($r('app.float.font_size_16'))
  238 + .fontColor($r('app.color.white'))
  239 + .margin({ bottom: 6 })
118 240
119 Image($r('app.media.icon_triangle')) 241 Image($r('app.media.icon_triangle'))
120 .width($r('app.float.border_radius_6')) 242 .width($r('app.float.border_radius_6'))
121 .height($r('app.float.border_radius_6')) 243 .height($r('app.float.border_radius_6'))
122 - .margin({ left: 2, bottom: 5 }) 244 + .margin({ left: 2, bottom: 6 })
123 } 245 }
124 .alignItems(VerticalAlign.Bottom) 246 .alignItems(VerticalAlign.Bottom)
  247 + .margin({ left: $r('app.float.margin_16'), bottom: $r('app.float.top_tab_bar_height') })
125 .alignRules({ 248 .alignRules({
126 - middle: { anchor: "__container__", align: HorizontalAlign.Center },  
127 - center: { anchor: "__container__", align: VerticalAlign.Center } 249 + bottom: { anchor: '__container__', align: VerticalAlign.Bottom },
  250 + left: { anchor: '__container__', align: HorizontalAlign.Start }
128 }) 251 })
129 - .id('e_newspaper_date')  
130 - .onClick(() => {  
131 - this.calendarDialogShow = !this.calendarDialogShow  
132 - if (this.calendarDialogShow) {  
133 - this.calendarDialogController.open() 252 + .id('e_newspaper_page_num')
  253 + .onClick((event: ClickEvent) => {
  254 + this.pageDialogShow = !this.pageDialogShow
  255 + if (this.pageDialogShow) {
  256 + this.pageDialogController.open()
134 } else { 257 } else {
135 - this.calendarDialogController.close() 258 + this.pageDialogController.close()
136 } 259 }
137 }) 260 })
138 261
139 - Image($r('app.media.icon_share'))  
140 - .height($r('app.float.top_arrow_size'))  
141 - .width($r('app.float.top_arrow_size'))  
142 - .alignRules({  
143 - right: { anchor: "__container__", align: HorizontalAlign.End },  
144 - center: { anchor: "__container__", align: VerticalAlign.Center }  
145 - })  
146 - .id('e_newspaper_share')  
147 - }  
148 - .margin({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') })  
149 - .height($r('app.float.top_bar_height'))  
150 - .alignRules({  
151 - top: { anchor: '__container__', align: VerticalAlign.Top },  
152 - left: { anchor: '__container__', align: HorizontalAlign.Start },  
153 - right: { anchor: '__container__', align: HorizontalAlign.End }  
154 - })  
155 - .id('e_newspaper_top')  
156 -  
157 - if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {  
158 - Swiper(this.swiperController) {  
159 - ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => {  
160 - ENewspaperItemComponent({ newspaperListItemBean: item })  
161 - })  
162 - }  
163 - .index(this.swiperIndex)  
164 - .width('100%')  
165 - .height(px2vp(this.picHeight) + 32)  
166 - .vertical(true)  
167 - .autoPlay(false)  
168 - .cachedCount(3)  
169 - .indicator(false)  
170 - .loop(false)  
171 - .displayCount(1)  
172 - .margin({ top: 35, left: 10, right: 10 })  
173 - .id('e_newspaper_content')  
174 - .alignRules({  
175 - top: { anchor: "e_newspaper_top", align: VerticalAlign.Bottom },  
176 - middle: { anchor: "__container__", align: HorizontalAlign.Center }  
177 - })  
178 - .onChange((index: number) => {  
179 - this.currentPageNum = this.newspaperListBean?.list[index]?.pageNum  
180 - this.swiperIndex = index  
181 - })  
182 -  
183 - Image($r('app.media.newspaper_shadow'))  
184 - .height($r('app.float.vp_12'))  
185 - .margin({ left: 20, right: 20, top: -1 })  
186 - .objectFit(ImageFit.Contain)  
187 - .alignRules({  
188 - top: { anchor: "e_newspaper_content", align: VerticalAlign.Bottom },  
189 - left: { anchor: 'e_newspaper_content', align: HorizontalAlign.Start },  
190 - right: { anchor: 'e_newspaper_content', align: HorizontalAlign.End }  
191 - })  
192 - .id('e_newspaper_shadow') 262 + // .bindPopup(this.pageNumPopup, {
  263 + // builder: this.popupBuilder,
  264 + // placement: Placement.Top,
  265 + // popupColor: Color.White
  266 + // })
193 267
194 Row() { 268 Row() {
195 - Text(this.swiperIndex + 1 == this.newspaperListBean?.list?.length ? '已到底部,可以选择其他日期' : '滑动查看下一版')  
196 - .fontColor(Color.White) 269 + Image($r('app.media.icon_read_paper'))
  270 + .width($r('app.float.vp_20'))
  271 + .height($r('app.float.vp_20'))
  272 + .margin({ right: $r('app.float.vp_3') })
  273 + Text('读报纸')
197 .fontSize($r('app.float.font_size_14')) 274 .fontSize($r('app.float.font_size_14'))
198 - Image($r('app.media.icon_next_page'))  
199 - .width($r('app.float.vp_16'))  
200 - .height($r('app.float.vp_16'))  
201 - .visibility(this.swiperIndex + 1 == this.newspaperListBean?.list?.length ? Visibility.None : Visibility.Visible) 275 + .fontColor($r('app.color.white'))
202 } 276 }
203 - .justifyContent(FlexAlign.Center)  
204 - .margin({ top: $r('app.float.margin_16') }) 277 + .alignItems(VerticalAlign.Center)
  278 + .margin({ right: $r('app.float.margin_16'), bottom: $r('app.float.top_tab_bar_height') })
205 .alignRules({ 279 .alignRules({
206 - top: { anchor: "e_newspaper_shadow", align: VerticalAlign.Bottom },  
207 - middle: { anchor: "__container__", align: HorizontalAlign.Center } 280 + bottom: { anchor: '__container__', align: VerticalAlign.Bottom },
  281 + right: { anchor: '__container__', align: HorizontalAlign.End }
208 }) 282 })
209 - .id('e_newspaper_next') 283 + .id('e_newspaper_read')
210 .onClick((event: ClickEvent) => { 284 .onClick((event: ClickEvent) => {
211 - this.swiperController.showNext() 285 + this.isOpenListDialog = true
212 }) 286 })
213 } 287 }
  288 + .width('100%')
  289 + .height('100%')
  290 + .backgroundColor($r('app.color.color_80000000'))
  291 + .id('e_newspaper_container')
214 292
215 - Row() {  
216 - Text(this.currentPageNum)  
217 - .fontSize($r('app.float.font_size_36'))  
218 - .fontColor($r('app.color.white'))  
219 - .fontFamily('BebasNeue_Regular')  
220 - Text('版')  
221 - .fontSize($r('app.float.font_size_16'))  
222 - .fontColor($r('app.color.white'))  
223 - .margin({ bottom: 6 })  
224 -  
225 - Image($r('app.media.icon_triangle'))  
226 - .width($r('app.float.border_radius_6'))  
227 - .height($r('app.float.border_radius_6'))  
228 - .margin({ left: 2, bottom: 6 })  
229 - }  
230 - .alignItems(VerticalAlign.Bottom)  
231 - .margin({ left: $r('app.float.margin_16'), bottom: $r('app.float.top_tab_bar_height') })  
232 - .alignRules({  
233 - bottom: { anchor: '__container__', align: VerticalAlign.Bottom },  
234 - left: { anchor: '__container__', align: HorizontalAlign.Start }  
235 - })  
236 - .id('e_newspaper_page_num')  
237 - .onClick((event: ClickEvent) => {  
238 - this.pageDialogShow = !this.pageDialogShow  
239 - if (this.pageDialogShow) {  
240 - this.pageDialogController.open()  
241 - } else {  
242 - this.pageDialogController.close() 293 + ENewspaperListDialog({
  294 + newspaperListBean: this.newspaperListBean,
  295 + closeDialog: () => {
  296 + this.isOpenListDialog = false
243 } 297 }
244 }) 298 })
245 -  
246 - // .bindPopup(this.pageNumPopup, {  
247 - // builder: this.popupBuilder,  
248 - // placement: Placement.Top,  
249 - // popupColor: Color.White  
250 - // })  
251 -  
252 - Row() {  
253 - Image($r('app.media.icon_read_paper'))  
254 - .width($r('app.float.vp_20'))  
255 - .height($r('app.float.vp_20'))  
256 - .margin({ right: $r('app.float.vp_3') })  
257 - Text('读报纸')  
258 - .fontSize($r('app.float.font_size_14'))  
259 - .fontColor($r('app.color.white'))  
260 - }  
261 - .alignItems(VerticalAlign.Center)  
262 - .margin({ right: $r('app.float.margin_16'), bottom: $r('app.float.top_tab_bar_height') })  
263 - .alignRules({  
264 - bottom: { anchor: '__container__', align: VerticalAlign.Bottom },  
265 - right: { anchor: '__container__', align: HorizontalAlign.End }  
266 - })  
267 - .id('e_newspaper_read')  
268 - .onClick((event: ClickEvent) => {  
269 - this.listDialogController.open()  
270 - }) 299 + .visibility(this.isOpenListDialog ? Visibility.Visible : Visibility.None)
271 } 300 }
272 - .width('100%')  
273 - .height('100%')  
274 - .backgroundColor($r('app.color.color_80000000'))  
275 - .id('e_newspaper_container') 301 +
276 } 302 }
277 303
278 private async getNewspaperTime() { 304 private async getNewspaperTime() {
1 -import { Logger, NumberFormatterUtils } from 'wdKit'; 1 +import { Logger, NumberFormatterUtils, DateTimeUtils } from 'wdKit';
2 import { 2 import {
3 Action, 3 Action,
4 ContentDetailDTO, 4 ContentDetailDTO,
@@ -14,15 +14,15 @@ import DetailViewModel from '../viewmodel/DetailViewModel'; @@ -14,15 +14,15 @@ import DetailViewModel from '../viewmodel/DetailViewModel';
14 import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; 14 import { ImageAndTextWebComponent } from './ImageAndTextWebComponent';
15 import router from '@ohos.router'; 15 import router from '@ohos.router';
16 import { RecommendList } from '../components/view/RecommendList' 16 import { RecommendList } from '../components/view/RecommendList'
17 -import { CommonConstants } from 'wdConstant' 17 +import { CommonConstants } from 'wdConstant';
18 import { HttpUrlUtils } from 'wdNetwork/Index'; 18 import { HttpUrlUtils } from 'wdNetwork/Index';
19 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 19 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
20 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; 20 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
21 import { PageRepository } from '../repository/PageRepository'; 21 import { PageRepository } from '../repository/PageRepository';
22 -import { detailedSkeleton } from './skeleton/detailSkeleton' 22 +import { detailedSkeleton } from './skeleton/detailSkeleton';
  23 +const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
23 24
24 const TAG = 'ImageAndTextPageComponent' 25 const TAG = 'ImageAndTextPageComponent'
25 -  
26 @Component 26 @Component
27 export struct ImageAndTextPageComponent { 27 export struct ImageAndTextPageComponent {
28 scroller: Scroller = new Scroller(); 28 scroller: Scroller = new Scroller();
@@ -32,7 +32,7 @@ export struct ImageAndTextPageComponent { @@ -32,7 +32,7 @@ export struct ImageAndTextPageComponent {
32 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 32 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
33 @State interactData: InteractDataDTO = {} as InteractDataDTO 33 @State interactData: InteractDataDTO = {} as InteractDataDTO
34 @State isPageEnd: boolean = false 34 @State isPageEnd: boolean = false
35 - 35 + @State publishTime: string = ''
36 build() { 36 build() {
37 Column() { 37 Column() {
38 if (!this.isPageEnd) { 38 if (!this.isPageEnd) {
@@ -40,10 +40,10 @@ export struct ImageAndTextPageComponent { @@ -40,10 +40,10 @@ export struct ImageAndTextPageComponent {
40 } else { 40 } else {
41 // 发布时间 41 // 发布时间
42 Row() { 42 Row() {
43 - Image($r('app.media.icon_ren_min_ri_bao'))  
44 - .width(70) 43 + Image(this.contentDetailData[0]?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb'))
  44 + .width(80)
45 .height(28) 45 .height(28)
46 - Text(this.contentDetailData[0]?.publishTime) 46 + Text(this.publishTime)
47 .fontColor($r('app.color.color_B0B0B0')) 47 .fontColor($r('app.color.color_B0B0B0'))
48 .fontSize($r('app.float.font_size_13')) 48 .fontSize($r('app.float.font_size_13'))
49 .height('100%') 49 .height('100%')
@@ -151,6 +151,8 @@ export struct ImageAndTextPageComponent { @@ -151,6 +151,8 @@ export struct ImageAndTextPageComponent {
151 let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) 151 let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
152 if (detailBeans && detailBeans.length > 0) { 152 if (detailBeans && detailBeans.length > 0) {
153 this.contentDetailData = detailBeans; 153 this.contentDetailData = detailBeans;
  154 + let dateTime = DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN);
  155 + this.publishTime = DateTimeUtils.formatDate(dateTime,PATTERN_DATE_CN_RN)
154 if (this.contentDetailData[0]?.recommendShow === 1) { 156 if (this.contentDetailData[0]?.recommendShow === 1) {
155 this.getRecommend() 157 this.getRecommend()
156 } 158 }
@@ -7,10 +7,14 @@ import { photoAccessHelper } from '@kit.MediaLibraryKit'; @@ -7,10 +7,14 @@ import { photoAccessHelper } from '@kit.MediaLibraryKit';
7 import fs from '@ohos.file.fs'; 7 import fs from '@ohos.file.fs';
8 8
9 const PERMISSIONS: Array<Permissions> = [ 9 const PERMISSIONS: Array<Permissions> = [
10 - 'ohos.permission.READ_MEDIA',  
11 - 'ohos.permission.WRITE_MEDIA' 10 + 'ohos.permission.READ_IMAGEVIDEO',
  11 + 'ohos.permission.WRITE_IMAGEVIDEO'
12 ]; 12 ];
13 13
  14 +/*
  15 + * saveButton参考文档
  16 + * https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/savebutton-0000001820999677
  17 + * */
14 @Component 18 @Component
15 export struct ImageDownloadComponent { 19 export struct ImageDownloadComponent {
16 @State image: PixelMap | undefined = undefined; 20 @State image: PixelMap | undefined = undefined;
@@ -20,12 +24,8 @@ export struct ImageDownloadComponent { @@ -20,12 +24,8 @@ export struct ImageDownloadComponent {
20 24
21 build() { 25 build() {
22 Column() { 26 Column() {
23 - Image($r('app.media.icon_arrow_left_white'))  
24 - .width(24)  
25 - .height(24)  
26 - .aspectRatio(1)  
27 - .interpolation(ImageInterpolation.High)  
28 - .rotate({ angle: -90 }) 27 + SaveButton({ icon: SaveIconStyle.LINES })
  28 + .iconColor(Color.White)
29 .onClick(async () => { 29 .onClick(async () => {
30 console.info(`cj2024 onClick ${this.imageBuffer}`) 30 console.info(`cj2024 onClick ${this.imageBuffer}`)
31 if (this.imageBuffer !== undefined) { 31 if (this.imageBuffer !== undefined) {
@@ -287,16 +287,6 @@ struct ChannelDialog { @@ -287,16 +287,6 @@ struct ChannelDialog {
287 .height('100%') 287 .height('100%')
288 .justifyContent(FlexAlign.Center) 288 .justifyContent(FlexAlign.Center)
289 .backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff') 289 .backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff')
290 - .onClick(() => {  
291 - if (this.isEditIng) {  
292 - if (item.delPermitted === 1) {  
293 - this.delChannelItem(index)  
294 - }  
295 - } else {  
296 - this.confirm(index)  
297 - this.controller?.close()  
298 - }  
299 - })  
300 } 290 }
301 .width('23%') 291 .width('23%')
302 .height(40) 292 .height(40)
@@ -307,31 +297,40 @@ struct ChannelDialog { @@ -307,31 +297,40 @@ struct ChannelDialog {
307 }) 297 })
308 .zIndex(this.dragItem == item.num ? 1 : 0) 298 .zIndex(this.dragItem == item.num ? 1 : 0)
309 .translate(this.dragItem == item.num ? { x: this.offsetX, y: this.offsetY } : { x: 0, y: 0 }) 299 .translate(this.dragItem == item.num ? { x: this.offsetX, y: this.offsetY } : { x: 0, y: 0 })
310 -  
311 .gesture( 300 .gesture(
312 - GestureGroup(GestureMode.Sequence,  
313 - PanGesture({ fingers: 1, direction: null, distance: 0 })  
314 - .onActionStart((event: GestureEvent) => {  
315 - this.dragItem = item.num  
316 - this.dragRefOffsetX = 0  
317 - this.dragRefOffsetY = 0  
318 - })  
319 - .onActionUpdate((event: GestureEvent) => {  
320 - animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => {  
321 - this.handleAnimationTo(item, event)  
322 - })  
323 - })  
324 - .onActionEnd((event: GestureEvent) => {  
325 - animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => {  
326 - this.dragItem = -1  
327 - this.offsetX = 0  
328 - this.offsetY = 0 301 + GestureGroup(GestureMode.Sequence,
  302 + TapGesture()
  303 + .onAction((event?: GestureEvent) => {
  304 + if (this.isEditIng) {
  305 + if (item.delPermitted === 1) {
  306 + this.delChannelItem(index)
  307 + }
  308 + } else {
  309 + this.confirm(index)
  310 + this.controller?.close()
  311 + }
  312 + }),
  313 + PanGesture({ fingers: 1, direction: null, distance: 0 })
  314 + .onActionStart((event: GestureEvent) => {
  315 + this.dragItem = item.num
329 this.dragRefOffsetX = 0 316 this.dragRefOffsetX = 0
330 this.dragRefOffsetY = 0 317 this.dragRefOffsetY = 0
331 }) 318 })
332 - })  
333 - )  
334 - .onCancel(() => { 319 + .onActionUpdate((event: GestureEvent) => {
  320 + animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => {
  321 + this.handleAnimationTo(item, event)
  322 + })
  323 + })
  324 + .onActionEnd((event: GestureEvent) => {
  325 + animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => {
  326 + this.dragItem = -1
  327 + this.offsetX = 0
  328 + this.offsetY = 0
  329 + this.dragRefOffsetX = 0
  330 + this.dragRefOffsetY = 0
  331 + })
  332 + })
  333 + ).onCancel(() => {
335 animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => { 334 animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => {
336 this.dragItem = -1 335 this.dragItem = -1
337 this.offsetX = 0 336 this.offsetX = 0
@@ -339,8 +338,8 @@ struct ChannelDialog { @@ -339,8 +338,8 @@ struct ChannelDialog {
339 this.dragRefOffsetX = 0 338 this.dragRefOffsetX = 0
340 this.dragRefOffsetY = 0 339 this.dragRefOffsetY = 0
341 }) 340 })
342 - }))  
343 - 341 + })
  342 + )
344 }, (item: TopNavDTO) => JSON.stringify(item)) 343 }, (item: TopNavDTO) => JSON.stringify(item))
345 } 344 }
346 .width('100%') 345 .width('100%')
@@ -66,15 +66,16 @@ struct MyCollectionListPage { @@ -66,15 +66,16 @@ struct MyCollectionListPage {
66 } 66 }
67 67
68 if (this.isEditState){ 68 if (this.isEditState){
69 - CustomBottomFuctionUI({  
70 - selectAllCallback:(isAllSelect)=>{  
71 - this.allSelectDatas(isAllSelect)  
72 - },  
73 - confirmCallback:()=>{  
74 - this.deleteDatas()  
75 - }  
76 - })  
77 - .position({y:'92%'}) 69 + Stack(){
  70 + CustomBottomFuctionUI({
  71 + selectAllCallback:(isAllSelect)=>{
  72 + this.allSelectDatas(isAllSelect)
  73 + },
  74 + confirmCallback:()=>{
  75 + this.deleteDatas()
  76 + }
  77 + })
  78 + }.position({y:'92%'})
78 } 79 }
79 } 80 }
80 .width(CommonConstants.FULL_WIDTH) 81 .width(CommonConstants.FULL_WIDTH)
@@ -119,15 +120,21 @@ struct MyCollectionListPage { @@ -119,15 +120,21 @@ struct MyCollectionListPage {
119 MyCollectionViewModel.fetchMyCollectList(1,'1',this.currentPage,getContext(this)).then(collectionItem => { 120 MyCollectionViewModel.fetchMyCollectList(1,'1',this.currentPage,getContext(this)).then(collectionItem => {
120 if(resolve) resolve('刷新成功') 121 if(resolve) resolve('刷新成功')
121 if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { 122 if (collectionItem && collectionItem.list && collectionItem.list.length > 0) {
122 - if (this.currentPage === 1) this.allDatas = []  
123 - this.allDatas = this.allDatas.concat(...collectionItem.list)  
124 - if (collectionItem.totalCount === this.allDatas.length) { 123 + if (this.currentPage === 1) {
  124 + this.allDatas = []
  125 + this.allDatas.push(...collectionItem.list)
  126 + }else {
  127 + this.allDatas = this.allDatas.concat(...collectionItem.list)
  128 + }
  129 + if (collectionItem.hasNext === 0) {
125 this.browSingModel.hasMore = false; 130 this.browSingModel.hasMore = false;
126 } else { 131 } else {
127 this.browSingModel.hasMore = true; 132 this.browSingModel.hasMore = true;
128 } 133 }
129 } else { 134 } else {
130 - this.browSingModel.viewType = ViewType.EMPTY; 135 + if (this.currentPage === 1) {
  136 + this.browSingModel.viewType = ViewType.EMPTY;
  137 + }
131 } 138 }
132 }) 139 })
133 } 140 }
1 import { CommonConstants } from 'wdConstant' 1 import { CommonConstants } from 'wdConstant'
2 -import { ContentDTO,CompDTO } from 'wdBean' 2 +import { ContentDTO, CompDTO } from 'wdBean'
  3 +import { ProcessUtils } from '../../utils/ProcessUtils';
3 4
4 @Component 5 @Component
5 export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { 6 export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
@@ -59,13 +60,12 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { @@ -59,13 +60,12 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
59 .padding({ left: (index == 0) ? 16 : 0, right: (index == this.compDTO.operDataList.length - 1) ? 16 : 0 }) 60 .padding({ left: (index == 0) ? 16 : 0, right: (index == this.compDTO.operDataList.length - 1) ? 16 : 0 })
60 // .offset({x:16}) 61 // .offset({x:16})
61 .onClick(() => { 62 .onClick(() => {
62 - if (item.objectType != '0') {  
63 - console.log(item.objectId)  
64 - } 63 + ProcessUtils.processPage(item)
65 }) 64 })
66 }) 65 })
67 66
68 }.listDirection(Axis.Horizontal) 67 }.listDirection(Axis.Horizontal)
  68 + .scrollBar(BarState.Off)
69 .width('100%') 69 .width('100%')
70 70
71 // .backgroundColor($r("app.color.color_FE4B05")) 71 // .backgroundColor($r("app.color.color_FE4B05"))
@@ -12,7 +12,7 @@ export struct ENewspaperListDialog { @@ -12,7 +12,7 @@ export struct ENewspaperListDialog {
12 @Consume @Watch('onCurrentPageNumUpdated') currentPageNum: string 12 @Consume @Watch('onCurrentPageNumUpdated') currentPageNum: string
13 @State pageDialogShow: boolean = false 13 @State pageDialogShow: boolean = false
14 @State scrollIndex: number = 0 14 @State scrollIndex: number = 0
15 - newspaperListBean: NewspaperListBean = {} as NewspaperListBean 15 + @Prop newspaperListBean: NewspaperListBean = {} as NewspaperListBean
16 private listScroller: Scroller = new Scroller(); 16 private listScroller: Scroller = new Scroller();
17 //文字版选择弹框 17 //文字版选择弹框
18 pageListDialogController: CustomDialogController = new CustomDialogController({ 18 pageListDialogController: CustomDialogController = new CustomDialogController({
@@ -21,13 +21,14 @@ export struct ENewspaperListDialog { @@ -21,13 +21,14 @@ export struct ENewspaperListDialog {
21 newspaperListBean: this.newspaperListBean, 21 newspaperListBean: this.newspaperListBean,
22 }), 22 }),
23 alignment: DialogAlignment.TopStart, 23 alignment: DialogAlignment.TopStart,
24 - offset: { dx: 0, dy: 214 }, 24 + offset: { dx: 0, dy: 224 },
25 customStyle: true, 25 customStyle: true,
26 }) 26 })
27 //页面半屏弹窗(实现在上个组件)若尝试在CustomDialog中传入多个其他的Controller, 27 //页面半屏弹窗(实现在上个组件)若尝试在CustomDialog中传入多个其他的Controller,
28 // 以实现在CustomDialog中打开另一个或另一些CustomDialog, 28 // 以实现在CustomDialog中打开另一个或另一些CustomDialog,
29 // 那么此处需要将指向自己的controller放在所有controller的后面 29 // 那么此处需要将指向自己的controller放在所有controller的后面
30 - listDialogController: CustomDialogController 30 + // listDialogController: CustomDialogController
  31 + public closeDialog?: () => void
31 32
32 //watch监听报纸页码回调 33 //watch监听报纸页码回调
33 onCurrentPageNumUpdated(): void { 34 onCurrentPageNumUpdated(): void {
@@ -53,147 +54,168 @@ export struct ENewspaperListDialog { @@ -53,147 +54,168 @@ export struct ENewspaperListDialog {
53 } 54 }
54 55
55 build() { 56 build() {
56 - Column() {  
57 - Row()  
58 - .width(43)  
59 - .height(4)  
60 - .backgroundColor('#EDEDED')  
61 - .margin({  
62 - top: 10,  
63 - bottom: 10  
64 - })  
65 - Row() {  
66 - Text(this.currentPageNum)  
67 - .fontSize($r('app.float.font_size_36'))  
68 - .fontColor($r('app.color.color_222222'))  
69 - .fontFamily('BebasNeue_Regular')  
70 - Text('版')  
71 - .fontSize($r('app.float.font_size_16'))  
72 - .fontColor($r('app.color.color_222222'))  
73 - .margin({ bottom: 6 })  
74 -  
75 - Image($r('app.media.icon_triangle_black'))  
76 - .width($r('app.float.border_radius_6'))  
77 - .height($r('app.float.border_radius_6'))  
78 - .margin({ left: 2, bottom: 6 })  
79 - }  
80 - .alignItems(VerticalAlign.Bottom)  
81 - .margin({ left: 15 })  
82 - .alignSelf(ItemAlign.Start)  
83 - .onClick(() => {  
84 - this.pageDialogShow = !this.pageDialogShow  
85 - if (this.pageDialogShow) {  
86 - this.pageListDialogController.open()  
87 - } else {  
88 - this.pageListDialogController.close() 57 + Stack() {
  58 + Column() {
  59 + Row()
  60 + .width(43)
  61 + .height(4)
  62 + .backgroundColor('#EDEDED')
  63 + .margin({
  64 + top: 10,
  65 + bottom: 10
  66 + })
  67 + .onClick(() => {
  68 + if (this.closeDialog) {
  69 + this.closeDialog()
  70 + }
  71 + })
  72 + Row() {
  73 + Text(this.currentPageNum)
  74 + .fontSize($r('app.float.font_size_36'))
  75 + .fontColor($r('app.color.color_222222'))
  76 + .fontFamily('BebasNeue_Regular')
  77 + Text('版')
  78 + .fontSize($r('app.float.font_size_16'))
  79 + .fontColor($r('app.color.color_222222'))
  80 + .margin({ bottom: 6 })
  81 +
  82 + Image($r('app.media.icon_triangle_black'))
  83 + .width($r('app.float.border_radius_6'))
  84 + .height($r('app.float.border_radius_6'))
  85 + .margin({ left: 2, bottom: 6 })
89 } 86 }
90 - })  
91 -  
92 - Image($r('app.media.line'))  
93 - .width('100%')  
94 - .height(6)  
95 - .margin({ top: 20, left: 16, right: 16 })  
96 - .objectFit(ImageFit.Contain)  
97 -  
98 - List({ scroller: this.listScroller, initialIndex: this.scrollIndex }) {  
99 - ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => {  
100 - ListItem() {  
101 - List() {  
102 - ForEach(item.items, (positionItem: NewspaperPositionItemBean, itemIndex: number) => {  
103 - ListItem() {  
104 - Column() {  
105 - if (itemIndex == 0) {  
106 - Text(item.pageNum + item.pageName)  
107 - .fontSize($r('app.float.font_size_14'))  
108 - .fontColor($r('app.color.color_ED2800'))  
109 - .fontWeight(600)  
110 - .margin({ top: 16, bottom: 16 })  
111 - .maxLines(1)  
112 - }  
113 -  
114 - if (positionItem.shortTitle) {  
115 - Text(positionItem.shortTitle)  
116 - .fontSize($r('app.float.font_size_14'))  
117 - .fontColor($r('app.color.color_222222'))  
118 - .fontWeight(600)  
119 - .maxLines(2)  
120 - }  
121 -  
122 - if (positionItem.title) {  
123 - Text(positionItem.title)  
124 - .fontSize($r('app.float.font_size_17'))  
125 - .fontColor($r('app.color.color_222222'))  
126 - .margin({ top: 8 })  
127 - .maxLines(2)  
128 - }  
129 -  
130 - if (positionItem.downTitle) {  
131 - Text(positionItem.downTitle)  
132 - .fontSize($r('app.float.font_size_14'))  
133 - .fontColor($r('app.color.color_222222'))  
134 - .fontWeight(600)  
135 - .margin({ top: 8 })  
136 - .maxLines(2)  
137 - } 87 + .alignItems(VerticalAlign.Bottom)
  88 + .margin({ left: 15 })
  89 + .alignSelf(ItemAlign.Start)
  90 + .onClick(() => {
  91 + this.pageDialogShow = !this.pageDialogShow
  92 + if (this.pageDialogShow) {
  93 + this.pageListDialogController.open()
  94 + } else {
  95 + this.pageListDialogController.close()
  96 + }
  97 + })
138 98
139 - if (positionItem.newsTxt) {  
140 - Text(positionItem.newsTxt)  
141 - .fontSize($r('app.float.font_size_14'))  
142 - .fontColor($r('app.color.color_999999'))  
143 - .margin({ top: 15, bottom: 15 })  
144 - .maxLines(5) 99 + Image($r('app.media.line'))
  100 + .width('100%')
  101 + .height(6)
  102 + .margin({ top: 20, left: 16, right: 16 })
  103 + .objectFit(ImageFit.Contain)
  104 +
  105 + List({ scroller: this.listScroller, initialIndex: this.scrollIndex }) {
  106 + ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => {
  107 + ListItem() {
  108 + List() {
  109 + ForEach(item.items, (positionItem: NewspaperPositionItemBean, itemIndex: number) => {
  110 + ListItem() {
  111 + Column() {
  112 + if (itemIndex == 0) {
  113 + Text(item.pageNum + item.pageName)
  114 + .fontSize($r('app.float.font_size_14'))
  115 + .fontColor($r('app.color.color_ED2800'))
  116 + .fontWeight(600)
  117 + .margin({ top: 16, bottom: 16 })
  118 + .maxLines(1)
  119 + }
  120 +
  121 + if (positionItem.shortTitle) {
  122 + Text(positionItem.shortTitle)
  123 + .fontSize($r('app.float.font_size_14'))
  124 + .fontColor($r('app.color.color_222222'))
  125 + .fontWeight(600)
  126 + .maxLines(2)
  127 + }
  128 +
  129 + if (positionItem.title) {
  130 + Text(positionItem.title)
  131 + .fontSize($r('app.float.font_size_17'))
  132 + .fontColor($r('app.color.color_222222'))
  133 + .margin({ top: 8 })
  134 + .maxLines(2)
  135 + }
  136 +
  137 + if (positionItem.downTitle) {
  138 + Text(positionItem.downTitle)
  139 + .fontSize($r('app.float.font_size_14'))
  140 + .fontColor($r('app.color.color_222222'))
  141 + .fontWeight(600)
  142 + .margin({ top: 8 })
  143 + .maxLines(2)
  144 + }
  145 +
  146 + if (positionItem.newsTxt) {
  147 + Text(positionItem.newsTxt)
  148 + .fontSize($r('app.float.font_size_14'))
  149 + .fontColor($r('app.color.color_999999'))
  150 + .margin({ top: 15, bottom: 15 })
  151 + .maxLines(5)
  152 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  153 + }
145 } 154 }
  155 + .alignItems(HorizontalAlign.Start)
  156 + .onClick(() => {
  157 + let taskAction: Action = {
  158 + type: 'JUMP_INNER_NEW_PAGE',
  159 + params: {
  160 + contentID: '' + positionItem.newsId,
  161 + pageID: 'IMAGE_TEXT_DETAIL',
  162 + extra: {
  163 + relType: positionItem.relType ?? '',
  164 + relId: '' + positionItem.relId,
  165 + sourcePage: '5'
  166 + } as ExtraDTO
  167 + } as Params,
  168 + };
  169 + WDRouterRule.jumpWithAction(taskAction)
  170 + // if (this.listDialogController) {
  171 + // this.listDialogController.close()
  172 + // }
  173 + })
146 } 174 }
147 - .alignItems(HorizontalAlign.Start)  
148 - .onClick(() => {  
149 - let taskAction: Action = {  
150 - type: 'JUMP_INNER_NEW_PAGE',  
151 - params: {  
152 - contentID: '' + positionItem.newsId,  
153 - pageID: 'IMAGE_TEXT_DETAIL',  
154 - extra: {  
155 - relType: positionItem.relType ?? '',  
156 - relId: '' + positionItem.relId,  
157 - sourcePage: '5'  
158 - } as ExtraDTO  
159 - } as Params,  
160 - };  
161 - WDRouterRule.jumpWithAction(taskAction)  
162 - if (this.listDialogController) {  
163 - this.listDialogController.close()  
164 - }  
165 - })  
166 - }  
167 175
168 - }) 176 + })
  177 + }
169 } 178 }
170 - } 179 + })
  180 + }
  181 + .width('100%')
  182 + .padding({ left: 15, right: 15 })
  183 + .margin({
  184 + bottom: 85
  185 + })
  186 + .scrollBar(BarState.Off)
  187 + .divider({
  188 + strokeWidth: 0.5,
  189 + color: '#EDEDED'
  190 + })
  191 + .onScrollIndex((firstIndex: number) => {
  192 + console.log('firstIndex', firstIndex)
  193 + })
  194 + .onScrollIndex((firstIndex: number, lastIndex: number, centerIndex: number) => {
  195 + console.info('first' + firstIndex)
  196 + console.info('last' + lastIndex)
  197 + console.info('center' + centerIndex)
  198 + // this.updateCurrentPageNum(firstIndex)
  199 + this.currentPageNum = `${centerIndex < 9 ? '0' + (centerIndex + 1) : centerIndex + 1}`
  200 + })
  201 + .onScroll((scrollOffset: number, scrollState: ScrollState) => {
  202 + console.info(`onScroll scrollState = ScrollState` + scrollState + `, scrollOffset = ` + scrollOffset)
171 }) 203 })
172 } 204 }
  205 + .margin({ top: 124 })
173 .width('100%') 206 .width('100%')
174 - .padding({ left: 15, right: 15 })  
175 - .scrollBar(BarState.Off)  
176 - .divider({  
177 - strokeWidth: 0.5,  
178 - color: '#EDEDED'  
179 - })  
180 - .onScrollIndex((firstIndex: number) => {  
181 - console.log('firstIndex', firstIndex)  
182 - })  
183 - .onScrollIndex((firstIndex: number, lastIndex: number, centerIndex: number) => {  
184 - console.info('first' + firstIndex)  
185 - console.info('last' + lastIndex)  
186 - console.info('center' + centerIndex)  
187 - // this.updateCurrentPageNum(firstIndex)  
188 - this.currentPageNum = `${centerIndex < 9 ? '0' + (centerIndex + 1) : centerIndex + 1}`  
189 - })  
190 - .onScroll((scrollOffset: number, scrollState: ScrollState) => {  
191 - console.info(`onScroll scrollState = ScrollState` + scrollState + `, scrollOffset = ` + scrollOffset)  
192 - })  
193 - }  
194 - .width('100%')  
195 - .backgroundColor(Color.White) 207 + .backgroundColor(Color.White)
  208 + .onClick(() => {
196 209
  210 + })
  211 + }.width('100%')
  212 + .height('100%')
  213 + .backgroundColor('#80000000')
  214 + .onClick(() => {
  215 + if (this.closeDialog) {
  216 + this.closeDialog()
  217 + }
  218 + })
197 } 219 }
198 220
199 updateCurrentPageNum(firstIndex: number): void { 221 updateCurrentPageNum(firstIndex: number): void {