Showing
11 changed files
with
49 additions
and
20 deletions
| @@ -24,7 +24,7 @@ import PageAdModel from '../../viewmodel/PageAdvModel'; | @@ -24,7 +24,7 @@ import PageAdModel from '../../viewmodel/PageAdvModel'; | ||
| 24 | import PageHelper from '../../viewmodel/PageHelper'; | 24 | import PageHelper from '../../viewmodel/PageHelper'; |
| 25 | import { PeopleShipAttentionContentListTopComponent } from './PeopleShipAttentionContentListTopComponent' | 25 | import { PeopleShipAttentionContentListTopComponent } from './PeopleShipAttentionContentListTopComponent' |
| 26 | import { CardParser } from '../CardParser' | 26 | import { CardParser } from '../CardParser' |
| 27 | -import NoMoreLayout from '../page/NoMoreLayout'; | 27 | +import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData'; |
| 28 | 28 | ||
| 29 | @Preview | 29 | @Preview |
| 30 | @Component | 30 | @Component |
| @@ -161,7 +161,7 @@ export struct PeopleShipMainComponent { | @@ -161,7 +161,7 @@ export struct PeopleShipMainComponent { | ||
| 161 | // 加载更多 | 161 | // 加载更多 |
| 162 | ListItem() { | 162 | ListItem() { |
| 163 | if (!this.hasMore && !this.isLoading) { | 163 | if (!this.hasMore && !this.isLoading) { |
| 164 | - NoMoreLayout() | 164 | + PeopleShipNoMoreData() |
| 165 | } | 165 | } |
| 166 | } | 166 | } |
| 167 | } | 167 | } |
| 1 | import { PeopleShipRecommendHeadComponent } from './PeopleShipRecommendHeadComponent' | 1 | import { PeopleShipRecommendHeadComponent } from './PeopleShipRecommendHeadComponent' |
| 2 | import { RmhRecommendDTO } from 'wdBean'; | 2 | import { RmhRecommendDTO } from 'wdBean'; |
| 3 | -import { Logger } from 'wdKit/Index'; | ||
| 4 | -import NoMoreLayout from '../page/NoMoreLayout'; | 3 | +import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData'; |
| 5 | 4 | ||
| 6 | @Component | 5 | @Component |
| 7 | export struct PeopleShipRecommendComponent { | 6 | export struct PeopleShipRecommendComponent { |
| @@ -87,7 +86,8 @@ export struct PeopleShipRecommendComponent { | @@ -87,7 +86,8 @@ export struct PeopleShipRecommendComponent { | ||
| 87 | // 为你推荐 | 86 | // 为你推荐 |
| 88 | Button(this.rmhSelectedList.length == 0 ? '一键关注' : `一键关注 (${this.rmhSelectedList.length})`, { type: ButtonType.Normal, stateEffect: this.rmhSelectedList.length != 0 }) | 87 | Button(this.rmhSelectedList.length == 0 ? '一键关注' : `一键关注 (${this.rmhSelectedList.length})`, { type: ButtonType.Normal, stateEffect: this.rmhSelectedList.length != 0 }) |
| 89 | .margin({ | 88 | .margin({ |
| 90 | - top: '24vp' | 89 | + top: '24vp', |
| 90 | + bottom: '10vp' | ||
| 91 | }) | 91 | }) |
| 92 | .width('120vp') | 92 | .width('120vp') |
| 93 | .height('36vp') | 93 | .height('36vp') |
| @@ -104,7 +104,7 @@ export struct PeopleShipRecommendComponent { | @@ -104,7 +104,7 @@ export struct PeopleShipRecommendComponent { | ||
| 104 | } | 104 | } |
| 105 | }) | 105 | }) |
| 106 | // 没有更多 | 106 | // 没有更多 |
| 107 | - NoMoreLayout() | 107 | + PeopleShipNoMoreData() |
| 108 | } | 108 | } |
| 109 | .width('100%') | 109 | .width('100%') |
| 110 | } | 110 | } |
| @@ -18,9 +18,9 @@ import { CardParser } from '../CardParser' | @@ -18,9 +18,9 @@ import { CardParser } from '../CardParser' | ||
| 18 | import { PageRepository } from '../../repository/PageRepository' | 18 | import { PageRepository } from '../../repository/PageRepository' |
| 19 | import { RefreshLayoutBean } from '../page/RefreshLayoutBean' | 19 | import { RefreshLayoutBean } from '../page/RefreshLayoutBean' |
| 20 | import CustomRefreshLoadLayout from '../page/CustomRefreshLoadLayout' | 20 | import CustomRefreshLoadLayout from '../page/CustomRefreshLoadLayout' |
| 21 | -import { ErrorComponent } from '../view/ErrorComponent'; | ||
| 22 | -import NoMoreLayout from '../page/NoMoreLayout'; | 21 | +import { ErrorComponent } from '../view/ErrorComponent' |
| 23 | import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh' | 22 | import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh' |
| 23 | +import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData' | ||
| 24 | 24 | ||
| 25 | const TAG = 'PeopleShipHomeArticleListComponent'; | 25 | const TAG = 'PeopleShipHomeArticleListComponent'; |
| 26 | 26 | ||
| @@ -104,7 +104,7 @@ export struct PeopleShipHomeArticleListComponent { | @@ -104,7 +104,7 @@ export struct PeopleShipHomeArticleListComponent { | ||
| 104 | // 加载更多 | 104 | // 加载更多 |
| 105 | ListItem() { | 105 | ListItem() { |
| 106 | if (!this.hasMore && !this.isLoading) { | 106 | if (!this.hasMore && !this.isLoading) { |
| 107 | - NoMoreLayout() | 107 | + PeopleShipNoMoreData() |
| 108 | } | 108 | } |
| 109 | } | 109 | } |
| 110 | } | 110 | } |
| @@ -56,7 +56,7 @@ export struct PeopleShipHomePageNavComponent { | @@ -56,7 +56,7 @@ export struct PeopleShipHomePageNavComponent { | ||
| 56 | 56 | ||
| 57 | if (this.isAttention == '0') { | 57 | if (this.isAttention == '0') { |
| 58 | // 关注 | 58 | // 关注 |
| 59 | - Button('+关注', { type: ButtonType.Normal, stateEffect: true }) | 59 | + Button('+ 关注', { type: ButtonType.Normal, stateEffect: true }) |
| 60 | .borderRadius(4) | 60 | .borderRadius(4) |
| 61 | .backgroundColor($r('app.color.color_ED2800')) | 61 | .backgroundColor($r('app.color.color_ED2800')) |
| 62 | .width('54vp') | 62 | .width('54vp') |
sight_harmony/features/wdComponent/src/main/ets/components/reusable/PeopleShipNoMoreData.ets
0 → 100644
| 1 | +@Component | ||
| 2 | +export struct PeopleShipNoMoreData{ | ||
| 3 | + | ||
| 4 | + @State title: string = '已显示全部内容' | ||
| 5 | + build(){ | ||
| 6 | + Row(){ | ||
| 7 | + Text("已显示全部内容") | ||
| 8 | + .fontColor($r('app.color.color_999999')) | ||
| 9 | + .fontWeight(400) | ||
| 10 | + .fontSize('14vp') | ||
| 11 | + } | ||
| 12 | + .justifyContent(FlexAlign.Center) | ||
| 13 | + .alignItems(VerticalAlign.Center) | ||
| 14 | + .width('100%') | ||
| 15 | + .margin({top:'24vp',bottom:'24vp'}) | ||
| 16 | + } | ||
| 17 | +} |
| @@ -34,6 +34,8 @@ export struct SearchComponent { | @@ -34,6 +34,8 @@ export struct SearchComponent { | ||
| 34 | aboutToAppear() { | 34 | aboutToAppear() { |
| 35 | //获取提示滚动 | 35 | //获取提示滚动 |
| 36 | this.getSearchHint() | 36 | this.getSearchHint() |
| 37 | + //清除缓存 | ||
| 38 | + SearcherAboutDataModel.searchHistoryData = [] | ||
| 37 | //获取搜索历史 | 39 | //获取搜索历史 |
| 38 | this.getSearchHistoryData() | 40 | this.getSearchHistoryData() |
| 39 | } | 41 | } |
| @@ -80,7 +80,7 @@ export struct SearchHotsComponent{ | @@ -80,7 +80,7 @@ export struct SearchHotsComponent{ | ||
| 80 | .fontWeight('400lpx') | 80 | .fontWeight('400lpx') |
| 81 | .lineHeight('42lpx') | 81 | .lineHeight('42lpx') |
| 82 | }.layoutWeight(1) | 82 | }.layoutWeight(1) |
| 83 | - if(item.mark!=0){ | 83 | + if(item.mark===1 || item.mark===2){ |
| 84 | Image(item.mark===1?$r('app.media.search_hots_mark1'):$r('app.media.search_hots_mark2')) | 84 | Image(item.mark===1?$r('app.media.search_hots_mark1'):$r('app.media.search_hots_mark2')) |
| 85 | .width('42lpx') | 85 | .width('42lpx') |
| 86 | .height('31lpx') | 86 | .height('31lpx') |
| 1 | 1 | ||
| 2 | -import { Logger, SPHelper, UserDataLocal } from 'wdKit'; | 2 | +import { Logger, SPHelper, StringUtils, UserDataLocal } from 'wdKit'; |
| 3 | import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; | 3 | import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; |
| 4 | import { SearchHistoryItem } from '../viewmodel/SearchHistoryItem'; | 4 | import { SearchHistoryItem } from '../viewmodel/SearchHistoryItem'; |
| 5 | import { SearchHotContentItem } from '../viewmodel/SearchHotContentItem'; | 5 | import { SearchHotContentItem } from '../viewmodel/SearchHotContentItem'; |
| @@ -18,7 +18,7 @@ const TAG = "SearcherAboutDataModel" | @@ -18,7 +18,7 @@ const TAG = "SearcherAboutDataModel" | ||
| 18 | class SearcherAboutDataModel{ | 18 | class SearcherAboutDataModel{ |
| 19 | private static instance: SearcherAboutDataModel; | 19 | private static instance: SearcherAboutDataModel; |
| 20 | public searchHistoryData:SearchHistoryItem[] = [] | 20 | public searchHistoryData:SearchHistoryItem[] = [] |
| 21 | - public SEARCH_HISTORY_KEY:string = "SEARCH_HISTORY_KEY" + UserDataLocal.getUserId() | 21 | + public SEARCH_HISTORY_KEY:string = "SEARCH_HISTORY_KEY" |
| 22 | 22 | ||
| 23 | private constructor() { } | 23 | private constructor() { } |
| 24 | 24 | ||
| @@ -37,7 +37,7 @@ class SearcherAboutDataModel{ | @@ -37,7 +37,7 @@ class SearcherAboutDataModel{ | ||
| 37 | * 插入搜索记录(单个) | 37 | * 插入搜索记录(单个) |
| 38 | */ | 38 | */ |
| 39 | public async putSearchHistoryData(content:string){ | 39 | public async putSearchHistoryData(content:string){ |
| 40 | - let history = SPHelper.default.getSync(this.SEARCH_HISTORY_KEY,"[]") as string | 40 | + let history = SPHelper.default.getSync(this.generationSearchKey(),"[]") as string |
| 41 | this.searchHistoryData = JSON.parse(history) | 41 | this.searchHistoryData = JSON.parse(history) |
| 42 | this.searchHistoryData.forEach((element,index) => { | 42 | this.searchHistoryData.forEach((element,index) => { |
| 43 | if (element.searchContent == content) { | 43 | if (element.searchContent == content) { |
| @@ -45,14 +45,14 @@ class SearcherAboutDataModel{ | @@ -45,14 +45,14 @@ class SearcherAboutDataModel{ | ||
| 45 | } | 45 | } |
| 46 | }); | 46 | }); |
| 47 | this.searchHistoryData.splice(0,0,new SearchHistoryItem(content)) | 47 | this.searchHistoryData.splice(0,0,new SearchHistoryItem(content)) |
| 48 | - await SPHelper.default.saveSync(this.SEARCH_HISTORY_KEY, JSON.stringify(this.searchHistoryData)); | 48 | + await SPHelper.default.saveSync(this.generationSearchKey(), JSON.stringify(this.searchHistoryData)); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | /** | 51 | /** |
| 52 | * 删除搜索记录(所有) | 52 | * 删除搜索记录(所有) |
| 53 | */ | 53 | */ |
| 54 | public async delSearchHistoryData(){ | 54 | public async delSearchHistoryData(){ |
| 55 | - SPHelper.default.deleteSync(this.SEARCH_HISTORY_KEY) | 55 | + SPHelper.default.deleteSync(this.generationSearchKey()) |
| 56 | this.searchHistoryData = [] | 56 | this.searchHistoryData = [] |
| 57 | } | 57 | } |
| 58 | /** | 58 | /** |
| @@ -62,11 +62,11 @@ class SearcherAboutDataModel{ | @@ -62,11 +62,11 @@ class SearcherAboutDataModel{ | ||
| 62 | if(this.searchHistoryData!=null && this.searchHistoryData.length>0){ | 62 | if(this.searchHistoryData!=null && this.searchHistoryData.length>0){ |
| 63 | this.searchHistoryData.splice(index,1) | 63 | this.searchHistoryData.splice(index,1) |
| 64 | }else{ | 64 | }else{ |
| 65 | - let history = SPHelper.default.getSync(this.SEARCH_HISTORY_KEY,"[]") as string | 65 | + let history = SPHelper.default.getSync(this.generationSearchKey(),"[]") as string |
| 66 | this.searchHistoryData = JSON.parse(history) | 66 | this.searchHistoryData = JSON.parse(history) |
| 67 | this.searchHistoryData.splice(index,1) | 67 | this.searchHistoryData.splice(index,1) |
| 68 | } | 68 | } |
| 69 | - SPHelper.default.saveSync(this.SEARCH_HISTORY_KEY, JSON.stringify(this.searchHistoryData)) | 69 | + SPHelper.default.saveSync(this.generationSearchKey(), JSON.stringify(this.searchHistoryData)) |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | /** | 72 | /** |
| @@ -79,7 +79,7 @@ class SearcherAboutDataModel{ | @@ -79,7 +79,7 @@ class SearcherAboutDataModel{ | ||
| 79 | } | 79 | } |
| 80 | return this.searchHistoryData | 80 | return this.searchHistoryData |
| 81 | } | 81 | } |
| 82 | - let history = SPHelper.default.getSync(this.SEARCH_HISTORY_KEY,"[]") as string | 82 | + let history = SPHelper.default.getSync(this.generationSearchKey(),"[]") as string |
| 83 | 83 | ||
| 84 | this.searchHistoryData = JSON.parse(history) | 84 | this.searchHistoryData = JSON.parse(history) |
| 85 | if(this.searchHistoryData.length>10){ | 85 | if(this.searchHistoryData.length>10){ |
| @@ -91,6 +91,15 @@ class SearcherAboutDataModel{ | @@ -91,6 +91,15 @@ class SearcherAboutDataModel{ | ||
| 91 | return this.searchHistoryData | 91 | return this.searchHistoryData |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | + public generationSearchKey():string{ | ||
| 95 | + let userId = UserDataLocal.getUserId() | ||
| 96 | + if(StringUtils.isEmpty(userId)){ | ||
| 97 | + return this.SEARCH_HISTORY_KEY + "_" + "0000111122223333" | ||
| 98 | + }else{ | ||
| 99 | + return this.SEARCH_HISTORY_KEY + "_" + userId | ||
| 100 | + } | ||
| 101 | + } | ||
| 102 | + | ||
| 94 | /** | 103 | /** |
| 95 | * 首页 搜索提示滚动内容 | 104 | * 首页 搜索提示滚动内容 |
| 96 | */ | 105 | */ |
| 1 | import { Logger } from 'wdKit/src/main/ets/utils/Logger' | 1 | import { Logger } from 'wdKit/src/main/ets/utils/Logger' |
| 2 | import { LoginModel } from './LoginModel' | 2 | import { LoginModel } from './LoginModel' |
| 3 | import { LoginBean } from './LoginBean' | 3 | import { LoginBean } from './LoginBean' |
| 4 | -import { SPHelper, StringUtils } from 'wdKit' | 4 | +import { SPHelper, StringUtils, UserDataLocal } from 'wdKit' |
| 5 | import { CheckVerifyBean } from './CheckVerifyBean' | 5 | import { CheckVerifyBean } from './CheckVerifyBean' |
| 6 | import cryptoFramework from '@ohos.security.cryptoFramework' | 6 | import cryptoFramework from '@ohos.security.cryptoFramework' |
| 7 | import buffer from '@ohos.buffer' | 7 | import buffer from '@ohos.buffer' |
| @@ -157,6 +157,7 @@ export class LoginViewModel { | @@ -157,6 +157,7 @@ export class LoginViewModel { | ||
| 157 | SPHelper.default.saveSync(SpConstants.USER_STATUS, '') | 157 | SPHelper.default.saveSync(SpConstants.USER_STATUS, '') |
| 158 | SPHelper.default.saveSync(SpConstants.USER_Type, '') | 158 | SPHelper.default.saveSync(SpConstants.USER_Type, '') |
| 159 | SPHelper.default.saveSync(SpConstants.USER_NAME, '') | 159 | SPHelper.default.saveSync(SpConstants.USER_NAME, '') |
| 160 | + UserDataLocal.clearUserData() | ||
| 160 | success(data) | 161 | success(data) |
| 161 | }).catch((message: string) => { | 162 | }).catch((message: string) => { |
| 162 | fail(message) | 163 | fail(message) |
-
Please register or login to post a comment