陈剑华

Merge remote-tracking branch 'origin/main'

Showing 21 changed files with 203 additions and 54 deletions
... ... @@ -59,3 +59,5 @@ export { UmengStats } from "./src/main/ets/umeng/UmengStats"
export { MpaasUtils } from './src/main/ets/mpaas/MpaasUtils'
export { MpaasUpgradeCheck, UpgradeTipContent } from './src/main/ets/mpaas/MpaasUpgradeCheck'
export { TingyunAPM } from './src/main/ets/tingyunAPM/TingyunAPM'
\ No newline at end of file
... ...
... ... @@ -7,6 +7,7 @@
"main": "Index.ets",
"version": "1.0.0",
"dependencies": {
"@tingyun/harmonyos": "file:./src/main/ets/tingyunAPM/tingyun_0.0.6.har",
"@umeng/common": "^1.0.21",
"@umeng/analytics": "^1.0.19"
}
... ...
import { common } from '@kit.AbilityKit';
import tingyun, { LogLevel } from '@tingyun/harmonyos';
export class TingyunAPM {
private static TINGYUN_APP_KEY = "" //TODO:
private static TINGYUN_REDIRECT_HOST = "wkrt.tingyun.com"
private static logEnable() {
return true
}
//
static initApp(context: common.UIAbilityContext, deviceId?: string) {
tingyun.init({
redirectHost: TingyunAPM.TINGYUN_REDIRECT_HOST,
appKey: TingyunAPM.TINGYUN_APP_KEY,
context: context,
httpEnabled: true,
logLevel: TingyunAPM.logEnable() ? LogLevel.DEBUG : LogLevel.NONE,
// TODO: axios实例对象
// axios:axiosInstance,
network: {
enabled: true,
},
crash: {
enabled: true,
jsCrashEnabled: true,
cppCrashEnabled: true,
},
freeze: {
enabled: true
}
});
if (deviceId) {
tingyun.setUserId(deviceId)
}
tingyun.startNextSession()
}
}
\ No newline at end of file
... ...
import { ToastUtils } from 'wdKit';
import { SPHelper,Logger,ToastUtils } from 'wdKit';
import { ContentDetailDTO, Action, ContentDTO,batchLikeAndCollectResult } from 'wdBean';
import { ProcessUtils } from 'wdRouter';
import router from '@ohos.router';
import { batchLikeAndCollectParams } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { SpConstants } from 'wdConstant/Index';
import { WDShare } from 'wdShare/Index';
const TAG = 'CarderInteraction'
/**
* 卡片 分享、评论、点赞公用组件
*/
@Component
export struct CarderInteraction {
@Prop contentDTO: ContentDTO
@State contentId: string = ''
@State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult// 点赞、收藏状态
build() {
Row(){
Row(){
... ... @@ -18,7 +29,7 @@ export struct CarderInteraction {
}
.justifyContent(FlexAlign.Center)
.onClick(()=>{
ToastUtils.showToast('分享为公共方法,待开发', 1000)
this.getContentDetailData()
})
Row(){
Image($r('app.media.CarderInteraction_comment'))
... ... @@ -31,7 +42,7 @@ export struct CarderInteraction {
}
.justifyContent(FlexAlign.Center)
.onClick(()=>{
ToastUtils.showToast('分享为公共方法,待开发', 1000)
ProcessUtils.processPage(this.contentDTO)
})
Row(){
Image($r('app.media.CarderInteraction_like'))
... ... @@ -44,7 +55,8 @@ export struct CarderInteraction {
}
.justifyContent(FlexAlign.Center)
.onClick(()=>{
ToastUtils.showToast('分享为公共方法,待开发', 1000)
ProcessUtils.processPage(this.contentDTO)
// ToastUtils.showToast('点赞为公共方法,待开发', 1000)
})
}
.width('100%')
... ... @@ -56,4 +68,45 @@ export struct CarderInteraction {
.justifyContent(FlexAlign.SpaceBetween)
.alignItems(VerticalAlign.Center)
}
/**
* 请求(动态)详情页数据
* */
private async getContentDetailData() {
try {
let data = await MultiPictureDetailViewModel.getDetailData(this.contentDTO.relId, this.contentDTO.objectId, this.contentDTO.relType)
this.contentDetailData = data[0];
console.log('动态详情',JSON.stringify(this.contentDetailData))
WDShare.shareContent(this.contentDetailData)
} catch (exception) {
console.log('请求失败',JSON.stringify(exception))
}
this.getInteractDataStatus()
}
// 已登录->查询用户对作品点赞、收藏状态
private async getInteractDataStatus() {
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
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))
}
}
}
... ...
... ... @@ -36,7 +36,7 @@ export struct Card12Component {
.lineHeight(25)
.fontFamily('PingFang SC-Regular')
}
CarderInteraction()
CarderInteraction({contentDTO: this.contentDTO})
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
.padding({
... ...
... ... @@ -53,7 +53,7 @@ export struct Card14Component {
.width(CommonConstants.FULL_WIDTH)
.margin({ bottom: 8 })
.height(75)
CarderInteraction()
CarderInteraction({contentDTO: this.contentDTO})
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
... ...
... ... @@ -52,7 +52,7 @@ export struct Card15Component {
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.alignContent(Alignment.BottomEnd)
CarderInteraction()
CarderInteraction({contentDTO: this.contentDTO})
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
.padding({
... ...
... ... @@ -53,7 +53,7 @@ export struct Card16Component {
})
}
}
CarderInteraction()
CarderInteraction({contentDTO: this.contentDTO})
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
.padding({
... ...
... ... @@ -47,7 +47,7 @@ export struct Card19Component {
})
ProcessUtils.gotoMultiPictureListPage(photoList,0)
})
CarderInteraction()
CarderInteraction({contentDTO: this.contentDTO})
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
.padding({
... ...
... ... @@ -37,7 +37,7 @@ export struct Card20Component {
if (this.contentDTO.fullColumnImgUrls[0]) {
createImg({ contentDTO: this.contentDTO })
}
CarderInteraction()
CarderInteraction({contentDTO: this.contentDTO})
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
.padding({
... ...
... ... @@ -51,7 +51,7 @@ export struct Card21Component {
}
.columnsTemplate('2fr 1fr')
.maxCount(1)
CarderInteraction()
CarderInteraction({contentDTO: this.contentDTO})
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
.onClick((event: ClickEvent) => {
... ...
... ... @@ -17,9 +17,7 @@ export struct AppointmentListChildComponent{
}),
autoCancel: true,
alignment: DialogAlignment.Center,
offset: { dx: 0, dy: -20 },
gridCount: 4,
customStyle: false
customStyle: true
})
... ...
... ... @@ -4,9 +4,12 @@ export struct MyCustomDialog {
@State titleShow: boolean = true
@State tipValue: string ="提示文字"
@State tipShow: boolean = true
@State cancelIsLeft :boolean = true//取消是否在左边
@State leftText: string = "取消"
@State rightText: string = "确认"
@State leftTextColor: Resource = $r('app.color.color_333333')
@State rightTextColor: Resource = $r('app.color.color_648DF2')
controller: CustomDialogController
cancel: () => void = () => {
... ... @@ -16,21 +19,25 @@ export struct MyCustomDialog {
build() {
Column() {
if(this.titleShow){
Text(this.title)
.fontSize("32lpx")
.margin({ top: "40lpx", bottom: "15lpx" })
.fontColor($r('app.color.color_333333'))
.fontSize('35lpx')
.fontWeight('600lpx')
}
Column(){
if(this.titleShow){
Text(this.title)
.fontSize("32lpx")
.fontColor($r('app.color.color_333333'))
.lineHeight('50lpx')
.fontWeight(600)
}
if(this.tipShow){
Text(this.tipValue)
.margin({ bottom: "30lpx" })
.fontSize("27lpx")
.fontColor($r('app.color.color_B0B0B0'))
}
if(this.tipShow){
Text(this.tipValue)
.margin({ top:this.titleShow?"10lpx":"0lpx" })
.fontSize("27lpx")
.fontWeight(400)
.lineHeight('38lpx')
.fontColor($r('app.color.color_999999'))
}
}.padding({top:"48lpx",bottom:"48lpx"})
.alignItems(HorizontalAlign.Center)
Divider()
.width("100%")
... ... @@ -41,13 +48,21 @@ export struct MyCustomDialog {
Row(){
Text(this.leftText)
.fontSize('35lpx')
.fontWeight('400lpx')
.fontColor($r('app.color.color_333333'))
.fontWeight(400)
.fontColor(this.leftTextColor)
.onClick(() => {
this.controller.close()
this.cancel()
if (this.controller != undefined){
if(this.cancelIsLeft){
this.controller.close()
this.cancel()
}else{
this.controller.close()
this.confirm()
}
}
}).layoutWeight(1)
.textAlign(TextAlign.Center)
Divider()
.width("1lpx")
.strokeWidth('1lpx')
... ... @@ -58,17 +73,24 @@ export struct MyCustomDialog {
Text(this.rightText)
.fontSize('35lpx')
.textAlign(TextAlign.Center)
.fontWeight('400lpx')
.fontColor($r('app.color.color_648DF2'))
.fontWeight(400)
.fontColor(this.rightTextColor)
.onClick(() => {
if (this.controller != undefined) {
this.controller.close()
this.confirm()
if(this.cancelIsLeft){
this.controller.close()
this.confirm()
}else{
this.controller.close()
this.cancel()
}
}
}).layoutWeight(1)
}
.alignItems(VerticalAlign.Center)
.height('96lpx')
}.borderRadius(10)
.width("518lpx")
.backgroundColor("#FFF")
}
}
\ No newline at end of file
... ...
... ... @@ -17,13 +17,12 @@ export struct SearchHistoryComponent{
this.onAccept()
},
title: "确认清空历史记录",
tipShow:false
tipShow:false,
leftTextColor:$r('app.color.color_648DF2')
}),
autoCancel: true,
alignment: DialogAlignment.Center,
offset: { dx: 0, dy: -20 },
gridCount: 4,
customStyle: false
customStyle: true
})
onAccept(){
... ...
... ... @@ -3,7 +3,7 @@ import { SearchRelatedItem } from '../../viewmodel/SearchRelatedItem'
const TAG = "SearchRelatedComponent"
/**
* 热门搜索
* 相关搜索
*/
@Component
export struct SearchRelatedComponent {
... ...
... ... @@ -40,11 +40,24 @@ export struct SearchResultComponent {
SearcherAboutDataModel.getSearchSuggestData(request, getContext(this)).then((value) => {
value.forEach((item) => {
this.data.push(item)
if(item.appStyle != "13"){
this.data.push(item)
}
})
this.data.notifyDataReload()
this.suggest_count = this.data.totalCount()
this.isLoading = false
if(this.suggest_count === 0 && value.length > 0){
this.suggest_count = -1
if(!this.isLoading){
this.getSuggestData()
}
}else if(this.suggest_count <= 20 && value.length > 0){
if(!this.isLoading){
this.getSuggestData()
}
}
})
}
... ... @@ -110,6 +123,7 @@ export struct SearchResultComponent {
TabContent() {
SearchResultContentComponent({ keywords: this.searchText, searchType: item })
}.tabBar(this.TabBuilder(index, item))
.layoutWeight(1)
}, (item: string, index: number) => index.toString())
}
.vertical(false)
... ... @@ -124,6 +138,7 @@ export struct SearchResultComponent {
.layoutWeight(1)
}
}.width('100%')
.layoutWeight(1)
.margin({ top: '12lpx' })
}
... ...
... ... @@ -54,6 +54,7 @@ export struct SearchResultContentComponent{
if (!this.data || value.list.length == 0){
this.hasMore = false
this.isLoading = false
this.count = this.count===-1?0:this.count
}else{
if(value.list[0].dataList!=null){
let data_temp: SearchRmhDescription[] = []
... ... @@ -205,8 +206,10 @@ export struct SearchResultContentComponent{
extra:'',
titleShow:value.data.type == "5"?1:0,
}
if(contentDTO.appStyle != "13"){
this.data.push(contentDTO)
}
this.data.push(contentDTO)
})
this.data.notifyDataReload()
this.count = this.data.totalCount()
... ... @@ -216,6 +219,19 @@ export struct SearchResultContentComponent{
this.hasMore = false
}
this.isLoading = false
if(this.count === 0 && resultData.list.length > 0){
this.count = -1
if(!this.isLoading){
//加载分页数据
this.getNewSearchResultData()
}
}else if(this.count <= 20 && resultData.list.length > 0){
if(!this.isLoading){
//加载分页数据
this.getNewSearchResultData()
}
}
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
this.isLoading = false
... ... @@ -297,13 +313,10 @@ export struct SearchResultContentComponent{
}
}
}
.onClick(()=>{
//TODO 跳转
})
}, (item: ContentDTO, index: number) => index.toString())
//没有更多数据 显示提示
if(!this.hasMore){
if(!this.hasMore && this.data.totalCount() > 0){
ListItem(){
ListHasNoMoreDataUI()
}
... ... @@ -319,11 +332,11 @@ export struct SearchResultContentComponent{
this.getNewSearchResultData()
}
})
}
}.layoutWeight(1)
}
}
.backgroundColor($r('app.color.white'))
.height('100%')
.layoutWeight(1)
.width('100%')
}
}
\ No newline at end of file
... ...
... ... @@ -26,7 +26,7 @@ export struct channelSkeleton {
}
.margin({ right: 0 })
}
.height(100)
.height(110)
.justifyContent(FlexAlign.SpaceBetween)
.SkeletonStyle()
})
... ... @@ -70,7 +70,7 @@ function textArea(width: number | Resource | string = '100%', height: number | R
.height(height)
.backgroundColor('#FFF2F3F4')
.margin({ top: 10 })
// .borderRadius(5)
.borderRadius(4)
}
// 全局公共样式
... ... @@ -78,7 +78,7 @@ function textArea(width: number | Resource | string = '100%', height: number | R
function SkeletonStyle() {
.padding({ right: 18, left: 18 })
.width('100%')
.margin({ top: 10 })
// .margin({ top: 10 })
}
@Extend(Column)
... ...
... ... @@ -103,6 +103,7 @@ export class StartupManager {
}
private initTingyun() {
// 暂时不能用,不初始化
// Logger.debug(TAG, "App tingyunAPM 初始化")
// TingyunAPM.initApp(this.context!, DeviceUtil.clientId())
}
... ...