陈剑华

Merge remote-tracking branch 'origin/main'

Showing 72 changed files with 3234 additions and 450 deletions

Too many changes to show.

To preserve performance only 72 of 72+ files are displayed.

... ... @@ -20,3 +20,5 @@ export { DurationEnum } from './src/main/ets/enum/DurationEnum';
export { ScreenType } from './src/main/ets/enum/ScreenType';
export { SpConstants } from './src/main/ets/constants/SpConstants';
export { DisplayDirection } from './src/main/ets/constants/VideoConstants';
... ...
... ... @@ -24,4 +24,6 @@ export class SpConstants{
static SETTING_SUSPENSION_SWITCH = "setting_suspension_switch" //悬浮窗 开关
static SETTING_PUSH_SWITCH = "setting_push_switch" //推送 开关
//未登录保存兴趣标签
static PUBLICVISUTORMODE_INTERESTTAGS = 'PublicVisitorMode_InterestTags'
}
\ No newline at end of file
... ...
export enum DisplayDirection {
VERTICAL,
VIDEO_HORIZONTAL
}
\ No newline at end of file
... ...
import { Action } from './Action';
interface dataObject {
operateType?: string
webViewHeight?: string
dataJson?: string
}
... ...
... ... @@ -43,3 +43,5 @@ export { ErrorToastUtils } from './src/main/ets/utils/ErrorToastUtils'
export { EmitterUtils } from './src/main/ets/utils/EmitterUtils'
export { EmitterEventId } from './src/main/ets/utils/EmitterEventId'
export { HWLocationUtils } from './src/main/ets/utils/HWLocationUtils'
\ No newline at end of file
... ...
import { Logger } from './Logger';
import { PermissionUtils } from './PermissionUtils';
import { abilityAccessCtrl, bundleManager, Permissions } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
import { geoLocationManager } from '@kit.LocationKit';
import { SPHelper } from './SPHelper';
/**
* 系统定位服务实现
* */
export class HWLocationUtils {
//d定位相关
static LOCATION_CITY_NAME = "location_city_name" //定位
static LOCATION_CITY_CODE = "location_city_code" //定位
static LOCATION: Permissions = 'ohos.permission.LOCATION'
static APPROXIMATELY_LOCATION: Permissions = 'ohos.permission.APPROXIMATELY_LOCATION'
private static getLocation() {
let requestInfo: geoLocationManager.LocationRequest = {
'priority': geoLocationManager.LocationRequestPriority.FIRST_FIX,
'scenario': geoLocationManager.LocationRequestScenario.UNSET,
distanceInterval: 0,
timeInterval: 60,
maxAccuracy: 0
};
geoLocationManager.on('locationChange', requestInfo, (data) => {
Logger.debug('location :' + JSON.stringify(data))
})
}
private static getLocationData() {
return new Promise<Record<string, string | number>>((success, fail) => {
let requestInfo: geoLocationManager.LocationRequest = {
'priority': geoLocationManager.LocationRequestPriority.FIRST_FIX,
'scenario': geoLocationManager.LocationRequestScenario.DAILY_LIFE_SERVICE,
distanceInterval: 0,
timeInterval: 60,
maxAccuracy: 0
};
geoLocationManager.on('locationChange', requestInfo, (data) => {
Logger.debug('location :' + JSON.stringify(data)) //{"latitude":31.86870096,"longitude":117.3015341,"altitude":0,"accuracy":5000,"speed":0,"timeStamp":1713332445643,"direction":0,"timeSinceBoot":589519570869240,"additions":"","additionSize":0}
let record: Record<string, string | number> = {};
record['latitude'] = data.latitude
record['longitude'] = data.longitude
success(record)
})
})
}
//开启定位服务
static async startLocationService() {
let grant = await PermissionUtils.checkPermissions(HWLocationUtils.APPROXIMATELY_LOCATION)
if (grant) {
HWLocationUtils.getCurrentLocation()
return
}
let context = getContext();
let requestGrant = await PermissionUtils.reqPermissionsFromUser([HWLocationUtils.APPROXIMATELY_LOCATION], context);
Logger.debug('location2 :' + requestGrant)
if (requestGrant) {
HWLocationUtils.getCurrentLocation()
} else {
PermissionUtils.openPermissionsInSystemSettings(context)
}
}
private static getCurrentLocation() {
let requestInfo: geoLocationManager.CurrentLocationRequest = {
'priority': geoLocationManager.LocationRequestPriority.FIRST_FIX,
'scenario': geoLocationManager.LocationRequestScenario.DAILY_LIFE_SERVICE,
'maxAccuracy': 0
};
try {
geoLocationManager.getCurrentLocation(requestInfo).then((result) => {
//{"latitude":31.8687047,"longitude":117.30152005,"altitude":0,"accuracy":5000,"speed":0,"timeStamp":1713331875766,"direction":0,"timeSinceBoot":588949694096931,"additions":"","additionSize":0}
Logger.debug('location' + JSON.stringify(result))
HWLocationUtils.getReverseGeoCodeRequest(result.latitude, result.longitude)
})
.catch((error: number) => {
Logger.debug('location' + JSON.stringify(error))
});
} catch (err) {
}
}
private static getGeoCodeRequest(description: string) {
let requestInfo: geoLocationManager.GeoCodeRequest = { 'description': description };
geoLocationManager.getAddressesFromLocationName(requestInfo, (error, data) => {
if (data) {
Logger.debug('location :' + JSON.stringify(data))
}
//[{"latitude":31.898204927828598,"longitude":117.29702564819466,"locale":"zh","placeName":"安徽省合肥市瑶海区白龙路与北二环路辅路交叉口南20米","countryCode":"CN","countryName":"中国","administrativeArea":"安徽省","subAdministrativeArea":"合肥市","locality":"合肥市","subLocality":"瑶海区","roadName":"白龙路与北二环路辅路","subRoadName":"20","premises":"20","postalCode":"","phoneNumber":"18756071597","addressUrl":"","descriptionsSize":0,"isFromMock":false}]
})
}
private static getReverseGeoCodeRequest(latitude: number, longitude: number) {
let requestInfo: geoLocationManager.ReverseGeoCodeRequest = {
"latitude": latitude,
"longitude": longitude,
"maxItems": 2
};
geoLocationManager.getAddressesFromLocation(requestInfo, (error, data) => {
if (error) {
Logger.debug('location :' + JSON.stringify(error))
}
if (data) {
Logger.debug('location :' + JSON.stringify(data))
if (data[0] && data[0].countryName) {
if (data[0].descriptionsSize && data[0].descriptions) {
let code = data[0].descriptions[1]
let cityCode = code.substring(0, 6)
let cityName = data[0].subAdministrativeArea;
if (cityName) {
SPHelper.default.save(HWLocationUtils.LOCATION_CITY_NAME, cityName)
}
if (cityCode) {
SPHelper.default.save(HWLocationUtils.LOCATION_CITY_NAME, cityCode)
}
}
}
}
})
}
//取消定位
static cancelLocation() {
// geoLocationManager.off('locationChange')
return new Promise<boolean>((success, fail) => {
geoLocationManager.off("locationChange", (data) => {
Logger.debug('location :' + JSON.stringify(data))
success(true)
})
})
}
}
\ No newline at end of file
... ...
... ... @@ -101,4 +101,9 @@ export class SPHelper {
// preferences.clearSync()
// preferences.flush()
// }
public getPreferences(){
let preferences = data_preferences.getPreferences(SPHelper.context, SPHelper.spFilename);
return preferences;
}
}
\ No newline at end of file
... ...
... ... @@ -26,6 +26,7 @@ export class Size {
export class WindowModel {
private windowStage?: window.WindowStage;
private windowClass?: window.Window;
private isFullScreen: boolean = false
static shared: WindowModel = new WindowModel()
static TAG = "WindowModel";
... ... @@ -129,7 +130,15 @@ export class WindowModel {
this.windowClass?.setWindowSystemBarProperties(systemBarProperties, (err: BusinessError) => {
callback && callback(err)
})
}
setWindowLayoutFullScreen(isFullScreen: boolean) {
this.isFullScreen = isFullScreen
this.windowClass?.setWindowLayoutFullScreen(isFullScreen)
}
getIsFullScreen(): boolean {
return this.isFullScreen
}
}
... ...
{
"lockfileVersion": 1,
"meta": {
"stableOrder": true
},
"lockfileVersion": 3,
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": {
"@ohos/axios@^2.1.1": "@ohos/axios@2.2.0"
"@ohos/axios@^2.1.1": "@ohos/axios@2.2.0",
"wdConstant@../wdConstant": "wdConstant@../wdConstant",
"wdKit@../wdKit": "wdKit@../wdKit"
},
"packages": {
"@ohos/axios@2.2.0": {
"name": "@ohos/axios",
"integrity": "sha512-v1QBWk6DfcN8wUW3D0ieFbHTR1taSI5cOgxp5l6B5cegXuNYhSc8ggKlAIXe6h/14LsfM+NW0ZGfSXcNEIM5yA==",
"resolved": "https://repo.harmonyos.com/ohpm/@ohos/axios/-/axios-2.2.0.har",
"integrity": "sha512-v1QBWk6DfcN8wUW3D0ieFbHTR1taSI5cOgxp5l6B5cegXuNYhSc8ggKlAIXe6h/14LsfM+NW0ZGfSXcNEIM5yA=="
"registryType": "ohpm"
},
"wdConstant@../wdConstant": {
"name": "wdconstant",
"resolved": "../wdConstant",
"registryType": "local"
},
"wdKit@../wdKit": {
"name": "wdkit",
"resolved": "../wdKit",
"registryType": "local"
}
}
}
\ No newline at end of file
... ...
... ... @@ -2,7 +2,7 @@
* ResponseDTO
*/
export interface ResponseDTO<T = string> {
success:boolean;
success: boolean;
// 服务请求响应值/微服务响应状态码”
code: number;
... ... @@ -12,6 +12,7 @@ export interface ResponseDTO<T = string> {
// 响应结果
data?: T;
totalCount?: number;
// 请求响应时间戳(unix格式)
timestamp?: number;
... ...
... ... @@ -235,6 +235,25 @@ export class HttpUrlUtils {
static readonly SEARCH_RESULT_LIST_DATA_PATH: string = "/api/rmrb-search-api/zh/c/search";
/**
* 创作者详情接口
*/
static readonly CREATOR_DETAIL_LIST_DATA_PATH: string = "/api/rmrb-contact/contact/zh/c/master/detailList";
/**
* 客态查询发布作品数量
*/
static readonly ARTICLE_COUNT_HOTS_DATA_PATH: string = "/api/rmrb-content-search/zh/c/article/count";
/**
* 客户端 客态主页页面-获取作品-从发布库获取该创作者下 稿件列表
*/
static readonly ARTICLE_LIST_HOTS_DATA_PATH: string = "/api/rmrb-content-search/zh/c/article/articleList";
/**
* 客户端 客态主页页面-获取影响力
*/
static readonly CREATOR_INFLUENCE_HOTS_DATA_PATH: string = "/api/rmrb-bigdata-bi/zh/c/stats/creator/influence/info";
/**
* 早晚报列表
* 根据页面id获取页面楼层列表
* https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/pageInfo?pageId=28927
... ... @@ -258,6 +277,10 @@ export class HttpUrlUtils {
* app启动页 兴趣偏好
*/
static readonly INTERESTS_HOTS_DATA_PATH: string = "/api/rmrb-user-center/user/zh/c/tag/queryTags";
/**
* 更新 兴趣偏好
*/
static readonly INTERESTS_UPDATETAG_PATH: string = "/api/rmrb-user-center/user/zh/c/tag/updateUserTag";
private static _hostUrl: string = HttpUrlUtils.HOST_PRODUCT;
... ... @@ -663,6 +686,11 @@ export class HttpUrlUtils {
}
static getUpdateInterestsUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.INTERESTS_UPDATETAG_PATH;
return url;
}
static getLiveDetailsUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_DETAILS_PATH
return url
... ... @@ -708,6 +736,26 @@ export class HttpUrlUtils {
return url
}
static getCreatorDetailListDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.CREATOR_DETAIL_LIST_DATA_PATH
return url
}
static getArticleCountHotsDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.ARTICLE_COUNT_HOTS_DATA_PATH
return url
}
static getArticleListHotsDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.ARTICLE_LIST_HOTS_DATA_PATH
return url
}
static getCreatorInfluenceInfoHotsDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.CREATOR_INFLUENCE_HOTS_DATA_PATH
return url
}
// static getYcgCommonHeaders(): HashMap<string, string> {
// let headers: HashMap<string, string> = new HashMap<string, string>()
//
... ...
{
"lockfileVersion": 1,
"meta": {
"stableOrder": true
},
"lockfileVersion": 3,
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": {},
"packages": {}
"specifiers": {
"wdBean@../../features/wdBean": "wdBean@../../features/wdBean",
"wdKit@../wdKit": "wdKit@../wdKit"
},
"packages": {
"wdBean@../../features/wdBean": {
"name": "wdbean",
"resolved": "../../features/wdBean",
"registryType": "local"
},
"wdKit@../wdKit": {
"name": "wdkit",
"resolved": "../wdKit",
"registryType": "local"
}
}
}
\ No newline at end of file
... ...
... ... @@ -8,6 +8,7 @@
"version": "1.0.0",
"dependencies": {
"wdKit": "file:../wdKit",
"wdBean": "file:../../features/wdBean"
"wdBean": "file:../../features/wdBean",
"wdNetwork": "file:../../commons/wdNetwork"
}
}
\ No newline at end of file
... ...
... ... @@ -50,13 +50,17 @@ export function registerRouter() {
Action2Page.register("JUMP_DETAIL_PAGE", (action: Action) => {
if (action.params?.detailPageType == 2 || action.params?.detailPageType == 6) {
if (action.params?.liveStyle === 0) {
return WDRouterPage.detailPlayLivePage
} else {
return WDRouterPage.detailPlayVLivePage
}
} else if (action.params?.detailPageType == 7 || action.params?.detailPageType == 8) {
return WDRouterPage.detailVideoListPage
}else if(action.params?.detailPageType == 9){
} else if (action.params?.detailPageType == 9) {
//图集详情页
return WDRouterPage.multiPictureDetailPage
}else if(action.params?.detailPageType == 14 || action.params?.detailPageType == 15){
} else if (action.params?.detailPageType == 14 || action.params?.detailPageType == 15) {
//动态详情页
return WDRouterPage.dynamicDetailPage
} else if (action.params?.detailPageType == 17) {
... ...
... ... @@ -14,6 +14,16 @@ export class WDRouterPage {
return `@bundle:${bundleInfo.name}/${"phone"}/${"ets/pages/MainPage"}`
}
static getLoginBundleInfo() {
let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT)
return `@bundle:${bundleInfo.name}/${"wdLogin"}/${"ets/pages/login/LoginPage"}`
}
static getSettingBundleInfo() {
let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT)
return `@bundle:${bundleInfo.name}/${"wdComponent"}/${"ets/components/page/SettingPage"}`
}
url() {
let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT)
... ... @@ -43,6 +53,7 @@ export class WDRouterPage {
static detailPlayVodPage = new WDRouterPage("wdDetailPlayVod", "ets/pages/DetailPlayVodPage");
// 直播详情页
static detailPlayLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayLivePage");
static detailPlayVLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayVLivePage");
// 多图(图集)详情页
static multiPictureDetailPage = new WDRouterPage("phone", "ets/pages/detail/MultiPictureDetailPage");
// 音乐详情页
... ... @@ -96,4 +107,8 @@ export class WDRouterPage {
static broadcastPage = new WDRouterPage("phone", "ets/pages/broadcast/BroadcastPage");
//搜索主页
static searchPage = new WDRouterPage("wdComponent", "ets/pages/SearchPage");
//搜索人民号主页
static searchCreatorPage = new WDRouterPage("wdComponent", "ets/pages/SearchCreatorPage");
//人民号主页
static peopleShipHomePage = new WDRouterPage("wdComponent", "ets/components/page/PeopleShipHomePage");
}
... ...
{
"lockfileVersion": 1,
"meta": {
"stableOrder": true
},
"lockfileVersion": 3,
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": {},
"packages": {}
"specifiers": {
"wdBean@../../features/wdBean": "wdBean@../../features/wdBean",
"wdConstant@../wdConstant": "wdConstant@../wdConstant",
"wdJsBridge@../wdJsBridge": "wdJsBridge@../wdJsBridge",
"wdKit@../wdKit": "wdKit@../wdKit",
"wdRouter@../wdRouter": "wdRouter@../wdRouter"
},
"packages": {
"wdBean@../../features/wdBean": {
"name": "wdbean",
"resolved": "../../features/wdBean",
"registryType": "local"
},
"wdConstant@../wdConstant": {
"name": "wdconstant",
"resolved": "../wdConstant",
"registryType": "local"
},
"wdJsBridge@../wdJsBridge": {
"name": "wdjsbridge",
"resolved": "../wdJsBridge",
"registryType": "local"
},
"wdKit@../wdKit": {
"name": "wdkit",
"resolved": "../wdKit",
"registryType": "local"
},
"wdRouter@../wdRouter": {
"name": "wdrouter",
"resolved": "../wdRouter",
"registryType": "local",
"dependencies": {
"wdKit": "file:../wdKit",
"wdBean": "file:../../features/wdBean"
}
}
}
}
\ No newline at end of file
... ...
... ... @@ -41,6 +41,7 @@ export function performJSCallNative(data: Message, call: Callback) {
class AppInfo {
plat: string = ''
system: string = ''
networkStatus: number = 1
// TODO 完善
}
... ... @@ -52,6 +53,7 @@ function getAppPublicInfo(): string {
info.plat = 'Phone'
// 直接用Android,后续适配再新增鸿蒙
info.system = 'Android'
info.networkStatus = 1
let result = JSON.stringify(info)
return result;
}
... ...
... ... @@ -13,6 +13,7 @@ export struct WdWebComponent {
@Prop backVisibility: boolean = false
@Prop webUrl: string = ''
@Prop @Watch('onReloadStateChanged') reload: number = 0
@Link isPageEnd: boolean
build() {
Column() {
... ... @@ -37,7 +38,6 @@ export struct WdWebComponent {
.horizontalScrollBarAccess(false)
.verticalScrollBarAccess(false)
.onPageBegin((event) => {
console.log(this.webUrl,"yzl")
this.onPageBegin(event?.url);
})
.onPageEnd((event) => {
... ... @@ -86,18 +86,19 @@ export struct WdWebComponent {
BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl)
}
onPageEnd: (url?: string) => void = () => {
this.isPageEnd = true
Logger.debug(TAG, 'onPageEnd');
}
onLoadIntercept: (url?: string) => boolean = () => {
Logger.debug(TAG, 'onLoadIntercept return false');
return false
}
onReloadStateChanged() {
Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`);
if (this.reload > 0) {
this.webviewControl.refresh()
}
}
}
... ...
... ... @@ -12,9 +12,12 @@ const TAG = 'WdWebLocalComponent';
@Component
export struct WdWebLocalComponent {
webviewControl: BridgeWebViewControl = new BridgeWebViewControl()
onWebPrepared: () => void = () => {
}
@Prop backVisibility: boolean = false
@Prop webResource: Resource = {} as Resource
@State webHeight: string | number = '100%'
@Link isPageEnd: boolean
build() {
Column() {
... ... @@ -80,7 +83,7 @@ export struct WdWebLocalComponent {
//webview 高度设置
private setCurrentPageOperate: (data: Message) => void = (data) => {
console.log("setCurrentPageOperate", JSON.stringify(data))
if (data.handlerName === H5CallNativeType.jsCall_currentPageOperate) {
if (data.handlerName === H5CallNativeType.jsCall_currentPageOperate && data?.data?.operateType === '8') {
if (typeof this.webHeight === 'number') {
if (Number(data?.data?.webViewHeight) > this.webHeight) {
this.webHeight = Number(data?.data?.webViewHeight)
... ... @@ -106,6 +109,8 @@ export struct WdWebLocalComponent {
}
onPageEnd: (url?: string) => void = () => {
Logger.debug(TAG, 'onPageEnd');
this.onWebPrepared()
this.isPageEnd = true
}
onLoadIntercept: (url?: string) => boolean = () => {
Logger.debug(TAG, 'onLoadIntercept return false');
... ...
... ... @@ -37,7 +37,8 @@ export {
postExecuteCollectRecordParams,
contentListParams,
postInteractAccentionOperateParams,
postRecommendListParams
postRecommendListParams,
contentListItem
} from './src/main/ets/bean/detail/MultiPictureDetailPageDTO';
export { InteractParam, ContentBean } from './src/main/ets/bean/content/InteractParam';
... ... @@ -122,3 +123,21 @@ export { LiveRoomBean,LiveRoomItemBean } from './src/main/ets/bean/live/LiveRoom
export { LiveRoomDataBean } from './src/main/ets/bean/live/LiveRoomDataBean';
export { LiveInfoDTO } from './src/main/ets/bean/detail/LiveInfoDTO';
export { LiveDTO } from './src/main/ets/bean/peoples/LiveDTO';
export { contentVideosDTO } from './src/main/ets/bean/content/contentVideosDTO';
export { ContentExtDTO } from './src/main/ets/bean/peoples/ContentExtDTO';
export { ContentShareDTO } from './src/main/ets/bean/peoples/ContentShareDTO';
export {
PeopleShipUserDetailData,
ArticleCountData,
ArticleTypeData,
ArticleListData,
InfluenceData
} from './src/main/ets/bean/peoples/PeopleShipUserDetailData';
... ...
... ... @@ -6,9 +6,14 @@
*/
import { appStyleImagesDTO } from '../content/appStyleImagesDTO'
import {contentVideosDTO} from '../content/contentVideosDTO'
import { VlivesDTO } from '../peoples/VlivesDTO'
import { LiveDTO } from '../peoples/LiveDTO'
import { ContentExtDTO } from '../peoples/ContentExtDTO'
import { ContentShareDTO } from '../peoples/ContentShareDTO'
export interface ArticleListDTO {
listTitle: string;
mainPicCount: string;
mainPicCount: number;
videosCount: string;
voicesCount: string;
landscape: number;
... ... @@ -20,7 +25,7 @@ export interface ArticleListDTO {
id: string;
serialsId: string;
oldContentId: string;
type: string;
type: number;
tenancy: string;
clientPubFlag: string;
grayScale: string;
... ... @@ -62,11 +67,12 @@ export interface ArticleListDTO {
joinActivity: string;
userType: string;
content: object;
contentShare: [];
contentShare: ContentShareDTO[];
contentLinkData: string;
contentExt: [];
contentExt: ContentExtDTO[];
contentVideos: contentVideosDTO[];
contentPictures: [];
appStyleVideos: contentVideosDTO[];
contentPictures: appStyleImagesDTO[];
contentPayments: string;
contentPaymentStaffs: string;
contentTxt: [];
... ... @@ -78,7 +84,7 @@ export interface ArticleListDTO {
contentStatistics: string;
topicExistHeadImage: string;
topicComps: string;
live: string;
live: LiveDTO;
statusInfo: string;
askInfo: string;
askAttachmentList: string;
... ... @@ -87,5 +93,5 @@ export interface ArticleListDTO {
ttopicInteracts: string;
ttopic: string;
mlive: string;
vlives: string
vlives: VlivesDTO[];
}
\ No newline at end of file
... ...
... ... @@ -12,4 +12,5 @@ export interface ExtraDTO extends ItemDTO {
sourcePage: string;
relId: string;
relType: string;
liveStreamType?: number
}
\ No newline at end of file
... ...
... ... @@ -21,6 +21,7 @@ export interface ContentDTO {
lengthTime?: object;
linkUrl: string;
openLikes: number;
openComment?: number;
openUrl: string;
pageId: string;
// playUrls: any[];
... ...
... ... @@ -18,5 +18,6 @@ export interface Params {
// 8.专辑竖屏详情页
// 13.音频详情页
// 17.多图(图集)详情页
detailPageType?:number; // 详情页类型
detailPageType?: number; // 详情页类型
liveStyle?: number; // 直播类型:0横屏,1竖屏
}
... ...
... ... @@ -160,7 +160,7 @@ export interface postExecuteCollectRecordParams {
contentList: postExecuteCollectRecordParamsItem[]
}
interface contentListItem {
export interface contentListItem {
contentId: string;
contentType: number;
}
... ...
export interface H5ReceiveDataExtraBean {
creatorId: string;
isLogin: string;
networkStatus: number;
loadImageOnlyWifiSwitch: string
}
\ No newline at end of file
... ...
... ... @@ -164,6 +164,7 @@ export interface LiveDetailsBean {
//迁移id
oldNewsId: string
reLInfo: ReLInfo
rmhInfo: RmhInfo
}
export interface LiveInfo {
... ... @@ -171,12 +172,15 @@ export interface LiveInfo {
liveState: string
//2024-04-12 15:00:00 直播开始时间
planStartTime: string
liveStyle: number;
vlive: Array<Vlive>
mlive:MLive
mlive: MLive
}
export interface MLive {
mliveId:string
mliveId: string
}
export interface FullColumnImgUrls {
url: string
}
... ... @@ -186,8 +190,18 @@ export interface Vlive {
liveUrl: string
//直播回看地址,多路直播录制文件URL
replayUri: string
// 画面兼容 0-横屏流画面,1-竖屏流画面(仅竖屏直播使用)【前端使用, 可能竖屏模式但是直播流画面是横屏流,前端使用该字段】
liveStreamType: number | null
}
export interface ReLInfo {
relId: string
}
export interface RmhInfo {
rmhName: string;
rmhHeadUrl: string;
rmhId: string;
userId: string;
userType: string;
}
\ No newline at end of file
... ...
export interface ContentExtDTO {
id: number;
contentId: number;
openLikes: number;
openComment: number;
openDownload: number;
likesStyle: number;
top: number;
joinActivity: number;
hotFlag: number;
preCommentFlag: number;
currentPoliticsFlag: number;
appStyle: number;
tenancy: number;
downloadFlag: number;
publishType: number;
payment: number;
deleted: number;
createUser: string;
createTime: string;
updateUser: string;
updateTime: string;
keyArticle: number;
toExamine: number;
bestNoticer: number;
commentDisplay: number;
imageQuality: number;
haveAdver: number;
openAudio: number;
withdrawNum: number;
menuShow: string;
recommendShow: string;
recommendSelf: string;
concentration: string;
objectPosId: string;
articleExistVote: number;
zhExpireTimeAi: number;
zhTagsAi: string;
appReadCountShow: number;
}
\ No newline at end of file
... ...
export interface ContentShareDTO {
id?: number;
shareSwitch: number;
contentId?: number;
sharePicture: string;
fullUrl: string;
shareTitle: string;
shareDescription: string;
}
\ No newline at end of file
... ...
export interface LiveDTO {
status: string;
previewType: number;
planStartTime: number;
tplId: number;
startTime: number;
endTime: number;
userOrigin: string;
liveStyle: number;
liveWay: number;
liveStreamType: number;
liveExperienceSwitch: boolean;
liveExperienceTime: number;
handAngleSwitch: boolean;
likeStyle: string;
liveType: string;
preDisplay: number;
playbackSwitch: boolean;
originalAddress: string;
provinceName: string;
liveRemindSwitch: boolean;
recordUrlFlag: number;
vr: number;
landscape: string;
recordUrl: string;
uri: string;
}
\ No newline at end of file
... ...
import { ArticleListDTO } from '../component/ArticleListDTO'
/**
* http://192.168.1.3:3300/project/3796/interface/api/188629
* 接口名称:客户端 客态主页页面-获取作品-从发布库获取该创作者下 稿件列表
* 接口路径:/contact/zh/c/master/detail
* 人民号-主页详情页面数据
*/
export interface PeopleShipUserDetailData {
articleCreation: number;
attentionNum: number;
authIcon: string;
authId: number;
authPersonal: string;
authTitle: string;
avatarFrame: string;
banControl: number;
browseNum: number;
categoryAuth: string;
city: string;
cnContentPublish: number;
cnIsComment: number;
cnIsLike: number;
cnLiveCommentControl: number;
cnLiveGiftControl: number;
cnLiveLikeControl: number;
cnLivePublish: number;
cnLiveShareControl: number;
cnShareControl: number;
contentPublish: number;
creatorId: string;
district: string;
dynamicControl: number;
dynamicCreation: number;
fansNum: number;
headPhotoUrl: string;
honoraryIcon: string;
honoraryTitle: string;
introduction: string;
isAttention: number;
isComment: number;
isLike: number;
liveCommentControl: number;
liveGiftControl: number;
liveLikeControl: number;
livePublish: number;
liveShareControl: number;
liveSwitch: number;
mainControl: number;
originUserId: string;
pictureCollectionCreation: number;
posterShareControl: number;
province: string;
region: string;
registTime: number;
shareControl: number;
shareUrl: string;
subjectType: number;
userId: string;
userName: string;
userType: string;
videoCollectionCreation: number;
videoCreation: number;
}
//article/count
/*
* 客户端 客态查询发布作品数量
* http://192.168.1.3:3300/project/3856/interface/api/190579
* 接口路径:/zh/c/article/count
* */
export interface ArticleCountData {
zbCount: number; //直播数量 (直播)
dtCount: number; //动态数量 (动态)
twCount: number; //图文数量 (文章)
ztCount: number; //组图数量 (图集)
spCount: number; // 视频数量 (视频)
publishCount: number; // 发布数量
serialsCount: number; //
}
export class ArticleTypeData {
name?: string; //名称
type?: number; // 类型
constructor(name?: string, type?: number) {
this.name = name;
this.type = type;
}
}
export interface ArticleListData {
totalCount: number;
pageNum: number;
pageSize: number;
list: ArticleListDTO[];
}
// 影响力
export interface InfluenceData {
creatorId: string;
influence: number;
influenceTotal: number;
}
\ No newline at end of file
... ...
export interface VlivesDTO {
id: number;
type: string;
// definition?: any;
// streamAppName?: any;
// streamName?: any;
pullStreamUrl: string;
// streamStatus?: any;
// shiftEnable?: any;
// clipEnable?: any;
// recordEnable?: any;
status: string;
liveId: number;
name: string;
// serialNum?: any;
streamWH: string;
recordUrl: string;
// playPreviewImageUri?: any;
// playPreviewImageFullUrl?: any;
// playPreviewImageBucket?: any;
showPad: boolean;
// liveStreamManagerId?: any;
// recordBucket?: any;
// recordUri?: any;
}
\ No newline at end of file
... ...
... ... @@ -63,3 +63,9 @@ export { SpacialTopicPageComponent } from './src/main/ets/components/SpacialTopi
export { LogoutViewModel } from "./src/main/ets/viewmodel/LogoutViewModel"
export { ImageSwiperComponent } from "./src/main/ets/components/ImageSwiperComponent"
export { newsSkeleton } from "./src/main/ets/components/skeleton/newsSkeleton"
export { LiveCommentComponent } from "./src/main/ets/components/comment/view/LiveCommentComponent"
... ...
... ... @@ -6,8 +6,11 @@
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": {
"@ohos/axios@^2.1.1": "@ohos/axios@2.2.0",
"@ohos/lottie@2.0.0": "@ohos/lottie@2.0.0",
"wdBean@../wdBean": "wdBean@../wdBean",
"wdConstant@../../commons/wdConstant": "wdConstant@../../commons/wdConstant",
"wdDetailPlayApi@../wdDetailPlayApi": "wdDetailPlayApi@../wdDetailPlayApi",
"wdDetailPlayShortVideo@../wdDetailPlayShortVideo": "wdDetailPlayShortVideo@../wdDetailPlayShortVideo",
"wdJsBridge@../../commons/wdJsBridge": "wdJsBridge@../../commons/wdJsBridge",
"wdKit@../../commons/wdKit": "wdKit@../../commons/wdKit",
"wdLogin@../wdLogin": "wdLogin@../wdLogin",
... ... @@ -23,6 +26,12 @@
"resolved": "https://repo.harmonyos.com/ohpm/@ohos/axios/-/axios-2.2.0.har",
"registryType": "ohpm"
},
"@ohos/lottie@2.0.0": {
"name": "@ohos/lottie",
"integrity": "sha512-jFEFYfuqGO323aMiwtzHmDGRJI0qTxjZD2Lzbn+LxRdoHSfu5OVu22I8gVm5ej019tCw3WOk547NHZ2GuWiNSg==",
"resolved": "https://repo.harmonyos.com/ohpm/@ohos/lottie/-/lottie-2.0.0.har",
"registryType": "ohpm"
},
"wdBean@../wdBean": {
"name": "wdbean",
"resolved": "../wdBean",
... ... @@ -33,6 +42,32 @@
"resolved": "../../commons/wdConstant",
"registryType": "local"
},
"wdDetailPlayApi@../wdDetailPlayApi": {
"name": "wddetailplayapi",
"resolved": "../wdDetailPlayApi",
"registryType": "local",
"dependencies": {
"wdPlayer": "file:../../features/wdPlayer",
"wdKit": "file:../../commons/wdKit",
"wdBean": "file:../../features/wdBean",
"wdRouter": "file:../../commons/wdRouter",
"wdNetwork": "file:../../commons/wdNetwork"
}
},
"wdDetailPlayShortVideo@../wdDetailPlayShortVideo": {
"name": "wddetailplayshortvideo",
"resolved": "../wdDetailPlayShortVideo",
"registryType": "local",
"dependencies": {
"@ohos/lottie": "2.0.0",
"wdPlayer": "file:../../features/wdPlayer",
"wdKit": "file:../../commons/wdKit",
"wdBean": "file:../../features/wdBean",
"wdRouter": "file:../../commons/wdRouter",
"wdNetwork": "file:../../commons/wdNetwork",
"wdDetailPlayApi": "file:../../features/wdDetailPlayApi"
}
},
"wdJsBridge@../../commons/wdJsBridge": {
"name": "wdjsbridge",
"resolved": "../../commons/wdJsBridge",
... ...
import { Logger } from 'wdKit';
import { AccountManagerUtils, Logger } from 'wdKit';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { ContentDetailDTO } from 'wdBean';
import { ContentDetailDTO,batchLikeAndCollectResult,batchLikeAndCollectParams,postBatchAttentionStatusParams,
PhotoListBean,
ContentDTO, } from 'wdBean';
import media from '@ohos.multimedia.media';
import { OperRowListView } from './view/OperRowListView';
import { WDPlayerController } from 'wdPlayer/Index';
import { ContentConstants } from '../constants/ContentConstants';
import { ProcessUtils } from '../utils/ProcessUtils';
const TAG = 'DynamicDetailComponent'
@Preview
... ... @@ -19,8 +23,11 @@ export struct DynamicDetailComponent {
/**
* 默认未关注 点击去关注
*/
private followStatus: boolean = false;
private followStatus: String = '0';
@State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
//跳转
private mJumpInfo: ContentDTO = {} as ContentDTO;
async aboutToAppear() {
await this.getContentDetailData()
... ... @@ -35,63 +42,63 @@ export struct DynamicDetailComponent {
//logo、日期
Row() {
Image($r('app.media.ic_article_rmh'))
.width(80)
.height(28)
.margin({ left: 16 })
.width($r('app.float.margin_80'))
.height($r('app.float.margin_28'))
.margin({ left: $r('app.float.margin_16') })
Blank()
Text("2023年03月14日 08:16")
.fontColor($r('app.color.color_B0B0B0'))
.fontSize(12)
.lineHeight(28)
.margin({ right: 16 })
.fontSize($r('app.float.font_size_12'))
.lineHeight($r('app.float.margin_28'))
.margin({ right: $r('app.float.margin_16') })
}
.height(48)
.height($r('app.float.margin_48'))
.width('100%')
//分割线
Image($r('app.media.ic_news_detail_division'))
.width('100%')
.height(7)
.margin({left: 16, right: 16} )
.height($r('app.float.margin_7'))
.margin({left: $r('app.float.margin_16'), right: $r('app.float.margin_16')} )
//号主信息
Row() {
//头像
Stack() {
Image(this.contentDetailData.rmhInfo?.rmhHeadUrl)
.alt(this.contentDetailData.rmhInfo?.userType=='1'?$r('app.media.default_head'):$r('app.media.icon_default_head_mater'))
.width('32')
.height('32')
.width($r('app.float.margin_32'))
.height($r('app.float.margin_32'))
.objectFit(ImageFit.Cover)
.borderRadius(16)
.borderRadius($r('app.float.margin_16'))
Image($r('app.media.icon_border_test'))
.width('48')
.height('48')
.width($r('app.float.margin_48'))
.height($r('app.float.margin_48'))
.objectFit(ImageFit.Cover)
.borderRadius(24)
.borderRadius($r('app.float.margin_24'))
}
.width(48)
.height(48)
.width($r('app.float.margin_48'))
.height($r('app.float.margin_48'))
.alignContent(Alignment.Center)
Column(){
//昵称
Text("this.contentDetailData.rmhInfo?.rmhName")
.fontSize(14)
.fontSize($r('app.float.font_size_14'))
.fontColor($r('app.color.color_222222'))
.fontWeight(FontWeight.Medium)
.margin({ left: 5 })
.margin({ left: $r('app.float.margin_5') })
//简介
Text("this.contentDetailData.rmhInfo?.rmhDesc")
.fontSize(14)
.fontSize($r('app.float.font_size_14'))
.fontColor($r('app.color.color_B0B0B0'))
.fontWeight(FontWeight.Medium)
.margin({ left: 5 })
.margin({ left: $r('app.float.margin_5') })
}
if (!this.followStatus) {
if (this.followStatus == '0') {
Text('关注')
.width(60)
.height(24)
.height($r('app.float.margin_48'))
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
.borderRadius($r('app.float.button_border_radius'))
.borderRadius($r('app.float.vp_3'))
.backgroundColor($r('app.color.color_ED2800'))
.fontColor($r('app.color.color_fff'))
.onClick(() => {
... ... @@ -99,12 +106,12 @@ export struct DynamicDetailComponent {
})
} else {
Text('已关注')
.width(60)
.height(24)
.width($r('app.float.margin_60'))
.height($r('app.float.margin_48'))
.borderWidth(1)
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
.borderRadius($r('app.float.button_border_radius'))
.borderRadius($r('app.float.vp_3'))
.borderColor($r('app.color.color_CCCCCC'))
.fontColor($r('app.color.color_CCCCCC'))
.onClick(() => {
... ... @@ -113,17 +120,325 @@ export struct DynamicDetailComponent {
}
}
.width('100%')
//内容
Text("这里展示标题这里展示标题这里展示标题这里这里展示标题这里展示标题这里展示标题这里这里展示标题这里展示标题这里展示标题这里")
.fontColor($r('app.color.color_222222'))
.fontSize($r('app.float.font_size_18'))
.lineHeight($r('app.float.margin_25'))
.margin({ top: $r('app.float.margin_6')
,left: $r('app.float.margin_16')
,right: $r('app.float.margin_16') })
if(this.contentDetailData.photoList!= null && this.contentDetailData.photoList.length>0){
//附件内容:图片/视频
if(this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN){
GridRow({
columns: { sm: this.contentDetailData.photoList.length
, md: this.contentDetailData.photoList.length == 1?1:
this.contentDetailData.photoList.length == 4?2:
3 },
breakpoints: { value: ['320vp', '520vp', '840vp'] }
}) {
ForEach(this.contentDetailData.photoList, (item: PhotoListBean, index: number) => {
GridCol() {
this.buildItemCard(this.contentDetailData.photoList[index],this.contentDetailData.photoList.length, index);
}
})
}
}else{
//附件内容:视频,只有一个
ForEach(this.contentDetailData.photoList, (item: PhotoListBean, index: number) => {
GridCol() {
this.buildItemCard(this.contentDetailData.photoList[index],this.contentDetailData.photoList.length, index);
}
})
}
}
//特别声明
Text("特别声明:本文为人民日报新媒体平台“人民号”作者上传并发布,仅代表作者观点。人民日报仅提供信息发布平台。")
.fontColor($r('app.color.color_CCCCCC'))
.fontSize($r('app.float.font_size_12'))
.lineHeight($r('app.float.margin_16'))
.margin({ top: $r('app.float.margin_16')
,left: $r('app.float.margin_16')
,right: $r('app.float.margin_16') })
//微信/朋友圈/微博
Row(){
Image($r('app.media.xxhdpi_pic_wechat'))
.width($r('app.float.margin_116'))
.height($r('app.float.margin_36'))
.objectFit(ImageFit.Cover)
Image($r('app.media.xxhdpi_pic_pyq'))
.width($r('app.float.margin_116'))
.height($r('app.float.margin_36'))
.margin({ left: $r('app.float.margin_4_negative')})
.objectFit(ImageFit.Cover)
Image($r('app.media.xxhdpi_pic_wb'))
.width($r('app.float.margin_116'))
.height($r('app.float.margin_36'))
.margin({ left: $r('app.float.margin_4_negative')})
.objectFit(ImageFit.Cover)
}
.margin({ top: $r('app.float.margin_24')})
//点赞
Row(){
Image($r('app.media.icon_like_selected_redheart'))
.width($r('app.float.margin_24'))
.height($r('app.float.margin_24'))
.objectFit(ImageFit.Cover)
Text("2.6万")
.fontColor($r('app.color.color_999999'))
.fontSize($r('app.float.font_size_16'))
.lineHeight($r('app.float.margin_20'))
.margin({ left: $r('app.float.margin_2')})
}
//评论组件/底部组件
}
}
.backgroundColor('#FFFFFFFF')
}
/**
* 请求(动态)详情页数据
* */
private async getContentDetailData() {
try {
let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType)
this.contentDetailData = data[0];
this.makeJumpInfo
console.log('动态详情',JSON.stringify(this.contentDetailData))
} catch (exception) {
console.log('请求失败',JSON.stringify(exception))
}
this.getBatchAttentionStatus
this.getInteractDataStatus
}
// 查询当前登录用户点赞状态
private async getInteractDataStatus() {
//未登录
if(!AccountManagerUtils.isLoginSync() || this.contentDetailData?.openLikes != 1){
return
}
try {
const params: batchLikeAndCollectParams = {
contentList: [
{
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType + '',
}
]
}
console.error(TAG, JSON.stringify(this.contentDetailData))
let data = await MultiPictureDetailViewModel.getInteractDataStatus(params)
console.error(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data))
this.newsStatusOfUser = data[0];
Logger.info(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`)
} catch (exception) {
console.error(TAG, JSON.stringify(exception))
}
}
/**
* 查询当前登录用户是否关注作品号主
* */
private async getBatchAttentionStatus() {
try {
const params: postBatchAttentionStatusParams = {
creatorIds: [{ creatorId: this.contentDetailData?.rmhInfo?.rmhId ?? '' }]
}
let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params)
this.followStatus = data[0]?.status;
Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`)
} catch (exception) {
}
}
@Builder
setItemImageStyle(picPath: string,topLeft: number,topRight: number,bottomLeft: number,bottomRight: number){
//四角圆角
Image(picPath)
.width(44).aspectRatio(1 / 1).margin(16).borderRadius({topLeft: topLeft, topRight: topRight, bottomLeft: bottomLeft, bottomRight: bottomRight})
}
/**
* 组件项
*
* @param programmeBean item 组件项, 上面icon,下面标题
*/
@Builder
buildItemCard(item: PhotoListBean,len: number,index: number) {
Column() {
this.setItemImageRoundCorner(len, item, index)
Flex({ direction: FlexDirection.Row }) {
Image($r('app.media.icon_long_pic'))
.width(14)
.height(14)
.margin({right: 4})
Text('长图')
.fontSize(12)
.fontWeight(400)
.fontColor(0xffffff)
.fontFamily('PingFang SC')
}
.width(48)
.padding({bottom: 9})
}
.width('100%')
.onClick((event: ClickEvent) => {
if(this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN){
//fixme 跳转到查看图片页面(带页脚/下载按钮)
// this.mJumpInfo.objectType = ContentConstants.TYPE_
ProcessUtils.processPage(this.mJumpInfo)
}else{
//fixme 跳转到播放视频页面(点播)
this.mJumpInfo.objectType = ContentConstants.TYPE_VOD
ProcessUtils.processPage(this.mJumpInfo)
}
})
}
//创建跳转信息
makeJumpInfo(){
this.mJumpInfo.pageId = 'dynamicDetailPage';
// this.mJumpInfo.from = 'dynamicDetailPage';
this.mJumpInfo.objectId = this.contentDetailData.newsId+"";
this.mJumpInfo.relType = this.contentDetailData.reLInfo?.relType+"";
this.mJumpInfo.relId = this.contentDetailData.reLInfo?.relId+"";
}
//设置图片圆角
@Builder
setItemImageRoundCorner(len: number, item: PhotoListBean, index: number) {
if (len == 1) {
//四角圆角
this.setItemImageStyle(item.picPath, 4, 4, 4, 4);
} else if (len == 2) {
if (index == 0) {
//左边圆角
this.setItemImageStyle(item.picPath, 4, 0, 4, 0);
} else {
//右边圆角
this.setItemImageStyle(item.picPath, 0, 4, 0, 4);
}
} else if (3 == len) {
if (index == 0) {
//左边圆角
this.setItemImageStyle(item.picPath, 4, 0, 4, 0);
} else if (index == 1) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else {
//右边圆角
this.setItemImageStyle(item.picPath, 0, 4, 0, 4);
}
} else if (4 == len) {
if (index == 0) {
//左边圆角
this.setItemImageStyle(item.picPath, 4, 0, 4, 0);
} else if (index == 1) {
//右边圆角
this.setItemImageStyle(item.picPath, 0, 4, 0, 4);
} else if (index = 2) {
//左边圆角
this.setItemImageStyle(item.picPath, 4, 0, 4, 0);
} else {
//右边圆角
this.setItemImageStyle(item.picPath, 0, 4, 0, 4);
}
} else if (5 == len) {
if (index == 0) {
this.setItemImageStyle(item.picPath, 4, 0, 0, 0);
} else if (index == 1) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index = 2) {
this.setItemImageStyle(item.picPath, 4, 4, 4, 4);
} else if (index = 3) {
this.setItemImageStyle(item.picPath, 0, 0, 4, 0);
} else {
this.setItemImageStyle(item.picPath, 0, 0, 0, 4);
}
} else if (6 == len) {
if (index == 0) {
this.setItemImageStyle(item.picPath, 4, 0, 0, 0);
} else if (index == 1) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index = 2) {
this.setItemImageStyle(item.picPath, 0, 4, 0, 0);
} else if (index = 3) {
this.setItemImageStyle(item.picPath, 0, 0, 4, 0);
} else if (index = 4) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else {
//右边圆角
this.setItemImageStyle(item.picPath, 0, 0, 0, 4);
}
} else if (7 == len) {
if (index == 0) {
this.setItemImageStyle(item.picPath, 4, 0, 0, 0);
} else if (index == 1) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index = 2) {
this.setItemImageStyle(item.picPath, 0, 4, 0, 0);
} else if (index = 3) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index = 4) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index = 5) {
this.setItemImageStyle(item.picPath, 0, 0, 0, 4);
} else {
this.setItemImageStyle(item.picPath, 0, 0, 4, 4);
}
} else if (8 == len) {
if (index == 0) {
this.setItemImageStyle(item.picPath, 4, 0, 0, 0);
} else if (index == 1) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index = 2) {
this.setItemImageStyle(item.picPath, 0, 4, 0, 0);
} else if (index = 3) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index = 4) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index = 5) {
this.setItemImageStyle(item.picPath, 0, 0, 0, 4);
} else if (index = 6) {
this.setItemImageStyle(item.picPath, 0, 0, 4, 0);
} else {
this.setItemImageStyle(item.picPath, 0, 0, 0, 4);
}
} else {
if (index == 0) {
this.setItemImageStyle(item.picPath, 4, 0, 0, 0);
} else if (index == 1) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index == 2) {
this.setItemImageStyle(item.picPath, 0, 4, 0, 0);
} else if (index == 3) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index == 4) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index == 5) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index == 6) {
this.setItemImageStyle(item.picPath, 0, 0, 4, 0);
} else if (index == 7) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else {
this.setItemImageStyle(item.picPath, 0, 0, 0, 4);
}
}
}
}
\ No newline at end of file
... ...
... ... @@ -2,6 +2,7 @@ import { Action, NewspaperListItemBean, NewspaperPositionItemBean, Params } from
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';
import { StringUtils } from 'wdKit';
import { WDRouterRule } from 'wdRouter';
import { newsSkeleton } from './skeleton/newsSkeleton';
@Component
export struct ENewspaperItemComponent {
... ... @@ -11,13 +12,20 @@ export struct ENewspaperItemComponent {
private startX: number = 0
private startY: number = 0
private itemBeanClicked: NewspaperPositionItemBean = {} as NewspaperPositionItemBean
@State isShowSkeleton: boolean = true
build() {
Stack() {
newsSkeleton()
.visibility(this.isShowSkeleton ? Visibility.Visible : Visibility.None)
Image(this.newspaperListItemBean.pagePic)
.width('100%')
.aspectRatio(378 / 566)
.objectFit(ImageFit.Fill)
.onComplete(() => {
this.isShowSkeleton = false
})
.visibility(this.isShowSkeleton ? Visibility.None : Visibility.Visible)
Canvas(this.context)
.width('100%')
... ... @@ -62,7 +70,7 @@ export struct ENewspaperItemComponent {
pageID: 'IMAGE_TEXT_DETAIL',
extra: {
relType: this.itemBeanClicked.relType ?? '',
relId: ''+this.itemBeanClicked.relId,
relId: '' + this.itemBeanClicked.relId,
sourcePage: '5'
} as ExtraDTO
} as Params,
... ...
... ... @@ -110,11 +110,11 @@ export struct ENewspaperPageComponent {
})
Row() {
Text(this.calendarDate)
Text(this.calendarDate?.replace('-', '.')?.replace('-', '.'))
.fontSize($r('app.float.font_size_20'))
.fontColor($r('app.color.white'))
.fontFamily('BebasNeue_Regular')
.fontWeight(FontWeight.Bold)
.fontWeight(FontWeight.Regular)
Image($r('app.media.icon_triangle'))
.width($r('app.float.border_radius_6'))
... ... @@ -167,6 +167,7 @@ export struct ENewspaperPageComponent {
.autoPlay(false)
.cachedCount(3)
.indicator(false)
.loop(false)
.displayCount(1)
.margin({ top: 35, left: 10, right: 10 })
.id('e_newspaper_content')
... ... @@ -191,12 +192,13 @@ export struct ENewspaperPageComponent {
.id('e_newspaper_shadow')
Row() {
Text('滑动查看下一版')
Text(this.swiperIndex + 1 == this.newspaperListBean?.list?.length ? '已到底部,可以选择其他日期' : '滑动查看下一版')
.fontColor(Color.White)
.fontSize($r('app.float.font_size_14'))
Image($r('app.media.icon_next_page'))
.width($r('app.float.vp_16'))
.height($r('app.float.vp_16'))
.visibility(this.swiperIndex + 1 == this.newspaperListBean?.list?.length ? Visibility.None : Visibility.Visible)
}
.justifyContent(FlexAlign.Center)
.margin({ top: $r('app.float.margin_16') })
... ...
... ... @@ -19,6 +19,7 @@ import { HttpUrlUtils } from 'wdNetwork/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { PageRepository } from '../repository/PageRepository';
import { detailedSkeleton } from './skeleton/detailSkeleton'
const TAG = 'ImageAndTextPageComponent'
... ... @@ -30,8 +31,13 @@ export struct ImageAndTextPageComponent {
@State recommendList: ContentDTO[] = []
@State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
@State interactData: InteractDataDTO = {} as InteractDataDTO
@State isPageEnd: boolean = false
build() {
Column() {
if (!this.isPageEnd) {
detailedSkeleton()
} else {
// 发布时间
Row() {
Image($r('app.media.icon_ren_min_ri_bao'))
... ... @@ -58,13 +64,16 @@ export struct ImageAndTextPageComponent {
}
.padding({ left: 15, right: 15 })
.backgroundColor(Color.White)
}
Stack({ alignContent: Alignment.Bottom }) {
Scroll(this.scroller) {
Column() {
ImageAndTextWebComponent({
contentDetailData: this.contentDetailData,
action: this.action
action: this.action,
isPageEnd: $isPageEnd
})
Column() {
if (this.recommendList.length > 0) {
... ... @@ -77,7 +86,7 @@ export struct ImageAndTextPageComponent {
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.padding({ bottom: 76 })
// .scrollBar(BarState.Off)
.scrollBar(BarState.Off)
//底部交互区
Row() {
... ... @@ -122,138 +131,6 @@ export struct ImageAndTextPageComponent {
.height(CommonConstants.FULL_HEIGHT)
}
// build() {
// Column() {
// // 发布时间
// Row() {
// Image($r('app.media.icon_ren_min_ri_bao'))
// .width(70)
// .height(28)
// Text(this.contentDetailData[0]?.publishTime)
// .fontColor($r('app.color.color_B0B0B0'))
// .fontSize($r('app.float.font_size_13'))
// .height('100%')
// .align(Alignment.End)
// }
// .width(CommonConstants.FULL_WIDTH)
// .height(32)
// .padding({ left: 15, right: 15, })
// .justifyContent(FlexAlign.SpaceBetween)
// .backgroundColor(Color.White)
//
// Row() {
// Image($r('app.media.line'))
// .width('100%')
// .height(6)
// .objectFit(ImageFit.Cover)
// .margin({ top: 10 })
// }
// .padding({ left: 15, right: 15, })
// .backgroundColor(Color.White)
//
// Stack({ alignContent: Alignment.Bottom }) {
//
// List() {
// //详情展示区
// ListItem() {
// Column() {
// ImageAndTextWebComponent({
// contentDetailData: this.contentDetailData,
// action: this.action,
// })
// }.width(CommonConstants.FULL_WIDTH)
// // .height(CommonConstants.FULL_HEIGHT)
// }
//
// if (this.contentDetailData[0]?.openLikes === 1) {
// ListItem() {
// // 点赞
// Row() {
// Row() {
// if (this.newsStatusOfUser?.likeStatus === '1') {
// Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.ic_like_check') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer_active') : $r('app.media.icon_candle_active')))
// .width(24)
// .height(24)
// .margin({ right: 5 })
// } else {
// Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.icon_like') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer') : $r('app.media.icon_candle')))
// .width(24)
// .height(24)
// .margin({ right: 5 })
// }
// Text(`${this.interactData?.likeNum || 0}`)
// .fontSize(16)
// .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999')
// .fontWeight(500)
// }.alignItems(VerticalAlign.Center)
// .onClick(() => {
// this.toggleLikeStatus()
// })
//
// }.width(CommonConstants.FULL_WIDTH).height(80)
// .justifyContent(FlexAlign.Center)
// }
// .border({
// width: { bottom: 5 },
// color: '#f5f5f5',
// })
// }
//
// // 相关推荐区
// ListItem() {
// RecommendList({ recommendList: this.recommendList })
// }
// }
// .width(CommonConstants.FULL_WIDTH)
// .height(CommonConstants.FULL_HEIGHT)
// .padding({ bottom: 56 })
// .scrollBar(BarState.Off)
// .edgeEffect(EdgeEffect.None)
//
// //底部交互区
// Row() {
// Image($r('app.media.icon_arrow_left'))
// .width(24)
// .height(24)
// .onClick((event: ClickEvent) => {
// router.back()
// })
//
// Row() {
// Image($r('app.media.icon_comment'))
// .width(24)
// .height(24)
// .margin({ right: 24 })
// .id('comment')
//
// Image($r('app.media.icon_star'))
// .width(24)
// .height(24)
// .margin({ right: 24 })
//
// Image($r('app.media.icon_listen'))
// .width(24)
// .height(24)
// .margin({ right: 24 })
//
// Image($r('app.media.icon_forward'))
// .width(24)
// .height(24)
//
// }
// }
// .width(CommonConstants.FULL_WIDTH)
// .height(56)
// .padding({ left: 15, right: 15, bottom: 50, top: 20 })
// .justifyContent(FlexAlign.SpaceBetween)
// .backgroundColor(Color.White)
// }
//
// }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
// .backgroundColor(Color.White)
//
// }
private async getDetail() {
let contentId: string = ''
let relId: string = ''
... ...
... ... @@ -15,8 +15,12 @@ import { BridgeWebViewControl } from 'wdJsBridge/Index';
export struct ImageAndTextWebComponent {
action: Action = {} as Action
@State reload: number = 0;
@Link isPageEnd: boolean
@Prop @Watch('onDetailDataUpdated') contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO []
webviewControl: BridgeWebViewControl = new BridgeWebViewControl()
private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean
private webPrepared = false;
private dataPrepared = false;
onDetailDataUpdated() {
if (this.action) {
... ... @@ -50,9 +54,14 @@ export struct ImageAndTextWebComponent {
}
let h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean
// TODO 对接user信息、登录情况
let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = { creatorId: '', isLogin: '0' } as H5ReceiveDataExtraBean
let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = {
creatorId: '',
isLogin: '0',
networkStatus: 1,
loadImageOnlyWifiSwitch: '2',
} as H5ReceiveDataExtraBean
let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = {
contentId: contentId,
contentType: contentType
... ... @@ -67,12 +76,10 @@ export struct ImageAndTextWebComponent {
response.code = 200
response.success = true
h5ReceiveDataJsonBean.responseMap = response
h5ReceiveAppData.dataJson = h5ReceiveDataJsonBean
h5ReceiveAppData.dataExt = h5ReceiveDataExtraBean
// TODO 暂延时1s,考虑业务流程再优化
setTimeout(() => {
this.sendContentData2H5(h5ReceiveAppData);
}, 2000)
this.h5ReceiveAppData.dataJson = h5ReceiveDataJsonBean
this.h5ReceiveAppData.dataExt = h5ReceiveDataExtraBean
this.dataPrepared = true
this.trySendData2H5()
}
... ... @@ -84,10 +91,26 @@ export struct ImageAndTextWebComponent {
webviewControl: this.webviewControl,
webResource: $rawfile('apph5/index.html'),
backVisibility: false,
onWebPrepared: this.onWebPrepared.bind(this),
isPageEnd: $isPageEnd
})
}
}
private trySendData2H5() {
if (!this.webPrepared || !this.dataPrepared) {
return
}
// 数据、web组件,都准备好了,开始塞详情数据
this.sendContentData2H5(this.h5ReceiveAppData)
}
private onWebPrepared() {
this.webPrepared = true
this.trySendData2H5()
}
private sendContentData2H5(h5ReceiveAppData: H5ReceiveDetailBean) {
Logger.debug('ImageAndTextWebComponent', 'jsCall_receiveAppData');
this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData,
... ...
import { PhotoListBean } from 'wdBean/Index';
import { Logger } from 'wdKit/Index';
import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent';
import { display } from '@kit.ArkUI';
const TAG = 'ImageSwiperComponent';
@Component
export struct ImageSwiperComponent {
@Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01'
private scroller: Scroller = new Scroller()
@State swiperIndex: number = 0;
photoList: PhotoListBean[] = [];
private swiperController: SwiperController = new SwiperController()
private displayTool = display.getDefaultDisplaySync()
private screenWidth: number = 0
private picWidth: number = 0
@State picHeight: number = 0
//watch监听页码回调
onCurrentPageNumUpdated(): void {
Logger.info(TAG, `currentPageNum:${this.currentPageNum}`,)
let _swiperIndex = Number.parseInt(this.currentPageNum)
Logger.info(TAG, `_swiperIndex:${_swiperIndex}`)
this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex
}
aboutToAppear(): void {
//获取宽高尺寸
this.screenWidth = this.displayTool.width
// this.picWidth = this.screenWidth - vp2px(52)
this.picWidth = this.screenWidth
this.picHeight = this.picWidth * 578 / 375
}
build() {
RelativeContainer() {
if (this.photoList && this.photoList?.length > 0) {
Swiper(this.swiperController) {
ForEach(this.photoList, (item: PhotoListBean) => {
MultiPictureDetailItemComponent({ MultiPictureDetailItem: item })
})
}
.index(this.swiperIndex)
.width('100%')
.height(px2vp(this.picHeight) + 32)
.vertical(false)
.autoPlay(false)
.cachedCount(3)
.indicator(false)
.displayCount(1)
.id('e_swiper_content')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.onChange((index: number) => {
this.swiperIndex = index
})
Row() {
Scroll(this.scroller) {
Row() {
Flex({
direction: FlexDirection.Column,
justifyContent: FlexAlign.Start
}) {
Text() {
Span(`${this.swiperIndex + 1}`)
.fontSize(24)
.fontFamily('PingFang SC-Medium')
.fontWeight(500)
.lineHeight(28)
Span(`/${this.photoList.length}`)
.fontSize(14)
.fontFamily('PingFang SC-Medium')
.fontWeight(500)
.lineHeight(19)
}.fontColor(Color.White).margin(4)
}
}
.width('100%')
.margin({
top: 8,
left: 18,
bottom: 24,
right: 18
})
}
.scrollable(ScrollDirection.Vertical)
.scrollBarWidth(0)
}
.id('e_swiper_titles')
.alignRules({
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
}
}
.width('100%')
.height('100%')
.backgroundColor(Color.Black)
.id('e_picture_container')
// 设置顶部绘制延伸到状态栏
// 设置底部绘制延伸到导航条
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
}
}
\ No newline at end of file
... ...
... ... @@ -4,6 +4,7 @@ import { WdWebComponent } from 'wdWebComponent';
import router from '@ohos.router';
import { CommonConstants } from 'wdConstant'
import { BridgeWebViewControl } from 'wdJsBridge/Index';
import { detailedSkeleton } from './skeleton/detailSkeleton'
const TAG = 'SpacialTopicPageComponent'
... ... @@ -13,14 +14,20 @@ export struct SpacialTopicPageComponent {
scroller: Scroller = new Scroller();
action: Action = {} as Action
@State webUrl: string = '';
@State isPageEnd: boolean = false
build() {
Column() {
if (!this.isPageEnd) {
detailedSkeleton()
}
Stack({ alignContent: Alignment.Bottom }) {
Column() {
WdWebComponent({
webviewControl: this.webviewControl,
webUrl: this.webUrl,
backVisibility: false,
isPageEnd:$isPageEnd
})
}
.padding({ bottom: 56 })
... ... @@ -64,6 +71,8 @@ export struct SpacialTopicPageComponent {
.padding({ left: 15, right: 15, bottom: 20, top: 20 })
.justifyContent(FlexAlign.SpaceBetween)
.backgroundColor(Color.White)
}
}.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
.backgroundColor(Color.White)
... ...
import { router } from '@kit.ArkUI'
import { NumberFormatterUtils, ToastUtils } from 'wdKit/Index'
@Component
export struct LiveCommentComponent {
public clickCollect?: (isCollect: boolean) => void
public clickHeart?: (isHeart: boolean) => void
@State isCollect: boolean = false
@State isLike: boolean = false
@State heartNum: number = 0
build() {
Row() {
Image($r('app.media.back_icon'))
.width(24)
.height(24)
.margin({
left: 16,
right: 12
})
.onClick(() => {
router.back()
})
Stack() {
Image($r('app.media.background_search'))
.interpolation(ImageInterpolation.High)
.width('100%')
.height(30)
TextArea({ placeholder: '说两句...' })
.backgroundColor(Color.Transparent)
.enabled(false)
.margin({
left: 5,
right: 20
})
}
.layoutWeight(1)
.onClick(() => {
ToastUtils.shortToast('依赖其它功能开发')
})
Image(this.isCollect ? $r('app.media.ic_collect_check') : $r('app.media.iv_live_comment_collect_un'))
.width(24)
.height(24)
.margin({
left: 20,
right: 24
})
.onClick(() => {
this.isCollect = !this.isCollect
})
Image($r('app.media.iv_live_comment_share'))
.width(24)
.height(24)
.onClick(() => {
ToastUtils.shortToast('依赖其它功能开发')
})
Stack() {
Text(NumberFormatterUtils.formatNumberWithWan(this.heartNum))
.height(12)
.fontSize('8fp')
.fontWeight(500)
.fontColor(Color.White)
.backgroundImage($r('app.media.iv_live_comment_hert_num'))
.backgroundImageSize(ImageSize.Cover)
.margin({
left: 6,
bottom: 33
})
.padding({
left: 6,
right: 2
})
Image(this.isLike ? $r('app.media.iv_live_comment_hert_light') : $r('app.media.comment_like_normal'))
.width(24)
.height(24)
.margin({
right: 20,
})
}
.width(44)
.height(56)
.margin({
left: 24
})
.onClick(() => {
this.isLike = !this.isLike
})
}
.height(56)
.width('100%')
.backgroundColor(Color.White)
}
}
\ No newline at end of file
... ...
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { CollectionUtils, DateTimeUtils, Logger, StringUtils, ToastUtils } from 'wdKit/Index';
import PageViewModel from '../../viewmodel/PageViewModel';
const TAG = 'Zh_Grid_Layout-02';
const FULL_PARENT: string = '100%';
... ... @@ -11,19 +13,28 @@ let listSize: number = 2;
* Zh_Grid_Layout-02
*
*/
@Preview
@Component
export struct ZhGridLayout02 {
@State compDTO: CompDTO = {} as CompDTO
@State operDataList: ContentDTO[] = []
currentPage = 1
pageSize = 12
aboutToAppear() {
if (this.compDTO.operDataList) {
listSize = this.compDTO.operDataList.length > 5 ? 2 : this.compDTO.operDataList.length;
}
Logger.debug(TAG, 'aboutToAppear ' + this.compDTO.objectTitle)
this.currentPage = 1
PageViewModel.getLiveReviewUrl(this.currentPage, this.pageSize).then((liveReviewDTO) => {
this.operDataList = []
this.operDataList.push(...liveReviewDTO.list)
})
}
build() {
Column() {
Scroll() {
Column() {
Row() {
Image($r("app.media.redLine"))
.width(3)
... ... @@ -38,19 +49,40 @@ export struct ZhGridLayout02 {
.margin({ top: 8, bottom: 8 })
.width(CommonConstants.FULL_WIDTH)
GridRow({
columns: { sm: listSize, md: 2 },
breakpoints: { value: ['320vp', '520vp', '840vp'] }
}) {
ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {
ForEach(this.operDataList, (item: ContentDTO, index: number) => {
GridCol() {
this.buildItemCard(this.compDTO.operDataList[index]);
this.buildItemCard(item);
}
})
}
}
}
.width("100%")
.height("100%")
// .layoutWeight(1)
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.onReachStart(() => {
Logger.debug(TAG, 'onReachStart')
})
.onReachEnd(() => {
Logger.debug(TAG, 'onReachEnd')
this.addItems()
})
.nestedScroll({
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
}
.width(CommonConstants.FULL_WIDTH)
// .width("100%")
.height("100%")
// .layoutWeight(1)
.padding({
top: 14,
left: 16,
... ... @@ -78,6 +110,15 @@ export struct ZhGridLayout02 {
}
.width('100%')
}
addItems() {
Logger.debug(TAG, 'addItems')
this.currentPage++
PageViewModel.getLiveReviewUrl(this.currentPage, this.pageSize).then((liveReviewDTO) => {
this.operDataList.push(...liveReviewDTO.list)
Logger.debug(TAG, 'addItems after: ' + this.operDataList.length)
})
}
}
... ...
... ... @@ -56,6 +56,9 @@ export struct ZhGridLayout03 {
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
.width('100%')
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(item)
})
}
}
... ...
... ... @@ -16,7 +16,7 @@ export default struct MinePageMoreFunctionUI {
.fontColor($r('app.color.color_666666'))
.fontSize('29lpx')
.margin({ left: "31lpx" })
.fontWeight(600)
.fontWeight('600lpx')
}.height('92lpx')
.width('100%')
.justifyContent(FlexAlign.Center)
... ...
import { WDRouterRule, WDRouterPage } from 'wdRouter'
import MinePagePersonalFunctionsItem from '../../viewmodel/MinePagePersonalFunctionsItem'
import router from '@ohos.router'
@Component
export default struct MinePagePersonFunctionUI {
@Link personalData:MinePagePersonalFunctionsItem[]
@Prop isLogin:boolean
@Consume('isLogin')@Watch('loginChange') loginState:Record<string,string>
loginChange(){
if(this.loginState){
this.isLogin=true
}
}
build() {
Grid(){
... ... @@ -45,6 +38,15 @@ export default struct MinePagePersonFunctionUI {
}.onClick(()=>{
console.log(index+"")
switch (item.msg){
case "评论":{
if(!this.isLogin){
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}else {
WDRouterRule.jumpWithPage(WDRouterPage.mineHomePage)
}
break;
}
case "预约":{
if(!this.isLogin){
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
... ...
import { Logger, UserDataLocal } from 'wdKit'
import { Logger, StringUtils, UserDataLocal } from 'wdKit'
import { WDRouterPage, WDRouterRule } from 'wdRouter'
import MinePageDatasModel from '../../model/MinePageDatasModel'
const TAG = "MinePageUserSimpleInfoUI"
... ... @@ -12,18 +12,13 @@ export default struct MinePageUserSimpleInfoUI {
@State levelHead:string = ""
@State levelId:number = 0
@Consume('isLogin') @Watch('loginChange') loginState:Record<string,string>
loginChange(){
Logger.debug("isLogin",'MinePageUserSimpleInfoUI')
if(this.loginState){
this.isLogin=true
}
}
loginStateChange(){
if(this.isLogin){
this.getUserInfo()
this.getUserLevel()
}else{
this.headPhotoUrl = ""
this.levelHead = ""
}
}
... ... @@ -31,17 +26,20 @@ export default struct MinePageUserSimpleInfoUI {
Row(){
//头像
Stack(){
Image(this.headPhotoUrl)
Image(this.headPhotoUrl==""?$r('app.media.default_head'):this.headPhotoUrl)
.alt($r('app.media.default_head'))
.width('100lpx')
.height('100lpx')
.objectFit(ImageFit.Cover)
.borderRadius(50)
if(StringUtils.isNotEmpty(this.levelHead)){
Image(this.levelHead)
.width('130lpx')
.height('130lpx')
.objectFit(ImageFit.Cover)
.borderRadius(50)
}
}.width('130lpx')
.height('130lpx')
.alignContent(Alignment.Center)
... ...
import { StringUtils } from 'wdKit/Index'
import { HttpUrlUtils } from 'wdNetwork/Index'
import MinePageDatasModel from '../../../model/MinePageDatasModel'
import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'
import { FollowOperationRequestItem } from '../../../viewmodel/FollowOperationRequestItem'
@Component
export struct FollowChildComponent{
@ObjectLink data: FollowListDetailItem
@State type:number = 0
build() {
if(this.type == 0 ){
Column(){
Blank().height('27lpx')
Row() {
Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl)
.objectFit(ImageFit.Auto)
.width('92lpx')
.height('92lpx')
.margin({right:'15lpx'})
Column(){
Text(this.data.cnUserName)
.fontWeight('400lpx')
.fontSize('31lpx')
.lineHeight('38lpx')
.fontColor($r('app.color.color_222222'))
.maxLines(1)
Text(`粉丝${this.data.cnFansNum}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
.maxLines(1)
Text(`${this.data.introduction}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
if(this.data.status == "1"){
Row(){
Text(`已关注`)
.fontColor($r('app.color.color_CCCCCC'))
.fontSize('23lpx')
.fontWeight('500lpx')
.lineHeight('35lpx')
}.backgroundColor($r('app.color.color_F5F5F5'))
.borderRadius('6lpx')
.borderColor($r('app.color.color_F5F5F5'))
.borderWidth('2lpx')
.justifyContent(FlexAlign.Center)
.width('100lpx')
.height('46lpx')
.margin({left:'4lpx',top:'23lpx'})
.onClick(()=>{
this.followOperation()
// this.data.status = "0"
})
}else{
Row(){
Image($r('app.media.follow_icon'))
.margin({right:'4lpx'})
.width('23lpx')
.height('23lpx')
Text(`关注`)
.fontColor($r('app.color.color_ED2800'))
.fontSize('23lpx')
.fontWeight('500lpx')
.lineHeight('35lpx')
}.borderColor($r('app.color.color_1AED2800'))
.borderRadius('6lpx')
.borderWidth('2lpx')
.justifyContent(FlexAlign.Center)
.width('100lpx')
.height('46lpx')
.margin({left:'4lpx',top:'23lpx'})
.onClick(()=>{
this.followOperation()
// this.data.status = "1"
})
}
}.alignItems(VerticalAlign.Top)
.width('100%')
.layoutWeight(1)
Divider().width('100%')
.height('2lpx')
.strokeWidth('1lpx')
.backgroundColor($r('app.color.color_EDEDED'))
}.height('146lpx')
.justifyContent(FlexAlign.Center)
.onClick(()=>{
//跳转 人民号的 主页
})
}else if(this.type == 1 ){
Column(){
Column(){
Row() {
Row(){
Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl)
.objectFit(ImageFit.Auto)
.width('92lpx')
.height('92lpx')
.margin({right:'15lpx'})
.borderRadius(50)
.borderWidth('1lpx')
.borderColor($r('app.color.color_0D000000'))
Column(){
Text(this.data.cnUserName)
.fontWeight('400lpx')
.fontSize('31lpx')
.lineHeight('38lpx')
.fontColor($r('app.color.color_222222'))
.maxLines(1)
.margin({bottom:'12lpx'})
Row(){
Text(`粉丝${this.data.cnFansNum}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
Image($r("app.media.point"))
.width('31lpx')
.height('31lpx')
.objectFit(ImageFit.Auto)
Text(`${this.data.introduction}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
.layoutWeight(1)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}.width('100%')
}
.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
}.layoutWeight(1)
if(this.data.status == "1"){
Row(){
Text(`已关注`)
.fontColor($r('app.color.color_CCCCCC'))
.fontSize('23lpx')
.fontWeight('500lpx')
.lineHeight('35lpx')
}
.justifyContent(FlexAlign.Center)
.width('100lpx')
.height('46lpx')
.onClick(()=>{
this.followOperation()
})
}else{
Row(){
Image($r('app.media.follow_icon'))
.margin({right:'4lpx'})
.width('23lpx')
.height('23lpx')
Text(`关注`)
.fontColor($r('app.color.color_ED2800'))
.fontSize('23lpx')
.fontWeight('500lpx')
.lineHeight('35lpx')
}.borderColor($r('app.color.color_1AED2800'))
.borderRadius('6lpx')
.borderWidth('2lpx')
.justifyContent(FlexAlign.Center)
.width('100lpx')
.height('46lpx')
.onClick(()=>{
this.followOperation()
})
}
}
.width('100%')
.height('92lpx')
.justifyContent(FlexAlign.SpaceBetween)
}.height('146lpx')
.justifyContent(FlexAlign.Center)
.onClick(()=>{
})
Divider().width('100%')
.height('1lpx')
.strokeWidth('1lpx')
.backgroundColor($r('app.color.color_EDEDED'))
}.width('100%')
}
}
followOperation(){
let item = new FollowOperationRequestItem(this.data.cnUserType,this.data.cnUserId,this.data.creatorId,HttpUrlUtils.getUserType(),HttpUrlUtils.getUserId(),this.data.status==="0" ? 1:0)
MinePageDatasModel.getFollowOperation(item,getContext(this)).then((value)=>{
if(value!=null){
if (value.code === 0 || value.code.toString() === "0") {
this.data.status = this.data.status ==="0"?"1":"0"
}
}
})
}
}
\ No newline at end of file
... ...
import { Params } from 'wdBean';
import { LazyDataSource, StringUtils } from 'wdKit';
import { HttpUrlUtils } from 'wdNetwork';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
import { LazyDataSource } from 'wdKit';
import MinePageDatasModel from '../../../model/MinePageDatasModel';
import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'
import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem';
import { FollowListStatusRequestItem } from '../../../viewmodel/FollowListStatusRequestItem';
import { FollowOperationRequestItem } from '../../../viewmodel/FollowOperationRequestItem';
import { MineFollowListDetailItem } from '../../../viewmodel/MineFollowListDetailItem';
import { QueryListIsFollowedItem } from '../../../viewmodel/QueryListIsFollowedItem';
import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
import { FollowChildComponent } from './FollowChildComponent';
const TAG = "FollowListDetailUI"
@Component
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
... ... @@ -22,7 +20,6 @@ export struct FollowListDetailUI{
curPageNum:number = 1;
aboutToAppear(){
console.log("YCG","aboutToAppear==="+this.creatorDirectoryId);
this.getNewPageData()
}
... ... @@ -35,7 +32,7 @@ export struct FollowListDetailUI{
List({ space: 3 }) {
LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => {
ListItem() {
ChildComponent({data: item})
FollowChildComponent({data: item,type:this.type})
}
.onClick(() => {
})
... ... @@ -76,7 +73,8 @@ export struct FollowListDetailUI{
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))
this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId))
})
this.data.notifyDataReload()
this.count = this.data.totalCount()
... ... @@ -149,111 +147,3 @@ export struct FollowListDetailUI{
}
}
\ No newline at end of file
@Component
struct ChildComponent {
@ObjectLink data: FollowListDetailItem
build() {
Column(){
Blank().height('27lpx')
Row() {
Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl)
.objectFit(ImageFit.Auto)
.width('92lpx')
.height('92lpx')
.margin({right:'15lpx'})
Column(){
Text(this.data.cnUserName)
.fontWeight('400lpx')
.fontSize('31lpx')
.lineHeight('38lpx')
.fontColor($r('app.color.color_222222'))
.maxLines(1)
Text(`粉丝${this.data.cnFansNum}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
.maxLines(1)
Text(`${this.data.introduction}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
if(this.data.status == "1"){
Row(){
Text(`已关注`)
.fontColor($r('app.color.color_CCCCCC'))
.fontSize('23lpx')
.fontWeight('500lpx')
.lineHeight('35lpx')
}.backgroundColor($r('app.color.color_F5F5F5'))
.borderRadius('6lpx')
.borderColor($r('app.color.color_F5F5F5'))
.borderWidth('2lpx')
.justifyContent(FlexAlign.Center)
.width('100lpx')
.height('46lpx')
.margin({left:'4lpx',top:'23lpx'})
.onClick(()=>{
this.followOperation()
// this.data.status = "0"
})
}else{
Row(){
Image($r('app.media.follow_icon'))
.margin({right:'4lpx'})
.width('23lpx')
.height('23lpx')
Text(`关注`)
.fontColor($r('app.color.color_ED2800'))
.fontSize('23lpx')
.fontWeight('500lpx')
.lineHeight('35lpx')
}.borderColor($r('app.color.color_1AED2800'))
.borderRadius('6lpx')
.borderWidth('2lpx')
.justifyContent(FlexAlign.Center)
.width('100lpx')
.height('46lpx')
.margin({left:'4lpx',top:'23lpx'})
.onClick(()=>{
this.followOperation()
// this.data.status = "1"
})
}
}.alignItems(VerticalAlign.Top)
.width('100%')
.layoutWeight(1)
Divider().width('100%')
.height('2lpx')
.strokeWidth('1lpx')
.backgroundColor($r('app.color.color_EDEDED'))
}.height('146lpx')
.justifyContent(FlexAlign.Center)
.onClick(()=>{
//跳转 人民号的 主页
// let params: Params = {
// pageID: this.data.attentionUserId
// }
// WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params)
})
}
followOperation(){
let item = new FollowOperationRequestItem(this.data.cnUserType,this.data.cnUserId,this.data.creatorId,HttpUrlUtils.getUserType(),HttpUrlUtils.getUserId(),this.data.status==="0" ? 1:0)
MinePageDatasModel.getFollowOperation(item,getContext(this)).then((value)=>{
if(value!=null){
if (value.code === 0 || value.code.toString() === "0") {
this.data.status = this.data.status ==="0"?"1":"0"
}
}
})
}
}
\ No newline at end of file
... ...
... ... @@ -23,7 +23,8 @@ 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}).layoutWeight(1)
FollowListDetailUI({creatorDirectoryId:this.data[this.firstIndex].id,type:1})
.layoutWeight(1)
}else{
this.FollowSecondUI()
}
... ...
... ... @@ -184,7 +184,7 @@ 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))
this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId))
})
this.data_follow.notifyDataReload()
this.count = this.data_follow.totalCount()
... ...
... ... @@ -116,7 +116,7 @@ export struct OtherHomePageBottomFollowComponent{
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.cnUserType,value.cnUserId))
this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.cnUserType,value.cnUserId))
})
this.data_follow.notifyDataReload()
this.count = this.data_follow.totalCount()
... ...
... ... @@ -4,11 +4,10 @@ import MinePageMoreFunctionModel from '../../viewmodel/MinePageMoreFunctionModel
import MinePageDatasModel from '../../model/MinePageDatasModel'
import MinePageUserSimpleInfoUI from '../mine/MinePageUserSimpleInfoUI'
import MinePagePersonFunctionUI from '../mine/MinePagePersonFunctionUI'
import MinePageCardUI from '../mine/MinePageCardUI'
import MinePageCreatorFunctionUI from '../mine/MinePageCreatorFunctionUI'
import MinePageMoreFunctionUI from '../mine/MinePageMoreFunctionUI'
import { SPHelper, StringUtils } from 'wdKit'
import { SpConstants } from 'wdConstant'
import dataPreferences from '@ohos.data.preferences';
const TAG = 'MinePageComponent';
... ... @@ -24,12 +23,29 @@ export struct MinePageComponent {
@State creatorData:MinePageCreatorFunctionsItem[] = []
@State moreData:MinePageMoreFunctionModel[] = []
scroller: Scroller = new Scroller()
preferences: dataPreferences.Preferences | null = null;
aboutToAppear(){
this.getUserLogin()
this.getFunctionData()
this.addLoginStatusObserver()
}
async addLoginStatusObserver(){
this.preferences = await SPHelper.default.getPreferences();
let observer = (key: string) => {
if(key == SpConstants.USER_ID){
if(StringUtils.isEmpty(SPHelper.default.getSync(SpConstants.USER_ID,""))){
this.isLogin = false
}else {
this.isLogin = true
}
}
}
this.preferences.on('change', observer);
}
getFunctionData(){
//个人功能数据
this.personalData = MinePageDatasModel.getPersonalFunctionsData()
... ...
... ... @@ -13,6 +13,7 @@ import CustomRefreshLoadLayout from './CustomRefreshLoadLayout';
import { CompParser } from '../CompParser';
import { CompDTO } from 'wdBean';
import PageHelper from '../../viewmodel/PageHelper';
import { channelSkeleton } from '../skeleton/channelSkeleton'
const TAG = 'PageComponent';
... ... @@ -77,11 +78,13 @@ export struct PageComponent {
refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage,
this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight)
})
} else {
} else if (!this.pageModel.contentNeedScroll) {
NoMoreLayout()
}
}
}
// comp自己处理分页,这里设置EdgeEffect.None
.edgeEffect(this.pageModel.contentNeedScroll ? EdgeEffect.None : EdgeEffect.Spring)
.scrollBar(BarState.Off)
.cachedCount(8)
.height(CommonConstants.FULL_PARENT)
... ... @@ -95,10 +98,11 @@ export struct PageComponent {
@Builder
LoadingLayout() {
CustomRefreshLoadLayout({
refreshBean: new RefreshLayoutBean(true,
$r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.pageModel.pullDownRefreshHeight)
})
channelSkeleton()
// CustomRefreshLoadLayout({
// refreshBean: new RefreshLayoutBean(true,
// $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.pageModel.pullDownRefreshHeight)
// })
}
async aboutToAppear() {
... ...
import router from '@ohos.router'
import { PeopleShipHomePageNavComponent } from '../peopleShipHomePage/PeopleShipHomeNavComponent'
import { PeopleShipHomePageTopComponent } from '../peopleShipHomePage/PeopleShipHomePageTopComponent'
import { Logger } from 'wdKit'
import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel'
import { PeopleShipHomeListComponent } from '../peopleShipHomePage/PeopleShipHomeListComponent'
import { QueryListIsFollowedItem } from '../../viewmodel/QueryListIsFollowedItem'
import { HttpUrlUtils } from 'wdNetwork/Index'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import { PageRepository } from '../../repository/PageRepository'
import {
postInteractAccentionOperateParams,
PeopleShipUserDetailData,
ArticleCountData
} from 'wdBean'
@Entry
@Component
struct PeopleShipHomePage {
// Todo 传入数据 后续在修改
creatorId: string = (router.getParams() as Record<string, string>)['creatorId'];
@State arr: number[] = []
// 页面详情数据
@Provide detailModel: PeopleShipUserDetailData = {} as PeopleShipUserDetailData
// 每个分类数量
@State articleModel: ArticleCountData = {} as ArticleCountData
// 总滑动空间
scroller: Scroller = new Scroller()
// 顶部透明度
@State topOpacity: number = 0
//发布数量
@State publishCount: number = 0
// 是否关注
@Provide isAttention: string = '0'
// 是否开始更新关注
@Provide @Watch('handleChangeAttentionStata') isLoadingAttention: boolean = false
//关注显示
@Prop attentionOpacity: boolean = false
@Provide topHeight: number = 400
build() {
Stack({ alignContent: Alignment.TopStart }) {
// 头部返回
PeopleShipHomePageNavComponent({
attentionOpacity: this.attentionOpacity,
topOpacity: this.topOpacity,
detailModel: this.detailModel
})
.height($r('app.float.top_bar_height'))
.zIndex(100)
.backgroundColor(Color.Transparent)
if (this.detailModel && this.detailModel.userName) {
Scroll(this.scroller) {
Column() {
// 顶部相关
PeopleShipHomePageTopComponent({
creatorId: this.creatorId,
detailModel: this.detailModel,
publishCount: this.publishCount,
topHeight: this.topHeight
})
.width("100%")
.height(this.topHeight)
.backgroundColor(Color.White)
// 列表
PeopleShipHomeListComponent({
publishCount: this.publishCount,
creatorId: this.creatorId
})
}
.width("100%")
.justifyContent(FlexAlign.Start)
// .height(this.publishCount == 0 ? '100%' : '')
}
.edgeEffect(EdgeEffect.None)
.friction(0.6)
.backgroundColor(Color.White)
.scrollBar(BarState.Off)
.width('100%')
.height('100%')
.onScroll(() => {
// this.topOpacity = yOffset / (this.getDeviceHeight() * 0.2)
this.topOpacity = this.scroller.currentOffset().yOffset / 100
if (this.scroller.currentOffset().yOffset >= this.topHeight - 66) {
this.attentionOpacity = true
} else {
this.attentionOpacity = false
}
console.log(`全局请求失败拦截,message:${this.topOpacity}`)
// System.out.println("输出高度:"+ AttrHelper.vp2px(height,this));
})
}
}
}
async aboutToAppear() {
try {
// 获取页面信息
this.detailModel = await PeopleShipHomePageDataModel.getPeopleShipHomePageDetailInfo(this.creatorId, '', '')
Logger.debug('PeopleShipHomePage', '获取页面信息', `${JSON.stringify(this.detailModel)}`)
// 获取关注
let followList: QueryListIsFollowedItem[] = await PeopleShipHomePageDataModel.getHomePageFollowListStatusData(this.creatorId)
Logger.debug('PeopleShipHomePage', '获取关注信息', `${JSON.stringify(followList)}`)
this.findFollowStata(followList)
} catch (exception) {
}
}
findFollowStata(followList: QueryListIsFollowedItem[]) {
if (followList.length > 0) {
let item: QueryListIsFollowedItem = followList[0]
Logger.debug('PeopleShipHomePage', '关注', `${JSON.stringify(item.status)}`)
this.isAttention = item.status
}
}
handleChangeAttentionStata() {
if (!this.isLoadingAttention) {
return
}
// 未登录,跳转登录
if (!HttpUrlUtils.getUserId()) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
let status = 0
if (this.isAttention == '0') {
status = 1
}
const params: postInteractAccentionOperateParams = {
attentionUserType: this.detailModel.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号)
attentionUserId: this.detailModel.userId || '', // 被关注用户号主id
attentionCreatorId: this.creatorId || '', // 被关注用户号主id
// userType: 1,
// userId: HttpUrlUtils.getUserId(),
status: status,
}
PageRepository.postInteractAccentionOperate(params).then(res => {
if (this.isAttention == '1') {
this.isAttention = '0'
} else {
this.isAttention = '1'
}
this.isLoadingAttention = false
})
.catch(() => {
this.isLoadingAttention = false
})
}
}
... ...
import { Logger, DisplayUtils} from 'wdKit'
import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel'
import {
ContentDTO,
ArticleListDTO,
LiveDTO,
LiveInfoDTO,
FullColumnImgUrlDTO,
VideoInfoDTO,
RmhInfoDTO,
contentListParams,
InteractDataDTO,
ArticleTypeData,
ArticleListData,
PeopleShipUserDetailData
} from 'wdBean'
import { CardParser } from '../CardParser'
import { PageRepository } from '../../repository/PageRepository'
import { RefreshLayoutBean } from '../page/RefreshLayoutBean'
import CustomRefreshLoadLayout from '../page/CustomRefreshLoadLayout'
import { ErrorComponent } from '../view/ErrorComponent';
import NoMoreLayout from '../page/NoMoreLayout';
import { LazyDataSource } from 'wdKit';
const TAG = 'PeopleShipHomeArticleListComponent';
@Component
export struct PeopleShipHomeArticleListComponent {
// @State arr: ContentDTO[] = []
@State arr: LazyDataSource<ContentDTO> = new LazyDataSource();
@State typeModel: ArticleTypeData = new ArticleTypeData()
@State creatorId: string = ''
@Consume detailModel: PeopleShipUserDetailData
@State private viewType: number = 1;
currentIndex: number = 0
@Link @Watch('onChange') currentTopSelectedIndex: number
@State private hasMore: boolean = true
@State currentPage: number = 1
@State private isLoading: boolean = false
@Consume topHeight: number
build() {
if (this.viewType == 1) {
// LoadingComponent()
this.LoadingLayout()
} else if (this.viewType == 2) {
ErrorComponent()
} else {
this.ListLayout()
}
}
@Builder
LoadingLayout() {
CustomRefreshLoadLayout({
refreshBean: new RefreshLayoutBean(true,
$r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), 20)
}).height(DisplayUtils.getDeviceHeight() - this.topHeight)
}
@Builder
ListLayout() {
List() {
// 下拉刷新
LazyForEach(this.arr, (item: ContentDTO) => {
ListItem() {
CardParser({ contentDTO: item })
}.width("100%")
.backgroundColor(Color.Transparent)
}, (item: ContentDTO, index: number) => item.objectId + index.toString())
// 加载更多
ListItem() {
if (!this.hasMore) {
NoMoreLayout()
}
}
}
.width("100%")
.height("100%")
.edgeEffect(EdgeEffect.Spring)
.nestedScroll({
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
.onReachEnd(() => {
if(!this.isLoading && this.hasMore){
//加载分页数据
this.getPeopleShipPageArticleList()
}
})
}
aboutToAppear() {
if (this.currentIndex == this.currentTopSelectedIndex) {
this.currentPage = 1
this.getPeopleShipPageArticleList()
}
}
onChange() {
if (this.currentIndex == this.currentTopSelectedIndex) {
this.currentPage = 1
this.getPeopleShipPageArticleList()
}
}
private async getPeopleShipPageArticleList() {
Logger.info(`获取页面信息PeopleShipHomeArticleListComponent${this.typeModel.type}`)
if (this.isLoading) {
return
}
try {
this.isLoading = true
let listData: ArticleListData = await PeopleShipHomePageDataModel.getPeopleShipHomePageArticleListData(this.creatorId, this.currentPage, 20, this.typeModel.type)
Logger.debug(TAG, `获取页面信息, ${listData.list.length}`);
if (listData && listData.list && listData.list.length > 0) {
this.viewType = 3;
if (listData.list.length === 20) {
this.currentPage++;
this.hasMore = true;
} else {
this.hasMore = false;
}
} else {
this.viewType = 1;
}
this.queryArticleContentInteractCount(listData)
Logger.debug(TAG, '展示的总数', `${this.arr.totalCount()}`)
}catch (exception) {
this.isLoading = false
if (this.arr.totalCount() == 0) {
this.viewType = 2
}
}
}
/**
* 查询点赞、收藏数量
*/
private queryArticleContentInteractCount(listData: ArticleListData) {
if (listData && listData.list && listData.list.length > 0) {
const params: contentListParams = {
contentList: []
}
listData.list.map((item: ArticleListDTO) => {
params.contentList.push({
contentId: item.id,
contentType: item.type
})
});
PageRepository.getContentInteract(params).then(res => {
this.articleListDTOChangeContentDTO(listData, res.data ?? [])
}).catch(() => {
this.articleListDTOChangeContentDTO(listData, [])
})
}
}
private articleListDTOChangeContentDTO(listData: ArticleListData, listCom: InteractDataDTO[]) {
this.isLoading = false
if (listData.list.length) {
for (const element of listData.list) {
let contentDTO = {} as ContentDTO
contentDTO.appStyle = this.changeCommon(element.appStyle)
contentDTO.newsTitle = element.title;
contentDTO.newsSummary = element.description;
contentDTO.objectId = element.id;
// 评论数
const comModel = listCom.find((item) => {
return item.contentId == element.id
})
if (comModel) {
contentDTO.interactData = comModel
}
//1:小图卡,2:大图卡,3:无图卡(全标题),
// 4:三图卡,5:头图卡,6:小视频卡,7:作者卡,8:财经快讯卡,
// 9:时间轴卡,10:大专题卡,
// 11.无图卡(标题缩略),12.无图卡(标题缩略)-人民号,
// 13.单图卡,14.单图卡-人民号,
// 15.大图卡-人民号,16.三图卡-人民号,17.图集卡,18.图集卡-人民号,
// 19.动态图文卡-人民号,20.动态视频卡-人民号,
// 21 小视频卡-人民号
contentDTO.objectType = `${element.type}`;
// contentDTO.productNum = element.productCount;
// if (master) {
// contentDTO.customWorkStatus = element.workStatus;
// }
// contentDTO.customSchedulePublishTime = element.contentPublishTasks.firstObject.schedulePublishTime;
contentDTO.fullColumnImgUrls = this.fullColumnImgUrls(element);
let rmhInfo = this.convertToRmhInfoWithAccountModel()
if (rmhInfo) {
contentDTO.rmhInfo = rmhInfo;
}
let liveInfo = this.convertToProgramLiveInfoModel(element.live);
if (liveInfo) {
contentDTO.liveInfo = liveInfo;
if (element.vlives && element.vlives.length > 0) {
let vlivesModel = element.vlives[0]
if (vlivesModel.recordUrl && vlivesModel.recordUrl.length > 0) {
contentDTO.liveInfo.replayUri = vlivesModel.recordUrl
}
}
}
let videInfo1 = this.convertToVideoInfo(element);
if (videInfo1) {
contentDTO.videoInfo = videInfo1
}
// contentDTO.shareInfo = [self.contentShare.firstObject convertToShareInfo];
// contentDTO.shareInfo.shareUrl = self.shareUrl;
if (element.createTime.length > 0) {
contentDTO.publishTime = this.convertPublishTimeWith(element.createTime);
} else if (element.updateTime.length > 0) {
contentDTO.publishTime = this.convertPublishTimeWith(element.updateTime);
} else if (element.firstPublishTime.length > 0) {
contentDTO.publishTime = this.convertPublishTimeWith(element.firstPublishTime);
} else if (element.publishTime.length > 0) {
contentDTO.publishTime = this.convertPublishTimeWith(element.publishTime);
}
//图集数量
contentDTO.photoNum = element.mainPicCount;
if (element.contentExt && element.contentExt.length > 0) {
let extModel = element.contentExt[0];
contentDTO.openLikes = extModel.openLikes;
contentDTO.openComment = extModel.openComment;
}
// 页面
if (contentDTO.appStyle == '2' || contentDTO.appStyle == '13' || contentDTO.appStyle == '20') {
if (element.appStyleImages && element.appStyleImages.length > 0) {
contentDTO.coverUrl = element.appStyleImages[0].fullUrl
} else if (element.contentPictures && element.contentPictures.length > 0) {
contentDTO.coverUrl = element.contentPictures[0].fullUrl
}
}
// infoModel.api_isFollowListDataSource = YES;
// //infoModel.topicTemplate = [self.topicTemplate integerValue];
// //infoModel.objectLevel = self.topicType;
// //infoModel.pageId = self.pageId;
contentDTO.source = this.detailModel.userName;
// infoModel.opusAllowEdit = master && !([self.workStatus isEqualToString:@"2"] ||
// [self.workStatus isEqualToString:@"6"] ||
// [self.workStatus isEqualToString:@"5"] ||
// [self.workStatus isEqualToString:@"8"] ||
// !self.workStatus);
// infoModel.newsTag = [self convertNewsTagIsMaster:master];
// if (isSerial) {
// contentDTO.coverUrl = element.fullUrl;
// }
this.arr.push(contentDTO)
}
}
// this.arr = listData.list
}
//人民号主页
private convertToRmhInfoWithAccountModel() {
if (this.detailModel) {
let rmhInfo = {} as RmhInfoDTO
rmhInfo.rmhHeadUrl = this.detailModel.headPhotoUrl;
rmhInfo.rmhName = this.detailModel.userName;
rmhInfo.rmhId = this.detailModel.creatorId;
rmhInfo.userId = this.detailModel.userId;
rmhInfo.userType = this.detailModel.userType
rmhInfo.rmhDesc = this.detailModel.introduction;
rmhInfo.cnIsAttention = 0;
rmhInfo.cnIsComment = this.detailModel.isComment;
rmhInfo.cnIsLike = this.detailModel.cnIsLike;
rmhInfo.cnMainControl = this.detailModel.mainControl;
rmhInfo.cnShareControl = this.detailModel.shareControl;
rmhInfo.authIcon = this.detailModel.authIcon;
rmhInfo.authTitle = this.detailModel.authTitle;
// rmhInfo.honoraryIcon = this.detailModel.honoraryIcon;
// rmhInfo.honoraryTitle = this.detailModel.honoraryTitle;
rmhInfo.banControl = this.detailModel.banControl;
return rmhInfo
}
return null
}
//视频信息转换
private convertToVideoInfo(model: ArticleListDTO) {
if (model.appStyleVideos && model.appStyleVideos.length > 0) {
let firstModel = model.appStyleVideos[0]
let videoInfo: VideoInfoDTO = {} as VideoInfoDTO
videoInfo.videoDuration = firstModel.duration
videoInfo.videoUrl = firstModel.url
videoInfo.videoLandscape = firstModel.landscape
videoInfo.firstFrameImageUri = firstModel.fullUrl
return videoInfo
}
else if (model.contentVideos && model.contentVideos.length > 0) {
let firstModel = model.contentVideos[0]
let videoInfo: VideoInfoDTO = {} as VideoInfoDTO
videoInfo.videoDuration = firstModel.duration
videoInfo.videoUrl = firstModel.url
videoInfo.videoLandscape = firstModel.landscape
videoInfo.firstFrameImageUri = firstModel.fullUrl
return videoInfo
}
return null
}
// 直播信息转换
private convertToProgramLiveInfoModel(model: LiveDTO): LiveInfoDTO | null {
if (model) {
let liveInfo = {} as LiveInfoDTO
liveInfo.vrType = model.vr
liveInfo.liveState = model.status
liveInfo.liveLandscape = model.landscape
if (model.recordUrl && model.recordUrl.length > 0) {
liveInfo.replayUri = model.recordUrl
} else if (model.uri && model.uri.length > 0) {
liveInfo.replayUri = model.uri
}
return liveInfo
}
return null
}
// 图片转换
private fullColumnImgUrls(model: ArticleListDTO) {
let imagesList: FullColumnImgUrlDTO[] = [] as FullColumnImgUrlDTO[]
if (model.appStyleImages && model.appStyleImages.length > 0) {
for (const element of model.appStyleImages) {
let imgUrl: FullColumnImgUrlDTO = {} as FullColumnImgUrlDTO
imgUrl.format = element.format
imgUrl.height = element.height
imgUrl.weight = element.weight
imgUrl.size = element.size
imgUrl.landscape = element.landscape
imgUrl.url = element.fullUrl
imgUrl.fullUrl = element.fullUrl
imagesList.push(imgUrl)
}
}
else if (model.contentPictures && model.contentPictures.length > 0) {
for (const element of model.contentPictures) {
let imgUrl: FullColumnImgUrlDTO = {} as FullColumnImgUrlDTO
imgUrl.format = element.format
imgUrl.height = element.height
imgUrl.weight = element.weight
imgUrl.size = element.size
imgUrl.landscape = element.landscape
imgUrl.url = element.fullUrl
imgUrl.fullUrl = element.fullUrl
imagesList.push(imgUrl)
}
}
return imagesList
}
//时间转时间戳
private convertPublishTimeWith(time: string): string {
if (time.length) {
return `${new Date(time).getTime()}`
}
return `${new Date().getTime()}`
}
private changeCommon(appStyle: number): string {
if (appStyle == 12) {
return '11'
}
if (appStyle == 14) {
return '13'
}
if (appStyle == 15) {
return '2'
}
if (appStyle == 16) {
return '4'
}
if (appStyle == 18) {
return '17'
}
if (appStyle == 21) {
return '6'
}
return `${appStyle}`
}
}
\ No newline at end of file
... ...
@Component
export struct PeopleShipHomeAttentionComponent {
@Consume isAttention: string
@Consume isLoadingAttention: boolean
build() {
Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Button({type: ButtonType.Normal, stateEffect: false } ) {
Stack() {
Image(this.isAttention == '0'? $r('app.media.home_attention_no_left') : $r('app.media.home_attention_left'))
.width('100%')
.height('100%')
.objectFit(ImageFit.Cover)
Row() {
if(this.isAttention == '0') {
if(this.isLoadingAttention) {
LoadingProgress()
.width(20)
.height(20)
.color($r('app.color.color_fff'))
}else {
Text('+ 关注')
.fontColor(Color.White)
.fontSize($r('app.float.vp_14'))
.fontWeight(500)
.margin({
right: '10vp'
})
}
}else {
if(this.isLoadingAttention) {
LoadingProgress()
.width(20)
.height(20)
.color( $r('app.color.color_CCCCCC'))
}else {
Text('已关注')
.fontSize($r('app.float.vp_14'))
.fontWeight(500)
.fontColor($r('app.color.color_CCCCCC'))
.margin({
right: '10vp'
})
}
}
}
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.width('100%')
.height('100%')
}
.width('100%')
.height('100%')
}
.backgroundColor(Color.Transparent)
.width(176)
.height(36)
.padding(0)
.fontColor(Color.Black)
.margin({
right: '-5vp'
})
.onClick(() => {
if(this.isLoadingAttention) {
return
}
this.isLoadingAttention = true
})
Button({type: ButtonType.Normal, stateEffect: false}) {
Stack() {
Image($r('app.media.home_share_right_icon'))
.width('100%')
.height('100%')
.objectFit(ImageFit.Cover)
Row() {
Image($r('app.media.QR_code_icon'))
.width(16)
.height(16)
.objectFit(ImageFit.Cover)
.margin({
left: '10vp'
})
Text('分享名片')
.fontSize($r('app.float.vp_14'))
.fontColor($r('app.color.color_222222'))
.fontWeight(500)
.margin({ left: 5 })
}
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.width('100%')
.height('100%')
}
.width('100%')
.height('100%')
}
.backgroundColor(Color.Transparent)
.width(176)
.height(36)
.padding(0)
.fontColor(Color.White)
.margin({
left: '-5vp'
})
.onClick(() => {
})
}
}
}
\ No newline at end of file
... ...
import { DisplayUtils, Logger } from 'wdKit'
import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel'
import { PeopleShipHomeArticleListComponent } from './PeopleShipHomeArticleListComponent'
import { ArticleCountData, ArticleTypeData } from 'wdBean'
import CustomRefreshLoadLayout from '../page/CustomRefreshLoadLayout'
import { EmptyComponent } from '../view/EmptyComponent';
import { RefreshLayoutBean } from '../page/RefreshLayoutBean'
@Component
export struct PeopleShipHomeListComponent {
private controller: TabsController = new TabsController()
@State tabArr: ArticleTypeData[] = []
@State creatorId: string = ''
// 发布数量
@Link publishCount: number
@State currentIndex: number = 0
@State private isLoading: boolean = false
@Consume topHeight: number
build() {
if (this.isLoading) {
this.LoadingLayout()
}
// 列表
else if(this.publishCount == 0) {
// 无数据展示
EmptyComponent().height(DisplayUtils.getDeviceHeight() - this.topHeight)
} else {
Tabs({ barPosition: BarPosition.Start, controller: this.controller}) {
ForEach(this.tabArr, (item: ArticleTypeData, index: number) => {
TabContent() {
PeopleShipHomeArticleListComponent({
typeModel: item,
creatorId: this.creatorId,
currentTopSelectedIndex: this.currentIndex,
currentIndex: index
})
}.tabBar(this.tabBuilder(index, item.name ?? ''))
})
}
.backgroundColor(Color.White)
.barWidth('100%')
.barHeight('44vp')
.vertical(false)
.height(DisplayUtils.getDeviceHeight() - 100)
.animationDuration(0)
.divider({
strokeWidth: '0.5vp',
color: $r('app.color.color_F5F5F5'),
startMargin: 0,
endMargin: 0
})
.onChange((index: number) => {
this.currentIndex = index
})
}
}
@Builder
LoadingLayout() {
CustomRefreshLoadLayout({
refreshBean: new RefreshLayoutBean(true,
$r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), DisplayUtils.getDeviceHeight() - this.topHeight)
}).height(DisplayUtils.getDeviceHeight() - this.topHeight)
}
@Builder tabBuilder(index: number, name: string) {
Column() {
Text(name)
.fontColor(this.currentIndex === index ? $r('app.color.color_222222') : $r('app.color.color_666666') )
.fontSize(18)
.fontWeight(this.currentIndex === index ? 500 : 400)
.lineHeight(22)
.height(22)
.margin({ top: 11, bottom: 1 })
Divider()
.width('15vp')
.strokeWidth(2)
.color('#CB0000')
.opacity(this.currentIndex === index ? 1 : 0)
}.width('100%')
}
async aboutToAppear() {
try {
this.isLoading = true
// 1:点播(视频),2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件 13:音频 14:动态图文 15:动态视频
let articleModel = await PeopleShipHomePageDataModel.getPeopleShipHomePageArticleCountData(1, this.creatorId)
Logger.debug('PeopleShipHomeListComponent', '获取页面信息', `${JSON.stringify(articleModel)}`)
this.updateTopBarData(articleModel)
this.isLoading = false
} catch (exception) {
this.isLoading = false
}
}
// 设置顶部数据
updateTopBarData(articleModel: ArticleCountData) {
if (articleModel) {
this.publishCount = articleModel.publishCount
this.tabArr = []
if (articleModel.publishCount != 0) {
let model: ArticleTypeData = new ArticleTypeData('全部')
this.tabArr.push(model)
}
if (articleModel.twCount != 0) {
let model: ArticleTypeData = new ArticleTypeData('文章', 8)
this.tabArr.push(model)
}
if (articleModel.spCount != 0) {
let model: ArticleTypeData = new ArticleTypeData('视频', 1)
this.tabArr.push(model)
}
if (articleModel.zbCount != 0) {
let model: ArticleTypeData = new ArticleTypeData('直播', 2)
this.tabArr.push(model)
}
if (articleModel.dtCount != 0) {
let model: ArticleTypeData = new ArticleTypeData('动态', 4)
this.tabArr.push(model)
}
if (articleModel.ztCount != 0) {
let model: ArticleTypeData = new ArticleTypeData('图集', 9)
this.tabArr.push(model)
}
}
}
}
\ No newline at end of file
... ...
import router from '@ohos.router'
import { PeopleShipUserDetailData } from 'wdBean'
import { PeopleShipHomePageHeadComponent } from './PeopleShipHomePageHeadComponent'
@Component
export struct PeopleShipHomePageNavComponent {
@Prop topOpacity: number
@Consume isAttention: string
@Consume isLoadingAttention: boolean
@Prop attentionOpacity: boolean
// 页面详情数据
@Prop detailModel: PeopleShipUserDetailData = {} as PeopleShipUserDetailData
build() {
Row() {
Stack({ alignContent: Alignment.TopStart }) {
Row()
.width('100%')
.height('100%')
.backgroundColor($r('app.color.white'))
.opacity(this.topOpacity)
Row() {
Row() {
// 返回
Image((this.topOpacity > 0.5 ? $r('app.media.icon_arrow_left') : $r('app.media.icon_arrow_left_white')))
.width('24vp')
.height('24vp')
.objectFit(ImageFit.Auto)
.margin({ left: '10vp' })
.onClick(() => {
router.back()
})
// 头像
PeopleShipHomePageHeadComponent({
diameter: 30,
iconDiameter: 10,
headPhotoUrl: this.detailModel.headPhotoUrl,
authIcon: this.detailModel.authIcon
})
.margin({
left: '10vp',
})
.visibility((this.topOpacity > 0.5 ? Visibility.Visible : Visibility.Hidden))
// 文字
Text(this.detailModel.userName)
.height('46vp')
.fontSize($r('app.float.vp_14'))
.fontColor($r('app.color.color_222222'))
.margin({
left: '6vp'
})
.visibility((this.topOpacity > 0.5 ? Visibility.Visible : Visibility.Hidden))
if (this.isAttention == '0') {
// 关注
Button('+关注', { type: ButtonType.Normal, stateEffect: true })
.borderRadius(4)
.backgroundColor($r('app.color.color_ED2800'))
.width('54vp')
.height('24vp')
.onClick(() => {
if (this.isLoadingAttention){
return
}
this.isLoadingAttention = true
})
.margin({
left: '12vp',
})
.padding(0)
.fontSize($r('app.float.vp_12'))
.fontColor(Color.White)
.visibility((this.attentionOpacity ? Visibility.Visible : Visibility.Hidden))
} else {
Button('已关注', { type: ButtonType.Normal, stateEffect: true })
.borderRadius(4)
.backgroundColor($r('app.color.color_F5F5F5'))
.width('54vp')
.height('24vp')
.onClick(() => {
if (this.isLoadingAttention){
return
}
this.isLoadingAttention = true
})
.margin({
left: '12vp',
})
.padding(0)
.fontSize($r('app.float.vp_12'))
.fontColor($r('app.color.color_999999'))
.visibility((this.attentionOpacity ? Visibility.Visible : Visibility.Hidden))
}
}
.height('100%')
Blank()
// 分享
Image((this.topOpacity > 0.5 ? $r('app.media.icon_forward') : $r('app.media.icon_share')))
.width('24vp')
.height('24vp')
.objectFit(ImageFit.Auto)
.margin({ right: '10vp' })
.onClick(() => {
})
}
.width('100%')
.height('100%')
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.SpaceBetween)
}
.zIndex(1000)
.width('100%')
.height('100%')
}
}
}
\ No newline at end of file
... ...
@Component
export struct PeopleShipHomePageAttestationComponent {
@Prop name: string
@Prop content: string
build() {
Row() {
Text(this.name)
.lineHeight('16vp')
.fontColor($r('app.color.color_ED2800'))
.fontSize($r('app.float.vp_11'))
.backgroundColor($r('app.color.color_1AED2800'))
.textAlign(TextAlign.Center)
.borderRadius('2vp')
.margin({
right: '4vp',
left: '16vp',
})
.padding({
top: '3vp',
bottom: '3vp',
right: '6vp',
left: '6vp'
})
Text(this.content)
.lineHeight('22vp')
.fontSize($r('app.float.vp_12'))
.layoutWeight(1)
.fontColor($r('app.color.color_222222'))
.textAlign(TextAlign.Start)
.margin({
right: '16vp'
})
}
.width('100%')
.alignItems(VerticalAlign.Top)
}
}
\ No newline at end of file
... ...
@Component
export struct PeopleShipHomePageHeadComponent {
@State diameter: number = 30
@State iconDiameter: number = 10
@Prop headPhotoUrl: string = ''
@Prop authIcon: string = ''
build() {
Stack({ alignContent: Alignment.BottomEnd }) {
// 头像
Image( this.headPhotoUrl.length > 0 ? this.headPhotoUrl : $r('app.media.home_page_header_authority') )
.width(this.diameter)
.height(this.diameter)
.borderRadius(this.diameter/2)
.borderWidth('1vp')
.borderStyle(BorderStyle.Solid)
.borderColor(Color.White)
.objectFit(ImageFit.Auto)
if(this.authIcon.length > 0 ) {
Image( this.authIcon )
.width(this.iconDiameter)
.height(this.iconDiameter)
.borderRadius(this.iconDiameter/2)
.objectFit(ImageFit.Auto)
.margin({
right: '-3vp'
})
}
}
}
}
\ No newline at end of file
... ...
import measure from '@ohos.measure'
import { DisplayUtils } from 'wdKit'
import { PeopleShipHomePageHeadComponent } from './PeopleShipHomePageHeadComponent'
import { PeopleShipHomePageAttestationComponent } from './PeopleShipHomePageAttestationComponent'
import { Logger } from 'wdKit'
import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel'
import { InfluenceData, PeopleShipUserDetailData } from 'wdBean'
import { PeopleShipHomeAttentionComponent } from './PeopleShipHomeAttentionComponent'
@Component
export struct PeopleShipHomePageTopComponent {
@State creatorId: string = ''
// 是否关注
// @Prop isAttention: string
@State introductionType: number = 0
@State heightComponent: number = 0
// 页面详情数据
@Prop @Watch('onIntroductionUpdated') detailModel: PeopleShipUserDetailData
@Prop publishCount: number
// 影响力
@State influenceTotal: number = 0
// 简介是否可以展开
@State isCollapse: boolean = true
@State maxLines: number = Infinity
@State collapseTxt: string = '…展开';
private subTxt: string = '';
@State content: string = ''
@State topFixedHeight: number = 320
@State lineInNum: number = 1
@Link topHeight: number
build() {
Column() {
Stack({ alignContent: Alignment.TopStart}) {
// 顶部图片
Image($r('app.media.home_page_bg'))
.width('100%')
.height('120vp')
.objectFit(ImageFit.Fill)
.backgroundColor(Color.Black)
// 头像和名称
Row() {
// 头像
PeopleShipHomePageHeadComponent({
diameter: 80,
iconDiameter: 20,
headPhotoUrl: this.detailModel.headPhotoUrl,
authIcon: this.detailModel.authIcon
}).margin({
left: '10vp',
bottom: '20vp'
})
// 文字
Text(this.detailModel.userName)
.height('50vp')
.fontSize($r('app.float.vp_22'))
.fontColor($r('app.color.color_222222'))
.fontWeight(500)
.textAlign(TextAlign.Start)
.textOverflow({overflow: TextOverflow.Ellipsis})
.maxLines(2)
.layoutWeight(1)
.margin({
left: '12vp',
bottom: '10vp',
right: '12vp'
})
}
.width('100%')
.height('100%')
.alignItems(VerticalAlign.Bottom)
}
.width('100%')
.height('180vp')
.backgroundColor(Color.Transparent)
// 认证id:1蓝2黄,蓝v 只有官方认证,黄v有领域和身份认证
// 官方认证
if(this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) {
PeopleShipHomePageAttestationComponent({name: '官方认证', content: this.detailModel.categoryAuth})
.margin({
top: '10vp',
bottom: '10vp'
})
}
if(this.detailModel.authId == 2) {
if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0 ){
PeopleShipHomePageAttestationComponent({name: '领域认证', content: this.detailModel.authTitle})
.margin({
top: '10vp',
bottom: '10vp'
})
}
if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0 ){
PeopleShipHomePageAttestationComponent({name: '身份认证', content: this.detailModel.authPersonal})
.margin({
top: '10vp',
bottom: '10vp'
})
}
}
// 简介
if(this.lineInNum > 3) {
Row() {
Text() {
Span(this.content)
.fontColor($r('app.color.color_222222'))
Span(this.collapseTxt)
.onClick(()=>{
if(this.isCollapse){
this.maxLines = Infinity;
this.content = `简介:${this.detailModel.introduction}`
this.isCollapse = false;
this.collapseTxt = '收起';
this.topHeight = this.topFixedHeight + 21 * this.lineInNum
}else{
this.isCollapse = true;
this.collapseTxt = '…展开';
this.content = this.subTxt;
this.topHeight = this.topFixedHeight + 21 * 3
}
})
.fontColor($r('app.color.color_B0B0B0'))
}
.lineHeight('21vp')
.maxLines(this.maxLines)
.textOverflow({overflow: TextOverflow.Ellipsis})
.fontSize($r('app.float.vp_14'))
.key('home_page_introduction')
.margin({
left: '16vp',
right: '16vp',
bottom: '10vp'
})
}.width('100%')
.alignItems(VerticalAlign.Top)
}else {
Row() {
Text(`简介:${this.detailModel.introduction}`)
.fontSize($r('app.float.vp_14'))
.fontColor($r('app.color.color_222222'))
.lineHeight('21vp')
.maxLines(3)
.textOverflow({overflow: TextOverflow.Ellipsis})
.margin({
left: '16vp',
right: '16vp',
bottom: '10vp'
})
}.width('100%')
.alignItems(VerticalAlign.Top)
}
// IP归属地
Text(`IP归属地:${this.detailModel.region}`)
.lineHeight('18vp')
.fontSize($r('app.float.vp_12'))
.fontColor($r('app.color.color_999999'))
.textAlign(TextAlign.Start)
.width('100%')
.alignSelf(ItemAlign.Start)
.margin({
right: '16vp',
left: '16vp',
})
// 发布, 粉丝, 影响力
Row() {
// 发布
Text(this.computeShowNum(this.publishCount))
.fontSize($r('app.float.vp_20'))
.fontColor($r('app.color.color_222222'))
.lineHeight('22vp')
.textAlign(TextAlign.Center)
.fontWeight(600)
.margin({
right: '4vp',
left: '16vp'
})
Text('发布')
.fontSize($r('app.float.vp_12'))
.fontColor($r('app.color.color_666666'))
.align(Alignment.Center)
.height('22vp')
// 粉丝
Text(this.computeShowNum(this.detailModel.fansNum))
.fontSize($r('app.float.vp_20'))
.fontColor($r('app.color.color_222222'))
.lineHeight('22vp')
.fontWeight(600)
.textAlign(TextAlign.Center)
.margin({
right: '4vp',
left: '12vp'
})
Text('粉丝')
.fontSize($r('app.float.vp_12'))
.fontColor($r('app.color.color_666666'))
.height('22vp')
.align(Alignment.Center)
//影响力
Text(this.computeShowNum(this.influenceTotal))
.lineHeight('22vp')
.fontSize($r('app.float.vp_20'))
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
.height('22vp')
.margin({
right: '4vp',
left: '12vp'
})
Text('影响力')
.fontSize($r('app.float.vp_12'))
.fontColor($r('app.color.color_666666'))
.height('22vp')
.align(Alignment.Center)
}
.alignItems(VerticalAlign.Center)
.backgroundColor(Color.Transparent)
.width('100%')
.margin({
top: '16vp'
})
// 分享-关注
PeopleShipHomeAttentionComponent()
.width('100%')
.margin({
top: '10vp',
bottom: '16vp'
})
Row()
.backgroundColor($r('app.color.color_F5F5F5'))
.width('100%')
.height('6vp')
}
.width('100%')
.height('100%')
}
async aboutToAppear() {
try {
// 获取影响力
let infData: InfluenceData = await PeopleShipHomePageDataModel.getCreatorInfluenceInfoData(this.creatorId)
Logger.debug('PeopleShipHomePageTopComponent', '获取获取影响力信息', `${JSON.stringify(infData)}`)
this.influenceTotal = infData.influenceTotal
} catch (exception) {
}
if (this.content.length == 0) {
this.onIntroductionUpdated()
}
}
// 不听减去2个字-一直到时3行
private compIntroductionTextHeights() {
let introduction = `简介:${this.detailModel.introduction}`
let lineInNum1 = this.getTextLineNum(introduction, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
while (lineInNum1 > 3 ) {
introduction = introduction.substring(0, introduction.length - 2);
lineInNum1 = this.getTextLineNum(introduction, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
}
introduction = introduction.substring(0, introduction.length - 3);
Logger.debug('PeopleShipHomePageTopComponent', '3行简介:', `${introduction}`)
this.subTxt = introduction;
}
// 获取文本几行
private getTextLineNum(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) {
let size = this.topMeasureText(text, constraintWidth, lineHeight, fontSize)
let height: number = Number(size.height)
return Math.ceil(px2vp(height)/lineHeight)
}
private topMeasureText(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) {
return measure.measureTextSize({
textContent: text,
fontSize: fontSize,
lineHeight: lineHeight,
constraintWidth: constraintWidth,
})
}
onIntroductionUpdated() {
if (this.content.length == 0 && this.detailModel.introduction ) {
this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
if (this.lineInNum > 3) {
this.compIntroductionTextHeights()
this.content = this.subTxt
}
}
if (this.detailModel) {
this.topFixedHeight = 336
if(this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) {
this.topFixedHeight += this.getTextLineNum(this.detailModel.categoryAuth, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22
}
else if(this.detailModel.authId == 2) {
if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0 ){
this.topFixedHeight += this.getTextLineNum(this.detailModel.authTitle, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22
}
if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0 ){
if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0 ){
this.topFixedHeight += 10
}
this.topFixedHeight += this.getTextLineNum(this.detailModel.authPersonal, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22
}
}
this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
if (this.lineInNum <= 3) {
this.topFixedHeight += (21 * this.lineInNum)
this.topHeight = this.topFixedHeight
}else {
this.topHeight = this.topFixedHeight + (this.isCollapse ? 21*3 : 21 * this.lineInNum )
}
}
}
private computeShowNum(count: number) {
if(count >= 10000) {
return `${(count/10000).toFixed(1)}万`
}
return `${count}`
}
}
\ No newline at end of file
... ...
/**
* 搜索活动 展示组件
*/
import { ContentDTO } from 'wdBean/Index';
@Component
export struct ActivityItemComponent {
@State contentDTO: ContentDTO = {} as ContentDTO;
build() {
Row() {
Stack(){
Image(this.contentDTO.coverUrl)
.width('207lpx')
.height('276lpx')
.objectFit(ImageFit.Auto)
.borderRadius('7lpx')
Row(){
Image(this.contentDTO.programType+"" === "1" ? $r('app.media.activity_is_start_icon') :$r('app.media.activity_not_begin_icon'))
.width('42lpx')
.height('35lpx')
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.Medium)
Text(this.contentDTO.programType+"" === "1" ? "进行中" :"未开始")
.fontColor($r('app.color.white'))
.fontSize('21lpx')
.fontWeight('400lpx')
.lineHeight('31lpx')
.textAlign(TextAlign.Center)
}.margin({right:'19lpx',bottom:'13lpx'})
}.alignContent(Alignment.BottomEnd)
Column() {
Row(){
// Text(){
// // backgroundColor 不生效
// Span(this.contentDTO.objectType == "new_collect" ? "征稿" : this.contentDTO.objectType == "vote" ? "投票":"")
// .fontColor($r('app.color.main_red'))
// .fontSize('23lpx')
// .fontWeight('400lpx')
// .lineHeight('31lpx')
// .padding({left:'10lpx',right:'10lpx',top:'6lpx',bottom:'6lpx'})
// .backgroundColor( "#FF0"/*$r('app.color.color_ED2800')*/)
// .borderRadius('10lpx')
// .margin({ right: '10lpx' })
//
// Span(this.contentDTO.newsTitle)
// .fontColor($r('app.color.color_222222'))
// .fontSize('33lpx')
// .fontWeight('400lpx')
// .lineHeight('48lpx')
// }.textAlign(TextAlign.Start)
// .maxLines(2)
// .textOverflow({ overflow: TextOverflow.Ellipsis })
//TODO 这里的样式(objectType) 只写了两个,其他的需要扩展
Text(this.contentDTO.objectType == "new_collect" ? "征稿" : this.contentDTO.objectType == "vote" ? "投票":"")
.fontColor($r('app.color.white'))
.fontSize('23lpx')
.fontWeight('400lpx')
.lineHeight('31lpx')
.textAlign(TextAlign.Center)
.padding({left:'10lpx',right:'10lpx',top:'6lpx',bottom:'6lpx'})
.backgroundColor( $r('app.color.color_ED2800'))
.borderRadius('10lpx')
.margin({ right: '10lpx' })
Text(this.contentDTO.newsTitle)
.fontColor($r('app.color.color_222222'))
.fontSize('33lpx')
.fontWeight('400lpx')
.lineHeight('48lpx')
.textAlign(TextAlign.Start)
.maxLines(2)
.layoutWeight(1)
}
.margin({ bottom: '15lpx' })
.alignItems(VerticalAlign.Top)
.width('100%')
Row() {
Image($r('app.media.time_icon'))
.width('27lpx')
.height('27lpx')
.objectFit(ImageFit.Auto)
.margin({ right: '4lpx' })
.interpolation(ImageInterpolation.Medium)
Text("时间:" + this.contentDTO.startTime.split(" ")[0] + "~" + this.contentDTO.endTime.split(" ")[0])
.fontColor($r('app.color.color_999999'))
.fontSize('23lpx')
.fontWeight('400lpx')
.lineHeight('31lpx')
}
Blank()
Text(this.contentDTO.programType+"" === "1" ? "立即参与" : "立即查看")
.fontColor($r('app.color.white'))
.fontSize('23lpx')
.fontWeight('500lpx')
.lineHeight('38lpx')
.width('154lpx')
.height('54lpx')
.textAlign(TextAlign.Center)
.backgroundColor(this.contentDTO.programType+"" == "1" ? $r('app.color.color_ED2800') : $r('app.color.color_F07E47'))
.borderRadius('6lpx')
}.alignItems(HorizontalAlign.Start)
.width('428lpx')
.height('276lpx')
}.height('330lpx')
.justifyContent(FlexAlign.SpaceBetween)
.width('100%')
.padding({left:'31lpx',right:'31lpx'})
}
}
\ No newline at end of file
... ...
... ... @@ -253,7 +253,8 @@ export struct SearchComponent {
if(StringUtils.isNotEmpty(this.searchText)){
SearcherAboutDataModel.putSearchHistoryData(this.searchText)
this.getSearchHistoryData()
ToastUtils.shortToast("插入一条搜索记录")
this.getSearchHotResData(this.searchText)
}
}else{
router.back()
... ...
import { SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
@Component
export struct SearchCreatorComponent{
@ObjectLink item: SearchRmhDescription
build() {
Column(){
Image(this.item.headerPhotoUrl)
.width('92lpx')
.alt($r('app.media.default_head'))
.height('92lpx')
.margin({bottom:'15lpx'})
.borderRadius(50)
Text(this.item.creatorName)
.fontSize('25lpx')
.fontWeight('400lpx')
.lineHeight('35lpx')
.constraintSize({maxWidth:'150lpx'})
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}.alignItems(HorizontalAlign.Center)
.justifyContent(FlexAlign.Center)
}
}
\ No newline at end of file
... ...
import { ContentDTO,
contentListParams,
FullColumnImgUrlDTO, InteractDataDTO, RmhInfoDTO, VideoInfoDTO } from 'wdBean/Index'
FullColumnImgUrlDTO, InteractDataDTO,
Params,
RmhInfoDTO, VideoInfoDTO } from 'wdBean/Index'
import { LiveInfoDTO } from 'wdBean/src/main/ets/bean/detail/LiveInfoDTO'
import { VoiceInfoDTO } from 'wdBean/src/main/ets/bean/detail/VoiceInfoDTO'
import { LazyDataSource, StringUtils } from 'wdKit/Index'
import { LazyDataSource, Logger, StringUtils, ToastUtils } from 'wdKit/Index'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem'
import { SearchResultContentData } from '../../viewmodel/SearchResultContentData'
import { SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
import { CardParser } from '../CardParser'
import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI'
import { ActivityItemComponent } from './ActivityItemComponent'
import { SearchCreatorComponent } from './SearchCreatorComponent'
const TAG = "SearchResultContentComponent"
... ... @@ -18,7 +24,7 @@ export struct SearchResultContentComponent{
@State searchType:string = ""
@State data: LazyDataSource<ContentDTO> = new LazyDataSource();
@State data_rmh: SearchRmhDescription[] = []
@State count:number = 0;
@State count:number = -1;
@State isLoading:boolean = false
@State hasMore:boolean = true
curPageNum:number = 1;
... ... @@ -50,15 +56,40 @@ export struct SearchResultContentComponent{
this.isLoading = false
}else{
if(value.list[0].dataList!=null){
this.data_rmh = value.list[0].dataList
let data_temp: SearchRmhDescription[] = []
data_temp = value.list[0].dataList
//TODO 查询创作者详情接口
let request = new CreatorDetailRequestItem()
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){
data.headerPhotoUrl = item.headPhotoUrl.split("?")[0]
}
})
})
}
data_temp.forEach((data)=>{
this.data_rmh.push(data)
})
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
})
}
this.getInteractData(value)
}
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
this.isLoading = false
this.count = this.count===-1?0:this.count
})
}
}
... ... @@ -105,7 +136,7 @@ export struct SearchResultContentComponent{
cityCode: value.data.cityCode,
coverSize: "",
coverType: -1,
coverUrl: value.data.appStyleImages.split("&&")[0],
coverUrl: this.searchType=="activity"?value.data.zhChannelPageImg:value.data.appStyleImages.split("&&")[0],
description: value.data.description,
districtCode: value.data.districtCode,
endTime: value.data.endTime,
... ... @@ -122,7 +153,7 @@ export struct SearchResultContentComponent{
programId: "",
programName: "",
programSource: -1,
programType: -1,
programType: Number.parseInt(value.data.status),
provinceCode: value.data.provinceCode,
showTitleEd: value.data.showTitleEd,
showTitleIng: value.data.showTitleIng,
... ... @@ -134,7 +165,7 @@ export struct SearchResultContentComponent{
vImageUrl: "",
screenType: "",
source: StringUtils.isEmpty(value.data.creatorName) ? value.data.sourceName : value.data.creatorName,
objectId: "",
objectId: value.data.id,
objectType: value.data.type,
channelId: value.data.channelId,
relId: value.data.relId,
... ... @@ -175,6 +206,7 @@ export struct SearchResultContentComponent{
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
this.isLoading = false
this.count = this.count===-1?0:this.count
})
}
... ... @@ -186,42 +218,63 @@ export struct SearchResultContentComponent{
Column(){
if (this.data_rmh!=null && this.data_rmh.length > 0) {
//List
List() {
List({space:'8lpx'}) {
ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => {
ListItem() {
Column(){
Image($r('app.media.default_head'))
.width('84lpx')
.height('84lpx')
.margin({bottom:'15lpx'})
Text(item.creatorName)
.fontSize('20lpx')
}.alignItems(HorizontalAlign.Center)
SearchCreatorComponent({item:item})
}.onClick(()=>{
//TODO 跳转
})
.width('150lpx')
.height('100%')
})
ListItem(){
Column(){
Text("查看更多")
.width('19lpx')
.fontSize('19lpx')
.fontWeight('400lpx')
.lineHeight('27lpx')
.fontColor($r('app.color.color_9E9E9E'))
}.borderRadius({topLeft:'4lpx',bottomLeft:'4lpx'})
.height('180lpx')
.width('77lpx')
.backgroundColor($r('app.color.color_EDEDED'))
.justifyContent(FlexAlign.Center)
}.height('100%')
.margin({left:'23lpx'})
.onClick(()=>{
let params: Params = {
pageID: this.keywords
}
WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage,params)
})
}
.cachedCount(6)
.edgeEffect(EdgeEffect.None)
.edgeEffect(EdgeEffect.Spring)
.scrollBar(BarState.Off)
.listDirection(Axis.Horizontal)
.width('100%')
.height('150lpx')
.onReachEnd(()=>{
if(!this.isLoading){
//进入更多关注页
}
})
.height('219lpx')
Divider()
.width('100%')
.height('12lpx')
.color($r('app.color.color_F5F5F5'))
.strokeWidth('12lpx')
}
//List
List({ space: '6lpx' }) {
LazyForEach(this.data, (item: ContentDTO, index: number) => {
ListItem() {
Column(){
if(this.searchType == "activity"){
ActivityItemComponent({contentDTO:item})
}else{
CardParser({contentDTO:item})
}
if(index != this.data.totalCount()-1 ){
Divider()
.width('100%')
... ... @@ -245,7 +298,6 @@ export struct SearchResultContentComponent{
}.cachedCount(6)
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.margin({top:'23lpx',left:'23lpx',right:'23lpx'})
.layoutWeight(1)
.onReachEnd(()=>{
console.log(TAG,"触底了");
... ...
import { EmptyComponent } from '../view/EmptyComponent'
@Entry
@Component
export struct DefaultPage {
build() {
Row() {
EmptyComponent({ emptyType: 8 })
}
}
}
\ No newline at end of file
... ...
... ... @@ -4,7 +4,7 @@
@Entry
@Component
export struct detailedSkeleton {
export struct newsSkeleton {
@State quantity: Array<number> = [1, 2, 3,]
build() {
... ...
... ... @@ -23,7 +23,7 @@ export const enum WDViewDefaultType {
WDViewDefaultType_NoCollection,
///无历史记录
WDViewDefaultType_NoHistory,
///网络失败
///网络失败 请稍后重试-倒计时
WDViewDefaultType_NetworkFailed,
///内容获取失败
WDViewDefaultType_ContentFailed,
... ... @@ -36,18 +36,25 @@ export const enum WDViewDefaultType {
///该号主无法访问
WDViewDefaultType_NoVisitAccount,
///暂无关注
WDViewDefaultType_NoFollow
WDViewDefaultType_NoFollow,
///直播结束
WDViewDefaultType_NoLiveEnd,
/// 直播暂停
WDViewDefaultType_NoLiveSuspend,
/// 视频加载失败
WDViewDefaultType_NoVideo,
}
/**
* 空数据/无数据
*/
@Preview
@Component
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
/**
* The empty image width percentage setting.
*/
... ... @@ -101,16 +108,62 @@ export struct EmptyComponent {
let contentString: string = '暂无内容'
if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCollection) {
contentString = '暂无收藏'
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoMessage) {
contentString = '暂无消息'
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment) {
contentString = '暂无评论'
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoSearchResult) {
contentString = '没有找到相关内容'
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoNetwork) {
contentString = '网络出小差了,请检查网络后重试'
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_ContentFailed) {
contentString = '获取内容失败请重试'
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCreation) {
contentString = '暂无作品'
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoBooking) {
contentString = '暂无预约'
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NetworkFailed) {
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 = '获取内容失败请重试' // 前方拥堵,请耐心等待
}
return contentString
}
buildNoDataTipImage(): Resource | string {
Logger.info(TAG, "buildNoDataTip");
let imageString: Resource | string = $r('app.media.icon_no_content')
if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCollection) {
imageString = $r('app.media.icon_no_collection')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoMessage) {
imageString = $r('app.media.icon_no_message')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment) {
imageString = $r('app.media.icon_no_comment')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoSearchResult) {
imageString = $r('app.media.icon_no_result')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoNetwork) {
imageString = $r('app.media.icon_no_net')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_ContentFailed) {
imageString = $r('app.media.icon_no_content')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCreation) {
imageString = $r('app.media.icon_no_appointmentMade')
} 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')
} 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')
}
return imageString
}
... ...
... ... @@ -7,6 +7,8 @@ import { SearchHotContentItem } from '../viewmodel/SearchHotContentItem';
import { SearchResultCountItem } from '../viewmodel/SearchResultCountItem';
import { SearchResultContentData } from '../viewmodel/SearchResultContentData';
import { contentListParams, InteractDataDTO } from 'wdBean/Index';
import { CreatorDetailRequestItem } from '../viewmodel/CreatorDetailRequestItem';
import { CreatorDetailResponseItem } from '../viewmodel/CreatorDetailResponseItem';
const TAG = "SearcherAboutDataModel"
... ... @@ -320,6 +322,37 @@ class SearcherAboutDataModel{
}
/**
* 获取关注详情 列表
*/
getCreatorDetailListData(object:CreatorDetailRequestItem): Promise<CreatorDetailResponseItem[]> {
return new Promise<CreatorDetailResponseItem[]>((success, error) => {
Logger.info(TAG, `getCreatorDetailListData start`);
this.fetchCreatorDetailListData(object).then((navResDTO: ResponseDTO<CreatorDetailResponseItem[]>) => {
if (!navResDTO || navResDTO.code != 0) {
success([])
return
}
Logger.info(TAG, "getCreatorDetailListData then,SearchResultListResDTO.timeStamp:" + navResDTO.timestamp);
let navigationBean = navResDTO.data as CreatorDetailResponseItem[]
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `getCreatorDetailListData catch, error.name : ${err.name}, error.message:${err.message}`);
success([])
})
})
}
fetchCreatorDetailListData(object:CreatorDetailRequestItem) {
let url = HttpUrlUtils.getCreatorDetailListDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post<ResponseDTO<CreatorDetailResponseItem[]>>(url,object, headers)
};
}
const searcherAboutDataModel = SearcherAboutDataModel.getInstance()
... ...
... ... @@ -2,7 +2,6 @@ import router from '@ohos.router'
import { Params } from 'wdBean';
import { StringUtils } from 'wdKit';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
import { CardParser } from '../components/CardParser';
import { HomePageBottomComponent } from '../components/mine/home/HomePageBottomComponent';
import MinePageDatasModel from '../model/MinePageDatasModel';
... ... @@ -183,37 +182,14 @@ struct MineHomePage {
Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx')
Column(){
Column() {
// 页签
Row({ space: 7 }) {
Scroll() {
Row() {
this.TabBuilder(0,"评论")
this.TabBuilder(1,"关注")
}
.justifyContent(FlexAlign.Start)
}
.align(Alignment.Start)
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.width('90%')
.padding({left:'31lpx'})
}
.alignItems(VerticalAlign.Bottom)
.width('100%')
}
.alignItems(HorizontalAlign.Start)
.width('100%')
//tab 页面
Tabs({controller: this.controller}) {
TabContent() {
HomePageBottomComponent({style:0})
}
}.tabBar(this.TabBuilder(0,"评论"))
TabContent() {
HomePageBottomComponent({style:1})
}
}.tabBar(this.TabBuilder(1,"关注"))
}
.backgroundColor($r('app.color.white'))
.animationDuration(0)
... ... @@ -221,8 +197,6 @@ struct MineHomePage {
this.currentIndex = index
})
.vertical(false)
.barHeight(0)
}
}.width("100%")
}
.edgeEffect(EdgeEffect.None)
... ... @@ -232,8 +206,8 @@ struct MineHomePage {
}
}.width('100%')
.layoutWeight(1)
}
}
@Builder MineHomeTitleTransparent() {
RelativeContainer() {
//标题栏目
... ... @@ -368,9 +342,9 @@ struct MineHomePage {
this.currentIndex = index
this.controller.changeIndex(this.currentIndex)
})
.height('77lpx')
.width('70lpx')
.margin({right:'29lpx'})
.height('100%')
.width('100%')
.margin({right:'9lpx'})
}
/**
... ...
... ... @@ -172,42 +172,17 @@ struct OtherNormalUserHomePage {
.width('100%')
.backgroundColor($r('app.color.white'))
}
//间隔符
Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx')
Column(){
Column() {
// 页签
Row({ space: 7 }) {
Scroll() {
Row() {
this.TabBuilder(0,"评论")
this.TabBuilder(1,"关注")
}
.justifyContent(FlexAlign.Start)
}
.align(Alignment.Start)
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.width('90%')
.padding({left:'31lpx'})
}
.alignItems(VerticalAlign.Bottom)
.width('100%')
}
.backgroundColor($r('app.color.white'))
.alignItems(HorizontalAlign.Start)
.width('100%')
//tab 页面
Tabs({controller: this.controller}) {
TabContent() {
OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead,commentNum:$commentNum})
}
}.tabBar(this.TabBuilder(0,"评论"))
TabContent() {
OtherHomePageBottomFollowComponent({curUserId:this.curUserId})
}
}.tabBar(this.TabBuilder(1,"关注"))
}
.backgroundColor($r('app.color.white'))
.animationDuration(0)
... ... @@ -215,8 +190,6 @@ struct OtherNormalUserHomePage {
this.currentIndex = index
})
.vertical(false)
.barHeight(0)
}
}.width("100%")
}
.edgeEffect(EdgeEffect.None)
... ... @@ -327,9 +300,9 @@ struct OtherNormalUserHomePage {
this.currentIndex = index
this.controller.changeIndex(this.currentIndex)
})
.height('77lpx')
.width('70lpx')
.margin({right:'29lpx'})
.height('100%')
.width('100%')
.margin({right:'9lpx'})
}
... ...