陈剑华

Merge remote-tracking branch 'origin/main'

Showing 58 changed files with 1037 additions and 458 deletions
... ... @@ -7,6 +7,7 @@ const TAG = 'KVStoreHelper'
/**
* 键值型数据库管理类,类似sp,存储变大,单条数据,value<4M
* TODO 是否需要开线程
*/
export class KVStoreHelper {
private static _context: Context;
... ... @@ -16,7 +17,6 @@ export class KVStoreHelper {
private kvStore: distributedKVStore.SingleKVStore | undefined = undefined;
private constructor() {
Logger.error(TAG, 'constructor')
}
static init(context: Context) {
... ...
... ... @@ -7,6 +7,7 @@ import { HostEnum, HostManager } from './HttpHostManager';
* 网络请求参数工具类,TODO 不对外暴露,收缩权限
*/
export class HttpParams {
static buildHeaders(): Record<string, string> {
let headers: Record<string, string> = {};
// 通用请求头
... ... @@ -90,8 +91,17 @@ export class HttpParams {
return '10000';
}
private static getVersionName() {
public static getVersionName() {
// TODO 读取配置
return '1.0.0';
}
//获取机型
static getPhoneModel() {
return 'getPhoneModel'
}
//获取当前手机系统版本号
static getSystemVersion() {
return 'getSystemVersion'
}
}
\ No newline at end of file
... ...
... ... @@ -349,6 +349,11 @@ export class HttpUrlUtils {
*/
static readonly HISTORY_PUSH_MESSAGE_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/push";
/**
* 意见反馈-提交
*/
static readonly FEEDBACK_COMMIT_PATH: string = "/api/rmrb-interact/interact/zh/c/user/feedBack";
static getHost(): string {
return HostManager.getHost();
}
... ...
/**
* 接口数据存储封装类
*/
import { DateTimeUtils, StringUtils } from 'wdKit/Index';
import { CacheDataSaveUtil } from './CacheDataSaveUtil';
import { JSON } from '@kit.ArkTS';
/**
* 接口数据存储封装类
*/
export class CacheData {
/**
* 底部导航栏缓存的数据key
*/
static bottomCacheKey = 'bottom_cache_data_key'
/**
* 头部频道缓存的数据key
*/
static channelCacheDataKey = 'channel_data_cache_id_'
/**
* 页面page组件的数据key
*/
static comPageInfoCacheKey = 'com_pageInfo_cache_id_'
/**
* 页面组件的数据key
*/
static compGroupInfoDataCacheKey = 'com_data_info_cache_id_'
// 接口返回数据
networkData?: object;
// 数据更新时间戳
... ... @@ -48,16 +65,20 @@ export class CacheData {
success(null)
return
}
let ll = CacheDataSaveUtil.get(key)
if (ll instanceof Promise) {
ll.then((data) => {
let str = data as string
let cache = JSON.parse(str) as CacheData
success(cache)
})
} else {
CacheDataSaveUtil.get(key).then((data) => {
let str = data as string
let cache = JSON.parse(str) as CacheData
success(cache)
}).catch(() => {
success(null)
}
})
})
}
static getNetworkData(data: CacheData): string {
if (data.networkData) {
return JSON.stringify(data.networkData);
}
return "";
}
}
\ No newline at end of file
... ...
... ... @@ -11,10 +11,18 @@ export class CacheDataSaveUtil {
KVStoreHelper.default.put(key, value)
}
static get(key: string) {
if (StringUtils.isEmpty(key)) {
return ''
}
return KVStoreHelper.default.get(key, '')
static get(key: string): Promise<string> {
return new Promise<string>((success) => {
if (StringUtils.isEmpty(key)) {
success('')
} else {
KVStoreHelper.default.get(key, '').then((data) => {
let str = data as string
success(str)
}).catch(() => {
success('')
})
}
})
}
}
\ No newline at end of file
... ...
import HomeChannelUtils from './src/main/ets/utils/HomeChannelUtils';
export default HomeChannelUtils;
export { WDRouterRule } from './src/main/ets/router/WDRouterRule'
export { WDRouterPage } from './src/main/ets/router/WDRouterPage'
... ... @@ -6,4 +10,6 @@ export { registerRouter } from './src/main/ets/router/Action2Page'
export { ProcessUtils } from './src/main/ets/utils/ProcessUtils'
export { AssignChannelParam } from './src/main/ets/utils/HomeChannelUtils';
export { RouterJumpInterceptor, JumpInterceptorAction } from './src/main/ets/router/RouterJumpInterceptor'
\ No newline at end of file
... ...
... ... @@ -2,7 +2,6 @@ import { BottomNavDTO, NavigationBodyDTO, TopNavDTO } from 'wdBean/Index';
import { EmitterEventId, EmitterUtils, StringUtils } from 'wdKit/Index';
import { WDRouterPage } from '../router/WDRouterPage';
import { WDRouterRule } from '../router/WDRouterRule';
import { HashMap } from '@kit.ArkTS';
/**
* 首页、频道相关跳转、处理
... ...
import { Action, ContentDTO, Params, PhotoListBean, commentInfo } from 'wdBean';
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';
import { Logger } from 'wdKit';
import { Logger, SPHelper } from 'wdKit';
import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils';
import { WDRouterRule, WDRouterPage } from '../../../../Index';
import { ContentConstants } from 'wdConstant';
import { ContentConstants, SpConstants } from 'wdConstant';
import { common, Want } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
... ... @@ -462,7 +462,13 @@ export class ProcessUtils {
/**
* 意见反馈
*/
public static gotoFeedBackActivity() {
public static async gotoFeedBackActivity() {
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
params: {
... ...
... ... @@ -122,7 +122,9 @@ function handleJsCallReceiveH5Data(data: Message) {
width: item.width,
height: item.height,
picPath: item.pic,
picDesc: ''
picDesc: '',
itemType:2,
id:0
}
return photo
})
... ...
... ... @@ -174,4 +174,4 @@ export { ReserveItemBean } from './src/main/ets/bean/live/ReserveItemBean';
export { FeedbackTypeBean } from './src/main/ets/bean/detail/FeedbackTypeBean';
\ No newline at end of file
export { FeedbackTypeBean } from './src/main/ets/bean/detail/FeedbackTypeBean';
... ...
... ... @@ -13,4 +13,6 @@ export interface PageDTO {
compList: CompDTO[]; // Components集合的布局信息
compAdList:CompAdvBean[] // 页面广告
md5: string
}
\ No newline at end of file
... ...
... ... @@ -4,10 +4,13 @@
// 【图文、图集稿件正文图片】图片信息数组
export interface PhotoListBean {
id: number;
height: number;
width: number;
picPath: string;
picDesc: string;
//1添加图片,2图片
itemType: number;
}
export interface InputMethodProperty {
... ...
... ... @@ -4,17 +4,20 @@ import { TopNavDTO } from './TopNavDTO';
/**
* 导航Body数据
*/
export interface NavigationBodyDTO {
backgroundColor: string; // 迭代二新增-底部导航背景色(信息流频道)
bottomNavList: BottomNavDTO[];
export class NavigationBodyDTO {
backgroundColor: string = ''; // 迭代二新增-底部导航背景色(信息流频道)
bottomNavList: BottomNavDTO[] = [];
// greyBottomNav: GreyBottomNav; // 灰度皮肤
immersiveBackgroundColor: string; // 迭代二新增-底部导航背景色(沉浸式频道)
nightBackgroundColor: string; // 迭代三新增-底部导航背景色(夜间模式)
immersiveBackgroundColor: string = ''; // 迭代二新增-底部导航背景色(沉浸式频道)
nightBackgroundColor: string = ''; // 迭代三新增-底部导航背景色(夜间模式)
md5: string = ''
}
export interface NavigationDetailDTO {
id: string; // 迭代二新增-底部导航背景色(信息流频道)
bottomNavCompList: BottomNavCompDTO[];
topNavChannelList: TopNavDTO[];
export class NavigationDetailDTO {
id: string = ''; // 迭代二新增-底部导航背景色(信息流频道)
bottomNavCompList: BottomNavCompDTO[] = [];
topNavChannelList: TopNavDTO[] = [];
md5: string = ''
}
... ...
... ... @@ -41,6 +41,7 @@ export interface PageInfoDTO {
*/
pageAdList:CompAdvBean[]
md5:string
}
export interface ChannelInfoDTO {
... ...
/**
* 顶导
*/
export interface TopNavDTO {
channelId: number;
channelStyle: number;
channelType: number; // 频道样式;1-沉浸式;2-信息流;3-特殊频道(跳转指定页面的,如版面)
defaultPermitted: number;
delPermitted: number;
fontCColor: string; // 频道展示样式颜色(选中状态)
fontColor: string; // 频道展示样式颜色(未选中状态)
headlinesOn: number;
homeChannel: string;
iconUrlSize: string;
iconCUrlSize: string;
iconUrl: string; // 频道图片展示样式图片相对地址(未选中状态)
iconCUrl: string; //频道图片展示样式图片相对地址(选中状态
localChannel: string;
moreChannel: string;
movePermitted: number;
myChannel: string;
name: string;
num: number;
pageId: number;
pageType: string;
underlineCColor: string; // 选中下划线颜色
export class TopNavDTO {
channelId: number = 0;
channelStyle: number = 0;
channelType: number = 0; // 频道样式;1-沉浸式;2-信息流;3-特殊频道(跳转指定页面的,如版面)
defaultPermitted: number = 0;
delPermitted: number = 0;
fontCColor: string = ''; // 频道展示样式颜色(选中状态)
fontColor: string = ''; // 频道展示样式颜色(未选中状态)
headlinesOn: number = 0;
homeChannel: string = '';
iconUrlSize: string = '';
iconCUrlSize: string = '';
iconUrl: string = ''; // 频道图片展示样式图片相对地址(未选中状态)
iconCUrl: string = ''; //频道图片展示样式图片相对地址(选中状态
localChannel: string = '';
moreChannel: string = '';
movePermitted: number = 0;
myChannel: string = '';
name: string = '';
num: number = 0;
pageId: number = 0;
pageType: string = '';
underlineCColor: string = ''; // 选中下划线颜色
}
... ...
... ... @@ -44,7 +44,7 @@ export struct CardParser {
} else if (contentDTO.appStyle === CompStyle.Card_04) {
Card4Component({ compDTO: this.compDTO, contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_05) {
Card5Component({ contentDTO, titleShowPolicy: this.compDTO.titleShowPolicy })
Card5Component({ contentDTO, titleShowPolicy: this.compDTO.titleShowPolicy, compDTO: this.compDTO })
} else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle
.Card_13) {
Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO })
... ...
... ... @@ -45,6 +45,10 @@ import { detailedSkeleton } from './skeleton/detailSkeleton';
const TAG = 'DynamicDetailComponent'
const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
/**
* @author wd-zsz
* */
// @Preview
@Component
export struct DynamicDetailComponent {
... ...
import { FeedbackTypeBean } from 'wdBean/Index';
import { NetworkUtil } from 'wdKit/Index';
import { FeedbackTypeBean, PhotoListBean } from 'wdBean/Index';
import { FastClickUtil, Logger, NetworkUtil, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { CustomTitleUI } from './reusable/CustomTitleUI'
import { ArrayList } from '@kit.ArkTS';
import { picker } from '@kit.CoreFileKit';
import { BusinessError } from '@kit.BasicServicesKit';
import { router } from '@kit.ArkUI';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter/Index';
import { HashMap } from '@kit.ArkTS';
import { HttpParams } from 'wdNetwork/src/main/ets/http/HttpCommonParams';
const TAG = 'FeedBackActivity'
// 意见反馈页面
/**
* 意见反馈页面
* @author wd-zsz
* */
@Entry
@Component
export struct FeedBackActivity {
@State canSubmit: boolean = false;
@State textNumLabel: string = '0/500';
contact: string = "";
email: string = "";
//UI
scroller: Scroller = new Scroller();
@State isNetConnected: boolean = true
@State feedbackTypeBeans: FeedbackTypeBean[] = [] as FeedbackTypeBean[]
//添加图片
addPic: PhotoListBean = {itemType:1} as PhotoListBean
@State pics: PhotoListBean[] = [this.addPic] as PhotoListBean[]
// 选择媒体文件的最大数目
selectNum = 3;
async aboutToAppear() {
await this.getContentDetailData()
... ... @@ -23,97 +42,209 @@ export struct FeedBackActivity {
build() {
Column() {
//标题栏目
CustomTitleUI({ titleName: "意见反馈" })
CustomTitleUI({ titleName: $r('app.string.feedback') })
Stack({ alignContent: Alignment.Bottom }) {
Scroll(this.scroller) {
Column() {
Text('请选择问题类型')
Text($r('app.string.feedback_opinion_type'))
.fontColor($r('app.color.color_222222'))
.fontSize($r('app.float.font_size_16'))
.fontWeight(FontWeight.Bold)
.width('100%')
.margin({ left: $r('app.float.vp_15'), top: $r('app.float.vp_14') })
GridRow({
gutter: { x: 2, y: 2 }
columns:3,
}) {
ForEach(this.feedbackTypeBeans, (item: FeedbackTypeBean, index: number) => {
ForEach(this.feedbackTypeBeans, (feedbackTypeBean: FeedbackTypeBean, index: number) => {
GridCol({
span: 12
}) {
Row(){
Toggle({ type: ToggleType.Checkbox, isOn: false })
Text(item.classifyName)
.onChange((select) => {
feedbackTypeBean.isselect = select
this.canSubmit = this.checkSubmit()
})
Text(feedbackTypeBean.classifyName)
.fontColor($r('app.color.color_222222'))
.fontSize($r('app.float.font_size_14'))
.fontWeight(FontWeight.Bold)
.margin({ left: $r('app.float.vp_4') })
}
.width(115)
.height(22)
.width($r('app.float.margin_115'))
.height($r('app.float.vp_22'))
.margin({bottom:$r('app.float.margin_16')})
.backgroundColor($r('app.color.color_fff'))
}
})
}
.width('100%')
.margin({top:$r('app.float.vp_16')})
Blank()
.height(0.5)
.margin({ left: $r('app.float.vp_16'), top: $r('app.float.vp_12'), right: $r('app.float.vp_16') })
.backgroundColor($r('app.color.color_EDEDED'))
Text('描述您的问题')
.height($r('app.float.margin_5'))
.backgroundColor($r('app.color.color_F5F5F5'))
Text($r('app.string.feedback_opinion_tv'))
.fontColor($r('app.color.color_222222'))
.fontSize($r('app.float.font_size_16'))
.fontWeight(FontWeight.Bold)
.width(CommonConstants.FULL_WIDTH)
.margin({ left: $r('app.float.vp_16'), top: $r('app.float.vp_12') })
Stack() {
TextInput({ placeholder: '您的宝贵意见是我们前行的动力' })
GridRow({
gutter: { x: 2, y: 2 }
}) {
ForEach(this.feedbackTypeBeans, (item: FeedbackTypeBean, index: number) => {
GridCol({
span: 12
}) {
}
})
Stack({ alignContent: Alignment.BottomEnd }) {
TextArea({ placeholder: $r('app.string.feedback_comments') })
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.padding({bottom:96})
.backgroundColor($r('app.color.color_F5F5F5'))
.align(Alignment.TopStart)
.maxLength(500)
.onChange((value) => {
// Logger.debug(TAG, "onChange" + value + "/" + this.passwordContent)
this.contact = value
this.textNumLabel = value.length+"/500"
this.canSubmit = this.checkSubmit()
})
GridRow({
columns:5,
}) {
ForEach(this.pics, (feedbackImageItem: PhotoListBean, index: number) => {
GridCol({
}) {
if(1 == feedbackImageItem.itemType){
Image($r('app.media.feekback_add'))
.width(60)
.height(60)
.onClick(async (event: ClickEvent) => {
if(await FastClickUtil.isMinDelayTime()){
return
}
this.callFilePickerSelectImage();
})
}else{
Stack({alignContent: Alignment.TopEnd}) {
Image(feedbackImageItem.picPath)
.width(60)
.height(60)
.borderRadius($r('app.float.margin_1'))
.onClick(async (event: ClickEvent) => {
if(await FastClickUtil.isMinDelayTime()){
return
}
//查看图片 fixme 去除添加按钮
ProcessUtils.gotoMultiPictureListPage(this.pics, index)
})
Image($r('app.media.icon_feekback_delete'))
.width(24)
.height(24)
.borderRadius($r('app.float.margin_1'))
.onClick(async (event: ClickEvent) => {
if(await FastClickUtil.isMinDelayTime()){
return
}
let temp: PhotoListBean[] = [] as PhotoListBean[]
temp.length = this.pics.length - 1;
let tempIndex = 0;
for (let index = 0; index < this.pics.length; index++) {
const element = this.pics[index];
if(!StringUtils.isEmpty(element.picPath) && element.id != feedbackImageItem.id){
temp[tempIndex] = element;
tempIndex = tempIndex+1
}
}
if(tempIndex < 3){
temp[tempIndex] = this.addPic
}
this.pics = temp
})
}
.width(60)
.height(60)
}
}
})
}
.margin({bottom: $r('app.float.vp_12'), right: $r('app.float.vp_12'),left: $r('app.float.vp_12')})
Text(this.textNumLabel)
.margin({bottom: $r('app.float.vp_12'), right: $r('app.float.vp_11')})
}
.height(200)
.width('90%')
.margin({ top: $r('app.float.vp_12') })
.backgroundColor($r('app.color.color_F5F5F5'))
.borderRadius(4)
Text('0/500')
}
.height(200)
.width('100%')
.margin({ left: $r('app.float.vp_16'), top: $r('app.float.vp_12'), right: $r('app.float.vp_16') })
.backgroundColor($r('app.color.color_F5F5F5'))
.borderRadius(4)
Text('期待您留下联系方式,我们将提供更好的服务')
Text($r('app.string.feedback_email'))
.fontColor($r('app.color.color_222222'))
.fontSize($r('app.float.font_size_14'))
.fontWeight(FontWeight.Bold)
.width('100%')
.margin({ left: $r('app.float.vp_16'), top: $r('app.float.margin_24') })
Row() {
Text('电话或者邮箱')
Text($r('app.string.feedback_mail'))
.fontColor($r('app.color.color_222222'))
.fontSize($r('app.float.font_size_14'))
.fontWeight(FontWeight.Bold)
.margin({ left: $r('app.float.vp_12') })
TextInput({ placeholder: '请输入电话或者邮箱' })
TextInput({ placeholder: $r('app.string.feedback_hideemail') })
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.backgroundColor($r('app.color.color_F5F5F5'))
.onChange((value) => {
// Logger.debug(TAG, "onChange" + value + "/" + this.passwordContent)
this.email = value
})
}
.height(44)
.margin({ left: $r('app.float.vp_16'), right: $r('app.float.vp_12'), top: $r('app.float.margin_16') })
.width('90%')
.backgroundColor($r('app.color.color_F5F5F5'))
.margin({top: $r('app.float.margin_16') })
.borderRadius(4)
Blank().layoutWeight(1)
}
}
Text($r('app.string.submit'))
.height(44)
.fontColor($r('app.color.color_9E9E9E_40'))
.fontSize($r('app.float.font_size_18'))
.margin({ left: $r('app.float.vp_16'), right: $r('app.float.vp_16'), top: $r('app.float.vp_15') })
.backgroundColor($r('app.color.color_ED2800_99'))
.borderRadius(4)
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.scrollBar(BarState.Off)
.alignSelf(ItemAlign.Start)
.padding({ bottom: 44 })
Column(){
Text($r('app.string.submit'))
.align(Alignment.Center)
.height(44)
.width('90%')
.fontColor(this.canSubmit?$r('app.color.color_9E9E9E_40'):$r('app.color.color_fff'))
.fontSize($r('app.float.font_size_18'))
.backgroundColor(this.canSubmit?$r('app.color.color_ED2800_99'):$r('app.color.color_EDEDED'))
.borderRadius(4)
.onClick(async (event: ClickEvent) => {
if(await FastClickUtil.isMinDelayTime()){
return
}
this.reportCommit()
})
Blank().height(15).width('100%')
}
.height(59)
}
}
}
/**
* 校验可提交状态
* */
checkSubmit(): boolean {
if(StringUtils.isEmpty(this.contact) || this.contact.length < 10){
return false
}
if(this.feedbackTypeBeans == null || this.feedbackTypeBeans.length == 0){
return false
}
return true
}
/**
* 请求接口数据
* */
... ... @@ -126,4 +257,117 @@ export struct FeedBackActivity {
console.log('请求失败',JSON.stringify(exception))
}
}
/**
* 拉起picker选择图片/视频
*/
async callFilePickerSelectImage(): Promise<void> { // async 用于申明一个 function 是异步的
let array: string[];
try {
// 设置photoPicker的参数
let PhotoSelectOptions = new picker.PhotoSelectOptions();
PhotoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; // 过滤选择媒体文件类型
PhotoSelectOptions.maxSelectNumber = this.selectNum; // 选择媒体文件的最大数目
let mediaFlag = false;
let photoPicker = new picker.PhotoViewPicker(); // 使用图库选择器对象前,需要先创建PhotoViewPicker实例
photoPicker.select(PhotoSelectOptions).then((PhotoSelectResult) => {
Logger.info(TAG, 'PhotoViewPicker.select successfully, PhotoSelectResult uri: ' + JSON.stringify(PhotoSelectResult)); // 日志中记录成功信息
if (PhotoSelectResult !== null && PhotoSelectResult !== undefined) { // 接口采用callback异步返回形式,返回PhotoSelectResult对象,故进行下一步操作前要先判断是否已经成功返回PhotoSelectResult对象了
// PhotoSelectResult为返回的结果集。
// 其中包含Array<string>类型的photoUris,为返回图库选择后的媒体文件的uri数组;还包含boolean类型的isOriginalPhoto,指示返回图库选择后的媒体文件是否为原图。
// 声明变量array,其取值为PhotoSelectResult中的数组。
array = PhotoSelectResult['photoUris'];
let startIndex = this.pics.length-1;
let totalLen = this.pics.length+array.length;
if(totalLen > 3){
totalLen = 3
}
this.pics.length = totalLen;
array.forEach((value) => {
let pic: PhotoListBean = {itemType:2,picPath:value} as PhotoListBean
pic.id = startIndex
this.pics[startIndex] = pic
startIndex = startIndex+1;
mediaFlag = true;
Logger.info(TAG, `select image/video uri: ${value}`);
})
if(this.pics.length<3){
this.addPic.id = startIndex
this.pics[this.pics.length-1]=this.addPic;
}
}
if (mediaFlag) {
this.getFilenameByUriForMedia(array);
}
})
.catch((err: BusinessError) => {
Logger.error(TAG, 'PhotoViewPicker.select failed with err: ' + JSON.stringify(err));
});
} catch (err) {
Logger.error(TAG, 'PhotoViewPicker failed with err: ' + err);
}
}
async getFilenameByUriForMedia(myUris: string[]) {
router.pushUrl({
url: 'pages/ViewMedia',
params: {
uris: myUris
}
}, router.RouterMode.Standard);
}
//提交
async reportCommit(){
//问题类型必选
let selectType = ""
this.feedbackTypeBeans.forEach((value) => {
if(value.isselect){
selectType = selectType+","
}
})
if(!StringUtils.isEmpty(selectType)){
selectType = selectType.substring(0,selectType.length-1)
}else{
//
ToastUtils.shortToast($r('app.string.feedback_opinion_type'))
return
}
//内容必填
if(StringUtils.isEmpty(this.contact) || this.contact.length < 10 || this.contact.length>500){
ToastUtils.shortToast($r('app.string.res_feedback_commentsFail'))
return
}
try {
let map: HashMap<String,String> = {} as HashMap<String,String>
//反馈内容
map.set("content", this.contact);
//投诉类型 id
map.set("classifyFlagIds", selectType);
if(!StringUtils.isEmpty(this.email)){
//邮箱
map.set("userContact", this.email);
}
//用户名称
if (!StringUtils.isEmpty(UserDataLocal.getUserName())) {
map.set("userName", UserDataLocal.getUserName());
}
//设备
map.set("appVersion", "V" + HttpParams.getVersionName());
map.set("appDevice", "harmony" + HttpParams.getSystemVersion() + " " + HttpParams.getPhoneModel());
// //投诉图片
// if (imageUrl.size() > 0) {
// String[] str = imageUrl.toArray(new String[imageUrl.size()]);
// map.set("imageUrls", str);
// }
await MultiPictureDetailViewModel.feedBackCommit(map)
} catch (exception) {
console.log('请求失败',JSON.stringify(exception))
}
}
}
\ No newline at end of file
... ...
... ... @@ -50,6 +50,8 @@ export struct ImageAndTextPageComponent {
// @State operationButtonList: string[] = ['comment', 'collect', 'share']
@State operationButtonList: string[] = []
@State isNetConnected: boolean = true
@State emptyType: number = 1 // 缺省图类型
@State detailContentEmpty: boolean = false
@State info: Area | null = null
@State likeNum: number = 0
@State reachEndIncreament: number = 0
... ... @@ -141,10 +143,10 @@ export struct ImageAndTextPageComponent {
this.reachEndIncreament += 1
})
if (!this.isNetConnected) {
if (!this.isNetConnected || this.detailContentEmpty) {
EmptyComponent({
emptyType: 1,
emptyButton: true,
emptyType: this.emptyType,
emptyButton: this.emptyType === 1 ? true : false,
retry: () => {
this.getDetail()
}
... ... @@ -171,12 +173,14 @@ export struct ImageAndTextPageComponent {
// 发布时间
Column() {
Row() {
Image(this.contentDetailData?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb'))
.width(80)
.height(28)
Text(this.publishTime)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize(13)
if(this.isNetConnected && !this.detailContentEmpty) {
Image(this.contentDetailData?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb'))
.width(80)
.height(28)
Text(this.publishTime)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize(13)
}
}
.width(CommonConstants.FULL_WIDTH)
.height(32)
... ... @@ -202,6 +206,9 @@ export struct ImageAndTextPageComponent {
private async getDetail() {
this.isNetConnected = NetworkUtil.isNetConnected()
if(!this.isNetConnected) {
this.emptyType = 1
}
let contentId: string = ''
let relId: string = ''
let relType: string = ''
... ... @@ -219,6 +226,12 @@ export struct ImageAndTextPageComponent {
}
let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
// 判断内容是否已下线,空数组表示下线
this.detailContentEmpty = detailBeans.length === 0 ? true : false
if(this.detailContentEmpty) {
this.emptyType = 18
}
console.log(TAG, JSON.stringify(detailBeans))
if (detailBeans && detailBeans.length > 0) {
this.contentDetailData = detailBeans[0];
let dateTime =
... ...
... ... @@ -42,7 +42,7 @@ export struct InteractMComponent {
.constraintSize({maxHeight:500})
}
if(this.messageModel.contentType != '211' && this.messageModel.contentType != '210'){
if(this.messageModel.contentType != '211'){
Column(){
if (this.messageModel.contentType === '207' || this.messageModel.contentType === '209'){
Text('[你的评论]'+this.buildCommentContent()).fontSize('14fp').fontColor('#666666').constraintSize({maxHeight:500})
... ...
... ... @@ -20,7 +20,7 @@ export struct SpacialTopicPageComponent {
action: Action = {} as Action
@State webUrl: string = '';
@State isPageEnd: boolean = false
@State reload: number = 0;
@Prop reload: number = 0;
@Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean
private webPrepared = false;
... ... @@ -134,13 +134,6 @@ export struct SpacialTopicPageComponent {
}.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
}
onPageShow() {
if (!this.action?.params?.backVisibility) {
WindowModel.shared.setWindowLayoutFullScreen(true)
}
this.reload++
}
aboutToAppear() {
if (!this.action?.params?.backVisibility) {
WindowModel.shared.setWindowLayoutFullScreen(true)
... ... @@ -149,12 +142,6 @@ export struct SpacialTopicPageComponent {
this.getDetail()
}
onPageHide() {
if (!this.action?.params?.backVisibility) {
WindowModel.shared.setWindowLayoutFullScreen(false)
}
}
aboutToDisappear() {
if (!this.action?.params?.backVisibility) {
WindowModel.shared.setWindowLayoutFullScreen(false)
... ...
... ... @@ -28,6 +28,11 @@ export struct CardSourceInfo {
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
if (((this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName && this.contentDTO.rmhInfo?.rmhName != '') || (this.contentDTO.source && this.contentDTO.source != '')) && (this.getContentDtoBean()?.interactData?.commentNum || DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)) != '')) {
Image($r("app.media.point"))
.width(16)
.height(16)
}
// 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间
if (this.contentDTO.isSearch || this.contentDTO.isCollection ||
!this.contentDTO.isSearch && DateTimeUtils.getCommentTime
... ... @@ -36,12 +41,6 @@ export struct CardSourceInfo {
.contentDTO.publishTime))
.indexOf
('-') === -1) {
if (this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName || this
.contentDTO.rmhPlatform !== 1 && this.contentDTO.source) {
Image($r("app.media.point"))
.width(16)
.height(16)
}
Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))
.fontSize($r("app.float.font_size_11"))
.fontColor($r("app.color.color_B0B0B0"))
... ...
... ... @@ -68,7 +68,9 @@ export struct Card19Component {
width: item.weight,
height: item.height,
picPath: item.fullUrl||item.url,
picDesc: ''
picDesc: '',
itemType:2,
id:0
}
return photo
})
... ...
... ... @@ -7,8 +7,6 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { Notes } from './notes';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
// import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
import { viewBlogInsightIntentShare, ActionMode } from '../../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
const TAG: string = 'Card2Component';
/**
... ... @@ -111,11 +109,6 @@ export struct Card2Component {
this.clicked = true;
// persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
if (this.contentDTO?.channelId === '2001' || this.contentDTO?.channelId === '2002') {
let context = getContext(this) as common.UIAbilityContext;
viewBlogInsightIntentShare(context, this.contentDTO?.channelId, [this.compDTO], ActionMode.EXECUTED)
}
})
}
}
... ...
... ... @@ -62,9 +62,10 @@ export struct Card4Component {
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.textOverflow({ overflow: TextOverflow.Ellipsis })
.textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :
(this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||
this.contentDTO.objectType == '5' ? 30 : 0)
//三图
Stack(){
Row() {
... ...
import { ContentDTO } from 'wdBean';
import { ContentDTO, CompDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { ProcessUtils } from 'wdRouter';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { Notes } from './notes';
import { viewBlogInsightIntentShare, ActionMode } from '../../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
const TAG: string = 'Card5Component';
... ... @@ -13,6 +15,7 @@ const TAG: string = 'Card5Component';
export struct Card5Component {
@State contentDTO: ContentDTO = new ContentDTO();
@Prop titleShowPolicy: number | string
@Prop compDTO: CompDTO = {} as CompDTO
@State loadImg: boolean = false;
@State clicked: boolean = false;
@State titleMarked: boolean = false;
... ... @@ -97,6 +100,8 @@ export struct Card5Component {
.onClick((event: ClickEvent) => {
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
let context = getContext(this) as common.UIAbilityContext;
viewBlogInsightIntentShare(context, this.contentDTO?.channelId, [this.compDTO], ActionMode.EXECUTED)
})
}
... ...
... ... @@ -38,6 +38,11 @@ export struct Card9Component {
Column() {
// 顶部标题,最多两行
if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) {
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags })
} else if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType })
}
Text() {
if (this.titleMarked) {
Span(this.str01)
... ... @@ -48,13 +53,17 @@ export struct Card9Component {
Span(this.contentDTO.newsTitle)
}
}
.fontColor(this.clicked ? 0x848484 : 0x222222)
.width(CommonConstants.FULL_WIDTH)
.fontSize($r('app.float.font_size_18'))
.fontWeight(600)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ bottom: 19 })
.fontColor(this.clicked ? 0x848484 : 0x222222)
.width(CommonConstants.FULL_WIDTH)
.fontSize($r('app.float.font_size_18'))
.fontWeight(600)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ bottom: 19 })
.textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :
(this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||
this.contentDTO.objectType == '5' ? 30 : 0)
}
// 大图
Stack() {
... ... @@ -102,7 +111,7 @@ export struct Card9Component {
}
.width(CommonConstants.FULL_WIDTH)
.padding({
top: 14,
top: 5,
left: 16,
right: 16,
bottom: 14
... ...
... ... @@ -7,6 +7,8 @@ import { CustomTitleUI } from '../../../reusable/CustomTitleUI';
import { ListHasNoMoreDataUI } from '../../../reusable/ListHasNoMoreDataUI';
import { EmptyComponent } from '../../../view/EmptyComponent';
import { SubscribeListChildComponent } from './SubscribeListChildComponent';
import { Action } from 'wdBean/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
const TAG = "SubscribeMessageComponent"
... ... @@ -71,6 +73,19 @@ export struct SubscribeMessageComponent{
ListItem() {
SubscribeListChildComponent({ item: item })
}.width('100%')
.onClick(()=>{
let action = {
type:item.contentType,
params:{
extra:{
relId:item.relId,
relType:item.relType
},
contentID:item.contentId
}
} as Action
WDRouterRule.jumpWithPage(WDRouterPage.detailPlayLiveCommon, action)
})
})
//没有更多数据 显示提示
if (!this.hasMore) {
... ... @@ -97,7 +112,11 @@ export struct SubscribeMessageComponent{
let remark = JSON.parse(value.remark) as Remark
this.data.push(new SubscribeMessageModel(dealTime,value.message,remark.coverImageUrl,value.title,dealTime2,value.contentId))
let bean = new SubscribeMessageModel(dealTime,value.message,remark.coverImageUrl,value.title,dealTime2,value.contentId)
bean.relId = remark.relationId
bean.relType = remark.relationType
bean.contentType = value.contentType
this.data.push(bean)
})
this.data.notifyDataReload()
this.count = this.data.totalCount()
... ...
import { BottomNavi, CommonConstants } from 'wdConstant';
import { BottomNavDTO, TopNavDTO } from 'wdBean';
import { DateTimeUtils, EmitterEventId, EmitterUtils, Logger } from 'wdKit';
import { BottomNavDTO, NavigationBodyDTO, TopNavDTO } from 'wdBean';
import { EmitterEventId, EmitterUtils, Logger } from 'wdKit';
import { TopNavigationComponent } from './TopNavigationComponent';
import { MinePageComponent } from './MinePageComponent';
import { CompUtils } from '../../utils/CompUtils';
import PageViewModel from '../../viewmodel/PageViewModel';
import HomeChannelUtils, { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils';
import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
import ChannelViewModel from '../../viewmodel/ChannelViewModel';
import HomeChannelUtils, { AssignChannelParam } from 'wdRouter';
import { VideoChannelPage } from './VideoChannelPage';
const TAG = 'BottomNavigationComponent';
... ... @@ -46,18 +45,12 @@ export struct BottomNavigationComponent {
@State assignChannel: AssignChannelParam = new AssignChannelParam()
// 自动刷新触发(双击tab自动刷新)
@State autoRefresh: number = 0
// 顶导数据,从接口获取 TODO 顶导业务逻辑没看懂,暂时不替换顶导list。频道管理数据待梳理
@State topNavMap: Record<string, TopNavDTO[]> = {}
async aboutToAppear() {
Logger.info(TAG, `aboutToAppear currentNavIndex: ${this.currentNavIndex}`);
let bottomNav = await PageViewModel.getBottomNavData(getContext(this))
if (bottomNav && bottomNav.bottomNavList != null) {
Logger.info(TAG, `aboutToAppear, bottomNav.length: ${bottomNav.bottomNavList.length}`);
// 使用filter方法移除name为'服务'的项
bottomNav.bottomNavList = bottomNav.bottomNavList.filter(item => item.name !== '服务');
this.bottomNavList = bottomNav.bottomNavList
}
this.getTopNavList(this.bottomNavList[0]?.id)
HomeChannelUtils.setBottomNavData(bottomNav)
this.getBottomData()
EmitterUtils.receiveEvent(EmitterEventId.JUMP_HOME_CHANNEL, (str?: string) => {
Logger.debug(TAG, 'receiveEvent JUMP_HOME_CHANNEL: ' + str)
... ... @@ -170,7 +163,7 @@ export struct BottomNavigationComponent {
//请求顶导数据
async getTopNavList(id: number) {
let bottomNavDetail = await PageViewModel.getBottomNavDetailData(id)
let bottomNavDetail = await ChannelViewModel.getBottomNavDetailData(id)
this.topNavList = bottomNavDetail?.topNavChannelList || []
}
... ... @@ -203,4 +196,62 @@ export struct BottomNavigationComponent {
this.assignChannel.bottomNavId = assignChannel.bottomNavId
}, 20)
}
private async getBottomData() {
Logger.debug(TAG, 'getBottomData')
// 1、缓存底导数据
let bottomCache = await ChannelViewModel.getBottomNavCacheData()
if (bottomCache && bottomCache.bottomNavList != null) {
Logger.debug(TAG, 'getBottomData cache success')
this.setData(bottomCache)
this.getBottomDetail()
}
// TODO 2、预置底导数据
// 3、接口底导数据
let bottomNav = await ChannelViewModel.getBottomNavData()
if (bottomNav && bottomNav.bottomNavList != null) {
Logger.debug(TAG, 'getBottomNavData')
HomeChannelUtils.setBottomNavData(bottomNav)
if (this.bottomNavList == null || this.bottomNavList.length <= 0) {
// 底导没展示,则用接口数据(接口数据回来,不去覆盖缓存数据,没有缓存才加载)
this.setData(bottomNav)
this.getBottomDetail()
}
// 将数据保存本地
ChannelViewModel.saveBottomData(bottomNav)
}
}
private getBottomDetail() {
// 1、获取顶导缓存数据
// this.bottomNavList.forEach((value) => {
// // 先用底导带回的list初始化
// this.topNavMap[value.id] = value.topNavChannelList
// ChannelViewModel.getBottomNavDetailData(value?.id).then((bottomNavDetail) => {
// let list = bottomNavDetail?.topNavChannelList || []
// // 将顶导数据,单独存储
// this.topNavMap[value.id] = list
// })
// })
// // 2、获取顶导接口数据,返回后需要覆盖缓存数据
// this.bottomNavList.forEach((value) => {
// ChannelViewModel.getBottomNavDetailData(value?.id).then((bottomNavDetail) => {
// let list = bottomNavDetail?.topNavChannelList || []
// // 将顶导数据,单独存储
// this.topNavMap[value.id] = list
// // 存储缓存
// ChannelViewModel.saveBottomDetailData(bottomNavDetail)
// })
// })
}
private setData(data: NavigationBodyDTO) {
Logger.debug(TAG, 'setData')
if (data && data.bottomNavList != null) {
Logger.info(TAG, `setData, bottomNav.length: ${data.bottomNavList.length}`);
// 使用filter方法移除name为'服务'的项
data.bottomNavList = data.bottomNavList.filter(item => item.name !== '服务');
this.bottomNavList = data.bottomNavList
}
}
}
\ No newline at end of file
... ...
... ... @@ -27,7 +27,7 @@ struct EditUserInfoPage {
}
}),
alignment: DialogAlignment.Bottom,
offset:{dx:0,dy:-20},
offset:{dx:0,dy:0},
})
aboutToAppear() {
... ... @@ -104,7 +104,7 @@ struct EditUserInfoPage {
.textOverflow({overflow:TextOverflow.Ellipsis})
.maxLines(1)
.fontSize(14)
.fontColor(r.subTitle === '待完善'?'#999999':'#666666')
.fontColor(r.subTitle === '待完善'?'#cccccc':'#666666')
.padding({right:10})
.width('70%')
.textAlign(TextAlign.End)
... ...
... ... @@ -8,6 +8,7 @@ import { CustomTitleUI } from '../reusable/CustomTitleUI';
import { InteractMComponent } from '../InteractMessage/InteractMComponent';
import { InteractMessageModel, WDMessageCenterMessageType } from '../../model/InteractMessageModel';
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
import { NetworkUtil } from 'wdKit/Index';
@Entry
@Component
... ... @@ -28,10 +29,9 @@ struct InteractMessagePage {
build() {
Column(){
CustomTitleUI({titleName:'互动消息'})
if(this.browSingModel.viewType == ViewType.ERROR){
EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NetworkFailed})
}else if(this.browSingModel.viewType == ViewType.EMPTY){
EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoMessage})
if(this.browSingModel.viewType == ViewType.EMPTY){
EmptyComponent({emptyType:this.browSingModel.emptyType})
}else {
CustomPullToRefresh({
alldata:this.allDatas,
... ... @@ -114,32 +114,40 @@ struct InteractMessagePage {
}
async getData(resolve?: (value: string | PromiseLike<string>) => void){
InteractMessageViewModel.fetchMessageList(WDMessageCenterMessageType.WDMessageCenterMessageType_Interact,this.currentPage).then(InteractMessageMItem => {
if(resolve) resolve('刷新成功')
if (InteractMessageMItem && InteractMessageMItem.list && InteractMessageMItem.list.length > 0) {
this.browSingModel.viewType = ViewType.LOADED;
if (this.currentPage === 1) {
this.allDatas = []
}
let netStatus = NetworkUtil.isNetConnected()
if (netStatus) {
InteractMessageViewModel.fetchMessageList(WDMessageCenterMessageType.WDMessageCenterMessageType_Interact,this.currentPage).then(InteractMessageMItem => {
if(resolve) resolve('刷新成功')
if (InteractMessageMItem && InteractMessageMItem.list && InteractMessageMItem.list.length > 0) {
this.browSingModel.viewType = ViewType.LOADED;
for (let index = 0; index < InteractMessageMItem.list.length; index++) {
const element = InteractMessageMItem.list[index];
element.InteractMsubM = JSON.parse(element.remark)
this.allDatas.push(element)
}
if (this.currentPage === 1) {
this.allDatas = []
}
if (InteractMessageMItem.hasNext === 0) {
this.browSingModel.hasMore = false;
for (let index = 0; index < InteractMessageMItem.list.length; index++) {
const element = InteractMessageMItem.list[index];
element.InteractMsubM = JSON.parse(element.remark)
this.allDatas.push(element)
}
if (InteractMessageMItem.hasNext === 0) {
this.browSingModel.hasMore = false;
} else {
this.browSingModel.hasMore = true;
}
} else {
this.browSingModel.hasMore = true;
}
} else {
if (this.currentPage === 1) {
this.browSingModel.viewType = ViewType.EMPTY;
if (this.currentPage === 1) {
this.browSingModel.viewType = ViewType.EMPTY;
this.browSingModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoMessage;
}
}
}
})
})
}else {
this.browSingModel.viewType = ViewType.EMPTY;
this.browSingModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoNetwork;
}
}
async getMessageLikeCount(){
... ...
... ... @@ -51,6 +51,11 @@ export struct MinePageComponent {
alignment: DialogAlignment.Center,
autoCancel: false
})
@Consume @Watch('pageShowForUpdateData') pageShow :number
pageShowForUpdateData(): void {
this.getMessageData()
}
aboutToAppear(){
this.getUserLogin()
... ... @@ -67,6 +72,11 @@ export struct MinePageComponent {
if(value.msg == "消息")
value.isShowRedPoint = true
})
}else {
this.personalData.forEach((value) => {
if(value.msg == "消息")
value.isShowRedPoint = false
})
}
}
}).catch((err: Error) => {
... ...
... ... @@ -12,6 +12,7 @@ import { BigPicCardComponent } from '../view/BigPicCardComponent';
import { contentListItemParams } from '../../model/MyCollectionModel';
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
import { MyCustomDialog } from '../reusable/MyCustomDialog'
import { NetworkUtil } from 'wdKit/Index';
@Entry
@Component
... ... @@ -26,6 +27,7 @@ struct MyCollectionListPage {
@State currentPage: number = 1;
private scroller: Scroller = new Scroller();
emptyType: WDViewDefaultType = WDViewDefaultType.WDViewDefaultType_Default
dialogController: CustomDialogController = new CustomDialogController({
builder: MyCustomDialog({
... ... @@ -53,10 +55,8 @@ struct MyCollectionListPage {
this.deleteNum = 0
}})
if(this.browSingModel.viewType == ViewType.ERROR){
ErrorComponent()
}else if(this.browSingModel.viewType == ViewType.EMPTY){
EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoCollection})
if(this.browSingModel.viewType == ViewType.EMPTY){
EmptyComponent({emptyType:this.browSingModel.emptyType})
}else {
CustomPullToRefresh({
alldata:this.allDatas,
... ... @@ -137,31 +137,39 @@ struct MyCollectionListPage {
}
}
async getData(resolve?: (value: string | PromiseLike<string>) => void) {
MyCollectionViewModel.fetchMyCollectList(1,'1',this.currentPage,getContext(this)).then(collectionItem => {
if(resolve) resolve('刷新成功')
if (collectionItem && collectionItem.list && collectionItem.list.length > 0) {
if (this.currentPage === 1) {
this.allDatas = []
}
let netStatus = NetworkUtil.isNetConnected()
if (netStatus) {
MyCollectionViewModel.fetchMyCollectList(1,'1',this.currentPage,getContext(this)).then(collectionItem => {
if(resolve) resolve('刷新成功')
if (collectionItem && collectionItem.list && collectionItem.list.length > 0) {
if (this.currentPage === 1) {
this.allDatas = []
}
for (let index = 0; index < collectionItem.list.length; index++) {
const compDTO = collectionItem.list[index];
compDTO.isCollection = true ///用于时间展示
this.allDatas.push(compDTO)
}
for (let index = 0; index < collectionItem.list.length; index++) {
const compDTO = collectionItem.list[index];
compDTO.isCollection = true ///用于时间展示
this.allDatas.push(compDTO)
}
if (collectionItem.hasNext === 0) {
this.browSingModel.hasMore = false;
if (collectionItem.hasNext === 0) {
this.browSingModel.hasMore = false;
} else {
this.browSingModel.hasMore = true;
}
} else {
this.browSingModel.hasMore = true;
}
} else {
if (this.currentPage === 1) {
this.browSingModel.viewType = ViewType.EMPTY;
if (this.currentPage === 1) {
this.browSingModel.viewType = ViewType.EMPTY;
this.browSingModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoCollection
}
}
}
})
})
} else {
this.browSingModel.viewType = ViewType.EMPTY;
this.browSingModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoNetwork;
}
}
//数据处理
... ...
... ... @@ -255,6 +255,7 @@ export struct PageComponent {
this.pageModel.channelId = this.channelId;
this.pageModel.currentPage = 1;
this.pageModel.pageTotalCompSize = 0;
// TODO PageHelper.getInitCacheData(this.pageModel, this.pageAdvModel)
PageHelper.getInitData(this.pageModel, this.pageAdvModel)
}, 100)
}
... ...
... ... @@ -13,8 +13,9 @@ export struct PeopleShipHomePageHeadComponent {
.width(this.diameter)
.height(this.diameter)
.borderRadius(this.diameter/2)
.borderWidth('1vp')
.borderWidth('0.5vp')
.borderStyle(BorderStyle.Solid)
.shadow({radius: 10, color: '#222226bd'})
.borderColor(Color.White)
.objectFit(ImageFit.Cover)
.backgroundColor(Color.White)
... ...
... ... @@ -3,7 +3,7 @@ import router from '@ohos.router'
@Component
export struct CustomTitleUI {
imgBack:boolean = true
titleName:string = "默认标题"
titleName:ResourceStr = "默认标题"
build() {
RelativeContainer() {
... ...
... ... @@ -42,7 +42,9 @@ export const enum WDViewDefaultType {
/// 16.暂无内容1
WDViewDefaultType_NoContent1,
// 17. 暂无评论快来抢沙发
WDViewDefaultType_NoComment1
WDViewDefaultType_NoComment1,
// 18. 内容找不到了
WDViewDefaultType_NoContent2
}
/**
... ... @@ -214,6 +216,8 @@ export struct EmptyComponent {
contentString = '暂无关注'
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment1) {
contentString = '暂无评论,快来抢沙发'
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment1) {
contentString = '内容找不到了'
}
return contentString
... ... @@ -247,7 +251,7 @@ export struct EmptyComponent {
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVideo) {
imageString = $r('app.media.icon_no_content')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoContent1 ||
this.emptyType === WDViewDefaultType.WDViewDefaultType_NoFollow) {
this.emptyType === WDViewDefaultType.WDViewDefaultType_NoFollow || this.emptyType === WDViewDefaultType.WDViewDefaultType_NoContent2) {
imageString = $r('app.media.icon_no_appointmentMade1')
}
return imageString
... ...
... ... @@ -90,6 +90,9 @@ export class SubscribeMessageModel{
desc:string = ""
time:string = ""
contentId:string = ""
contentType:string = ""
relId :string = ""
relType:string = ""
constructor(dealTime: string, title: string, imgUrl: string, desc: string , time: string, contentId: string) {
this.dealTime = dealTime
... ...
... ... @@ -183,6 +183,7 @@ struct MineHomePage {
Image($r('app.media.user_info_edit_icon'))
.width('27lpx')
.height('27lpx')
.interpolation(ImageInterpolation.High)
.objectFit(ImageFit.Auto)
}
}
... ...
import { common } from '@kit.AbilityKit';
import { insightIntent } from '@kit.IntentsKit';
import { BusinessError } from '@kit.BasicServicesKit';
import { CompDTO, CompList, ContentDTO, PageInfoBean } from 'wdBean';
function generateUniqueId() {
// 生成当前时间戳
let timestamp = new Date().getTime();
// 将时间戳转换成16进制字符串
let hexString = timestamp.toString(16);
// 确保字符串长度为16位,不足的话在前面补0
while (hexString.length < 16) {
hexString = '0' + hexString;
}
// 格式化为UUID样式
let uuid = hexString.substring(0, 8) + '-' +
hexString.substring(8, 12) + '-' +
hexString.substring(12, 16) + '-' +
hexString.substring(16, 20) + '-' +
hexString.substring(20);
function generateUUID() {
let dt = new Date().getTime(); // 获取当前时间的时间戳(毫秒)
let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
let r = (dt + Math.random() * 16) % 16 | 0;
dt = Math.floor(dt / 16);
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
});
return uuid;
}
... ... @@ -34,15 +23,16 @@ export const enum ActionMode {
//ViewBlog意图共享-频道列表
export function viewBlogInsightIntentShare(context: common.UIAbilityContext, entityGroupId: string,
compList: CompDTO[] | CompList[], actionMode: ActionMode) {
console.log('viewBlogInsightIntentShare',actionMode)
console.log('viewBlogInsightIntentShare', actionMode)
let insightIntentArray: insightIntent.InsightIntent [] = []
let identifier = generateUUID()
if (compList?.length > 0) {
compList?.forEach((item: CompDTO | CompList) => {
item.operDataList.forEach((_item: ContentDTO) => {
let viewBlogInsightIntentItem: insightIntent.InsightIntent = {
intentName: 'ViewBlog',
intentVersion: '1.0.1',
identifier: generateUniqueId(),
identifier,
intentActionInfo: {
actionMode,
currentPercentage: 50,
... ... @@ -67,7 +57,7 @@ export function viewBlogInsightIntentShare(context: common.UIAbilityContext, ent
_item?.newsSummary.substring(0, 20) : _item?.newsSummary,
blogAuthor: _item?.source,
blogPublishTime: _item?.publishTimestamp,
tag: _item?.newTags,
tag: _item?.newTags.split(','),
likeCount: _item?.interactData?.likeNum || 0,
forwardCount: _item?.interactData?.shareNum || 0,
commentCount: _item?.interactData?.commentNum || 0,
... ... @@ -82,21 +72,13 @@ export function viewBlogInsightIntentShare(context: common.UIAbilityContext, ent
})
console.log('yzl', JSON.stringify(insightIntentArray[0]))
try {
// 共享数据
insightIntent.shareIntent(context, insightIntentArray, (error) => {
if (error?.code) {
// 处理业务逻辑错误
console.error(`shareIntent failed, error.code: ${error?.code}, error.message: ${error?.message}`);
return;
}
// 执行正常业务
console.log('shareIntent succeed');
});
} catch (error) {
// 处理异常
console.error(`error.code: ${error?.code}, error.message: ${error?.message}`);
}
// 共享数据
insightIntent.shareIntent(context, insightIntentArray).then(() => {
console.log('yzl shareIntent success');
}).catch((err: BusinessError) => {
console.error(`yzl failed because ${err?.message}`);
});
}
}
... ... @@ -108,7 +90,7 @@ export function viewColumInsightIntentShare(context: common.UIAbilityContext, en
let viewBlogInsightIntentItem: insightIntent.InsightIntent = {
intentName: 'ViewColumn',
intentVersion: '1.0.1',
identifier: generateUniqueId(),
identifier: generateUUID(),
intentActionInfo: {
actionMode: ActionMode.EXECUTED,
currentPercentage: 50,
... ... @@ -116,30 +98,22 @@ export function viewColumInsightIntentShare(context: common.UIAbilityContext, en
intentEntityInfo: {
entityName: 'Column',
entityId,
displayName:pageInfoBean?.topicInfo?.title,
displayName: pageInfoBean?.topicInfo?.title,
description: pageInfoBean?.shareSummary,
logoURL:pageInfoBean?.shareCoverUrl,
activityType:['RecentViews'],
logoURL: pageInfoBean?.shareCoverUrl,
activityType: ['RecentViews'],
columnTitle: pageInfoBean?.topicInfo?.title,
columnSubTitle: pageInfoBean?.shareSummary,
rankingHint: 99,
isPublicData: true
}
}
console.log('yzl viewColumInsightIntentShare', JSON.stringify(viewBlogInsightIntentItem))
try {
// 共享数据
insightIntent.shareIntent(context, [viewBlogInsightIntentItem], (error) => {
if (error?.code) {
// 处理业务逻辑错误
console.error(`shareIntent failed, error.code: ${error?.code}, error.message: ${error?.message}`);
return;
}
// 执行正常业务
console.log('shareIntent succeed');
});
} catch (error) {
// 处理异常
console.error(`error.code: ${error?.code}, error.message: ${error?.message}`);
}
// 共享数据
insightIntent.shareIntent(context, [viewBlogInsightIntentItem]).then(() => {
console.log('yzl shareIntent success');
}).catch((err: BusinessError) => {
console.error(`yzl failed because ${err?.message}`);
});
}
... ...
import { NavigationBodyDTO, NavigationDetailDTO, } from 'wdBean';
import { Logger } from 'wdKit';
import { CacheData, ResponseDTO } from 'wdNetwork';
import { PageRepository } from '../repository/PageRepository';
const TAG = 'ChannelViewModel';
/**
* 首页底导、顶导相关
*/
export class ChannelViewModel {
/**
* 获取底导缓存数据
*/
async getBottomNavCacheData(): Promise<NavigationBodyDTO | null> {
Logger.info(TAG, `getBottomNavCacheData start`);
return new Promise<NavigationBodyDTO | null>((success) => {
CacheData.getLocalCacheData(CacheData.bottomCacheKey).then((data) => {
// Logger.debug(TAG, 'getBottomNavCacheData 333 ' + JSON.stringify(data));
if (data) {
let navBean = JSON.parse(CacheData.getNetworkData(data)) as NavigationBodyDTO
success(navBean)
} else {
success(null)
}
}).catch((err: object) => {
Logger.error(TAG, 'getBottomNavCacheData catch err: ' + JSON.stringify(err));
success(null)
})
});
}
/**
* 保存底导数据到缓存
*/
saveBottomData(data: NavigationBodyDTO) {
CacheData.saveCacheData(CacheData.bottomCacheKey, data, data.md5)
}
/**
* 获取底导详情(顶导)缓存数据
*/
getBottomNavDetailCacheData(id: number): Promise<NavigationDetailDTO | null> {
return new Promise<NavigationDetailDTO | null>((success) => {
CacheData.getLocalCacheData(CacheData.channelCacheDataKey + id).then((data) => {
if (data) {
let navBean = JSON.parse(CacheData.getNetworkData(data)) as NavigationDetailDTO
success(navBean)
} else {
success(null)
}
}).catch((err: object) => {
Logger.error(TAG, 'getBottomNavDetailCacheData catch err: ' + JSON.stringify(err));
success(null)
})
})
}
/**
* 保存底导详情数据到缓存
*/
saveBottomDetailData(data: NavigationDetailDTO) {
CacheData.saveCacheData(CacheData.channelCacheDataKey + data?.id, data, data.md5)
}
/**
* 获取底导接口数据
*/
async getBottomNavData(): Promise<NavigationBodyDTO> {
Logger.info(TAG, `getBottomNavData start`);
return this.getNavData();
}
/**
* 获取底导详情(顶导)接口数据
*/
async getBottomNavDetailData(id: number): Promise<NavigationDetailDTO> {
Logger.info(TAG, `getBottomNavDetailData start`);
return this.getNavDetailData(id);
}
private getNavData(): Promise<NavigationBodyDTO> {
return new Promise<NavigationBodyDTO>((success, error) => {
Logger.info(TAG, `getNavData start`);
PageRepository.fetchNavigationDataApi().then((navResDTO: ResponseDTO<NavigationBodyDTO>) => {
if (!navResDTO || !navResDTO.data) {
Logger.error(TAG, 'getNavData then navResDTO is empty');
error('navResDTO is empty');
return
}
if (navResDTO.code != 0) {
Logger.error(TAG, `getNavData then code:${navResDTO.code}, message:${navResDTO.message}`);
error('navResDTO Response Code is failure');
return
}
// let navResStr = JSON.stringify(navResDTO);
Logger.info(TAG, "getNavData then,navResDTO.timestamp:" + navResDTO.timestamp);
navResDTO.data.md5 = navResDTO.meta?.md5 || ''
success(navResDTO.data);
}).catch((err: Error) => {
Logger.error(TAG, `fetchNavigationDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
private getNavDetailData(id: number): Promise<NavigationDetailDTO> {
return new Promise<NavigationDetailDTO>((success, error) => {
Logger.info(TAG, `getNavData start`);
PageRepository.fetchNavigationDetailDataApi(id).then((navResDTO: ResponseDTO<NavigationDetailDTO>) => {
if (!navResDTO || !navResDTO.data) {
Logger.error(TAG, 'getNavData then navResDTO is empty');
error('navResDTO is empty');
return
}
if (navResDTO.code != 0) {
Logger.error(TAG, `getNavData then code:${navResDTO.code}, message:${navResDTO.message}`);
error('navResDTO Response Code is failure');
return
}
// let navResStr = JSON.stringify(navResDTO);
Logger.info(TAG, "getNavData then,navResDTO.timestamp:" + navResDTO.timestamp);
navResDTO.data.md5 = navResDTO.meta?.md5 || ''
success(navResDTO.data);
}).catch((err: Error) => {
Logger.error(TAG, `fetchNavigationDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
}
let channelViewModel = new ChannelViewModel();
export default channelViewModel as ChannelViewModel;
\ No newline at end of file
... ...
... ... @@ -23,18 +23,11 @@ export class DetailViewModel extends BaseViewModel {
Logger.debug(TAG, 'getDetailPageData contentId: ' + contentId);
return new Promise<ContentDetailDTO[]>((success, error) => {
PageRepository.fetchDetailData(relId, contentId, relType).then((resDTO: ResponseDTO<ContentDetailDTO[]>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'getDetailPageData then resDTO is empty');
error('resDTO is empty');
return
}
if (resDTO.code != 0) {
Logger.error(TAG, `getDetailPageData then code:${resDTO.code}, message:${resDTO.message}`);
error('resDTO Response Code is failure');
return
}
Logger.info(TAG, "getDetailPageData then,resDTO.timeStamp:" + resDTO.timestamp);
success(resDTO.data);
if(resDTO.data) {
success(resDTO.data)
} else {
success([] as ContentDetailDTO[])
};
}).catch((err: Error) => {
Logger.error(TAG, `getDetailPageData catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
... ...
... ... @@ -52,11 +52,11 @@ class EditInfoViewModel {
if (editDTO.code == 0) {
success(editDTO.data)
}else {
success(this.GetqueryAccountOwnerLocal(context))
// success(this.GetqueryAccountOwnerLocal(context))
}
}).catch((error: Error) => {
Logger.info(TAG,'queryAccountOwnerInfo','EditInfoViewModel')
success(this.GetqueryAccountOwnerLocal(context))
// success(this.GetqueryAccountOwnerLocal(context))
})
}))
}
... ...
import { Logger } from 'wdKit';
import { ResponseDTO } from 'wdNetwork';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { HashMap } from '@kit.ArkTS';
import { ContentDetailDTO,
batchLikeAndCollectParams,
batchLikeAndCollectResult,
... ... @@ -156,4 +157,17 @@ export class MultiPictureDetailViewModel {
})
})
}
static async feedBackCommit(params:HashMap<String,String>): Promise<ResponseDTO> {
return new Promise<ResponseDTO>((success, error) => {
Logger.info(TAG, `fetchDetailData start`);
WDHttp.post(HttpUrlUtils.getHost() + HttpUrlUtils.FEEDBACK_COMMIT_PATH,params).then((resDTO: ResponseDTO) => {
success(resDTO);
}).catch((err: Error) => {
Logger.error(TAG, `fetchDetailData catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
}
... ...
... ... @@ -13,6 +13,7 @@ import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean
import { BaseDTO } from 'wdBean/src/main/ets/bean/component/BaseDTO';
import { viewBlogInsightIntentShare, ActionMode } from '../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
import { CacheData } from 'wdNetwork/Index';
const TAG = 'PageHelper';
... ... @@ -26,6 +27,7 @@ export class PageHelper {
async refreshUI(pageModel: PageModel, pageAdvModel: PageAdModel) {
pageModel.loadStrategy = 2
pageModel.pageTotalCompSize = 0;
// TODO 下拉刷新,是否加载缓存
this.getPageInfo(pageModel, pageAdvModel)
}
... ... @@ -41,11 +43,71 @@ export class PageHelper {
/**
* 进页面请求数据
*/
async getInitCacheData(pageModel: PageModel, pageAdvModel: PageAdModel) {
Logger.error('zzzz','getInitCacheData')
PageViewModel.getPageInfoCache(pageModel.pageId).then(pageInfo => {
if (pageInfo == null) {
return;
}
pageModel.pageInfo = pageInfo;
//解析页面挂角广告资源
pageAdvModel.analysisAdvSource(pageInfo);
this.parseCacheGroup(pageModel)
})
}
async parseCacheGroup(pageModel: PageModel) {
Logger.error('zzzz','parseCacheGroup')
let pageInfo: PageInfoDTO = pageModel.pageInfo
pageModel.groupList = []
pageInfo.pageAdList = []
pageInfo.oneRequestPageGroupCompList = new ArrayList()
pageModel.groupList.push(...pageInfo.groups)
Logger.error("ZZZXXXXX", 'parseCacheGroup----1-----');
for (const group of pageInfo.groups) {
pageModel.groupId = group.id;
pageModel.groupData = group
Logger.error("ZZZXXXXX", '楼层id-start--》' + pageModel.groupId);
// await,确保groups接口顺序执行
let pageDto = await PageViewModel.getPageGroupCacheData(pageModel.bizCopy()) as PageDTO
let index = pageInfo.groups.indexOf(group)
if (index == 0) {
// 清空comp列表
pageModel.compList.clear()
}
this.analysisPageGroupCompData(pageModel,pageDto, pageInfo, index == pageInfo.groups.length - 1)
Logger.error("ZZZXXXXX", '楼层id-end--》' + pageModel.groupId + ' 楼层 comp数量=' + pageDto.compList.length);
}
// 收集页面所有楼层的组件信息,同步完成广告投放计算,异步完成稿件批查,
pageModel.pageTotalCompSize = pageInfo.oneRequestPageGroupCompList.length + pageModel.pageTotalCompSize
// 处理页面广告数据,投放到页面的位置
// TODO 缓存数据不加载广告
// this.handlePageCompAdvPostion(pageInfo.oneRequestPageGroupCompList, pageModel, pageInfo.pageAdList);
//遍历所有组件和稿件数据 push到页面
for (let element of pageInfo.oneRequestPageGroupCompList) {
pageModel.compList.push(CompDTO.createNewsBean(element))
}
Logger.error('zzzz', 'parseCacheGroup count: ' + pageModel.compList.totalCount())
pageModel.currentPage++
pageModel.viewType = ViewType.LOADED
closeRefresh(pageModel, true)
Logger.error("ZZZXXXXX", 'parseGroup----3----->' + pageInfo.oneRequestPageGroupCompList.length);
}
/**
* 进页面请求数据
*/
async getInitData(pageModel: PageModel, pageAdvModel: PageAdModel) {
pageModel.loadStrategy = 1
let netStatus = NetworkUtil.isNetConnected()
if (netStatus) {
this.getPageInfo(pageModel, pageAdvModel)
} else if (pageModel.compList.size() > 0) {
// 加载缓存数据了,不用无网络提示
} else {
pageModel.viewType = ViewType.EMPTY;
pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoNetwork;
... ... @@ -79,6 +141,10 @@ export class PageHelper {
//解析页面挂角广告资源
pageAdvModel.analysisAdvSource(pageInfo);
this.parseGroup(pageModel)
// if (pageModel.currentPage == 1) {
// // 保存缓存
// CacheData.saveCacheData(CacheData.comPageInfoCacheKey + pageModel.pageId, pageInfo, pageInfo.md5)
// }
}).catch(() => {
pageModel.viewType = ViewType.EMPTY;
pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_ContentFailed;
... ... @@ -115,6 +181,9 @@ export class PageHelper {
if (index == 0) {
// 清空comp列表
pageModel.compList.clear()
// // 保存缓存
// CacheData.saveCacheData(CacheData.compGroupInfoDataCacheKey + pageModel.pageId + pageModel.groupId, pageDto,
// pageDto.md5)
}
this.analysisPageGroupCompData(pageModel,pageDto, pageInfo, index == pageInfo.groups.length - 1)
Logger.error("ZZZXXXXX", '楼层id-end--》' + pageModel.groupId + ' 楼层 comp数量=' + pageDto.compList.length);
... ...
... ... @@ -16,17 +16,12 @@ import {
import { CompStyle } from 'wdConstant/Index';
import { CollectionUtils, Logger, ResourcesUtils, StringUtils } from 'wdKit';
import { ResponseDTO, } from 'wdNetwork';
import { CacheData, ResponseDTO, } from 'wdNetwork';
import { PageUIReqBean } from '../components/page/bean/PageUIReqBean';
import { PageRepository } from '../repository/PageRepository';
import { BaseViewModel } from './BaseViewModel';
const TAG = 'PageViewModel';
/**
* mock数据开关,默认关。
* mock数据是本地json数据,可自行修改内容(‘entry\src\main\resources\rawfile\’目录)
*/
const mock_switch = false;
/**
* 处理返回后的数据
... ... @@ -37,111 +32,10 @@ export class PageViewModel extends BaseViewModel {
}
/**
* get Nav Data from Resource .
*
* @return BottomNavBean[] Nav Data List
*/
async getBottomNavData(context: Context): Promise<NavigationBodyDTO> {
Logger.info(TAG, `getBottomNavData start`);
if (mock_switch) {
return this.getBottomNavDataMock(context);
}
return this.getNavData();
}
async getBottomNavDetailData(id: number): Promise<NavigationDetailDTO> {
Logger.info(TAG, `getBottomNavDetailData start`);
return this.getNavDetailData(id);
}
async getBottomNavDataMock(context: Context): Promise<NavigationBodyDTO> {
Logger.info(TAG, `getBottomNavDataMock start`);
let compRes: ResponseDTO<NavigationBodyDTO> | null =
await ResourcesUtils.getResourcesJson<ResponseDTO<NavigationBodyDTO>>(context, 'bottom_nav.json');
if (!compRes || !compRes.data) {
Logger.info(TAG, `getBottomNavDataMock compRes bottomNavList is empty`);
return {} as NavigationBodyDTO
}
Logger.info(TAG, `getBottomNavDataMock getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
private getNavData(): Promise<NavigationBodyDTO> {
return new Promise<NavigationBodyDTO>((success, error) => {
Logger.info(TAG, `getNavData start`);
PageRepository.fetchNavigationDataApi().then((navResDTO: ResponseDTO<NavigationBodyDTO>) => {
if (!navResDTO || !navResDTO.data) {
Logger.error(TAG, 'getNavData then navResDTO is empty');
error('navResDTO is empty');
return
}
if (navResDTO.code != 0) {
Logger.error(TAG, `getNavData then code:${navResDTO.code}, message:${navResDTO.message}`);
error('navResDTO Response Code is failure');
return
}
// let navResStr = JSON.stringify(navResDTO);
Logger.info(TAG, "getNavData then,navResDTO.timestamp:" + navResDTO.timestamp);
success(navResDTO.data);
}).catch((err: Error) => {
Logger.error(TAG, `fetchNavigationDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
private getNavDetailData(id: number): Promise<NavigationDetailDTO> {
return new Promise<NavigationDetailDTO>((success, error) => {
Logger.info(TAG, `getNavData start`);
PageRepository.fetchNavigationDetailDataApi(id).then((navResDTO: ResponseDTO<NavigationDetailDTO>) => {
if (!navResDTO || !navResDTO.data) {
Logger.error(TAG, 'getNavData then navResDTO is empty');
error('navResDTO is empty');
return
}
if (navResDTO.code != 0) {
Logger.error(TAG, `getNavData then code:${navResDTO.code}, message:${navResDTO.message}`);
error('navResDTO Response Code is failure');
return
}
// let navResStr = JSON.stringify(navResDTO);
Logger.info(TAG, "getNavData then,navResDTO.timestamp:" + navResDTO.timestamp);
success(navResDTO.data);
}).catch((err: Error) => {
Logger.error(TAG, `fetchNavigationDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
/**
* Get PageDTO data.
*
* @return {GroupDTO} compRes.data
*/
private async getPageData1(currentPage: number, context: Context): Promise<PageDTO> {
if (currentPage > 1) {
// 加载更多,返回无数据
return {} as PageDTO
}
let compRes: ResponseDTO<PageDTO> | null =
await ResourcesUtils.getResourcesJson<ResponseDTO<PageDTO>>(context, 'comp_list0.json');
if (!compRes || !compRes.data) {
Logger.info(TAG, `getCompList compRes is empty`);
return {} as PageDTO
}
Logger.info(TAG, `getCompList getResourcesJson compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
/**
* 获取【早晚报】数据
*/
async getMorningEveningPaperData(pageId: string): Promise<MorningEveningPaperDTO> {
Logger.debug(TAG, 'getPageData pageId: ' + pageId);
// if (mock_switch) {
// return this.getPageData3(currentPage, context);
// }
return new Promise<MorningEveningPaperDTO>((success, error) => {
PageRepository.fetchMorningEveningPaperData(pageId)
... ... @@ -166,18 +60,6 @@ export class PageViewModel extends BaseViewModel {
})
}
private async getPageData2(context: Context): Promise<PageDTO> {
let compRes: ResponseDTO<PageDTO> | null =
await ResourcesUtils.getResourcesJson<ResponseDTO<PageDTO>>(context, 'comp_list2.json');
if (!compRes || !compRes.data) {
Logger.info(TAG, `getCompList compRes is empty`);
return {} as PageDTO
}
// router.push('')
Logger.info(TAG, `getCompList getResourcesJson compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
/**
* 获取页面楼层的组件信息
* @param pageModel
... ... @@ -207,6 +89,7 @@ export class PageViewModel extends BaseViewModel {
return
}
Logger.info(TAG, "getNavData then,resDTO.timestamp:" + resDTO.timestamp);
resDTO.data.md5 = resDTO.meta?.md5 || ''
success(resDTO.data);
})
.catch((err: Error) => {
... ... @@ -309,36 +192,6 @@ export class PageViewModel extends BaseViewModel {
});
}
/**
* @deprecated
*/
private resetInteract(interact: InteractDataDTO[], compList: CompDTO[]) {
if (interact == null || interact.length == 0) {
return
}
interact.forEach((interactData) => {
let id = interactData.contentId;
outer: for (let i = 0; i < compList.length; i++) {
let comp = compList[i];
if (comp == null || comp.operDataList == null || comp.operDataList.length == 0) {
continue;
}
for (let j = 0; j < comp.operDataList.length; j++) {
let content = comp.operDataList[j];
if (content == null) {
continue;
}
if (id == content.objectId) {
content.interactData = interactData;
// TODO 测试代码,待删除
// content.interactData.likeNum = Math.floor(Math.random() * Math.floor(999));;
break outer;
}
}
}
})
}
private getInteractParams(compList: CompDTO[]): InteractParam {
if (compList == null || compList.length == 0) {
return {} as InteractParam;
... ... @@ -374,11 +227,13 @@ export class PageViewModel extends BaseViewModel {
async getPageInfo(pageId: string): Promise<PageInfoDTO> {
return new Promise<PageInfoDTO>((success, error) => {
PageRepository.fetchPageData(pageId).then((resDTO: ResponseDTO<PageInfoDTO>) => {
if (this.isRespondsInvalid(resDTO, 'getPageInfo')) {
error("getPageInfo data invalid");
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'getPageInfo then navResDTO is empty');
error('navResDTO is empty');
return
}
Logger.info(TAG, "getPageInfo then,resDTO.timeStamp:" + resDTO.timestamp);
resDTO.data.md5 = resDTO.meta?.md5 || ''
success(resDTO.data as PageInfoDTO);
});
});
... ... @@ -483,6 +338,46 @@ export class PageViewModel extends BaseViewModel {
})
}
async getPageInfoCache(pageId: string): Promise<PageInfoDTO | null> {
return new Promise<PageInfoDTO | null>((success) => {
CacheData.getLocalCacheData(CacheData.comPageInfoCacheKey + pageId).then((data) => {
// Logger.debug(TAG, 'getPageInfoCache 333 ' + JSON.stringify(data));
if (data) {
let navBean = JSON.parse(CacheData.getNetworkData(data)) as PageInfoDTO
success(navBean)
} else {
success(null)
}
}).catch((err: object) => {
Logger.error(TAG, 'getPageInfoCache catch err: ' + JSON.stringify(err));
success(null)
})
});
}
/**
* 获取页面楼层的组件信息
* @param pageModel
* @returns
*/
async getPageGroupCacheData(pageModel: PageUIReqBean): Promise<PageDTO | null> {
Logger.debug(TAG, 'getPageData pageId: ' + pageModel.pageId);
return new Promise<PageDTO | null>((success) => {
CacheData.getLocalCacheData(CacheData.compGroupInfoDataCacheKey + pageModel.pageId + pageModel.groupId).then((data) => {
// Logger.debug(TAG, 'getPageGroupCacheData 333 ' + JSON.stringify(data));
if (data) {
let navBean = JSON.parse(CacheData.getNetworkData(data)) as PageDTO
success(navBean)
} else {
success(null)
}
}).catch((err: object) => {
Logger.error(TAG, 'getPageGroupCacheData catch err: ' + JSON.stringify(err));
success(null)
})
});
}
}
... ...
... ... @@ -307,6 +307,10 @@
{
"name": "vp_13",
"value": "13vp"
},
{
"name": "margin_115",
"value": "115vp"
}
]
}
... ...
... ... @@ -67,5 +67,40 @@
"name": "feedback",
"value": "意见反馈"
}
,
{
"name": "res_feedback_commentsFail",
"value": "请输入 10-500 个字以内"
}
,
{
"name": "feedback_opinion_type",
"value": "请选择问题类型"
}
,
{
"name": "feedback_comments",
"value": "您的宝贵意见是我们前行的动力"
}
,
{
"name": "feedback_opinion_tv",
"value": "描述您的问题"
}
,
{
"name": "feedback_email",
"value": "期待您留下联系方式,我们将提供更好的服务"
}
,
{
"name": "feedback_mail",
"value": "电话或者邮箱"
}
,
{
"name": "feedback_hideemail",
"value": "请输入电话或者邮箱"
}
]
}
\ No newline at end of file
... ...
... ... @@ -71,7 +71,9 @@ export struct TabChatItemComponent {
width: 0,
height: 0,
picPath: imgUrl,
picDesc: ''
picDesc: '',
itemType:2,
id:0
})
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
... ...
... ... @@ -194,7 +194,9 @@ export struct TabLiveItemComponent {
width: 0,
height: 0,
picPath: item,
picDesc: ''
picDesc: '',
itemType:2,
id:0
})
}
let taskAction: Action = {
... ...
... ... @@ -9,6 +9,10 @@
"value": "14fp"
},
{
"name": "margin_1",
"value": "1vp"
},
{
"name": "font_size_12",
"value": "12fp"
},
... ...
... ... @@ -441,6 +441,20 @@ struct LoginPage {
cancelProtocol(): void {
this.isProtocol = false
}
pageTransition() {
// 为目标页面时,进入:从右边侧滑入,退出:是右侧划出;跳转别的页面:左侧划出,返回:左侧划入。
PageTransitionEnter({ type: RouteType.Push, duration: 300 })
.slide(SlideEffect.Right)
PageTransitionEnter({ type: RouteType.Pop, duration: 300 })
.slide(SlideEffect.Left)
PageTransitionExit({ type: RouteType.Push, duration: 300 })
.slide(SlideEffect.Left)
PageTransitionExit({ type: RouteType.Pop, duration: 300 })
.slide(SlideEffect.Right)
}
}
... ...
... ... @@ -9,11 +9,12 @@ const TAG = 'SpacialTopicPage';
@Entry
@Component
struct SpacialTopicPage {
action: Action = {} as Action
@State action: Action = {} as Action
@State reload: number = 0
@State count: number = 0
build() {
Column() {
SpacialTopicPageComponent({ action: this.action })
SpacialTopicPageComponent({ action: this.action ,reload:this.reload })
}.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
}
... ... @@ -30,8 +31,12 @@ struct SpacialTopicPage {
}
aboutToAppear() {
Logger.info(TAG, 'aboutToAppear');
Logger.info(TAG, `aboutToAppearcount:${this.reload}`);
let action: Action = router.getParams() as Action
this.action = action
}
onPageShow() {
this.reload = this.reload + 1
Logger.info(TAG, `onPageShowcount:${this.reload}`);
}
}
\ No newline at end of file
... ...
... ... @@ -3,6 +3,7 @@ import { WDPushNotificationManager } from 'wdHwAbility/Index'
import { DeviceUtil,
EmitterEventId,
EmitterUtils,
KVStoreHelper,
Logger,
MpaasUtils, NetworkManager,
NetworkType,
... ... @@ -38,7 +39,8 @@ export class StartupManager {
// KV存储
SPHelper.init(context);
// KV存储(较大数据,value<4M)(首页接口数据缓存用到)
KVStoreHelper.init(context)
// 路由注册
registerRouter();
... ...