Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
张善主
2024-04-28 13:50:37 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
dd98b33ba294d73d042bebdefbec1056facd0899
dd98b33b
2 parents
0d9d3327
3e7b4a1b
Merge remote-tracking branch 'origin/main'
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
982 additions
and
22 deletions
sight_harmony/commons/wdKit/src/main/ets/utils/EmitterEventId.ts
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
sight_harmony/features/wdBean/Index.ets
sight_harmony/features/wdBean/src/main/ets/bean/peoples/AttentionBatchDTO.ets
sight_harmony/features/wdBean/src/main/ets/bean/peoples/PeopleShipContentListDTO.ets
sight_harmony/features/wdBean/src/main/ets/bean/peoples/RmhRecommendDTO.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipAttentionContentListComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipAttentionContentListTopComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipMainComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipRecommendComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipRecommendHeadComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomeArticleListComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomeNavComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomePageHeadComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomePageTopComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/setting/AccountAndSecurityLayout.ets
sight_harmony/features/wdComponent/src/main/ets/dialog/ENewspaperListDialog.ets
sight_harmony/features/wdComponent/src/main/ets/model/MinePageDatasModel.ets
sight_harmony/features/wdComponent/src/main/ets/repository/PageRepository.ets
sight_harmony/features/wdComponent/src/main/ets/viewmodel/PeopleShipMainViewModel.ets
sight_harmony/features/wdComponent/src/main/resources/base/element/float.json
sight_harmony/features/wdComponent/src/main/resources/base/media/home_page_header_authority.png
sight_harmony/features/wdDetailPlayApi/src/main/ets/request/ContentDetailRequest.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginModel.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginPage.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginViewModel.ets
sight_harmony/commons/wdKit/src/main/ets/utils/EmitterEventId.ts
View file @
dd98b33
...
...
@@ -15,6 +15,9 @@ export enum EmitterEventId {
/*发布评论*/
COMMENT_PUBLISH
=
6
,
// 关注,取消关注
PEOPLE_SHIP_ATTENTION
=
7
,
// App回到前台
APP_ENTER_FOREGROUD
=
100
,
// App进入后台
...
...
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
View file @
dd98b33
...
...
@@ -284,6 +284,22 @@ export class HttpUrlUtils {
*/
static readonly SEARCH_SUGGEST_DATA_PATH: string = "/api/rmrb-bff-display-zh/recommend/zh/c/list";
/**
* 人民号号主推荐
*/
static readonly RMH_RECOMMEND_DATA_PATH: string = "/api/rmrb-bff-display-zh/recommend/zh/c/rmh";
/**
* 关注号主发布内容接口
*/
static readonly ATTENTION_CONTENT_LIST_DATA_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/attention/contentList";
/**
* 一键关注接口
*/
static readonly ATTENTION_BATCH_DATA_PATH: string = "/api/rmrb-interact/interact/zh/c/attention/batch";
static getHost(): string {
return HostManager.getHost();
}
...
...
@@ -650,4 +666,23 @@ export class HttpUrlUtils {
let url = HttpUrlUtils.getHost() + "/api/rmrb-bff-display-zh/display/zh/c/themeList";
return url;
}
// 人民号号主推荐
static getRmhRecommendUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.RMH_RECOMMEND_DATA_PATH;
return url;
}
// 关注号主发布内容接口
static getAttentionContentListUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.ATTENTION_CONTENT_LIST_DATA_PATH;
return url;
}
// 一键关注接口
static getAttentionBatchUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.ATTENTION_BATCH_DATA_PATH;
return url;
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdBean/Index.ets
View file @
dd98b33
...
...
@@ -153,3 +153,15 @@ export {
UserExtend
} from './src/main/ets/bean/user/UserDetail';
export {
RmhRecommendDTO
} from './src/main/ets/bean/peoples/RmhRecommendDTO';
export {
PeopleShipContentListDTO
} from './src/main/ets/bean/peoples/PeopleShipContentListDTO';
export {
AttentionBatchDTO,
CreatorDTO
} from './src/main/ets/bean/peoples/AttentionBatchDTO';
...
...
sight_harmony/features/wdBean/src/main/ets/bean/peoples/AttentionBatchDTO.ets
0 → 100644
View file @
dd98b33
export class AttentionBatchDTO{
creators: CreatorDTO[];
constructor(creators: CreatorDTO[] = []) {
this.creators = creators
}
}
export class CreatorDTO {
attentionUserType: string;
attentionUserId: string;
attentionCreatorId: string;
constructor(attentionUserType: string, attentionUserId: string, attentionCreatorId: string) {
this.attentionUserType = attentionUserType
this.attentionUserId = attentionUserId
this.attentionCreatorId = attentionCreatorId
}
}
...
...
sight_harmony/features/wdBean/src/main/ets/bean/peoples/PeopleShipContentListDTO.ets
0 → 100644
View file @
dd98b33
import { ContentDTO } from '../content/ContentDTO'
export interface PeopleShipContentListDTO {
followCreators: boolean;
hasNext: number;
list: ContentDTO[];
pageNum: number;
pageSize: number;
totalCount: number;
}
\ No newline at end of file
...
...
sight_harmony/features/wdBean/src/main/ets/bean/peoples/RmhRecommendDTO.ets
0 → 100644
View file @
dd98b33
export interface RmhRecommendDTO {
authIcon: string;
authTitle: string;
authTitle2: string;
cnAttention: number;
cnMainControl: number;
creatorId: string;
fansNum: number;
headPhotoUrl: string;
introduction: string;
itemId: string;
itemType: string;
itemTypeCode: string;
posterShareControl: number;
region: string;
sceneId: string;
subSceneId: string;
traceId: string;
traceInfo: string;
userId: string;
userName: string;
userType: string;
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponent.ets
View file @
dd98b33
...
...
@@ -6,6 +6,8 @@ import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout';
import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent';
import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index';
import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils';
import { PeopleShipMainComponent } from '../peopleShip/PeopleShipMainComponent';
const TAG = 'TopNavigationComponent';
...
...
@@ -224,7 +226,16 @@ export struct TopNavigationComponent {
pageId: navItem.pageId + '',
channelId: navItem.channelId + '',
})
} else
}
else if (this.currentBottomNavName === '人民号' && navItem.name === '关注') {
PeopleShipMainComponent({
currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
navIndex: index,
pageId: navItem.pageId + '',
channelId: navItem.channelId + '',
})
}
else
if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {
PageComponent({
currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipAttentionContentListComponent.ets
0 → 100644
View file @
dd98b33
import { PeopleShipAttentionContentListTopComponent } from './PeopleShipAttentionContentListTopComponent'
import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem';
import { ContentDTO } from 'wdBean'
import { CardParser } from '../CardParser'
@Preview
@Component
export struct PeopleShipAttentionContentListComponent {
@Prop followList: FollowListDetailItem[]
@Prop attentionList: ContentDTO[]
build() {
List(){
// 头部关注列表
ListItem(){
PeopleShipAttentionContentListTopComponent({
followList: this.followList
})
}
ForEach(this.attentionList, (item: ContentDTO) => {
ListItem() {
CardParser({ contentDTO: item })
}.width("100%")
.backgroundColor(Color.Transparent)
}, (item: ContentDTO, index: number) => item.objectId + index.toString())
}
.scrollBar(BarState.Off)
.width('100%')
.height('100%')
}
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipAttentionContentListTopComponent.ets
0 → 100644
View file @
dd98b33
import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import { ProcessUtils } from 'wdRouter';
import { PeopleShipHomePageHeadComponent } from '../peopleShipHomePage/PeopleShipHomePageHeadComponent'
@Component
export struct PeopleShipAttentionContentListTopComponent {
@Prop followList: FollowListDetailItem[]
build() {
Column() {
List(){
ListItem() {
PeopleShipAttentionContentListHeadComponent({
index: 0,
item: this.followList[0]
})
}.onClick(() => {
// 跳转到关注列表-我的
WDRouterRule.jumpWithPage(WDRouterPage.followListPage)
})
ForEach(this.followList, (item: FollowListDetailItem, index: number) => {
ListItem() {
PeopleShipAttentionContentListHeadComponent({
index: index + 1,
item: item
})
}.onClick(() => {
let creatorId = item.attentionCreatorId || ''
ProcessUtils.gotoPeopleShipHomePage(creatorId)
})
}, (item: FollowListDetailItem) => item.attentionCreatorId)
}
.listDirection(Axis.Horizontal)
.scrollBar(BarState.Off)
.width('100%')
.height('102vp')
Divider().strokeWidth(1).color($r('app.color.color_F5F5F5'))
}
}
}
@Component
struct PeopleShipAttentionContentListHeadComponent {
@State index: number = 0
@ObjectLink item: FollowListDetailItem
build() {
Column(){
// 头像
PeopleShipHomePageHeadComponent({
diameter: 48,
iconDiameter: 16,
headPhotoUrl: this.index == 0 ? $r('app.media.attention_mine') :
((this.item.attentionHeadPhotoUrl && this.item.attentionHeadPhotoUrl.length > 0) ?
this.item.attentionHeadPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon')),
authIcon: this.index == 0 ? '' : this.item.authIcon
}).margin({
bottom: '8vp'
})
Text(this.index == 0 ? '我的关注' : this.item.attentionUserName)
.fontColor($r('app.color.color_666666'))
.fontSize($r('app.float.vp_13'))
.fontWeight(400)
.height('18vp')
.lineHeight('18vp')
.maxLines(1)
.textOverflow({overflow: TextOverflow.Ellipsis})
.padding({
left: '2vp',
right: '2vp'
})
}
.alignItems(HorizontalAlign.Center)
.width('78vp')
.margin({
left: this.index == 0 ? '8vp' : '4vp',
top: '14vp',
bottom: '14vp'
})
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipMainComponent.ets
0 → 100644
View file @
dd98b33
import { PeopleShipRecommendComponent } from './PeopleShipRecommendComponent';
import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel';
import { HttpUtils } from 'wdNetwork/Index';
import { Logger, DateTimeUtils, EmitterEventId, EmitterUtils } from 'wdKit';
import { RmhRecommendDTO, ContentDTO, AttentionBatchDTO, CreatorDTO } from 'wdBean';
import { ViewType } from 'wdConstant/src/main/ets/enum/ViewType';
import { channelSkeleton } from '../skeleton/channelSkeleton'
import { EmptyComponent } from '../view/EmptyComponent';
import { ErrorComponent } from '../view/ErrorComponent';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import MinePageDatasModel from '../../model/MinePageDatasModel';
import { FollowListDetailRequestItem } from '../../viewmodel/FollowListDetailRequestItem';
import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem';
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
import PageModel from '../../viewmodel/PageModel';
import PageAdModel from '../../viewmodel/PageAdvModel';
import PageHelper from '../../viewmodel/PageHelper';
import { PeopleShipAttentionContentListTopComponent } from './PeopleShipAttentionContentListTopComponent'
import { CardParser } from '../CardParser'
import NoMoreLayout from '../page/NoMoreLayout';
@Preview
@Component
export struct PeopleShipMainComponent {
@State private pageModel: PageModel = new PageModel();
@State private pageAdvModel: PageAdModel = new PageAdModel();
navIndex: number = 0;
pageId: string = "";
channelId: string = "";
@Link @Watch('onChange') currentTopNavSelectedIndex: number
private scroller: Scroller = new Scroller()
private listScroller: Scroller = new Scroller()
@State rmhList: RmhRecommendDTO[] = []
@Provide rmhSelectedList: string[] = []
@State viewType: ViewType = ViewType.LOADING
// 一键关注处理
@State @Watch('onOneFollowChange') oneKeyFollow: boolean = false
// 已经关注的列表
@State followList: FollowListDetailItem[] = []
// 换一换
@State @Watch('onChangeButtonClick') changeButton: boolean = false
@State attentionList: ContentDTO[] = []
@State private hasMore: boolean = true
@State private currentPage: number = 1
@State private isLoading: boolean = false
@State private loadTime: string = ''
// 页面展示监听
@Consume @Watch('onPageShowChange') pageShow: number
@State private pageAttentionChange: boolean = false
build() {
if (this.viewType == ViewType.LOADING) {
this.LoadingLayout()
} else if (this.viewType == ViewType.ERROR) {
ErrorComponent()
} else if (this.viewType == ViewType.EMPTY) {
EmptyComponent()
} else {
if (this.followList.length == 0) {
CustomPullToRefresh({
alldata: this.rmhList,
scroller: this.scroller,
hasMore: false,
customList: () => {
this.ListLayout()
},
onRefresh: (resolve) => {
this.currentPage = 1
this.getData(resolve)
},
})
}else {
CustomPullToRefresh({
alldata: this.attentionList,
scroller: this.listScroller,
hasMore: this.hasMore,
customList: () => {
this.ListAttentionLayout()
},
onRefresh: (resolve) => {
this.currentPage = 1
this.getData(resolve)
},
onLoadMore:(resolve)=> {
if (this.hasMore === false) {
if(resolve) {
resolve('')
}
return
}
if(!this.isLoading && this.hasMore){
//加载分页数据
this.currentPage++;
this.getAttentionContentListData(resolve)
}else {
if(resolve) {
resolve('')
}
}
},
})
}
}
}
@Builder
LoadingLayout() {
channelSkeleton()
}
@Builder
ListLayout() {
Scroll(this.scroller) {
// 推荐人民号
PeopleShipRecommendComponent({
rmhList: this.rmhList,
oneKeyFollow: this.oneKeyFollow,
changeButton: this.changeButton
})
}
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.width('100%')
.height('100%')
}
@Builder
ListAttentionLayout() {
List({scroller: this.listScroller}){
// 头部关注列表
ListItem(){
PeopleShipAttentionContentListTopComponent({
followList: this.followList
})
}
ForEach(this.attentionList, (item: ContentDTO) => {
ListItem() {
CardParser({ contentDTO: item })
}.width("100%")
.backgroundColor(Color.Transparent)
}, (item: ContentDTO, index: number) => item.objectId + index.toString())
// 加载更多
ListItem() {
if (!this.hasMore && !this.isLoading) {
NoMoreLayout()
}
}
}
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.width('100%')
.height('100%')
// PeopleShipAttentionContentListComponent({
// followList: this.followList,
// attentionList: this.attentionList
// })
}
aboutToAppear() {
if (this.navIndex == this.currentTopNavSelectedIndex && this.viewType == ViewType.LOADING) {
this.getData()
}
// 有登录-退出登录-关注接口等问题
EmitterUtils.receiveEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION, () => {
Logger.debug('PeopleShipMainComponent', 'PEOPLE_SHIP_ATTENTION')
this.pageAttentionChange = true
})
}
onChange() {
if (this.navIndex === this.currentTopNavSelectedIndex && (this.viewType == ViewType.LOADING || this.pageAttentionChange)) {
this.getData();
}
}
private async getData(resolve?: (value: string | PromiseLike<string>) => void) {
if (this.isLoading) {
if (resolve) {
resolve('已更新至最新')
}
return
}
this.pageAttentionChange = false
this.isLoading = true
this.getInitData()
try {
// 登录后获取
if (HttpUtils.getUserId()) {
// 获取用户关注人数
let object = new FollowListDetailRequestItem(-1, 20, 1)
let followInfo = await MinePageDatasModel.getMineFollowListData(object, getContext(this))
Logger.debug('PeopleShipMainComponent', '获取页面信息' + `${JSON.stringify(followInfo)}`)
if (followInfo.list.length == 0) {
this.followList = []
this.getRmhRecommendInfo(resolve)
} else {
this.followList = []
// this.followList = followInfo.list
this.followList.push(...followInfo.list)
this.attentionList = []
this.currentPage = 1
this.loadTime = DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)
this.getAttentionContentListData(resolve)
}
} else {
this.followList = []
this.getRmhRecommendInfo(resolve)
}
} catch (exception) {
this.viewType = ViewType.ERROR
this.isLoading = false
}
}
// 获取人民号号主推荐
private async getRmhRecommendInfo(resolve?: (value: string | PromiseLike<string>) => void) {
try {
// 获取页面信息
this.rmhList = await PeopleShipMainViewModel.getPeopleRemRecommendInfo()
this.rmhSelectedList = []
this.rmhList.forEach((item: RmhRecommendDTO) => {
this.rmhSelectedList.push(item.creatorId)
})
this.viewType = ViewType.LOADED
this.changeButton = false
this.isLoading = false
Logger.debug('PeopleShipMainComponent', 'getRmhRecommendInfo' + `${JSON.stringify(this.rmhList)}`)
if (resolve) {
resolve('已更新至最新')
}
} catch (exception) {
if (resolve) {
resolve('')
}
this.viewType = ViewType.ERROR
this.changeButton = false
this.isLoading = false
}
}
// 获取关注
private async getAttentionContentListData(resolve?: (value: string | PromiseLike<string>) => void) {
if (this.isLoading && this.currentPage != 1) {
if (resolve) {
resolve('')
}
return
}
this.isLoading = true
try {
// 获取列表数据
let listData = await PeopleShipMainViewModel.getAttentionContentListInfo(this.currentPage, 20, this.loadTime)
Logger.debug('PeopleShipMainComponent', '获取页面信息' + `${JSON.stringify(listData)}`)
if (resolve ) {
if (this.currentPage == 1) {
resolve('已更新至最新')
}else {
resolve('')
}
}
if (listData && listData.list && listData.list.length > 0) {
if (listData.list.length === 20) {
this.hasMore = true;
} else {
this.hasMore = false;
}
if (this.currentPage == 1) {
this.attentionList = []
}
this.attentionList.push(...listData.list)
}
this.viewType = ViewType.LOADED
this.isLoading = false
} catch (exception) {
this.viewType = ViewType.ERROR
this.isLoading = false
}
}
// 说是首页必须要调用
async getInitData() {
Logger.debug('PeopleShipMainComponent', `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`);
this.pageModel.pageId = this.pageId;
this.pageModel.groupId = this.pageId;
this.pageModel.channelId = this.channelId;
this.pageModel.currentPage = 1;
PageHelper.getInitData(this.pageModel, this.pageAdvModel)
}
// 点击一键关注
onOneFollowChange() {
if (this.oneKeyFollow) {
if (this.rmhSelectedList.length > 0) {
if (!HttpUtils.getUserId()) {
this.oneKeyFollow = false
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
//调用接口
this.attentionBatchPort()
} else {
this.oneKeyFollow = false
}
}
}
// 一键关注接口
private async attentionBatchPort() {
try {
// 获取列表数据
let objects = new AttentionBatchDTO()
this.rmhList.forEach((element: RmhRecommendDTO) => {
if ( this.rmhSelectedList.indexOf(element.creatorId) != -1) {
const creator = new CreatorDTO(element.userType, element.userId, element.creatorId)
objects.creators.push(creator)
}
})
Logger.debug('PeopleShipMainComponent', `一键关注接口参数: ${JSON.stringify(objects)}`);
let batchInfo = await PeopleShipMainViewModel.getAttentionBatchInfo(objects)
if (batchInfo.code === 0 || batchInfo.code.toString() === "0") {
this.getData()
}
} catch (exception) {
}
}
// 点击换一换
onChangeButtonClick() {
if (this.changeButton) {
this.getRmhRecommendInfo()
}
}
// 页面展示监听
onPageShowChange() {
if (this.navIndex === this.currentTopNavSelectedIndex && this.pageAttentionChange ) {
this.getData()
}
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipRecommendComponent.ets
0 → 100644
View file @
dd98b33
import { PeopleShipRecommendHeadComponent } from './PeopleShipRecommendHeadComponent'
import { RmhRecommendDTO } from 'wdBean';
import { Logger } from 'wdKit/Index';
import NoMoreLayout from '../page/NoMoreLayout';
@Component
export struct PeopleShipRecommendComponent {
@Prop rmhList: RmhRecommendDTO[] = []
@Consume rmhSelectedList: string[]
// 一键关注处理
@Link oneKeyFollow: boolean
// 换一换
@Link changeButton: boolean
build() {
Column({ space: 0 }) {
Row() {
Image($r('app.media.redLine'))
.width('3vp')
.height('16vp')
.objectFit(ImageFit.Cover)
.margin({
left: '16vp',
right: '4vp'
})
Text('为你推荐优质号主')
.height('30vp')
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
.fontSize($r('app.float.vp_18'))
Blank()
Button({ type: ButtonType.Normal, stateEffect: true }) {
Row() {
Text('换一换')
.height('30vp')
.fontColor($r('app.color.color_999999'))
.fontWeight(400)
.fontSize($r('app.float.vp_14'))
Image($r('app.media.ic_refresh'))
.width('14vp')
.height('14vp')
.objectFit(ImageFit.Cover)
}
}
.margin({
right: '16vp'
})
.backgroundColor(Color.Transparent)
.onClick(() => {
// 点击换一换
if (!this.changeButton) {
this.changeButton = true
}
})
}
.width('100%')
.alignSelf(ItemAlign.Start)
.margin({
top: '10vp',
bottom: '10vp'
})
Grid() {
ForEach(this.rmhList, (item: RmhRecommendDTO) => {
GridItem() {
PeopleShipRecommendHeadComponent({
rmhInfo: item
})
.onClick(() => {
this.clickRecommendHeadSelected(item)
})
}
}, (item: RmhRecommendDTO) => item.creatorId)
}
.columnsTemplate('1fr 1fr 1fr')
.columnsGap(20)
.rowsGap(20)
.height(Math.ceil(this.rmhList.length / 3.0) * 136)
.backgroundColor(Color.Transparent)
.margin({
right: '20vp',
left: '20pv'
})
// 为你推荐
Button(this.rmhSelectedList.length == 0 ? '一键关注' : `一键关注 (${this.rmhSelectedList.length})`, { type: ButtonType.Normal, stateEffect: this.rmhSelectedList.length != 0 })
.margin({
top: '24vp'
})
.width('120vp')
.height('36vp')
.backgroundColor(this.rmhSelectedList.length != 0 ? $r('app.color.color_ED2800') : $r('app.color.color_B0B0B0'))
.borderRadius('3vp')
.fontColor($r('app.color.color_999999'))
.fontWeight(500)
.fontSize($r('app.float.vp_14'))
.fontColor(Color.White)
.onClick(() => {
// 点击一键关注
if (!this.oneKeyFollow && this.rmhSelectedList.length > 0 ){
this.oneKeyFollow = true
}
})
// 没有更多
NoMoreLayout()
}
.width('100%')
}
// 选中
private clickRecommendHeadSelected(rmhInfo: RmhRecommendDTO) {
if (this.rmhSelectedList.length > 0 && rmhInfo ) {
const num = this.rmhSelectedList.indexOf(rmhInfo.creatorId)
if ( num != -1) {
this.rmhSelectedList.splice(num, 1)
}else {
this.rmhSelectedList.push(rmhInfo.creatorId)
}
}else {
this.rmhSelectedList.push(rmhInfo.creatorId)
}
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipRecommendHeadComponent.ets
0 → 100644
View file @
dd98b33
import { RmhRecommendDTO } from 'wdBean';
import { ToastUtils } from 'wdKit/Index';
@Component
export struct PeopleShipRecommendHeadComponent {
@State isSelected: boolean = true
@Consume rmhSelectedList: string[]
@State rmhInfo: RmhRecommendDTO = {} as RmhRecommendDTO
build() {
Column(){
Stack({ alignContent: Alignment.BottomEnd }) {
Image(this.rmhInfo.headPhotoUrl.length > 0 ? this.rmhInfo.headPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon'))
.width('44vp')
.height('44vp')
.borderRadius('22vp')
.objectFit(ImageFit.Cover)
Image( this.isSelectedRmhInfo() ? $r('app.media.rmh_selected') : $r('app.media.rmh_unselected') )
.width('18vp')
.height('18vp')
.objectFit(ImageFit.Cover)
.margin({
right: '-3vp'
})
}.margin({ top: 12, bottom: 8 })
Text(this.rmhInfo.userName)
.fontColor($r('app.color.color_222222'))
.fontSize($r('app.float.vp_14'))
.fontWeight(600)
.maxLines(1)
.textOverflow({overflow: TextOverflow.Ellipsis})
Text(this.rmhInfo.introduction)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize($r('app.float.vp_12'))
.margin({ top: 8, bottom: 14 })
.textOverflow({overflow: TextOverflow.Ellipsis})
.maxLines(2)
.height(34)
}
.width('100%')
.height('116vp')
}
private isSelectedRmhInfo() {
if (this.rmhSelectedList.length > 0 && this.rmhInfo ) {
if (this.rmhSelectedList.indexOf(this.rmhInfo.creatorId) != -1) {
return true
}
}
return false
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomeArticleListComponent.ets
View file @
dd98b33
...
...
@@ -20,7 +20,6 @@ import { RefreshLayoutBean } from '../page/RefreshLayoutBean'
import CustomRefreshLoadLayout from '../page/CustomRefreshLoadLayout'
import { ErrorComponent } from '../view/ErrorComponent';
import NoMoreLayout from '../page/NoMoreLayout';
// import { LazyDataSource } from 'wdKit';
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'
const TAG = 'PeopleShipHomeArticleListComponent';
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomeNavComponent.ets
View file @
dd98b33
...
...
@@ -36,7 +36,7 @@ export struct PeopleShipHomePageNavComponent {
PeopleShipHomePageHeadComponent({
diameter: 30,
iconDiameter: 10,
headPhotoUrl:
this.detailModel.headPhotoUrl
,
headPhotoUrl:
(this.detailModel.headPhotoUrl && this.detailModel.headPhotoUrl.length > 0 ) ? this.detailModel.headPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon')
,
authIcon: this.detailModel.authIcon
})
.margin({
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomePageHeadComponent.ets
View file @
dd98b33
...
...
@@ -2,13 +2,13 @@
export struct PeopleShipHomePageHeadComponent {
@State diameter: number = 30
@State iconDiameter: number = 10
@Prop headPhotoUrl: string = ''
@Prop headPhotoUrl: string
| ResourceStr
= ''
@Prop authIcon: string = ''
build() {
Stack({ alignContent: Alignment.BottomEnd }) {
// 头像
Image( this.headPhotoUrl
.length > 0 ? this.headPhotoUrl : $r('app.media.home_page_header_authority')
)
Image( this.headPhotoUrl )
.width(this.diameter)
.height(this.diameter)
.borderRadius(this.diameter/2)
...
...
@@ -16,6 +16,7 @@ export struct PeopleShipHomePageHeadComponent {
.borderStyle(BorderStyle.Solid)
.borderColor(Color.White)
.objectFit(ImageFit.Cover)
.backgroundColor(Color.White)
if(this.authIcon.length > 0 ) {
Image( this.authIcon )
.width(this.iconDiameter)
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomePageTopComponent.ets
View file @
dd98b33
...
...
@@ -46,7 +46,7 @@ export struct PeopleShipHomePageTopComponent {
PeopleShipHomePageHeadComponent({
diameter: 80,
iconDiameter: 20,
headPhotoUrl:
this.detailModel.headPhotoUrl
,
headPhotoUrl:
(this.detailModel.headPhotoUrl && this.detailModel.headPhotoUrl.length > 0) ? this.detailModel.headPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon')
,
authIcon: this.detailModel.authIcon
}).margin({
left: '10vp',
...
...
sight_harmony/features/wdComponent/src/main/ets/components/setting/AccountAndSecurityLayout.ets
View file @
dd98b33
import { BottomNavi, CommonConstants, SpConstants } from 'wdConstant';
import { Logger, SPHelper, ToastUtils, UserDataLocal } from 'wdKit';
import { Logger, SPHelper, ToastUtils, UserDataLocal
, EmitterEventId, EmitterUtils
} from 'wdKit';
import { TopNavigationComponent } from '../page/TopNavigationComponent';
import PageViewModel from '../../viewmodel/PageViewModel';
import {MineMainSettingFunctionItem} from '../../viewmodel/MineMainSettingFunctionItem';
...
...
@@ -430,7 +430,7 @@ export struct AccountAndSecurityLayout {
let login = new LoginViewModel;
login.logOut().then(()=>{
promptAction.showToast({ message: '退出登录' })
router.back();
EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION)
router.back();
}).catch((error:string)=>{
promptAction.showToast({ message: error })
...
...
sight_harmony/features/wdComponent/src/main/ets/dialog/ENewspaperListDialog.ets
View file @
dd98b33
...
...
@@ -110,7 +110,7 @@ export struct ENewspaperListDialog {
ListItem() {
Column() {
if (itemIndex == 0) {
Text(item.pageNum + item.pageName)
Text(item.pageNum +
'版:' +
item.pageName)
.fontSize($r('app.float.font_size_14'))
.fontColor($r('app.color.color_ED2800'))
.fontWeight(600)
...
...
@@ -130,6 +130,7 @@ export struct ENewspaperListDialog {
Text(positionItem.title)
.fontSize($r('app.float.font_size_17'))
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
.margin({ top: 8 })
.maxLines(2)
}
...
...
@@ -172,9 +173,12 @@ export struct ENewspaperListDialog {
// }
})
}
})
}
.divider({
strokeWidth: 0.5,
color: '#EDEDED'
})
}
})
}
...
...
sight_harmony/features/wdComponent/src/main/ets/model/MinePageDatasModel.ets
View file @
dd98b33
...
...
@@ -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 } from 'wdKit';
import { Logger, StringUtils
, EmitterUtils, EmitterEventId
} from 'wdKit';
import { MineFollowListDetailItem } from '../viewmodel/MineFollowListDetailItem';
import { FollowListDetailRequestItem } from '../viewmodel/FollowListDetailRequestItem';
import { FollowListItem } from '../viewmodel/FollowListItem';
...
...
@@ -545,6 +545,7 @@ class MinePageDatasModel{
return
}
Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION)
success(navResDTO);
}).catch((err: Error) => {
Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
...
...
sight_harmony/features/wdComponent/src/main/ets/repository/PageRepository.ets
View file @
dd98b33
import { HttpUrlUtils, HttpUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { DateTimeUtils, Logger, StringUtils } from 'wdKit';
import { DateTimeUtils, Logger, StringUtils, EmitterUtils, EmitterEventId } from 'wdKit';
import {
batchLikeAndCollectResult,
CompInfoBean,
...
...
@@ -313,10 +314,32 @@ export class PageRepository {
/**
* 关注号主
*/
static postInteractAccentionOperate
(params: postInteractAccentionOperateParams): Promise<ResponseDTO> {
private static postInteractAccentionOperateInfo
(params: postInteractAccentionOperateParams): Promise<ResponseDTO> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_ACCENTION_OPERATION
return WDHttp.post(url, params)
}
/**
* 关注号主
*/
static postInteractAccentionOperate(params: postInteractAccentionOperateParams): Promise<ResponseDTO> {
return new Promise<ResponseDTO>((success, error) => {
Logger.debug(TAG, `postInteractAccentionOperate pageInfo start`);
PageRepository.postInteractAccentionOperateInfo(params)
.then((resDTO: ResponseDTO) => {
if (!resDTO || resDTO.code != 0) {
error(null)
return
}
Logger.debug(TAG, "postInteractAccentionOperate then,navResDTO.timestamp:" + resDTO.timestamp);
EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION)
success(resDTO);
})
.catch((err: Error) => {
Logger.error(TAG, `postInteractAccentionOperate catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
static fetchNewspaperInfo(date: string) {
let url = PageRepository.getNewspaperInfoUrl(date)
...
...
sight_harmony/features/wdComponent/src/main/ets/viewmodel/PeopleShipMainViewModel.ets
0 → 100644
View file @
dd98b33
import { Logger } from 'wdKit';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import HashMap from '@ohos.util.HashMap';
import {
RmhRecommendDTO,
PeopleShipContentListDTO,
AttentionBatchDTO
} from 'wdBean';
const TAG = 'PeopleShipMainViewModel'
export class PeopleShipMainViewModel {
/*人民号号主推荐*/
static fetchPeopleRemRecommendData() {
let url = HttpUrlUtils.getRmhRecommendUrl()
let bean: Record<string, string> = {};
return WDHttp.post<ResponseDTO<RmhRecommendDTO[]>>(url, bean)
}
static async getPeopleRemRecommendInfo(): Promise<RmhRecommendDTO[]> {
return new Promise<RmhRecommendDTO[]>((success, error) => {
Logger.debug(TAG, `getMorningEveningCompInfo pageInfo start`);
PeopleShipMainViewModel.fetchPeopleRemRecommendData()
.then((resDTO: ResponseDTO<RmhRecommendDTO[]>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'getPeopleRemRecommendInfo then navResDTO is empty');
error('resDTO is empty');
return
}
if (resDTO.code != 0) {
Logger.error(TAG, `getPeopleRemRecommendInfo then code:${resDTO.code}, message:${resDTO.message}`);
error('resDTO Response Code is failure');
return
}
Logger.debug(TAG, "getPeopleRemRecommendInfo then,navResDTO.timestamp:" + resDTO.timestamp);
success(resDTO.data);
})
.catch((err: Error) => {
Logger.error(TAG, `getPeopleRemRecommendInfo catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
/*关注号主发布内容接口*/
static fetchAttentionContentListData(pageNum: number, pageSize: number, time: string) {
let url = HttpUrlUtils.getAttentionContentListUrl()
let params: Record<string, Object> = {};
params['pageNum'] = pageNum
params['pageSize'] = pageSize
params['time'] = time
return WDHttp.post<ResponseDTO<PeopleShipContentListDTO>>(url, params)
}
static async getAttentionContentListInfo(pageNum:number, pageSize: number, time: string): Promise<PeopleShipContentListDTO> {
return new Promise<PeopleShipContentListDTO>((success, error) => {
Logger.debug(TAG, `getAttentionContentListInfo pageInfo start`);
PeopleShipMainViewModel.fetchAttentionContentListData(pageNum, pageSize, time)
.then((resDTO: ResponseDTO<PeopleShipContentListDTO>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'getAttentionContentListInfo then navResDTO is empty');
error('resDTO is empty');
return
}
if (resDTO.code != 0) {
Logger.error(TAG, `getAttentionContentListInfo then code:${resDTO.code}, message:${resDTO.message}`);
error('resDTO Response Code is failure');
return
}
Logger.debug(TAG, "getAttentionContentListInfo then,navResDTO.timestamp:" + resDTO.timestamp);
success(resDTO.data);
})
.catch((err: Error) => {
Logger.error(TAG, `getAttentionContentListInfo catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
/*一键关注接口*/
static fetchAttentionBatchData(params: AttentionBatchDTO) {
let url = HttpUrlUtils.getAttentionBatchUrl()
return WDHttp.post<ResponseDTO>(url, params)
}
static async getAttentionBatchInfo(params: AttentionBatchDTO): Promise<ResponseDTO> {
return new Promise<ResponseDTO>((success, error) => {
Logger.debug(TAG, `getAttentionBatchInfo pageInfo start`);
PeopleShipMainViewModel.fetchAttentionBatchData(params)
.then((resDTO: ResponseDTO) => {
if (!resDTO || resDTO.code != 0) {
error(resDTO.message)
return
}
Logger.debug(TAG, "getAttentionBatchInfo then,navResDTO.timestamp:" + resDTO.timestamp);
success(resDTO);
})
.catch((err: Error) => {
Logger.error(TAG, `getAttentionBatchInfo catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/resources/base/element/float.json
View file @
dd98b33
...
...
@@ -271,6 +271,14 @@
{
"name"
:
"vp_14"
,
"value"
:
"14vp"
},
{
"name"
:
"vp_18"
,
"value"
:
"18vp"
},
{
"name"
:
"vp_13"
,
"value"
:
"13vp"
}
]
}
...
...
sight_harmony/features/wdComponent/src/main/resources/base/media/home_page_header_authority.png
deleted
100644 → 0
View file @
0d9d332
5.05 KB
sight_harmony/features/wdDetailPlayApi/src/main/ets/request/ContentDetailRequest.ets
View file @
dd98b33
import { Logger, ResourcesUtils } from 'wdKit';
import { Logger, ResourcesUtils
, EmitterUtils, EmitterEventId
} from 'wdKit';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { ContentDetailDTO, InteractDataDTO } from 'wdBean';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
...
...
@@ -321,8 +321,32 @@ export class ContentDetailRequest {
/**
* 关注号主
*/
static postInteractAccentionOperate
(params: postInteractAccentionOperateParams): Promise<ResponseDTO> {
private static postInteractAccentionOperateInfo
(params: postInteractAccentionOperateParams): Promise<ResponseDTO> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_ACCENTION_OPERATION
return WDHttp.post(url, params)
}
/**
* 关注号主
*/
static postInteractAccentionOperate(params: postInteractAccentionOperateParams): Promise<ResponseDTO> {
return new Promise<ResponseDTO>((success, error) => {
Logger.debug(TAG, `postInteractAccentionOperate pageInfo start`);
ContentDetailRequest.postInteractAccentionOperateInfo(params)
.then((resDTO: ResponseDTO) => {
if (!resDTO || resDTO.code != 0) {
error(null)
return
}
Logger.debug(TAG, "postInteractAccentionOperate then,navResDTO.timestamp:" + resDTO.timestamp);
// 关注号后发送-更新关注页面
EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION)
success(resDTO);
})
.catch((err: Error) => {
Logger.error(TAG, `postInteractAccentionOperate catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginModel.ets
View file @
dd98b33
...
...
@@ -84,7 +84,11 @@ export class LoginModel {
// {"password":"523acd319228efde34e8a30268ee8ca5e4fc421d72affa531676e1765940d22c","phone":"13625644528","loginType":0,"oldPassword":"BA5FD74F827AF9B271FE17CADC489C36","deviceId":"60da5af6-9c59-3566-8622-8c6c00710994"}
appLoginByPassword(phone: string, loginType: number, password: string, oldPassword: string) {
let bean: Record<string, string | number> = {};
bean['phone'] = phone
if (loginType == 0) {
bean['phone'] = phone
} else {
bean['userName'] = phone
}
bean['loginType'] = loginType
bean['deviceId'] = '60da5af6-9c59-3566-8622-8c6c00710994'
bean['password'] = password
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginPage.ets
View file @
dd98b33
import { Logger
} from 'wdKit/src/main/ets/utils/Logger
'
import { Logger
, EmitterEventId, EmitterUtils } from 'wdKit
'
import { CustomProtocolDialog } from './CustomProtocolDialog'
import router from '@ohos.router'
import { LoginViewModel } from './LoginViewModel'
...
...
@@ -196,7 +196,6 @@ struct LoginPage {
Column() {
TextInput({ placeholder: "请输入账号", controller: this.phoneController })
.fontSize(16)
.maxLength(11)
.height(48)
.backgroundColor("#F5F5F5")
.borderRadius(4)
...
...
@@ -325,6 +324,7 @@ struct LoginPage {
let interestsModel = new InterestsHobbiesModel()
interestsModel.updateInterests()
this.queryUserDetail()
EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION)
}).catch((error:string)=>{
promptAction.showToast({ message: error })
})
...
...
@@ -332,11 +332,12 @@ struct LoginPage {
this.loginViewModel.appLoginByPassword(this.accountContent, 0, this.passwordContent, "").then((data) => {
Logger.debug(TAG, "requestLogin: " + data.jwtToken)
promptAction.showToast({ message: '登录成功' })
///同步兴趣tag
let interestsModel = new InterestsHobbiesModel()
interestsModel.updateInterests()
this.queryUserDetail()
EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION)
// router.back({
// params: { userName: data.userName,
// userId:data.id},
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginViewModel.ets
View file @
dd98b33
import { Logger } from 'wdKit/src/main/ets/utils/Logger'
import { LoginModel } from './LoginModel'
import { LoginBean } from './LoginBean'
import { SPHelper } from 'wdKit'
import { SPHelper
, StringUtils
} from 'wdKit'
import { CheckVerifyBean } from './CheckVerifyBean'
import cryptoFramework from '@ohos.security.cryptoFramework'
import buffer from '@ohos.buffer'
...
...
@@ -66,11 +66,17 @@ export class LoginViewModel {
}
async appLoginByPassword(phone: string, loginType: number, password: string, oldPassword: string) {
let newLoginType: number
let isPhone = this.verifyIsPhoneNumber(phone)
if (isPhone) {
newLoginType = 0;
} else {
newLoginType = 8;
}
return new Promise<LoginBean>(async (success, fail) => {
let passwordNew = await this.doMd(password)
Logger.debug(TAG, "PASSWORD:" + passwordNew)
this.loginModel.appLoginByPassword(phone,
l
oginType, passwordNew, oldPassword).then((data: LoginBean) => {
this.loginModel.appLoginByPassword(phone,
newL
oginType, passwordNew, oldPassword).then((data: LoginBean) => {
SPHelper.default.saveSync(SpConstants.USER_FIRST_MARK, data.firstMark)
SPHelper.default.saveSync(SpConstants.USER_ID, data.id)
SPHelper.default.saveSync(SpConstants.USER_JWT_TOKEN, data.jwtToken)
...
...
@@ -234,4 +240,18 @@ export class LoginViewModel {
})
})
}
public verifyIsPhoneNumber(phone: string): boolean {
const regex = /^1[3-9]\d{9}$/;
let isMatch: boolean;
if (StringUtils.isEmpty(phone)) {
return false;
} else if (phone.length != 11) {
return false;
} else {
isMatch = regex.test(phone)
}
return isMatch;
}
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment