王士厅
Showing 18 changed files with 145 additions and 64 deletions
... ... @@ -261,6 +261,14 @@ export class HttpUrlUtils {
return 'eyJhbGciOiJIUzI1NiIsImtpZCI6ImQ4WkI2QkhxSEZrdjJ2U25BNlRwZEdKRjBHcjItVzBvS2FaYzdLOUUycmcifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcwMzY0OTYwNiwidXNlcklkIjo0NTk3NzYyOTc0NzQ5NDksInVzZXJWZXJzaW9uIjoiNDU5Nzc2Mjk3NDc0OTQ5XzIiLCJ1c2VyTmFtZSI6IkJ1bGlraWtpMTgxIiwidXNlclR5cGUiOjIsImNyZWF0b3JJZCI6NDI2NTM5MH0.jhQ9kylcm3FxWf0-lBMZuLkdtIQ6XpFnAi0AFZJNwfc';
}
static getRefreshToken() {
let refreshToken = SPHelper.default.getSync(SpConstants.USER_REFRESH_TOKEN,"")
if(StringUtils.isNotEmpty(refreshToken)) {
return refreshToken as string;
}
return '';
}
private static getDeviceId() {
// TODO
return '8a81226a-cabd-3e1b-b630-b51db4a720ed';
... ... @@ -350,6 +358,12 @@ export class HttpUrlUtils {
return url;
}
static getLogoutUrl() {
let url = HttpUrlUtils.hostUrl + "/api/rmrb-user-center/user/zh/c/logout";
return url;
}
static getResetPassworddUrl() {
let url = HttpUrlUtils.hostUrl + "/api/rmrb-user-center/user/zh/c/resetPassword";
return url;
... ...
... ... @@ -30,17 +30,18 @@ export default struct MinePageUserSimpleInfoUI {
build(){
Row(){
//头像
Stack({alignContent: Alignment.Center}){
Stack(){
Image(this.headPhotoUrl)
.alt($r('app.media.default_head'))
.width('108lpx')
.height('108lpx')
.objectFit(ImageFit.Auto)
.objectFit(ImageFit.Cover)
.borderRadius(50)
Image(this.levelHead)
.width('130lpx')
.height('130lpx')
.objectFit(ImageFit.Auto)
.objectFit(ImageFit.Cover)
.borderRadius(50)
}.width('130lpx')
.height('130lpx')
.alignContent(Alignment.Center)
... ...
... ... @@ -80,7 +80,7 @@ export struct FollowFirstTabsComponent{
this.currentIndex = index
})
.width('100%')
.height('100%')
.layoutWeight(1)
}.width('100%')
}
}
\ No newline at end of file
... ...
... ... @@ -23,14 +23,14 @@ export struct FollowSecondTabsComponent{
if(this.data != null){
if(this.data[this.firstIndex].children == null || this.data[this.firstIndex].children.length == 0){
FollowListDetailUI({creatorDirectoryId:this.data[this.firstIndex].id})
FollowListDetailUI({creatorDirectoryId:this.data[this.firstIndex].id}).layoutWeight(1)
}else{
this.FollowSecondUI()
}
}
}
.width('100%')
.height('100%')
.layoutWeight(1)
}
@Builder FollowSecondUI(){
... ...
... ... @@ -128,7 +128,7 @@ export struct HomePageBottomComponent{
List({ space: 3 }) {
LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
ListItem() {
ChildCommentComponent({data: item})
ChildCommentComponent({data: item,isLastItem:index===this.data_comment.totalCount()-1})
}
.onClick(() => {
})
... ... @@ -158,7 +158,7 @@ export struct HomePageBottomComponent{
})
}
}
}.height('100%')
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
.width('100%')
}
... ... @@ -334,6 +334,7 @@ struct ChildFollowComponent {
@Component
struct ChildCommentComponent {
@ObjectLink data: CommentListItem
isLastItem: boolean = false
build() {
Column(){
... ... @@ -408,10 +409,12 @@ struct ChildCommentComponent {
.backgroundColor($r('app.color.color_F5F5F5'))
.margin({top:'19lpx',bottom:'31lpx'})
Divider().width('100%')
.height('12lpx')
.strokeWidth('12lpx')
.backgroundColor($r('app.color.color_F5F5F5'))
if(!this.isLastItem){
Divider().width('100%')
.height('12lpx')
.strokeWidth('12lpx')
.color($r('app.color.color_F5F5F5'))
}
}
.justifyContent(FlexAlign.Center)
... ...
... ... @@ -37,7 +37,7 @@ export struct OtherHomePageBottomCommentComponent{
List({ space: 3 }) {
LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
ListItem() {
ChildCommentComponent({data: item,levelHead:this.levelHead})
ChildCommentComponent({data: item,levelHead:this.levelHead,isLastItem:index===this.data_comment.totalCount()-1})
}
.onClick(() => {
})
... ... @@ -68,6 +68,8 @@ export struct OtherHomePageBottomCommentComponent{
}
}
.width('100%')
.layoutWeight(1)
.justifyContent(FlexAlign.Start)
}
... ... @@ -143,6 +145,7 @@ export struct OtherHomePageBottomCommentComponent{
struct ChildCommentComponent {
@ObjectLink data: CommentListItem
@Prop levelHead:string
isLastItem: boolean = false
build() {
Column(){
... ... @@ -234,10 +237,12 @@ struct ChildCommentComponent {
.backgroundColor($r('app.color.color_F5F5F5'))
.margin({top:'19lpx',bottom:'31lpx'})
Divider().width('100%')
.height('12lpx')
.strokeWidth('12lpx')
.backgroundColor($r('app.color.color_F5F5F5'))
if(!this.isLastItem){
Divider().width('100%')
.height('12lpx')
.strokeWidth('12lpx')
.color($r('app.color.color_F5F5F5'))
}
}
.justifyContent(FlexAlign.Center)
... ...
... ... @@ -5,6 +5,7 @@ import EditInfoViewModel from '../../viewmodel/EditInfoViewModel';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
import {AreaPickerDialog} from '../view/areaPickerDialog/AreaPickerDialog'
import { AreaListModel } from '../../model/AreaListModel';
import router from '@ohos.router';
@Entry
... ... @@ -25,6 +26,10 @@ struct EditUserInfoPage {
this.getAreaList()
}
onPageShow(){
}
build() {
Row() {
Column() {
... ... @@ -89,7 +94,6 @@ struct EditUserInfoPage {
.width('100%')
.onClick(()=>{
if (i === 1){
// WDRouterRule.jumpWithPage(WDRouterPage.editUserInfoPage)
WDRouterRule.jumpWithPage(WDRouterPage.editUserNikeNamePage)
}else if (i === 2){
WDRouterRule.jumpWithPage(WDRouterPage.editUserIntroductionPage)
... ...
import { CustomTitleUI } from '../reusable/CustomTitleUI'
import router from '@ohos.router'
@Entry
@Component
struct EditUserIntroductionPage {
@State numCount: number = 0
@State textColor : string = '#222222'
@State introduction: string = ''
build() {
Column(){
... ... @@ -23,6 +25,7 @@ struct EditUserIntroductionPage {
}else {
this.textColor = '#222222'
}
this.introduction = value
})
Text(this.numCount.toString() + '/60')
... ... @@ -46,6 +49,12 @@ struct EditUserIntroductionPage {
.backgroundColor('#ED2800')
.borderRadius(5)
.margin(30)
.onClick(()=>{
router.back({
url:'',
params:{nikeName:this.introduction}
})
})
}
}
}
\ No newline at end of file
... ...
import { CustomTitleUI } from '../reusable/CustomTitleUI'
import router from '@ohos.router'
@Entry
@Component
... ... @@ -6,6 +7,7 @@ struct EditUserNikeNamePage {
///接收传参
@State numCount: number = 0
@State textColor : string = '#222222'
@State nikeName: string = ''
build() {
Column(){
... ... @@ -24,6 +26,7 @@ struct EditUserNikeNamePage {
}else {
this.textColor = '#222222'
}
this.nikeName = value
})
Text(this.numCount.toString() + '/16')
... ... @@ -46,6 +49,12 @@ struct EditUserNikeNamePage {
.backgroundColor('#ED2800')
.borderRadius(5)
.margin(30)
.onClick(()=>{
router.back({
url:'',
params:{nikeName:this.nikeName}
})
})
}
}
}
\ No newline at end of file
... ...
... ... @@ -51,9 +51,7 @@ struct MyCollectionListPage {
LazyForEach(this.browSingModel.compList, (compDTO: CompDTO, compIndex: number) => {
ListItem() {
Column() {
CompParser({ compDTO: compDTO, compIndex: compIndex });
}
this.newCompParser(compDTO,compIndex)
}
})
... ... @@ -72,6 +70,23 @@ struct MyCollectionListPage {
.height(CommonConstants.FULL_PARENT)
}
@Builder
newCompParser(compDTO: CompDTO, compIndex: number){
Row(){
Button()
.type(ButtonType.Normal)
.width('20')
.height('20')
.backgroundColor('#ED2800')
.borderRadius(5)
.margin({left:16})
Column() {
CompParser({ compDTO: compDTO, compIndex: compIndex });
}
}
}
@Builder LoadingLayout() {
CustomRefreshLoadLayout({ refreshBean: new RefreshLayoutBean(true,
$r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.browSingModel.pullDownRefreshHeight) })
... ...
import { Logger } from 'wdKit';
import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel';
import EditInfoViewModel from '../../../viewmodel/EditInfoViewModel';
import { FirstLevelComponent } from './FirstLevelComponent';
... ... @@ -13,12 +14,6 @@ export struct AreaPickerDialog {
@Provide dataSource: AreaListModel[] = []
result: JSON[] = [];
aboutToAppear(){
this.currentFirst = EditInfoViewModel.getAreaListManageModel(this.dataSource[0])
this.currentSecondBean = EditInfoViewModel.getAreaListManageModel(this.dataSource[0].children[0])
this.currentThirdBean = EditInfoViewModel.getAreaListManageModel(this.dataSource[0].children[0].children[0])
}
build() {
Column(){
Row(){
... ... @@ -39,7 +34,8 @@ export struct AreaPickerDialog {
Button('确定',{type:ButtonType.Normal})
.onClick(()=> {
this.controller.close()
Logger.info('area',this.currentFirst.label+this.currentSecondBean.label+this.currentThirdBean.label);
})
.backgroundColor(0xffffff)
.fontColor(Color.Blue)
... ...
... ... @@ -12,6 +12,7 @@ export struct FirstLevelComponent {
const element = this.dataSource[index];
this.labelList.push(element.label)
}
this.currentFirst = EditInfoViewModel.getAreaListManageModel(this.dataSource[this.select])
}
build() {
... ... @@ -21,10 +22,10 @@ export struct FirstLevelComponent {
Text('暂无数据').fontSize(20)
}else {
TextPicker({range:this.labelList,selected:this.select})
// .onChange((value:string,index:number) => {
// this.select = index
// this.currentFirst = EditInfoViewModel.getAreaListManageModel(this.dataSource[index])
// })
.onChange((value: string | string[], index: number | number[]) => {
this.select = index as number
this.currentFirst = EditInfoViewModel.getAreaListManageModel(this.dataSource[index as number])
})
.backgroundColor(Color.White)
.border({color:'#e2e2e2',width:{right:0.5}})
.width('100%')
... ...
import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel';
import EditInfoViewModel from '../../../viewmodel/EditInfoViewModel';
@Component
export struct SecondLevelComponent {
@State mTip: string = '暂无数据'
... ... @@ -8,13 +8,6 @@ export struct SecondLevelComponent {
@Consume @Watch('onFirstChange') currentFirst: AreaListManageModel;
@Consume currentSecondBean: AreaListManageModel
aboutToAppear(){
for (let index = 0; index < this.currentFirst.children.length; index++) {
const element = this.currentFirst.children[index];
this.labelList.push(element.label)
}
}
build() {
Column(){
Column(){
... ... @@ -22,10 +15,10 @@ export struct SecondLevelComponent {
Text(this.mTip).fontSize(20)
}else {
TextPicker({range:this.labelList,selected:this.select})
// .onChange((value:string,index:number) => {
// this.select = index
// this.currentSecondBean = this.currentFirst.children[index]
// })
.onChange((value: string | string[], index: number | number[]) => {
this.select = index as number
this.currentSecondBean = EditInfoViewModel.getAreaListManageModel(this.currentFirst.children[index as number])
})
.backgroundColor(Color.White)
.border({color:'#e2e2e2',width:{right:0.5}})
.width('100%')
... ... @@ -47,7 +40,7 @@ export struct SecondLevelComponent {
const element = this.currentFirst.children[index];
this.labelList.push(element.label)
}
// this.currentSecondBean = this.currentFirst.children[this.select]
this.currentSecondBean = EditInfoViewModel.getAreaListManageModel(this.currentFirst.children[this.select])
}
}
}
\ No newline at end of file
... ...
import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel';
import EditInfoViewModel from '../../../viewmodel/EditInfoViewModel';
@Component
export struct ThirdLevelComponent {
@State mTip: string = '暂无数据'
... ... @@ -9,13 +9,6 @@ export struct ThirdLevelComponent {
@Consume @Watch('onSecondChange') currentSecondBean: AreaListManageModel;
@Consume currentThirdBean: AreaListManageModel
aboutToAppear(){
for (let index = 0; index < this.currentSecondBean.children.length; index++) {
const element = this.currentSecondBean.children[index];
this.labelList.push(element.label)
}
}
build() {
Column(){
Column(){
... ... @@ -23,10 +16,10 @@ export struct ThirdLevelComponent {
Text(this.mTip).fontSize(20)
}else {
TextPicker({range:this.labelList,selected:this.select})
// .onChange((value:string,index:number) => {
// this.select = index
// this.currentThirdBean = this.currentSecondBean.children[index]
// })
.onChange((value: string | string[], index: number | number[]) => {
this.select = index as number
this.currentThirdBean = EditInfoViewModel.getAreaListManageModel(this.currentSecondBean.children[index as number])
})
.backgroundColor(Color.White)
.border({color:'#e2e2e2',width:{right:0.5}})
.width('100%')
... ... @@ -52,7 +45,7 @@ export struct ThirdLevelComponent {
const element = this.currentSecondBean.children[index];
this.labelList.push(element.label)
}
// this.currentThirdBean = this.currentSecondBean.children[this.select]
this.currentThirdBean = EditInfoViewModel.getAreaListManageModel(this.currentSecondBean.children[this.select])
}
}
}
\ No newline at end of file
... ...
... ... @@ -197,16 +197,15 @@ struct MineHomePage {
this.currentIndex = index
})
.vertical(false)
.height("100%")
}.width("100%")
}
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.width('100%')
.height('100%')
.layoutWeight(1)
}
}.width('100%')
.height('100%')
.layoutWeight(1)
}
@Builder MineHomeTitleTransparent() {
... ...
... ... @@ -190,16 +190,15 @@ struct OtherNormalUserHomePage {
this.currentIndex = index
})
.vertical(false)
.height("100%")
}.width("100%")
}
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.width('100%')
.height('100%')
.layoutWeight(1)
}
}.width('100%')
.height('100%')
.layoutWeight(1)
}
@Builder MineHomeTitleTransparent() {
... ...
... ... @@ -221,5 +221,30 @@ export class LoginModel {
})
}
//退出登录
logOut() {
let bean: Record<string, string> = {};
bean['refreshToken'] = HttpUrlUtils.getRefreshToken();
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<string>((success, fail) => {
HttpRequest.post<ResponseDTO<string>>(HttpUrlUtils.getLogoutUrl(), bean, headers).then((data: ResponseDTO<string>) => {
if (!data || !data.data) {
fail("数据为空")
return
}
if (data.code != 0) {
fail(data.message)
return
}
success(data.data)
}, (error: Error) => {
fail(error.message)
Logger.debug("LoginViewModel:error ", error.toString())
})
})
}
}
... ...
... ... @@ -139,10 +139,25 @@ export class LoginViewModel {
fail(message)
})
})
}
// 登出
logOut(){
return new Promise<string>(async (success, fail) => {
this.loginModel.logOut().then((data) => {
//清除登录状态以及token、userid等信息
HttpUrlUtils.setUserId('');
HttpUrlUtils.setUserType('');
HttpUrlUtils.setUserToken('');
success(data)
}).catch((message: string) => {
fail(message)
})
})
}
async doMd(content: string): Promise<string> {
let mdAlgName = 'SHA256'; // 摘要算法名
let message = content; // 待摘要的数据
... ...