Showing
26 changed files
with
385 additions
and
109 deletions
| 1 | import router from '@ohos.router'; | 1 | import router from '@ohos.router'; |
| 2 | -import common from '@ohos.app.ability.common'; | ||
| 3 | -import MineFunctionModel from '../../viewmodel/MineFunctionModel'; | 2 | + |
| 3 | +import MinePagePersonalFunctionsItem from '../../viewmodel/MinePagePersonalFunctionsItem' | ||
| 4 | +import MinePageCreatorFunctionsItem from '../../viewmodel/MinePageCreatorFunctionsItem' | ||
| 5 | +import MinePageMoreFunctionModel from '../../viewmodel/MinePageMoreFunctionModel' | ||
| 6 | +import MinePageDatasModel from '../../model/MinePageDatasModel' | ||
| 7 | + | ||
| 4 | const TAG = 'PageComponent'; | 8 | const TAG = 'PageComponent'; |
| 5 | 9 | ||
| 10 | + | ||
| 11 | + | ||
| 6 | /** | 12 | /** |
| 7 | * 我的页面 | 13 | * 我的页面 |
| 8 | */ | 14 | */ |
| 9 | @Component | 15 | @Component |
| 10 | export struct MinePageComponent { | 16 | export struct MinePageComponent { |
| 11 | //是否是创作者 | 17 | //是否是创作者 |
| 12 | - @State isActive:boolean = false | 18 | + @State isCreator:boolean = false |
| 13 | @State isLogin:boolean = true | 19 | @State isLogin:boolean = true |
| 14 | - @State icons:MineFunctionModel[] = [] | 20 | + @State personalData:MinePagePersonalFunctionsItem[] = [] |
| 21 | + @State creatorData:MinePageCreatorFunctionsItem[] = [] | ||
| 22 | + @State moreData:MinePageMoreFunctionModel[] = [] | ||
| 15 | scroller: Scroller = new Scroller() | 23 | scroller: Scroller = new Scroller() |
| 16 | 24 | ||
| 17 | - private context = getContext(this) as common.UIAbilityContext | ||
| 18 | - | ||
| 19 | aboutToAppear(){ | 25 | aboutToAppear(){ |
| 20 | - // TODO 获取用户信息 | ||
| 21 | - //初始化 icon | ||
| 22 | - this.initIconDatas() | 26 | + this.getFunctionData() |
| 23 | } | 27 | } |
| 24 | 28 | ||
| 25 | - /** | ||
| 26 | - * 初始化 icon | ||
| 27 | - */ | ||
| 28 | - initIconDatas(){ | ||
| 29 | - this.icons.push(new MineFunctionModel("评论",$r('app.media.mine_comment_icon'))) | ||
| 30 | - this.icons.push(new MineFunctionModel("关注",$r('app.media.mine_order_icon'))) | ||
| 31 | - this.icons.push(new MineFunctionModel("收藏",$r('app.media.mine_collect_icon'))) | ||
| 32 | - this.icons.push(new MineFunctionModel("历史",$r('app.media.mine_history_icon'))) | ||
| 33 | - this.icons.push(new MineFunctionModel("消息",$r('app.media.mine_msg_icon'))) | ||
| 34 | - this.icons.push(new MineFunctionModel("留言板",$r('app.media.mine_msgboard_icon'))) | ||
| 35 | - this.icons.push(new MineFunctionModel("预约",$r('app.media.mine_order_icon'))) | 29 | + getFunctionData(){ |
| 30 | + //个人功能数据 | ||
| 31 | + this.personalData = MinePageDatasModel.getPersonalFunctionsData() | ||
| 32 | + //创作者功能数据 | ||
| 33 | + this.creatorData = MinePageDatasModel.getCreatorFunctionsData() | ||
| 34 | + //更多功能数据 | ||
| 35 | + this.moreData = MinePageDatasModel.getMoreFunctionsData() | ||
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | - | ||
| 39 | build() { | 38 | build() { |
| 40 | - Column(){ | 39 | + Scroll(this.scroller){ |
| 40 | + Flex({direction:FlexDirection.Column}){ | ||
| 41 | Stack({alignContent:Alignment.Top}){ | 41 | Stack({alignContent:Alignment.Top}){ |
| 42 | Image($r('app.media.mine_head_bg')) | 42 | Image($r('app.media.mine_head_bg')) |
| 43 | .setFullWidth() | 43 | .setFullWidth() |
| 44 | - .height('50%') | 44 | + .height('657lpx') |
| 45 | .objectFit(ImageFit.Auto) | 45 | .objectFit(ImageFit.Auto) |
| 46 | - this.TopUI() | ||
| 47 | - }.setFullWidthAndHeight() | ||
| 48 | - .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 49 | - }.setFullWidthAndHeight() | ||
| 50 | - | 46 | + this.MinePageUI() |
| 47 | + } | ||
| 48 | + }.width('100%') | ||
| 49 | + } | ||
| 50 | + .backgroundColor($r('app.color.color_F9F9F9')) | ||
| 51 | + .scrollable(ScrollDirection.Vertical) | ||
| 52 | + .scrollBar(BarState.Off) | ||
| 51 | } | 53 | } |
| 52 | 54 | ||
| 53 | 55 | ||
| 54 | - @Builder TopUI(){ | 56 | + @Builder MinePageUI(){ |
| 55 | Column(){ | 57 | Column(){ |
| 56 | //头像层 | 58 | //头像层 |
| 57 | this.HeaderUI() | 59 | this.HeaderUI() |
| @@ -59,11 +61,11 @@ export struct MinePageComponent { | @@ -59,11 +61,11 @@ export struct MinePageComponent { | ||
| 59 | this.GridUI() | 61 | this.GridUI() |
| 60 | //Card | 62 | //Card |
| 61 | this.CardUI() | 63 | this.CardUI() |
| 64 | + //创作者区域 | ||
| 65 | + this.ActiveUI() | ||
| 62 | //滑动区域 | 66 | //滑动区域 |
| 63 | - this.ScrollUI() | ||
| 64 | - } | ||
| 65 | - .padding({left:11,right:11}) | ||
| 66 | - .setFullWidthAndHeight() | 67 | + this.MoreFunctionUI() |
| 68 | + }.setFullWidth() | ||
| 67 | } | 69 | } |
| 68 | 70 | ||
| 69 | @Builder HeaderUI(){ | 71 | @Builder HeaderUI(){ |
| @@ -71,144 +73,288 @@ export struct MinePageComponent { | @@ -71,144 +73,288 @@ export struct MinePageComponent { | ||
| 71 | //头像 | 73 | //头像 |
| 72 | Stack(){ | 74 | Stack(){ |
| 73 | Button({type:ButtonType.Circle}) | 75 | Button({type:ButtonType.Circle}) |
| 74 | - .backgroundColor($r('app.color.white')) | ||
| 75 | - .width(74) | ||
| 76 | - .height(74) | ||
| 77 | - | 76 | + .backgroundColor($r('app.color.main_red')) |
| 77 | + .width('110lpx') | ||
| 78 | + .height('110lpx') | ||
| 78 | Image($r('app.media.mine_head_icon')) | 79 | Image($r('app.media.mine_head_icon')) |
| 79 | - .width(70) | ||
| 80 | - .height(70) | 80 | + .width('108lpx') |
| 81 | + .height('108lpx') | ||
| 81 | .objectFit(ImageFit.Cover) | 82 | .objectFit(ImageFit.Cover) |
| 82 | .borderRadius(50) | 83 | .borderRadius(50) |
| 83 | - }.width(74) | ||
| 84 | - .height(74) | 84 | + }.width('110lpx') |
| 85 | + .height('110lpx') | ||
| 86 | + .alignContent(Alignment.Center) | ||
| 85 | 87 | ||
| 86 | //昵称信息 | 88 | //昵称信息 |
| 87 | Column(){ | 89 | Column(){ |
| 88 | Row(){ | 90 | Row(){ |
| 89 | - Text("人民日报网友ABCDEF") | ||
| 90 | - .fontColor($r('app.color.white')) | ||
| 91 | - | 91 | + Text("人民日报网友6G5E3T") |
| 92 | + .fontColor($r('app.color.color_222222')) | ||
| 93 | + .maxLines(1) | ||
| 94 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 95 | + .fontSize('33lpx') | ||
| 96 | + .width('326lpx') | ||
| 92 | Image($r('app.media.mine_user_edit')) | 97 | Image($r('app.media.mine_user_edit')) |
| 93 | - .width(20) | ||
| 94 | - .height(20) | ||
| 95 | - } | 98 | + .width('11lpx') |
| 99 | + .height('20lpx') | ||
| 100 | + .margin({left:'15lpx'}) | ||
| 101 | + .objectFit(ImageFit.Cover) | ||
| 102 | + }.width('100%') | ||
| 103 | + | ||
| 104 | + Stack(){ | ||
| 105 | + Image($r('app.media.mine_grade_bg')) | ||
| 106 | + .width('84lpx') | ||
| 107 | + .height('29lpx') | ||
| 108 | + .objectFit(ImageFit.Auto) | ||
| 96 | Text("等级8") | 109 | Text("等级8") |
| 97 | .textAlign(TextAlign.Center) | 110 | .textAlign(TextAlign.Center) |
| 98 | - .backgroundImage($r('app.media.mine_grade_bg')) | ||
| 99 | - .backgroundImageSize({width:55}) | ||
| 100 | .fontColor($r('app.color.white')) | 111 | .fontColor($r('app.color.white')) |
| 101 | - .fontSize(12) | ||
| 102 | - .width(40) | ||
| 103 | - .margin({top:20}) | 112 | + .fontSize('19lpx') |
| 113 | + .width('50lpx') | ||
| 114 | + .height('29lpx') | ||
| 115 | + }.margin({top:'15lpx'}) | ||
| 104 | }.alignItems(HorizontalAlign.Start) | 116 | }.alignItems(HorizontalAlign.Start) |
| 105 | - .width(200) | ||
| 106 | - .margin({left:10}) | 117 | + .margin({top:'11lpx',left:'17lpx'}) |
| 118 | + .width('352lpx') | ||
| 107 | 119 | ||
| 108 | Blank() | 120 | Blank() |
| 109 | 121 | ||
| 110 | Stack({alignContent:Alignment.Start}){ | 122 | Stack({alignContent:Alignment.Start}){ |
| 111 | Text("签到") | 123 | Text("签到") |
| 112 | - .textAlign(TextAlign.Center) | ||
| 113 | - .borderRadius({ topLeft:10,bottomLeft:10}) | ||
| 114 | - .width(50) | ||
| 115 | - .fontColor($r('app.color.white')) | 124 | + .textAlign(TextAlign.Start) |
| 125 | + .width('108lpx') | ||
| 126 | + .height('46lpx') | ||
| 127 | + .fontColor($r('app.color.color_AD6000')) | ||
| 116 | .backgroundColor($r('app.color.color_FFC460')) | 128 | .backgroundColor($r('app.color.color_FFC460')) |
| 117 | - .margin({left:20}) | 129 | + .fontWeight(500) |
| 130 | + .position({x:'23lpx'}) | ||
| 131 | + .padding({left:'35lpx'}) | ||
| 118 | Image($r("app.media.mine_sign_icon")) | 132 | Image($r("app.media.mine_sign_icon")) |
| 119 | - .width(30) | ||
| 120 | - .height(30) | ||
| 121 | - }.width(60) | ||
| 122 | - | ||
| 123 | - } | 133 | + .width('50lpx') |
| 134 | + .height('50lpx') | ||
| 135 | + }.width('131lpx') | ||
| 136 | + }.setBackGroundWhite() | ||
| 124 | .setFullWidth() | 137 | .setFullWidth() |
| 125 | - .margin({top:30}) | 138 | + .padding({top:'31lpx',left:'46lpx'}) |
| 126 | } | 139 | } |
| 127 | 140 | ||
| 128 | @Builder GridUI(){ | 141 | @Builder GridUI(){ |
| 129 | - Column(){ | ||
| 130 | Grid(){ | 142 | Grid(){ |
| 131 | - ForEach(this.icons,(item:MineFunctionModel,index:number)=>{ | 143 | + ForEach(this.personalData,(item:MinePagePersonalFunctionsItem,index:number)=>{ |
| 132 | GridItem(){ | 144 | GridItem(){ |
| 133 | Row(){ | 145 | Row(){ |
| 134 | Column(){ | 146 | Column(){ |
| 135 | Image(item.imgSrc) | 147 | Image(item.imgSrc) |
| 136 | - .width(30) | ||
| 137 | - .height(30) | ||
| 138 | - | 148 | + .width('46lpx') |
| 149 | + .height('46lpx') | ||
| 139 | Text(`${item.msg}`) | 150 | Text(`${item.msg}`) |
| 140 | - .margin({top:2}) | ||
| 141 | - .fontColor($r('app.color.white')) | 151 | + .margin({top:'8lpx'}) |
| 152 | + .width('50lpx') | ||
| 153 | + .height('23lpx') | ||
| 154 | + .fontColor($r('app.color.color_222222')) | ||
| 155 | + .fontSize('23lpx') | ||
| 142 | } | 156 | } |
| 143 | .alignItems(HorizontalAlign.Center) | 157 | .alignItems(HorizontalAlign.Center) |
| 144 | .width('100%') | 158 | .width('100%') |
| 145 | Blank() | 159 | Blank() |
| 146 | .layoutWeight(1) | 160 | .layoutWeight(1) |
| 147 | - if(index % 4 < 3 && index != this.icons.length){ | ||
| 148 | - Text().backgroundColor($r('app.color.white')) | ||
| 149 | - .width(2) | ||
| 150 | - .height(15) | 161 | + if(index % 4 < 3 && index != this.personalData.length){ |
| 162 | + Text().backgroundColor($r('app.color.color_222222')) | ||
| 163 | + .opacity(0.1) | ||
| 164 | + .width('2lpx') | ||
| 165 | + .height('29lpx') | ||
| 151 | } | 166 | } |
| 152 | } | 167 | } |
| 153 | }.onClick(()=>{ | 168 | }.onClick(()=>{ |
| 154 | console.log(index+"") | 169 | console.log(index+"") |
| 155 | - }) | 170 | + }).width('169lpx') |
| 171 | + .height('117lpx') | ||
| 156 | }, item => item) | 172 | }, item => item) |
| 157 | } | 173 | } |
| 158 | .rowsTemplate('1fr 1fr') | 174 | .rowsTemplate('1fr 1fr') |
| 159 | .columnsTemplate('1fr 1fr 1fr 1fr') | 175 | .columnsTemplate('1fr 1fr 1fr 1fr') |
| 160 | - // .columnsGap(10) | ||
| 161 | - .height(140) | ||
| 162 | - .margin({top:15 }) | 176 | + .height('338lpx') |
| 177 | + .margin({top:'31lpx',left:'23lpx',right:'23lpx' }) | ||
| 163 | } | 178 | } |
| 179 | + | ||
| 180 | + @Builder ActiveUI(){ | ||
| 181 | + Column(){ | ||
| 182 | + Row(){ | ||
| 183 | + Text("创作者中心") | ||
| 184 | + .fontSize('29lpx') | ||
| 185 | + .width('148lpx') | ||
| 186 | + .height('46lpx') | ||
| 187 | + .fontColor($r('app.color.color_222222')) | ||
| 188 | + | ||
| 189 | + Blank() | ||
| 190 | + | ||
| 191 | + Row(){ | ||
| 192 | + Text("内容管理") | ||
| 193 | + .fontSize('27lpx') | ||
| 194 | + .width('113lpx') | ||
| 195 | + .height('35lpx') | ||
| 196 | + .fontColor($r('app.color.color_222222')) | ||
| 197 | + | ||
| 198 | + Image($r('app.media.mine_right_arrow')) | ||
| 199 | + .width('27lpx') | ||
| 200 | + .height('27lpx') | ||
| 201 | + .objectFit(ImageFit.Auto) | ||
| 164 | } | 202 | } |
| 165 | 203 | ||
| 166 | - @Builder CardUI(){ | 204 | + }.setFullWidth() |
| 205 | + .height('92lpx') | ||
| 206 | + .padding({left:'29lpx',top:'23lpx',right:'31lpx'}) | ||
| 207 | + | ||
| 167 | Row(){ | 208 | Row(){ |
| 209 | + Grid(){ | ||
| 210 | + ForEach(this.creatorData,(item:MinePageCreatorFunctionsItem,index:number)=>{ | ||
| 211 | + GridItem(){ | ||
| 212 | + Row(){ | ||
| 213 | + Column(){ | ||
| 214 | + Image(item.imgSrc) | ||
| 215 | + .width('50lpx') | ||
| 216 | + .height('50lpx') | ||
| 217 | + Text(`${item.msg}`) | ||
| 218 | + .margin({top:'15lpx'}) | ||
| 219 | + .width('96lpx') | ||
| 220 | + .height('23lpx') | ||
| 221 | + .fontColor($r('app.color.color_666666')) | ||
| 222 | + .fontSize('23lpx') | ||
| 223 | + } | ||
| 224 | + .alignItems(HorizontalAlign.Center) | ||
| 225 | + .width('100%') | ||
| 226 | + Blank() | ||
| 227 | + .layoutWeight(1) | ||
| 228 | + if(index % 4 < 3 && index != this.creatorData.length){ | ||
| 229 | + Text().backgroundColor($r('app.color.color_222222')) | ||
| 230 | + .opacity(0.1) | ||
| 231 | + .width('2lpx') | ||
| 232 | + .height('29lpx') | ||
| 233 | + } | ||
| 234 | + } | ||
| 235 | + }.onClick(()=>{ | ||
| 236 | + console.log(index+"") | ||
| 237 | + }).width('169lpx') | ||
| 238 | + .height('117lpx') | ||
| 239 | + }, item => item) | ||
| 240 | + } | ||
| 241 | + .rowsTemplate('1fr') | ||
| 242 | + .columnsTemplate('1fr 1fr 1fr 1fr') | ||
| 243 | + .height('88lpx') | ||
| 244 | + }.setFullWidth() | ||
| 245 | + .height('127lpx') | ||
| 246 | + } | ||
| 247 | + .height('219lpx') | ||
| 248 | + .borderRadius(8) | ||
| 249 | + .margin({top:'19lpx',left:'23lpx',right:'23lpx',bottom:'19lpx'}) | ||
| 250 | + .setBackGroundWhite() | ||
| 251 | + } | ||
| 252 | + | ||
| 253 | + @Builder CardUI(){ | ||
| 254 | + Flex(){ | ||
| 168 | Stack(){ | 255 | Stack(){ |
| 169 | Image($r('app.media.mine_card_01')) | 256 | Image($r('app.media.mine_card_01')) |
| 170 | - .width(170) | 257 | + .setFullWidthAndHeight() |
| 171 | .objectFit(ImageFit.Auto) | 258 | .objectFit(ImageFit.Auto) |
| 172 | Column(){ | 259 | Column(){ |
| 173 | Text("积分商城") | 260 | Text("积分商城") |
| 174 | - .fontColor($r('app.color.color_FF2E0C')) | ||
| 175 | - .width(120) | 261 | + .fontColor($r('app.color.color_994D00')) |
| 262 | + .width('119lpx') | ||
| 263 | + .height('35lpx') | ||
| 264 | + .textAlign(TextAlign.Start) | ||
| 265 | + .fontSize('29lpx') | ||
| 176 | Text("华为MATE40手机") | 266 | Text("华为MATE40手机") |
| 177 | - .width(120) | 267 | + .width('159lpx') |
| 268 | + .height('23lpx') | ||
| 178 | .fontColor($r('app.color.color_FF2E0C')) | 269 | .fontColor($r('app.color.color_FF2E0C')) |
| 179 | - .fontSize(14) | ||
| 180 | - .margin({top:3}) | ||
| 181 | - }.padding({left:20}) | 270 | + .fontSize('19lpx') |
| 271 | + .textAlign(TextAlign.Start) | ||
| 272 | + .margin({top:'10lpx'}) | ||
| 273 | + }.padding({left:'29lpx'}) | ||
| 274 | + .alignItems(HorizontalAlign.Start) | ||
| 182 | }.alignContent(Alignment.Start) | 275 | }.alignContent(Alignment.Start) |
| 276 | + .width('345lpx') | ||
| 277 | + .height('115lpx') | ||
| 278 | + | ||
| 183 | Stack(){ | 279 | Stack(){ |
| 184 | Image($r('app.media.mine_card_02')) | 280 | Image($r('app.media.mine_card_02')) |
| 185 | - .width(170) | 281 | + .setFullWidthAndHeight() |
| 186 | .objectFit(ImageFit.Auto) | 282 | .objectFit(ImageFit.Auto) |
| 187 | Column(){ | 283 | Column(){ |
| 188 | - Text("数字藏品").fontColor($r('app.color.color_AD6000')) | ||
| 189 | - .width(120) | ||
| 190 | - Text("黑胶唱片NFT").width(120) | ||
| 191 | - .fontColor($r('app.color.color_AD6000')) | ||
| 192 | - .fontSize(14) | ||
| 193 | - .margin({top:3}) | ||
| 194 | - }.padding({left:30}) | 284 | + Text("数字藏品") |
| 285 | + .fontColor($r('app.color.color_B15900')) | ||
| 286 | + .width('119lpx') | ||
| 287 | + .height('35lpx') | ||
| 288 | + .textAlign(TextAlign.Start) | ||
| 289 | + .fontSize('29lpx') | ||
| 290 | + Text("黑胶唱片NFT") | ||
| 291 | + .width('159lpx') | ||
| 292 | + .height('23lpx') | ||
| 293 | + .fontColor($r('app.color.color_B15900')) | ||
| 294 | + .fontSize('19lpx') | ||
| 295 | + .textAlign(TextAlign.Start) | ||
| 296 | + .margin({top:'10lpx'}) | ||
| 297 | + }.padding({left:'67lpx'}) | ||
| 298 | + .alignItems(HorizontalAlign.Start) | ||
| 195 | }.alignContent(Alignment.Start) | 299 | }.alignContent(Alignment.Start) |
| 196 | - }.width('100%') | ||
| 197 | - .height(70) | 300 | + .width('348lpx') |
| 301 | + .height('115lpx') | ||
| 302 | + }.setFullWidth() | ||
| 303 | + .height('115lpx') | ||
| 304 | + .setPadding() | ||
| 198 | } | 305 | } |
| 199 | 306 | ||
| 200 | - @Builder ScrollUI(){ | ||
| 201 | - Scroll(this.scroller){ | 307 | + @Builder MoreFunctionUI(){ |
| 308 | + Column(){ | ||
| 309 | + List(){ | ||
| 310 | + ForEach(this.moreData,(item:MinePageMoreFunctionModel,index:number)=>{ | ||
| 311 | + ListItem(){ | ||
| 202 | Column(){ | 312 | Column(){ |
| 313 | + Row(){ | ||
| 314 | + if(item.imgSrc){ | ||
| 315 | + Image(item.imgSrc) | ||
| 316 | + .width('38lpx') | ||
| 317 | + .height('38lpx') | ||
| 318 | + .margin({right:'15lpx'}) | ||
| 319 | + } | ||
| 320 | + Text(`${item.msg}`) | ||
| 321 | + .margin({top:'8lpx'}) | ||
| 322 | + .width('456lpx') | ||
| 323 | + .height('38lpx') | ||
| 324 | + .fontColor($r('app.color.color_666666')) | ||
| 325 | + .fontSize('29lpx') | ||
| 203 | 326 | ||
| 204 | - }.height(600) | ||
| 205 | - .setFullWidth() | 327 | + Blank() |
| 328 | + | ||
| 329 | + Image($r('app.media.mine_user_arrow')) | ||
| 330 | + .width('27lpx') | ||
| 331 | + .height('27lpx') | ||
| 332 | + .objectFit(ImageFit.Auto) | ||
| 333 | + .margin({left:'81lpx',right:'29lpx'}) | ||
| 334 | + }.alignItems(VerticalAlign.Center) | ||
| 335 | + .justifyContent(FlexAlign.Start) | ||
| 336 | + | ||
| 337 | + if(index != this.moreData.length -1 ){ | ||
| 338 | + Text().backgroundColor($r('app.color.color_F5F5F5')) | ||
| 339 | + .opacity(0.1) | ||
| 340 | + .width('612lpx') | ||
| 341 | + .height('2lpx') | ||
| 342 | + } | ||
| 343 | + }.height(index === 0 ? '92lpx':'108lpx') | ||
| 344 | + }.padding({left:'27lpx'}) | ||
| 345 | + .onClick(()=>{ | ||
| 346 | + console.log(index+"") | ||
| 347 | + }) | ||
| 348 | + .height('117lpx') | ||
| 349 | + }, item => item) | ||
| 350 | + }.onScrollFrameBegin((offset, state) => { | ||
| 351 | + return { offsetRemain: 0 } | ||
| 352 | + }) | ||
| 353 | + } | ||
| 354 | + .setBackGroundWhite() | ||
| 206 | .backgroundColor($r('app.color.white')) | 355 | .backgroundColor($r('app.color.white')) |
| 207 | - }.setFullWidth() | ||
| 208 | - .layoutWeight(1) | ||
| 209 | - .scrollable(ScrollDirection.Vertical) | ||
| 210 | - .scrollBar(BarState.Off) | ||
| 211 | - .edgeEffect(EdgeEffect.None) | 356 | + .setMargining() |
| 357 | + .borderRadius(8) | ||
| 212 | } | 358 | } |
| 213 | 359 | ||
| 214 | @Styles setFullWidthAndHeight(){ | 360 | @Styles setFullWidthAndHeight(){ |
| @@ -221,13 +367,25 @@ export struct MinePageComponent { | @@ -221,13 +367,25 @@ export struct MinePageComponent { | ||
| 221 | } | 367 | } |
| 222 | 368 | ||
| 223 | @Styles setFullHeight(){ | 369 | @Styles setFullHeight(){ |
| 224 | - .width('100%') | 370 | + .height('100%') |
| 371 | + } | ||
| 372 | + | ||
| 373 | + @Styles setPadding(){ | ||
| 374 | + .padding({left:'23lpx',right:'23lpx'}) | ||
| 375 | + } | ||
| 376 | + @Styles setMargining(){ | ||
| 377 | + .margin({left:'23lpx',right:'23lpx'}) | ||
| 378 | + } | ||
| 379 | + | ||
| 380 | + @Styles setBackGroundWhite(){ | ||
| 381 | + .backgroundColor($r('app.color.white')) | ||
| 225 | } | 382 | } |
| 226 | 383 | ||
| 227 | change(){ | 384 | change(){ |
| 228 | router.pushUrl({ | 385 | router.pushUrl({ |
| 229 | url: 'pages/IndexPage', | 386 | url: 'pages/IndexPage', |
| 230 | params: { | 387 | params: { |
| 388 | + | ||
| 231 | } | 389 | } |
| 232 | }).catch((error: Error) => { | 390 | }).catch((error: Error) => { |
| 233 | }); | 391 | }); |
| 1 | + | ||
| 2 | +import MinePagePersonalFunctionsItem from '../viewmodel/MinePagePersonalFunctionsItem' | ||
| 3 | +import MinePageCreatorFunctionsItem from '../viewmodel/MinePageCreatorFunctionsItem' | ||
| 4 | +import MinePageMoreFunctionModel from '../viewmodel/MinePageMoreFunctionModel'; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 我的页面 所有数据 获取封装类 | ||
| 8 | + */ | ||
| 9 | +class MinePageDatasModel{ | ||
| 10 | + private static instance: MinePageDatasModel; | ||
| 11 | + personalData:MinePagePersonalFunctionsItem[] = [] | ||
| 12 | + creatorData:MinePageCreatorFunctionsItem[] = [] | ||
| 13 | + moreData:MinePageMoreFunctionModel[] = [] | ||
| 14 | + | ||
| 15 | + | ||
| 16 | + private constructor() { } | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * 单例模式 | ||
| 20 | + * @returns | ||
| 21 | + */ | ||
| 22 | + public static getInstance(): MinePageDatasModel { | ||
| 23 | + if (!MinePageDatasModel.instance) { | ||
| 24 | + MinePageDatasModel.instance = new MinePageDatasModel(); | ||
| 25 | + } | ||
| 26 | + return MinePageDatasModel.instance; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + | ||
| 30 | + | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * 评论 关注 收藏 等7个数据 | ||
| 34 | + * 包含名字和图标 | ||
| 35 | + */ | ||
| 36 | + getPersonalFunctionsData():MinePagePersonalFunctionsItem[]{ | ||
| 37 | + if(this.personalData.length === 7){ | ||
| 38 | + return this.personalData | ||
| 39 | + } | ||
| 40 | + this.personalData.push(new MinePagePersonalFunctionsItem("评论",$r('app.media.mine_comment_icon'))) | ||
| 41 | + this.personalData.push(new MinePagePersonalFunctionsItem("关注",$r('app.media.mine_order_icon'))) | ||
| 42 | + this.personalData.push(new MinePagePersonalFunctionsItem("收藏",$r('app.media.mine_collect_icon'))) | ||
| 43 | + this.personalData.push(new MinePagePersonalFunctionsItem("历史",$r('app.media.mine_history_icon'))) | ||
| 44 | + this.personalData.push(new MinePagePersonalFunctionsItem("消息",$r('app.media.mine_msg_icon'))) | ||
| 45 | + this.personalData.push(new MinePagePersonalFunctionsItem("留言板",$r('app.media.mine_msgboard_icon'))) | ||
| 46 | + this.personalData.push(new MinePagePersonalFunctionsItem("预约",$r('app.media.mine_order_icon'))) | ||
| 47 | + return this.personalData | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * 发布文章 发布视频 等4个数据 | ||
| 53 | + * 包含名字和图标 | ||
| 54 | + */ | ||
| 55 | + getCreatorFunctionsData():MinePageCreatorFunctionsItem[]{ | ||
| 56 | + if(this.creatorData.length === 4){ | ||
| 57 | + return this.creatorData | ||
| 58 | + } | ||
| 59 | + this.creatorData.push(new MinePageCreatorFunctionsItem("发布文章",$r('app.media.mine_active_create_article'))) | ||
| 60 | + this.creatorData.push(new MinePageCreatorFunctionsItem("发布视频",$r('app.media.mine_active_create_video'))) | ||
| 61 | + this.creatorData.push(new MinePageCreatorFunctionsItem("发布动态",$r('app.media.mine_active_create_video'))) | ||
| 62 | + this.creatorData.push(new MinePageCreatorFunctionsItem("发布图集",$r('app.media.mine_active_create_pics'))) | ||
| 63 | + return this.creatorData | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + /** | ||
| 67 | + * 更多功能 扫一扫 我的奖品 等6个数据 | ||
| 68 | + * 包含名字和图标 | ||
| 69 | + */ | ||
| 70 | + getMoreFunctionsData():MinePageCreatorFunctionsItem[]{ | ||
| 71 | + if(this.moreData.length === 6){ | ||
| 72 | + return this.moreData | ||
| 73 | + } | ||
| 74 | + this.moreData.push(new MinePageMoreFunctionModel("更多功能",null)) | ||
| 75 | + this.moreData.push(new MinePageMoreFunctionModel("扫一扫",$r('app.media.mine_scan'))) | ||
| 76 | + this.moreData.push(new MinePageMoreFunctionModel("我的奖品",$r('app.media.mine_mygift'))) | ||
| 77 | + this.moreData.push(new MinePageMoreFunctionModel("意见反馈",$r('app.media.mine_suggest'))) | ||
| 78 | + this.moreData.push(new MinePageMoreFunctionModel("设置",$r('app.media.mine_setting'))) | ||
| 79 | + this.moreData.push(new MinePageMoreFunctionModel("关于",$r('app.media.mine_about'))) | ||
| 80 | + return this.moreData | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + | ||
| 84 | +} | ||
| 85 | + | ||
| 86 | +const minePageDatasModel = MinePageDatasModel.getInstance() | ||
| 87 | +export default minePageDatasModel as MinePageDatasModel |
| @@ -63,6 +63,22 @@ | @@ -63,6 +63,22 @@ | ||
| 63 | { | 63 | { |
| 64 | "name": "color_AD6000", | 64 | "name": "color_AD6000", |
| 65 | "value": "#AD6000" | 65 | "value": "#AD6000" |
| 66 | + }, | ||
| 67 | + { | ||
| 68 | + "name": "color_F9F9F9", | ||
| 69 | + "value": "#F9F9F9" | ||
| 70 | + }, | ||
| 71 | + { | ||
| 72 | + "name": "color_994D00", | ||
| 73 | + "value": "#994D00" | ||
| 74 | + }, | ||
| 75 | + { | ||
| 76 | + "name":"color_B15900", | ||
| 77 | + "value": "#B15900" | ||
| 78 | + }, | ||
| 79 | + { | ||
| 80 | + "name": "main_red", | ||
| 81 | + "value": "#E84026" | ||
| 66 | } | 82 | } |
| 67 | ] | 83 | ] |
| 68 | } | 84 | } |
810 Bytes
PeopleDaily_Harmony/wdComponent/src/main/resources/base/media/mine_active_create_article.png
0 → 100644
421 Bytes
PeopleDaily_Harmony/wdComponent/src/main/resources/base/media/mine_active_create_pics.png
0 → 100644
448 Bytes
PeopleDaily_Harmony/wdComponent/src/main/resources/base/media/mine_active_create_video.png
0 → 100644
334 Bytes
446 Bytes
200 Bytes
341 Bytes
829 Bytes
392 Bytes
202 Bytes
-
Please register or login to post a comment