wangliang_wd

desc:增加资料编辑部分界面

... ... @@ -57,8 +57,16 @@ export class HttpUrlUtils {
* 个人中心 我的预约列表
*/
static readonly APPOINTMENT_LIST_DATA_PATH: string = "/api/live-center-message/zh/c/live/subscribe";
/**
* 资料编辑 获取用户信息
*/
static readonly APPOINTMENT_AccountOwner_PATH: string = "/api/rmrb-contact/contact/zh/c/my/detail";
/**
* 我的收藏
*/
static readonly APPOINTMENT_MyCollectionList_PATH: string = "/api/rmrb-interact/content/zh/c/interact";
/**
* 早晚报列表
* 根据页面id获取页面楼层列表
* https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/pageInfo?pageId=28927
... ... @@ -257,6 +265,11 @@ export class HttpUrlUtils {
return url
}
static getMyCollectionListDataUrl() {
let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.APPOINTMENT_MyCollectionList_PATH
return url
}
static getYcgCommonHeaders(): HashMap<string, string> {
let headers: HashMap<string, string> = new HashMap<string, string>()
... ...
... ... @@ -40,4 +40,10 @@ export class WDRouterPage {
static appointmentListPage = new WDRouterPage("wdComponent", "ets/components/page/AppointmentListPage");
//我的 关注
static followListPage = new WDRouterPage("wdComponent", "ets/components/page/FollowListPage");
//资料编辑
static editUserInfoPage = new WDRouterPage("wdComponent", "ets/components/page/EditUserInfoPage");
//修改昵称
static editUserNikeNamePage = new WDRouterPage("wdComponent", "ets/components/page/EditUserNikeNamePage");
//修改简介
static editUserIntroductionPage = new WDRouterPage("wdComponent", "ets/components/page/EditUserIntroductionPage");
}
... ...
... ... @@ -44,6 +44,10 @@ export default struct MinePagePersonFunctionUI {
WDRouterRule.jumpWithPage(WDRouterPage.followListPage)
break;
}
case "收藏":{
WDRouterRule.jumpWithPage(WDRouterPage.editUserInfoPage)
break;
}
}
}).width('169lpx')
.height('117lpx')
... ...
import { ResourcesUtils } from 'wdKit'
import { ResponseDTO } from 'wdNetwork'
import { MyCollectionModel } from '../../model/MyCollectionModel'
import { CustomTitleUI } from '../reusable/CustomTitleUI'
@Entry
@Component
struct BrowsingHistoryPage {
private browsingHistoryList:MyCollectionModel[] = []
aboutToAppear(){
ResourcesUtils.getResourcesJson<ResponseDTO<MyCollectionModel[]>>(getContext(this),'browsingHistory_list_data.json').then((success)=>{
success.data?.forEach(element => {
this.browsingHistoryList.push(element)
});
console.log("ycg",this.browsingHistoryList.length.toString());
})
}
build() {
Column(){
CustomTitleUI({titleName:'浏览历史'})
List({}){
ForEach(
this.browsingHistoryList,
(item: MyCollectionModel) =>{
ListItem(){
this.HistoryItem(item)
}
}
)
}
}
.height('100%')
}
@Builder
HistoryItem(item: MyCollectionModel){
Column(){
Row(){
Column(){
Text('就像是一场不断升级的权亡。')
.maxLines(3)
Text('2024-03-14')
.margin({top:10,bottom:0})
}
.width('60%')
.alignItems(HorizontalAlign.Start)
Blank()
Image('')
.backgroundColor(Color.Orange)
.width('30%')
.height(80)
.margin({top:10})
}
Blank()
Divider()
.width('90%')
}
.width('100%')
.height(100)
}
}
\ No newline at end of file
... ...
import router from '@ohos.router';
import { CustomTitleUI } from '../reusable/CustomTitleUI';
import { EditInfoModel, EditListInfo } from '../../model/EditInfoModel';
import EditInfoViewModel from '../../viewmodel/EditInfoViewModel';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
@Entry
@Component
struct EditUserInfoPage {
private listData: EditListInfo[] = []
editInfo: EditInfoModel = new EditInfoModel('','待完善','待完善','待完善','待完善','待完善','待完善')
aboutToAppear() {
this.listData = EditInfoViewModel.getEditListInfo(this.editInfo)
this.getAccountOwnerInfo()
}
build() {
Row() {
Column() {
CustomTitleUI({titleName:'资料编辑'})
Image(this.editInfo.headPhotoUrl?this.editInfo.headPhotoUrl:'')
.backgroundColor(Color.Gray)
.width(100)
.height(100)
.borderRadius(50)
.margin({top:20,bottom:-10})
Button('点击更换头像')
.fontColor(Color.Gray)
.fontSize(18)
.backgroundColor(Color.White)
.margin(20)
List({}){
ForEach(this.listData,(item:EditListInfo,index:number) =>{
ListItem(){
this.RouterItem(item,index+1)
}
}
)
}
.layoutWeight(1)
.alignListItem(ListItemAlign.Center)
.width('100%')
}
}
.width('100%')
.height('100%')
}
@Builder
RouterItem(r:EditListInfo,i:Number){
Column(){
Row(){
Text(r.title)
.fontSize(18)
.fontColor(Color.Gray)
Blank()
Text(r.subTitle)
.fontSize(16)
.fontColor(Color.Gray)
.padding({right:10})
Image($r('app.media.mine_user_edit'))
.width('12')
.height('12')
}
.alignItems(VerticalAlign.Center)
.width('100%')
.padding(16)
Divider()
.width('90%')
}
.height(60)
.width('100%')
.onClick(()=>{
if (i === 1){
// WDRouterRule.jumpWithPage(WDRouterPage.editUserInfoPage)
WDRouterRule.jumpWithPage(WDRouterPage.editUserNikeNamePage)
}else if (i === 2){
WDRouterRule.jumpWithPage(WDRouterPage.editUserIntroductionPage)
// router.pushUrl({
// url:'pages/EditUserInstoductionPage',
// params:{pageNum:i}
// })
} else if (i === 4) {
DatePickerDialog.show({
start:new Date('1900-1-1'),
end:new Date(),
selected:new Date,
lunar:false,
// onAccept:(value:DatePickerResult) => {
//
// }
})
}else if(i === 5){
TextPickerDialog.show({
range:['男','女'],
selected:0,
// onAccept:(value:TextPickerResult) => {
//
// }
})
}
})
}
getAccountOwnerInfo(){
EditInfoViewModel.queryAccountOwnerInfo(1).then((result) => {
this.editInfo = result
});
}
}
... ...
import { CustomTitleUI } from '../reusable/CustomTitleUI'
@Entry
@Component
struct EditUserIntroductionPage {
@State numCount: number = 0
@State textColor : string = '#222222'
build() {
Column(){
CustomTitleUI({titleName:'修改简介'})
Row(){
TextInput({placeholder:'请输入简介'})
.maxLength(60)
.width('100%')
.height(80)
.backgroundColor(Color.White)
.onChange(value => {
this.numCount = value.length
if (this.numCount === 60) {
this.textColor = '#ED2800'
}else {
this.textColor = '#222222'
}
})
Text(this.numCount.toString() + '/60')
.fontColor(this.textColor)
.margin({left: -50})
}
.alignItems(VerticalAlign.Bottom)
Divider()
.margin(12)
Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、出于商业或作为素材恶搞目的,而将国旗、国徽以及国家领导人用于头像、昵称;\n3、最多60个字,只能输入中文、数字、英文字母。')
.fontSize(13)
.padding(12)
.fontColor(Color.Gray)
Button('保存')
.type(ButtonType.Normal)
.width('90%')
.backgroundColor('#ED2800')
.borderRadius(5)
.margin(30)
}
}
}
\ No newline at end of file
... ...
import { CustomTitleUI } from '../reusable/CustomTitleUI'
@Entry
@Component
struct EditUserNikeNamePage {
///接收传参
@State numCount: number = 0
@State textColor : string = '#222222'
build() {
Column(){
CustomTitleUI({titleName:'修改昵称'})
Row(){
TextInput({placeholder:'请输入昵称'})
.width('100%')
.maxLength(16)
.height(50)
.backgroundColor(Color.White)
.onChange(value => {
this.numCount = value.length
if (this.numCount === 16) {
this.textColor = '#ED2800'
}else {
this.textColor = '#222222'
}
})
Text(this.numCount.toString() + '/16')
.fontColor(this.textColor)
.margin({left: -50})
}
.alignItems(VerticalAlign.Center)
Divider()
.margin(12)
Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、出于商业或作为素材恶搞目的,而将国旗、国徽以及国家领导人用于头像、昵称;\n3、最多16个字,只能输入中文、数字、英文字母。')
.fontSize(13)
.padding(12)
.fontColor(Color.Gray)
Button('保存')
.type(ButtonType.Normal)
.width('90%')
.backgroundColor('#ED2800')
.borderRadius(5)
.margin(30)
}
}
}
\ No newline at end of file
... ...
export class EditListInfo{
//标题
title:string
//副标题
subTitle:string
constructor(title:string , subTitle:string) {
this.title = title;
this.subTitle = subTitle
}
}
export class EditInfoModel{
//头像
headPhotoUrl:string = ''
//昵称
userName:string = ''
//简介
introduction:string = ''
//城市
city:string = ''
//地区
county:string = ''
//生日
birthday:string = ''
//性别
sex:string = ''
constructor(headPhotoUrl:string , userName:string , introduction:string , city:string , county:string, birthday:string , sex:string) {
this.headPhotoUrl = headPhotoUrl;
this.userName = userName;
this.introduction = introduction;
this.city = city;
this.county = county;
this.birthday = birthday;
this.sex = sex;
}
}
\ No newline at end of file
... ...
// {
// "hasNext": 0,
// "list": [
// Object{...},
// Object{...}
// ],
// "pageNum": 1,
// "pageSize": 20,
// "totalCount": 2
// },
export class MyCollectionModel{
//标题
newsTitle:string
//封面
coverUrl:string
constructor(newsTitle:string , coverUrl:string) {
this.newsTitle = newsTitle;
this.coverUrl = coverUrl
}
}
@Observed
export class MyCollectionItem{
pageNum:number = 0
pageSize:number = 0
totalCount:number = 0
hasNext:number = 0
list:MyCollectionModel[] = []
}
export class MyCollectionListModel{
list:MyCollectionModel[] = []
pageNum: number = 0
pageSize: number = 20
totalCount: number = 0
constructor(list?:MyCollectionModel[],pageNum?: number,pageSize?: number,totalCount?: number) {
}
}
... ...
import { EditInfoModel, EditListInfo } from '../model/EditInfoModel';
import HashMap from '@ohos.util.HashMap';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
class EditInfoViewModel {
private static instance: EditInfoViewModel;
editListData:EditListInfo[] = []
/**
* 单例模式
* @returns
*/
public static getInstance(): EditInfoViewModel {
if (!EditInfoViewModel.instance) {
EditInfoViewModel.instance = new EditInfoViewModel();
}
return EditInfoViewModel.instance;
}
BaseGetRequest(requestUrl:string){
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders()
return WDHttp.get<ResponseDTO>(requestUrl,headers)
}
getEditListInfo(item:EditInfoModel):EditListInfo[]{
this.editListData = [
new EditListInfo('昵称',item&&item.userName?item.userName:'待完善'),
new EditListInfo('简介',item&&item.introduction?item.introduction:'待完善'),
new EditListInfo('地区',item&&item.city?item.city:'待完善'),
new EditListInfo('生日',item&&item.birthday?item.birthday:'待完善'),
new EditListInfo('性别',item&&item.sex?item.sex:'待完善'),]
return this.editListData
}
queryAccountOwnerInfo(userType:number):PromiseLike<EditInfoModel>{
return new Promise(((success, error) => {
this.BaseGetRequest(HttpUrlUtils.APPOINTMENT_AccountOwner_PATH).then(navResDTO =>{
if (navResDTO.code == 200) {
// success(JSON.parse(navResDTO.data))
}
}).catch()
}))
}
updateUserInfo(){
}
}
const editInfoViewModel = EditInfoViewModel.getInstance();
export default editInfoViewModel as EditInfoViewModel
\ No newline at end of file
... ...
import { MyCollectionListModel } from '../model/MyCollectionModel';
import HashMap from '@ohos.util.HashMap';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { Logger } from 'wdKit';
const TAG = "MyCollectionViewModel"
class MyCollectionViewModel {
private static instance:MyCollectionViewModel
/**
* 单例模式
* @returns
*/
public static getInstance(): MyCollectionViewModel {
if (!MyCollectionViewModel.instance) {
MyCollectionViewModel.instance = new MyCollectionViewModel();
}
return MyCollectionViewModel.instance;
}
BaseGetRequest(type:number,tagId:string,pageNum:string){
let url = HttpUrlUtils.getMyCollectionListDataUrl()+ `?type=${type}&operateTag=${1}&pageSize=${20}&pageNum=${pageNum}`
if (tagId.length > 0) {
url = url + `&tagId=${tagId}`
}
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders()
return WDHttp.get<ResponseDTO<MyCollectionListModel>>(url, headers)
}
//Type 1 收藏 2 浏览历史
//tagId 收藏界面 标签筛选
fetchMyCollectList(type:number,tagId:string,pageNum:string):Promise<MyCollectionListModel>{
return new Promise<MyCollectionListModel>((success,error) => {
this.BaseGetRequest(type,tagId,pageNum).then((navResDTO: ResponseDTO<MyCollectionListModel>) => {
if (navResDTO) {
let listData = navResDTO.data as MyCollectionListModel
success(listData)
}else{
Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
error("page data invalid");
}
}).catch((err: Error) => {
Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
error("page data invalid");
})
})
}
}
\ No newline at end of file
... ...
... ... @@ -2,7 +2,9 @@
"src": [
"components/MorningEveningPaper/MorningEveningPaperComponent",
"components/page/AppointmentListPage",
"components/page/FollowListPage"
"components/page/FollowListPage",
"components/page/EditUserInfoPage",
"components/page/EditUserNikeNamePage",
"components/page/EditUserIntroductionPage"
]
}
}
\ No newline at end of file
... ...
{
"code": "0",
"data": {
"hasNext": 0,
"list": [
{
"activityExt": null,
"appStyle": "23",
"askInfo": {
"answerContent": "已回复已回复已回复已回复已回复已回复已回复已回复已回复已回复已回复已回复已回复已回复已回复已回复已回复已回复已回复已回复已回复已回复已回复已回复已回复",
"askId": 60000000430,
"content": "首先,修路期间道路的封闭和交通拥堵成为了最大的问题。原本通畅的道路在施工期间常常被堵得水泄不通,不仅给市民的出行带来了极大的不便,也影响了周边商户的生意。此外,由于施工期间各种设备和材料的运输需求增加,交通压力也随之增大。\n\n其次,修路期间产生的噪音和环境污染也是一个难以忍受的烦恼。大型机械和运输车辆的轰鸣声、建筑材料加工的噪音以及工人施工的喧闹声,都给居民的生活带来了很大的干扰。同时,由于施工期间各种设备、材料的使用和运输,产生的灰尘、废气等也会对环境造成一定的污染。\n\n再者,修路期间的施工安全问题也令人担忧。由于施工期间道路的不规范和设备的摆放不当,容易导致交通事故的发生。此外,由于施工人员的疏忽大意,也可能引发一些安全隐患。\n\n针对以上问题,我们可以采取以下措施来缓解修路期间的烦恼:\n\n合理规划施工时间和路线,尽量减少对居民生活和商户经营的影响。\n\n加强施工现场的安全管理,确保施工期间的安全。\n\n采取必要的环保措施,减少施工期间对环境的影响。\n\n总之,修路虽然带来了许多烦恼,但也是城市发展所必须面对的问题。只有通过合理的规划和管理,才能最大程度地减少修路期间的各种烦恼,让我们的生活更加便利和舒适。",
"domainName": "治安",
"forumName": "安徽省合肥市委书记虞爱华",
"realAskId": "17050288",
"stateInfo": 4,
"typeName": "咨询"
},
"axisColor": "",
"bestNoticer": null,
"bottomNavId": null,
"cardItemId": "",
"channelId": 2062,
"commentInfo": null,
"corner": "",
"coverSize": "",
"coverType": 1,
"coverUrl": "http://testlybcustomer.people.cn/files/attachment/month_2310/202310_b1XKIRsW35n7A3Srz5EeUaLtWnqryjNz_m.jpg",
"expIds": "",
"extra": "",
"fullColumnImgUrls": [
{
"format": null,
"height": null,
"landscape": null,
"size": null,
"url": "http://testlybcustomer.people.cn/files/attachment/month_2310/202310_b1XKIRsW35n7A3Srz5EeUaLtWnqryjNz_m.jpg",
"weight": null
}
],
"hasMore": null,
"itemId": "",
"itemType": "",
"itemTypeCode": "",
"keyArticle": null,
"landscape": null,
"likeStyle": null,
"linkUrl": "",
"liveInfo": null,
"menuShow": 1,
"newTags": "",
"newsAuthor": "",
"newsSubTitle": "",
"newsSummary": "",
"newsTitle": "8月5号正在修路,给出行带来了诸多不变",
"newsTitleColor": "",
"objectId": "60000000430",
"objectLevel": "",
"objectType": "16",
"openComment": null,
"openLikes": null,
"pageId": "",
"photoNum": null,
"position": null,
"productNum": null,
"publishTime": "1697091605000",
"pushTime": null,
"pushUnqueId": null,
"readFlag": 0,
"recommend": null,
"relId": 500000002539,
"relObjectId": "2062",
"relType": 1,
"rmhInfo": null,
"rmhPlatform": null,
"sceneId": "",
"shareInfo": null,
"slideShows": [
],
"sortValue": null,
"source": "",
"subObjectType": "",
"subSceneId": "",
"tagIds": [
],
"tagWord": null,
"titleShow": null,
"titleShowPolicy": null,
"topicTemplate": null,
"traceId": "",
"traceInfo": "",
"userInfo": null,
"videoInfo": null,
"visitorComment": 0,
"voiceInfo": null
},
{
"activityExt": null,
"appStyle": "13",
"askInfo": null,
"axisColor": "",
"bestNoticer": null,
"bottomNavId": null,
"cardItemId": "",
"channelId": 2002,
"commentInfo": null,
"corner": "",
"coverSize": "616*463",
"coverType": 1,
"coverUrl": "https://rmrbcmsonline.peopleapp.com/upload/image/202403/202403151512545044.png?x-oss-process=image/resize,m_fill,h_160,w_240/quality,q_90",
"expIds": "",
"extra": "",
"fullColumnImgUrls": [
{
"format": null,
"height": 463,
"landscape": 1,
"size": 1,
"url": "https://rmrbcmsonline.peopleapp.com/upload/image/202403/202403151512545044.png?x-oss-process=image/resize,m_fill,h_160,w_240/quality,q_90",
"weight": 616
}
],
"hasMore": null,
"itemId": "",
"itemType": "",
"itemTypeCode": "",
"keyArticle": 0,
"landscape": null,
"likeStyle": null,
"linkUrl": "",
"liveInfo": null,
"menuShow": 2,
"newTags": "",
"newsAuthor": "",
"newsSubTitle": "",
"newsSummary": "涉事人员被拘。",
"newsTitle": "北京昌平一社区火警延报近1小时:2人被拘,原因离谱",
"newsTitleColor": "",
"objectId": "30034963995",
"objectLevel": "",
"objectType": "8",
"openComment": null,
"openLikes": null,
"pageId": "",
"photoNum": null,
"position": null,
"productNum": null,
"publishTime": "1710487201000",
"pushTime": null,
"pushUnqueId": null,
"readFlag": 0,
"recommend": null,
"relId": 500002806288,
"relObjectId": "2002",
"relType": 1,
"rmhInfo": null,
"rmhPlatform": 0,
"sceneId": "",
"shareInfo": null,
"slideShows": [
],
"sortValue": null,
"source": "央视新闻",
"subObjectType": "",
"subSceneId": "",
"tagIds": [
],
"tagWord": null,
"titleShow": null,
"titleShowPolicy": null,
"topicTemplate": null,
"traceId": "",
"traceInfo": "",
"userInfo": null,
"videoInfo": null,
"visitorComment": 0,
"voiceInfo": null
}
],
"pageNum": 1,
"pageSize": 20,
"totalCount": 2
},
"message": "Success",
"meta": null,
"requestId": "",
"success": true,
"timestamp": 1711010813300
}
\ No newline at end of file
... ...