yangchenggong1_wd

fix:bug[17224] 搜索结果为空,推荐列表没有屏蔽音频

@@ -17,9 +17,7 @@ export struct AppointmentListChildComponent{ @@ -17,9 +17,7 @@ export struct AppointmentListChildComponent{
17 }), 17 }),
18 autoCancel: true, 18 autoCancel: true,
19 alignment: DialogAlignment.Center, 19 alignment: DialogAlignment.Center,
20 - offset: { dx: 0, dy: -20 },  
21 - gridCount: 4,  
22 - customStyle: false 20 + customStyle: true
23 }) 21 })
24 22
25 23
@@ -4,9 +4,12 @@ export struct MyCustomDialog { @@ -4,9 +4,12 @@ export struct MyCustomDialog {
4 @State titleShow: boolean = true 4 @State titleShow: boolean = true
5 @State tipValue: string ="提示文字" 5 @State tipValue: string ="提示文字"
6 @State tipShow: boolean = true 6 @State tipShow: boolean = true
7 - 7 + @State cancelIsLeft :boolean = true//取消是否在左边
8 @State leftText: string = "取消" 8 @State leftText: string = "取消"
9 @State rightText: string = "确认" 9 @State rightText: string = "确认"
  10 + @State leftTextColor: Resource = $r('app.color.color_333333')
  11 + @State rightTextColor: Resource = $r('app.color.color_648DF2')
  12 +
10 13
11 controller: CustomDialogController 14 controller: CustomDialogController
12 cancel: () => void = () => { 15 cancel: () => void = () => {
@@ -16,21 +19,25 @@ export struct MyCustomDialog { @@ -16,21 +19,25 @@ export struct MyCustomDialog {
16 19
17 build() { 20 build() {
18 Column() { 21 Column() {
19 - if(this.titleShow){  
20 - Text(this.title)  
21 - .fontSize("32lpx")  
22 - .margin({ top: "40lpx", bottom: "15lpx" })  
23 - .fontColor($r('app.color.color_333333'))  
24 - .fontSize('35lpx')  
25 - .fontWeight('600lpx')  
26 - } 22 + Column(){
  23 + if(this.titleShow){
  24 + Text(this.title)
  25 + .fontSize("32lpx")
  26 + .fontColor($r('app.color.color_333333'))
  27 + .lineHeight('50lpx')
  28 + .fontWeight(600)
  29 + }
27 30
28 - if(this.tipShow){  
29 - Text(this.tipValue)  
30 - .margin({ bottom: "30lpx" })  
31 - .fontSize("27lpx")  
32 - .fontColor($r('app.color.color_B0B0B0'))  
33 - } 31 + if(this.tipShow){
  32 + Text(this.tipValue)
  33 + .margin({ top:this.titleShow?"10lpx":"0lpx" })
  34 + .fontSize("27lpx")
  35 + .fontWeight(400)
  36 + .lineHeight('38lpx')
  37 + .fontColor($r('app.color.color_999999'))
  38 + }
  39 + }.padding({top:"48lpx",bottom:"48lpx"})
  40 + .alignItems(HorizontalAlign.Center)
34 41
35 Divider() 42 Divider()
36 .width("100%") 43 .width("100%")
@@ -41,13 +48,21 @@ export struct MyCustomDialog { @@ -41,13 +48,21 @@ export struct MyCustomDialog {
41 Row(){ 48 Row(){
42 Text(this.leftText) 49 Text(this.leftText)
43 .fontSize('35lpx') 50 .fontSize('35lpx')
44 - .fontWeight('400lpx')  
45 - .fontColor($r('app.color.color_333333')) 51 + .fontWeight(400)
  52 + .fontColor(this.leftTextColor)
46 .onClick(() => { 53 .onClick(() => {
47 - this.controller.close()  
48 - this.cancel() 54 + if (this.controller != undefined){
  55 + if(this.cancelIsLeft){
  56 + this.controller.close()
  57 + this.cancel()
  58 + }else{
  59 + this.controller.close()
  60 + this.confirm()
  61 + }
  62 + }
49 }).layoutWeight(1) 63 }).layoutWeight(1)
50 .textAlign(TextAlign.Center) 64 .textAlign(TextAlign.Center)
  65 +
51 Divider() 66 Divider()
52 .width("1lpx") 67 .width("1lpx")
53 .strokeWidth('1lpx') 68 .strokeWidth('1lpx')
@@ -58,17 +73,24 @@ export struct MyCustomDialog { @@ -58,17 +73,24 @@ export struct MyCustomDialog {
58 Text(this.rightText) 73 Text(this.rightText)
59 .fontSize('35lpx') 74 .fontSize('35lpx')
60 .textAlign(TextAlign.Center) 75 .textAlign(TextAlign.Center)
61 - .fontWeight('400lpx')  
62 - .fontColor($r('app.color.color_648DF2')) 76 + .fontWeight(400)
  77 + .fontColor(this.rightTextColor)
63 .onClick(() => { 78 .onClick(() => {
64 if (this.controller != undefined) { 79 if (this.controller != undefined) {
65 - this.controller.close()  
66 - this.confirm() 80 + if(this.cancelIsLeft){
  81 + this.controller.close()
  82 + this.confirm()
  83 + }else{
  84 + this.controller.close()
  85 + this.cancel()
  86 + }
67 } 87 }
68 }).layoutWeight(1) 88 }).layoutWeight(1)
69 } 89 }
70 .alignItems(VerticalAlign.Center) 90 .alignItems(VerticalAlign.Center)
71 .height('96lpx') 91 .height('96lpx')
72 }.borderRadius(10) 92 }.borderRadius(10)
  93 + .width("518lpx")
  94 + .backgroundColor("#FFF")
73 } 95 }
74 } 96 }
@@ -21,9 +21,7 @@ export struct SearchHistoryComponent{ @@ -21,9 +21,7 @@ export struct SearchHistoryComponent{
21 }), 21 }),
22 autoCancel: true, 22 autoCancel: true,
23 alignment: DialogAlignment.Center, 23 alignment: DialogAlignment.Center,
24 - offset: { dx: 0, dy: -20 },  
25 - gridCount: 4,  
26 - customStyle: false 24 + customStyle: true
27 }) 25 })
28 26
29 onAccept(){ 27 onAccept(){
@@ -3,7 +3,7 @@ import { SearchRelatedItem } from '../../viewmodel/SearchRelatedItem' @@ -3,7 +3,7 @@ import { SearchRelatedItem } from '../../viewmodel/SearchRelatedItem'
3 const TAG = "SearchRelatedComponent" 3 const TAG = "SearchRelatedComponent"
4 4
5 /** 5 /**
6 - * 热门搜索 6 + * 相关搜索
7 */ 7 */
8 @Component 8 @Component
9 export struct SearchRelatedComponent { 9 export struct SearchRelatedComponent {
@@ -40,11 +40,24 @@ export struct SearchResultComponent { @@ -40,11 +40,24 @@ export struct SearchResultComponent {
40 40
41 SearcherAboutDataModel.getSearchSuggestData(request, getContext(this)).then((value) => { 41 SearcherAboutDataModel.getSearchSuggestData(request, getContext(this)).then((value) => {
42 value.forEach((item) => { 42 value.forEach((item) => {
43 - this.data.push(item) 43 + if(item.appStyle != "13"){
  44 + this.data.push(item)
  45 + }
44 }) 46 })
45 this.data.notifyDataReload() 47 this.data.notifyDataReload()
46 this.suggest_count = this.data.totalCount() 48 this.suggest_count = this.data.totalCount()
47 this.isLoading = false 49 this.isLoading = false
  50 +
  51 + if(this.suggest_count === 0 && value.length > 0){
  52 + this.suggest_count = -1
  53 + if(!this.isLoading){
  54 + this.getSuggestData()
  55 + }
  56 + }else if(this.suggest_count <= 20 && value.length > 0){
  57 + if(!this.isLoading){
  58 + this.getSuggestData()
  59 + }
  60 + }
48 }) 61 })
49 } 62 }
50 63
@@ -110,6 +123,7 @@ export struct SearchResultComponent { @@ -110,6 +123,7 @@ export struct SearchResultComponent {
110 TabContent() { 123 TabContent() {
111 SearchResultContentComponent({ keywords: this.searchText, searchType: item }) 124 SearchResultContentComponent({ keywords: this.searchText, searchType: item })
112 }.tabBar(this.TabBuilder(index, item)) 125 }.tabBar(this.TabBuilder(index, item))
  126 + .layoutWeight(1)
113 }, (item: string, index: number) => index.toString()) 127 }, (item: string, index: number) => index.toString())
114 } 128 }
115 .vertical(false) 129 .vertical(false)
@@ -124,6 +138,7 @@ export struct SearchResultComponent { @@ -124,6 +138,7 @@ export struct SearchResultComponent {
124 .layoutWeight(1) 138 .layoutWeight(1)
125 } 139 }
126 }.width('100%') 140 }.width('100%')
  141 + .layoutWeight(1)
127 .margin({ top: '12lpx' }) 142 .margin({ top: '12lpx' })
128 } 143 }
129 144
@@ -54,6 +54,7 @@ export struct SearchResultContentComponent{ @@ -54,6 +54,7 @@ export struct SearchResultContentComponent{
54 if (!this.data || value.list.length == 0){ 54 if (!this.data || value.list.length == 0){
55 this.hasMore = false 55 this.hasMore = false
56 this.isLoading = false 56 this.isLoading = false
  57 + this.count = this.count===-1?0:this.count
57 }else{ 58 }else{
58 if(value.list[0].dataList!=null){ 59 if(value.list[0].dataList!=null){
59 let data_temp: SearchRmhDescription[] = [] 60 let data_temp: SearchRmhDescription[] = []
@@ -205,8 +206,10 @@ export struct SearchResultContentComponent{ @@ -205,8 +206,10 @@ export struct SearchResultContentComponent{
205 extra:'', 206 extra:'',
206 titleShow:value.data.type == "5"?1:0, 207 titleShow:value.data.type == "5"?1:0,
207 } 208 }
  209 + if(contentDTO.appStyle != "13"){
  210 + this.data.push(contentDTO)
  211 + }
208 212
209 - this.data.push(contentDTO)  
210 }) 213 })
211 this.data.notifyDataReload() 214 this.data.notifyDataReload()
212 this.count = this.data.totalCount() 215 this.count = this.data.totalCount()
@@ -216,6 +219,19 @@ export struct SearchResultContentComponent{ @@ -216,6 +219,19 @@ export struct SearchResultContentComponent{
216 this.hasMore = false 219 this.hasMore = false
217 } 220 }
218 this.isLoading = false 221 this.isLoading = false
  222 +
  223 + if(this.count === 0 && resultData.list.length > 0){
  224 + this.count = -1
  225 + if(!this.isLoading){
  226 + //加载分页数据
  227 + this.getNewSearchResultData()
  228 + }
  229 + }else if(this.count <= 20 && resultData.list.length > 0){
  230 + if(!this.isLoading){
  231 + //加载分页数据
  232 + this.getNewSearchResultData()
  233 + }
  234 + }
219 }).catch((err:Error)=>{ 235 }).catch((err:Error)=>{
220 console.log(TAG,"请求失败") 236 console.log(TAG,"请求失败")
221 this.isLoading = false 237 this.isLoading = false
@@ -297,13 +313,10 @@ export struct SearchResultContentComponent{ @@ -297,13 +313,10 @@ export struct SearchResultContentComponent{
297 } 313 }
298 } 314 }
299 } 315 }
300 - .onClick(()=>{  
301 - //TODO 跳转  
302 - })  
303 }, (item: ContentDTO, index: number) => index.toString()) 316 }, (item: ContentDTO, index: number) => index.toString())
304 317
305 //没有更多数据 显示提示 318 //没有更多数据 显示提示
306 - if(!this.hasMore){ 319 + if(!this.hasMore && this.data.totalCount() > 0){
307 ListItem(){ 320 ListItem(){
308 ListHasNoMoreDataUI() 321 ListHasNoMoreDataUI()
309 } 322 }
@@ -319,11 +332,11 @@ export struct SearchResultContentComponent{ @@ -319,11 +332,11 @@ export struct SearchResultContentComponent{
319 this.getNewSearchResultData() 332 this.getNewSearchResultData()
320 } 333 }
321 }) 334 })
322 - } 335 + }.layoutWeight(1)
323 } 336 }
324 } 337 }
325 .backgroundColor($r('app.color.white')) 338 .backgroundColor($r('app.color.white'))
326 - .height('100%') 339 + .layoutWeight(1)
327 .width('100%') 340 .width('100%')
328 } 341 }
329 } 342 }