yangchenggong1_wd

desc:缺省图

... ... @@ -9,12 +9,13 @@ import { EmptyComponent } from '../../view/EmptyComponent';
const TAG = "AppointmentListUI"
@Component
export struct AppointmentListUI{
export struct AppointmentListUI {
@State data: LazyDataSource<MineAppointmentItem> = new LazyDataSource();
@State count:number = 0;
@State isLoading:boolean = false
@State hasMore:boolean = true
curPageNum:number = 1;
@State count: number = 0;
@State isLoading: boolean = false
@State hasMore: boolean = true
curPageNum: number = 1;
@State isGetRequest: boolean = false
aboutToAppear() {
this.getNewPageData()
... ... @@ -23,37 +24,41 @@ export struct AppointmentListUI{
build() {
Column() {
//标题栏目
CustomTitleUI({titleName:"预约列表"})
if(this.count == 0){
EmptyComponent({emptyType:10})
CustomTitleUI({ titleName: "预约列表" })
if (this.count == 0) {
if (this.isGetRequest == true) {
EmptyComponent({ emptyType: 10 })
.height('100%')
.width('100%')
}else{
}
} else {
//刷新控件 TODO
//List
List({ space: '6lpx' }) {
LazyForEach(this.data, (item: MineAppointmentItem, index: number) => {
ListItem() {
AppointmentListChildComponent({item:item})
AppointmentListChildComponent({ item: item })
}
.onClick(()=>{
.onClick(() => {
//TODO 跳转
})
}, (item: MineAppointmentItem, index: number) => index.toString())
//没有更多数据 显示提示
if(!this.hasMore){
ListItem(){
if (!this.hasMore) {
ListItem() {
ListHasNoMoreDataUI()
}
}
}.cachedCount(4)
}
.cachedCount(4)
.scrollBar(BarState.Off)
.margin({top:'23lpx',left:'23lpx',right:'23lpx'})
.margin({ top: '23lpx', left: '23lpx', right: '23lpx' })
.layoutWeight(1)
.onReachEnd(()=>{
console.log(TAG,"触底了");
if(!this.isLoading){
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
//加载分页数据
this.getNewPageData()
}
... ... @@ -65,70 +70,73 @@ export struct AppointmentListUI{
.width('100%')
}
getNewPageData(){
getNewPageData() {
this.isLoading = true
if(this.hasMore){
MinePageDatasModel.getAppointmentListData("20",`${this.curPageNum}`,getContext(this)).then((value)=>{
if (!this.data || value.list.length == 0){
if (this.hasMore) {
MinePageDatasModel.getAppointmentListData("20", `${this.curPageNum}`, getContext(this)).then((value) => {
if (!this.data || value.list.length == 0) {
this.hasMore = false
}else{
value.list.forEach((value)=>{
} else {
value.list.forEach((value) => {
let dealTime = this.DealStartTime(value.planStartTime)
if(dealTime!=null && dealTime.length === 2){
this.data.push(new MineAppointmentItem(value.imageUrl,value.status,value.title,true,dealTime[0],dealTime[1],value.relType,value.liveId,value.relId))
}else {
this.data.push(new MineAppointmentItem(value.imageUrl,value.status,value.title,true,"","",value.relType,value.liveId,value.relId))
if (dealTime != null && dealTime.length === 2) {
this.data.push(new MineAppointmentItem(value.imageUrl, value.status, value.title, true, dealTime[0], dealTime[1], value.relType, value.liveId, value.relId))
} else {
this.data.push(new MineAppointmentItem(value.imageUrl, value.status, value.title, true, "", "", value.relType, value.liveId, value.relId))
}
})
this.data.notifyDataReload()
this.count = this.data.totalCount()
if (this.data.totalCount() < value.totalCount) {
this.curPageNum++
}else {
} else {
this.hasMore = false
}
}
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
this.isGetRequest = true
this.isLoading = false
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
this.isGetRequest = true
this.isLoading = false
})
}
this.isLoading = false
}
DealStartTime(planStartTime:string):string[]{
let dealData:string[] = []
DealStartTime(planStartTime: string): string[] {
let dealData: string[] = []
if(!StringUtils.isNotEmpty(planStartTime)){
console.log(TAG,"格式有误")
if (!StringUtils.isNotEmpty(planStartTime)) {
console.log(TAG, "格式有误")
return dealData
}
if(planStartTime.indexOf(" ") === -1){
console.log(TAG,"格式有误")
if (planStartTime.indexOf(" ") === -1) {
console.log(TAG, "格式有误")
return dealData
}
let arr = planStartTime.split(" ")
if(arr!=null && StringUtils.isNotEmpty(arr[0])){ //处理年月日
if (arr != null && StringUtils.isNotEmpty(arr[0])) { //处理年月日
let time = arr[0].split("-");
if(time.length === 3){
let month = time[1].indexOf("0") === 0 ? time[1].substring(1):time[1]
if (time.length === 3) {
let month = time[1].indexOf("0") === 0 ? time[1].substring(1) : time[1]
let day = time[2]
dealData[0] = `${month}月${day}日`
let today = `${new Date().getMonth()+1}月${new Date().getDate()}日`
if(dealData[0] === today){
let today = `${new Date().getMonth() + 1}月${new Date().getDate()}日`
if (dealData[0] === today) {
dealData[0] = "今日"
}
}
}
if(arr!=null && StringUtils.isNotEmpty(arr[1])){ //处理时分
if (arr != null && StringUtils.isNotEmpty(arr[1])) { //处理时分
let time = arr[1].split(":");
if(time.length === 3){
if (time.length === 3) {
dealData[1] = `${time[0]}:${time[1]}`
}
}
console.log(TAG,JSON.stringify(dealData))
console.log(TAG, JSON.stringify(dealData))
return dealData
}
}
\ No newline at end of file
... ...
... ... @@ -256,11 +256,13 @@ export struct FollowChildComponent{
if (value.code === 0 || value.code.toString() === "0") {
this.data.status = this.data.status ==="0"?"1":"0"
if(this.data.status === "1"){
UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+"")
}else{
UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+","+this.data.creatorId)
}
UserDataLocal.setUserFollowOperation(this.data.creatorId+","+this.data.status)
// if(this.data.status === "1"){
// UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+"")
// }else{
// UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+","+this.data.creatorId)
// }
}
}
})
... ...
... ... @@ -24,6 +24,7 @@ export struct FollowListDetailUI {
@State hasMore: boolean = true
curPageNum: number = 1;
preferences: dataPreferences.Preferences | null = null;
@State isGetRequest: boolean = false
aboutToAppear() {
this.getNewPageData()
... ... @@ -33,9 +34,12 @@ export struct FollowListDetailUI {
build() {
Column() {
if (this.count === 0) {
EmptyComponent({emptyType:14})
if (this.isGetRequest == true) {
EmptyComponent({ emptyType: 14 })
.layoutWeight(1)
.width('100%')
}
} else {
List({ space: 3 }) {
LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => {
... ... @@ -47,7 +51,7 @@ export struct FollowListDetailUI {
}, (item: FollowListDetailItem) => item.creatorId)
//没有更多数据 显示提示
if (!this.hasMore) {
if (!this.hasMore && this.count != 0) {
ListItem() {
ListHasNoMoreDataUI()
}
... ... @@ -75,16 +79,17 @@ export struct FollowListDetailUI {
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 value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION, "") as string
let arr = value.split(',')
if(arr!=null && arr.length === 2){
this.data.getDataArray().forEach((element,index) => {
if (element.creatorId === arr[1]) {
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){
} else {
if (!this.isLoading) {
this.isLoading = true
this.hasMore = true
this.curPageNum = 1
... ... @@ -93,6 +98,16 @@ export struct FollowListDetailUI {
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"
}
})
}
}
}
}
... ... @@ -109,7 +124,7 @@ export struct FollowListDetailUI {
this.isLoading = false
} else {
value.list.forEach((value) => {
let fansNum:number = value.fansNum
let fansNum: number = value.fansNum
let fansNumString = ""
if (fansNum > 10000) {
let temp = (fansNum / 10000) + ""
... ... @@ -123,7 +138,7 @@ export struct FollowListDetailUI {
} else {
fansNumString = fansNum + ""
}
this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl, value.attentionUserName, fansNumString, value.introduction, value.attentionCreatorId, "1", value.attentionUserId, value.attentionUserType, value.attentionUserId, value.mainControl, value.banControl,value.authIcon))
this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl, value.attentionUserName, fansNumString, value.introduction, value.attentionCreatorId, "1", value.attentionUserId, value.attentionUserType, value.attentionUserId, value.mainControl, value.banControl, value.authIcon))
})
this.data.notifyDataReload()
this.count = this.data.totalCount()
... ... @@ -134,12 +149,15 @@ export struct FollowListDetailUI {
}
}
this.isLoading = false
this.isGetRequest = true
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isGetRequest = true
this.isLoading = false
})
}else {
} else {
this.isLoading = false
this.isGetRequest = true
}
}
... ... @@ -161,6 +179,7 @@ export struct FollowListDetailUI {
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isLoading = false
this.isGetRequest = true
})
}
}
... ... @@ -169,7 +188,7 @@ export struct FollowListDetailUI {
getFollowListStatus(result: MineFollowListDetailItem) {
let data_temp: FollowListDetailItem[] = []
result.list.forEach((item) => {
data_temp.push(new FollowListDetailItem(item.headPhotoUrl, item.cnUserName, item.cnFansNum, item.introduction, item.creatorId, "0", item.attentionUserId, item.cnUserType, item.cnUserId, item.cnMainControl, -1,item.authIcon))
data_temp.push(new FollowListDetailItem(item.headPhotoUrl, item.cnUserName, item.cnFansNum, item.introduction, item.creatorId, "0", item.attentionUserId, item.cnUserType, item.cnUserId, item.cnMainControl, -1, item.authIcon))
})
let request = new CreatorDetailRequestItem()
... ... @@ -206,6 +225,7 @@ export struct FollowListDetailUI {
console.log(TAG, JSON.stringify(err))
this.isLoading = false
this.count = this.count === -1 ? 0 : this.count
this.isGetRequest = true
})
}
... ... @@ -225,7 +245,7 @@ export struct FollowListDetailUI {
})
result.forEach((item) => {
this.data.push(new FollowListDetailItem(item.headPhotoUrl, item.cnUserName, item.cnFansNum, item.introduction, item.creatorId, item.status, item.attentionUserId, item.cnUserType, item.cnUserId, item.mainControl, item.banControl,item.authIcon))
this.data.push(new FollowListDetailItem(item.headPhotoUrl, item.cnUserName, item.cnFansNum, item.introduction, item.creatorId, item.status, item.attentionUserId, item.cnUserType, item.cnUserId, item.mainControl, item.banControl, item.authIcon))
})
this.data.notifyDataReload()
... ... @@ -238,9 +258,11 @@ export struct FollowListDetailUI {
}
this.isLoading = false
this.isGetRequest = true
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isLoading = false
this.isGetRequest = true
})
}
}
\ No newline at end of file
... ...
... ... @@ -27,6 +27,7 @@ export struct HomePageBottomComponent{
@State userId:string = "";
@Link commentNum:number
preferences: dataPreferences.Preferences | null = null;
@State isGetRequest:boolean = false
aboutToAppear(){
this.getNewPageData()
... ... @@ -39,10 +40,11 @@ export struct HomePageBottomComponent{
if (key == UserDataLocal.USER_FOLLOW_OPERATION) {
let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION,"") as string
let arr = value.split(',')
if(arr!=null && arr.length === 2){
if(arr[1] == "0"){
this.data_follow.getDataArray().forEach((element,index) => {
if (element.creatorId === arr[1]) {
if (element.creatorId === arr[0]) {
this.data_follow.deleteItem(index)
this.count = this.data_follow.size()
}
});
}else{
... ... @@ -62,12 +64,14 @@ export struct HomePageBottomComponent{
build(){
Column(){
if(this.isGetRequest == true){
Divider().width('100%')
.height('2lpx')
.strokeWidth('1lpx')
.backgroundColor($r('app.color.color_EDEDED'))
}
if(this.count === 0){
if(this.count === 0 ){
if(this.style === 1){
Column(){
Row(){
... ... @@ -92,15 +96,19 @@ export struct HomePageBottomComponent{
let params = {'index': "1"} as Record<string, string>
WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params)
})
if(this.isGetRequest == true){
EmptyComponent({emptyType:14})
.layoutWeight(1)
.width('100%')
}
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
}else{
ListHasNoMoreDataUI({style:2})
if(this.isGetRequest == true){
EmptyComponent({emptyType:11})
.layoutWeight(1)
.width('100%')
}
}
}else{
if(this.style === 1){
... ... @@ -244,12 +252,15 @@ export struct HomePageBottomComponent{
}
}
this.isLoading = false
this.isGetRequest = true
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
this.isLoading = false
this.isGetRequest = true
})
}else{
this.isLoading = false
this.isGetRequest = true
}
}
... ... @@ -266,17 +277,18 @@ export struct HomePageBottomComponent{
MinePageDatasModel.getMineCommentListData(time,object,getContext(this)).then((value)=>{
if (!this.data_comment || value.list.length == 0){
this.hasMore = false
this.isLoading = false
}else{
this.getCommentListStatus(value)
}
this.isLoading = false
this.commentNum = value.totalCount
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
this.isLoading = false
this.isGetRequest = true
})
}else{
this.isLoading = false
this.isGetRequest = true
}
}
}
... ... @@ -329,9 +341,11 @@ export struct HomePageBottomComponent{
}
this.isLoading = false
this.isGetRequest = true
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
this.isLoading = false
this.isGetRequest = true
})
}
... ...
... ... @@ -6,50 +6,61 @@ import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem';
import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem';
import { ChildCommentComponent } from './ChildCommentComponent';
import { EmptyComponent } from '../../view/EmptyComponent';
const TAG = "HomePageBottomComponent"
@Component
export struct OtherHomePageBottomCommentComponent{
export struct OtherHomePageBottomCommentComponent {
@Prop curUserId: string
@State data_comment: LazyDataSource<CommentListItem> = new LazyDataSource();
@State isLoading:boolean = false
@State hasMore:boolean = true
curPageNum:number = 1;
@State count:number = 0;
@Prop levelHead:string
@Link commentNum:number
aboutToAppear(){
@State isLoading: boolean = false
@State hasMore: boolean = true
curPageNum: number = 1;
@State count: number = 0;
@Prop levelHead: string
@Link commentNum: number
@State isGetRequest: boolean = false
aboutToAppear() {
this.getNewPageData()
}
build(){
Column(){
build() {
Column() {
Divider().width('100%')
.height('2lpx')
.strokeWidth('1lpx')
.backgroundColor($r('app.color.color_EDEDED'))
if(this.count === 0){
ListHasNoMoreDataUI({style:2})
if (this.count === 0) {
if (this.isGetRequest == true) {
EmptyComponent({emptyType:11})
.height('100%')
}else{
.layoutWeight(1)
}
} else {
List({ space: 3 }) {
LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
ListItem() {
ChildCommentComponent({data: item,levelHead:this.levelHead,isLastItem:index===this.data_comment.totalCount()-1})
ChildCommentComponent({
data: item,
levelHead: this.levelHead,
isLastItem: index === this.data_comment.totalCount() - 1
})
}
.onClick(() => {
})
}, (item: CommentListItem, index: number) => index.toString())
//没有更多数据 显示提示
if(!this.hasMore){
ListItem(){
if (!this.hasMore) {
ListItem() {
ListHasNoMoreDataUI()
}
}
}.cachedCount(15)
}
.cachedCount(15)
.layoutWeight(1)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
... ... @@ -57,9 +68,9 @@ export struct OtherHomePageBottomCommentComponent{
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
.onReachEnd(()=>{
console.log(TAG,"触底了");
if(!this.isLoading){
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
... ... @@ -72,7 +83,6 @@ export struct OtherHomePageBottomCommentComponent{
.justifyContent(FlexAlign.Start)
}
@Styles
listStyle() {
.backgroundColor(Color.White)
... ... @@ -81,60 +91,64 @@ export struct OtherHomePageBottomCommentComponent{
.borderRadius(12)
}
getNewPageData(){
getNewPageData() {
this.isLoading = true
if(this.hasMore){
if (this.hasMore) {
let time = encodeURI(DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
let object = new OtherUserCommentListRequestItem("",20,this.curPageNum,time,"1",this.curUserId)
let object = new OtherUserCommentListRequestItem("", 20, this.curPageNum, time, "1", this.curUserId)
MinePageDatasModel.getOtherCommentListData(object,getContext(this)).then((value)=>{
if (!this.data_comment || value.list.length == 0){
MinePageDatasModel.getOtherCommentListData(object, getContext(this)).then((value) => {
if (!this.data_comment || value.list.length == 0) {
this.hasMore = false
this.isLoading = false
}else{
} else {
this.getCommentListStatus(value)
}
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isLoading = false
this.isGetRequest = true
})
} else {
this.isGetRequest = true
this.isLoading = false
}
}
getCommentListStatus(value:MineCommentListDetailItem){
getCommentListStatus(value: MineCommentListDetailItem) {
let status = new OtherUserCommentLikeStatusRequestItem()
let data : CommentListItem[] = []
value.list.forEach((item)=>{
if(item.checkStatus === 2){
let data: CommentListItem[] = []
value.list.forEach((item) => {
if (item.checkStatus === 2) {
status.commentIdList.push(item.id)
}
let commentContent = item.commentContent
if(item.sensitiveShow === 0 && item.sensitiveExist === 1){
if (item.sensitiveShow === 0 && item.sensitiveExist === 1) {
commentContent = item.commentContentSensitive
}
let parentCommentContent = ""
if(item.parentCommentVo!=null ){
if (item.parentCommentVo != null) {
parentCommentContent = item.parentCommentVo.commentContent
}
let parentCommentUserName = ""
if(item.parentCommentVo!=null ){
if (item.parentCommentVo != null) {
parentCommentUserName = item.parentCommentVo.fromUserName
}
data.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,commentContent,item.likeNum,0,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,parentCommentContent,parentCommentUserName))
data.push(new CommentListItem(item.fromUserHeader, item.fromUserName, item.targetTitle, item.createTime, commentContent, item.likeNum, 0, item.id, item.targetId, item.targetType, item.targetRelId, item.targetRelObjectId, item.targetRelType, item.targetStatus, item.checkStatus, parentCommentContent, parentCommentUserName))
})
MinePageDatasModel.getOtherUserCommentLikeStatusData(status,getContext(this)).then((newValue)=>{
newValue.forEach((item)=>{
data.forEach((list)=>{
MinePageDatasModel.getOtherUserCommentLikeStatusData(status, getContext(this)).then((newValue) => {
newValue.forEach((item) => {
data.forEach((list) => {
if (item.commentId == list.id) {
list.like_status = item.status
}
})
})
data.forEach((item)=>{
this.data_comment.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,item.commentContent,item.likeNum,item.like_status,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,item.parentCommentContent,item.parentCommentUserName))
data.forEach((item) => {
this.data_comment.push(new CommentListItem(item.fromUserHeader, item.fromUserName, item.targetTitle, item.createTime, item.commentContent, item.likeNum, item.like_status, item.id, item.targetId, item.targetType, item.targetRelId, item.targetRelObjectId, item.targetRelType, item.targetStatus, item.checkStatus, item.parentCommentContent, item.parentCommentUserName))
})
this.data_comment.notifyDataReload()
... ... @@ -143,14 +157,16 @@ export struct OtherHomePageBottomCommentComponent{
this.commentNum = value.totalCount
if (this.data_comment.totalCount() < value.totalCount) {
this.curPageNum++
}else {
} else {
this.hasMore = false
}
this.isLoading = false
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
this.isGetRequest = true
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isLoading = false
this.isGetRequest = true
})
}
}
\ No newline at end of file
... ...
... ... @@ -17,6 +17,7 @@ export struct OtherHomePageBottomFollowComponent{
curPageNum:number = 1;
@State count:number = 0;
@Prop curUserId: string
@State isGetRequest:boolean = false
aboutToAppear(){
... ... @@ -54,10 +55,11 @@ export struct OtherHomePageBottomFollowComponent{
let params = {'index': "1"} as Record<string, string>
WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params)
})
if(this.isGetRequest == true){
EmptyComponent({emptyType:14})
.layoutWeight(1)
.width('100%')
}
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
}else{
... ... @@ -155,10 +157,15 @@ export struct OtherHomePageBottomFollowComponent{
}
}
this.isLoading = false
this.isGetRequest = true
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
this.isLoading = false
this.isGetRequest = true
})
}else{
this.isGetRequest = true
this.isLoading = false
}
}
}
\ No newline at end of file
... ...
... ... @@ -63,8 +63,4 @@ export struct SearchRelatedComponent {
.padding({ left: '31lpx', right: '31lpx' })
}
test(){
let c = "12121212121"
}
}
\ No newline at end of file
... ...