liyubing

Merge remote-tracking branch 'origin/main'

@@ -34,11 +34,10 @@ export struct ENewspaperItemComponent { @@ -34,11 +34,10 @@ export struct ENewspaperItemComponent {
34 .visibility(this.isShowSkeleton ? Visibility.Visible : Visibility.None) 34 .visibility(this.isShowSkeleton ? Visibility.Visible : Visibility.None)
35 Image(this.newspaperListItemBean.pagePic) 35 Image(this.newspaperListItemBean.pagePic)
36 .width('100%') 36 .width('100%')
37 - .aspectRatio(378 / 566)  
38 - .objectFit(ImageFit.Fill)  
39 .onComplete(() => { 37 .onComplete(() => {
40 this.isShowSkeleton = false 38 this.isShowSkeleton = false
41 }) 39 })
  40 + .objectFit(ImageFit.Contain)
42 .visibility(this.isShowSkeleton ? Visibility.None : Visibility.Visible) 41 .visibility(this.isShowSkeleton ? Visibility.None : Visibility.Visible)
43 42
44 Canvas(this.context) 43 Canvas(this.context)
@@ -49,7 +48,7 @@ export struct ENewspaperItemComponent { @@ -49,7 +48,7 @@ export struct ENewspaperItemComponent {
49 48
50 }) 49 })
51 } 50 }
52 - .padding({ top: 16, right: 16, bottom: 16, left: 16 }) 51 + .padding({ top:14, right: 10, bottom: 14, left: 10 })
53 .margin({ left: 10, right: 10 }) 52 .margin({ left: 10, right: 10 })
54 .backgroundColor(Color.White) 53 .backgroundColor(Color.White)
55 .width('100%') 54 .width('100%')
@@ -28,6 +28,8 @@ export struct ENewspaperPageComponent { @@ -28,6 +28,8 @@ export struct ENewspaperPageComponent {
28 @State swiperIndex: number = 0; 28 @State swiperIndex: number = 0;
29 //当前选择的日期标记 29 //当前选择的日期标记
30 @State selectDate: Date = new Date() 30 @State selectDate: Date = new Date()
  31 + @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
  32 + @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
31 33
32 //watch监听报纸页码回调 34 //watch监听报纸页码回调
33 onCurrentPageNumUpdated(): void { 35 onCurrentPageNumUpdated(): void {
@@ -102,7 +104,10 @@ export struct ENewspaperPageComponent { @@ -102,7 +104,10 @@ export struct ENewspaperPageComponent {
102 //获取宽高尺寸 104 //获取宽高尺寸
103 this.screenWidth = this.displayTool.width 105 this.screenWidth = this.displayTool.width
104 this.picWidth = this.screenWidth - vp2px(52) 106 this.picWidth = this.screenWidth - vp2px(52)
105 - this.picHeight = this.picWidth * 566 / 378 107 + let screenHeight = this.displayTool.height;
  108 + // bottomSafeHeight 底导高度 topSafeHeight 顶导高度 44 顶部高度 60 底部高度
  109 + let height = screenHeight -this.bottomSafeHeight - this.topSafeHeight - vp2px(44) - vp2px(60)
  110 + this.picHeight = height
106 // 默认日期 111 // 默认日期
107 const date = new Date() 112 const date = new Date()
108 const month = date.getMonth() + 1 113 const month = date.getMonth() + 1
@@ -213,10 +218,11 @@ export struct ENewspaperPageComponent { @@ -213,10 +218,11 @@ export struct ENewspaperPageComponent {
213 } 218 }
214 .index(this.swiperIndex) 219 .index(this.swiperIndex)
215 .width('100%') 220 .width('100%')
216 - .height(px2vp(this.picHeight) + 32) 221 + // newspaper_shadow 44 高度 e_newspaper_content 35 margin top
  222 + .height(px2vp(this.picHeight) - 44 - 35)
217 .vertical(true) 223 .vertical(true)
218 .autoPlay(false) 224 .autoPlay(false)
219 - .cachedCount(3) 225 + .cachedCount(1)
220 .indicator(false) 226 .indicator(false)
221 .loop(false) 227 .loop(false)
222 .displayCount(1) 228 .displayCount(1)
@@ -234,6 +240,7 @@ export struct ENewspaperPageComponent { @@ -234,6 +240,7 @@ export struct ENewspaperPageComponent {
234 240
235 Image($r('app.media.newspaper_shadow')) 241 Image($r('app.media.newspaper_shadow'))
236 .height($r('app.float.vp_12')) 242 .height($r('app.float.vp_12'))
  243 + .width('100%')
237 .margin({ left: 10, right: 10, top: -1 }) 244 .margin({ left: 10, right: 10, top: -1 })
238 .objectFit(ImageFit.Contain) 245 .objectFit(ImageFit.Contain)
239 .alignRules({ 246 .alignRules({
@@ -11,6 +11,7 @@ import { router } from '@kit.ArkUI'; @@ -11,6 +11,7 @@ import { router } from '@kit.ArkUI';
11 import { CommonConstants } from 'wdConstant/Index'; 11 import { CommonConstants } from 'wdConstant/Index';
12 import { ProcessUtils } from 'wdRouter/Index'; 12 import { ProcessUtils } from 'wdRouter/Index';
13 import { TrackConstants, TrackingButton, TrackingPageBrowse } from 'wdTracking/Index'; 13 import { TrackConstants, TrackingButton, TrackingPageBrowse } from 'wdTracking/Index';
  14 +import inputMethod from '@ohos.inputMethod';
14 15
15 const TAG = 'FeedBackActivity' 16 const TAG = 'FeedBackActivity'
16 17
@@ -23,14 +24,15 @@ const TAG = 'FeedBackActivity' @@ -23,14 +24,15 @@ const TAG = 'FeedBackActivity'
23 export struct FeedBackActivity { 24 export struct FeedBackActivity {
24 pageShowTime:number = 0; 25 pageShowTime:number = 0;
25 @State canSubmit: boolean = false; 26 @State canSubmit: boolean = false;
26 - @State textNumLabel: string = '0/500';  
27 - contact: string = ""; 27 + @State textNumLabel: number = 0;
28 email: string = ""; 28 email: string = "";
29 //UI 29 //UI
30 scroller: Scroller = new Scroller(); 30 scroller: Scroller = new Scroller();
31 31
32 @State isNetConnected: boolean = true 32 @State isNetConnected: boolean = true
33 33
  34 + @State editValue: FeedbackTypeBean = {classifyName:''} as FeedbackTypeBean
  35 +
34 @State feedbackTypeBeans: FeedbackTypeBean[] = [] as FeedbackTypeBean[] 36 @State feedbackTypeBeans: FeedbackTypeBean[] = [] as FeedbackTypeBean[]
35 //添加图片 37 //添加图片
36 addPic: PhotoListBean = {itemType:1} as PhotoListBean 38 addPic: PhotoListBean = {itemType:1} as PhotoListBean
@@ -107,7 +109,7 @@ export struct FeedBackActivity { @@ -107,7 +109,7 @@ export struct FeedBackActivity {
107 .width(CommonConstants.FULL_WIDTH) 109 .width(CommonConstants.FULL_WIDTH)
108 .margin({ left: 24, top: $r('app.float.vp_12') }) 110 .margin({ left: 24, top: $r('app.float.vp_12') })
109 Stack({ alignContent: Alignment.BottomEnd }) { 111 Stack({ alignContent: Alignment.BottomEnd }) {
110 - TextArea({ placeholder: $r('app.string.feedback_comments') }) 112 + TextArea({ placeholder: $r('app.string.feedback_comments'),text: this.editValue.classifyName})
111 .width(CommonConstants.FULL_WIDTH) 113 .width(CommonConstants.FULL_WIDTH)
112 .height(CommonConstants.FULL_HEIGHT) 114 .height(CommonConstants.FULL_HEIGHT)
113 .fontColor($r('app.color.color_222222')) 115 .fontColor($r('app.color.color_222222'))
@@ -116,12 +118,20 @@ export struct FeedBackActivity { @@ -116,12 +118,20 @@ export struct FeedBackActivity {
116 .placeholderFont({size:$r('app.float.font_size_13_2')}) 118 .placeholderFont({size:$r('app.float.font_size_13_2')})
117 .padding({bottom:96}) 119 .padding({bottom:96})
118 .backgroundColor($r('app.color.color_F5F5F5')) 120 .backgroundColor($r('app.color.color_F5F5F5'))
  121 + .outlineColor($r('app.color.color_F5F5F5'))
119 .align(Alignment.TopStart) 122 .align(Alignment.TopStart)
120 - .maxLength(500)  
121 .onChange((value) => { 123 .onChange((value) => {
122 - // Logger.debug(TAG, "onChange" + value + "/" + this.passwordContent)  
123 - this.contact = value  
124 - this.textNumLabel = value.length+"/500" 124 + if(value.length> 500){
  125 + //隐藏键盘
  126 + inputMethod.getController().stopInputSession();
  127 + ToastUtils.shortToast($r('app.string.res_feedback_commentsFail'))
  128 + // Logger.debug(TAG, "onChange > 500 " + value)
  129 + this.editValue = {classifyName:value.substring(0,500)} as FeedbackTypeBean
  130 + }else{
  131 + this.editValue.classifyName = value
  132 + }
  133 + // Logger.debug(TAG, "onChange " + value)
  134 + this.textNumLabel = value.length
125 this.canSubmit = this.checkSubmit() 135 this.canSubmit = this.checkSubmit()
126 }) 136 })
127 GridRow({ 137 GridRow({
@@ -185,9 +195,17 @@ export struct FeedBackActivity { @@ -185,9 +195,17 @@ export struct FeedBackActivity {
185 }) 195 })
186 } 196 }
187 .margin({bottom: $r('app.float.vp_12'), right: $r('app.float.vp_12'),left: $r('app.float.vp_12')}) 197 .margin({bottom: $r('app.float.vp_12'), right: $r('app.float.vp_12'),left: $r('app.float.vp_12')})
188 - Text(this.textNumLabel) 198 + Text(){
  199 + ContainerSpan(){
  200 + if(this.textNumLabel<500){
  201 + Span(this.textNumLabel+'/500').fontColor($r('app.color.color_999999'))
  202 + }else{
  203 + Span(this.textNumLabel+'').fontColor($r('app.color.color_ED2800'))
  204 + Span('/500').fontColor($r('app.color.color_999999'))
  205 + }
  206 + }
  207 + }
189 .margin({bottom: $r('app.float.vp_12'), right: $r('app.float.vp_11')}) 208 .margin({bottom: $r('app.float.vp_12'), right: $r('app.float.vp_11')})
190 - .fontColor($r('app.color.color_999999'))  
191 .fontSize($r('app.float.font_size_13_5')) 209 .fontSize($r('app.float.font_size_13_5'))
192 } 210 }
193 .height(200) 211 .height(200)
@@ -279,7 +297,7 @@ export struct FeedBackActivity { @@ -279,7 +297,7 @@ export struct FeedBackActivity {
279 * */ 297 * */
280 checkSubmit(): boolean { 298 checkSubmit(): boolean {
281 299
282 - if(StringUtils.isEmpty(this.contact) || this.contact.length < 10){ 300 + if(StringUtils.isEmpty(this.editValue.classifyName) || this.editValue.classifyName.length < 10){
283 return false 301 return false
284 } 302 }
285 303
@@ -395,7 +413,7 @@ export struct FeedBackActivity { @@ -395,7 +413,7 @@ export struct FeedBackActivity {
395 return 413 return
396 } 414 }
397 //内容必填 415 //内容必填
398 - if(StringUtils.isEmpty(this.contact) || this.contact.length < 10 || this.contact.length>500){ 416 + if(StringUtils.isEmpty(this.editValue.classifyName) || this.editValue.classifyName.length < 10 || this.editValue.classifyName.length>500){
399 ToastUtils.shortToast($r('app.string.res_feedback_commentsFail')) 417 ToastUtils.shortToast($r('app.string.res_feedback_commentsFail'))
400 return 418 return
401 } 419 }
@@ -403,7 +421,7 @@ export struct FeedBackActivity { @@ -403,7 +421,7 @@ export struct FeedBackActivity {
403 try { 421 try {
404 let feedBackParams: FeedBackParams = { 422 let feedBackParams: FeedBackParams = {
405 //反馈内容 423 //反馈内容
406 - "content": this.contact, 424 + "content": this.editValue.classifyName,
407 //投诉类型 id 425 //投诉类型 id
408 "classifyFlagIds": selectType, 426 "classifyFlagIds": selectType,
409 //设备 427 //设备
@@ -224,7 +224,7 @@ export struct MorningEveningPaperComponent { @@ -224,7 +224,7 @@ export struct MorningEveningPaperComponent {
224 if (imageSource) { 224 if (imageSource) {
225 const pixelMap: image.PixelMap = await imageNet2PixelMap(imageSource); 225 const pixelMap: image.PixelMap = await imageNet2PixelMap(imageSource);
226 effectKit.createColorPicker(pixelMap, (err, colorPicker) => { 226 effectKit.createColorPicker(pixelMap, (err, colorPicker) => {
227 - let color = colorPicker.getMainColorSync(); 227 + let color = colorPicker.getLargestProportionColor();
228 Logger.debug(TAG, "compInfoBean compStyle = " + color) 228 Logger.debug(TAG, "compInfoBean compStyle = " + color)
229 // color = ColorUtils.getMorningEveningPaperRgb({red:color.red,green:color.green,blue:color.blue,alpha:color.alpha}) 229 // color = ColorUtils.getMorningEveningPaperRgb({red:color.red,green:color.green,blue:color.blue,alpha:color.alpha})
230 // 将取色器选取的color示例转换为十六进制颜色代码 230 // 将取色器选取的color示例转换为十六进制颜色代码
@@ -273,6 +273,7 @@ export struct MorningEveningPaperComponent { @@ -273,6 +273,7 @@ export struct MorningEveningPaperComponent {
273 } 273 }
274 } 274 }
275 // .height(`calc(100% - ${this.bottomSafeHeight + this.topSafeHeight + 'vp'})`) 275 // .height(`calc(100% - ${this.bottomSafeHeight + this.topSafeHeight + 'vp'})`)
  276 + .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果
276 .scrollBar(BarState.Off) 277 .scrollBar(BarState.Off)
277 .onWillScroll(scrollOffset =>{ 278 .onWillScroll(scrollOffset =>{
278 this.scrollOffset = this.scrollOffset + scrollOffset as number 279 this.scrollOffset = this.scrollOffset + scrollOffset as number
@@ -19,31 +19,121 @@ export struct ZhSingleRow02 { @@ -19,31 +19,121 @@ export struct ZhSingleRow02 {
19 @State pageId: string = ''; 19 @State pageId: string = '';
20 @State pageName: string = ''; 20 @State pageName: string = '';
21 @State compDTO: CompDTO = {} as CompDTO 21 @State compDTO: CompDTO = {} as CompDTO
  22 + @State initMoreWidth: number = 16;
  23 + @State moreWidth:number = 16
  24 + @State moreTips: string = ''
  25 + scroller: Scroller = new Scroller()
  26 +
  27 + resetMoreTips() {
  28 + console.log('resetMoreTips', this.moreWidth, this.initMoreWidth)
  29 + if (this.moreWidth < this.initMoreWidth * 2) {
  30 + this.moreTips = '查看更多';
  31 + }
  32 + }
  33 +
  34 + edgeAnimation() {
  35 + if (this.moreWidth < this.initMoreWidth * 3) {
  36 + if (!this.moreTips) {
  37 + this.moreTips = '查看更多';
  38 + }
  39 + this.moreWidth = this.moreWidth + 2
  40 + }
  41 + if (this.moreWidth > this.initMoreWidth * 2) {
  42 + this.moreTips = '松手查看';
  43 + } else {
  44 +
  45 + }
  46 + }
  47 +
  48 + reverseEdgeAnimation() {
  49 + if (this.moreWidth > this.initMoreWidth) {
  50 + this.moreWidth = this.moreWidth - 2
  51 + }
  52 + this.resetMoreTips()
  53 + }
  54 +
  55 + resetEdgeAnimation() {
  56 + if (this.moreWidth > this.initMoreWidth) {
  57 + this.moreWidth = this.moreWidth - 1
  58 + this.resetEdgeAnimation();
  59 + }
  60 + this.resetMoreTips()
  61 + }
  62 +
  63 + toMore() {
  64 + if (this.moreWidth > this.initMoreWidth * 2) {
  65 + if (this.compDTO?.objectType === '11') {
  66 + ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string, this.compDTO.objectTitle)
  67 + } else if (this.compDTO?.objectType === '5') {
  68 + ProcessUtils._gotoSpecialTopic(this.compDTO.linkUrl)
  69 + } else if (this.compDTO?.objectType === '6') {
  70 + ProcessUtils._gotoDefaultWeb(this.compDTO.linkUrl)
  71 + }
  72 + }
  73 + }
22 74
23 build() { 75 build() {
24 Column() { 76 Column() {
25 //顶部 77 //顶部
26 this.CompHeader(this.compDTO) 78 this.CompHeader(this.compDTO)
27 - Row(){  
28 - // 列表内容  
29 - List() {  
30 - ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {  
31 - CreatorItem({  
32 - item,  
33 - index,  
34 - compDTO: this.compDTO,  
35 - pageId: this.pageId,  
36 - pageName: this.pageName 79 + // 列表内容
  80 + Scroll(this.scroller) {
  81 + Row() {
  82 + Row() {
  83 + ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {
  84 + CreatorItem({
  85 + item,
  86 + index,
  87 + compDTO: this.compDTO,
  88 + pageId: this.pageId,
  89 + pageName: this.pageName
  90 + })
  91 + .margin({ right: 8 })
37 }) 92 })
38 - .margin({right: index === this.compDTO.operDataList.length - 1 ? $r('app.float.card_comp_pagePadding_lf') : 0})  
39 - }) 93 + }
  94 + if (this.compDTO.operDataList.length > 2) {
  95 + Column() {
  96 + if (this.moreWidth > this.initMoreWidth + 2) {
  97 + Text(this.moreTips)
  98 + .fontSize(8)
  99 + .fontColor(0x858585)
  100 + .width(8)
  101 + }
  102 + }
  103 + .justifyContent(FlexAlign.Center)
  104 + .align(Alignment.Center)
  105 + .height('100%')
  106 + .width(this.moreWidth)
  107 + .backgroundColor(0xe9e9e9)
  108 + .borderRadius({ topLeft: 5, bottomLeft: 5 })
  109 + }
40 } 110 }
41 - .listDirection(Axis.Horizontal)  
42 - .scrollBar(BarState.Off)  
43 - .edgeEffect(EdgeEffect.None)  
44 } 111 }
45 .width(CommonConstants.FULL_WIDTH) 112 .width(CommonConstants.FULL_WIDTH)
46 .height(208) 113 .height(208)
  114 + .align(Alignment.Start)
  115 + .scrollable(this.compDTO.operDataList.length > 2 ? ScrollDirection.Horizontal : ScrollDirection.None)
  116 + .scrollBar(BarState.Off)
  117 + .edgeEffect(EdgeEffect.None)
  118 + .onReachEnd(() => {
  119 + this.edgeAnimation()
  120 + })
  121 + .onScrollStop(() => {
  122 + // this.resetEdgeAnimation();
  123 + })
  124 + .onScroll((xOffset: number, yOffset: number) => {
  125 + if (xOffset < 0) {
  126 + this.reverseEdgeAnimation();
  127 + }
  128 + })
  129 + .onTouch((event?: TouchEvent) => {
  130 + if(event) {
  131 + if (event.type === TouchType.Up) {
  132 + this.toMore();
  133 + this.resetEdgeAnimation();
  134 + }
  135 + }
  136 + })
47 } 137 }
48 .padding({ 138 .padding({
49 left: $r('app.float.card_comp_pagePadding_lf'), 139 left: $r('app.float.card_comp_pagePadding_lf'),
@@ -126,6 +216,7 @@ struct CreatorItem { @@ -126,6 +216,7 @@ struct CreatorItem {
126 .width(156) 216 .width(156)
127 .height(208) 217 .height(208)
128 .backgroundColor(0xf5f5f5) 218 .backgroundColor(0xf5f5f5)
  219 + .borderRadius(5)
129 220
130 Row() 221 Row()
131 .width(156) 222 .width(156)
@@ -134,6 +225,7 @@ struct CreatorItem { @@ -134,6 +225,7 @@ struct CreatorItem {
134 direction: GradientDirection.Bottom, 225 direction: GradientDirection.Bottom,
135 colors: [['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.3)', 1.0]] 226 colors: [['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.3)', 1.0]]
136 }) 227 })
  228 + .borderRadius(5)
137 Text(this.item.newsTitle) 229 Text(this.item.newsTitle)
138 .fontColor(0xffffff) 230 .fontColor(0xffffff)
139 .fontSize(14) 231 .fontSize(14)
@@ -145,7 +237,6 @@ struct CreatorItem { @@ -145,7 +237,6 @@ struct CreatorItem {
145 } 237 }
146 .width(156) 238 .width(156)
147 .height(208) 239 .height(208)
148 - .margin({ right: 11 })  
149 .borderColor($r('app.color.color_EDEDED')) 240 .borderColor($r('app.color.color_EDEDED'))
150 .borderRadius($r('app.float.image_border_radius')) 241 .borderRadius($r('app.float.image_border_radius'))
151 } 242 }
@@ -29,17 +29,61 @@ export struct ZhSingleRow03 { @@ -29,17 +29,61 @@ export struct ZhSingleRow03 {
29 @State pageId: string = ''; 29 @State pageId: string = '';
30 @State pageName: string = ''; 30 @State pageName: string = '';
31 @State compDTO: CompDTO = {} as CompDTO 31 @State compDTO: CompDTO = {} as CompDTO
32 - @State isEndEdge: boolean = false;  
33 // @State reserveStatus: reserveItem[] = [] 32 // @State reserveStatus: reserveItem[] = []
34 @State reservedIds: string[] = []; 33 @State reservedIds: string[] = [];
35 @State loadImg: boolean = false; 34 @State loadImg: boolean = false;
  35 + @State initMoreWidth: number = 16;
  36 + @State moreWidth:number = 16
  37 + @State moreTips: string = ''
  38 + scroller: Scroller = new Scroller()
  39 +
  40 + resetMoreTips() {
  41 + console.log('resetMoreTips', this.moreWidth, this.initMoreWidth)
  42 + if (this.moreWidth < this.initMoreWidth * 2) {
  43 + this.moreTips = '查看更多';
  44 + }
  45 + }
  46 +
  47 + edgeAnimation() {
  48 + if (this.moreWidth < this.initMoreWidth * 3) {
  49 + if (!this.moreTips) {
  50 + this.moreTips = '查看更多';
  51 + }
  52 + this.moreWidth = this.moreWidth + 2
  53 + }
  54 + if (this.moreWidth > this.initMoreWidth * 2) {
  55 + this.moreTips = '松手查看';
  56 + } else {
  57 +
  58 + }
  59 + }
  60 +
  61 + reverseEdgeAnimation() {
  62 + if (this.moreWidth > this.initMoreWidth) {
  63 + this.moreWidth = this.moreWidth - 2
  64 + }
  65 + this.resetMoreTips()
  66 + }
  67 +
  68 + resetEdgeAnimation() {
  69 + if (this.moreWidth > this.initMoreWidth) {
  70 + this.moreWidth = this.moreWidth - 1
  71 + this.resetEdgeAnimation();
  72 + }
  73 + this.resetMoreTips()
  74 + }
  75 +
  76 + toMore() {
  77 + if (this.moreWidth > this.initMoreWidth * 2) {
  78 + this.jumpToMore()
  79 + }
  80 + }
36 81
37 async aboutToAppear(): Promise<void> { 82 async aboutToAppear(): Promise<void> {
38 this.getReserveState(); 83 this.getReserveState();
39 this.loadImg = await onlyWifiLoadImg(); 84 this.loadImg = await onlyWifiLoadImg();
40 } 85 }
41 86
42 - scroller: Scroller = new Scroller()  
43 87
44 // 请求所有预约状态 88 // 请求所有预约状态
45 async getReserveState() { 89 async getReserveState() {
@@ -106,25 +150,51 @@ export struct ZhSingleRow03 { @@ -106,25 +150,51 @@ export struct ZhSingleRow03 {
106 150
107 Scroll(this.scroller){ 151 Scroll(this.scroller){
108 Row() { 152 Row() {
109 - ForEach(this.compDTO.operDataList, (item: ContentDTO) => {  
110 - this.ItemCard(item)  
111 - }) 153 + Row() {
  154 + ForEach(this.compDTO.operDataList, (item: ContentDTO) => {
  155 + this.ItemCard(item)
  156 + })
  157 + }
  158 + if (this.compDTO.operDataList.length > 2) {
  159 + Column() {
  160 + if (this.moreWidth > this.initMoreWidth + 2) {
  161 + Text(this.moreTips)
  162 + .fontSize(8)
  163 + .fontColor(0x858585)
  164 + .width(8)
  165 + }
  166 + }
  167 + .justifyContent(FlexAlign.Center)
  168 + .align(Alignment.Center)
  169 + .width(this.moreWidth)
  170 + .backgroundColor(0xf9f9f9)
  171 + .borderRadius({ topLeft: 5, bottomLeft: 5 })
  172 + .height(116)
  173 + }
112 } 174 }
113 } 175 }
114 - .scrollable(ScrollDirection.Horizontal) 176 + .align(Alignment.Start)
  177 + .scrollable(this.compDTO.operDataList.length > 2 ? ScrollDirection.Horizontal : ScrollDirection.None)
115 .scrollBar(BarState.Off) 178 .scrollBar(BarState.Off)
116 - .onScrollEdge((side: Edge) => {  
117 - if (side === Edge.End) {  
118 - this.isEndEdge = true;  
119 - } 179 + .edgeEffect(EdgeEffect.None)
  180 + .onReachEnd(() => {
  181 + this.edgeAnimation()
120 }) 182 })
121 .onScrollStop(() => { 183 .onScrollStop(() => {
122 - if (this.isEndEdge) {  
123 - this.jumpToMore();  
124 - } 184 + // this.resetEdgeAnimation();
125 }) 185 })
126 .onScroll((xOffset: number, yOffset: number) => { 186 .onScroll((xOffset: number, yOffset: number) => {
127 - this.isEndEdge = false; 187 + if (xOffset < 0) {
  188 + this.reverseEdgeAnimation();
  189 + }
  190 + })
  191 + .onTouch((event?: TouchEvent) => {
  192 + if(event) {
  193 + if (event.type === TouchType.Up) {
  194 + this.toMore();
  195 + this.resetEdgeAnimation();
  196 + }
  197 + }
128 }) 198 })
129 } 199 }
130 .padding({ 200 .padding({
@@ -11,6 +11,14 @@ import { FollowOperationRequestItem } from '../../../viewmodel/FollowOperationRe @@ -11,6 +11,14 @@ import { FollowOperationRequestItem } from '../../../viewmodel/FollowOperationRe
11 export struct FollowChildComponent{ 11 export struct FollowChildComponent{
12 @ObjectLink data: FollowListDetailItem 12 @ObjectLink data: FollowListDetailItem
13 @State type:number = 0 13 @State type:number = 0
  14 + @State columnHeight:number = 202
  15 +
  16 +
  17 + aboutToAppear(): void {
  18 + if(this.type == 0 && StringUtils.isEmpty(this.data.introduction)){
  19 + this.columnHeight = 202 - 31
  20 + }
  21 + }
14 22
15 build() { 23 build() {
16 if(this.type == 0 ){ 24 if(this.type == 0 ){
@@ -115,7 +123,7 @@ export struct FollowChildComponent{ @@ -115,7 +123,7 @@ export struct FollowChildComponent{
115 .justifyContent(FlexAlign.SpaceBetween) 123 .justifyContent(FlexAlign.SpaceBetween)
116 .alignItems(VerticalAlign.Top) 124 .alignItems(VerticalAlign.Top)
117 125
118 - }.height('202lpx') 126 + }.height(`${this.columnHeight}lpx`)
119 .justifyContent(FlexAlign.Start) 127 .justifyContent(FlexAlign.Start)
120 128
121 Divider() 129 Divider()
@@ -144,13 +144,11 @@ export struct FollowListDetailUI { @@ -144,13 +144,11 @@ export struct FollowListDetailUI {
144 value.list.forEach((value) => { 144 value.list.forEach((value) => {
145 let fansNum: number = value.fansNum 145 let fansNum: number = value.fansNum
146 let fansNumString = "" 146 let fansNumString = ""
147 - if (fansNum > 10000) {  
148 - let temp = (fansNum / 10000) + ""  
149 - let index = temp.indexOf('.')  
150 - if (index != -1) {  
151 - temp = temp.substring(0, index + 2)  
152 - } else {  
153 - temp = temp 147 +
  148 + if (fansNum >= 10000) {
  149 + let temp = (fansNum / 10000) .toFixed(1)
  150 + if (Number(temp.substring(temp.length-1)) == 0) {
  151 + temp = temp.substring(0, temp.length-2)
154 } 152 }
155 fansNumString = temp + "万" 153 fansNumString = temp + "万"
156 } else { 154 } else {
@@ -8,6 +8,62 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { @@ -8,6 +8,62 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
8 @State compDTO: CompDTO = {} as CompDTO 8 @State compDTO: CompDTO = {} as CompDTO
9 @State pageId: string = ''; 9 @State pageId: string = '';
10 @State pageName: string = ''; 10 @State pageName: string = '';
  11 + @State initMoreWidth: number = 16;
  12 + @State moreWidth:number = 16
  13 + @State moreTips: string = ''
  14 + scroller: Scroller = new Scroller()
  15 +
  16 + resetMoreTips() {
  17 + console.log('resetMoreTips', this.moreWidth, this.initMoreWidth)
  18 + if (this.moreWidth < this.initMoreWidth * 2) {
  19 + this.moreTips = '查看更多';
  20 + }
  21 + }
  22 +
  23 + edgeAnimation() {
  24 + if (this.moreWidth < this.initMoreWidth * 3) {
  25 + if (!this.moreTips) {
  26 + this.moreTips = '查看更多';
  27 + }
  28 + this.moreWidth = this.moreWidth + 2
  29 + }
  30 + if (this.moreWidth > this.initMoreWidth * 2) {
  31 + this.moreTips = '松手查看';
  32 + } else {
  33 +
  34 + }
  35 + }
  36 +
  37 + reverseEdgeAnimation() {
  38 + if (this.moreWidth > this.initMoreWidth) {
  39 + this.moreWidth = this.moreWidth - 2
  40 + }
  41 + this.resetMoreTips()
  42 + }
  43 +
  44 + resetEdgeAnimation() {
  45 + if (this.moreWidth > this.initMoreWidth) {
  46 + this.moreWidth = this.moreWidth - 1
  47 + this.resetEdgeAnimation();
  48 + }
  49 + this.resetMoreTips()
  50 + }
  51 +
  52 + toMore() {
  53 + if (this.moreWidth > this.initMoreWidth * 2) {
  54 + if (this.compDTO.linkUrl) {
  55 + let taskAction: Action = {
  56 + type: 'JUMP_H5_BY_WEB_VIEW',
  57 + params: {
  58 + url: this.compDTO.linkUrl
  59 + } as Params,
  60 + };
  61 + WDRouterRule.jumpWithAction(taskAction)
  62 + } else {
  63 + this.jumpToLiveMorePage()
  64 + }
  65 + }
  66 + }
11 67
12 build() { 68 build() {
13 Column() { 69 Column() {
@@ -53,40 +109,78 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { @@ -53,40 +109,78 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
53 .width('100%') 109 .width('100%')
54 110
55 // .backgroundColor($r("app.color.white")) 111 // .backgroundColor($r("app.color.white"))
56 - List({ space: 12 }) { 112 + Scroll(this.scroller) {
  113 + Row() {
  114 + Row() {
  115 + ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {
  116 + Column() {
  117 + Image(item.coverUrl)
  118 + .aspectRatio(1.5)
  119 + .width(this.compDTO.operDataList.length == 2 ? 210 : 150)
  120 + .borderRadius(4)
  121 + .objectFit(ImageFit.Cover)
57 122
58 - ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {  
59 - ListItem() { 123 + Text(item.newsTitle)
  124 + .fontSize($r("app.float.font_size_14"))
  125 + .fontColor($r("app.color.color_212228"))
  126 + .fontWeight(400)
  127 + .maxLines(2)
  128 + .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
  129 + .textAlign(TextAlign.Start)
  130 + .margin({ top: 8 })
  131 + .width(150)
  132 + .lineHeight(19)
  133 + }
  134 + .padding({ left: (index == 0) ? 16 : 0, right: 16 })
  135 + // .offset({x:16})
  136 + .onClick(() => {
  137 + InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName)
  138 + ProcessUtils.processPage(item)
  139 + })
  140 + })
  141 + }
  142 + if (this.compDTO.operDataList.length > 2) {
60 Column() { 143 Column() {
61 - Image(item.coverUrl)  
62 - .aspectRatio(1.5)  
63 - .width(this.compDTO.operDataList.length == 2 ? 210 : 150)  
64 - .borderRadius(4)  
65 - .objectFit(ImageFit.Cover)  
66 -  
67 - Text(item.newsTitle)  
68 - .fontSize($r("app.float.font_size_14"))  
69 - .fontColor($r("app.color.color_212228"))  
70 - .fontWeight(400)  
71 - .maxLines(2)  
72 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。  
73 - .textAlign(TextAlign.Start)  
74 - .margin({ top: 8 })  
75 - .width(150)  
76 - .lineHeight(19) 144 + if (this.moreWidth > this.initMoreWidth + 2) {
  145 + Text(this.moreTips)
  146 + .fontSize(8)
  147 + .fontColor(0x858585)
  148 + .width(8)
  149 + }
77 } 150 }
  151 + .justifyContent(FlexAlign.Center)
  152 + .align(Alignment.Center)
  153 + .width(this.moreWidth)
  154 + .backgroundColor(0xf1f3f4)
  155 + .borderRadius({ topLeft: 5, bottomLeft: 5 })
  156 + .height(this.compDTO.operDataList.length == 2 ? 180 : 146)
78 } 157 }
79 - .padding({ left: (index == 0) ? 16 : 0, right: (index == this.compDTO.operDataList.length - 1) ? 16 : 0 })  
80 - // .offset({x:16})  
81 - .onClick(() => {  
82 - InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName)  
83 - ProcessUtils.processPage(item)  
84 - })  
85 - })  
86 -  
87 - }.listDirection(Axis.Horizontal) 158 + }
  159 + }
  160 + .align(Alignment.Start)
  161 + .scrollable(this.compDTO.operDataList.length > 2 ? ScrollDirection.Horizontal : ScrollDirection.None)
88 .scrollBar(BarState.Off) 162 .scrollBar(BarState.Off)
89 - .width('100%') 163 + .edgeEffect(EdgeEffect.None)
  164 + .onReachEnd(() => {
  165 + this.edgeAnimation()
  166 + })
  167 + .onScrollStop(() => {
  168 + // this.resetEdgeAnimation();
  169 + })
  170 + .onScroll((xOffset: number, yOffset: number) => {
  171 + if (xOffset < 0) {
  172 + this.reverseEdgeAnimation();
  173 + }
  174 + })
  175 + .onTouch((event?: TouchEvent) => {
  176 + if(event) {
  177 + if (event.type === TouchType.Up) {
  178 + this.toMore();
  179 + this.resetEdgeAnimation();
  180 + }
  181 + }
  182 + })
  183 + // .width('100%')
90 184
91 // .backgroundColor($r("app.color.color_FE4B05")) 185 // .backgroundColor($r("app.color.color_FE4B05"))
92 // .padding({left:16,right:16}) 186 // .padding({left:16,right:16})
@@ -18,6 +18,62 @@ export struct LiveHorizontalCardComponent { @@ -18,6 +18,62 @@ export struct LiveHorizontalCardComponent {
18 @State pageName: string = ''; 18 @State pageName: string = '';
19 @State compDTO: CompDTO = {} as CompDTO 19 @State compDTO: CompDTO = {} as CompDTO
20 @State loadImg: boolean = false; 20 @State loadImg: boolean = false;
  21 + @State initMoreWidth: number = 16;
  22 + @State moreWidth:number = 16
  23 + @State moreTips: string = ''
  24 + scroller: Scroller = new Scroller()
  25 +
  26 + resetMoreTips() {
  27 + console.log('resetMoreTips', this.moreWidth, this.initMoreWidth)
  28 + if (this.moreWidth < this.initMoreWidth * 2) {
  29 + this.moreTips = '查看更多';
  30 + }
  31 + }
  32 +
  33 + edgeAnimation() {
  34 + if (this.moreWidth < this.initMoreWidth * 3) {
  35 + if (!this.moreTips) {
  36 + this.moreTips = '查看更多';
  37 + }
  38 + this.moreWidth = this.moreWidth + 2
  39 + }
  40 + if (this.moreWidth > this.initMoreWidth * 2) {
  41 + this.moreTips = '松手查看';
  42 + } else {
  43 +
  44 + }
  45 + }
  46 +
  47 + reverseEdgeAnimation() {
  48 + if (this.moreWidth > this.initMoreWidth) {
  49 + this.moreWidth = this.moreWidth - 2
  50 + }
  51 + this.resetMoreTips()
  52 + }
  53 +
  54 + resetEdgeAnimation() {
  55 + if (this.moreWidth > this.initMoreWidth) {
  56 + this.moreWidth = this.moreWidth - 1
  57 + this.resetEdgeAnimation();
  58 + }
  59 + this.resetMoreTips()
  60 + }
  61 +
  62 + toMore() {
  63 + if (this.moreWidth > this.initMoreWidth * 2) {
  64 + if (this.compDTO.linkUrl) {
  65 + let taskAction: Action = {
  66 + type: 'JUMP_H5_BY_WEB_VIEW',
  67 + params: {
  68 + url: this.compDTO.linkUrl
  69 + } as Params,
  70 + };
  71 + WDRouterRule.jumpWithAction(taskAction)
  72 + } else {
  73 + this.jumpToLiveMorePage()
  74 + }
  75 + }
  76 + }
21 77
22 async aboutToAppear(): Promise<void> { 78 async aboutToAppear(): Promise<void> {
23 this.loadImg = await onlyWifiLoadImg(); 79 this.loadImg = await onlyWifiLoadImg();
@@ -69,46 +125,85 @@ export struct LiveHorizontalCardComponent { @@ -69,46 +125,85 @@ export struct LiveHorizontalCardComponent {
69 125
70 // 多个 126 // 多个
71 if (this.compDTO.operDataList.length >= 2) { 127 if (this.compDTO.operDataList.length >= 2) {
72 - List({ space: 12 }) {  
73 - ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {  
74 - ListItem() {  
75 - Column() {  
76 - Stack({ alignContent: Alignment.BottomEnd }) {  
77 - Image(this.loadImg ? item.coverUrl : '')  
78 - .backgroundColor(0xf5f5f5)  
79 - .aspectRatio(16 / 9) 128 + Scroll(this.scroller) {
  129 + Row() {
  130 + Row() {
  131 + ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {
  132 + Column() {
  133 + Stack({ alignContent: Alignment.BottomEnd }) {
  134 + Image(this.loadImg ? item.coverUrl : '')
  135 + .backgroundColor(0xf5f5f5)
  136 + .aspectRatio(16 / 9)
  137 + .width(this.compDTO.operDataList.length == 2 ? 210 : 150)
  138 + .borderRadius(4)
  139 + .objectFit(ImageFit.Cover)
  140 + CardMediaInfo({
  141 + livePeopleNum:false,
  142 + contentDTO: item
  143 + })
  144 + }
  145 +
  146 + Text(item.newsTitle)
  147 + .fontSize($r("app.float.font_size_14"))
  148 + .fontColor($r("app.color.color_212228"))
  149 + .fontWeight(400)
  150 + .maxLines(2)
  151 + .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
  152 + .textAlign(TextAlign.Start)
  153 + .margin({ top: 8 })
80 .width(this.compDTO.operDataList.length == 2 ? 210 : 150) 154 .width(this.compDTO.operDataList.length == 2 ? 210 : 150)
81 - .borderRadius(4)  
82 - .objectFit(ImageFit.Cover)  
83 - CardMediaInfo({  
84 - livePeopleNum:false,  
85 - contentDTO: item  
86 - })  
87 } 155 }
88 -  
89 - Text(item.newsTitle)  
90 - .fontSize($r("app.float.font_size_14"))  
91 - .fontColor($r("app.color.color_212228"))  
92 - .fontWeight(400)  
93 - .maxLines(2)  
94 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。  
95 - .textAlign(TextAlign.Start)  
96 - .margin({ top: 8 })  
97 - .width(this.compDTO.operDataList.length == 2 ? 210 : 150)  
98 - } 156 + .padding({ left: (index == 0) ? 16 : 0, right: 16 })
  157 + .onClick(() => {
  158 + InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName)
  159 + if (item.objectType != '0') {
  160 + console.log(item.objectId)
  161 + this.gotoLive(item)
  162 + }
  163 + })
  164 + })
99 } 165 }
100 - .padding({ left: (index == 0) ? 16 : 0, right: (index == this.compDTO.operDataList.length - 1) ? 16 : 0 })  
101 - .onClick(() => {  
102 - InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName)  
103 - if (item.objectType != '0') {  
104 - console.log(item.objectId)  
105 - this.gotoLive(item) 166 + if (this.compDTO.operDataList.length > 2) {
  167 + Column() {
  168 + if (this.moreWidth > this.initMoreWidth + 2) {
  169 + Text(this.moreTips)
  170 + .fontSize(8)
  171 + .fontColor(0x858585)
  172 + .width(8)
  173 + }
106 } 174 }
107 - })  
108 - }) 175 + .justifyContent(FlexAlign.Center)
  176 + .align(Alignment.Center)
  177 + .width(this.moreWidth)
  178 + .backgroundColor(0xf1f3f4)
  179 + .borderRadius({ topLeft: 5, bottomLeft: 5 })
  180 + .height(this.compDTO.operDataList.length == 2 ? 180 : 146)
  181 + }
  182 + }
109 } 183 }
110 - .listDirection(Axis.Horizontal) 184 + .align(Alignment.Start)
  185 + .scrollable(this.compDTO.operDataList.length > 2 ? ScrollDirection.Horizontal : ScrollDirection.None)
111 .scrollBar(BarState.Off) 186 .scrollBar(BarState.Off)
  187 + .edgeEffect(EdgeEffect.None)
  188 + .onReachEnd(() => {
  189 + this.edgeAnimation()
  190 + })
  191 + .onScrollStop(() => {
  192 + // this.resetEdgeAnimation();
  193 + })
  194 + .onScroll((xOffset: number, yOffset: number) => {
  195 + if (xOffset < 0) {
  196 + this.reverseEdgeAnimation();
  197 + }
  198 + })
  199 + .onTouch((event?: TouchEvent) => {
  200 + if(event) {
  201 + if (event.type === TouchType.Up) {
  202 + this.toMore();
  203 + this.resetEdgeAnimation();
  204 + }
  205 + }
  206 + })
112 .width(CommonConstants.FULL_WIDTH) 207 .width(CommonConstants.FULL_WIDTH)
113 .height(this.compDTO.operDataList.length == 2 ? 180 : 136) 208 .height(this.compDTO.operDataList.length == 2 ? 180 : 136)
114 } else if (this.compDTO.operDataList.length) { 209 } else if (this.compDTO.operDataList.length) {
@@ -7,8 +7,8 @@ struct GuidePages { @@ -7,8 +7,8 @@ struct GuidePages {
7 // guideImage = [$r('app.media.guide_static1'), $r('app.media.guide_static2'), $r('app.media.guide_static3'), $r('app.media.guide_static4'),$r('app.media.guide_static5')] 7 // guideImage = [$r('app.media.guide_static1'), $r('app.media.guide_static2'), $r('app.media.guide_static3'), $r('app.media.guide_static4'),$r('app.media.guide_static5')]
8 // guideTitle = [$r('app.media.guide_title1'), $r('app.media.guide_title2'), $r('app.media.guide_title3'), $r('app.media.guide_title4'),$r('app.media.guide_title5')] 8 // guideTitle = [$r('app.media.guide_title1'), $r('app.media.guide_title2'), $r('app.media.guide_title3'), $r('app.media.guide_title4'),$r('app.media.guide_title5')]
9 // guideIndex = [$r('app.media.guide_index1'), $r('app.media.guide_index2'), $r('app.media.guide_index3'),$r('app.media.guide_index4'), $r('app.media.guide_button')] 9 // guideIndex = [$r('app.media.guide_index1'), $r('app.media.guide_index2'), $r('app.media.guide_index3'),$r('app.media.guide_index4'), $r('app.media.guide_button')]
10 - guideImage = [$r('app.media.guide_Static')]  
11 - guideIndex = [$r('app.media.guide_button')] 10 + guideImage = [$r('app.media.guide_Static'),'']
  11 + guideIndex = [$r('app.media.guide_button'),'']
12 12
13 build() { 13 build() {
14 Column() { 14 Column() {
@@ -17,10 +17,16 @@ struct GuidePages { @@ -17,10 +17,16 @@ struct GuidePages {
17 this.ChildItem(index) 17 this.ChildItem(index)
18 18
19 }, (item: number) => JSON.stringify(item)) 19 }, (item: number) => JSON.stringify(item))
20 - }.loop(false).disableSwipe(true) 20 + }.loop(false)
21 .indicator(false) 21 .indicator(false)
22 .width('100%') 22 .width('100%')
23 .height('100%') 23 .height('100%')
  24 + .effectMode(EdgeEffect.None)
  25 + .onChange(index => {
  26 + if (index == 1) {
  27 + WDRouterRule.jumpWithReplacePage(WDRouterPage.launchInterestsPage)
  28 + }
  29 + })
24 }.width('100%') 30 }.width('100%')
25 .height('100%') 31 .height('100%')
26 32
@@ -103,8 +103,8 @@ struct LaunchAdvertisingPage { @@ -103,8 +103,8 @@ struct LaunchAdvertisingPage {
103 .fontSize('24lpx') 103 .fontSize('24lpx')
104 .width('72lpx') 104 .width('72lpx')
105 .height('36lpx') 105 .height('36lpx')
106 - .borderRadius(5)  
107 - .margin({top:'10lpx',left:'19lpx'}) 106 + .borderRadius(2)
  107 + .margin({top:'15lpx',left:'19lpx'})
108 .backgroundColor('#80000000') 108 .backgroundColor('#80000000')
109 } 109 }
110 .width('100%') 110 .width('100%')
@@ -191,7 +191,7 @@ struct LaunchAdvertisingPage { @@ -191,7 +191,7 @@ struct LaunchAdvertisingPage {
191 this.trackingLaunchClick() 191 this.trackingLaunchClick()
192 192
193 if(this.defaultModel.linkUrl.length > 0){ 193 if(this.defaultModel.linkUrl.length > 0){
194 - if (this.defaultModel.objectType == '2') { 194 + if (this.defaultModel.openType == '2') {
195 //端外打开 195 //端外打开
196 ProcessUtils.jumpExternalWebPage(this.defaultModel.linkUrl) 196 ProcessUtils.jumpExternalWebPage(this.defaultModel.linkUrl)
197 }else { 197 }else {
@@ -3,8 +3,9 @@ import { WDRouterRule } from 'wdRouter'; @@ -3,8 +3,9 @@ import { WDRouterRule } from 'wdRouter';
3 import { WDRouterPage } from 'wdRouter'; 3 import { WDRouterPage } from 'wdRouter';
4 import { SPHelper } from 'wdKit/Index'; 4 import { SPHelper } from 'wdKit/Index';
5 import { SpConstants } from 'wdConstant/Index'; 5 import { SpConstants } from 'wdConstant/Index';
6 -import { ButtonOptions, promptAction } from '@kit.ArkUI'; 6 +import { ButtonOptions, promptAction, window } from '@kit.ArkUI';
7 import { ParamType, TrackConstants, TrackingContent } from 'wdTracking/Index'; 7 import { ParamType, TrackConstants, TrackingContent } from 'wdTracking/Index';
  8 +import { ImageKnifeComponent } from '@ohos/imageknife';
8 9
9 @Entry 10 @Entry
10 @Component 11 @Component
@@ -13,7 +14,6 @@ struct LaunchInterestsHobbiesPage { @@ -13,7 +14,6 @@ struct LaunchInterestsHobbiesPage {
13 @State selectCount: number = 0 14 @State selectCount: number = 0
14 @State interestsArray: InterestsList[] = [] 15 @State interestsArray: InterestsList[] = []
15 16
16 -  
17 aboutToAppear(){ 17 aboutToAppear(){
18 //请求接口,获取兴趣偏好数据 18 //请求接口,获取兴趣偏好数据
19 this.requestInterestsData() 19 this.requestInterestsData()
@@ -21,106 +21,116 @@ struct LaunchInterestsHobbiesPage { @@ -21,106 +21,116 @@ struct LaunchInterestsHobbiesPage {
21 21
22 build() { 22 build() {
23 Column() { 23 Column() {
24 - Row(){  
25 - Blank()  
26 - Text('跳过')  
27 - .fontSize('27lpx')  
28 - .fontColor('#333333')  
29 - .width('54lpx')  
30 - .height('35lpx')  
31 - .margin({top:'27lpx',right:'46lpx'})  
32 - .onClick(()=>{  
33 - //直接跳过到首页  
34 - //跳转首页  
35 - WDRouterRule.jumpWithReplacePage(WDRouterPage.mainPage)  
36 -  
37 - this.trackingLaunchJumpOver(false)  
38 - })  
39 - }  
40 - .width('100%')  
41 - .justifyContent(FlexAlign.End)  
42 -  
43 - Text('选择感兴趣的内容')  
44 - .fontSize('46lpx')  
45 - .fontWeight(FontWeight.Bold)  
46 - .textAlign(TextAlign.Center)  
47 - .fontColor('#333333')  
48 - .width('100%')  
49 - .height('61lpx')  
50 - .margin({top:'84lpx'})  
51 - Text('完善信息,将为您推荐个性化的内容')  
52 - .fontSize('27lpx')  
53 - .textAlign(TextAlign.Center)  
54 - .fontColor('#9E9E9E')  
55 - .width('100%')  
56 - .height('35lpx')  
57 - .margin({top:'12lpx'})  
58 -  
59 - Grid( ){  
60 - ForEach(this.interestsArray,(item:InterestsList,index:number)=>{  
61 - GridItem(){  
62 - Stack({alignContent:Alignment.TopStart}){  
63 -  
64 - Image(item.pic)  
65 - .width('100%')  
66 - .height('100%')  
67 - .backgroundColor(Color.White)  
68 - .borderRadius(5)  
69 - Stack(){  
70 - Image('')  
71 - .width('100%')  
72 - .height('100%')  
73 - .backgroundColor(Color.Black)  
74 - .opacity(item.choose?0.5:0)  
75 - .borderRadius(5)  
76 - }  
77 -  
78 - Stack(){  
79 - Column({}){  
80 - Text(item.name)  
81 - .fontSize(18)  
82 - .fontColor('#FFFFFF')  
83 - .margin({top:'21lpx',left:'19lpx'})  
84 - .width('100%')  
85 - .height('46lpx')  
86 - .fontWeight(FontWeight.Bold)  
87 - Text(item.title)  
88 - .fontSize('23lpx')  
89 - .fontColor('#FFFFFF')  
90 - .margin({top:'2lpx',left:'19lpx'}) 24 + Stack(){
  25 + Column(){
  26 + Row(){
  27 + Blank()
  28 + Text('跳过')
  29 + .fontSize('27lpx')
  30 + .fontColor('#333333')
  31 + .width('54lpx')
  32 + .height('35lpx')
  33 + .margin({right:'46lpx'})
  34 + .onClick(()=>{
  35 + //直接跳过到首页
  36 + //跳转首页
  37 + WDRouterRule.jumpWithReplacePage(WDRouterPage.mainPage)
  38 +
  39 + this.trackingLaunchJumpOver(false)
  40 + })
  41 + }
  42 + .width('100%')
  43 + .justifyContent(FlexAlign.End)
  44 +
  45 + Text('选择感兴趣的内容')
  46 + .fontSize('46lpx')
  47 + .fontWeight(FontWeight.Bold)
  48 + .textAlign(TextAlign.Center)
  49 + .fontColor('#333333')
  50 + .width('100%')
  51 + .height('61lpx')
  52 + .margin({top:'84lpx'})
  53 + Text('完善信息,将为您推荐个性化的内容')
  54 + .fontSize('27lpx')
  55 + .textAlign(TextAlign.Center)
  56 + .fontColor('#9E9E9E')
  57 + .width('100%')
  58 + .height('35lpx')
  59 + .margin({top:'12lpx'})
  60 +
  61 + Grid( ){
  62 + ForEach(this.interestsArray,(item:InterestsList,index:number)=>{
  63 + GridItem(){
  64 + Stack({alignContent:Alignment.TopStart}){
  65 + ImageKnifeComponent({imageKnifeOption:{loadSrc:item.pic}})
91 .width('100%') 66 .width('100%')
92 - .height('31lpx')  
93 - Image(item.choose ? $r('app.media.interestsSelected') : $r('app.media.interestsSelectNot'))  
94 - .height('32lpx')  
95 - .width('32lpx')  
96 - .margin({top:'80lpx',left:'110lpx'})  
97 -  
98 - }.justifyContent(FlexAlign.Start) 67 + .height('100%')
  68 + .backgroundColor(Color.White)
  69 + .borderRadius(5)
  70 + // Image(item.pic)
  71 + // .width('100%')
  72 + // .height('100%')
  73 + // .backgroundColor(Color.White)
  74 + // .borderRadius(5)
  75 + Stack(){
  76 + Image('')
  77 + .width('100%')
  78 + .height('100%')
  79 + .backgroundColor(Color.Black)
  80 + .opacity(item.choose?0.5:0)
  81 + .borderRadius(5)
  82 + }
  83 + Stack(){
  84 + Column({}){
  85 + Text(item.name)
  86 + .fontSize(18)
  87 + .fontColor('#FFFFFF')
  88 + .margin({top:'21lpx',left:'19lpx'})
  89 + .width('100%')
  90 + .height('46lpx')
  91 + .fontWeight(FontWeight.Bold)
  92 + Text(item.title)
  93 + .fontSize('23lpx')
  94 + .fontColor('#FFFFFF')
  95 + .margin({top:'2lpx',left:'19lpx'})
  96 + .width('100%')
  97 + .height('31lpx')
  98 + Image(item.choose ? $r('app.media.interestsSelected') : $r('app.media.interestsSelectNot'))
  99 + .height('32lpx')
  100 + .width('32lpx')
  101 + .margin({top:'80lpx',left:'110lpx'})
  102 +
  103 + }.justifyContent(FlexAlign.Start)
  104 + }
  105 +
  106 + }
99 } 107 }
  108 + .width('192lpx')
  109 + .height('230lpx')
  110 + .borderRadius('8lpx')
  111 + .onClick(()=>{
  112 + //选择后改变已选择属性
  113 + item.choose = !item.choose
  114 + this.interestsArray.splice(index,1,item)
  115 + this.selectCount = this.interestsArray.filter(item => item.choose).length
  116 + })
100 117
101 - } 118 + })
102 } 119 }
103 - .width('192lpx')  
104 - .height('230lpx')  
105 - .borderRadius('8lpx')  
106 - .onClick(()=>{  
107 - //选择后改变已选择属性  
108 - item.choose = !item.choose  
109 - this.interestsArray.splice(index,1,item)  
110 - this.selectCount = this.interestsArray.filter(item => item.choose).length  
111 - })  
112 -  
113 - })  
114 - 120 + .width('90%')
  121 + // .height('70%')
  122 + .margin({top:'61lpx',bottom:'240lpx'})
  123 + .columnsTemplate('1fr 1fr 1fr')
  124 + .columnsGap('23lpx')
  125 + .rowsGap('23lpx')
  126 + .scrollBar(BarState.Off)
  127 + }
  128 + .width('100%')
  129 + .height('100%')
115 } 130 }
116 - .width('90%')  
117 - .height('70%')  
118 - .margin({top:'61lpx'})  
119 - .columnsTemplate('1fr 1fr 1fr')  
120 - // .rowsTemplate('1fr 1fr 1fr 1fr')  
121 - .columnsGap('23lpx')  
122 - .rowsGap('23lpx')  
123 - .scrollBar(BarState.Off) 131 + .width('100%')
  132 + .height(`calc(100% - ${108 + 'lpx'})`)
  133 + // .backgroundColor(Color.Red)
124 134
125 Stack({alignContent:Alignment.Center}){ 135 Stack({alignContent:Alignment.Center}){
126 Button(this.selectCount == 0?'选好了':'选好了(' + this.selectCount + ')') 136 Button(this.selectCount == 0?'选好了':'选好了(' + this.selectCount + ')')
@@ -131,9 +141,11 @@ struct LaunchInterestsHobbiesPage { @@ -131,9 +141,11 @@ struct LaunchInterestsHobbiesPage {
131 .borderRadius('10lpx') 141 .borderRadius('10lpx')
132 .width('662lpx') 142 .width('662lpx')
133 .height('84lpx') 143 .height('84lpx')
  144 + .margin({top:'10lpx'})
134 Image('') 145 Image('')
135 .width('662lpx') 146 .width('662lpx')
136 .height('84lpx') 147 .height('84lpx')
  148 + .margin({top:'10lpx'})
137 .backgroundColor(Color.White) 149 .backgroundColor(Color.White)
138 .opacity(this.selectCount == 0 ? 0.6 : 0) 150 .opacity(this.selectCount == 0 ? 0.6 : 0)
139 .borderRadius('10lpx') 151 .borderRadius('10lpx')
@@ -156,10 +168,8 @@ struct LaunchInterestsHobbiesPage { @@ -156,10 +168,8 @@ struct LaunchInterestsHobbiesPage {
156 } 168 }
157 .width('100%') 169 .width('100%')
158 .height('108lpx') 170 .height('108lpx')
159 - // .position({y:})  
160 - // .margin({bottom:'1',top:'1'})  
161 - .backgroundColor('#FFFFFF')  
162 - 171 + .margin({top:0})
  172 + // .backgroundColor(Color.Orange)
163 } 173 }
164 .width('100%') 174 .width('100%')
165 .height('100%') 175 .height('100%')