王士厅
@@ -96,6 +96,14 @@ export class HttpUrlUtils { @@ -96,6 +96,14 @@ export class HttpUrlUtils {
96 */ 96 */
97 static readonly APPOINTMENT_QueryUserDetail_PATH: string = "/api/rmrb-user-center/user/zh/c/queryUserDetail"; 97 static readonly APPOINTMENT_QueryUserDetail_PATH: string = "/api/rmrb-user-center/user/zh/c/queryUserDetail";
98 /** 98 /**
  99 + * 资料编辑 更新普通用户信息
  100 + */
  101 + static readonly APPOINTMENT_editUserDetail_PATH: string = "/api/rmrb-user-center/user/zh/c/editUserDetail";
  102 + /**
  103 + * 资料编辑 更新普通用户名
  104 + */
  105 + static readonly APPOINTMENT_editUserDetail1_PATH: string = "/api/rmrb-user-center/user/zh/c/completeUserInfo";
  106 + /**
99 /** 107 /**
100 * 个人中心 关注列表详情 108 * 个人中心 关注列表详情
101 */ 109 */
1 import { TopNavDTO } from 'wdBean'; 1 import { TopNavDTO } from 'wdBean';
  2 +import curves from '@ohos.curves';
2 3
3 const INDEX_SETTING_TITLE: string = '首页设置' 4 const INDEX_SETTING_TITLE: string = '首页设置'
4 const INDEX_SETTING_SUBTITLE: string = '将指定频道设置为首页' 5 const INDEX_SETTING_SUBTITLE: string = '将指定频道设置为首页'
5 const MY_CHANNEL: string = '我的频道' 6 const MY_CHANNEL: string = '我的频道'
6 const EDIT_TEXT: string = '编辑' 7 const EDIT_TEXT: string = '编辑'
7 const EDIT_DOWN: string = '完成' 8 const EDIT_DOWN: string = '完成'
  9 +const MY_CHANNEL_TIP1: string = '点击进入频道'
  10 +const MY_CHANNEL_TIP2: string = '拖动调整频道顺序'
8 const MORE_CHANNEL: string = '更多频道' 11 const MORE_CHANNEL: string = '更多频道'
9 const LOCAL_CHANNEL: string = '地方频道' 12 const LOCAL_CHANNEL: string = '地方频道'
10 13
  14 +
11 @CustomDialog 15 @CustomDialog
12 struct ChannelDialog { 16 struct ChannelDialog {
  17 + @State dragItem: number = -1
  18 + @State item: number = -1
  19 + private dragRefOffsetX: number = 0
  20 + private dragRefOffsetY: number = 0
  21 + @State offsetX: number = 0
  22 + @State offsetY: number = 0
  23 + private FIX_VP_X: number = 80
  24 + private FIX_VP_Y: number = 48
13 @State indexSettingTabIndex: number = 0 25 @State indexSettingTabIndex: number = 0
14 @State isEditIng: boolean = false 26 @State isEditIng: boolean = false
  27 + @State currentTopNavSelectedItem: TopNavDTO = {} as TopNavDTO
15 @Link currentTopNavSelectedIndex: number 28 @Link currentTopNavSelectedIndex: number
16 @Link myChannelList: TopNavDTO[] 29 @Link myChannelList: TopNavDTO[]
17 @Link moreChannelList: TopNavDTO[] 30 @Link moreChannelList: TopNavDTO[]
@@ -20,48 +33,153 @@ struct ChannelDialog { @@ -20,48 +33,153 @@ struct ChannelDialog {
20 controller?: CustomDialogController 33 controller?: CustomDialogController
21 confirm: (index: number) => void = () => { 34 confirm: (index: number) => void = () => {
22 } 35 }
23 - changeChannelIndex : (index1:number, index2:number) => void = ()=>{}  
24 - myChannelItemEditHandle = (index: number): void => {  
25 - let item = this.myChannelList.splice(index, 1)[0]  
26 - if (item.moreChannel === '1') {  
27 - this.moreChannelList.unshift(item)  
28 - }  
29 - if (item.localChannel === '1') {  
30 - this.localChannelList.unshift(item) 36 + changeChannelIndex: (index1: number, index2: number) => void = () => {
  37 + }
  38 + delChannelItem: (index: number) => void = () => {
  39 + }
  40 + addChannelItem: (item: TopNavDTO) => void = () => {
  41 + }
  42 +
  43 + aboutToAppear() {
  44 + this.currentTopNavSelectedItem = this.myChannelList[this.currentTopNavSelectedIndex]
  45 + }
  46 +
  47 + itemMove(index: number, newIndex: number): void {
  48 + let targetItem = this.myChannelList[newIndex]
  49 + if (!(targetItem?.headlinesOn === 1 || targetItem?.movePermitted === 0 || targetItem?.homeChannel === '1')) {
  50 + this.changeChannelIndex(index, newIndex)
  51 + if (index <= this.currentTopNavSelectedIndex || newIndex <= this.currentTopNavSelectedIndex) {
  52 + // this.currentTopNavSelectedIndex = this.myChannelList.findIndex(ele => ele.channelId === currentTopNavSelectedItem.channelId)
  53 + }
31 } 54 }
32 } 55 }
33 56
34 - @Builder  
35 - pixelMapBuilder(item: TopNavDTO, index: number) { //拖拽过程样式  
36 - Row() {  
37 - Row() {  
38 - Text(item.name)  
39 - .fontSize(14)  
40 - .fontColor(this.currentTopNavSelectedIndex === index ? '#ED2800' : (item.homeChannel === '1' || item.movePermitted === 0 ? '#999999' : '#222222')) 57 + //向下滑
  58 + down(index: number): void {
  59 + console.info(`向下滑`)
  60 + this.offsetY -= this.FIX_VP_Y
  61 + this.dragRefOffsetY += this.FIX_VP_Y
  62 + this.itemMove(index, index + 4)
  63 + }
41 64
42 - if (this.isEditIng && item.myChannel !== '1') {  
43 - Image($r('app.media.icon_audio_close'))  
44 - .width(12)  
45 - .margin({ left: 1 })  
46 - } 65 + //向下滑(右下角为空)
  66 + down2(index: number): void {
  67 + this.offsetY -= this.FIX_VP_Y
  68 + this.dragRefOffsetY += this.FIX_VP_Y
  69 + this.itemMove(index, index + 4)
  70 + }
  71 +
  72 + //向上滑
  73 + up(index: number): void {
  74 + console.info(`向上滑`)
  75 + this.offsetY += this.FIX_VP_Y
  76 + this.dragRefOffsetY -= this.FIX_VP_Y
  77 + this.itemMove(index, index - 4)
  78 + }
  79 +
  80 + //向左滑
  81 + left(index: number): void {
  82 + console.info(`向左滑`)
  83 + this.offsetX += this.FIX_VP_X
  84 + this.dragRefOffsetX -= this.FIX_VP_X
  85 + this.itemMove(index, index - 1)
  86 + }
  87 +
  88 + //向右滑
  89 + right(index: number): void {
  90 + console.info(`向右滑`)
  91 + this.offsetX -= this.FIX_VP_X
  92 + this.dragRefOffsetX += this.FIX_VP_X
  93 + this.itemMove(index, index + 1)
  94 + }
  95 +
  96 + //向右下滑
  97 + lowerRight(index: number): void {
  98 + console.info(`向右下滑`)
  99 + this.offsetX -= this.FIX_VP_X
  100 + this.dragRefOffsetX += this.FIX_VP_X
  101 + this.offsetY -= this.FIX_VP_Y
  102 + this.dragRefOffsetY += this.FIX_VP_Y
  103 + this.itemMove(index, index + 5)
  104 + }
  105 +
  106 + //向右上滑
  107 + upperRight(index: number): void {
  108 + console.info(`向右上滑`)
  109 + this.offsetX -= this.FIX_VP_X
  110 + this.dragRefOffsetX += this.FIX_VP_X
  111 + this.offsetY += this.FIX_VP_Y
  112 + this.dragRefOffsetY -= this.FIX_VP_Y
  113 + this.itemMove(index, index - 3)
  114 + }
  115 +
  116 + //向左下滑
  117 + lowerLeft(index: number): void {
  118 + console.info(`向左下滑`)
  119 + this.offsetX += this.FIX_VP_X
  120 + this.dragRefOffsetX -= this.FIX_VP_X
  121 + this.offsetY -= this.FIX_VP_Y
  122 + this.dragRefOffsetY += this.FIX_VP_Y
  123 + this.itemMove(index, index + 3)
  124 + }
  125 +
  126 + //向左上滑
  127 + upperLeft(index: number): void {
  128 + console.info(`向左上滑`)
  129 + this.offsetX += this.FIX_VP_X
  130 + this.dragRefOffsetX -= this.FIX_VP_X
  131 + this.offsetY += this.FIX_VP_Y
  132 + this.dragRefOffsetY -= this.FIX_VP_Y
  133 + this.itemMove(index, index - 5)
  134 + }
  135 +
  136 + handleAnimationTo(item: TopNavDTO, event: GestureEvent) {
  137 + let index = this.myChannelList.findIndex(ele => ele.num === this.dragItem)
  138 + if (!(item.headlinesOn === 1 || item.movePermitted === 0 || item.homeChannel === '1') && this.isEditIng) {
  139 + this.offsetY = event.offsetY - this.dragRefOffsetY
  140 + this.offsetX = event.offsetX - this.dragRefOffsetX
  141 + if (this.offsetY >= this.FIX_VP_Y / 2 && (this.offsetX <= 44 && this.offsetX >= -44)
  142 + ) {
  143 + //向下滑
  144 + this.down(index)
  145 + } else if (this.offsetY <= -this.FIX_VP_Y / 2 && (this.offsetX <= 44 && this.offsetX >= -44)
  146 + ) {
  147 + //向上滑
  148 + this.up(index)
  149 + } else if (this.offsetX >= this.FIX_VP_X / 2 && (this.offsetY <= 20 && this.offsetY >= -20)
  150 + ) {
  151 + //向右滑
  152 + this.right(index)
  153 + } else if (this.offsetX <= -this.FIX_VP_X / 2 && (this.offsetY <= 20 && this.offsetY >= -20)
  154 + ) {
  155 + //向左滑
  156 + this.left(index)
  157 + } else if (this.offsetX >= this.FIX_VP_X / 2 && this.offsetY >= this.FIX_VP_Y / 2
  158 + ) {
  159 + //向右下滑
  160 + this.lowerRight(index)
  161 + } else if (this.offsetX >= this.FIX_VP_X / 2 && this.offsetY <= -this.FIX_VP_Y / 2
  162 + ) {
  163 + //向右上滑
  164 + this.upperRight(index)
  165 + } else if (this.offsetX <= -this.FIX_VP_X / 2 && this.offsetY >= this.FIX_VP_Y / 2
  166 + ) {
  167 + //向左下滑
  168 + this.lowerLeft(index)
  169 + } else if (this.offsetX <= -this.FIX_VP_X / 2 && this.offsetY <= -this.FIX_VP_Y / 2
  170 + ) {
  171 + //向左上滑
  172 + this.upperLeft(index)
  173 + } else if (this.offsetX >= this.FIX_VP_X / 2 && this.offsetY >= this.FIX_VP_Y / 2
  174 + ) {
  175 + //向右下滑(右下角为空)
  176 + this.down2(index)
47 } 177 }
48 - .width('100%')  
49 - .height('100%')  
50 - .justifyContent(FlexAlign.Center)  
51 - .backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff')  
52 } 178 }
53 - .width('23%')  
54 - .height(40)  
55 - .border({  
56 - width: item.homeChannel === '1' ? 0 : 1,  
57 - color: '#EDEDED',  
58 - radius: 3  
59 - })  
60 } 179 }
61 180
62 build() { 181 build() {
63 Column() { 182 Column() {
64 -  
65 Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { 183 Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
66 Image($r('app.media.icon_ren_min_ri_bao')) 184 Image($r('app.media.icon_ren_min_ri_bao'))
67 .width(72) 185 .width(72)
@@ -73,7 +191,7 @@ struct ChannelDialog { @@ -73,7 +191,7 @@ struct ChannelDialog {
73 }) 191 })
74 } 192 }
75 .width('100%') 193 .width('100%')
76 - .padding({ top: 30, bottom: 10 }) 194 + .padding({ bottom: 10 })
77 195
78 List() { 196 List() {
79 197
@@ -87,6 +205,7 @@ struct ChannelDialog { @@ -87,6 +205,7 @@ struct ChannelDialog {
87 Text(INDEX_SETTING_SUBTITLE) 205 Text(INDEX_SETTING_SUBTITLE)
88 .fontSize(12) 206 .fontSize(12)
89 .fontWeight(400) 207 .fontWeight(400)
  208 + .fontColor('#222222')
90 } 209 }
91 .width('100%') 210 .width('100%')
92 .margin({ top: 22, bottom: 16 }) 211 .margin({ top: 22, bottom: 16 })
@@ -128,9 +247,17 @@ struct ChannelDialog { @@ -128,9 +247,17 @@ struct ChannelDialog {
128 247
129 ListItem() { 248 ListItem() {
130 Row() { 249 Row() {
131 - Text(MY_CHANNEL)  
132 - .fontSize(16)  
133 - .fontWeight(600) 250 + Row() {
  251 + Text(MY_CHANNEL)
  252 + .fontSize(16)
  253 + .fontWeight(600)
  254 + .margin({ right: 4 })
  255 + Text(!this.isEditIng ? MY_CHANNEL_TIP1 : MY_CHANNEL_TIP2)
  256 + .fontSize(12)
  257 + .fontWeight(400)
  258 + .fontColor('#222222')
  259 + }
  260 +
134 Text(this.isEditIng ? EDIT_DOWN : EDIT_TEXT) 261 Text(this.isEditIng ? EDIT_DOWN : EDIT_TEXT)
135 .fontSize(14) 262 .fontSize(14)
136 .fontColor('#ED2800') 263 .fontColor('#ED2800')
@@ -151,7 +278,7 @@ struct ChannelDialog { @@ -151,7 +278,7 @@ struct ChannelDialog {
151 Row() { 278 Row() {
152 Text(item.name) 279 Text(item.name)
153 .fontSize(14) 280 .fontSize(14)
154 - .fontColor(this.currentTopNavSelectedIndex === index ? '#ED2800' : (item.homeChannel === '1' || item.movePermitted === 0 ? '#999999' : '#222222')) 281 + .fontColor(this.currentTopNavSelectedItem.channelId === item.channelId ? '#ED2800' : (item.homeChannel === '1' || item.movePermitted === 0 ? '#999999' : '#222222'))
155 282
156 if (this.isEditIng && item.myChannel !== '1') { 283 if (this.isEditIng && item.myChannel !== '1') {
157 Image($r('app.media.icon_audio_close')) 284 Image($r('app.media.icon_audio_close'))
@@ -162,15 +289,14 @@ struct ChannelDialog { @@ -162,15 +289,14 @@ struct ChannelDialog {
162 .width('100%') 289 .width('100%')
163 .height('100%') 290 .height('100%')
164 .justifyContent(FlexAlign.Center) 291 .justifyContent(FlexAlign.Center)
165 - .backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '') 292 + .backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff')
166 .onClick(() => { 293 .onClick(() => {
167 if (this.isEditIng) { 294 if (this.isEditIng) {
168 if (item.myChannel !== '1') { 295 if (item.myChannel !== '1') {
169 - this.myChannelItemEditHandle(index) 296 + this.delChannelItem(index)
170 } 297 }
171 } else { 298 } else {
172 this.confirm(index) 299 this.confirm(index)
173 - this.currentTopNavSelectedIndex = index  
174 this.controller?.close() 300 this.controller?.close()
175 } 301 }
176 }) 302 })
@@ -182,6 +308,33 @@ struct ChannelDialog { @@ -182,6 +308,33 @@ struct ChannelDialog {
182 color: '#EDEDED', 308 color: '#EDEDED',
183 radius: 3 309 radius: 3
184 }) 310 })
  311 + .zIndex(this.dragItem == item.num ? 1 : 0)
  312 + .translate(this.dragItem == item.num ? { x: this.offsetX, y: this.offsetY } : { x: 0, y: 0 })
  313 + .gesture(
  314 + GestureGroup(GestureMode.Sequence,
  315 + PanGesture({ fingers: 1, direction: null, distance: 0 })
  316 + .onActionStart((event: GestureEvent) => {
  317 + this.dragItem = item.num
  318 + this.dragRefOffsetX = 0
  319 + this.dragRefOffsetY = 0
  320 + })
  321 + .onActionUpdate((event: GestureEvent) => {
  322 + animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => {
  323 + this.handleAnimationTo(item, event)
  324 + })
  325 + })
  326 + .onActionEnd((event: GestureEvent) => {
  327 + animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => {
  328 + this.dragItem = -1
  329 + })
  330 + })
  331 + )
  332 + .onCancel(() => {
  333 + animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => {
  334 + this.dragItem = -1
  335 + })
  336 + }))
  337 +
185 }, (item: TopNavDTO) => JSON.stringify(item)) 338 }, (item: TopNavDTO) => JSON.stringify(item))
186 } 339 }
187 .width('100%') 340 .width('100%')
@@ -189,22 +342,7 @@ struct ChannelDialog { @@ -189,22 +342,7 @@ struct ChannelDialog {
189 .columnsTemplate('1fr 1fr 1fr 1fr') 342 .columnsTemplate('1fr 1fr 1fr 1fr')
190 .columnsGap(8) 343 .columnsGap(8)
191 .rowsGap(8) 344 .rowsGap(8)
192 - .height(Math.ceil(this.myChannelList.length / 4 ) * 48)  
193 - .editMode(this.isEditIng)  
194 - .supportAnimation(true) //设置Grid是否开启拖拽补位动画  
195 - .onItemDragStart((event: ItemDragInfo, itemIndex: number) => {  
196 - if(this.myChannelList[itemIndex].headlinesOn===1 || this.myChannelList[itemIndex].movePermitted===0){  
197 - return  
198 - }else{  
199 - return this.pixelMapBuilder(this.myChannelList[itemIndex], itemIndex) //设置拖拽过程中显示的元素。  
200 - }  
201 - })  
202 - .onItemDrop((event: ItemDragInfo, itemIndex: number, insertIndex: number, isSuccess: boolean) => { //绑定此事件的组件可作为拖拽释放目标,当在本组件范围内停止拖拽行为时,触发回调。  
203 - if (!isSuccess || insertIndex >= this.myChannelList.length || this.myChannelList[insertIndex].headlinesOn===1 || this.myChannelList[insertIndex].movePermitted===0) {  
204 - return  
205 - }  
206 - this.changeChannelIndex(itemIndex,insertIndex)  
207 - }) 345 + .height(Math.ceil(this.myChannelList.length / 4) * 48)
208 } 346 }
209 347
210 //更多频道列表 348 //更多频道列表
@@ -233,7 +371,7 @@ struct ChannelDialog { @@ -233,7 +371,7 @@ struct ChannelDialog {
233 .width('100%').height('100%') 371 .width('100%').height('100%')
234 .justifyContent(FlexAlign.Center) 372 .justifyContent(FlexAlign.Center)
235 .onClick(() => { 373 .onClick(() => {
236 - this.myChannelList.push(this.moreChannelList.splice(index, 1)[0]) 374 + this.addChannelItem(this.moreChannelList.splice(index, 1)[0])
237 }) 375 })
238 } 376 }
239 .width(80) 377 .width(80)
@@ -277,7 +415,7 @@ struct ChannelDialog { @@ -277,7 +415,7 @@ struct ChannelDialog {
277 .width('100%').height('100%') 415 .width('100%').height('100%')
278 .justifyContent(FlexAlign.Center) 416 .justifyContent(FlexAlign.Center)
279 .onClick(() => { 417 .onClick(() => {
280 - this.myChannelList.push(this.localChannelList.splice(index, 1)[0]) 418 + this.addChannelItem(this.localChannelList.splice(index, 1)[0])
281 }) 419 })
282 } 420 }
283 .width(80) 421 .width(80)
@@ -295,9 +433,8 @@ struct ChannelDialog { @@ -295,9 +433,8 @@ struct ChannelDialog {
295 } 433 }
296 434
297 }.width('100%').height('100%') 435 }.width('100%').height('100%')
298 -  
299 } 436 }
300 - .padding(15) 437 + .padding({ top: 40, right: 15, bottom: 20, left: 15 })
301 .backgroundColor('#ffffff') 438 .backgroundColor('#ffffff')
302 } 439 }
303 } 440 }
@@ -305,18 +442,42 @@ struct ChannelDialog { @@ -305,18 +442,42 @@ struct ChannelDialog {
305 // @Entry 442 // @Entry
306 @Component 443 @Component
307 struct ChannelSubscriptionLayout { 444 struct ChannelSubscriptionLayout {
308 - changeTab: (index: number) => void = () => {  
309 - }  
310 @State indexSettingArray: string [] = ['推荐', '热点'] 445 @State indexSettingArray: string [] = ['推荐', '热点']
311 //当前选中的频道 446 //当前选中的频道
312 @Link currentTopNavSelectedIndex: number; 447 @Link currentTopNavSelectedIndex: number;
313 @Link myChannelList: TopNavDTO [] 448 @Link myChannelList: TopNavDTO []
314 @Link moreChannelList: TopNavDTO [] 449 @Link moreChannelList: TopNavDTO []
315 @Link localChannelList: TopNavDTO [] 450 @Link localChannelList: TopNavDTO []
  451 + @Link @Watch('onChannelIdsUpdate') channelIds: number []
  452 + changeTab: (index: number) => void = () => {
  453 + }
  454 + //频道弹窗点击切换频道
316 onAccept = (index: number) => { 455 onAccept = (index: number) => {
317 - console.log(`onAccept${index}`)  
318 this.changeTab(index) 456 this.changeTab(index)
319 } 457 }
  458 + //交换我的频道数组中的位置
  459 + changeChannelIndex = (index1: number, index2: number) => {
  460 + let tmp = this.myChannelList.splice(index1, 1)
  461 + let channelIdTmp = this.channelIds.splice(index1, 1)
  462 + this.myChannelList.splice(index2, 0, tmp[0])
  463 + this.channelIds.splice(index2, 0, channelIdTmp[0])
  464 + }
  465 + //删除频道
  466 + delChannelItem = (index: number) => {
  467 + let item = this.myChannelList.splice(index, 1)[0]
  468 + this.channelIds.splice(index, 1)
  469 + if (item.moreChannel === '1') {
  470 + this.moreChannelList.unshift(item)
  471 + }
  472 + if (item.localChannel === '1') {
  473 + this.localChannelList.unshift(item)
  474 + }
  475 + }
  476 + // 添加频道
  477 + addChannelItem = (item: TopNavDTO) => {
  478 + this.channelIds.push(item.channelId)
  479 + this.myChannelList.push(item)
  480 + }
320 // @State currentTopNavSelectedIndex: number = 0 481 // @State currentTopNavSelectedIndex: number = 0
321 // @State topNavList: TopNavDTO [] = [ 482 // @State topNavList: TopNavDTO [] = [
322 // { 483 // {
@@ -1831,22 +1992,14 @@ struct ChannelSubscriptionLayout { @@ -1831,22 +1992,14 @@ struct ChannelSubscriptionLayout {
1831 moreChannelList: $moreChannelList, 1992 moreChannelList: $moreChannelList,
1832 localChannelList: $localChannelList, 1993 localChannelList: $localChannelList,
1833 confirm: this.onAccept, 1994 confirm: this.onAccept,
1834 - changeChannelIndex: this.changeChannelIndex 1995 + changeChannelIndex: this.changeChannelIndex,
  1996 + delChannelItem: this.delChannelItem,
  1997 + addChannelItem: this.addChannelItem
1835 }), 1998 }),
1836 alignment: DialogAlignment.TopEnd, 1999 alignment: DialogAlignment.TopEnd,
1837 customStyle: true, 2000 customStyle: true,
1838 }) 2001 })
1839 2002
1840 - changeChannelIndex(index1:number, index2:number) { //交换数组中的位置  
1841 - const temp = this.myChannelList[index1];  
1842 - if (index1 > index2) {  
1843 - this.myChannelList.splice(index2, 0, temp);  
1844 - this.myChannelList.splice(index1 + 1, 1);  
1845 - } else {  
1846 - this.myChannelList.splice(index2 + 1, 0, temp);  
1847 - this.myChannelList.splice(index1, 1);  
1848 - }  
1849 - }  
1850 // topNavListHandle() { 2003 // topNavListHandle() {
1851 // let defaultMyChannelList: TopNavDTO[] = [] 2004 // let defaultMyChannelList: TopNavDTO[] = []
1852 // let handledTopNavList = [...this.topNavList] 2005 // let handledTopNavList = [...this.topNavList]
@@ -1896,8 +2049,13 @@ struct ChannelSubscriptionLayout { @@ -1896,8 +2049,13 @@ struct ChannelSubscriptionLayout {
1896 // }) 2049 // })
1897 // } 2050 // }
1898 2051
  2052 + onChannelIdsUpdate(){
  2053 + AppStorage.SetOrCreate('channelIds', this.channelIds.join(','));
  2054 + console.log(`AppStorage.get('channelIds')${AppStorage.get('channelIds')}`)
  2055 + }
1899 2056
1900 aboutToAppear() { 2057 aboutToAppear() {
  2058 + console.log(`myChannelListzz${this.channelIds}}`)
1901 // this.topNavListHandle() 2059 // this.topNavListHandle()
1902 } 2060 }
1903 2061
1 1
2 import { CustomTitleUI } from '../reusable/CustomTitleUI'; 2 import { CustomTitleUI } from '../reusable/CustomTitleUI';
3 -import { EditListInfo, editModel } from '../../model/EditInfoModel'; 3 +import { EditListInfo, editModel, editModelParams, WDEditDataModelType } from '../../model/EditInfoModel';
4 import EditInfoViewModel from '../../viewmodel/EditInfoViewModel'; 4 import EditInfoViewModel from '../../viewmodel/EditInfoViewModel';
5 import { WDRouterPage, WDRouterRule } from 'wdRouter'; 5 import { WDRouterPage, WDRouterRule } from 'wdRouter';
6 import {AreaPickerDialog} from '../view/areaPickerDialog/AreaPickerDialog' 6 import {AreaPickerDialog} from '../view/areaPickerDialog/AreaPickerDialog'
7 import { AreaListModel } from '../../model/AreaListModel'; 7 import { AreaListModel } from '../../model/AreaListModel';
  8 +import router from '@ohos.router';
8 9
9 @Entry 10 @Entry
10 @Component 11 @Component
@@ -18,6 +19,7 @@ struct EditUserInfoPage { @@ -18,6 +19,7 @@ struct EditUserInfoPage {
18 builder: AreaPickerDialog({dataSource:this.dataSource, 19 builder: AreaPickerDialog({dataSource:this.dataSource,
19 confirmCallback:(area:string)=>{ 20 confirmCallback:(area:string)=>{
20 this.currentUserInfo.userExtend.city = area; 21 this.currentUserInfo.userExtend.city = area;
  22 + this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_region
21 this.updateEditModel() 23 this.updateEditModel()
22 } 24 }
23 }), 25 }),
@@ -31,7 +33,7 @@ struct EditUserInfoPage { @@ -31,7 +33,7 @@ struct EditUserInfoPage {
31 } 33 }
32 34
33 onPageShow(){ 35 onPageShow(){
34 - 36 + this.updateUserNameAndIntroduction()
35 } 37 }
36 38
37 build() { 39 build() {
@@ -98,13 +100,15 @@ struct EditUserInfoPage { @@ -98,13 +100,15 @@ struct EditUserInfoPage {
98 .width('100%') 100 .width('100%')
99 .onClick(()=>{ 101 .onClick(()=>{
100 if (i === 1){ 102 if (i === 1){
101 - WDRouterRule.jumpWithPage(WDRouterPage.editUserNikeNamePage) 103 + let params: editModelParams = {
  104 + editContent: this.currentUserInfo.userName
  105 + }
  106 + WDRouterRule.jumpWithPage(WDRouterPage.editUserNikeNamePage,params)
102 }else if (i === 2){ 107 }else if (i === 2){
103 - WDRouterRule.jumpWithPage(WDRouterPage.editUserIntroductionPage)  
104 - // router.pushUrl({  
105 - // url:'pages/EditUserInstoductionPage',  
106 - // params:{pageNum:i}  
107 - // }) 108 + let params: editModelParams = {
  109 + editContent: this.currentUserInfo.userExtend.introduction
  110 + }
  111 + WDRouterRule.jumpWithPage(WDRouterPage.editUserIntroductionPage,params)
108 }else if (i === 3){ 112 }else if (i === 3){
109 this.dialogController.open() 113 this.dialogController.open()
110 } else if (i === 4) { 114 } else if (i === 4) {
@@ -116,6 +120,7 @@ struct EditUserInfoPage { @@ -116,6 +120,7 @@ struct EditUserInfoPage {
116 onAccept:(value:DatePickerResult) => { 120 onAccept:(value:DatePickerResult) => {
117 let mon = value.month as number + 1 121 let mon = value.month as number + 1
118 this.currentUserInfo.userExtend.birthday = value.year+'-'+mon.toString()+'-'+value.day; 122 this.currentUserInfo.userExtend.birthday = value.year+'-'+mon.toString()+'-'+value.day;
  123 + this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_birthday
119 this.updateEditModel() 124 this.updateEditModel()
120 } 125 }
121 }) 126 })
@@ -125,6 +130,7 @@ struct EditUserInfoPage { @@ -125,6 +130,7 @@ struct EditUserInfoPage {
125 selected:0, 130 selected:0,
126 onAccept:(value:TextPickerResult) => { 131 onAccept:(value:TextPickerResult) => {
127 this.currentUserInfo.userExtend.sex = value.index.toString(); 132 this.currentUserInfo.userExtend.sex = value.index.toString();
  133 + this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_sex
128 this.updateEditModel() 134 this.updateEditModel()
129 } 135 }
130 }) 136 })
@@ -132,6 +138,28 @@ struct EditUserInfoPage { @@ -132,6 +138,28 @@ struct EditUserInfoPage {
132 }) 138 })
133 } 139 }
134 140
  141 + updateUserNameAndIntroduction(){
  142 + let backParams:editModelParams = router.getParams() as editModelParams;
  143 + if (backParams) {
  144 + let userName = backParams.userName as string ///昵称
  145 + let introduction = backParams.introduction as string ///简介
  146 +
  147 + if (userName) {
  148 + if (userName != this.currentUserInfo.userName) {
  149 + this.currentUserInfo.userName = userName;
  150 + this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_nickname
  151 + this.updateEditModel()
  152 + }
  153 + } else if (introduction){
  154 + if (introduction != this.currentUserInfo.userExtend.introduction ) {
  155 + this.currentUserInfo.userExtend.introduction = introduction;
  156 + this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_intro
  157 + this.updateEditModel()
  158 + }
  159 + }
  160 + }
  161 + }
  162 +
135 updateEditModel(){ 163 updateEditModel(){
136 this.listData = [] 164 this.listData = []
137 this.listData.push(...EditInfoViewModel.getEditListInfo(this.currentUserInfo)) 165 this.listData.push(...EditInfoViewModel.getEditListInfo(this.currentUserInfo))
1 import { CustomTitleUI } from '../reusable/CustomTitleUI' 1 import { CustomTitleUI } from '../reusable/CustomTitleUI'
2 import router from '@ohos.router' 2 import router from '@ohos.router'
  3 +import { editModelParams } from '../../model/EditInfoModel'
3 4
4 @Entry 5 @Entry
5 @Component 6 @Component
@@ -7,13 +8,13 @@ struct EditUserIntroductionPage { @@ -7,13 +8,13 @@ struct EditUserIntroductionPage {
7 @State numCount: number = 0 8 @State numCount: number = 0
8 @State textColor : string = '#222222' 9 @State textColor : string = '#222222'
9 @State introduction: string = '' 10 @State introduction: string = ''
10 - 11 + @State params:editModelParams = router.getParams() as editModelParams;
11 build() { 12 build() {
12 Column(){ 13 Column(){
13 CustomTitleUI({titleName:'修改简介'}) 14 CustomTitleUI({titleName:'修改简介'})
14 15
15 Row(){ 16 Row(){
16 - TextInput({placeholder:'请输入简介'}) 17 + TextInput({placeholder:'请输入简介',text:this.params.editContent})
17 .maxLength(60) 18 .maxLength(60)
18 .width('100%') 19 .width('100%')
19 .height(80) 20 .height(80)
@@ -50,9 +51,12 @@ struct EditUserIntroductionPage { @@ -50,9 +51,12 @@ struct EditUserIntroductionPage {
50 .borderRadius(5) 51 .borderRadius(5)
51 .margin(30) 52 .margin(30)
52 .onClick(()=>{ 53 .onClick(()=>{
  54 + let params: editModelParams = {
  55 + introduction: this.introduction
  56 + }
53 router.back({ 57 router.back({
54 url:'', 58 url:'',
55 - params:{nikeName:this.introduction} 59 + params:params
56 }) 60 })
57 }) 61 })
58 } 62 }
1 import { CustomTitleUI } from '../reusable/CustomTitleUI' 1 import { CustomTitleUI } from '../reusable/CustomTitleUI'
2 import router from '@ohos.router' 2 import router from '@ohos.router'
  3 +import { editModelParams } from '../../model/EditInfoModel'
3 4
4 @Entry 5 @Entry
5 @Component 6 @Component
@@ -8,13 +9,13 @@ struct EditUserNikeNamePage { @@ -8,13 +9,13 @@ struct EditUserNikeNamePage {
8 @State numCount: number = 0 9 @State numCount: number = 0
9 @State textColor : string = '#222222' 10 @State textColor : string = '#222222'
10 @State nikeName: string = '' 11 @State nikeName: string = ''
11 - 12 + @State params:editModelParams = router.getParams() as editModelParams;
12 build() { 13 build() {
13 Column(){ 14 Column(){
14 CustomTitleUI({titleName:'修改昵称'}) 15 CustomTitleUI({titleName:'修改昵称'})
15 16
16 Row(){ 17 Row(){
17 - TextInput({placeholder:'请输入昵称'}) 18 + TextInput({placeholder:'请输入昵称',text:this.params.editContent})
18 .width('100%') 19 .width('100%')
19 .maxLength(16) 20 .maxLength(16)
20 .height(50) 21 .height(50)
@@ -50,9 +51,12 @@ struct EditUserNikeNamePage { @@ -50,9 +51,12 @@ struct EditUserNikeNamePage {
50 .borderRadius(5) 51 .borderRadius(5)
51 .margin(30) 52 .margin(30)
52 .onClick(()=>{ 53 .onClick(()=>{
  54 + let params: editModelParams = {
  55 + userName: this.nikeName
  56 + }
53 router.back({ 57 router.back({
54 url:'', 58 url:'',
55 - params:{nikeName:this.nikeName} 59 + params:params
56 }) 60 })
57 }) 61 })
58 } 62 }
@@ -68,6 +68,7 @@ export struct TopNavigationComponent { @@ -68,6 +68,7 @@ export struct TopNavigationComponent {
68 68
69 if (item.myChannel === '1') { 69 if (item.myChannel === '1') {
70 this.myChannelList.push(item) 70 this.myChannelList.push(item)
  71 + this.channelIds.push(item.channelId)
71 } 72 }
72 if (item.moreChannel === '1') { 73 if (item.moreChannel === '1') {
73 this.moreChannelList.push(item) 74 this.moreChannelList.push(item)
@@ -81,6 +82,7 @@ export struct TopNavigationComponent { @@ -81,6 +82,7 @@ export struct TopNavigationComponent {
81 isBroadcast (item: TopNavDTO) { 82 isBroadcast (item: TopNavDTO) {
82 return item.name === '播报' 83 return item.name === '播报'
83 } 84 }
  85 +
84 build() { 86 build() {
85 Column() { 87 Column() {
86 // 顶部搜索、日报logo、早晚报 88 // 顶部搜索、日报logo、早晚报
@@ -208,15 +210,15 @@ export struct TopNavigationComponent { @@ -208,15 +210,15 @@ export struct TopNavigationComponent {
208 }) 210 })
209 // 分类列表最右侧频道设置 211 // 分类列表最右侧频道设置
210 ChannelSubscriptionLayout({ 212 ChannelSubscriptionLayout({
211 - changeTab: (index) => {  
212 - this.tabsController.changeIndex(index)  
213 - }, 213 + currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
214 myChannelList: $myChannelList, 214 myChannelList: $myChannelList,
215 moreChannelList: $moreChannelList, 215 moreChannelList: $moreChannelList,
216 localChannelList: $localChannelList, 216 localChannelList: $localChannelList,
217 - currentTopNavSelectedIndex: $currentTopNavSelectedIndex 217 + channelIds: $channelIds,
  218 + changeTab: (index) => {
  219 + this.tabsController.changeIndex(index)
  220 + }
218 }) 221 })
219 - // ChannelSubscriptionLayout()  
220 } 222 }
221 223
222 } 224 }
1 1
  2 +/**
  3 + * WDEditDataModelType 更新资料类型
  4 + */
  5 +export const enum WDEditDataModelType {
  6 + WDEditDataModelType_default, //默认不修改
  7 + WDEditDataModelType_head, //头像
  8 + WDEditDataModelType_nickname, //昵称
  9 + WDEditDataModelType_intro, //简介
  10 + WDEditDataModelType_sex, //性别
  11 + WDEditDataModelType_birthday, //生日
  12 + WDEditDataModelType_region, //地址
  13 +}
  14 +
2 export class EditListInfo{ 15 export class EditListInfo{
3 //标题 16 //标题
4 title:string 17 title:string
@@ -42,6 +55,26 @@ export class editModel{ @@ -42,6 +55,26 @@ export class editModel{
42 55
43 userExtend:EditInfoModel = new EditInfoModel() 56 userExtend:EditInfoModel = new EditInfoModel()
44 57
45 - constructor(userName?:string , userNameStatus?:string,phone?:string , headPhotoStatus?:string,userExtend?:EditInfoModel) { 58 + editDataType:WDEditDataModelType = 0
  59 +
  60 + constructor(userName?:string , userNameStatus?:string,phone?:string , headPhotoStatus?:string,userExtend?:EditInfoModel,editDataType?:WDEditDataModelType) {
46 } 61 }
  62 +}
  63 +
  64 +export interface editModelParams {
  65 + editContent?: string;
  66 +
  67 + userName?: string;
  68 +
  69 + introduction?: string;
  70 +
  71 + //地区
  72 + city?:string;
  73 + county?:string;
  74 + province?:string;
  75 +
  76 + //生日
  77 + birthday?:string;
  78 + //性别
  79 + sex?:string;
47 } 80 }
@@ -105,10 +105,9 @@ export class PageRepository { @@ -105,10 +105,9 @@ export class PageRepository {
105 } 105 }
106 106
107 /** 107 /**
108 - * 早晚报pageInfo请求 TODO 现网无数据写死测试环境 108 + * 早晚报pageInfo请求
109 * */ 109 * */
110 static getMorningEveningPageInfoUrl(pageId: string) { 110 static getMorningEveningPageInfoUrl(pageId: string) {
111 - HttpUrlUtils.hostUrl = HttpUrlUtils.HOST_DEV  
112 let url = HttpUrlUtils.getHost() + HttpUrlUtils.MORNING_EVENING_PAGE_INFO_PATH; 111 let url = HttpUrlUtils.getHost() + HttpUrlUtils.MORNING_EVENING_PAGE_INFO_PATH;
113 url = url + "?pageId=" + pageId; 112 url = url + "?pageId=" + pageId;
114 Logger.info(TAG, "getMorningEveningPageInfoUrl url = " + url) 113 Logger.info(TAG, "getMorningEveningPageInfoUrl url = " + url)
@@ -125,11 +124,10 @@ export class PageRepository { @@ -125,11 +124,10 @@ export class PageRepository {
125 * 124 *
126 * 可选 125 * 可选
127 * channelId:频道id 126 * channelId:频道id
128 - * channelStrategy:频道策略 TODO 现网无数据写死测试环境 127 + * channelStrategy:频道策略
129 * topicId:专题id 128 * topicId:专题id
130 * */ 129 * */
131 static getMorningEveningCompInfoUrl(pageId: number, groupId: number, refreshTime: string, topicId: string, pageNum: number, pageSize: number) { 130 static getMorningEveningCompInfoUrl(pageId: number, groupId: number, refreshTime: string, topicId: string, pageNum: number, pageSize: number) {
132 - HttpUrlUtils.hostUrl = HttpUrlUtils.HOST_DEV  
133 let url = HttpUrlUtils.getHost() + HttpUrlUtils.MORNING_EVENING_COMP_INFO_PATH; 131 let url = HttpUrlUtils.getHost() + HttpUrlUtils.MORNING_EVENING_COMP_INFO_PATH;
134 url = url + "?loadStrategy=first_load&pageNum=" + pageNum + "&refreshTime=" + refreshTime + "&pageId=" 132 url = url + "?loadStrategy=first_load&pageNum=" + pageNum + "&refreshTime=" + refreshTime + "&pageId="
135 + pageId + "&channelStrategy=2&groupId=" + groupId + "&topicId=" + topicId + "&pageSize=" + pageSize; 133 + pageId + "&channelStrategy=2&groupId=" + groupId + "&topicId=" + topicId + "&pageSize=" + pageSize;
@@ -288,7 +286,6 @@ export class PageRepository { @@ -288,7 +286,6 @@ export class PageRepository {
288 * */ 286 * */
289 static fetchBroadcastCompInfo(pageId: number, groupId: number, refreshTime: string, topicId: 287 static fetchBroadcastCompInfo(pageId: number, groupId: number, refreshTime: string, topicId:
290 string, channelId: string) { 288 string, channelId: string) {
291 - HttpUrlUtils.hostUrl = HttpUrlUtils.HOST_DEV  
292 let url = HttpUrlUtils.getHost() + HttpUrlUtils.MORNING_EVENING_COMP_INFO_PATH; 289 let url = HttpUrlUtils.getHost() + HttpUrlUtils.MORNING_EVENING_COMP_INFO_PATH;
293 url = `${url}?topicId=${topicId}&channelStrategy=2&groupId=${groupId}&refreshTime=${refreshTime}&pageSize=50&recommend=0&pageId=${pageId}&loadStrategy=first_load&pageNum=1&channelId=${channelId}` 290 url = `${url}?topicId=${topicId}&channelStrategy=2&groupId=${groupId}&refreshTime=${refreshTime}&pageSize=50&recommend=0&pageId=${pageId}&loadStrategy=first_load&pageNum=1&channelId=${channelId}`
294 Logger.info(TAG, "getMorningEveningCompInfoUrl url = " + url) 291 Logger.info(TAG, "getMorningEveningCompInfoUrl url = " + url)
1 1
2 -import { EditInfoModel, EditListInfo, editModel } from '../model/EditInfoModel'; 2 +import { EditInfoModel, EditListInfo, editModel, editModelParams, WDEditDataModelType } from '../model/EditInfoModel';
3 import HashMap from '@ohos.util.HashMap'; 3 import HashMap from '@ohos.util.HashMap';
4 import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; 4 import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
5 import { Logger, ResourcesUtils } from 'wdKit'; 5 import { Logger, ResourcesUtils } from 'wdKit';
@@ -27,6 +27,12 @@ class EditInfoViewModel { @@ -27,6 +27,12 @@ class EditInfoViewModel {
27 return WDHttp.get<ResponseDTO>(requestUrl,headers) 27 return WDHttp.get<ResponseDTO>(requestUrl,headers)
28 } 28 }
29 29
  30 + BasePOSTRequest(requestUrl:string){
  31 + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders()
  32 + requestUrl = HttpUrlUtils.HOST_SIT + requestUrl
  33 + return WDHttp.post<ResponseDTO>(requestUrl,headers)
  34 + }
  35 +
30 36
31 getEditListInfo(item?:editModel):EditListInfo[]{ 37 getEditListInfo(item?:editModel):EditListInfo[]{
32 this.editListData = [ 38 this.editListData = [
@@ -34,8 +40,7 @@ class EditInfoViewModel { @@ -34,8 +40,7 @@ class EditInfoViewModel {
34 new EditListInfo('简介',item&&item.userExtend.introduction.length > 0?item.userExtend.introduction:'待完善'), 40 new EditListInfo('简介',item&&item.userExtend.introduction.length > 0?item.userExtend.introduction:'待完善'),
35 new EditListInfo('地区',item&&item.userExtend.city.length > 0?item.userExtend.city:'待完善'), 41 new EditListInfo('地区',item&&item.userExtend.city.length > 0?item.userExtend.city:'待完善'),
36 new EditListInfo('生日',item&&item.userExtend.birthday.length > 0?item.userExtend.birthday:'待完善'), 42 new EditListInfo('生日',item&&item.userExtend.birthday.length > 0?item.userExtend.birthday:'待完善'),
37 - new EditListInfo('性别',item&&item.userExtend.sex.length > 0?(item.userExtend.sex=== '1'?'男':'女'):'待完善'),  
38 - ] 43 + new EditListInfo('性别',item&&item.userExtend.sex.length > 0?(item.userExtend.sex=== '1'?'男':'女'):'待完善'),]
39 return this.editListData 44 return this.editListData
40 } 45 }
41 46
@@ -51,7 +56,6 @@ class EditInfoViewModel { @@ -51,7 +56,6 @@ class EditInfoViewModel {
51 }).catch((error: Error) => { 56 }).catch((error: Error) => {
52 Logger.info('EditInfoViewModel','EditInfoViewModel','EditInfoViewModel') 57 Logger.info('EditInfoViewModel','EditInfoViewModel','EditInfoViewModel')
53 success(this.GetqueryAccountOwnerLocal(context)) 58 success(this.GetqueryAccountOwnerLocal(context))
54 -  
55 }) 59 })
56 })) 60 }))
57 } 61 }
@@ -68,7 +72,7 @@ class EditInfoViewModel { @@ -68,7 +72,7 @@ class EditInfoViewModel {
68 } 72 }
69 73
70 getAreaList(context: Context):PromiseLike<AreaListModel[]>{ 74 getAreaList(context: Context):PromiseLike<AreaListModel[]>{
71 - return new Promise(((success, error) => { 75 + return new Promise((success, error) => {
72 success(this.getAreaListLocal(context)) 76 success(this.getAreaListLocal(context))
73 // this.BaseGetRequest(HttpUrlUtils.APPOINTMENT_AccountOwner_PATH).then((navResDTO:ResponseDTO) =>{ 77 // this.BaseGetRequest(HttpUrlUtils.APPOINTMENT_AccountOwner_PATH).then((navResDTO:ResponseDTO) =>{
74 // if (navResDTO.code == 200) { 78 // if (navResDTO.code == 200) {
@@ -81,7 +85,7 @@ class EditInfoViewModel { @@ -81,7 +85,7 @@ class EditInfoViewModel {
81 // success(this.GetqueryAccountOwnerLocal(context)) 85 // success(this.GetqueryAccountOwnerLocal(context))
82 // 86 //
83 // }) 87 // })
84 - })) 88 + })
85 } 89 }
86 90
87 async getAreaListLocal(context: Context): Promise<AreaListModel[]> { 91 async getAreaListLocal(context: Context): Promise<AreaListModel[]> {
@@ -99,9 +103,33 @@ class EditInfoViewModel { @@ -99,9 +103,33 @@ class EditInfoViewModel {
99 return new AreaListManageModel(item.code,item.id,item.label,item.children) 103 return new AreaListManageModel(item.code,item.id,item.label,item.children)
100 } 104 }
101 105
102 - updateUserInfo(){  
103 -  
104 - } 106 + // updateUserInfo(item?:editModel):Promise<ResponseDTO> {
  107 + // let params: editModelParams = {};
  108 + // if (item.editDataType === WDEditDataModelType.WDEditDataModelType_head) {
  109 + // // params =
  110 + // } else if (item.editDataType === WDEditDataModelType.WDEditDataModelType_nickname) {
  111 + // params = { userName: item.userName }
  112 + // } else if (item.editDataType === WDEditDataModelType.WDEditDataModelType_intro) {
  113 + // params = { introduction: item.userExtend.introduction }
  114 + // } else if (item.editDataType === WDEditDataModelType.WDEditDataModelType_sex) {
  115 + // params = { sex: item.userExtend.sex }
  116 + // } else if (item.editDataType === WDEditDataModelType.WDEditDataModelType_birthday) {
  117 + // params = { birthday: item.userExtend.birthday }
  118 + // } else if (item.editDataType === WDEditDataModelType.WDEditDataModelType_region) {
  119 + // params = { county: item.userExtend.county }
  120 + // } else {
  121 + // }
  122 + // return new Promise((success, error) => {
  123 + // this.BasePOSTRequest(HttpUrlUtils.APPOINTMENT_editUserDetail_PATH)
  124 + // .then((navResDTO: ResponseDTO) => {
  125 + // if (navResDTO.code == 200) {
  126 + // }
  127 + // })
  128 + // .catch((error: Error) => {
  129 + //
  130 + // })
  131 + // })
  132 + // }
105 133
106 } 134 }
107 135
1 -// import router from '@ohos.router';  
2 -import mediaquery from '@ohos.mediaquery';  
3 -import window from '@ohos.window';  
4 -import { ContentDetailDTO, InteractDataDTO, RmhInfoDTO, UserInfoDTO } from 'wdBean';  
5 -import { Logger, SPHelper, WindowModel } from 'wdKit';  
6 -import { PlayerConstants, WDPlayerController, WDPlayerRenderView } from 'wdPlayer';  
7 -import { ContentDetailRequest, devicePLSensorManager } from 'wdDetailPlayApi';  
8 -import { PlayControlViewContainer } from '../view/PlayControlViewContainer';  
9 -import { PlayerDetailContainer } from '../view/PlayerDetailContainer';  
10 -// import { PlayViewModel } from '../viewmodel/PlayViewModel';  
11 -import { DetailContainer } from '../view/DetailContainer';  
12 -import {  
13 - batchLikeAndCollectParams,  
14 - batchLikeAndCollectResult,  
15 - postBatchAttentionStatusParams  
16 -} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';  
17 -import { HttpUrlUtils } from 'wdNetwork/Index';  
18 -  
19 -const TAG = 'DetailPlayShortVideoPage';  
20 -  
21 -/**  
22 - * 详情&短视频播放页面  
23 - */  
24 -  
25 -@Component  
26 -export struct DetailPlayShortVideoPage {  
27 - // private contentId?: string = undefined  
28 - // private relId?: string = undefined  
29 - // private relType?: string = undefined  
30 - @Provide contentDetailData: ContentDetailDTO | undefined = undefined  
31 - @Provide interactData: InteractDataDTO | undefined = undefined  
32 - @Prop @Watch('currentIndexChange') currentIndex: number = 0  
33 - private index: number = 0  
34 - private playerController: WDPlayerController = new WDPlayerController();  
35 - // @Watch("urlChanged") @State url?: string = undefined  
36 - // @Watch('changeContinue') @Provide nextContId?: string = '';  
37 - // @Watch('getPlayHistory') @Provide curContId?: string = undefined;  
38 - // @Watch("playVMChanged") @Provide playVM: PlayViewModel = new PlayViewModel();  
39 - @Provide isFullScreen: boolean = false;  
40 - // @Provide canStart?: boolean = false;  
41 - // @Provide status: number = PlayerConstants.STATUS_START;  
42 - // @Provide userId: string = '';  
43 - // @Provide newsSourceName?: string = ''  
44 - // @Provide newsTitle?: string = ''  
45 - // @Provide editorName?: string = ''  
46 - // @Provide rmhInfo?: RmhInfoDTO | null = null  
47 - // @Provide userInfo?: UserInfoDTO | null = null  
48 - // @Provide message?: string = ''  
49 - // @Provide newsSummary?: string = ''  
50 - @Provide progressVal: number = 0;  
51 - @Provide videoLandScape?: number = 1; // 视频朝向, 横屏视频:1;竖屏视频:2  
52 - @Provide newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态  
53 - @Provide followStatus: string = '0' // 关注状态  
54 -  
55 - // playVMChanged() {  
56 - // this.url = this.playVM.url  
57 - // this.newsSourceName = this.playVM.newsSourceName  
58 - // this.newsTitle = this.playVM.newsTitle  
59 - // this.editorName = this.playVM.editorName  
60 - // this.newsSummary = this.playVM.newsSummary  
61 - // this.videoLandScape = this.playVM.videoLandScape ?? 1  
62 - // this.curContId = this.playVM.contentId  
63 - // this.nextContId = this.playVM.nextContId  
64 - // this.canStart = this.playVM.canStart;  
65 - // this.message = this.playVM.message  
66 - // this.rmhInfo = this.playVM.rmhInfo  
67 - // this.userInfo = this.playVM.userInfo  
68 - // console.error('rmhInfo', this.rmhInfo)  
69 - // console.error('userInfo', this.userInfo)  
70 - // }  
71 -  
72 - currentIndexChange() {  
73 - if (this.currentIndex != this.index) {  
74 - this.playerController.pause()  
75 -  
76 - if (this.index < this.currentIndex - 5 && this.playerController.getPlayer()) {  
77 - this.playerController.release()  
78 - }  
79 -  
80 - } else {  
81 - console.log('currentIndexChange====1', this.currentIndex)  
82 - this.playerController.play()  
83 - this.queryNewsInfoOfUser()  
84 -  
85 - }  
86 - }  
87 -  
88 - /**  
89 - * 查询用户点赞、收藏、关注等状态  
90 - */  
91 - queryNewsInfoOfUser() {  
92 - if (HttpUrlUtils.getUserId()) {  
93 - const params: batchLikeAndCollectParams = {  
94 - contentList: [  
95 - {  
96 - contentId: this.contentDetailData?.newsId + '',  
97 - contentType: this.contentDetailData?.newsType + '',  
98 - }  
99 - ]  
100 - }  
101 - // 已登录->查询用户对作品点赞、收藏状态  
102 - ContentDetailRequest.postBatchLikeAndCollectStatus(params).then(res => {  
103 - console.log('查询点赞、收藏状态==', JSON.stringify(res.data))  
104 - if (res.data) {  
105 - this.newsStatusOfUser = res.data[0]  
106 - }  
107 - })  
108 -  
109 - const params1: postBatchAttentionStatusParams = {  
110 - creatorIds: [{ creatorId: this.contentDetailData?.rmhInfo?.rmhId ?? '' }]  
111 - }  
112 - // 已登录->批量查作品是否被号主关注  
113 - ContentDetailRequest.postBatchAttentionStatus(params1).then(res => {  
114 - console.log('批量查号主是否为用户关注==', JSON.stringify(res.data))  
115 - if (res.data) {  
116 - this.followStatus = res.data[0]?.status  
117 - }  
118 - })  
119 - }  
120 - }  
121 -  
122 - aboutToAppear() {  
123 - console.log('开始设置setContentDetailData', JSON.stringify(this.contentDetailData))  
124 -  
125 - // this.playVM.setContentDetailData(this.contentDetailData)  
126 -  
127 - // this.playVMChanged()  
128 - this.queryNewsInfoOfUser()  
129 - this.playerController.onCanplay = () => {  
130 - if (this.index == 0 || this.currentIndex === this.index) {  
131 - this.videoLandScape = this.contentDetailData?.videoInfo[0]?.videoLandScape  
132 - this.playerController.firstPlay(this.contentDetailData?.videoInfo[0]?.videoUrl);  
133 - this.playerController.play()  
134 - }  
135 - }  
136 -  
137 - // 设置播放地址  
138 - // this.url = 'https://media.w3.org/2010/05/sintel/trailer.mp4'  
139 - let listener = mediaquery.matchMediaSync('(orientation: landscape)');  
140 - listener.on("change", (mediaQueryResult) => {  
141 - if (mediaQueryResult.matches) {  
142 - console.log("横屏 yes")  
143 - this.isFullScreen = true  
144 - } else {  
145 - this.isFullScreen = false  
146 - console.log("横屏 no")  
147 - }  
148 - // WindowModel.shared.setMainWindowFullScreen(this.isFullScreen)  
149 - })  
150 -  
151 - }  
152 -  
153 - onPageShow() {  
154 - // WindowModel.shared.setPreferredOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED);  
155 - }  
156 -  
157 - aboutToDisappear(): void {  
158 - this.playerController?.pause();  
159 - }  
160 -  
161 - onPageHide() {  
162 - // WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT);  
163 - devicePLSensorManager.devicePLSensorOff();  
164 - // this.status = PlayerConstants.STATUS_PAUSE;  
165 - this.playerController?.pause();  
166 - }  
167 -  
168 - @Builder  
169 - playerViewContainerBuilder() {  
170 - // 播放窗口  
171 - WDPlayerRenderView({  
172 - playerController: this.playerController,  
173 - onLoad: async () => {  
174 - console.log('onload==', this.contentId, this.relId, this.relType)  
175 -  
176 - }  
177 - })  
178 - .height('100%')  
179 - .width('100%')  
180 - .onClick(() => {  
181 - console.error('WDPlayerRenderView=== onClick')  
182 - this.playerController?.switchPlayOrPause();  
183 - })  
184 - }  
185 -  
186 - @Builder  
187 - playControlViewContainerBuilder() {  
188 - // 播放窗口控制bar  
189 - PlayControlViewContainer({  
190 - playerController: this.playerController  
191 - })  
192 - }  
193 -  
194 - @Builder  
195 - detailContainerBuilder() {  
196 - // DetailTabBarPageComponent({ pageId: this.pageId }).backgroundColor(Color.Black)  
197 - DetailContainer({  
198 - playerController: this.playerController  
199 - })  
200 - }  
201 -  
202 - build() {  
203 - Row() {  
204 - PlayerDetailContainer({  
205 - playerView: () => {  
206 - this.playerViewContainerBuilder()  
207 - }, playControlView: () => {  
208 - // this.playControlViewContainerBuilder()  
209 - }, detailView: () => {  
210 - this.detailContainerBuilder()  
211 - }  
212 - })  
213 - .height('100%')  
214 - .width('100%')  
215 - .onClick(() => {  
216 - console.error('PlayerDetailContainer=== onClick')  
217 - this.playerController?.switchPlayOrPause();  
218 - })  
219 - }  
220 - .height('100%')  
221 - .width('100%')  
222 -  
223 - .backgroundColor(Color.Black)  
224 - }  
225 -  
226 - // 续播判断  
227 - // changeContinue() {  
228 - // if (this.nextContId) {  
229 - // this.playerController.continue = () => {  
230 - // this.playerController?.stop();  
231 - // // this.playVM.playWithContentId(this.nextContId ?? '');  
232 - // }  
233 - // return;  
234 - // }  
235 - // this.playerController.continue = undefined;  
236 - // }  
237 -  
238 - // urlChanged() {  
239 - // console.error('urlChanged===')  
240 - // if (this.url) {  
241 - // this.status = PlayerConstants.STATUS_START;  
242 - // this.playerController.firstPlay(this.url);  
243 - // }  
244 - // }  
245 -  
246 - // getPlayHistory() {  
247 - // SPHelper.default.get('playHistory', '').then((str) => {  
248 - // let result = str.toString();  
249 - // let time = 0;  
250 - // if (result != null && result != "") {  
251 - // let playHistory: Record<string, Record<string, number>> = JSON.parse(result);  
252 - // let userData: Record<string, number> = {};  
253 - // if (this.userId) {  
254 - // userData = playHistory[this.userId] ?? {};  
255 - // }  
256 - // if (this.curContId) {  
257 - // time = userData?.[this.curContId] ?? 0;  
258 - // }  
259 - // }  
260 - // this.playerController?.setStartTime(time);  
261 - // }).catch((err: Error) => {  
262 - // // Error: Inner error. Error code 15500000  
263 - // Logger.error(TAG, 'catch err:' + JSON.stringify(err));  
264 - // this.playerController?.setStartTime(0);  
265 - // });  
266 - // }  
267 -}  
  1 +@CustomDialog
  2 +export struct DetailDialog {
  3 + controller: CustomDialogController
  4 + @Prop name: string
  5 + @Prop title: string
  6 + @Prop summary: string
  7 + @Link isOpen: boolean
  8 +
  9 + build() {
  10 + Column() {
  11 + if (this.name + '1222222') {
  12 + Text(`@${this.name}` + '1222222')
  13 + .fontColor(Color.White)
  14 + .fontSize(14)
  15 + .fontWeight(600)
  16 + .lineHeight(17)
  17 + }
  18 +
  19 + if (this.title) {
  20 + Text(this.title)
  21 + .fontColor(Color.White)
  22 + .fontSize(16)
  23 + .fontWeight(600)
  24 + .margin({ top: 8 })
  25 + .lineHeight(24)
  26 + }
  27 +
  28 + Text(this.summary)
  29 + .fontColor(Color.White)
  30 + .fontSize(14)
  31 + .fontWeight(400)
  32 + .margin({ top: 8 })
  33 + .lineHeight(21)
  34 +
  35 + Row() {
  36 + Image($r('app.media.ic_close'))
  37 + .height(24).margin({ top: 20 }).onClick(() => {
  38 + this.controller.close()
  39 + if (this.isOpen) {
  40 + this.isOpen = !this.isOpen
  41 + }
  42 + })
  43 + }.width('100%').justifyContent(FlexAlign.Center)
  44 +
  45 + }
  46 + .width('100%')
  47 + .alignItems(HorizontalAlign.Start)
  48 + .backgroundColor(Color.Gray)
  49 + // .linearGradient({
  50 + // direction: GradientDirection.Top, // 渐变方向
  51 + // repeating: false, // 渐变颜色是否重复
  52 + // colors: [['rgba(0, 0, 0, 0.1)', 0.0], ['rgba(0, 0, 0, 0)', 1.0]] // 数组末尾元素占比小于1时满足重复着色效果
  53 + // })
  54 + .padding({ top: 20, bottom: 30, left: 16, right: 16 })
  55 + }
  56 +}
@@ -198,7 +198,7 @@ export struct OperationListView { @@ -198,7 +198,7 @@ export struct OperationListView {
198 198
199 }.height(60) 199 }.height(60)
200 } 200 }
201 - }.margin({ bottom: 30 }) 201 + }.margin({ bottom: 18 })
202 } 202 }
203 203
204 @Builder 204 @Builder
@@ -6,6 +6,7 @@ import { WDPlayerController } from 'wdPlayer'; @@ -6,6 +6,7 @@ import { WDPlayerController } from 'wdPlayer';
6 import { devicePLSensorManager } from 'wdDetailPlayApi'; 6 import { devicePLSensorManager } from 'wdDetailPlayApi';
7 import { OperationListView } from './OperationListView'; 7 import { OperationListView } from './OperationListView';
8 import { ContentDetailDTO, RmhInfoDTO, UserInfoDTO } from 'wdBean/Index'; 8 import { ContentDetailDTO, RmhInfoDTO, UserInfoDTO } from 'wdBean/Index';
  9 +import { DetailDialog } from './DetailDialog';
9 10
10 @Component 11 @Component
11 export struct PlayerTitleComment { 12 export struct PlayerTitleComment {
@@ -16,8 +17,22 @@ export struct PlayerTitleComment { @@ -16,8 +17,22 @@ export struct PlayerTitleComment {
16 @Consume isFullScreen: boolean; 17 @Consume isFullScreen: boolean;
17 @Consume progressVal: number; 18 @Consume progressVal: number;
18 @Consume videoLandScape?: number 19 @Consume videoLandScape?: number
  20 + @State isOpen: boolean = false
  21 + dialogController: CustomDialogController = new CustomDialogController({
  22 + builder: DetailDialog({
  23 + name: this.getName(),
  24 + title: this.getTitle(),
  25 + summary: this.getSummary(),
  26 + isOpen: this.isOpen
  27 +
  28 + }),
  29 + autoCancel: false,
  30 + customStyle: true,
  31 + alignment: DialogAlignment.Bottom
  32 + })
19 33
20 aboutToAppear() { 34 aboutToAppear() {
  35 +
21 } 36 }
22 37
23 watchSpeed() { 38 watchSpeed() {
@@ -25,42 +40,50 @@ export struct PlayerTitleComment { @@ -25,42 +40,50 @@ export struct PlayerTitleComment {
25 } 40 }
26 41
27 getName() { 42 getName() {
28 - return this.contentDetailData?.newsSourceName || this.contentDetailData?.editorName 43 + return this.contentDetailData?.newsSourceName || this.contentDetailData?.editorName || ''
29 } 44 }
30 45
31 getTitle() { 46 getTitle() {
32 - return this.contentDetailData?.newsTitle || this.contentDetailData?.newsSummary 47 + return this.contentDetailData?.newsTitle || this.contentDetailData?.newsSummary || ''
  48 + }
  49 +
  50 + getSummary() {
  51 + return this.contentDetailData?.newsSummary || ''
33 } 52 }
34 53
35 build() { 54 build() {
36 Column() { 55 Column() {
37 - // Column() {  
38 - // Row() {  
39 - // Image($r('app.media.ic_switch_orientation'))  
40 - // .width(34)  
41 - // .aspectRatio(1)  
42 - // .objectFit(ImageFit.Contain)  
43 - // .padding({ left: 10, right: 5 })  
44 - // Text("全屏观看")  
45 - // .fontColor(Color.White)  
46 - // .fontSize('14fp')  
47 - // .maxLines(2)  
48 - // .layoutWeight(1)  
49 - // }  
50 - // .width(100)  
51 - // .backgroundColor(Color.Gray)  
52 - // .borderRadius(10)  
53 - // .alignItems(VerticalAlign.Center)  
54 - // .visibility(this.videoLandScape == 2 ? Visibility.Hidden : Visibility.Visible)  
55 - // .onClick(() => {  
56 - // this.isFullScreen = !this.isFullScreen;  
57 - // WindowModel.shared.setPreferredOrientation(window.Orientation.LANDSCAPE);  
58 - // devicePLSensorManager.devicePLSensorOn(window.Orientation.LANDSCAPE);  
59 - // })  
60 - // }  
61 - // .width('100%')  
62 - // // .margin({ bottom: 120 })  
63 - // .alignItems(HorizontalAlign.Center) 56 +
  57 + if (this.contentDetailData?.videoInfo[0]?.videoLandScape === 1) {
  58 + Column() {
  59 + Row() {
  60 + Image($r('app.media.ic_switch_orientation'))
  61 + .width(34)
  62 + .aspectRatio(1)
  63 + .objectFit(ImageFit.Contain)
  64 + .padding({ left: 10, right: 5 })
  65 + Text("全屏观看")
  66 + .fontColor(Color.White)
  67 + .fontSize('14fp')
  68 + .maxLines(2)
  69 + .layoutWeight(1)
  70 + }
  71 + .width(100)
  72 + .backgroundColor(Color.Gray)
  73 + .borderRadius(10)
  74 + .alignItems(VerticalAlign.Center)
  75 + .visibility(this.videoLandScape == 2 ? Visibility.Hidden : Visibility.Visible)
  76 + .onClick(() => {
  77 + this.isFullScreen = !this.isFullScreen;
  78 + WindowModel.shared.setPreferredOrientation(window.Orientation.LANDSCAPE);
  79 + devicePLSensorManager.devicePLSensorOn(window.Orientation.LANDSCAPE);
  80 + })
  81 + }
  82 + .width('100%')
  83 + // .margin({ bottom: 120 })
  84 + .alignItems(HorizontalAlign.Center)
  85 + }
  86 +
64 87
65 Row() { 88 Row() {
66 Column() { 89 Column() {
@@ -79,11 +102,22 @@ export struct PlayerTitleComment { @@ -79,11 +102,22 @@ export struct PlayerTitleComment {
79 .textOverflow({ overflow: TextOverflow.Ellipsis }) 102 .textOverflow({ overflow: TextOverflow.Ellipsis })
80 } 103 }
81 104
82 - Text('查看详情 > ')  
83 - .margin({ top: 5 })  
84 - .fontColor(Color.White)  
85 - .fontSize(12)  
86 - .maxLines(2) 105 +
  106 + if (this.contentDetailData?.newsSummary) {
  107 + Text('查看详情 > ')
  108 + .margin({ top: 8 })
  109 + .padding(6)
  110 + .borderRadius(2)
  111 + .backgroundColor('#636363')
  112 + .fontColor(Color.White)
  113 + .fontSize(12)
  114 + .onClick(() => {
  115 + console.log('click===', this.dialogController?.open)
  116 + this.isOpen = true
  117 + this.dialogController?.open()
  118 + })
  119 + }
  120 +
87 } 121 }
88 .layoutWeight(1) 122 .layoutWeight(1)
89 .alignItems(HorizontalAlign.Start) 123 .alignItems(HorizontalAlign.Start)
@@ -117,25 +151,7 @@ export struct PlayerTitleComment { @@ -117,25 +151,7 @@ export struct PlayerTitleComment {
117 .height(24) 151 .height(24)
118 .aspectRatio(1) 152 .aspectRatio(1)
119 .onClick(() => { 153 .onClick(() => {
120 - if (this.isFullScreen) {  
121 - if (deviceInfo.deviceType != "phone") {  
122 - WindowModel.shared.getWindowSize().then((size) => {  
123 - if (size.width > size.height) {  
124 - router.back();  
125 - } else {  
126 - this.isFullScreen = !this.isFullScreen;  
127 - WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT);  
128 - devicePLSensorManager.devicePLSensorOn(window.Orientation.PORTRAIT);  
129 - }  
130 - })  
131 - } else {  
132 - this.isFullScreen = !this.isFullScreen;  
133 - WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT);  
134 - devicePLSensorManager.devicePLSensorOn(window.Orientation.PORTRAIT);  
135 - }  
136 - } else {  
137 - router.back();  
138 - } 154 + router.back();
139 }) 155 })
140 156
141 TextInput({ placeholder: '说两句...', text: this.comment }) 157 TextInput({ placeholder: '说两句...', text: this.comment })
@@ -158,5 +174,8 @@ export struct PlayerTitleComment { @@ -158,5 +174,8 @@ export struct PlayerTitleComment {
158 .width('100%') 174 .width('100%')
159 // .height('40%') 175 // .height('40%')
160 .alignItems(HorizontalAlign.Start) 176 .alignItems(HorizontalAlign.Start)
  177 + .opacity(this.isOpen ? 0 : 1)
  178 + .animation({ duration: 200 })
161 } 179 }
162 -}  
  180 +}
  181 +