wangyujian_wd

Merge remote-tracking branch 'origin/main'

Showing 38 changed files with 400 additions and 133 deletions
... ... @@ -44,4 +44,7 @@ export class SpConstants{
//频道信息流页面左右挂角
static APP_PAGE_CORNER_ADV = 'app_page_corner_adv_'
//游客状态下首次评论时间
static FIRSTCOMMENTTIME = 'firstCommentTime'
}
\ No newline at end of file
... ...
... ... @@ -441,6 +441,12 @@ export class HttpUrlUtils {
return url;
}
//游客评论合并
static visitorMergeComment() {
let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/visitorMerge";
return url;
}
static getAppointmentListDataUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH
return url
... ...
... ... @@ -44,7 +44,7 @@ export struct CompParser {
@Builder
componentBuilder(compDTO: CompDTO, compIndex: number) {
// if (compDTO.operDataList[0]?.objectType !== '3' && compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口
if (compDTO.operDataList[0]?.objectType !== '3' && compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口
if (compDTO.compStyle === CompStyle.Label_03) {
LabelComponent({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
... ... @@ -77,8 +77,8 @@ export struct CompParser {
ZhSingleRow04({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_05) {
ZhSingleRow05({ compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
// ZhSingleRow05({ compDTO })
// Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) {
ZhSingleRow06({ compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
... ... @@ -119,6 +119,6 @@ export struct CompParser {
}
}
// }
}
}
... ...
import { AccountManagerUtils, Logger, DateTimeUtils, SPHelper, NumberFormatterUtils } from 'wdKit';
import { AccountManagerUtils, Logger, DateTimeUtils, SPHelper, NumberFormatterUtils, DisplayUtils } from 'wdKit';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { ContentDetailDTO,postBatchAttentionStatusParams,
PhotoListBean,
... ... @@ -53,7 +53,7 @@ export struct DynamicDetailComponent {
//跳转
private mJumpInfo: ContentDTO = {} as ContentDTO;
@State publishCommentModel: publishCommentModel = new publishCommentModel()
async aboutToAppear() {
await this.getContentDetailData()
... ... @@ -83,7 +83,7 @@ export struct DynamicDetailComponent {
Image($r('app.media.ic_news_detail_division'))
.width('100%')
.height($r('app.float.margin_7'))
.margin({left: $r('app.float.margin_16'), right: $r('app.float.margin_16')} )
.padding({left: $r('app.float.margin_16'), right: $r('app.float.margin_16')} )
Stack({ alignContent: Alignment.Bottom }) {
Scroll(this.scroller) {
Column() {
... ... @@ -275,8 +275,8 @@ export struct DynamicDetailComponent {
Image(this.contentDetailData.fullColumnImgUrls!= null && this.contentDetailData.fullColumnImgUrls.length>0&&!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url)?
this.contentDetailData.fullColumnImgUrls[0].url:
this.contentDetailData.videoInfo[0].firstFrameImageUri)
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.width(DisplayUtils.getDeviceWidth()- 32)
.height((DisplayUtils.getDeviceWidth()-32)* 9 / 16)
.borderRadius($r('app.float.image_border_radius'))
CardMediaInfo({ contentDTO: this.mJumpInfo })
}
... ... @@ -291,7 +291,8 @@ export struct DynamicDetailComponent {
Image(this.contentDetailData.fullColumnImgUrls!= null && this.contentDetailData.fullColumnImgUrls.length>0&&!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url)?
this.contentDetailData.fullColumnImgUrls[0].url:
this.contentDetailData.videoInfo[0].firstFrameImageUri)
.width(CommonConstants.FULL_WIDTH)
.width(DisplayUtils.getDeviceWidth()/2)
.height(DisplayUtils.getDeviceWidth()/2* 4 / 3)
.borderRadius($r('app.float.image_border_radius'))
CardMediaInfo({ contentDTO: this.mJumpInfo })
}
... ... @@ -299,7 +300,7 @@ export struct DynamicDetailComponent {
}
}
}
.margin({ left: $r('app.float.margin_16'),right: $r('app.float.margin_16'),top: $r('app.float.margin_8')})
.padding({ left: this.contentDetailData.videoInfo[0].videoLandScape === 1?0: 16,top: $r('app.float.margin_8')})
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.mJumpInfo)
})
... ... @@ -362,9 +363,17 @@ export struct DynamicDetailComponent {
})
// 评论
if (this.contentDetailData?.openComment) {
Divider().strokeWidth(6).color('#f5f5f5')
Divider().strokeWidth(6).color('#f5f5f5').margin({top:$r('app.float.margin_24')})
CommentComponent({
publishCommentModel: this.publishCommentModel
publishCommentModel: {
targetId: String(this.contentDetailData?.newsId || ''),
targetRelId: this.contentDetailData?.reLInfo?.relId,
targetTitle: this.contentDetailData?.newsTitle,
targetRelType: this.contentDetailData?.reLInfo?.relType,
targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId),
keyArticle: String(this.contentDetailData?.keyArticle),
targetType: String(this.contentDetailData?.newsType),
} as publishCommentModel
})
}
Blank().layoutWeight(1)
... ... @@ -379,7 +388,15 @@ export struct DynamicDetailComponent {
OperRowListView({ contentDetailData: this.contentDetailData
,interactData:this.interactDataDTO
,newsStatusOfUser:this.newsStatusOfUser
,publishCommentModel: this.publishCommentModel
,publishCommentModel: {
targetId: String(this.contentDetailData?.newsId || ''),
targetRelId: this.contentDetailData?.reLInfo?.relId,
targetTitle: this.contentDetailData?.newsTitle,
targetRelType: this.contentDetailData?.reLInfo?.relType,
targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId),
keyArticle: String(this.contentDetailData?.keyArticle),
targetType: String(this.contentDetailData?.newsType),
} as publishCommentModel
,needLike:false})
}
}
... ... @@ -399,17 +416,6 @@ export struct DynamicDetailComponent {
} catch (exception) {
console.log('请求失败',JSON.stringify(exception))
}
if (this.contentDetailData.openComment) {
this.publishCommentModel = {
targetId: String(this.contentDetailData?.newsId || ''),
targetRelId: this.contentDetailData?.reLInfo?.relId,
targetTitle: this.contentDetailData?.newsTitle,
targetRelType: this.contentDetailData?.reLInfo?.relType,
targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId),
keyArticle: String(this.contentDetailData?.keyArticle),
targetType: String(this.contentDetailData?.newsType),
} as publishCommentModel
}
this.getBatchAttentionStatus()
this.getInteractDataStatus()
this.makeJumpInfo()
... ...
import { Logger, NumberFormatterUtils, DateTimeUtils, EmitterUtils, EmitterEventId } from 'wdKit';
import { Logger, NumberFormatterUtils, DateTimeUtils, EmitterUtils, EmitterEventId, NetworkUtil } from 'wdKit';
import {
Action,
ContentDetailDTO,
... ... @@ -20,7 +20,7 @@ import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailView
import { PageRepository } from '../repository/PageRepository';
import { detailedSkeleton } from './skeleton/detailSkeleton';
import { publishCommentModel } from '../components/comment/model/PublishCommentModel';
import { EmptyComponent } from '../components/view/EmptyComponent';
import { CommentComponent } from '../components/comment/view/CommentComponent'
import { HttpUtils } from 'wdNetwork/Index';
... ... @@ -40,6 +40,7 @@ export struct ImageAndTextPageComponent {
@State publishTime: string = ''
@State publishCommentModel: publishCommentModel = new publishCommentModel()
@State operationButtonList: string[] = ['comment', 'collect', 'share']
@State isNetConnected: boolean = true
build() {
Column() {
... ... @@ -131,7 +132,7 @@ export struct ImageAndTextPageComponent {
CommentComponent({
publishCommentModel: this.publishCommentModel
})
// .onMeasureSize()
// .onMeasureSize()
}
}
}
... ... @@ -143,8 +144,18 @@ export struct ImageAndTextPageComponent {
.scrollBar(BarState.Off)
.align(Alignment.Top)
if (!this.isPageEnd) {
detailedSkeleton()
if(!this.isNetConnected) {
EmptyComponent({
emptyType: 1,
emptyButton: true,
retry: () => {
this.getDetail()
}
})
}else{
if (!this.isPageEnd) {
detailedSkeleton()
}
}
//底部交互区
... ... @@ -163,6 +174,7 @@ export struct ImageAndTextPageComponent {
}
private async getDetail() {
this.isNetConnected = NetworkUtil.isNetConnected()
let contentId: string = ''
let relId: string = ''
let relType: string = ''
... ...
... ... @@ -91,7 +91,6 @@ export struct SpacialTopicPageComponent {
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
// .padding({ bottom: 76 })
if (!this.isPageEnd) {
detailedSkeleton()
... ...
import { ContentDTO, slideShows } from 'wdBean';
import { CommonConstants } from 'wdConstant'
import { CommonConstants } from 'wdConstant';
import { DateTimeUtils } from 'wdKit';
import { ProcessUtils } from 'wdRouter';
... ... @@ -104,10 +104,12 @@ export struct Card9Component {
Column() {
Row() {
// 标题
Image($r("app.media.timeline_rect"))
Image($r("app.media.timeAxis"))
.width(9)
.height(9)
.margin({ right: 5 })
.fillColor(item.newsTitleColor)
Text(DateTimeUtils.formatDate(item.publishTime, "MM月dd日 HH:mm"))
.fontSize($r('app.float.font_size_12'))
.fontColor($r('app.color.color_222222'))
... ...
import { DateTimeUtils, Logger, ToastUtils, UserDataLocal } from 'wdKit/Index';
import { SpConstants } from 'wdConstant/Index';
import { DateTimeUtils, Logger, SPHelper, ToastUtils, UserDataLocal } from 'wdKit/Index';
import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork/Index';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import {
... ... @@ -183,6 +184,14 @@ class CommentViewModel {
}
ToastUtils.showToast(data.message, 1000);
let model = data.data as commentItemModel
let userId = HttpUtils.getUserId()
let FIRSTCOMMENTTIME = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, '')
if (!userId && !FIRSTCOMMENTTIME) {
//保存首次评论时间
SPHelper.default.saveSync(SpConstants.FIRSTCOMMENTTIME, DateTimeUtils.formatDate(data.timestamp, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
}
success(model)
}, (error: Error) => {
ToastUtils.showToast('评论失败', 1000);
... ...
... ... @@ -19,7 +19,7 @@ export struct FollowChildComponent{
Row() {
Row(){
Stack({alignContent: Alignment.Bottom}){
Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl)
Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.icon_default_head_mater'):this.data.headPhotoUrl)
.objectFit(ImageFit.Auto)
.width('92lpx')
.height('92lpx')
... ... @@ -128,7 +128,7 @@ export struct FollowChildComponent{
Row() {
Row(){
Stack({alignContent: Alignment.Bottom}){
Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl)
Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.icon_default_head_mater'):this.data.headPhotoUrl)
.objectFit(ImageFit.Auto)
.width('92lpx')
.height('92lpx')
... ...
... ... @@ -70,7 +70,7 @@ export struct FollowListDetailUI {
Column() {
if (this.count === 0) {
if (this.isGetRequest == true) {
EmptyComponent({ emptyType: 14 })
EmptyComponent({ emptyType: 14,emptyHeight:"100%" })
.layoutWeight(1)
.width('100%')
}
... ... @@ -179,6 +179,7 @@ export struct FollowListDetailUI {
if (!this.data || value.list.length == 0) {
this.hasMore = false
this.isLoading = false
this.isGetRequest = true
} else {
this.getFollowListStatus(value)
}
... ... @@ -226,6 +227,8 @@ export struct FollowListDetailUI {
})
})
this.getFollowStatus(data_temp, result.totalCount)
}else{
this.isGetRequest = true
}
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
... ...
... ... @@ -146,7 +146,7 @@ export struct HomePageBottomComponent{
LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => {
ListItem() {
FollowChildComponent({data: item,type:1})
FollowChildComponent({data: item,type:2})
}
.onClick(() => {
})
... ...
... ... @@ -449,7 +449,7 @@ struct ChannelDialog {
}.width('100%').height('100%')
.scrollBar(BarState.Off)
}
.padding({ top: 40, right: 15, bottom: 20, left: 15 })
.padding({ top: 40, right: 15, bottom: 40, left: 15 })
.backgroundColor('#ffffff')
}
}
... ... @@ -526,10 +526,9 @@ struct ChannelSubscriptionLayout {
.width(18)
}
.width(36)
.height(36)
.height(40)
.justifyContent(FlexAlign.Center)
.padding({ bottom: 6 })
.backgroundColor('#ffffff')
.backgroundColor(Color.White)
.onClick(() => {
if (this.dialogController != null) {
this.dialogController.open()
... ...
... ... @@ -8,6 +8,7 @@ import MinePageMoreFunctionUI from '../mine/MinePageMoreFunctionUI'
import { SPHelper, StringUtils } from 'wdKit'
import { SpConstants } from 'wdConstant'
import dataPreferences from '@ohos.data.preferences';
import { MergeRecordDialog } from '../../dialog/MergeRecordDialog'
const TAG = 'MinePageComponent';
... ... @@ -30,9 +31,23 @@ export struct MinePageComponent {
this.isLogin = false
}else {
this.isLogin = true
this.addRecordDialog()
}
}
}
mergeDialogController: CustomDialogController = new CustomDialogController({
builder: MergeRecordDialog({
cancel: () => {
this.clearMergeRecord()
},
confirm: () => {
this.dealMergeRecordData()
}
}),
customStyle: true,
alignment: DialogAlignment.Center,
autoCancel: false
})
aboutToAppear(){
this.getUserLogin()
... ... @@ -112,5 +127,29 @@ export struct MinePageComponent {
}
}
addRecordDialog() {
setTimeout(() => {
this.dealMergeRecordDialog()
}, 300)
}
dealMergeRecordDialog() {
let commentTime = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, "")
if (StringUtils.isNotEmpty(commentTime)) {
this.mergeDialogController.open()
}
}
dealMergeRecordData() {
MinePageDatasModel.visitorMergeComment().then(() => {
this.mergeDialogController.close()
}).catch(() => {
this.mergeDialogController.close()
})
}
clearMergeRecord(){
SPHelper.default.saveSync(SpConstants.FIRSTCOMMENTTIME, "")
}
}
... ...
... ... @@ -5,12 +5,14 @@ import { RefreshConstants } from '../../utils/RefreshConstants'
*/
@Component
export default struct NoMoreLayout {
build() {
Row() {
Column() {
Text($r('app.string.footer_text'))
.margin({ left: RefreshConstants.NoMoreLayoutConstant_NORMAL_PADDING })
.fontSize(RefreshConstants.NoMoreLayoutConstant_TITLE_FONT)
.textAlign(TextAlign.Center)
.margin({bottom:40})
}
.width(RefreshConstants.FULL_WIDTH)
.justifyContent(FlexAlign.Center)
... ...
... ... @@ -7,6 +7,7 @@ import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent
import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index';
import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils';
import { PeopleShipMainComponent } from '../peopleShip/PeopleShipMainComponent';
import { WDRouterPage, WDRouterRule } from 'wdRouter'
const TAG = 'TopNavigationComponent';
... ... @@ -63,6 +64,8 @@ export struct TopNavigationComponent {
@State indicatorLeftMargin: number = 0
@State indicatorWidth: number = 0
private tabsWidth: number = 0
//定时器延时处理切换至版面、播报tab时 返回上一个tab
@State tabTimmer: number = 0
topOrBottomNavChange() {
if (this.currentBottomNavName === this.currentBottomNavInfo?.name) {
... ... @@ -260,6 +263,9 @@ export struct TopNavigationComponent {
})
.animationDuration(this.animationDuration)
.onChange((index: number) => {
if(this.tabTimmer){
clearTimeout(this.tabTimmer)
}
this.currentTopNavName =
this._currentNavIndex === 0 ? this.myChannelList[index].name : this.topNavList[index].name
Logger.info(TAG, `onChange index : ${index}`);
... ... @@ -271,11 +277,15 @@ export struct TopNavigationComponent {
if (this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) {
// 跳转到播报页面
ProcessUtils.gotoBroadcastPage(this.myChannelList[index].pageId)
this.tabsController.changeIndex(this.currentTopNavSelectedIndex)
this.tabTimmer = setTimeout(() => {
this.tabsController.changeIndex(this.currentTopNavSelectedIndex)
}, 500)
}
if (this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) {
ProcessUtils.gotoENewsPaper()
this.tabsController.changeIndex(this.currentTopNavSelectedIndex)
this.tabTimmer = setTimeout(() => {
this.tabsController.changeIndex(this.currentTopNavSelectedIndex)
}, 500)
}
})
.onAnimationStart((index: number, targetIndex: number, event: TabsAnimationEvent) => {
... ... @@ -326,6 +336,20 @@ export struct TopNavigationComponent {
this.tabsController.changeIndex(index)
}
})
}else {
Row() {
Image($r('app.media.icon_search'))
.width(18)
.height(18)
}
.height('40vp')
.width('40vp')
.margin({ right: 10 })
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Center)
.onClick(() => {
WDRouterRule.jumpWithPage(WDRouterPage.searchPage)
})
}
}
}
... ...
... ... @@ -24,7 +24,7 @@ import PageAdModel from '../../viewmodel/PageAdvModel';
import PageHelper from '../../viewmodel/PageHelper';
import { PeopleShipAttentionContentListTopComponent } from './PeopleShipAttentionContentListTopComponent'
import { CardParser } from '../CardParser'
import NoMoreLayout from '../page/NoMoreLayout';
import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData';
@Preview
@Component
... ... @@ -161,7 +161,7 @@ export struct PeopleShipMainComponent {
// 加载更多
ListItem() {
if (!this.hasMore && !this.isLoading) {
NoMoreLayout()
PeopleShipNoMoreData()
}
}
}
... ...
import { PeopleShipRecommendHeadComponent } from './PeopleShipRecommendHeadComponent'
import { RmhRecommendDTO } from 'wdBean';
import { Logger } from 'wdKit/Index';
import NoMoreLayout from '../page/NoMoreLayout';
import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData';
@Component
export struct PeopleShipRecommendComponent {
... ... @@ -87,7 +86,8 @@ export struct PeopleShipRecommendComponent {
// 为你推荐
Button(this.rmhSelectedList.length == 0 ? '一键关注' : `一键关注 (${this.rmhSelectedList.length})`, { type: ButtonType.Normal, stateEffect: this.rmhSelectedList.length != 0 })
.margin({
top: '24vp'
top: '24vp',
bottom: '10vp'
})
.width('120vp')
.height('36vp')
... ... @@ -104,7 +104,7 @@ export struct PeopleShipRecommendComponent {
}
})
// 没有更多
NoMoreLayout()
PeopleShipNoMoreData()
}
.width('100%')
}
... ...
... ... @@ -18,9 +18,9 @@ import { CardParser } from '../CardParser'
import { PageRepository } from '../../repository/PageRepository'
import { RefreshLayoutBean } from '../page/RefreshLayoutBean'
import CustomRefreshLoadLayout from '../page/CustomRefreshLoadLayout'
import { ErrorComponent } from '../view/ErrorComponent';
import NoMoreLayout from '../page/NoMoreLayout';
import { ErrorComponent } from '../view/ErrorComponent'
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'
import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData'
const TAG = 'PeopleShipHomeArticleListComponent';
... ... @@ -104,7 +104,7 @@ export struct PeopleShipHomeArticleListComponent {
// 加载更多
ListItem() {
if (!this.hasMore && !this.isLoading) {
NoMoreLayout()
PeopleShipNoMoreData()
}
}
}
... ...
... ... @@ -56,7 +56,7 @@ export struct PeopleShipHomePageNavComponent {
if (this.isAttention == '0') {
// 关注
Button('+关注', { type: ButtonType.Normal, stateEffect: true })
Button('+ 关注', { type: ButtonType.Normal, stateEffect: true })
.borderRadius(4)
.backgroundColor($r('app.color.color_ED2800'))
.width('54vp')
... ...
@Component
export struct PeopleShipNoMoreData{
@State title: string = '已显示全部内容'
build(){
Row(){
Text("已显示全部内容")
.fontColor($r('app.color.color_999999'))
.fontWeight(400)
.fontSize('14vp')
}
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.width('100%')
.margin({top:'24vp',bottom:'24vp'})
}
}
\ No newline at end of file
... ...
... ... @@ -29,11 +29,19 @@ export struct FirstTabTopSearchComponent {
if (value != null) {
this.searchTextData = value
}
this.setDefaultHitData()
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
this.setDefaultHitData()
})
}
setDefaultHitData(){
if(this.searchTextData.length === 0){
this.searchTextData.push("搜索")
}
}
build() {
Row() {
Image($r('app.media.icon_search'))
... ...
... ... @@ -13,14 +13,18 @@ const TAG = "SearchComponent"
@Component
export struct SearchComponent {
@State searchTextData: string[] = []
@State hasNoSearchTextData: boolean = false
@State curHintSearchData: string = ""
@State hasInputContent: boolean = false
@State hasChooseSearch: boolean = false
@State isClickedHistory: boolean = false
@State isClickedHot: boolean = false
@State isClickedRelated: boolean = false
@State isClickedHistorySearch: boolean = false
@State isClickedHotSearch: boolean = false
@State isClickedRelatedSearch: boolean = false
@State isClickedInputSearch: boolean = false
@State isClickedHintSearch: boolean = false
private swiperController: SwiperController = new SwiperController()
@State searchText: string = ''
controller: TextInputController = new TextInputController()
controller: SearchController = new SearchController()
@State searchHistoryData: SearchHistoryItem[] = []
@State relatedSearchContentsData: SearchRelatedItem[] = []
scroller: Scroller = new Scroller()
... ... @@ -30,6 +34,8 @@ export struct SearchComponent {
aboutToAppear() {
//获取提示滚动
this.getSearchHint()
//清除缓存
SearcherAboutDataModel.searchHistoryData = []
//获取搜索历史
this.getSearchHistoryData()
}
... ... @@ -75,10 +81,18 @@ export struct SearchComponent {
if (value != null) {
this.searchTextData = value
}
this.setDefaultHitData()
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
this.setDefaultHitData()
})
}
setDefaultHitData(){
if(this.searchTextData.length === 0){
this.hasNoSearchTextData = true
this.searchTextData.push("搜索感兴趣的内容")
}
}
getSearchHistoryData() {
this.searchHistoryData = SearcherAboutDataModel.getSearchHistoryData()
... ... @@ -131,7 +145,7 @@ export struct SearchComponent {
getSearchHistoryResData(content:string,index:number){
//删除单条记录
SearcherAboutDataModel.delSearchSingleHistoryData(index)
this.isClickedHistory = true
this.isClickedHistorySearch = true
this.searchResData(content)
}
... ... @@ -148,6 +162,16 @@ export struct SearchComponent {
//查询 操作 TODO
this.hasChooseSearch = true
this.getSearchResultCountData()
this.controller.stopEditing()
}
/**
* 点击hint搜索列表回调
* @param content
*/
getSearchHintResData(content:string){
this.isClickedHintSearch = true
this.searchResData(content)
}
/**
... ... @@ -155,7 +179,7 @@ export struct SearchComponent {
* @param content
*/
getSearchRelatedResData(content:string){
this.isClickedRelated = true
this.isClickedRelatedSearch = true
this.searchResData(content)
}
... ... @@ -164,10 +188,18 @@ export struct SearchComponent {
* @param content
*/
getSearchHotResData(content:string){
this.isClickedHot = true
this.isClickedHotSearch = true
this.searchResData(content)
}
/**
* 点击输入法搜索搜索列表回调
* @param content
*/
getSearchInputResData(content:string){
this.isClickedInputSearch = true
this.searchResData(content)
}
//搜索框
@Builder searchInputComponent() {
... ... @@ -185,7 +217,7 @@ export struct SearchComponent {
.textAlign(TextAlign.Start)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Clip })
.margin({ left: '40lpx' })
.margin({ left: '70lpx' })
})
}
.loop(true)
... ... @@ -195,42 +227,57 @@ export struct SearchComponent {
.vertical(true)
.enabled(false)
.focusable(false)
.onChange((index: number) => {
this.curHintSearchData = this.searchTextData[index]
})
}
Row(){
TextInput({ text: this.searchText, placeholder: '', controller: this.controller })
.caretColor(Color.Pink)
.fontSize('27lpx')
Search({ value: this.searchText, placeholder: '', controller: this.controller})
.layoutWeight(1)
.fontColor(Color.Black)
.onChange((value: string) => {
this.searchText = value
if (this.searchText.length > 0) {
this.hasInputContent = true
} else {
this.hasInputContent = false
}
if(this.isClickedHistory || this.isClickedHot || this.isClickedRelated){
this.isClickedHistory = false
this.isClickedHot = false
this.isClickedRelated = false
}else{
this.getRelatedSearchContent()
}
})
.backgroundColor($r('app.color.color_transparent'))
.defaultFocus(true)
if(this.hasInputContent){
Image($r('app.media.search_input_del_icon'))
.width('31lpx')
.height('31lpx')
.objectFit(ImageFit.Cover)
.interpolation(ImageInterpolation.High)
.onClick(()=>{
this.searchText = ""
this.hasInputContent = false
.height('69lpx')
.backgroundColor($r('app.color.color_transparent'))
.textFont({ size: "27lpx", weight: "400lpx" })
.defaultFocus(true)
.caretStyle({color:Color.Pink})
.onSubmit((value: string) => {
if(StringUtils.isNotEmpty(this.searchText)){
SearcherAboutDataModel.putSearchHistoryData(this.searchText)
this.getSearchHistoryData()
this.getSearchInputResData(this.searchText)
}else{
if(!this.hasNoSearchTextData){
if(StringUtils.isEmpty(this.curHintSearchData)){
this.curHintSearchData = this.searchTextData[0]
}
this.getSearchHintResData(this.curHintSearchData)
}else{
ToastUtils.shortToast("请输入搜索关键词")
}
}
})
.onChange((value: string) => {
this.searchText = value
if(this.isClickedHistorySearch || this.isClickedHotSearch || this.isClickedRelatedSearch || this.isClickedInputSearch|| this.isClickedHintSearch){
this.hasChooseSearch = true
}else{
this.hasChooseSearch = false
})
}
}
if (this.searchText.length > 0) {
this.hasInputContent = true
} else {
this.hasInputContent = false
}
if(this.isClickedHistorySearch || this.isClickedHotSearch || this.isClickedRelatedSearch || this.isClickedInputSearch|| this.isClickedHintSearch){
this.resetSearch()
}else{
if(this.hasInputContent){
this.getRelatedSearchContent()
}
}
})
}.padding({right:'30lpx'})
.layoutWeight(1)
}
... ... @@ -241,7 +288,7 @@ export struct SearchComponent {
//TODO 需要修改输入法 换行
//右
Text(this.hasInputContent?"搜索":"取消")
Text("取消")
.textAlign(TextAlign.Center)
.fontWeight('400lpx')
.fontSize('31lpx')
... ... @@ -250,16 +297,7 @@ export struct SearchComponent {
.width('125lpx')
.height('58lpx')
.onClick(() => {
if(this.hasInputContent){
if(StringUtils.isNotEmpty(this.searchText)){
SearcherAboutDataModel.putSearchHistoryData(this.searchText)
this.getSearchHistoryData()
this.getSearchHotResData(this.searchText)
}
}else{
router.back()
}
router.back()
})
}
.height('85lpx')
... ... @@ -289,9 +327,19 @@ export struct SearchComponent {
}
}
this.isGetRequest = true
this.resetSearch()
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
this.isGetRequest = true
this.resetSearch()
})
}
resetSearch(){
this.isClickedHistorySearch = false
this.isClickedHotSearch = false
this.isClickedRelatedSearch = false
this.isClickedInputSearch = false
this.isClickedHintSearch = false
}
}
\ No newline at end of file
... ...
... ... @@ -135,6 +135,6 @@ export struct SearchHistoryComponent{
}
getCategoryViewHeight() {
return `${46 * this.getCategoryRowCount()}lpx`;
return `${50 * this.getCategoryRowCount()}lpx`;
}
}
\ No newline at end of file
... ...
... ... @@ -80,7 +80,7 @@ export struct SearchHotsComponent{
.fontWeight('400lpx')
.lineHeight('42lpx')
}.layoutWeight(1)
if(item.mark!=0){
if(item.mark===1 || item.mark===2){
Image(item.mark===1?$r('app.media.search_hots_mark1'):$r('app.media.search_hots_mark2'))
.width('42lpx')
.height('31lpx')
... ...
import { Params } from 'wdBean';
import { AppUtils, StringUtils } from 'wdKit/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
import { CustomTitleUI } from '../reusable/CustomTitleUI';
import { EnvironmentCustomDialog } from './EnvironmentCustomDialog';
const TAG = 'AboutPageUI';
... ... @@ -23,11 +24,11 @@ export struct AboutPageUI {
})
build() {
Navigation() {
// Navigation() {
//滑动区域
this.aboutUi()
}.titleMode(NavigationTitleMode.Mini)
.title('关于')
// }.titleMode(NavigationTitleMode.Mini)
// .title('关于')
}
aboutToAppear() {
... ... @@ -42,6 +43,8 @@ export struct AboutPageUI {
@Builder
aboutUi() {
Column() {
CustomTitleUI({titleName:'关于'})
Image($r('app.media.setting_about_logo'))
.width('278lpx')
.height('154lpx')
... ...
... ... @@ -197,7 +197,7 @@ export struct EmptyComponent {
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoNetwork) {
contentString = '网络出小差了,请检查网络后重试'
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_ContentFailed) {
contentString = '获取内容失败请重试'
contentString = '获取内容失败请重试'
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCreation) {
contentString = '暂无作品'
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoBooking) {
... ...
@CustomDialog
export struct MergeRecordDialog {
controller: CustomDialogController
cancel: () => void = () => {
}
confirm: () => void = () => {
}
build() {
Column() {
Text("合并游客记录到当前账号,可避免信息丢失")
.fontColor("#222222")
.fontSize(18)
.width("100%")
.fontWeight(FontWeight.Bold)
.textAlign(TextAlign.Center)
.margin({ top: 20 })
Divider().color("#999999").width("100%").margin({ top: 20 }).height('1vp')
Row() {
Text('取消')
.fontSize(16)
.fontColor("#648DF2")
.layoutWeight(1)
.fontWeight(FontWeight.Medium)
.textAlign(TextAlign.Center)
.onClick(() => {
this.controller.close()
if (this.cancel) {
this.cancel()
}
})
.height('100%')
// Divider().color("#999999").height('100%').width('0.5vp')
Text('一键合并')
.fontSize(16)
.fontColor("#648DF2")
.layoutWeight(1)
.fontWeight(FontWeight.Medium)
.textAlign(TextAlign.Center)
.border({
width: { left: 1 },
color: "#999999",
style: { left: BorderStyle.Solid }
})
.onClick(() => {
this.controller.close()
if (this.confirm) {
this.confirm()
}
})
.height('100%')
}.layoutWeight(1).justifyContent(FlexAlign.Center)
}.height(140).backgroundColor(Color.White).borderRadius(10).width('74%')
}
}
\ No newline at end of file
... ...
... ... @@ -4,7 +4,7 @@ import MinePageCreatorFunctionsItem from '../viewmodel/MinePageCreatorFunctionsI
import MinePageMoreFunctionModel from '../viewmodel/MinePageMoreFunctionModel';
import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { MineAppointmentListItem } from '../viewmodel/MineAppointmentListItem';
import { Logger, StringUtils, EmitterUtils, EmitterEventId } from 'wdKit';
import { Logger, StringUtils, EmitterUtils, EmitterEventId, SPHelper } from 'wdKit';
import { MineFollowListDetailItem } from '../viewmodel/MineFollowListDetailItem';
import { FollowListDetailRequestItem } from '../viewmodel/FollowListDetailRequestItem';
import { FollowListItem } from '../viewmodel/FollowListItem';
... ... @@ -22,6 +22,7 @@ import { UserFollowListRequestItem } from '../viewmodel/UserFollowListRequestIte
import { AppointmentOperationRequestItem } from '../viewmodel/AppointmentOperationRequestItem';
import { CommentLikeOperationRequestItem } from '../viewmodel/CommentLikeOperationRequestItem';
import { FollowOperationRequestItem } from '../viewmodel/FollowOperationRequestItem';
import { SpConstants } from 'wdConstant/Index';
const TAG = "MinePageDatasModel"
... ... @@ -559,7 +560,26 @@ class MinePageDatasModel{
return WDHttp.post<ResponseDTO>(url,object)
};
visitorMergeComment() {
let bean: Record<string, string> = {};
bean['time'] = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, "") as string
bean['deviceId'] = HttpUtils.getDeviceId();
return new Promise<object>((success, error) => {
// Logger.info(TAG, `visitorMergeComment`);
HttpBizUtil.post<ResponseDTO<object>>(HttpUrlUtils.visitorMergeComment(), bean).then((data: ResponseDTO<object>) => {
if (!data) {
error()
}
if (data.code != 0) {
error()
}
SPHelper.default.save(SpConstants.FIRSTCOMMENTTIME, "")
success(data)
}).catch(() => {
error()
})
})
}
}
const minePageDatasModel = MinePageDatasModel.getInstance()
... ...
import { Logger, SPHelper, UserDataLocal } from 'wdKit';
import { Logger, SPHelper, StringUtils, UserDataLocal } from 'wdKit';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { SearchHistoryItem } from '../viewmodel/SearchHistoryItem';
import { SearchHotContentItem } from '../viewmodel/SearchHotContentItem';
... ... @@ -18,7 +18,7 @@ const TAG = "SearcherAboutDataModel"
class SearcherAboutDataModel{
private static instance: SearcherAboutDataModel;
public searchHistoryData:SearchHistoryItem[] = []
public SEARCH_HISTORY_KEY:string = "SEARCH_HISTORY_KEY" + UserDataLocal.getUserId()
public SEARCH_HISTORY_KEY:string = "SEARCH_HISTORY_KEY"
private constructor() { }
... ... @@ -37,7 +37,7 @@ class SearcherAboutDataModel{
* 插入搜索记录(单个)
*/
public async putSearchHistoryData(content:string){
let history = SPHelper.default.getSync(this.SEARCH_HISTORY_KEY,"[]") as string
let history = SPHelper.default.getSync(this.generationSearchKey(),"[]") as string
this.searchHistoryData = JSON.parse(history)
this.searchHistoryData.forEach((element,index) => {
if (element.searchContent == content) {
... ... @@ -45,14 +45,14 @@ class SearcherAboutDataModel{
}
});
this.searchHistoryData.splice(0,0,new SearchHistoryItem(content))
await SPHelper.default.saveSync(this.SEARCH_HISTORY_KEY, JSON.stringify(this.searchHistoryData));
await SPHelper.default.saveSync(this.generationSearchKey(), JSON.stringify(this.searchHistoryData));
}
/**
* 删除搜索记录(所有)
*/
public async delSearchHistoryData(){
SPHelper.default.deleteSync(this.SEARCH_HISTORY_KEY)
SPHelper.default.deleteSync(this.generationSearchKey())
this.searchHistoryData = []
}
/**
... ... @@ -62,11 +62,11 @@ class SearcherAboutDataModel{
if(this.searchHistoryData!=null && this.searchHistoryData.length>0){
this.searchHistoryData.splice(index,1)
}else{
let history = SPHelper.default.getSync(this.SEARCH_HISTORY_KEY,"[]") as string
let history = SPHelper.default.getSync(this.generationSearchKey(),"[]") as string
this.searchHistoryData = JSON.parse(history)
this.searchHistoryData.splice(index,1)
}
SPHelper.default.saveSync(this.SEARCH_HISTORY_KEY, JSON.stringify(this.searchHistoryData))
SPHelper.default.saveSync(this.generationSearchKey(), JSON.stringify(this.searchHistoryData))
}
/**
... ... @@ -79,7 +79,7 @@ class SearcherAboutDataModel{
}
return this.searchHistoryData
}
let history = SPHelper.default.getSync(this.SEARCH_HISTORY_KEY,"[]") as string
let history = SPHelper.default.getSync(this.generationSearchKey(),"[]") as string
this.searchHistoryData = JSON.parse(history)
if(this.searchHistoryData.length>10){
... ... @@ -91,6 +91,15 @@ class SearcherAboutDataModel{
return this.searchHistoryData
}
public generationSearchKey():string{
let userId = UserDataLocal.getUserId()
if(StringUtils.isEmpty(userId)){
return this.SEARCH_HISTORY_KEY + "_" + "0000111122223333"
}else{
return this.SEARCH_HISTORY_KEY + "_" + userId
}
}
/**
* 首页 搜索提示滚动内容
*/
... ...
... ... @@ -34,7 +34,7 @@ export class RefreshConstants {
/**
* The refresh and load height.
*/
static readonly CUSTOM_LAYOUT_HEIGHT: number = 90;
static readonly CUSTOM_LAYOUT_HEIGHT: number = 80;
/**
* Full the width.
*/
... ...
... ... @@ -52,7 +52,7 @@ export class PageHelper {
PageViewModel.getPageInfo(pageModel.pageId).then(pageInfo => {
if (pageInfo == null) {
pageModel.viewType = ViewType.EMPTY;
pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoListContent;
pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoContent1;
return;
}
pageModel.pageInfo = pageInfo;
... ... @@ -94,7 +94,7 @@ export class PageHelper {
// 没数据,展示空页面
Logger.debug(TAG, 'aboutToAppear, data response page ' + pageModel.pageId + ', comp list is empty.');
pageModel.viewType = ViewType.EMPTY;
pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoListContent;
pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoContent1;
}
}
... ...
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="9" height="6" viewBox="0 0 9 6"><g><g><path d="M2.63066,0.5L7.79156,0.5C8.13703,0.5,8.3784,0.8420000000000001,8.26266,1.167505L6.84044,5.1675C6.76957,5.36684,6.5809,5.5,6.36934,5.5L1.208442,5.5C0.862974,5.5,0.6216,5.158,0.737335,4.8325L2.15956,0.832495C2.23043,0.633155,2.4191000000000003,0.5,2.63066,0.5" fill-rule="evenodd" fill="#ED2800" fill-opacity="1"/></g></g></svg>
\ No newline at end of file
... ...
... ... @@ -60,7 +60,7 @@ export class LoginModel {
let bean: Record<string, Object> = {};
bean['phone'] = phone
bean['loginType'] = loginType
bean['deviceId'] = '60da5af6-9c59-3566-8622-8c6c00710994'
bean['deviceId'] = HttpUtils.getDeviceId()
bean['verificationCode'] = verificationCode
return new Promise<LoginBean>((success, fail) => {
HttpRequest.post<ResponseDTO<LoginBean>>(HttpUrlUtils.getAppLoginUrl(), bean).then((data: ResponseDTO<LoginBean>) => {
... ... @@ -90,7 +90,7 @@ export class LoginModel {
bean['userName'] = phone
}
bean['loginType'] = loginType
bean['deviceId'] = '60da5af6-9c59-3566-8622-8c6c00710994'
bean['deviceId'] = HttpUtils.getDeviceId()
bean['password'] = password
bean['oldPassword'] = oldPassword
return new Promise<LoginBean>((success, fail) => {
... ...
import { Logger } from 'wdKit/src/main/ets/utils/Logger'
import { LoginModel } from './LoginModel'
import { LoginBean } from './LoginBean'
import { SPHelper, StringUtils } from 'wdKit'
import { SPHelper, StringUtils, UserDataLocal } from 'wdKit'
import { CheckVerifyBean } from './CheckVerifyBean'
import cryptoFramework from '@ohos.security.cryptoFramework'
import buffer from '@ohos.buffer'
... ... @@ -157,6 +157,7 @@ export class LoginViewModel {
SPHelper.default.saveSync(SpConstants.USER_STATUS, '')
SPHelper.default.saveSync(SpConstants.USER_Type, '')
SPHelper.default.saveSync(SpConstants.USER_NAME, '')
UserDataLocal.clearUserData()
success(data)
}).catch((message: string) => {
fail(message)
... ...
... ... @@ -3,8 +3,9 @@ import { WdWebComponent } from 'wdWebComponent';
import router from '@ohos.router';
import { CommonConstants } from 'wdConstant'
import { BridgeWebViewControl } from 'wdJsBridge';
import { detailedSkeleton } from 'wdComponent/src/main/ets/components/skeleton/detailSkeleton'
const TAG = 'DefaultWebPage'
@Entry
@Component
struct DefaultWebPage {
... ... @@ -16,9 +17,6 @@ struct DefaultWebPage {
build() {
Column() {
if (!this.isPageEnd) {
detailedSkeleton()
}
Stack({ alignContent: Alignment.Bottom }) {
Column() {
WdWebComponent({
... ...