daijian_wd

Merge remote-tracking branch 'origin/main'

Showing 37 changed files with 1164 additions and 121 deletions
... ... @@ -15,6 +15,9 @@ export enum EmitterEventId {
/*发布评论*/
COMMENT_PUBLISH = 6,
// 关注,取消关注
PEOPLE_SHIP_ATTENTION = 7,
// App回到前台
APP_ENTER_FOREGROUD = 100,
// App进入后台
... ...
... ... @@ -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
... ...
... ... @@ -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';
... ...
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
}
}
... ...
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
... ...
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;
}
... ...
... ... @@ -32,6 +32,7 @@ export class commentListModel extends PageModel {
pageNum: number = 1
pageSize: number = 10
totalCount: number = 0
totalCommentNum: string = '0'
hasNext: number = 0
list: commentItemModel[] = []
// constructor(pageNum:number, pageSize:number, totalCount: number, hasNext: number, list: commentItemModel[]) {
... ...
... ... @@ -177,6 +177,7 @@ export struct CommentComponent {
async getData() {
commentViewModel.fetchContentCommentList('1', this.publishCommentModel.targetId, this.publishCommentModel.targetType)
.then(commentListModel => {
this.publishCommentModel.totalCommentNumer = commentListModel.totalCount + ''
if (commentListModel && commentListModel.list && commentListModel.list.length > 0) {
commentListModel.list.forEach(element => {
element.hasMore = Number.parseInt(element.childCommentNum) ? true : false
... ...
import { EmitterEventId, EmitterUtils } from 'wdKit/Index'
import { DisplayUtils, EmitterEventId, EmitterUtils } from 'wdKit/Index'
import { publishCommentModel } from '../model/PublishCommentModel'
import { CommentCustomDialog } from './CommentCustomDialog'
import measure from '@ohos.measure'
@Preview
@Component
export struct CommentTabComponent {
@ObjectLink publishCommentModel: publishCommentModel
/*展示类型*/
@State type:number = 1
@State type: number = 1
@State placeHolder: string = '说两句...'
@State dialogController: CustomDialogController | null = null;
/*回调方法*/
dialogControllerConfirm: () => void = () => {}
dialogControllerConfirm: () => void = () => {
}
aboutToAppear() {
... ... @@ -24,9 +21,9 @@ export struct CommentTabComponent {
builder: CommentCustomDialog({
confirm: (value: Record<string, string>) => {
this.dialogControllerConfirm();
EmitterUtils.sendEvent(EmitterEventId.COMMENT_PUBLISH,this.publishCommentModel.targetId)
EmitterUtils.sendEvent(EmitterEventId.COMMENT_PUBLISH, this.publishCommentModel.targetId)
},
publishCommentModel:this.publishCommentModel
publishCommentModel: this.publishCommentModel
}),
autoCancel: true,
alignment: DialogAlignment.Bottom,
... ... @@ -40,13 +37,13 @@ export struct CommentTabComponent {
}
build() {
Row(){
Stack({alignContent:Alignment.Start}){
Row() {
Stack({ alignContent: Alignment.Start }) {
Image($r('app.media.comment_img_input_hui')).width(151).height(30)
Text(this.placeHolder).fontSize(12).fontColor('#999999').margin({left:10})
Text(this.placeHolder).fontSize(12).fontColor('#999999').margin({ left: 10 })
}
}.width(151).height(30)
.onClick(()=>{
.onClick(() => {
this.publishCommentModel.parentId = '-1';
this.dialogController?.open();
})
... ... @@ -58,54 +55,84 @@ export struct CommentTabComponent {
export struct CommentIconComponent {
@ObjectLink publishCommentModel: publishCommentModel
/*展示类型*/
@State type:number = 1
@State type: number = 1
// aboutToAppear(): void {
// setTimeout(() => {
// this.publishCommentModel.totalCommentNumer = '444'
// }, 3000);
//
// setTimeout(() => {
// this.publishCommentModel.totalCommentNumer = '2'
// }, 4000);
// }
/*回调方法*/
onClickItem: () => void = () => {}
onClickItem: () => void = () => {
}
build() {
Row(){
Stack({alignContent:Alignment.TopEnd}){
Row() {
Stack({ alignContent: Alignment.TopEnd }) {
Image($r('app.media.comment_icon')).width(24).height(24)
// Stack({alignContent:Alignment.Start}) {
// if(Number.parseInt(this.publishCommentModel.totalCommentNumer) != 0){
RelativeContainer() {
Image($r('app.media.comment_icon_number_bg'))
.objectFit(ImageFit.Fill)
.resizable({ slice: {top:1, left: 20 , right:1, bottom:1} })
.resizable({ slice: { top: 1, left: 20, right: 1, bottom: 1 } })
.alignRules({
top: {anchor: "Text", align: VerticalAlign.Top},
left: {anchor: "Text", align: HorizontalAlign.Start},
right: {anchor: "Text", align: HorizontalAlign.End},
bottom : {anchor: "Text", align: VerticalAlign.Bottom},
})
// .offset({
top: { anchor: "Text", align: VerticalAlign.Top },
left: { anchor: "Text", align: HorizontalAlign.Start },
right: { anchor: "Text", align: HorizontalAlign.End },
bottom: { anchor: "Text", align: VerticalAlign.Bottom },
})// .offset({
// x:-6
// })
.id("Image")
Text('123213123123123')
Text(this.publishCommentModel.totalCommentNumer)// Text("44444444")
.fontSize(8)
.fontColor('#ffffff')// .backgroundColor('#ED2800')
.height(12)
.textAlign(TextAlign.Center)
.alignRules({
top: {anchor: "__container__", align: VerticalAlign.Top},
left: {anchor: "__container__", align: HorizontalAlign.Start}
})
// .margin({left: 4,right:4
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start }
})// .margin({left: 4,right:4
// })
/*动态计算文字宽度*/
.width(50)
// .backgroundColor(Color.Green)
.width(this.getMeasureText(this.publishCommentModel.totalCommentNumer) + 12)// .backgroundColor(Color.Green)
.id("Text")
// .offset({
// x: 3
// })
}
// }
.offset({
x:12
x: 12
})
// }
}
}.width(24).height(24)
// .backgroundColor(Color.Blue)
}
private getMeasureText(text: string) {
let width = measure.measureText({
textContent: text,
fontSize: 8,
lineHeight: 12,
constraintWidth: DisplayUtils.getDeviceWidth(),
})
width = px2vp(width)
return width
}
}
... ...
... ... @@ -25,6 +25,41 @@ export struct FollowListDetailUI {
curPageNum: number = 1;
preferences: dataPreferences.Preferences | null = null;
@State isGetRequest: boolean = false
observer = (key: string) => {
if (key == UserDataLocal.USER_FOLLOW_OPERATION) {
if (this.creatorDirectoryId === -1) {
let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION, "") as string
let arr = value.split(',')
if (arr[1] == "0") {
this.data.getDataArray().forEach((element, index) => {
if (element.creatorId === arr[0]) {
this.data.deleteItem(index)
this.count = this.data.size()
}
});
} else {
if (!this.isLoading) {
this.isLoading = true
this.hasMore = true
this.curPageNum = 1
this.data.clear()
this.data.notifyDataReload()
this.getMyFollowListDetail()
}
}
}else{
let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION, "") as string
let arr = value.split(',')
if (arr[1] == "0"){
this.data.getDataArray().forEach((element, index) => {
if (element.creatorId === arr[0]) {
this.data.getData(index).status = "0"
}
})
}
}
}
}
aboutToAppear() {
this.getNewPageData()
... ... @@ -76,42 +111,13 @@ export struct FollowListDetailUI {
async addFollowStatusObserver() {
this.preferences = await SPHelper.default.getPreferences();
let observer = (key: string) => {
if (key == UserDataLocal.USER_FOLLOW_OPERATION) {
if (this.creatorDirectoryId === -1) {
let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION, "") as string
let arr = value.split(',')
if (arr[1] == "0") {
this.data.getDataArray().forEach((element, index) => {
if (element.creatorId === arr[0]) {
this.data.deleteItem(index)
this.count = this.data.size()
}
});
} else {
if (!this.isLoading) {
this.isLoading = true
this.hasMore = true
this.curPageNum = 1
this.data.clear()
this.data.notifyDataReload()
this.getMyFollowListDetail()
}
}
}else{
let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION, "") as string
let arr = value.split(',')
if (arr[1] == "0"){
this.data.getDataArray().forEach((element, index) => {
if (element.creatorId === arr[0]) {
this.data.getData(index).status = "0"
}
})
}
}
this.preferences.on('change', this.observer);
}
aboutToDisappear(): void {
if(this.preferences){
this.preferences.off('change', this.observer);
}
this.preferences.on('change', observer);
}
getMyFollowListDetail() {
... ...
... ... @@ -28,15 +28,7 @@ export struct HomePageBottomComponent{
@Link commentNum:number
preferences: dataPreferences.Preferences | null = null;
@State isGetRequest:boolean = false
aboutToAppear(){
this.getNewPageData()
this.addFollowStatusObserver()
}
async addFollowStatusObserver() {
this.preferences = await SPHelper.default.getPreferences();
let observer = (key: string) => {
observer = (key: string) => {
if (key == UserDataLocal.USER_FOLLOW_OPERATION) {
let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION,"") as string
let arr = value.split(',')
... ... @@ -59,7 +51,21 @@ export struct HomePageBottomComponent{
}
}
}
this.preferences.on('change', observer);
aboutToAppear(){
this.getNewPageData()
this.addFollowStatusObserver()
}
async addFollowStatusObserver() {
this.preferences = await SPHelper.default.getPreferences();
this.preferences.on('change', this.observer);
}
aboutToDisappear(): void {
if(this.preferences){
this.preferences.off('change', this.observer);
}
}
build(){
... ...
... ... @@ -24,6 +24,15 @@ export struct MinePageComponent {
@State moreData:MinePageMoreFunctionModel[] = []
scroller: Scroller = new Scroller()
preferences: dataPreferences.Preferences | null = null;
observer = (key: string) => {
if(key == SpConstants.USER_ID){
if(StringUtils.isEmpty(SPHelper.default.getSync(SpConstants.USER_ID,""))){
this.isLogin = false
}else {
this.isLogin = true
}
}
}
aboutToAppear(){
this.getUserLogin()
... ... @@ -33,16 +42,13 @@ export struct MinePageComponent {
async addLoginStatusObserver(){
this.preferences = await SPHelper.default.getPreferences();
let observer = (key: string) => {
if(key == SpConstants.USER_ID){
if(StringUtils.isEmpty(SPHelper.default.getSync(SpConstants.USER_ID,""))){
this.isLogin = false
}else {
this.isLogin = true
}
this.preferences.on('change', this.observer);
}
aboutToDisappear(): void {
if(this.preferences){
this.preferences.off('change', this.observer);
}
this.preferences.on('change', observer);
}
... ...
... ... @@ -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';
... ... @@ -218,7 +220,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,
... ...
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%')
}
}
... ...
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
... ...
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
... ...
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
... ...
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
... ...
... ... @@ -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';
... ...
... ... @@ -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({
... ...
... ... @@ -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)
... ...
... ... @@ -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',
... ...
import { Params } from 'wdBean';
import { AppUtils, StringUtils } from 'wdKit/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
import { EnvironmentCustomDialog } from './EnvironmentCustomDialog';
... ... @@ -32,6 +33,10 @@ export struct AboutPageUI {
aboutToAppear() {
let context = getContext();
context.getApplicationContext();
let appVerion = AppUtils.getAppVersionName()
if (StringUtils.isNotEmpty(appVerion)) {
this.version = "版本号:" + appVerion
}
}
@Builder
... ...
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 })
... ...
... ... @@ -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'
})
}
})
}
... ...
... ... @@ -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}`);
... ...
... ... @@ -182,13 +182,14 @@ struct MineHomePage {
Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx')
//tab 页面
Stack({ alignContent: Alignment.Top }){
Tabs({controller: this.controller}) {
TabContent() {
HomePageBottomComponent({style:0,commentNum:$commentNum})
}.tabBar(this.TabBuilder(0,"评论"))
}
TabContent() {
HomePageBottomComponent({style:1,commentNum:$commentNum})
}.tabBar(this.TabBuilder(1,"关注"))
}
}
.backgroundColor($r('app.color.white'))
.animationDuration(0)
... ... @@ -196,6 +197,32 @@ struct MineHomePage {
this.currentIndex = index
})
.vertical(false)
.barHeight("77lpx")
Column() {
// 页签
Row({ space: 7 }) {
Scroll() {
Row() {
this.TabBuilder(0,"评论")
this.TabBuilder(1,"关注")
}
.justifyContent(FlexAlign.Start)
}
.align(Alignment.Start)
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.width('100%')
.padding({left:'31lpx'})
}
.alignItems(VerticalAlign.Bottom)
.width('100%')
}
.backgroundColor($r('app.color.white'))
.alignItems(HorizontalAlign.Start)
.width('100%')
.height('77lpx')
}
}.width("100%")
}
.edgeEffect(EdgeEffect.None)
... ... @@ -341,9 +368,9 @@ struct MineHomePage {
this.currentIndex = index
this.controller.changeIndex(this.currentIndex)
})
.height('100%')
.width('100%')
.margin({right:'9lpx'})
.height('77lpx')
.width('70lpx')
.margin({right:'29lpx'})
}
/**
... ...
... ... @@ -176,13 +176,14 @@ struct OtherNormalUserHomePage {
Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx')
//tab 页面
Stack({ alignContent: Alignment.Top }){
Tabs({controller: this.controller}) {
TabContent() {
OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead,commentNum:$commentNum})
}.tabBar(this.TabBuilder(0,"评论"))
}
TabContent() {
OtherHomePageBottomFollowComponent({curUserId:this.curUserId})
}.tabBar(this.TabBuilder(1,"关注"))
}
}
.backgroundColor($r('app.color.white'))
.animationDuration(0)
... ... @@ -190,6 +191,32 @@ struct OtherNormalUserHomePage {
this.currentIndex = index
})
.vertical(false)
.barHeight('77lpx')
Column() {
// 页签
Row({ space: 7 }) {
Scroll() {
Row() {
this.TabBuilder(0,"评论")
this.TabBuilder(1,"关注")
}
.justifyContent(FlexAlign.Start)
}
.align(Alignment.Start)
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.width('90%')
.padding({left:'31lpx'})
}
.alignItems(VerticalAlign.Bottom)
.width('100%')
}
.backgroundColor($r('app.color.white'))
.alignItems(HorizontalAlign.Start)
.width('100%')
.height('77lpx')
}
}.width("100%")
}
.edgeEffect(EdgeEffect.None)
... ... @@ -300,9 +327,9 @@ struct OtherNormalUserHomePage {
this.currentIndex = index
this.controller.changeIndex(this.currentIndex)
})
.height('100%')
.width('100%')
.margin({right:'9lpx'})
.height('77lpx')
.width('70lpx')
.margin({right:'29lpx'})
}
... ...
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)
... ...
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
... ...
... ... @@ -271,6 +271,14 @@
{
"name": "vp_14",
"value": "14vp"
},
{
"name": "vp_18",
"value": "18vp"
},
{
"name": "vp_13",
"value": "13vp"
}
]
}
... ...
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
... ...
... ... @@ -37,7 +37,7 @@ export struct LoginInputComponent {
.type(InputType.PhoneNumber)
.onChange((content) => {
this.phoneContent = content
this.isSubmit = (this.phoneContent.length >= 11 && this.codeContent.length >= 6)
this.isSubmit = (this.phoneContent.length >= 11 && this.codeContent.length >= 4)
if (content.length >= 11) {
this.codeBtnState = true
} else {
... ... @@ -55,7 +55,7 @@ export struct LoginInputComponent {
.type(InputType.Number)
.onChange((content) => {
this.phoneContent = content
this.isSubmit = (this.phoneContent.length >= 11 && this.codeContent.length >= 6)
this.isSubmit = (this.phoneContent.length >= 11 && this.codeContent.length >= 4)
if (content.length >= 11) {
this.codeBtnState = true
} else {
... ... @@ -78,7 +78,7 @@ export struct LoginInputComponent {
// .backgroundImageSize(ImageSize.Contain)
.onChange((value) => {
this.codeContent = value
this.isSubmit = (this.phoneContent.length >= 11 && this.codeContent.length >= 6)
this.isSubmit = (this.phoneContent.length >= 11 && this.codeContent.length >= 4)
})
Text(this.isCodeSend ? this.timeCount + "s" : this.isFirst?"发送验证码":'重新发送')
... ...
... ... @@ -13,9 +13,9 @@ export class LoginModel {
sendVerifyCode(number: string) {
let bean: Record<string, string> = {};
bean['phoneNum'] = number
return new Promise<string>((success, fail) => {
HttpRequest.post<ResponseDTO<string>>(HttpUrlUtils.getVerifyCodeUrl(), bean).then((data: ResponseDTO<string>) => {
if (!data || !data.data) {
return new Promise<object>((success, fail) => {
HttpRequest.post<ResponseDTO<object>>(HttpUrlUtils.getVerifyCodeUrl(), bean).then((data: ResponseDTO<object>) => {
if (!data) {
fail("数据为空")
return
}
... ... @@ -23,7 +23,7 @@ export class LoginModel {
fail(data.message)
return
}
success(data.data)
success(data)
}, (error: Error) => {
fail(error.message)
Logger.debug("LoginViewModel:error ", error.toString())
... ...
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'
... ... @@ -325,6 +325,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 +333,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},
... ...
... ... @@ -22,7 +22,7 @@ export class LoginViewModel {
//发送验证码
sendVerifyCode(number: string) {
return new Promise<string>((success, fail) => {
return new Promise<object>((success, fail) => {
this.loginModel.sendVerifyCode(number).then((data) => {
success(data)
}).catch((message: string) => {
... ...