Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
wangyujian_wd
2024-04-22 15:36:42 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
6921dc71098ec8032cabdcbc580373958b3e82ee
6921dc71
2 parents
7d574643
1723f2a5
Merge remote-tracking branch 'origin/main'
Show whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
852 additions
and
393 deletions
sight_harmony/commons/wdKit/src/main/ets/utils/PermissionUtil.ets
sight_harmony/commons/wdKit/src/main/ets/utils/UserDataLocal.ets
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpBizUtil.ets
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
sight_harmony/features/wdComponent/src/main/ets/components/CompParser.ets
sight_harmony/features/wdComponent/src/main/ets/components/MultiPictureDetailPageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/AttentionListComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card19Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/QualityCommentsComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhSingleRow04.ets
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhSingleRow05.ets
sight_harmony/features/wdComponent/src/main/ets/components/mine/follow/FollowChildComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/mine/follow/FollowListDetailUI.ets
sight_harmony/features/wdComponent/src/main/ets/components/mine/home/HomePageBottomComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/PrivacySettingPage.ets
sight_harmony/features/wdComponent/src/main/ets/components/setting/PrivacySettingComponents.ets
sight_harmony/features/wdComponent/src/main/ets/components/skeleton/DefaultPage.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/EmptyComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/LiveEmptyComponent.ets
sight_harmony/features/wdComponent/src/main/ets/model/MinePageDatasModel.ets
sight_harmony/features/wdComponent/src/main/ets/model/MineSettingDatasModel.ets
sight_harmony/features/wdComponent/src/main/resources/base/media/local_content_icon.png
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginModel.ets
sight_harmony/products/phone/src/main/ets/pages/launchPage/LaunchAdvertisingPage.ets
sight_harmony/products/phone/src/main/ets/pages/launchPage/LaunchPage.ets
sight_harmony/products/phone/src/main/ets/pages/viewModel/InterestsHobbiesModel.ets
sight_harmony/products/phone/src/main/ets/pages/viewModel/LaunchDataModel.ets
sight_harmony/products/phone/src/main/ets/pages/viewModel/LaunchPageModel.ets
sight_harmony/commons/wdKit/src/main/ets/utils/PermissionUtil.ets
View file @
6921dc7
...
...
@@ -77,18 +77,32 @@ export class PermissionUtil {
}
static openPermissionsInSystemSettings(component: Object): void {
let context = getContext(component) as common.UIAbilityContext;
let wantInfo:Want = {
action: 'action.settings.app.info',
/**跳转设置页面*/
static openPermissionsInSystemSettings(context: Object): void {
let uiContext = getContext(context) as common.UIAbilityContext;
let wantInfo: Want = {
bundleName: 'com.huawei.hmos.settings',
abilityName: 'com.huawei.hmos.settings.MainAbility',
uri: 'application_info_entry',
parameters: {
settingsParamBundleName: AppUtils.getPackageName(context) // 打开指定应用的详情
页面
pushParams: AppUtils.getPackageName(uiContext) // 打开指定应用的设置
页面
}
}
context.startAbility(wantInfo).then(() => {
// ...
}).catch((err:Error) => {
// ...
})
uiContext.startAbility(wantInfo)
}
// static openPermissionsInSystemSettings(component: Object): void {
// let context = getContext(component) as common.UIAbilityContext;
// let wantInfo:Want = {
// action: 'action.settings.app.info',
// parameters: {
// settingsParamBundleName: AppUtils.getPackageName(context) // 打开指定应用的详情页面
// }
// }
// context.startAbility(wantInfo).then(() => {
// // ...
// }).catch((err:Error) => {
// // ...
// })
// }
}
...
...
sight_harmony/commons/wdKit/src/main/ets/utils/UserDataLocal.ets
View file @
6921dc7
...
...
@@ -24,6 +24,7 @@ export class UserDataLocal {
static USER_HEADER_URL="userHeaderUrl"
static USER_LEVEL="userLevel"
static USER_LEVEL_HEADER_URL="userLevelHeaderUrl"
static USER_FOLLOW_OPERATION="user_follow_operation"
//刷新token 用到
static USER_REFRESH_TOKEN="refreshToken"
...
...
@@ -89,6 +90,10 @@ export class UserDataLocal {
SPHelper.default.save(UserDataLocal.USER_HEADER_URL, url)
}
public static setUserFollowOperation(timestamp:string) {
SPHelper.default.saveSync(UserDataLocal.USER_FOLLOW_OPERATION, timestamp)
}
public static getUserLevel() {
if(UserDataLocal.userLevel != -1){
...
...
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpBizUtil.ets
View file @
6921dc7
...
...
@@ -19,9 +19,11 @@ export class HttpBizUtil {
* @param headers 请求header参数
* @returns 返回值
*/
static get<T = string>(url: string, headers?: HashMap<string, string>): Promise<ResponseDTO<T>> {
return new Promise<ResponseDTO<T>>((success, debug) => {
WDHttp.get<ResponseDTO<T>>(url, headers).then((resDTO: ResponseDTO<T>) => {
static get<T = ResponseDTO<string>>(url: string, headers?: HashMap<string, string>): Promise<T> {
return new Promise<T>((success, debug) => {
WDHttp.get<T>(url, headers).then((originalRes: T) => {
try {
let resDTO = originalRes as ResponseDTO
Logger.debug(TAG, 'get: ' + resDTO.code)
Logger.debug(TAG, 'get: ' + resDTO.message)
// 403:临时token;406:强制下线、封禁、清空登录信息还要跳转登录页面
...
...
@@ -33,16 +35,20 @@ export class HttpBizUtil {
}
Logger.debug(TAG, 'get again send: ' + token)
// refreshToken为空场景不处理,直接请求接口。
WDHttp.get<ResponseDTO<T>>(url, headers).then((resDTO: ResponseDTO<T>) => {
Logger.debug(TAG, 'get again: ' + resDTO.message)
success(resDTO)
WDHttp.get<T>(url, headers).then((againResDTO: T) => {
Logger.debug(TAG, 'get again: ' + againResDTO)
success(againResDTO)
}).catch((res: object) => {
debug(res)
})
});
} else {
success(resDTO
)
success(originalRes
)
}
} catch (e) {
debug(originalRes)
}
}).catch((res: object) => {
debug(res)
})
...
...
@@ -56,9 +62,11 @@ export class HttpBizUtil {
* @param headers 请求header参数
* @returns 返回值
*/
static post<T = string>(url: string, data?: object, headers?: HashMap<string, string>): Promise<ResponseDTO<T>> {
return new Promise<ResponseDTO<T>>((success, debug) => {
WDHttp.post<ResponseDTO<T>>(url, data, headers).then((resDTO: ResponseDTO<T>) => {
static post<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> {
return new Promise<T>((success, debug) => {
WDHttp.post<T>(url, data, headers).then((originalRes: T) => {
try {
let resDTO = originalRes as ResponseDTO
Logger.debug(TAG, 'post: ' + resDTO.code)
Logger.debug(TAG, 'post: ' + resDTO.message)
// 403:临时token;406:强制下线、封禁、清空登录信息还要跳转登录页面
...
...
@@ -69,14 +77,17 @@ export class HttpBizUtil {
headers.replace('cookie', 'RMRB-X-TOKEN=' + token)
}
// refreshToken为空场景不处理,直接请求接口。
WDHttp.post<ResponseDTO<T>>(url, headers).then((resDTO: ResponseDTO<T>) => {
success(resDTO)
WDHttp.post<T>(url, headers).then((againResDTO: T) => {
success(againResDTO)
}).catch((res: object) => {
debug(res)
})
});
} else {
success(resDTO)
success(originalRes)
}
} catch (e) {
success(originalRes)
}
}).catch((res: object) => {
debug(res)
...
...
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
View file @
6921dc7
...
...
@@ -281,6 +281,11 @@ export class HttpUrlUtils {
* 更新 兴趣偏好
*/
static readonly INTERESTS_UPDATETAG_PATH: string = "/api/rmrb-user-center/user/zh/c/tag/updateUserTag";
/**
* 获取启动页相关数据
*/
static readonly LAUNCH_PAGE_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/launchPage";
private static _hostUrl: string = HttpUrlUtils.HOST_PRODUCT;
/**
* 推荐列表
...
...
@@ -714,6 +719,12 @@ export class HttpUrlUtils {
return url;
}
static getLaunchPageDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LAUNCH_PAGE_PATH;
return url;
}
static getLiveDetailsUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_DETAILS_PATH
return url
...
...
sight_harmony/features/wdComponent/src/main/ets/components/CompParser.ets
View file @
6921dc7
import { CompDTO } from 'wdBean';
import { CommonConstants, CompStyle } from 'wdConstant';
import { BannerComponent } from './view/BannerComponent';
import { LabelComponent } from './view/LabelComponent';
import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent';
import {
...
...
sight_harmony/features/wdComponent/src/main/ets/components/MultiPictureDetailPageComponent.ets
View file @
6921dc7
...
...
@@ -93,10 +93,12 @@ export struct MultiPictureDetailPageComponent {
if (this.contentDetailData.rmhPlatform == 1) {
Row() {
Row() {
Row({ space: 8 }) {
Row() {
Image(this.contentDetailData?.rmhInfo?.rmhHeadUrl)
.borderRadius('50%')
.borderRadius(24)
.aspectRatio(1)
.border({ width: 1, color: Color.White, style: BorderStyle.Solid })
.alt($r('app.media.picture_loading'))
.width(36)
.height(36)
...
...
@@ -109,7 +111,8 @@ export struct MultiPictureDetailPageComponent {
Row() {
Flex({
direction: FlexDirection.Column,
justifyContent: FlexAlign.Start
justifyContent: FlexAlign.SpaceAround,
alignItems: ItemAlign.Start
}) {
Text(`${this.contentDetailData?.rmhInfo?.rmhName}`)
.fontColor(Color.White)
...
...
@@ -118,13 +121,15 @@ export struct MultiPictureDetailPageComponent {
.fontWeight(500)
.lineHeight(17)
.margin(0)
.height(17)
Text(`${this.contentDetailData?.rmhInfo?.rmhDesc}`)
.fontColor('#676767')
.fontSize(12)
.fontFamily('PingFang SC-Regular')
.fontWeight(400)
.lineHeight(14)
.textOverflow({ overflow: TextOverflow.Clip })
.height(14)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin(0)
}
}
...
...
@@ -142,7 +147,11 @@ export struct MultiPictureDetailPageComponent {
if (this.followStatus == '0') {
Row() {
Button('+关注', { type: ButtonType.Normal, stateEffect: true })
Button({ type: ButtonType.Normal, stateEffect: true }) {
Row() {
Text('+关注').fontSize(12).fontColor(0xffffff)
}.alignItems(VerticalAlign.Center)
}
.borderRadius(4)
.backgroundColor('#ED2800')
.width(48)
...
...
@@ -150,15 +159,9 @@ export struct MultiPictureDetailPageComponent {
.onClick(() => {
this.handleAccention()
})
.margin({
top: 10,
bottom: 10,
left: 16,
right: 16
})
.fontSize(12)
.fontColor(Color.White)
}
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.width('21.6%')
.height('100%')
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/AttentionListComponent.ets
View file @
6921dc7
...
...
@@ -71,6 +71,7 @@ export struct AttentionListComponent {
})
}
.listDirection(Axis.Horizontal)
.scrollBar(BarState.Off)
.height(74)
}
.padding({
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card19Component.ets
View file @
6921dc7
import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean';
import { RmhTitle } from '../cardCommon/RmhTitle'
import { ProcessUtils } from '../../utils/ProcessUtils';
import { CommonConstants } from 'wdConstant/Index';
const TAG = 'Card19Component';
/**
...
...
@@ -83,9 +85,16 @@ export struct Card19Component {
.fontColor($r('app.color.color_222222'))
.textOverflowStyle(2)
.margin({ bottom: 8 })
.width(CommonConstants.FULL_WIDTH)
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.contentDTO)
})
}
// 图片-从无图到9图展示
createImg({ fullColumnImgUrls: this.contentDTO.fullColumnImgUrls })
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.contentDTO)
})
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
.padding({
...
...
@@ -94,9 +103,6 @@ export struct Card19Component {
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.contentDTO)
})
}
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/QualityCommentsComponent.ets
View file @
6921dc7
...
...
@@ -174,7 +174,7 @@ export struct QualityCommentsComponent {
// ListItemGroup({ header: this.titleHeader() })
LazyForEach(this.allDatas, (item: commentItemModel, index: number) => {
ListItem() {
QualityCommentItem({ item: item }).margin({ left: 12, right: 12 })
QualityCommentItem({ item: item
, index:index
}).margin({ left: 12, right: 12 })
}
})
ListItem() {
...
...
@@ -217,6 +217,7 @@ export struct QualityCommentsComponent {
@Component
struct QualityCommentItem {
@ObjectLink item: commentItemModel
index:number = 0
build() {
Column() {
...
...
@@ -326,6 +327,7 @@ struct QualityCommentItem {
}
}.onClick(() => {
this.item.api_status = !this.item.api_status
// commentViewModel.commnetLikeChange(this.item)
commentViewModel.commentLike(this.item).then(() => {
...
...
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhSingleRow04.ets
View file @
6921dc7
...
...
@@ -12,12 +12,10 @@ import { ProcessUtils } from '../../utils/ProcessUtils';
export struct ZhSingleRow04 {
@State compDTO: CompDTO = {} as CompDTO
aboutToAppear() {}
build() {
Column(){
Column()
{
//顶部
Row(){
Row()
{
Row() {
Image($r("app.media.local_selection"))
.width(24)
...
...
@@ -28,6 +26,7 @@ export struct ZhSingleRow04 {
.fontColor($r("app.color.color_222222"))
.fontWeight(600)
}
Row() {
Text("更多")
.fontSize($r("app.float.font_size_14"))
...
...
@@ -41,64 +40,93 @@ export struct ZhSingleRow04 {
.justifyContent(FlexAlign.SpaceBetween)
.margin({ top: 8, bottom: 8 })
.width('100%')
// 列表内容
List({ space: 12 }) {
ForEach(this.compDTO.operDataList, (item: ContentDTO) => {
ForEach(this.compDTO.operDataList, (item: ContentDTO
, index: number
) => {
ListItem() {
Row(){
if(item.coverUrl) {
Image(item.coverUrl)
.width(84)
.height(56)
.borderRadius(3)
.objectFit(ImageFit.Cover)
.padding({right: 6})
}
Column(){
Text(item.newsTitle)
.fontSize($r("app.float.font_size_16"))
.fontColor($r("app.color.color_212228"))
.fontWeight(400)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.margin({ top: 8 })
Row(){
Text(item.source)
.fontSize($r('app.float.font_size_12'))
.fontColor($r('app.color.color_B0B0B0'))
.textOverflow({overflow: TextOverflow.Ellipsis})
.maxLines(1)
.width(item.source.length > 10 ? '60%' : '')
Image($r("app.media.point"))
.width(16)
.height(16)
Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.compDTO.operDataList[0].publishTime)))
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
localCard(
{
operDataListItem: item
}
.width('100%')
}
.width(200)
}
// .margin({right: 18})
.onClick(() =>{
)
.margin({right: index === this.compDTO.operDataList.length - 1 ? $r('app.float.card_comp_pagePadding_lf') : 0})
.onClick(() => {
ProcessUtils.processPage(item)
})
}
})
}
.listDirection(Axis.Horizontal)
.width('100%')
.scrollBar(BarState.Off)
.width(CommonConstants.FULL_PARENT)
}
.width(CommonConstants.FULL_WIDTH)
.padding({
top: 14,
left: 16,
right: 16,
bottom: 14
left: $r('app.float.card_comp_pagePadding_lf'),
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.backgroundColor($r("app.color.white"))
.margin({ bottom: 8 })
}
}
@Component
struct localCard {
@Prop operDataListItem: ContentDTO
build() {
Flex({ direction: FlexDirection.Column }) {
Text(this.operDataListItem.source)
.fontSize($r('app.float.font_size_12'))
.fontColor($r('app.color.color_B0B0B0'))
.width('100%')
.margin({ bottom: 6 })
.flexShrink(0)
Text(this.operDataListItem.newsTitle)
.width(CommonConstants.FULL_PARENT)
.height(CommonConstants.FULL_PARENT)
.fontSize($r('app.float.font_size_16'))
.fontColor('#000000')
.align(Alignment.TopStart)
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })
Row() {
Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.operDataListItem.publishTime)))
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
.margin({ right: 5 })
// 这里需要外部查询评论接口后,写入字段
if(this.operDataListItem.interactData?.commentNum) {
Text(`${this.operDataListItem.interactData?.commentNum}评`)
.fontSize(12)
}
Blank()
Image($r('app.media.local_content_icon'))
.width(20)
.height(20)
.margin({
right: -4
})
}
.width('100%')
.padding({
top: 17
})
.flexShrink(0)
}
.width(182)
.height(146)
.padding(12)
.border({
radius: 2,
})
.shadow({ radius: 5, color: '#1A000000', offsetX: 0, offsetY: 2 })
.margin({
right: 10
})
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhSingleRow05.ets
View file @
6921dc7
...
...
@@ -44,6 +44,7 @@ export struct ZhSingleRow05 {
})
}
.listDirection(Axis.Horizontal)
.scrollBar(BarState.Off)
}
.width(CommonConstants.FULL_WIDTH)
.height(170)
...
...
@@ -125,6 +126,7 @@ struct CreatorItem {
.fontSize($r('app.float.font_size_12'))
.margin({ top: 8, bottom: 14 })
.textOverflowStyle(2)
.height(34)
if (!this.rmhIsAttention) {
Text('关注')
.width(60)
...
...
sight_harmony/features/wdComponent/src/main/ets/components/mine/follow/FollowChildComponent.ets
View file @
6921dc7
import {
StringUtils, ToastUtils
} from 'wdKit/Index'
import {
DateTimeUtils, StringUtils, ToastUtils, UserDataLocal
} from 'wdKit/Index'
import { HttpUrlUtils } from 'wdNetwork/Index'
import { WDRouterRule, WDRouterPage } from 'wdRouter/Index'
import MinePageDatasModel from '../../../model/MinePageDatasModel'
...
...
@@ -133,14 +133,17 @@ export struct FollowChildComponent{
.maxLines(1)
.margin({bottom:'12lpx'})
Row(){
if(this.data.cnFansNum!="0"){
Text(`粉丝${this.data.cnFansNum}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
}
if(this.data.cnFansNum!="0" && StringUtils.isNotEmpty(this.data.introduction)){
Image($r("app.media.point"))
.width('31lpx')
.height('31lpx')
.objectFit(ImageFit.Auto)
}
Text(`${this.data.introduction}`)
.fontColor($r('app.color.color_B0B0B0'))
...
...
@@ -222,6 +225,12 @@ export struct FollowChildComponent{
if(value!=null){
if (value.code === 0 || value.code.toString() === "0") {
this.data.status = this.data.status ==="0"?"1":"0"
if(this.data.status === "1"){
UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+"")
}else{
UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+","+this.data.creatorId)
}
}
}
})
...
...
sight_harmony/features/wdComponent/src/main/ets/components/mine/follow/FollowListDetailUI.ets
View file @
6921dc7
import { LazyDataSource } from 'wdKit';
import { LazyDataSource
, SPHelper, UserDataLocal
} from 'wdKit';
import MinePageDatasModel from '../../../model/MinePageDatasModel';
import SearcherAboutDataModel from '../../../model/SearcherAboutDataModel';
import { CreatorDetailRequestItem } from '../../../viewmodel/CreatorDetailRequestItem';
...
...
@@ -9,50 +9,55 @@ import { MineFollowListDetailItem } from '../../../viewmodel/MineFollowListDetai
import { QueryListIsFollowedItem } from '../../../viewmodel/QueryListIsFollowedItem';
import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
import { FollowChildComponent } from './FollowChildComponent';
import dataPreferences from '@ohos.data.preferences';
const TAG = "FollowListDetailUI"
@Component
export struct FollowListDetailUI{
@State creatorDirectoryId:number = -1;
@State type:number = 0
export struct FollowListDetailUI {
@State creatorDirectoryId: number = -1;
@State type: number = 0
@State data: LazyDataSource<FollowListDetailItem> = new LazyDataSource();
@State count:number = 0;
@State isLoading:boolean = false
@State hasMore:boolean = true
curPageNum:number = 1;
@State count: number = 0;
@State isLoading: boolean = false
@State hasMore: boolean = true
curPageNum: number = 1;
preferences: dataPreferences.Preferences | null = null;
aboutToAppear(){
aboutToAppear()
{
this.getNewPageData()
this.addFollowStatusObserver()
}
build(){
Column(){
if(this.count === 0){
ListHasNoMoreDataUI({style:2})
build() {
Column() {
if (this.count === 0) {
ListHasNoMoreDataUI({ style: 2 })
.height('100%')
}
else
{
}
else
{
List({ space: 3 }) {
LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => {
ListItem() {
FollowChildComponent({
data: item,type:this.type
})
FollowChildComponent({
data: item, type: this.type
})
}
.onClick(() => {
})
}, (item: FollowListDetailItem
, index: number) => index.toString()
)
}, (item: FollowListDetailItem
) => item.creatorId
)
//没有更多数据 显示提示
if(!this.hasMore){
ListItem(){
if (!this.hasMore) {
ListItem() {
ListHasNoMoreDataUI()
}
}
}.cachedCount(10)
.padding({left:'31lpx',right:'31lpx'})
}
.cachedCount(10)
.padding({ left: '31lpx', right: '31lpx' })
.layoutWeight(1)
.scrollBar(BarState.Off)
.onReachEnd(()=>{
console.log(TAG,"触底了");
if(!this.isLoading){
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
...
...
@@ -63,79 +68,128 @@ export struct FollowListDetailUI{
.width('100%')
}
getNewPageData(){
async addFollowStatusObserver() {
this.preferences = await SPHelper.default.getPreferences();
let observer = (key: string) => {
if (key == UserDataLocal.USER_FOLLOW_OPERATION) {
if (this.creatorDirectoryId === -1) {
let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION,"") as string
let arr = value.split(',')
if(arr!=null && arr.length === 2){
this.data.getDataArray().forEach((element,index) => {
if (element.creatorId === arr[1]) {
this.data.deleteItem(index)
}
});
}else{
if(!this.isLoading){
this.isLoading = true
//我的关注列表
if (this.creatorDirectoryId === -1){
if(this.hasMore){
let object = new FollowListDetailRequestItem(-1,20,this.curPageNum)
this.hasMore = true
this.curPageNum = 1
this.data.clear()
this.data.notifyDataReload()
this.getMyFollowListDetail()
}
}
}
}
}
this.preferences.on('change', observer);
}
getMyFollowListDetail() {
if (this.hasMore) {
let object = new FollowListDetailRequestItem(-1, 20, this.curPageNum)
MinePageDatasModel.getMineFollowListData(object,getContext(this)).then((value)=>{
if (!this.data || value.list.length == 0){
MinePageDatasModel.getMineFollowListData(object, getContext(this)).then((value) => {
if (!this.data || value.list.length == 0) {
this.hasMore = false
}else{
value.list.forEach((value)=>{
this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId,value.mainControl,value.banControl))
this.isLoading = false
} else {
value.list.forEach((value) => {
let fansNum:number = value.fansNum
let fansNumString = ""
if (fansNum > 10000) {
let temp = (fansNum / 10000) + ""
let index = temp.indexOf('.')
if (index != -1) {
temp = temp.substring(0, index + 2)
} else {
temp = temp
}
fansNumString = temp + "万"
} else {
fansNumString = fansNum + ""
}
this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl, value.attentionUserName, fansNumString, value.introduction, value.attentionCreatorId, "1", value.attentionUserId, value.attentionUserType, value.attentionUserId, value.mainControl, value.banControl))
})
this.data.notifyDataReload()
this.count = this.data.totalCount()
if (this.data.totalCount() < value.totalCount) {
this.curPageNum++
}
else {
}
else {
this.hasMore = false
}
}
this.isLoading = false
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isLoading = false
})
}else {
this.isLoading = false
}
}
}else{
if(this.hasMore){
let object = new FollowListDetailRequestItem(this.creatorDirectoryId,20,this.curPageNum)
MinePageDatasModel.getFollowListDetailData(object,getContext(this)).then((value)=>{
if (!this.data || value.list.length == 0){
getNewPageData() {
//我的关注列表
if (this.creatorDirectoryId === -1) {
this.getMyFollowListDetail()
} else {
if (this.hasMore) {
let object = new FollowListDetailRequestItem(this.creatorDirectoryId, 20, this.curPageNum)
MinePageDatasModel.getFollowListDetailData(object, getContext(this)).then((value) => {
if (!this.data || value.list.length == 0) {
this.hasMore = false
this.isLoading = false
}
else
{
}
else
{
this.getFollowListStatus(value)
}
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isLoading = false
})
}
}
}
getFollowListStatus(result:MineFollowListDetailItem){
let data_temp : FollowListDetailItem[] = []
result.list.forEach((item)=>{
data_temp.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,"0",item.attentionUserId,item.cnUserType,item.cnUserId,item.cnMainControl,-1))
getFollowListStatus(result: MineFollowListDetailItem) {
let data_temp: FollowListDetailItem[] = []
result.list.forEach((item) => {
data_temp.push(new FollowListDetailItem(item.headPhotoUrl, item.cnUserName, item.cnFansNum, item.introduction, item.creatorId, "0", item.attentionUserId, item.cnUserType, item.cnUserId, item.cnMainControl, -1))
})
let request = new CreatorDetailRequestItem()
data_temp.forEach((data)
=>
{
data_temp.forEach((data)
=>
{
request.creatorIdList.push(data.creatorId)
})
SearcherAboutDataModel.getCreatorDetailListData(request).then((value)=>{
if(value!=null && value.length>0){
data_temp.forEach((data)=>{
value.forEach((item)=>{
if(data.creatorId == item.creatorId){
SearcherAboutDataModel.getCreatorDetailListData(request).then((value) => {
if (value != null && value.length > 0) {
data_temp.forEach((data) => {
value.forEach((item) => {
if (data.creatorId == item.creatorId) {
data.headPhotoUrl = item.headPhotoUrl
if(item.fansNum>10000){
let temp = (item.fansNum/10000)+""
if (item.fansNum > 10000) {
let temp = (item.fansNum / 10000) + ""
let index = temp.indexOf('.')
if(index != -1){
temp = temp.substring(0,index+2)
}else{
if (index != -1) {
temp = temp.substring(0, index + 2)
} else {
temp = temp
}
data.cnFansNum = temp + "万"
}
else
{
}
else
{
data.cnFansNum = item.fansNum + ""
}
data.introduction = item.introduction
...
...
@@ -144,32 +198,32 @@ export struct FollowListDetailUI{
}
})
})
this.getFollowStatus(data_temp,result.totalCount)
this.getFollowStatus(data_temp,
result.totalCount)
}
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
this.isLoading = false
this.count = this.count
===-1?0:
this.count
this.count = this.count
=== -1 ? 0 :
this.count
})
}
getFollowStatus(result
: FollowListDetailItem[],totalCount:number)
{
getFollowStatus(result
: FollowListDetailItem[], totalCount: number)
{
let status = new FollowListStatusRequestItem()
result.forEach((item)
=>
{
result.forEach((item)
=>
{
status.creatorIds.push(new QueryListIsFollowedItem(item.creatorId))
})
MinePageDatasModel.getFollowListStatusData(status,getContext(this)).then((newValue)=>{
newValue.forEach((item)=>{
result.forEach((list)=>{
MinePageDatasModel.getFollowListStatusData(status, getContext(this)).then((newValue) => {
newValue.forEach((item) => {
result.forEach((list) => {
if (item.creatorId == list.creatorId) {
list.status = item.status
}
})
})
result.forEach((item)=>{
this.data.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,item.status,item.attentionUserId,item.cnUserType,item.cnUserId,item.mainControl,item.banControl))
result.forEach((item) => {
this.data.push(new FollowListDetailItem(item.headPhotoUrl, item.cnUserName, item.cnFansNum, item.introduction, item.creatorId, item.status, item.attentionUserId, item.cnUserType, item.cnUserId, item.mainControl, item.banControl))
})
this.data.notifyDataReload()
...
...
@@ -177,15 +231,14 @@ export struct FollowListDetailUI{
this.count = this.data.totalCount()
if (this.data.totalCount() < totalCount) {
this.curPageNum++
}else {
}
else {
this.hasMore = false
}
this.isLoading = false
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isLoading = false
})
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/mine/home/HomePageBottomComponent.ets
View file @
6921dc7
import { Params } from 'wdBean';
import { DateTimeUtils, LazyDataSource,UserDataLocal } from 'wdKit';
import { DateTimeUtils, LazyDataSource,
SPHelper,
UserDataLocal } from 'wdKit';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
import MinePageDatasModel from '../../../model/MinePageDatasModel';
import { CommentListItem } from '../../../viewmodel/CommentListItem';
...
...
@@ -7,6 +7,7 @@ import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem';
import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem';
import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
import { FollowChildComponent } from '../follow/FollowChildComponent';
import dataPreferences from '@ohos.data.preferences';
const TAG = "HomePageBottomComponent"
@Component
...
...
@@ -21,9 +22,38 @@ export struct HomePageBottomComponent{
@State isMineAccount:boolean = true;
@State userId:string = "";
@Link commentNum:number
preferences: dataPreferences.Preferences | null = null;
aboutToAppear(){
this.getNewPageData()
this.addFollowStatusObserver()
}
async addFollowStatusObserver() {
this.preferences = await SPHelper.default.getPreferences();
let observer = (key: string) => {
if (key == UserDataLocal.USER_FOLLOW_OPERATION) {
let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION,"") as string
let arr = value.split(',')
if(arr!=null && arr.length === 2){
this.data_follow.getDataArray().forEach((element,index) => {
if (element.creatorId === arr[1]) {
this.data_follow.deleteItem(index)
}
});
}else{
if(!this.isLoading){
this.isLoading = true
this.hasMore = true
this.curPageNum = 1
this.data_follow.clear()
this.data_follow.notifyDataReload()
this.getMyFollowListDetail()
}
}
}
}
this.preferences.on('change', observer);
}
build(){
...
...
@@ -175,10 +205,8 @@ export struct HomePageBottomComponent{
.borderRadius(12)
}
getNewPageData(){
this.isLoading = true
//我的关注列表
if (this.style === 1){
getMyFollowListDetail(){
if(this.hasMore){
let object = new FollowListDetailRequestItem(-1,20,this.curPageNum)
...
...
@@ -187,7 +215,21 @@ export struct HomePageBottomComponent{
this.hasMore = false
}else{
value.list.forEach((value)=>{
this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId,value.mainControl,value.banControl))
let fansNum:number = value.fansNum
let fansNumString = ""
if (fansNum > 10000) {
let temp = (fansNum / 10000) + ""
let index = temp.indexOf('.')
if (index != -1) {
temp = temp.substring(0, index + 2)
} else {
temp = temp
}
fansNumString = temp + "万"
} else {
fansNumString = fansNum + ""
}
this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,fansNumString,value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId,value.mainControl,value.banControl))
})
this.data_follow.notifyDataReload()
this.count = this.data_follow.totalCount()
...
...
@@ -202,7 +244,16 @@ export struct HomePageBottomComponent{
console.log(TAG,"请求失败")
this.isLoading = false
})
}else{
this.isLoading = false
}
}
getNewPageData(){
this.isLoading = true
//我的关注列表
if (this.style === 1){
this.getMyFollowListDetail()
}else if(this.style === 0){
if(this.hasMore){
let time = encodeURI(DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
...
...
@@ -230,6 +281,8 @@ export struct HomePageBottomComponent{
console.log(TAG,"请求失败")
this.isLoading = false
})
}else{
this.isLoading = false
}
}
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/PrivacySettingPage.ets
View file @
6921dc7
import dataPreferences from '@ohos.data.preferences';
import { PermissionUtil } from 'wdKit'
import { SPHelper } from 'wdKit'
import hilog from '@ohos.hilog';
import { PrivacySettingModel } from '../../model/PrivacySettingModel'
import { Params } from 'wdBean';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
const TAG = 'PrivacySettingPage';
const DiyString = '开启个性化推荐'
const DiyCloseTipsString = '关闭后,将不会使用你的偏好进行内容推荐'
import { PrivacySettingComponents } from '../setting/PrivacySettingComponents';
@Entry
@Component
struct PrivacySettingPage {
export struct PrivacySettingPage {
@State listData: Array<PrivacySettingModel> = [new PrivacySettingModel(DiyString, false, 'ohos.permission.READ_MEDIA'), new PrivacySettingModel('相册权限', false, 'ohos.permission.READ_MEDIA'), new PrivacySettingModel('相机权限', false, 'ohos.permission.CAMERA'), new PrivacySettingModel('定位权限', false, 'ohos.permission.APPROXIMATELY_LOCATION'), new PrivacySettingModel('麦克风权限', false, 'ohos.permission.MICROPHONE')];
tips: string = '设置前可查阅'
privacyTips: string = '《隐私政策》'
tipsEnd = '中相应权限使用规则'
onPageShow(): void {
this.getPermissionStatus();
}
aboutToAppear() {
// 获取权限=
// SPHelper.default.save('sdf','sdf');
// this.initListData();
this.getPermissionStatus();
// RefreshStatus;
}
async getPermissionStatus() {
const permissionUtil = new PermissionUtil();
for (const element of this.listData) {
if (element.privacyName == DiyString) {
element.queryUserDetail();
// element.permission = true;
continue;
}
const result = await permissionUtil.checkPermissions(element.permissionKey);
element.permission = result;
}
}
build() {
Navigation() {
//滑动区域
this.PrivacySettingComponentsUI()
}.titleMode(NavigationTitleMode.Mini)
.title('隐私设置')
.backgroundColor('#F8F8F8')
}
@Builder PrivacySettingComponentsUI() {
Column() {
List({ space: '23lpx' }) {
ForEach(this.listData, (item: PrivacySettingModel, index:number) => {
ListItem() {
if (index == 0) {
getTuiJianCell({ item:item, index:index });
} else {
getArrowCell({ item:item, index:index });
}
}.onClick(() => {
if (index != 0) {
if (!item.permission) {
//跳转权限设置
const permissionUtil = new PermissionUtil();
PermissionUtil.reqPermissionsFromUser([item.permissionKey], this).then((res)=>{
item.permission = res;
});
}
}
})
})
}
.padding({ left: '29lpx', right: '29lpx' })
.margin({ top: '38lpx' })
Row() {
Text(this.tips)
.fontSize('25lpx')
.textAlign(TextAlign.Start)
.fontColor($r("app.color.color_666666"))
.margin({ left: '29lpx', top: '46lpx' })
// .backgroundColor(Color.Orange)
Text(this.privacyTips)
.fontSize('25lpx')
.textAlign(TextAlign.Start)
.fontColor('#ED2800')
.margin({ top: '46lpx' })
.onClick(() => {
//跳转隐私政策
let bean={contentID:"2",pageID:""} as Params
WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean)
})
Text(this.tipsEnd)
.fontSize('25lpx')
.textAlign(TextAlign.Start)
.fontColor($r("app.color.color_666666"))
.margin({ top: '46lpx' })
}
}
.width('100%')
.height('100%')
.backgroundColor('#F8F8F8')
.alignItems(HorizontalAlign.Start)
}
}
@Component
struct getArrowCell {
@ObjectLink item: PrivacySettingModel;
index:number = 0;
// 右文字+箭头cell
// @Builder getArrowCell(item:PrivacySettingModel, index) {
build() {
Row() {
// 左侧标题
Text(this.item.privacyName)
.fontColor('#666666')
.fontSize('31lpx')
Row() {
Text(this.item.permission ? '已开启' : '去设置')
.fontColor(this.item.permission ? '#666666' : '#CCCCCC')
.fontSize('31lpx')
.margin({ right: '8lpx' })
Image($r('app.media.mine_user_arrow'))
.width('27lpx')
.height('27lpx')
.objectFit(ImageFit.Auto)
}
}
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.SpaceBetween)
.height('97lpx')
.width('100%')
.padding({ left: '29lpx', right: '29lpx' })
.backgroundColor('#FFFFFF')
.borderRadius('8lpx')
}
}
@Component
struct getTuiJianCell {
@ObjectLink item: PrivacySettingModel;
index:number = 0;
build() {
Column(){
PrivacySettingComponents()
Column() {
Row() {
// 左侧标题
Text(this.item.privacyName)
.fontColor('#666666')
.fontSize('31lpx')
Row() {
Toggle({ type: ToggleType.Switch, isOn: this.item.permission })
.height('58lpx')
.width('96lpx')
.selectedColor('#ED2700')
.onChange((isOn: boolean) => {
// this.privacySwitch = isOn;
this.item.editUserDetail(isOn?'1':'0');
})
}
}
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.SpaceBetween)
.height('97lpx')
.width('100%')
Blank()
.backgroundColor('#EDEDED')
.height('1lpx')
Text(DiyCloseTipsString)
.fontColor('#999999')
.fontSize('23lpx')
.margin({ right: '8lpx' })
.height('69lpx')
}
.alignItems(HorizontalAlign.Start)
.backgroundColor('#FFFFFF')
.borderRadius('8lpx')
.padding({ left: '29lpx', right: '29lpx' })
}
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/setting/PrivacySettingComponents.ets
deleted
100644 → 0
View file @
7d57464
import dataPreferences from '@ohos.data.preferences';
import { PermissionUtil } from 'wdKit'
import { SPHelper } from 'wdKit'
import hilog from '@ohos.hilog';
import { PrivacySettingModel } from '../../model/PrivacySettingModel'
import { Params } from 'wdBean';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
const TAG = 'PrivacySettingComponents';
@Component
export struct PrivacySettingComponents {
@State listData: Array<PrivacySettingModel> = [new PrivacySettingModel('开启个性推荐', false, 'ohos.permission.READ_MEDIA'), new PrivacySettingModel('相册权限', false, 'ohos.permission.READ_MEDIA'), new PrivacySettingModel('相机权限', false, 'ohos.permission.CAMERA'), new PrivacySettingModel('定位权限', false, 'ohos.permission.APPROXIMATELY_LOCATION'), new PrivacySettingModel('麦克风权限', false, 'ohos.permission.MICROPHONE')];
@State tips: string = '设置前可查阅'
@State privacyTips: string = '《隐私政策》'
aboutToAppear() {
// 获取权限=
// SPHelper.default.save('sdf','sdf');
// this.initListData();
this.getPermissionStatus();
// RefreshStatus;
}
async getPermissionStatus() {
const permissionUtil = new PermissionUtil();
for (const element of this.listData) {
if (element.privacyName == '开启个性推荐') {
element.queryUserDetail();
// element.permission = true;
continue;
}
const result = await permissionUtil.checkPermissions(element.permissionKey);
element.permission = result;
}
}
build() {
Navigation() {
//滑动区域
this.PrivacySettingComponentsUI()
}.titleMode(NavigationTitleMode.Mini)
.title('隐私设置')
.backgroundColor('#F8F8F8')
}
@Builder PrivacySettingComponentsUI() {
Column() {
List({ space: '23lpx' }) {
ForEach(this.listData, (item: PrivacySettingModel, index:number) => {
ListItem() {
if (index == 0) {
getTuiJianCell({ item:item, index:index });
} else {
getArrowCell({ item:item, index:index });
}
}.onClick(() => {
if (index != 0) {
if (!item.permission) {
//跳转权限设置
const permissionUtil = new PermissionUtil();
PermissionUtil.reqPermissionsFromUser([item.permissionKey], this).then((res)=>{
item.permission = res;
});
}
}
})
})
}
.padding({ left: '29lpx', right: '29lpx' })
.margin({ top: '38lpx' })
Row() {
Text(this.tips)
.fontSize('25lpx')
.textAlign(TextAlign.Start)
.fontColor($r("app.color.color_666666"))
.margin({ left: '29lpx', top: '46lpx' })
// .backgroundColor(Color.Orange)
Text(this.privacyTips)
.fontSize('25lpx')
.textAlign(TextAlign.Start)
.fontColor('#ED2800')
.margin({ top: '46lpx' })
.onClick(() => {
//跳转隐私政策
let bean={contentId:"2",pageID:""} as Params
WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean)
})
}
}
.width('100%')
.height('100%')
.backgroundColor('#F8F8F8')
.alignItems(HorizontalAlign.Start)
}
}
@Component
struct getArrowCell {
@ObjectLink item: PrivacySettingModel;
index:number = 0;
// 右文字+箭头cell
// @Builder getArrowCell(item:PrivacySettingModel, index) {
build() {
Row() {
// 左侧标题
Text(this.item.privacyName)
.fontColor('#666666')
.fontSize('31lpx')
Row() {
Text(this.item.permission ? '已开启' : '去设置')
.fontColor(this.item.permission ? '#666666' : '#CCCCCC')
.fontSize('31lpx')
.margin({ right: '8lpx' })
Image($r('app.media.mine_user_arrow'))
.width('27lpx')
.height('27lpx')
.objectFit(ImageFit.Auto)
}
}
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.SpaceBetween)
.height('97lpx')
.width('100%')
.padding({ left: '29lpx', right: '29lpx' })
.backgroundColor('#FFFFFF')
.borderRadius('8lpx')
}
}
@Component
struct getTuiJianCell {
@ObjectLink item: PrivacySettingModel;
index:number = 0;
build() {
Column() {
Row() {
// 左侧标题
Text(this.item.privacyName)
.fontColor('#666666')
.fontSize('31lpx')
Row() {
Toggle({ type: ToggleType.Switch, isOn: this.item.permission })
.height('58lpx')
.width('96lpx')
// .selectedColor(Color.Pink)
.onChange((isOn: boolean) => {
// this.privacySwitch = isOn;
this.item.editUserDetail(isOn?'1':'0');
})
}
}
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.SpaceBetween)
.height('97lpx')
.width('100%')
Blank()
.backgroundColor('#EDEDED')
.height('1lpx')
Text('关闭后,将无法看到个性化推荐的服务')
.fontColor('#999999')
.fontSize('23lpx')
.margin({ right: '8lpx' })
.height('69lpx')
}
.alignItems(HorizontalAlign.Start)
.backgroundColor('#FFFFFF')
.borderRadius('8lpx')
.padding({ left: '29lpx', right: '29lpx' })
}
}
sight_harmony/features/wdComponent/src/main/ets/components/skeleton/DefaultPage.ets
View file @
6921dc7
...
...
@@ -3,9 +3,17 @@ import { EmptyComponent } from '../view/EmptyComponent'
@Entry
@Component
export struct DefaultPage {
retry() {
console.log('daj点击了重试')
}
build() {
Row() {
EmptyComponent({ emptyType: 8 })
EmptyComponent({
emptyType: 8, emptyButton: true, retry: () => {
this.retry()
}
})
}
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/view/EmptyComponent.ets
View file @
6921dc7
...
...
@@ -37,10 +37,6 @@ export const enum WDViewDefaultType {
WDViewDefaultType_NoVisitAccount,
/// 15.暂无关注
WDViewDefaultType_NoFollow,
/// 16.直播结束
WDViewDefaultType_NoLiveEnd,
/// 17.直播暂停
WDViewDefaultType_NoLiveSuspend,
/// 18.视频加载失败
WDViewDefaultType_NoVideo,
/// 19.暂无内容1
...
...
@@ -56,7 +52,9 @@ export struct EmptyComponent {
// private emptySize: SizeOptions = {};
@State emptyWidth: string | number = CommonConstants.FULL_PARENT;
@State emptyHeight: string | number = CommonConstants.FULL_PARENT;
@State emptyType: number = WDViewDefaultType.WDViewDefaultType_Default
@State emptyType: number = WDViewDefaultType.WDViewDefaultType_Default;
@State emptyButton: boolean = false
@State timeNum: number = 10
/**
* The empty image width percentage setting.
*/
...
...
@@ -73,6 +71,42 @@ export struct EmptyComponent {
* The empty data text opacity.
*/
readonly TEXT_OPACITY: number = 0.4;
private timer: number = -1
retry: () => void = () => {
}
createTimer() {
if (this.emptyType === 8) {
this.timer = setInterval(() => {
this.timeNum--;
if (this.timeNum === 0) {
clearInterval(this.timer);
}
}, 1000);
}
}
destroyTimer() {
if (this.emptyType === 8) {
clearInterval(this.timer);
}
}
onPageShow(): void {
this.createTimer()
}
aboutToAppear(): void {
this.createTimer()
}
onPageHide(): void {
this.destroyTimer()
}
aboutToDisappear() {
this.destroyTimer()
}
build() {
this.noProgrammeData();
...
...
@@ -90,7 +124,7 @@ export struct EmptyComponent {
.objectFit(ImageFit.Contain)
// .border({ width: 1, color: Color.Red, radius: 6 })
Text(this.
buildNoDataTip()
)
Text(this.
emptyType !== 8 ? this.buildNoDataTip() : `${this.buildNoDataTip()}(${this.timeNum}s)`
)
.fontSize($r('app.float.normal_text_size'))
.fontColor('#000000')
.fontWeight(FontWeight.Normal)
...
...
@@ -99,6 +133,23 @@ export struct EmptyComponent {
.onClick((event: ClickEvent) => {
Logger.info(TAG, `noProgrammeData onClick event?.source: ${event.source}`);
})
if (this.emptyButton) {
Button('点击重试')
.type(ButtonType.Normal)
.width(80)
.height(28)
.backgroundColor('#fffffff')
.fontColor('#FF666666')
.border({ width: 1 })
.borderColor('#FFEDEDED')
.fontSize($r('app.float.font_size_12'))
.margin({ top: 16 })
.padding(0)
.onClick(() => {
this.retry()
})
}
}
.justifyContent(FlexAlign.Center)
.width(this.emptyWidth)
...
...
@@ -127,13 +178,9 @@ export struct EmptyComponent {
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoBooking) {
contentString = '暂无预约'
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NetworkFailed) {
contentString = '
' // 前方拥堵,请耐心等待
contentString = '
前方拥堵,请耐心等待...' // 前方拥堵,请耐心等待...
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVisitAccount) {
contentString = '该号主暂时无法访问' // 前方拥堵,请耐心等待
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveEnd) {
contentString = '直播已结束' // 前方拥堵,请耐心等待
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveSuspend) {
contentString = '主播暂时离开,马上回来' // 前方拥堵,请耐心等待
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVideo) {
contentString = '获取内容失败请重试' // 前方拥堵,请耐心等待
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoContent1) {
...
...
@@ -163,11 +210,9 @@ export struct EmptyComponent {
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoBooking) {
imageString = $r('app.media.icon_no_appointmentMade')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NetworkFailed) {
imageString = $r('app.media.icon_no_
net
')
imageString = $r('app.media.icon_no_
limiting
')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVisitAccount) {
imageString = $r('app.media.icon_no_master1')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveEnd) {
imageString = $r('app.media.icon_no_end')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVideo) {
imageString = $r('app.media.icon_no_content')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoContent1) {
...
...
sight_harmony/features/wdComponent/src/main/ets/components/view/LiveEmptyComponent.ets
0 → 100644
View file @
6921dc7
import { CommonConstants } from 'wdConstant';
import { Logger } from 'wdKit';
const TAG = 'LiveEmptyComponent';
/**
* WDViewDefaultType 缺省页
*/
export const enum WDViewDefaultType {
/// 1.默认
WDViewDefaultType_Default,
/// 16.直播结束
WDViewDefaultType_NoLiveEnd,
/// 17.直播暂停
WDViewDefaultType_NoLiveSuspend,
}
/**
* 空数据/无数据
*/
@Preview
@Component
export struct LiveEmptyComponent {
// private emptySize: SizeOptions = {};
@State emptyWidth: string | number = CommonConstants.FULL_PARENT;
@State emptyHeight: string | number = CommonConstants.FULL_PARENT;
@State emptyType: number = WDViewDefaultType.WDViewDefaultType_Default
/**
* The empty image width percentage setting.
*/
readonly EMPTY_IMAGE_WIDTH: string = '15%';
/**
* The empty image height percentage setting.
*/
readonly EMPTY_IMAGE_HEIGHT: string = '15%';
/**
* The empty data text component margin top.
*/
readonly EMPTY_TIP_TEXT_MARGIN_TOP: string = '10';
/**
* The empty data text opacity.
*/
readonly TEXT_OPACITY: number = 0.4;
build() {
this.noProgrammeData();
}
/**
* 无数据,空白view组件
*/
@Builder
noProgrammeData() {
Column() {
Image(this.buildNoDataTipImage())
.width('this.EMPTY_IMAGE_WIDTH')
.height(this.EMPTY_IMAGE_HEIGHT)
.objectFit(ImageFit.Contain)
// .border({ width: 1, color: Color.Red, radius: 6 })
Text(this.buildNoDataTip())
.fontSize($r('app.float.normal_text_size'))
.fontColor('#000000')
.fontWeight(FontWeight.Normal)
.opacity(this.TEXT_OPACITY)
.margin({ top: this.EMPTY_TIP_TEXT_MARGIN_TOP })
.onClick((event: ClickEvent) => {
Logger.info(TAG, `noProgrammeData onClick event?.source: ${event.source}`);
})
}
.justifyContent(FlexAlign.Center)
.width(this.emptyWidth)
.height(this.emptyHeight)
}
buildNoDataTip(): string {
Logger.info(TAG, "buildNoDataTip");
let contentString: string = '暂无内容'
if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveEnd) {
contentString = '直播已结束' // 前方拥堵,请耐心等待
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveSuspend) {
contentString = '主播暂时离开,马上回来' // 前方拥堵,请耐心等待
}
return contentString
}
buildNoDataTipImage(): Resource | string {
Logger.info(TAG, "buildNoDataTip");
let imageString: Resource | string = $r('app.media.icon_no_content')
if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveEnd) {
imageString = $r('app.media.icon_no_end')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveSuspend) {
imageString = $r('app.media.icon_no_liver')
}
return imageString
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/model/MinePageDatasModel.ets
View file @
6921dc7
...
...
@@ -372,7 +372,7 @@ class MinePageDatasModel{
let url = HttpUrlUtils.getMineUserLevelDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
// return WDHttp.get<ResponseDTO<MineUserLevelItem>>(url, headers)
return HttpBizUtil.get<
MineUserLevelItem
>(url, headers)
return HttpBizUtil.get<
ResponseDTO<MineUserLevelItem>
>(url, headers)
};
async getMineUserLevelDataLocal(context: Context): Promise<MineUserLevelItem> {
...
...
@@ -411,7 +411,7 @@ class MinePageDatasModel{
let url = HttpUrlUtils.getMineUserDetailDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
// return WDHttp.get<ResponseDTO<MineUserDetailItem>>(url, headers)
return HttpBizUtil.get<
MineUserDetailItem
>(url, headers)
return HttpBizUtil.get<
ResponseDTO<MineUserDetailItem>
>(url, headers)
};
async getMineUserDetailDataLocal(context: Context): Promise<MineUserDetailItem> {
...
...
sight_harmony/features/wdComponent/src/main/ets/model/MineSettingDatasModel.ets
View file @
6921dc7
...
...
@@ -45,7 +45,7 @@ class MineSettingDatasModel{
this.mainSettingData.push(new MineMainSettingFunctionItem(null, '隐私设罝', null, 0, false))
this.mainSettingData.push(new MineMainSettingFunctionItem(null, '仅WiFi网络加载图片', null, 1, false))
this.mainSettingData.push(new MineMainSettingFunctionItem(null, 'WiFi网络情况下自动播放视频', null, 1, false))
this.mainSettingData.push(new MineMainSettingFunctionItem(null, '开
户
播放器悬浮窗', null, 1, false))
this.mainSettingData.push(new MineMainSettingFunctionItem(null, '开
启
播放器悬浮窗', null, 1, false))
this.mainSettingData.push(new MineMainSettingFunctionItem(null, null, null, 2, null))
this.mainSettingData.push(new MineMainSettingFunctionItem(null, '清除缓存', '32MB', 0, false))
this.mainSettingData.push(new MineMainSettingFunctionItem(null, '评价我们', null, 0, false))
...
...
sight_harmony/features/wdComponent/src/main/resources/base/media/local_content_icon.png
0 → 100644
View file @
6921dc7
2.04 KB
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginModel.ets
View file @
6921dc7
...
...
@@ -224,7 +224,7 @@ export class LoginModel {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<string>((success, fail) => {
HttpBizUtil.post<
string
>(HttpUrlUtils.getLogoutUrl(), bean, headers).then((data: ResponseDTO<string>)=>{
HttpBizUtil.post<
ResponseDTO<string>
>(HttpUrlUtils.getLogoutUrl(), bean, headers).then((data: ResponseDTO<string>)=>{
if (!data) {
fail("数据为空")
return
...
...
sight_harmony/products/phone/src/main/ets/pages/launchPage/LaunchAdvertisingPage.ets
View file @
6921dc7
...
...
@@ -12,6 +12,7 @@ struct LaunchAdvertisingPage {
// url:'pages/MainPage'
// })
WDRouterRule.jumpWithReplacePage(WDRouterPage.mainPage)
clearInterval(this.timer)
}
onPageShow(){
...
...
sight_harmony/products/phone/src/main/ets/pages/launchPage/LaunchPage.ets
View file @
6921dc7
...
...
@@ -9,6 +9,7 @@ import { GlobalContext } from '../../utils/GlobalContext'
import { WDRouterRule } from 'wdRouter';
import { WDRouterPage } from 'wdRouter';
import { LaunchModel } from '../viewModel/LaunchModel'
import { LaunchPageModel } from '../viewModel/LaunchPageModel'
@Entry
@Component
...
...
@@ -44,7 +45,8 @@ struct LaunchPage {
this.saveIsPrivacy();
//跳转引导页
this.jumpToGuidePage();
//同意隐私协议后请求启动页相关数据
this.requestLaunchPageData();
}
jumpToAdvertisingPage() {
...
...
@@ -90,9 +92,11 @@ struct LaunchPage {
this.dialogController.open();
// }
} else {
//需要根据请求数据判断是否需要进入广告页,广告数据为nil则直接跳转到首页
//跳转广告页
this.jumpToAdvertisingPage();
//同意隐私协议后每次启动app请求启动页相关数据,并更新数据
this.requestLaunchPageData();
}
});
});
...
...
@@ -154,4 +158,12 @@ struct LaunchPage {
launchModel.getAgreement()
}
requestLaunchPageData() {
//请求启动页相关接口数据并保存
let launchPageModel = new LaunchPageModel()
launchPageModel.getLaunchPageData()
}
}
\ No newline at end of file
...
...
sight_harmony/products/phone/src/main/ets/pages/viewModel/InterestsHobbiesModel.ets
View file @
6921dc7
...
...
@@ -46,16 +46,6 @@ export class InterestsHobbiesModel {
Logger.debug("InterestsHobbiesModel兴趣偏好数据获取成功:success ", JSON.stringify(data))
success(data.data);
//保存数据
// for (let i = 0; i < data.data.length; i++) {
// if (data.data[i].type == 1) {
// SPHelper.default.save(SpConstants.USER_PROTOCOL, data.data[i].linkUrl)
// } else if (data.data[i].type == 2) {
// SPHelper.default.save(SpConstants.PRIVATE_PROTOCOL, data.data[i].linkUrl)
// }
// }
}, (error: Error) => {
Logger.debug("InterestsHobbiesModel兴趣偏好数据获取失败:error ", error.toString())
fail(error.message)
...
...
sight_harmony/products/phone/src/main/ets/pages/viewModel/LaunchDataModel.ets
0 → 100644
View file @
6921dc7
export interface NetLayerLaunchOperatModel {
ID : string
screenName : string //开机屏名称
objectType : string // WDPublicProgramType 对象类型 0:不跳转,1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,11:图文,12:组图,13:H5新闻,14:频道
objectId : string //跳转id
objectLevel : string //频道(1:一级频道,2:二级频道),专题(1:普通专题,2:主题专题,3:作者专题 21:文章专题,22:音频专题,23:直播专题,24:话题专题)
pageId : string //跳转页面id,objectType=5,14使用页面跳转
durations : string //展示时长(单位:秒)
linkUrl : string //转链接地址【objectType=6,13】
screenType : string // 0, 1 : WDDisplayStyle_Logo 2 : WDDisplayStyle_Full
bootScreenUrl : string //开机屏封面图/视频地址
bootVideoScreenUrl : string //视频封面地址
showType : string //文件类型WDPublicFileType 2: 视频 其他: 图片
isAd : string //0-非广告,1-是广告
bottomNavId : string //底部导航ID
relId : string //频道/专题内容关系id
}
export interface NetLayerLauncherADMaterialModel{
matType : string //1 video 其他 image
startStyle : number // 1 WDDisplayStyle_Full 全屏样式 其他 WDDisplayStyle_Logo 底部logo样式
advTitle : string
matImageUrl : string[] //取firstObject
matVideoUrl : string
openType : string //链接打开方式,0-没链接,不用打开,1-端内打开,2-端外打开
linkUrl : string
}
export interface NetLayerLauncherADInfoModel{
ID : string
startTime : number
endTime : number
displayDuration : number
displayRound : number
matInfo : NetLayerLauncherADMaterialModel
}
export interface NetLayerLauncherH5TemplateInfoModel{
versionRangeMin : string
versionRangeMax : string
h5TemplateUrl : string
version : string
md5 : string
}
export default interface LaunchDataModel{
launchPageInfo : NetLayerLaunchOperatModel
launchAdInfo : NetLayerLauncherADInfoModel[]
h5Template : NetLayerLauncherH5TemplateInfoModel[]
}
\ No newline at end of file
...
...
sight_harmony/products/phone/src/main/ets/pages/viewModel/LaunchPageModel.ets
0 → 100644
View file @
6921dc7
import LaunchDataModel from '../viewModel/LaunchDataModel'
import HashMap from '@ohos.util.HashMap';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import { HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index';
import { Logger, SPHelper } from 'wdKit/Index';
import data from '@ohos.telephony.data';
import { SpConstants } from 'wdConstant/Index';
export class LaunchPageModel {
getLaunchPageData() {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<LaunchDataModel>((success, fail) => {
HttpRequest.get<ResponseDTO<LaunchDataModel>>(HttpUrlUtils.getLaunchPageDataUrl(), headers).then((data: ResponseDTO<LaunchDataModel>) => {
if (!data || !data.data) {
fail("数据为空")
return
}
if (data.code != 0) {
fail(data.message)
return
}
Logger.debug("LaunchPageModel获取启动相关数据获取成功:success ", JSON.stringify(data))
success(data.data);
//存储数据
}, (error: Error) => {
Logger.debug("LaunchPageModel获取启动相关数据获取失败:error ", error.toString())
fail(error.message)
})
})
}
}
...
...
Please
register
or
login
to post a comment