wangliang_wd

feat:优化功能

@@ -37,9 +37,9 @@ struct EditUserIntroductionPage { @@ -37,9 +37,9 @@ struct EditUserIntroductionPage {
37 37
38 38
39 Divider() 39 Divider()
40 - .margin(12) 40 + .margin(20)
41 41
42 - Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、出于商业或作为素材恶搞目的,而将国旗、国徽以及国家领导人用于头像、昵称;\n3、最多60个字,只能输入中文、数字、英文字母。') 42 + Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多60个字,只能输入中文、数字、英文字母。')
43 .fontSize(13) 43 .fontSize(13)
44 .padding(12) 44 .padding(12)
45 .fontColor(Color.Gray) 45 .fontColor(Color.Gray)
@@ -39,9 +39,9 @@ struct EditUserNikeNamePage { @@ -39,9 +39,9 @@ struct EditUserNikeNamePage {
39 .alignItems(VerticalAlign.Center) 39 .alignItems(VerticalAlign.Center)
40 40
41 Divider() 41 Divider()
42 - .margin(12) 42 + .margin(20)
43 43
44 - Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、出于商业或作为素材恶搞目的,而将国旗、国徽以及国家领导人用于头像、昵称;\n3、最多16个字,只能输入中文、数字、英文字母。') 44 + Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多16个字,只能输入中文、数字、英文字母。')
45 .fontSize(13) 45 .fontSize(13)
46 .padding(12) 46 .padding(12)
47 .fontColor(Color.Gray) 47 .fontColor(Color.Gray)
  1 +
  2 +import MyCollectionViewModel from '../../viewmodel/MyCollectionViewModel';
  3 +import PageModel from '../../viewmodel/PageModel';
  4 +import { CommonConstants, ViewType } from 'wdConstant'
  5 +import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent'
  6 +import { ContentDTO } from 'wdBean'
  7 +import NoMoreLayout from './NoMoreLayout'
  8 +import CustomRefreshLoadLayout from './CustomRefreshLoadLayout';
  9 +import { CustomSelectUI } from '../view/CustomSelectUI';
  10 +import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI';
  11 +import { BigPicCardComponent } from '../view/BigPicCardComponent';
  12 +
  13 +import { CustomTitleUI } from '../reusable/CustomTitleUI';
  14 +import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
  15 +
  16 +@Entry
  17 +@Component
  18 +struct InteractMessagePage {
  19 + @State private browSingModel: PageModel = new PageModel()
  20 + isloading : boolean = false
  21 + @Provide isEditState:boolean = false
  22 + @State allDatas :ContentDTO[] = [];
  23 + private scroller: Scroller = new Scroller();
  24 + @State likeNum: number = 20
  25 +
  26 + aboutToAppear(){
  27 + this.getData()
  28 + }
  29 +
  30 + build() {
  31 + Column(){
  32 + CustomTitleUI({titleName:'互动消息'})
  33 +
  34 +
  35 +
  36 + if(this.browSingModel.viewType == ViewType.ERROR){
  37 + EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NetworkFailed})
  38 + }else if(this.browSingModel.viewType == ViewType.EMPTY){
  39 + EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoHistory})
  40 + }else {
  41 + CustomPullToRefresh({
  42 + alldata:this.allDatas,
  43 + scroller:this.scroller,
  44 + customList:()=>{
  45 + this.ListLayout()
  46 + },
  47 + onRefresh:(resolve)=>{
  48 + this.browSingModel.currentPage = 0
  49 + this.getData(resolve)
  50 + },
  51 + onLoadMore:(resolve)=> {
  52 + this.browSingModel.currentPage++
  53 + this.getData()
  54 + }
  55 + })
  56 + }
  57 +
  58 + }
  59 + .width(CommonConstants.FULL_WIDTH)
  60 + .height(CommonConstants.FULL_HEIGHT)
  61 + }
  62 +
  63 + @Builder ListLayout() {
  64 + List({scroller: this.scroller}) {
  65 + ListItem(){
  66 + this.likeUILayout()
  67 + }
  68 +
  69 + // 下拉刷新
  70 + ForEach(this.allDatas, (compDTO: ContentDTO, compIndex: number) => {
  71 + ListItem() {
  72 + this.newCompParser(compDTO,compIndex)
  73 + }
  74 + })
  75 + // 加载更多
  76 + ListItem() {
  77 + if (this.browSingModel.hasMore) {
  78 + } else {
  79 + NoMoreLayout()
  80 + }
  81 + }
  82 + }
  83 + .height(CommonConstants.FULL_PARENT)
  84 + .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果
  85 + }
  86 +
  87 + @Builder
  88 + likeUILayout(){
  89 + Column(){
  90 + Row(){
  91 + Text('共获')
  92 + .fontSize(18)
  93 + Text(this.likeNum.toString())
  94 + .fontSize(30)
  95 + .fontColor(Color.Red)
  96 + Text('赞')
  97 + .fontSize(18)
  98 +
  99 + }.height(75)
  100 +
  101 +
  102 + Divider()
  103 + .color('#f5f5f5')
  104 + .backgroundColor('#f5f5f5')
  105 + .width('100%')
  106 + .height(5)
  107 + }
  108 + .alignItems(HorizontalAlign.Start)
  109 + .padding({ left:16,right:16 })
  110 + .width('100%')
  111 + .height(80)
  112 +
  113 + }
  114 +
  115 + @Builder
  116 + newCompParser(compDTO: ContentDTO, compIndex: number){
  117 + Row(){
  118 + if (this.isEditState){
  119 + CustomSelectUI({
  120 + isOn:compDTO.isSelect,
  121 + selectCallback:(isOn)=>{
  122 +
  123 + }
  124 + })
  125 + .margin({left:16})
  126 + }
  127 + Column() {
  128 + BigPicCardComponent({contentDTO:compDTO})
  129 + }
  130 + }
  131 + }
  132 +
  133 +
  134 + async getData(resolve?: (value: string | PromiseLike<string>) => void){
  135 + MyCollectionViewModel.fetchMyCollectList(2,'1',this.browSingModel.currentPage,getContext(this)).then(collectionItem => {
  136 + if(resolve) resolve('刷新成功')
  137 + if (collectionItem && collectionItem.list && collectionItem.list.length > 0) {
  138 + this.browSingModel.viewType = ViewType.LOADED;
  139 + this.allDatas.push(...collectionItem.list)
  140 + if (collectionItem.list.length === this.browSingModel.pageSize) {
  141 + this.browSingModel.currentPage++;
  142 + this.browSingModel.hasMore = true;
  143 + } else {
  144 + this.browSingModel.hasMore = false;
  145 + }
  146 + } else {
  147 + this.browSingModel.viewType = ViewType.EMPTY;
  148 + }
  149 + })
  150 + }
  151 +
  152 +}
@@ -3,6 +3,7 @@ import { Params } from 'wdBean'; @@ -3,6 +3,7 @@ import { Params } from 'wdBean';
3 import { StringUtils } from 'wdKit'; 3 import { StringUtils } from 'wdKit';
4 import { WDRouterPage, WDRouterRule } from 'wdRouter'; 4 import { WDRouterPage, WDRouterRule } from 'wdRouter';
5 import { HomePageBottomComponent } from '../components/mine/home/HomePageBottomComponent'; 5 import { HomePageBottomComponent } from '../components/mine/home/HomePageBottomComponent';
  6 +import { editModelParams } from '../model/EditInfoModel';
6 import MinePageDatasModel from '../model/MinePageDatasModel'; 7 import MinePageDatasModel from '../model/MinePageDatasModel';
7 8
8 const TAG = "MineHomePage" 9 const TAG = "MineHomePage"
@@ -77,7 +78,12 @@ struct MineHomePage { @@ -77,7 +78,12 @@ struct MineHomePage {
77 .fontSize('38lpx') 78 .fontSize('38lpx')
78 .lineHeight('50lpx') 79 .lineHeight('50lpx')
79 .fontWeight('500lpx') 80 .fontWeight('500lpx')
80 - 81 + .onClick(()=>{
  82 + let params: editModelParams = {
  83 + editContent: this.userName
  84 + }
  85 + WDRouterRule.jumpWithPage(WDRouterPage.editUserNikeNamePage,params)
  86 + })
81 if(this.levelId>0){ 87 if(this.levelId>0){
82 Text(`等级${this.levelId}`) 88 Text(`等级${this.levelId}`)
83 .textAlign(TextAlign.Center) 89 .textAlign(TextAlign.Center)
@@ -148,7 +154,7 @@ struct MineHomePage { @@ -148,7 +154,7 @@ struct MineHomePage {
148 //用户简介区域 154 //用户简介区域
149 Column() { 155 Column() {
150 Row() { 156 Row() {
151 - Text(this.desc) 157 + Text(this.isHasIntroduction?'简介:'+this.desc:this.desc)
152 .fontSize('27lpx') 158 .fontSize('27lpx')
153 .maxLines(3) 159 .maxLines(3)
154 .textOverflow({ overflow: TextOverflow.Ellipsis }) 160 .textOverflow({ overflow: TextOverflow.Ellipsis })
@@ -156,7 +162,12 @@ struct MineHomePage { @@ -156,7 +162,12 @@ struct MineHomePage {
156 .fontWeight('400lpx') 162 .fontWeight('400lpx')
157 .fontColor(this.isHasIntroduction?$r('app.color.color_222222'):$r('app.color.color_999999')) 163 .fontColor(this.isHasIntroduction?$r('app.color.color_222222'):$r('app.color.color_999999'))
158 .textAlign(TextAlign.Start) 164 .textAlign(TextAlign.Start)
159 - 165 + .onClick(()=>{
  166 + let params: editModelParams = {
  167 + editContent: this.isHasIntroduction?this.desc:''
  168 + }
  169 + WDRouterRule.jumpWithPage(WDRouterPage.editUserIntroductionPage,params)
  170 + })
160 if(!this.isHasIntroduction){ 171 if(!this.isHasIntroduction){
161 Image($r('app.media.user_info_edit_icon')) 172 Image($r('app.media.user_info_edit_icon'))
162 .width('27lpx') 173 .width('27lpx')
@@ -164,6 +175,8 @@ struct MineHomePage { @@ -164,6 +175,8 @@ struct MineHomePage {
164 .objectFit(ImageFit.Auto) 175 .objectFit(ImageFit.Auto)
165 } 176 }
166 } 177 }
  178 +
  179 +
167 Text(`来到人民日报${this.registerTimeForDay}天`) 180 Text(`来到人民日报${this.registerTimeForDay}天`)
168 .fontSize('23lpx') 181 .fontSize('23lpx')
169 .lineHeight('25lpx') 182 .lineHeight('25lpx')