wangliang_wd

feat:优化代码

@@ -116,7 +116,6 @@ export struct HomePageBottomFollowComponent { @@ -116,7 +116,6 @@ export struct HomePageBottomFollowComponent {
116 this.curPageNum = 1; 116 this.curPageNum = 1;
117 this.hasMore = true 117 this.hasMore = true
118 this.isGetRequest = false 118 this.isGetRequest = false
119 - this.data_follow.clear()  
120 119
121 if (!this.isLoading){ 120 if (!this.isLoading){
122 this.getNewPageData() 121 this.getNewPageData()
@@ -201,6 +200,7 @@ export struct HomePageBottomFollowComponent { @@ -201,6 +200,7 @@ export struct HomePageBottomFollowComponent {
201 let object = new FollowListDetailRequestItem(-1, 20, this.curPageNum) 200 let object = new FollowListDetailRequestItem(-1, 20, this.curPageNum)
202 201
203 MinePageDatasModel.getMineFollowListData(object, getContext(this)).then((value) => { 202 MinePageDatasModel.getMineFollowListData(object, getContext(this)).then((value) => {
  203 + if (this.curPageNum === 1) this.data_follow.clear()
204 if (!this.data_follow || value.list.length == 0) { 204 if (!this.data_follow || value.list.length == 0) {
205 this.hasMore = false 205 this.hasMore = false
206 } else { 206 } else {
@@ -77,7 +77,6 @@ export struct OtherHomePageBottomFollowComponent{ @@ -77,7 +77,6 @@ export struct OtherHomePageBottomFollowComponent{
77 this.curPageNum = 1; 77 this.curPageNum = 1;
78 this.hasMore = true 78 this.hasMore = true
79 this.isGetRequest = false 79 this.isGetRequest = false
80 - this.data_follow.clear()  
81 80
82 if (!this.isLoading){ 81 if (!this.isLoading){
83 this.getNewPageData() 82 this.getNewPageData()
@@ -164,6 +163,9 @@ export struct OtherHomePageBottomFollowComponent{ @@ -164,6 +163,9 @@ export struct OtherHomePageBottomFollowComponent{
164 let object = new UserFollowListRequestItem(Number(this.curUserId),20,this.curPageNum,"1") 163 let object = new UserFollowListRequestItem(Number(this.curUserId),20,this.curPageNum,"1")
165 164
166 MinePageDatasModel.getOtherUserFollowListData(object,getContext(this)).then((value)=>{ 165 MinePageDatasModel.getOtherUserFollowListData(object,getContext(this)).then((value)=>{
  166 +
  167 + if (this.curPageNum === 1) this.data_follow.clear()
  168 +
167 if (!this.data_follow || value.list.length == 0){ 169 if (!this.data_follow || value.list.length == 0){
168 this.hasMore = false 170 this.hasMore = false
169 }else{ 171 }else{
@@ -430,7 +430,7 @@ export struct PaperSingleColumn999CardView { @@ -430,7 +430,7 @@ export struct PaperSingleColumn999CardView {
430 build() { 430 build() {
431 Column() { 431 Column() {
432 Text(this.item?.newsTitle) 432 Text(this.item?.newsTitle)
433 - .fontColor('#222222') 433 + .fontColor(this.isRead ? 0x848484 : '#222222')
434 .fontSize(16) 434 .fontSize(16)
435 .fontWeight(FontWeight.Medium) 435 .fontWeight(FontWeight.Medium)
436 .alignSelf(ItemAlign.Start) 436 .alignSelf(ItemAlign.Start)
@@ -57,7 +57,8 @@ struct EditUserInfoPage { @@ -57,7 +57,8 @@ struct EditUserInfoPage {
57 sexDialogController: CustomDialogController = new CustomDialogController({ 57 sexDialogController: CustomDialogController = new CustomDialogController({
58 builder: EditUserSexCustomDialog({ 58 builder: EditUserSexCustomDialog({
59 confirmCallback:(index)=>{ 59 confirmCallback:(index)=>{
60 - this.currentUserInfo.userExtend.sex = index; 60 + ///1男 2女
  61 + this.currentUserInfo.userExtend.sex = index == 0?2:1;
61 this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_sex 62 this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_sex
62 this.updateEditModel() 63 this.updateEditModel()
63 } 64 }
@@ -40,7 +40,7 @@ export class EditInfoModel{ @@ -40,7 +40,7 @@ export class EditInfoModel{
40 //生日 40 //生日
41 birthday:string = '' 41 birthday:string = ''
42 //性别 42 //性别
43 - sex:number = 10 43 + sex:number = 0
44 44
45 airec:number = 0 45 airec:number = 0
46 46
@@ -41,7 +41,7 @@ class EditInfoViewModel { @@ -41,7 +41,7 @@ class EditInfoViewModel {
41 new EditListInfo('简介',item&&item.userExtend.introduction?item.userExtend.introduction:'待完善'), 41 new EditListInfo('简介',item&&item.userExtend.introduction?item.userExtend.introduction:'待完善'),
42 new EditListInfo('地区',item&&item.userExtend.address?item.userExtend.address:'待完善'), 42 new EditListInfo('地区',item&&item.userExtend.address?item.userExtend.address:'待完善'),
43 new EditListInfo('生日',item&&item.userExtend.birthday?item.userExtend.birthday:'待完善'), 43 new EditListInfo('生日',item&&item.userExtend.birthday?item.userExtend.birthday:'待完善'),
44 - new EditListInfo('性别',item?(item.userExtend.sex === 10?'待完善':(item.userExtend.sex === 1?'男':'女')):'待完善'),] 44 + new EditListInfo('性别',item?(item.userExtend.sex === 0?'待完善':(item.userExtend.sex === 1?'男':'女')):'待完善'),]
45 return this.editListData 45 return this.editListData
46 } 46 }
47 47
@@ -8,6 +8,9 @@ import { WDRouterRule } from 'wdRouter/src/main/ets/router/WDRouterRule'; @@ -8,6 +8,9 @@ import { WDRouterRule } from 'wdRouter/src/main/ets/router/WDRouterRule';
8 import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/src/main/ets/bean/content/Params' 8 import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/src/main/ets/bean/content/Params'
9 import {InterestsHobbiesModel} from '../../../../../../../products/phone/src/main/ets/pages/viewModel/InterestsHobbiesModel' 9 import {InterestsHobbiesModel} from '../../../../../../../products/phone/src/main/ets/pages/viewModel/InterestsHobbiesModel'
10 import { TrackingPageBrowse, TrackConstants, TrackingButton, ParamType, Tracking } from 'wdTracking/Index' 10 import { TrackingPageBrowse, TrackConstants, TrackingButton, ParamType, Tracking } from 'wdTracking/Index'
  11 +import { window } from '@kit.ArkUI';
  12 +import { BusinessError } from '@kit.BasicServicesKit';
  13 +import { common } from '@kit.AbilityKit'
11 14
12 @Extend(Row) 15 @Extend(Row)
13 function otherStyle() { 16 function otherStyle() {
@@ -45,6 +48,7 @@ struct LoginPage { @@ -45,6 +48,7 @@ struct LoginPage {
45 lastTime: number = 0 48 lastTime: number = 0
46 @State codeStateSuccess:boolean=false 49 @State codeStateSuccess:boolean=false
47 @State toastText:string = "" 50 @State toastText:string = ""
  51 + @State isPrivacyMode: boolean = true;
48 dialogToast: CustomDialogController = new CustomDialogController({ 52 dialogToast: CustomDialogController = new CustomDialogController({
49 builder: CustomToast({ 53 builder: CustomToast({
50 msg: this.toastText, 54 msg: this.toastText,
@@ -84,6 +88,29 @@ struct LoginPage { @@ -84,6 +88,29 @@ struct LoginPage {
84 this.currentChanged() 88 this.currentChanged()
85 } 89 }
86 90
  91 + disableScreenCapture(){
  92 + let windowClass: window.Window|undefined = undefined;
  93 + let context = getContext(this) as common.UIAbilityContext
  94 + try {
  95 + window.getLastWindow(context, (err, data) => {
  96 + if (err.code) {
  97 + return
  98 + }
  99 + windowClass = data
  100 + windowClass.setWindowPrivacyMode(this.isPrivacyMode, (err: BusinessError) => {
  101 + const errCode: number = err.code;
  102 + if (errCode) {
  103 + console.error('Failed to set the window to privacy mode. Cause:' + JSON.stringify(err));
  104 + return;
  105 + }
  106 + console.info('Succeeded in setting the window to privacy mode.');
  107 + });
  108 + })
  109 + } catch (exception) {
  110 + console.error('Failed to set the window to privacy mode. Cause:' + JSON.stringify(exception));
  111 + }
  112 + }
  113 +
87 aboutToDisappear(): void { 114 aboutToDisappear(): void {
88 this.breakpointSystem.unregister(); 115 this.breakpointSystem.unregister();
89 } 116 }
@@ -91,6 +118,8 @@ struct LoginPage { @@ -91,6 +118,8 @@ struct LoginPage {
91 onPageShow() { 118 onPageShow() {
92 Logger.debug(TAG, "onPageShow:" + this.isCodeSend + " ") 119 Logger.debug(TAG, "onPageShow:" + this.isCodeSend + " ")
93 this.pageShowTime = DateTimeUtils.getTimeStamp() 120 this.pageShowTime = DateTimeUtils.getTimeStamp()
  121 + this.isPrivacyMode = true
  122 + this.disableScreenCapture()
94 } 123 }
95 124
96 onPageHide(): void { 125 onPageHide(): void {
@@ -103,6 +132,8 @@ struct LoginPage { @@ -103,6 +132,8 @@ struct LoginPage {
103 }else{ 132 }else{
104 TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Login_Page,TrackConstants.PageName.Login_Page,duration) 133 TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Login_Page,TrackConstants.PageName.Login_Page,duration)
105 } 134 }
  135 + this.isPrivacyMode = false
  136 + this.disableScreenCapture()
106 } 137 }
107 138
108 build() { 139 build() {
@@ -637,3 +668,5 @@ function trackTypeClick(typeValue: number,pageId: string){ @@ -637,3 +668,5 @@ function trackTypeClick(typeValue: number,pageId: string){
637 668
638 Tracking.event("login_type_click", params) 669 Tracking.event("login_type_click", params)
639 } 670 }
  671 +
  672 +
@@ -8,6 +8,11 @@ @@ -8,6 +8,11 @@
8 // "tablet", 8 // "tablet",
9 // "2in1" 9 // "2in1"
10 ], 10 ],
  11 + "requestPermissions": [
  12 + {
  13 + "name": "ohos.permission.PRIVACY_WINDOW"
  14 + }
  15 + ],
11 "compressNativeLibs": true, 16 "compressNativeLibs": true,
12 "deliveryWithInstall": true, 17 "deliveryWithInstall": true,
13 "pages": "$profile:main_pages" 18 "pages": "$profile:main_pages"