王士厅
Showing 82 changed files with 1388 additions and 207 deletions
{
"appKey": "662f39fecac2a664de284236",
"channel": "rmrb_china_0000"
}
\ No newline at end of file
... ...
... ... @@ -268,6 +268,18 @@
]
}
]
},
{
"name": "wdTracking",
"srcPath": "./features/wdTracking",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
}
]
}
\ No newline at end of file
... ...
... ... @@ -49,3 +49,7 @@ export { NetworkUtil } from './src/main/ets/utils/NetworkUtil'
export { NetworkManager } from './src/main/ets/network/NetworkManager'
export { NetworkType } from './src/main/ets/network/NetworkType'
export { CustomToast } from './src/main/ets/reusable/CustomToast'
export { UmengStats } from "./src/main/ets/umeng/UmengStats"
... ...
{
"meta": {
"stableOrder": true
},
"lockfileVersion": 3,
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": {
"@umeng/analytics@^1.0.19": "@umeng/analytics@1.0.19",
"@umeng/common@^1.0.21": "@umeng/common@1.0.21",
"libcommon.so@../../oh_modules/.ohpm/@umeng+common@1.0.21/oh_modules/@umeng/common/src/main/cpp/types/libcommon": "libcommon.so@../../oh_modules/.ohpm/@umeng+common@1.0.21/oh_modules/@umeng/common/src/main/cpp/types/libcommon"
},
"packages": {
"@umeng/analytics@1.0.19": {
"name": "@umeng/analytics",
"integrity": "sha512-0m9z5l8to+POjDl9UkCQC8s4P+e2E1OILwUglC7ME4QwqfH44e59GLJtQdwF0h6kwpsy3YBft4SoWK8MYbuP7g==",
"resolved": "https://ohpm.openharmony.cn/ohpm/@umeng/analytics/-/analytics-1.0.19.har",
"registryType": "ohpm"
},
"@umeng/common@1.0.21": {
"name": "@umeng/common",
"integrity": "sha512-EbXsd4OoRisTQf5egNY/+z1D2bvrYw9VwC2xu3EJA9TiDPSbnaJZ5+yltA/Se6yZ4oCcFvq6e5/AAfPuumunbw==",
"resolved": "https://ohpm.openharmony.cn/ohpm/@umeng/common/-/common-1.0.21.har",
"registryType": "ohpm",
"dependencies": {
"libcommon.so": "./src/main/cpp/types/libcommon"
}
},
"libcommon.so@../../oh_modules/.ohpm/@umeng+common@1.0.21/oh_modules/@umeng/common/src/main/cpp/types/libcommon": {
"name": "libcommon.so",
"resolved": "../../oh_modules/.ohpm/@umeng+common@1.0.21/oh_modules/@umeng/common/src/main/cpp/types/libcommon",
"registryType": "local"
}
}
}
\ No newline at end of file
... ...
... ... @@ -6,5 +6,8 @@
"description": "Please describe the basic information.",
"main": "Index.ets",
"version": "1.0.0",
"dependencies": {}
"dependencies": {
"@umeng/common": "^1.0.21",
"@umeng/analytics": "^1.0.19"
}
}
... ...
@CustomDialog
export struct CustomToast {
public static LENGTH_LONG = 5000;
public static LENGTH_SHORT = 3000;
@State msg: string = ""
@State duration: number = CustomToast.LENGTH_SHORT
@State bgBorderRadius: number = 10
controller: CustomDialogController
dismiss: () => void = () => {
}
aboutToAppear(): void {
let intervalID = setInterval(() => {
if (this.controller != undefined) {
this.controller.close()
this.dismiss()
clearInterval(intervalID);
}
}, this.duration);
}
build() {
Row() {
Text(this.msg)
.fontWeight(FontWeight.Regular)
.fontColor($r('app.color.white'))
.fontSize("27lpx")
.lineHeight("38lpx")
}.borderRadius(`${this.bgBorderRadius}lpx`)
.padding({top:"23lpx",bottom:'23lpx',left:"35lpx",right:"35lpx"})
.backgroundColor($r("app.color.black"))
.opacity(0.7)
}
}
... ...
import { preInit, InternalPlugin, setLogEnabled, init, onEventObject, onProfileSignOff,
onProfileSignIn } from '@umeng/analytics';
import { common } from '@kit.AbilityKit';
import { AccountManagerUtils } from '../utils/AccountManagerUtils';
import { UserDataLocal } from '../utils/UserDataLocal';
import { EmitterUtils } from '../utils/EmitterUtils';
export class UmengStats {
private static _inited = false
// 启动时调用
static preInit(context: common.UIAbilityContext) {
// 需在 AppScope/resources/rawfile/umconfig.json 配置key和channel
preInit({
context: context.getApplicationContext(),
plugins: [new InternalPlugin()],
enableLog: true
});
}
// 在用户同意隐私政策后再调用此方法
static initAfterAgreeProtocol() {
init();
UmengStats._inited = true
UmengStats.onLogin()
UmengStats.event("testHarmony", {"key1": "value1"})
}
// TODO: 登录成功调用
static onLogin() {
AccountManagerUtils.isLogin().then((login) => {
if (!login) { return }
let userId = UserDataLocal.getUserId()
if (userId.length > 0) {
onProfileSignIn("USER", userId)
}
})
}
// TODO: 退出登录调用
static onLogout() {
onProfileSignOff()
}
// 属性key,128位以内的非空字符串,value为256位以内的数值或字符串
static event(eventId: string, param?: Record<string, string | number>) {
if (!UmengStats._inited) {
return
}
onEventObject(eventId, param);
}
}
\ No newline at end of file
... ...
... ... @@ -509,6 +509,26 @@ export class DateTimeUtils {
}
return num;
}
/**
* 去除发布日期前导零
* @param dateTimeString 2024年01月01日 00:00
* @returns 2024年1月1日 00:00
*/
static removeTrailingZeros(dateTimeString: string) {
// 分割日期时间字符串
const [datePart, timePart] = dateTimeString.split(' ');
// 分割日期
const [year, month, day] = datePart.match(/\d+/g);
// 去除年和月后面的零
const trimmedMonth = parseInt(month, 10);
const trimmedDay = parseInt(day, 10);
// 重新组合日期时间字符串
const newDateTimeString = `${year}${trimmedMonth}${trimmedDay} ${timePart}`;
return newDateTimeString;
}
}
// const dateTimeUtils = new DateTimeUtils()
\ No newline at end of file
... ...
... ... @@ -125,6 +125,37 @@ export class StringUtils {
static isScore(text: string): boolean {
return StringUtils.SCORE_REG_EXP.test(text);
}
//手机号校验
static photoMatch(phone:string) : boolean {
/**
* 移动号段正则表达式
*/
let CM_NUM = "^((13[4-9])|(147)|(15[0-2,7-9])|(178)|(18[2-4,7-8]))\\d{8}|(1705)\\d{7}$";
/**
* 联通号段正则表达式
*/
let CU_NUM = "^((13[0-2])|(145)|(15[5-6])|(176)|(18[5,6]))\\d{8}|(1709)\\d{7}$";
/**
* 电信号段正则表达式
*/
let CT_NUM = "^((133)|(153)|(177)|(18[0,1,9]))\\d{8}$";
/**
* 官网正则
*/
let GW_NUM = "^1(3|4|5|6|7|8|9)\\d{9}$";
let CM_NUM_reg : RegExp = new RegExp(CM_NUM);
let CU_NUM_reg : RegExp = new RegExp(CU_NUM);
let CT_NUM_reg : RegExp = new RegExp(CT_NUM);
let GW_NUM_reg : RegExp = new RegExp(GW_NUM);
if (CM_NUM_reg.test(phone) || CU_NUM_reg.test(phone) || CT_NUM_reg.test(phone) || GW_NUM_reg.test(phone)) {
return true;
}
console.log('请输入正确的手机号')
return false;
}
}
// export default new StringUtils();
... ...
... ... @@ -3,6 +3,10 @@
{
"name": "white",
"value": "#FFFFFF"
},
{
"name": "black",
"value": "#000000"
}
]
}
\ No newline at end of file
... ...
... ... @@ -88,6 +88,9 @@ export class ProcessUtils {
return;
}
let type = content.objectType;
if (typeof type == "number") {
type = `${type}`
}
console.log(TAG, 'objectType', `${JSON.stringify(content)}`);
switch (type) {
case ContentConstants.TYPE_NONE:
... ...
... ... @@ -10,6 +10,7 @@ import Url from '@ohos.url'
import { ContentDTO, PhotoListBean } from 'wdBean';
import { handleJsCallAppService } from './JsCallAppService'
import { HttpUtils } from 'wdNetwork/Index';
const TAG = 'JsBridgeBiz'
class AppInfo {
... ... @@ -20,6 +21,7 @@ class AppInfo {
screenTabbarSafeHeight: number = 42 // TODO 这里需要动态获取
imei: string = HttpUtils.getImei()
device_id: string = HttpUtils.getDeviceId()
fontSizes: string = 'small'
// TODO 完善
}
... ...
import { CompDTO } from 'wdBean';
import { CommonConstants, CompStyle } from 'wdConstant';
import { LabelComponent } from './view/LabelComponent';
import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent';
import {
HorizontalStrokeCardThreeTwoRadioForMoreComponent
} from './view/HorizontalStrokeCardThreeTwoRadioForMoreComponent';
... ... @@ -11,21 +10,19 @@ import {
import { ZhSingleRow02 } from './compview/ZhSingleRow02';
import { ZhSingleRow03 } from './compview/ZhSingleRow03';
import { ZhSingleRow04 } from './compview/ZhSingleRow04';
import { ZhSingleRow05 } from './compview/ZhSingleRow05';
import { ZhSingleRow06 } from './compview/ZhSingleRow06';
import { ZhSingleColumn04 } from './compview/ZhSingleColumn04';
import { ZhSingleColumn05 } from './compview/ZhSingleColumn05';
import { ZhSingleColumn09 } from './compview/ZhSingleColumn09';
import { ZhGridLayout03 } from './compview/ZhGridLayout03';
import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01';
import { CardParser } from './CardParser';
import { LiveHorizontalReservationComponent } from './view/LiveHorizontalReservationComponent';
import { ZhGridLayout02 } from './compview/ZhGridLayout02';
import { Card2Component } from './cardview/Card2Component';
import { Card5Component } from './cardview/Card5Component';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { AdvCardParser } from './cardViewAdv/AdvCardParser';
import PageModel from '../viewmodel/PageModel';
import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent';
/**
* comp适配器.
... ... @@ -35,13 +32,15 @@ import PageModel from '../viewmodel/PageModel';
@Component
export struct CompParser {
@State compDTO: CompDTO = {} as CompDTO
@State private pageModel: PageModel = new PageModel();
@State compIndex: number = 0;
build() {
Column() {
this.componentBuilder(this.compDTO, this.compIndex);
if (this.compDTO.name !="月度排行卡") {
this.componentBuilder(this.compDTO, this.compIndex);
}
}
}
... ... @@ -54,7 +53,8 @@ export struct CompParser {
} else if (compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) {
ZhCarouselLayout01({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 2) {
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 2) {// && compDTO.name ==="横划卡"
LiveHorizontalCardComponent({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 3) {
... ... @@ -103,7 +103,7 @@ export struct CompParser {
ZhSingleColumn09({ compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告
AdvCardParser({pageModel:this.pageModel,compDTO})
AdvCardParser({ pageModel: this.pageModel, compDTO })
//Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 16, right: 16 })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (!Number.isNaN(Number(compDTO.compStyle))) {
... ... @@ -123,6 +123,6 @@ export struct CompParser {
}
}
// }
// }
}
... ...
... ... @@ -29,7 +29,8 @@ import { publishCommentModel } from './comment/model/PublishCommentModel';
import { CommentComponent } from './comment/view/CommentComponent';
const TAG = 'DynamicDetailComponent'
@Preview
const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
// @Preview
@Component
export struct DynamicDetailComponent {
//入参
... ... @@ -53,6 +54,7 @@ export struct DynamicDetailComponent {
//跳转
private mJumpInfo: ContentDTO = {} as ContentDTO;
@State publishTime: string = ''
async aboutToAppear() {
... ... @@ -71,7 +73,7 @@ export struct DynamicDetailComponent {
.height($r('app.float.margin_28'))
.margin({ left: $r('app.float.margin_16') })
Blank()
Text(StringUtils.isEmpty(this.contentDetailData.publishTime)?"":this.contentDetailData.publishTime.replace('-','年').replace('-','月').replace(' ','日 ').substring(0,this.contentDetailData.publishTime.length-2))
Text(this.publishTime)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize($r('app.float.font_size_12'))
.lineHeight($r('app.float.margin_28'))
... ... @@ -79,6 +81,8 @@ export struct DynamicDetailComponent {
}
.height($r('app.float.margin_48'))
.width('100%')
.alignItems(VerticalAlign.Bottom)
.padding({bottom:5})
//分割线
Image($r('app.media.ic_news_detail_division'))
.width('100%')
... ... @@ -142,15 +146,23 @@ export struct DynamicDetailComponent {
.margin({right: $r('app.float.margin_6')})
if(!StringUtils.isEmpty(this.followStatus)){
if (this.followStatus == '0') {
Text('+关注')
.width($r('app.float.margin_54'))
.height($r('app.float.margin_24'))
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
.borderRadius($r('app.float.vp_3'))
.backgroundColor($r('app.color.color_ED2800'))
.fontColor($r('app.color.color_fff'))
.onClick(() => {
Row() {
Blank().layoutWeight(1)
Image($r('app.media.icon_add_attention'))
.width($r('app.float.vp_12'))
.height($r('app.float.vp_12'))
.margin({right:2})
Text('关注')
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
.fontColor($r('app.color.color_fff'))
Blank().layoutWeight(1)
}
.width($r('app.float.margin_54'))
.height($r('app.float.margin_24'))
.borderRadius($r('app.float.vp_3'))
.backgroundColor($r('app.color.color_ED2800'))
.onClick(() => {
this.handleAccention()
})
} else {
... ... @@ -330,23 +342,23 @@ export struct DynamicDetailComponent {
,left: $r('app.float.vp_12')
,right: $r('app.float.vp_12') })
//微信/朋友圈/微博
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.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(){
Blank().layoutWeight(1)
... ... @@ -427,6 +439,10 @@ export struct DynamicDetailComponent {
try {
let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType)
this.contentDetailData = data[0];
let dateTime =
DateTimeUtils.parseDate(this.contentDetailData?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN);
let _publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN)
this.publishTime = DateTimeUtils.removeTrailingZeros(_publishTime)
console.log('动态详情',JSON.stringify(this.contentDetailData))
} catch (exception) {
console.log('请求失败',JSON.stringify(exception))
... ...
... ... @@ -295,15 +295,15 @@ export struct ENewspaperPageComponent {
.backgroundColor($r('app.color.color_80000000'))
.id('e_newspaper_container')
ENewspaperListDialog({
newspaperListBean: this.newspaperListBean,
closeDialog: () => {
this.isOpenListDialog = false
}
})
.visibility(this.isOpenListDialog ? Visibility.Visible : Visibility.None)
if (this.isOpenListDialog) {
ENewspaperListDialog({
newspaperListBean: this.newspaperListBean,
closeDialog: () => {
this.isOpenListDialog = false
}
})
}
}
}
private async getNewspaperTime() {
... ...
... ... @@ -61,13 +61,12 @@ export struct ImageAndTextPageComponent {
Text(this.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)
.alignItems(VerticalAlign.Bottom)
.backgroundColor(Color.White)
Row() {
... ... @@ -205,7 +204,8 @@ export struct ImageAndTextPageComponent {
this.contentDetailData = detailBeans;
let dateTime =
DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN);
this.publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN)
let _publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN)
this.publishTime = DateTimeUtils.removeTrailingZeros(_publishTime)
if (this.contentDetailData[0]?.recommendShow === 1) {
this.getRecommend()
}
... ...
... ... @@ -66,7 +66,7 @@ export struct ImageAndTextWebComponent {
loadImageOnlyWifiSwitch: '2',
networkStatus: Number(NetworkUtil.isNetConnected()),
darkMode: 'light',
fontSizes: 'normalsize'
fontSizes: 'small'
} as H5ReceiveDataExtraBean
let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = {
... ...
... ... @@ -13,6 +13,7 @@ import { image } from '@kit.ImageKit';
import { getPicture, imageNet2PixelMap } from '../../utils/ImageUtils';
import { effectKit } from '@kit.ArkGraphics2D';
import { window } from '@kit.ArkUI';
import DailyPaperTopicModel from '../../model/DailyPaperTopicModel'
const TAG = 'MorningEveningPaperComponent';
... ... @@ -111,12 +112,19 @@ export struct MorningEveningPaperComponent {
Logger.info(TAG, "currentTime = " + currentTime)
Logger.info(TAG, `currentTime = ${currentTime}`)
try {
let dailyPaperTopicBean = await DailyPaperTopicModel.getDailyPaperTopic()
if (dailyPaperTopicBean) {
dailyPaperTopicPageId = '' + dailyPaperTopicBean.id
Logger.info(TAG, "pageID = " + dailyPaperTopicPageId)
}
// let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + this.dailyPaperTopicPageId)
let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + dailyPaperTopicPageId) //"25091"
this.pageInfoBean = pageInfoBean;
this.title = this.pageInfoBean?.topicInfo?.title
let dateTime = DateTimeUtils.parseDate(this.pageInfoBean?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN);
this.subTitle = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN)
let dateTime = DateTimeUtils.parseDate(this.pageInfoBean?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN)
const dateShow = new Date(dateTime)
this.subTitle = `${dateShow.getFullYear()}年\n${(dateShow.getMonth() + 1)}月${dateShow.getDate()}日`
Logger.info(TAG, "pageInfoBean topicDate = " + this.pageInfoBean?.topicInfo?.topicDate)
Logger.info(TAG, "pageInfoBean title = " + this.pageInfoBean?.topicInfo?.title)
... ... @@ -166,6 +174,7 @@ export struct MorningEveningPaperComponent {
let color = colorPicker.getMainColorSync();
// 将取色器选取的color示例转换为十六进制颜色代码
this.mixedBgColor = "#" + color.alpha.toString(16) + color.red.toString(16) + color.green.toString(16) + color.blue.toString(16);
Logger.debug(TAG, "compInfoBean compStyle = " + this.mixedBgColor)
});
}
... ... @@ -218,7 +227,6 @@ export struct MorningEveningPaperComponent {
.margin({ left: 14, right: 14 })
}
.width('100%')
// .backgroundColor('#000080')
// .backgroundColor(Color.Black)
// .backgroundColor(this.pageInfoBean?.backgroundColor ?? Color.Black)
.backgroundColor(this.mixedBgColor ?? Color.Black)
... ...
import router from '@ohos.router';
import { ToastUtils } from 'wdKit';
/**
* 早晚报页面标题bar
... ... @@ -74,6 +75,9 @@ export struct PaperTitleComponent {
})
.id('img_share')
.margin({ right: 13 })
.onClick(() => {
ToastUtils.showToast('分享为公共方法,待开发', 1000)
})
}
.margin({ left: 14, right: 14 })
.height($r('app.float.top_bar_height'))
... ...
... ... @@ -101,8 +101,8 @@ export struct SingleColumn999Component {
.height(100)
.padding(9)
.fontColor(Color.White)
.fontSize($r('app.float.font_size_16'))
.fontWeight(FontWeight.Medium)
.fontSize($r('app.float.vp_14'))
.fontWeight(400)
.textAlign(TextAlign.Center)
.align(Alignment.Bottom)
.maxLines(1)
... ... @@ -130,8 +130,8 @@ export struct SingleColumn999Component {
.width("100%")// .height(100)
.padding(9)
.fontColor(Color.White)
.fontSize($r('app.float.font_size_16'))
.fontWeight(FontWeight.Medium)
.fontSize($r('app.float.font_size_14'))
.fontWeight(400)
.textAlign(TextAlign.Center)
.align(Alignment.Bottom)
.maxLines(1)
... ...
... ... @@ -9,6 +9,7 @@ import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
*/
const TAG: string = 'Card10Component';
@Preview
@Component
export struct Card10Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
... ... @@ -24,6 +25,9 @@ export struct Card10Component {
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ bottom: 19 })
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.contentDTO)
})
}
// 大图
Stack() {
... ... @@ -36,12 +40,18 @@ export struct Card10Component {
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.contentDTO)
})
Text('专题')
.fontSize($r('app.float.font_size_12'))
.padding({ left: 8, right: 8, top: 3, bottom: 3 })
.backgroundColor(Color.Red)
.fontColor(Color.White)
.borderRadius($r('app.float.button_border_radius'))
// Text('专题')
// .fontSize($r('app.float.font_size_12'))
// .padding({ left: 8, right: 8, top: 3, bottom: 3 })
// .backgroundColor(Color.Red)
// .fontColor(Color.White)
// .borderRadius($r('app.float.button_border_radius'))
// .margin({ left: 5, bottom: 5 })
ImageSpan($r('app.media.special'))
.width($r('app.float.font_size_36'))
.objectFit(ImageFit.Fill)
.verticalAlign(ImageSpanAlignment.CENTER)
.margin({ left: 5, bottom: 5 })
}.alignContent(Alignment.BottomStart)
... ... @@ -89,12 +99,32 @@ export struct Card10Component {
timelineItem(item: slideShows, index: number) {
Row() {
Column() {
Text(item.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontWeight(400)
.fontColor($r('app.color.color_222222'))
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
Text(item.newsTitle) {
if (item.objectType == '5') {
// Text('专题')
// .fontSize($r('app.float.font_size_12'))
// .padding({ left: 8, right: 8, top: 3, bottom: 3 })
// .backgroundColor(Color.Red)
// .fontColor(Color.White)
// .borderRadius($r('app.float.button_border_radius'))
// .margin({ right: 5 })
ImageSpan($r('app.media.special'))
.width($r('app.float.font_size_36'))
.objectFit(ImageFit.Fill)
.verticalAlign(ImageSpanAlignment.CENTER)
.margin({ right: 5 })
}
Span(item.newsTitle)
}
.fontSize($r('app.float.font_size_17'))
.fontWeight(400)
.fontColor($r('app.color.color_222222'))
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
CardSourceInfo(
{
contentDTO: {
... ...
... ... @@ -105,6 +105,9 @@ export class commentItemModel {
targetRelObjectId: string = '';
targetRelType: string = '';
targetType: string = '';
h5Url: string = '';
pageId: string = '';
topicType: string = '';
visitorComment: string = '';
shareInfo: commentItemShareInfoModel = new commentItemShareInfoModel;
api_commentId: string = '';
... ...
... ... @@ -6,8 +6,10 @@ import display from '@ohos.display';
const collapseString = '...展开全文'
const uncollapseString = '...收起'
const TestLongText = "超过三行超\n过三行超过\n三行超超过三行\n超过三行超过三行超过三\n行超过"
@Component
@Preview
// @Preview
export struct CommentText {
// 长文本
@State longMessage: string = ''
... ... @@ -26,6 +28,7 @@ export struct CommentText {
@State expandedStates: boolean = false;
@State fontSize: number = 18;
@State fontWeight: FontWeight = FontWeight.Regular
@State lineHeight: number = 24
fontColor: ResourceColor = $r('app.color.color_222222')
// 测量文本宽度(单位px)
@State textWidth: number = 0;
... ... @@ -37,6 +40,8 @@ export struct CommentText {
promise: Promise<Array<display.Display>> = display.getAllDisplays()
aboutToAppear() {
// this.longMessage = TestLongText
console.log(`文本宽度为:${this.textWidth}`)
let padding = vp2px(5 + this.marginWidth)
... ... @@ -58,6 +63,17 @@ export struct CommentText {
this.isExpanded = (this.screenWidth - padding) * this.lines <= this.textWidth
// this.expandedStates = this.isExpanded;
let lines = this.getTextLineNum(
this.longMessage,
(this.screenWidth - padding),
this.lineHeight,
this.fontSize,
this.fontWeight
)
if (lines > 3) {
this.isExpanded = true
}
//需要展开的话计算3行需要显示的文字
if (this.isExpanded) {
... ... @@ -76,13 +92,25 @@ export struct CommentText {
wordBreak:WordBreak.BREAK_ALL
})
let size = this.topMeasureText(
string,
(this.screenWidth - padding),
this.lineHeight,
this.fontSize,
this.fontWeight,
WordBreak.BREAK_ALL)
let height: number = Number(size.height)
let lines = Math.ceil(px2vp(height) / this.lineHeight)
//计算有误差20
if (thisTextWidth >= maxLineTextWidth) {
if (thisTextWidth >= maxLineTextWidth || lines > 3) {
// if (this.maxLineMesssage.endsWith('\n')) {
// this.maxLineMesssage = this.maxLineMesssage.slice(0, this.maxLineMesssage.length - 1)
// }
break
}
this.maxLineMesssage = element;
}
}
... ... @@ -152,6 +180,24 @@ export struct CommentText {
// .height('100%')
}
// 获取文本几行
private getTextLineNum(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource, fontWeight: FontWeight) {
let size = this.topMeasureText(text, constraintWidth, lineHeight, fontSize, fontWeight)
let height: number = Number(size.height)
return Math.ceil(px2vp(height) / lineHeight)
}
private topMeasureText(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource, fontWeight: FontWeight, wordBreak?: WordBreak) {
return measure.measureTextSize({
textContent: text,
fontSize: fontSize,
lineHeight: lineHeight,
constraintWidth: constraintWidth,
fontWeight: fontWeight,
wordBreak: wordBreak,
})
}
}
... ... @@ -161,7 +207,11 @@ export struct CommentText {
struct Index {
build() {
Column() {
CommentText()
CommentText({longMessage: TestLongText,
maxline: 3,
fontSize: 14,
fontWeight: FontWeight.Regular,
marginWidth: (95 + 16)})
}
}
}
\ No newline at end of file
... ...
... ... @@ -9,7 +9,8 @@ import { EmptyComponent, WDViewDefaultType } from '../../view/EmptyComponent'
import NoMoreLayout from '../../page/NoMoreLayout'
import { CommentCustomDialog } from './CommentCustomDialog'
import { publishCommentModel } from '../model/PublishCommentModel'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import { ContentDTO } from 'wdBean/Index'
const TAG = 'QualityCommentsComponent';
... ... @@ -355,6 +356,9 @@ struct QualityCommentItem {
Image($r('app.media.more')).width(12).height(12)
}.width('100%').height(40).justifyContent(FlexAlign.SpaceBetween)
.onClick(() => {
this.jumpToDetail()
})
}
.backgroundColor('#F9F9F9')
... ... @@ -418,6 +422,22 @@ struct QualityCommentItem {
}
}
jumpToDetail() {
// programInfoModel.api_isCommentAction = YES;
let program: ContentDTO = {
objectId: this.item.targetId,
objectType: this.item.targetType,
relId: this.item.targetRelId,
relType: this.item.targetRelType,
// objectLevel: this.item.topicType,
pageId: this.item.pageId,
linkUrl: this.item.h5Url,
} as ContentDTO
ProcessUtils.processPage(program)
}
}
function commentLikeChange(item: commentItemModel) {
... ...
import { Action, ContentDTO, Params } from 'wdBean';
import { CommonConstants, ConfigConstants, ScreenType } from 'wdConstant';
import { Logger } from 'wdKit';
import { Logger, ToastUtils } from 'wdKit';
import { CompUtils } from '../../utils/CompUtils';
import { ProcessUtils, WDRouterRule } from 'wdRouter';
... ... @@ -475,7 +475,7 @@ export struct PaperSingleColumn999CardView {
}
.justifyContent(FlexAlign.Start)
Image($r('app.media.icon_forward'))
Image($r('app.media.icon_paper_share'))
.width(16)
.height(16)
.margin({ left: 10, right: 22, top: 10, bottom: 10 })
... ... @@ -483,6 +483,9 @@ export struct PaperSingleColumn999CardView {
center: { anchor: '__container__', align: VerticalAlign.Center },
right: { anchor: '__container__', align: HorizontalAlign.End }
})
.onClick(() => {
ToastUtils.showToast('分享为公共方法,待开发', 1000)
})
}.width(CommonConstants.FULL_PARENT)
.justifyContent(FlexAlign.SpaceBetween)
}
... ...
... ... @@ -214,20 +214,23 @@ struct ChannelDialog {
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
ForEach(this.homeChannelList, (item: TopNavDTO, index: number) => {
Stack() {
Image(item.channelId === this.indexSettingChannelId ? $r('app.media.index_setting_button_active') : $r('app.media.index_setting_button'))
Image(item.channelId === this.indexSettingChannelId ? $r('app.media.index_setting_button_active') :
$r('app.media.index_setting_button'))
.objectFit(ImageFit.Auto)
.rotate({
angle: index === 1 ? 180 : 0
})
Row() {
if (index === 0) {
Image(item.channelId === this.indexSettingChannelId ? $r('app.media.recommend_icon') : $r('app.media.recommend_icon_active'))
Image(item.channelId === this.indexSettingChannelId ? $r('app.media.recommend_icon') :
$r('app.media.recommend_icon_active'))
.width(20)
}
Text(item.name)
.textAlign(TextAlign.Center)
.fontSize(16)
.fontColor(item.channelId === this.indexSettingChannelId ? '#ffffff' : '#ED2800')
}
.width('100%')
.justifyContent(FlexAlign.Center)
... ... @@ -275,8 +278,8 @@ struct ChannelDialog {
GridItem() {
Row() {
Text(item.name)
.fontSize(14)
.fontColor(this.currentTopNavSelectedItem.channelId === item.channelId ? '#ED2800' : (item.headlinesOn === 1 || item.movePermitted === 0 ? '#999999' : '#222222'))
.fontSize(14)// .fontColor(this.currentTopNavSelectedItem.channelId === item.channelId ? '#ED2800' : (item.headlinesOn === 1 || item.movePermitted === 0 ? '#999999' : '#222222'))
.fontColor(item.headlinesOn === 1 || item.movePermitted === 0 ? '#999999' : '#222222')
if (this.isEditIng && item.delPermitted === 1 && item.movePermitted === 1) {
Image($r('app.media.icon_audio_close'))
... ... @@ -292,7 +295,7 @@ struct ChannelDialog {
.width('23%')
.height(40)
.border({
width: item.headlinesOn === 1 || item.movePermitted === 0 ? 0 : 1,
width: item.headlinesOn === 1 || item.movePermitted === 0 ? 0 : 1,
color: '#EDEDED',
radius: 3
})
... ... @@ -319,7 +322,11 @@ struct ChannelDialog {
}
}
}),
PanGesture({ fingers: 1, direction: this.isEditIng ? PanDirection.All:PanDirection.None, distance: 0 })
PanGesture({
fingers: 1,
direction: this.isEditIng ? PanDirection.All : PanDirection.None,
distance: 0
})
.onActionStart((event: GestureEvent) => {
this.dragItem = item.num
this.dragRefOffsetX = 0
... ... @@ -449,7 +456,12 @@ struct ChannelDialog {
}.width('100%').height('100%')
.scrollBar(BarState.Off)
}
.padding({ top: 40, right: 15, bottom: 40, left: 15 })
.padding({
top: 40,
right: 15,
bottom: 40,
left: 15
})
.backgroundColor('#ffffff')
}
}
... ...
... ... @@ -43,17 +43,34 @@ struct EditUserInfoPage {
Row() {
Column() {
CustomTitleUI({titleName:'编辑资料'})
Image(this.headerImg)
.alt($r('app.media.default_head'))
.backgroundColor(Color.Gray)
.width(100)
.height(100)
.borderRadius(50)
.margin({top:20,bottom:-10})
Stack(){
Image(this.headerImg)
.alt($r('app.media.default_head'))
.backgroundColor(Color.Gray)
.width(84)
.height(84)
.borderRadius(42)
if (this.headerImg.length === 0){
Image('')
.width('84')
.height('84')
.backgroundColor(Color.Gray)
.opacity(0.7)
.borderRadius(5)
.borderRadius(42)
Image($r('app.media.seletct_photo'))
.width('30')
.height('30')
}
}.margin({top:20,bottom:-10})
Button('点击更换头像')
.fontColor(Color.Gray)
.fontSize(18)
.fontSize(15)
.backgroundColor(Color.White)
.margin(20)
... ... @@ -79,14 +96,14 @@ struct EditUserInfoPage {
Column(){
Row(){
Text(r.title)
.fontSize(18)
.fontSize(15)
.fontColor(Color.Gray)
Blank()
Text(r.subTitle)
.textOverflow({overflow:TextOverflow.Ellipsis})
.maxLines(1)
.fontSize(16)
.fontSize(14)
.fontColor(Color.Gray)
.padding({right:10})
.width('70%')
... ...
... ... @@ -197,7 +197,7 @@ export struct TopNavigationComponent {
.width(18)
.height(18)
Text('早晚报')
.fontColor($r('app.color.color_B0B0B0'))
.fontColor("#666666")
.fontSize($r('app.float.font_size_13'))
}
.alignItems(VerticalAlign.Center)
... ...
... ... @@ -385,11 +385,12 @@ export struct PeopleShipMainComponent {
})
Logger.debug('PeopleShipMainComponent', `一键关注接口参数: ${JSON.stringify(objects)}`);
let batchInfo = await PeopleShipMainViewModel.getAttentionBatchInfo(objects)
this.oneKeyFollow = false
if (batchInfo.code === 0 || batchInfo.code.toString() === "0") {
this.getData()
}
} catch (exception) {
this.oneKeyFollow = false
}
}
... ...
... ... @@ -54,7 +54,7 @@ export struct FirstTabTopSearchComponent {
ForEach(this.searchTextData, (item: string, index: number) => {
Text(item)
.fontWeight(400)
.fontColor($r('app.color.color_B0B0B0'))
.fontColor("#666666")
.fontSize($r('app.float.font_size_13'))
.textAlign(TextAlign.Start)
.maxLines(1)
... ...
... ... @@ -14,7 +14,7 @@ export struct newsSkeleton {
Column() {
Row() {
Column() {
Image($rawfile('apph5/image/peopleSeleton.svg')).width('100%').height(47)// 后缀名不能省略
Image($r('app.media.peopleSeleton')).width('100%').height(47)// 后缀名不能省略
.interpolation(ImageInterpolation.High)
textArea('100%', 9)
}.width('72.00%').alignItems(HorizontalAlign.Start).margin({ right: 5 })
... ...
import { ToastUtils, Logger, NumberFormatterUtils, SPHelper } from 'wdKit';
import promptAction from '@ohos.promptAction';
import {
InputMethodProperty,
batchLikeAndCollectResult,
... ... @@ -41,7 +42,7 @@ const TAG = 'OperRowListView';
@Preview
@Component
export struct OperRowListView {
@Prop contentDetailData: ContentDetailDTO // 稿件详情
@Prop @Watch('onDetailUpdated') contentDetailData: ContentDetailDTO // 稿件详情
@State operationButtonList: string[] = ['comment', 'collect', 'share'] // 组件展示条件
@ObjectLink publishCommentModel: publishCommentModel
// @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
... ... @@ -52,7 +53,9 @@ export struct OperRowListView {
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
needLike: boolean = true
async aboutToAppear() {
// async aboutToAppear() {
async onDetailUpdated() {
if (!this.contentDetailData) return
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (user_id) {
this.getInteractDataStatus()
... ... @@ -99,20 +102,22 @@ export struct OperRowListView {
})
.width(42)
ForEach(this.operationButtonList, (item: string, index: number) => {
if (item == 'comment') {
this.builderComment()
} else if (item == 'like' && this.needLike) {
this.builderLike()
} else if (item == 'collect') {
this.builderCollect()
} else if (item == 'listen') {
this.builderListen()
} else if (item == 'share') {
this.builderShare()
} else {
}
})
if (this.contentDetailData) {
ForEach(this.operationButtonList, (item: string, index: number) => {
if (item == 'comment') {
this.builderComment()
} else if (item == 'like' && this.needLike) {
this.builderLike()
} else if (item == 'collect') {
this.builderCollect()
} else if (item == 'listen') {
this.builderListen()
} else if (item == 'share') {
this.builderShare()
} else {
}
})
}
}
.width('100%')
.justifyContent(FlexAlign.Start)
... ... @@ -121,7 +126,8 @@ export struct OperRowListView {
.backgroundColor(Color.White)
.padding({
top: 10,
bottom: `${this.bottomSafeHeight}px`
// bottom: `${this.bottomSafeHeight}px`
bottom: 50
})
}
... ... @@ -267,6 +273,9 @@ export struct OperRowListView {
PageRepository.postExecuteCollectRecord(params).then(res => {
if (this.newsStatusOfUser) {
this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
if(this.newsStatusOfUser.collectStatus === 1){
promptAction.showToast({ message: '收藏成功' })
}
this.queryContentInteractCount()
}
})
... ...
... ... @@ -15,11 +15,15 @@ export struct ENewspaperListDialog {
@Prop @Watch('updateRecordsData') newspaperListBean: NewspaperListBean = {} as NewspaperListBean
private listScroller: Scroller = new Scroller()
@State scrollOffset: number = 0
@State isCurrentViewOpen: boolean = false
//文字版选择弹框
pageListDialogController: CustomDialogController = new CustomDialogController({
builder: ENewspaperPageDialog({
dialogType: 1,
newspaperListBean: this.newspaperListBean,
dialogVisibility: (visibility: boolean) => {
this.isCurrentViewOpen = !visibility
}
}),
alignment: DialogAlignment.TopStart,
offset: { dx: 0, dy: 224 },
... ... @@ -37,10 +41,13 @@ export struct ENewspaperListDialog {
let _scrollIndex = Number.parseInt(this.currentPageNum)
console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "_scrollIndex:", _scrollIndex)
let scrollIndexEnd = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex
this.listScroller.scrollToIndex(scrollIndexEnd)
if (!this.isCurrentViewOpen) {
this.listScroller.scrollToIndex(scrollIndexEnd)
}
}
aboutToAppear(): void {
this.isCurrentViewOpen = true
console.log("ENewspaperListDialog-aboutToAppear", "currentPageNum:", this.currentPageNum)
let _scrollIndex = Number.parseInt(this.currentPageNum)
console.log("ENewspaperListDialog-aboutToAppear", "_scrollIndex:", _scrollIndex)
... ... @@ -52,6 +59,7 @@ export struct ENewspaperListDialog {
// if (this.pageListDialogController) {
// this.pageListDialogController = null
// }
this.isCurrentViewOpen = false
}
build() {
... ... @@ -221,26 +229,26 @@ export struct ENewspaperListDialog {
.padding({
left: 15,
right: 15,
top: 16,
// top: 16,
bottom: 16
})
.margin({
bottom: 85
})
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.onScrollIndex((firstIndex: number, lastIndex: number, centerIndex: number) => {
// console.info('ENewspaperListDialog::first' + firstIndex)
// console.info('ENewspaperListDialog::last' + lastIndex)
// console.info('ENewspaperListDialog::center' + centerIndex)
console.info('ENewspaperListDialog::first' + firstIndex)
console.info('ENewspaperListDialog::last' + lastIndex)
console.info('ENewspaperListDialog::center' + centerIndex)
// this.updateCurrentPageNum(firstIndex)
// const tempIndex = this.findClassIndex(firstIndex)
if (firstIndex !== centerIndex) {
return
}
// if (firstIndex !== centerIndex) {
// return
// }
// console.info(`this.scrollOffset:` + this.scrollOffset)
// if (this.scrollOffset == 0) {
this.currentPageNum = `${centerIndex < 9 ? '0' + (centerIndex + 1) : centerIndex + 1}`
this.currentPageNum = `${firstIndex < 9 ? '0' + (firstIndex + 1) : firstIndex + 1}`
// }
})
.onScroll((scrollOffset: number, scrollState: ScrollState) => {
... ...
... ... @@ -9,11 +9,24 @@ export struct ENewspaperPageDialog {
pageDialogController?: CustomDialogController
@Consume @Watch('onCurrentPageNumUpdated') currentPageNum: string
@Prop newspaperListBean: NewspaperListBean = {} as NewspaperListBean
public dialogVisibility?: (visibility: boolean) => void
onCurrentPageNumUpdated(): void {
console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum)
}
aboutToAppear(): void {
if (this.dialogType == 1 && this.dialogVisibility) {
this.dialogVisibility(true)
}
}
aboutToDisappear(): void {
if (this.dialogType == 1 && this.dialogVisibility) {
this.dialogVisibility(false)
}
}
build() {
Column() {
if (this.dialogType == 1) {
... ...
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1713249268044" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2925" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M884.736 546.88c-1.792-5.12-7.04-9.728-12.8-7.232-3.2 1.344-10.496 12.544-11.072 9.6-2.752-14.08 16.704-18.048 19.52-25.344 3.008-8-4.224-11.52-10.24-13.888a47.232 47.232 0 0 1-16.192-11.072c-4.928-4.992-17.024-12.352-21.568-3.2-1.28 4.352-0.512 12.608-2.176 17.92-1.92 6.272-9.088 6.72-13.44 11.328-6.208 6.848 0.64 9.216 4.8 14.464 3.84 4.992 1.216 40.384-5.248 52.48-3.2 6.016-86.336 72.064-100.032 75.52-15.744 3.84-15.68 20.48-8.96 29.696 8.576 11.712 27.008 6.272 36.16-0.448 5.76-4.352 44.288-45.056 53.44-53.44 3.712-3.392 18.688-22.976 19.84-10.432a46.912 46.912 0 0 1-1.728 16.96c-1.856 5.888-5.568 14.848-5.12 21.248 0.768 10.24 19.2 24.32 28.8 20.096 6.208-2.816 6.72-12.096 6.08-18.816-0.576-7.04 0.768-49.024 2.24-62.72a46.08 46.08 0 0 1 5.952-20.8c5.248-8.768 36.928-27.072 31.744-41.92z m-226.88 26.624c-2.816 6.08-14.272-3.84-17.152-6.528-2.88-2.56-6.464-4.48-6.016-8.896 0.576-4.48 5.76-5.12 5.76-5.12 1.792-0.32 17.792-0.96 18.88 1.856a55.296 55.296 0 0 1-1.472 18.688z m14.72-97.28c-10.816-1.408-23.296 9.472-31.616 14.72-4.096 2.56-27.52 14.4-24 20.48 2.432 4.096 17.024 0.576 21.76-0.512 13.44-3.072 20.48-12.032 23.872-9.792 2.88 1.92 1.024 32.64-4.48 32.064-12.032-1.152-19.2-10.624-32.064-15.872-3.968-1.6-11.776-4.608-9.088 2.624 0.768 2.176 3.648 5.056 4.672 7.168 2.368 4.8 4.48 21.504 2.368 25.152-4.224 6.976-8.704-5.376-9.792-8.064-2.048-5.12-3.328-10.368-5.12-15.552-1.536-4.736-5.568-16.96-10.944-16.256-6.208 0.832-1.664 27.968-2.816 33.728-3.84 19.456-5.504 25.216-6.144 37.952-0.512 10.304 0 27.392 11.84 30.528 15.808 4.224 18.048-9.344 19.456-18.56 0.32-2.176 0.832-6.784 1.92-8.64 1.664-2.752 3.84-3.2 5.888-0.512 1.664 2.304 0.96 5.696 3.456 7.936 2.496 2.304 5.312 1.92 8.576 2.56 5.056 0.96 11.328-0.96 14.464 3.84 3.2 5.12 2.176 10.56 8.32 14.016 13.44 7.36 19.84-7.168 20.864-16.896 1.216-11.648 1.792-22.592 2.368-34.176 0.576-11.712 1.088-24.448 4.096-35.776a244.48 244.48 0 0 1 5.248-17.024 22.72 22.72 0 0 0 0.768-16.256c-3.776-9.728-19.648-18.368-23.936-18.88z m-165.312 2.304c4.48-4.16 12.032-9.664 10.88-16.32-4.352-25.92-44.672-8.384-59.968-0.768-22.208 11.136-11.52 5.824-50.432 24.96-5.888 2.816-3.2 7.04-2.304 9.6 3.2 9.216 17.664 13.632 23.808 9.728 5.12-3.264 54.08-37.76 56.704-34.112 4.032 5.504-20.8 24.512-32.32 29.056-5.12 2.048-13.184 9.408-14.784 15.04a12.992 12.992 0 0 0 0.192 8.96l-0.64-0.256c-1.856 0.64-6.848-0.192-8.512 0.96-1.536 1.024 1.728 20.928 8.128 33.28 2.304 4.352 4.288 8.32-1.088 11.008-6.208 3.072-17.088 15.68-4.928 16.832 2.624 0.256 5.44 0.384 7.68-0.896 1.728-1.024 4.992-2.944 7.488-2.24 2.56 0.768 4.736 8.32 6.4 10.944 5.312 8.064 24.576 43.328 33.728 45.632 8 2.048 21.312-1.152 24-9.984 1.408-4.416 2.56-36.864 2.496-41.664-0.064-4.288 0.256-9.856-0.896-13.76-1.088-3.648-3.84-9.152-8.448-7.872-4.928 1.28-5.184 8.832-6.016 12.8-1.024 4.8-2.24 26.304-7.232 26.368-3.52 0-20.16-26.624-22.016-30.336-1.92-3.776-3.52-7.36-0.96-11.008 4.48-6.464 19.2-14.976 11.264-23.68-6.272-6.784-20.48-4.992-22.592 3.584-0.64 2.56 0.896 12.608-4.416 8.96-3.072-2.112-8.704-17.088-6.656-19.2 0.832-0.832 4.224-1.472 7.296-1.792h3.2c10.88-0.96 26.496-6.72 29.952-15.296 1.152-2.88 2.56-6.592 0.064-8.576-1.984-1.664-2.624-1.92-3.2-4.16-0.64-2.688 19.52-21.504 24.128-25.792z m472.064 56.128c16.384-7.808 49.408-7.424 44.096-39.04-1.088-6.528-4.352-20.032-13.568-19.52-8 0.448-14.272 12.8-17.792 18.816-8.96 15.36-26.496 30.4-38.912 43.264-15.68 16.256-41.088 60.992-43.84 60.992-7.296-0.064 3.264-29.248 4.992-33.536 10.176-25.28 42.88-104.256 47.808-113.28 9.152-16.832 15.808-25.792 26.112-41.664 20.352-31.36-14.848-30.336-14.848-30.336-9.92 0.768-16.256 7.296-21.952 11.776-6.272 4.8-12.8 8.064-19.712 11.904-6.784 3.84-15.36 7.872-9.472 16.128 4.992 7.04 10.752 7.744 18.24 8.512a38.72 38.72 0 0 0 7.36 0.512c-1.216 7.232-25.28 50.112-30.848 66.752-11.392 34.24-20.224 98.368-36.8 128a29.888 29.888 0 0 0-3.392 23.68c2.112 6.912 14.272 11.52 21.952 5.376 6.144-4.864 6.976-29.312 28.48-67.072 6.016-10.496 9.6-6.144 14.592 3.584 4.544 8.768 8.512 31.104 14.592 39.296 19.52 26.176 41.408 18.688 44.352 9.472 4.48-13.632-3.84-23.872-9.792-29.824-16.896-16.704-59.712-28.992-49.152-48 7.872-14.08 28.544-21.504 37.504-25.792zM260.544 386.816c-0.576-9.856-6.912-17.472-16.064-22.72-4.288-2.496-19.52-9.664-23.04-6.144l1.472-0.32c-6.016 2.688-1.92 21.312-2.496 26.688-1.024 9.984-6.336 22.208-9.792 31.872-7.232 20.032-13.888 37.824-21.056 57.856a576.64 576.64 0 0 1-26.944 61.312c-9.984 19.84-19.712 40.256-29.888 59.84-5.76 11.2-11.84 22.272-19.2 32.32-6.848 9.152-14.464 20.352-22.784 28.416-6.848 6.592-15.872 12.8-24.512 16.064-10.496 4.032-20.032 4.864-30.72 6.912-4.928 0.896-26.24 2.304-31.04 4.096-13.696 4.992 7.872 11.648 13.952 11.584 21.76 0 44.992 1.536 64.64-5.568 18.944-6.912 35.84-21.12 47.936-36.736 13.44-17.344 37.632-61.76 46.976-81.216 11.52-23.808 58.24-112.64 62.912-125.312 6.08-16.64 20.544-41.408 19.648-59.008z m550.144 102.4a24.512 24.512 0 0 0 16.96-1.472 25.6 25.6 0 0 1 16.448-2.176c4.736 0.64 8.832 1.28 13.76 0.448 6.08-0.96 7.808-2.112 12.8-5.12 4.864-2.944 9.408-2.496 14.784-3.328a20.8 20.8 0 0 0 11.584-6.912c6.784-7.04 12.16-18.624 3.648-25.728-3.968-3.328-15.552-9.664-27.712-4.736a265.216 265.216 0 0 0-25.664 16.64c-9.728 6.912-21.568 9.472-31.488 15.36-3.84 2.24-9.152 5.248-11.648 8.96-3.264 4.672 1.92 6.784 6.528 8.064zM437.952 595.712c-11.008-4.672-14.912 2.624-21.632 6.464-3.264-5.12 0.128-12.416 0.96-17.856 0.96-6.4 6.72-38.4-17.92-51.008-1.984-1.024-5.568-1.472-5.568 1.408l-2.24 18.24c-5.632 43.2-9.728 53.76-10.112 60.864-0.256 6.848-0.704 16.576 3.712 21.952 3.648 4.288 9.472 7.488 15.488 5.824 5.76-1.472 24.128-17.472 29.056-22.208 5.056-4.8 19.008-19.2 8.256-23.68z m378.88-166.208c4.48 1.472 21.312 1.344 19.008 7.68-1.344 3.776-6.272 6.4-9.088 9.088-1.664 1.664-8.448 7.872-7.68 10.112 1.408 4.544 21.376-7.616 25.344-10.624 4.288-3.328 8.704-6.208 13.696-8.448 4.928-2.304 18.56-7.168 28.736-15.36 10.048-8.256 45.312-69.312 45.888-74.304 1.152-10.368-10.432-23.488-20.928-27.456-4.48-1.728-9.792 7.808-11.072 10.624-2.304 5.12-15.552 30.72-19.712 39.36a61.504 61.504 0 0 1-19.136 23.872c-8.96 6.08-18.56 8.896-28.8 11.904-5.248 1.6-26.688 6.656-28.8 9.792-2.88 4.224 8.192 12.352 12.544 13.76z m-489.088 219.136c-5.248 1.536-35.2 8.96-40.512 7.808-28.928-5.888-30.272-32.832-79.04-75.904-1.664-1.536-19.584-12.032-18.176-4.48 0 0 15.424 26.624 18.816 31.552 3.712 5.312 20.032 42.88 22.592 48.192 2.432 5.056 4.992 10.368 7.68 15.232 5.44 9.344 15.68 22.272 27.072 24.832 5.76 1.28 24.512-4.352 30.144-7.104 11.328-5.632 22.528-12.8 32.192-21.312 3.84-3.328 8.64-7.744 10.112-12.672 2.304-7.808-5.248-7.808-10.88-6.144z" p-id="2926" fill="#f6f6f6"></path></svg>
\ No newline at end of file
... ...
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1715075661006" class="icon" viewBox="0 0 2048 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7815" width="64" height="32" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M1920 0a128 128 0 0 1 128 128v768a128 128 0 0 1-128 128H128a128 128 0 0 1-128-128V128a128 128 0 0 1 128-128h1792zM569.344 135.168c-6.144 30.72-12.288 61.44-19.2 92.928H347.392v51.456h191.232c-7.68 32.256-15.36 63.744-23.808 95.232H295.168v53.76h204.288c-16.128 52.992-33.792 103.68-52.224 152.832h379.392c-40.704 50.688-96.768 99.84-167.424 145.92a2339.2 2339.2 0 0 0-165.888-51.456l-29.184 43.008a1960.896 1960.896 0 0 1 356.352 134.4l30.72-48.384a1604.032 1604.032 0 0 0-132.864-56.064c79.104-56.832 136.704-114.432 173.568-171.264V529.92H526.336c10.752-31.488 22.272-65.28 33.024-101.376h425.472v-53.76h-410.88c7.68-29.952 15.36-61.44 23.04-95.232h342.528v-51.456H608.512c6.144-27.648 11.52-57.6 17.664-88.32l-56.832-4.608z m829.44 354.816h-325.632v50.688h152.064v186.624c-23.808-17.664-46.08-42.24-66.048-73.728 3.84-23.04 6.144-46.848 7.68-72.96l-49.152-6.144c-3.84 87.552-26.112 165.888-67.584 235.776l39.936 35.328a565.696 565.696 0 0 0 57.6-135.936c31.488 44.544 67.584 76.032 108.288 92.928 44.16 19.136 151.04 29.12 322.176 29.888l173.952 0.064 9.216-55.296c-34.88 1.408-85.696 2.816-152.32 3.008l-20.48 0.064c-157.44 0-258.048-6.912-302.592-20.736a89.408 89.408 0 0 0-11.52-4.608v-83.712h105.216V622.08h-105.216V540.672h124.416v-50.688z m201.984-122.88h-50.688v108.288c-1.536 57.6-13.056 104.448-33.024 140.544-22.272 34.56-60.672 62.208-115.968 82.176l29.952 47.616c58.368-23.04 101.376-54.528 127.488-95.232 26.112-43.776 40.704-102.144 42.24-175.104V367.104z m29.952 228.864l-36.864 35.328c49.92 39.936 89.088 78.336 117.504 113.664l39.168-38.4a850.24 850.24 0 0 0-119.808-110.592z m110.592-424.704h-331.776v50.688h143.616a539.136 539.136 0 0 1-9.984 61.44h-109.824v310.272h49.152V331.008h185.856v262.656h51.456V283.392h-126.72c4.608-19.968 7.68-39.936 9.984-61.44h138.24v-50.688zM1369.6 170.496h-261.888v268.032H1369.6V170.496z m-53.76 156.672v65.28h-154.368v-65.28h154.368z m0-110.592V284.16h-154.368V216.576h154.368z" fill="#ff0000" p-id="7816"></path></svg>
\ No newline at end of file
... ...
... ... @@ -344,7 +344,6 @@ const app = Vue.createApp({
// 页面加载 内容详情数据 最外层方法
const initData = async (res, id, devApp) => {
console.log("initData:",res)
/**判断是否为本地开发环境,是的话初始化数据,不是的话通过app提供的方法,h5发送数据给app**/
if (window.config.VUE_BASE_NODE === 'dev') {
if (devApp || window.config.devApp) {
... ... @@ -405,7 +404,6 @@ const app = Vue.createApp({
if ([ 200, '0' ].includes(res.code) > 0) {
if (res.data) {
const details = res.data.length > 0 ? res.data[0] : {}
// const details = res.data || {}
hasDetails = true
// 获取用户登录状态
if (hasAppLoginExtra.value) {
... ...
import { window } from '@kit.ArkUI'
import { NumberFormatterUtils, WindowModel } from 'wdKit/Index'
import { NumberFormatterUtils, StringUtils, WindowModel } from 'wdKit/Index'
import { DateFormatUtil, WDPlayerController } from 'wdPlayer/Index'
import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index'
import { DisplayDirection } from 'wdConstant/Index'
... ... @@ -20,7 +20,8 @@ export struct PlayUIComponent {
@Consume displayDirection: DisplayDirection
onChangeMenuVisible() {
if (!this.liveDetailsBean || !this.liveDetailsBean.liveInfo || this.liveDetailsBean?.liveInfo?.liveState === 'wait') {
if (!this.liveDetailsBean || !this.liveDetailsBean.liveInfo ||
this.liveDetailsBean?.liveInfo?.liveState === 'wait') {
return
}
let time: number = 0
... ... @@ -216,30 +217,38 @@ export struct PlayUIComponent {
this.playOrPauseBtn()
Blank()
} else if (this.liveDetailsBean?.liveInfo?.liveState == 'end') {
this.playOrPauseBtn()
Text(this.currentTime)
.fontColor(Color.White)
.fontWeight(600)
.fontSize('12fp')
.margin({
left: 16
})
this.playProgressView()
Text(this.totalTime)
.fontColor(Color.White)
.fontWeight(600)
.fontSize('12fp')
.margin({
right: 16
})
if (StringUtils.isEmpty(this.liveDetailsBean?.liveInfo?.vlive[0]?.replayUri)) {
Blank()
} else {
this.playOrPauseBtn()
Text(this.currentTime)
.fontColor(Color.White)
.fontWeight(600)
.fontSize('12fp')
.margin({
left: 16
})
this.playProgressView()
Text(this.totalTime)
.fontColor(Color.White)
.fontWeight(600)
.fontSize('12fp')
.margin({
right: 16
})
}
}
if (this.liveDetailsBean?.liveInfo?.liveState == 'running'
|| this.liveDetailsBean?.liveInfo?.liveState == 'end') {
|| (this.liveDetailsBean?.liveInfo?.liveState == 'end' &&
StringUtils.isNotEmpty(this.liveDetailsBean?.liveInfo?.vlive[0]?.replayUri))
) {
Image($r('app.media.icon_live_player_full_screen'))
.width(24)
.height(24)
.onClick(() => {
this.displayDirection = this.displayDirection == DisplayDirection.VERTICAL ? DisplayDirection.VIDEO_HORIZONTAL : DisplayDirection.VERTICAL
this.displayDirection =
this.displayDirection == DisplayDirection.VERTICAL ? DisplayDirection.VIDEO_HORIZONTAL :
DisplayDirection.VERTICAL
WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ?
window.Orientation.PORTRAIT :
window.Orientation.LANDSCAPE_INVERTED)
... ...
import { LiveDetailsBean } from 'wdBean/Index';
import { StringUtils } from 'wdKit/Index';
import { WDPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index';
import { PlayUIComponent } from './PlayUIComponent';
... ... @@ -8,7 +9,10 @@ export struct TopPlayComponent {
@Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean
playerController?: WDPlayerController
@State imgUrl: string = ''
//未开始
@State isWait: boolean = false
//已结束直播
@State isEnd: boolean = false
aboutToAppear(): void {
if (this.playerController) {
... ... @@ -24,6 +28,8 @@ export struct TopPlayComponent {
this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url
}
this.isWait = this.liveDetailsBean?.liveInfo?.liveState == 'wait'
this.isEnd = this.liveDetailsBean?.liveInfo?.liveState === 'end' &&
StringUtils.isEmpty(this.liveDetailsBean?.liveInfo?.vlive[0]?.replayUri)
if (!this.isWait && this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.vlive.length > 0) {
let playUrl = ''
if (this.liveDetailsBean.liveInfo.liveState == 'running') {
... ... @@ -31,8 +37,10 @@ export struct TopPlayComponent {
} else if (this.liveDetailsBean.liveInfo.liveState == 'end') {
playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri
}
this.playerController?.firstPlay(playUrl);
// this.playerController?.firstPlay('https://rmrbcmsonline.peopleapp.com/upload/rmh/video/mp4/202404/1713752415708fb81d0b8f137b.mp4');
if (StringUtils.isNotEmpty(playUrl)) {
this.playerController?.firstPlay(playUrl);
}
}
}
... ... @@ -48,10 +56,18 @@ export struct TopPlayComponent {
.visibility(this.isWait ? Visibility.None : Visibility.Visible)
Image(this.imgUrl)
.objectFit(ImageFit.Contain)
.visibility(this.isWait ? Visibility.Visible : Visibility.None)
.visibility(this.isWait || this.isEnd ? Visibility.Visible : Visibility.None)
.contrast(this.isEnd ? 0.2 : 1)
PlayUIComponent({ playerController: this.playerController })
Text('直播已结束')
.fontSize('20fp')
.fontWeight(500)
.fontColor(Color.White)
.visibility(this.isEnd ? Visibility.Visible :
Visibility.None)
}
.width('100%')
.alignSelf(ItemAlign.Center)
}
aboutToDisappear(): void {
... ...
... ... @@ -101,7 +101,7 @@ export struct VideoChannelDetail {
openFullScreen() {
WindowModel.shared.setWindowSystemBarProperties({
statusBarContentColor: '#ffffff',
statusBarColor: '#000000',
// statusBarColor: '#000000',
// navigationBarColor: '#000000',
// navigationBarContentColor: '#ffffff'
})
... ... @@ -116,7 +116,7 @@ export struct VideoChannelDetail {
closeFullScreen() {
WindowModel.shared.setWindowSystemBarProperties({
statusBarContentColor: '#000000',
statusBarColor: '#ffffff',
// statusBarColor: '#ffffff',
// navigationBarColor: '#0x66000000',
// navigationBarContentColor: '#0xE5FFFFFF'
... ...
... ... @@ -170,7 +170,7 @@ export struct PlayerRightView {
.width(58)
.position({ x: '100%', y: '100%' })
.markAnchor({ x: '100%', y: '100%' })
.padding({ bottom: 72, right: 10 })
.padding({ bottom: 0, right: 10 })
.visibility(this.isOpenDetail || this.isDragging ? Visibility.None : Visibility.Visible)
}
... ... @@ -229,7 +229,8 @@ export struct PlayerRightView {
}
} else if (this.likesStyle === 3) {
return {
url: this.newsStatusOfUser.likeStatus === '1' ? $r(`app.media.ic_candle_check`) : $r(`app.media.ic_candle_uncheck`),
url: this.newsStatusOfUser.likeStatus === '1' ? $r(`app.media.ic_candle_check`) :
$r(`app.media.ic_candle_uncheck`),
name: '默哀'
}
}
... ... @@ -239,13 +240,17 @@ export struct PlayerRightView {
}
transNum2String(name: 'likeNum' | 'collectNum' | 'commentNum') {
console.log(TAG, 'transNum2String', this.interactData.likeNum, this.interactData.collectNum, this.interactData.commentNum)
console.log(TAG, 'transNum2String', this.interactData.likeNum, this.interactData.collectNum,
this.interactData.commentNum)
if (name === 'likeNum') {
return this.interactData.likeNum != 0 ? NumberFormatterUtils.formatNumberWithWan(this.interactData.likeNum || '') : ''
return this.interactData.likeNum != 0 ?
NumberFormatterUtils.formatNumberWithWan(this.interactData.likeNum || '') : ''
} else if (name === 'collectNum') {
return this.interactData.collectNum != 0 ? NumberFormatterUtils.formatNumberWithWan(this.interactData.collectNum || '') : ''
return this.interactData.collectNum != 0 ?
NumberFormatterUtils.formatNumberWithWan(this.interactData.collectNum || '') : ''
} else {
return this.interactData.commentNum != 0 ? NumberFormatterUtils.formatNumberWithWan(this.interactData.commentNum || '') : ''
return this.interactData.commentNum != 0 ?
NumberFormatterUtils.formatNumberWithWan(this.interactData.commentNum || '') : ''
}
}
... ... @@ -282,7 +287,8 @@ export struct PlayerRightView {
@Builder
collectBuilderView() {
Column() {
Image(this.newsStatusOfUser.collectStatus == 1 ? $r(`app.media.ic_collect_check`) : $r(`app.media.ic_collect_uncheck`))
Image(this.newsStatusOfUser.collectStatus == 1 ? $r(`app.media.ic_collect_check`) :
$r(`app.media.ic_collect_uncheck`))
.width(32)
.aspectRatio(1)
.onClick(() => {
... ...
... ... @@ -25,7 +25,7 @@ export struct PlayerTitleComment {
name: this.getName(),
title: this.getTitle(),
summary: this.getSummary(),
isOpen: this.isOpen
isOpenDetail: this.isOpen
}),
autoCancel: false,
... ... @@ -164,9 +164,12 @@ export struct PlayerTitleComment {
step: 0.01,
// style: SliderStyle.OutSet
})
.blockColor(this.status === PlayerConstants.STATUS_START ? Color.Transparent : $r('app.color.play_block_color'))
.trackColor(this.status === PlayerConstants.STATUS_START ? $r('app.color.play_track_color') : $r('app.color.pause_track_color'))
.selectedColor(this.status === PlayerConstants.STATUS_START ? $r('app.color.play_selected_color') : $r('app.color.pause_selected_color'))
.blockColor(this.status === PlayerConstants.STATUS_START ? Color.Transparent :
$r('app.color.play_block_color'))
.trackColor(this.status === PlayerConstants.STATUS_START ? $r('app.color.play_track_color') :
$r('app.color.pause_track_color'))
.selectedColor(this.status === PlayerConstants.STATUS_START ? $r('app.color.play_selected_color') :
$r('app.color.pause_selected_color'))
.trackThickness(this.status === PlayerConstants.STATUS_START ? 1 : 4)
.blockStyle({
type: this.status === PlayerConstants.STATUS_START ? SliderBlockType.DEFAULT : SliderBlockType.IMAGE,
... ... @@ -202,7 +205,12 @@ export struct PlayerTitleComment {
.margin({ left: 12 })
}
.alignItems(VerticalAlign.Center)
.padding({ left: 16, right: 16, top: 11, bottom: 11 })
.padding({
left: 16,
right: 16,
top: 11,
bottom: 11
})
}
}
... ...
... ... @@ -47,7 +47,7 @@ export struct PlayerTitleView {
fontSize: 15,
fontWeight: 400,
lineHeight: 20,
constraintWidth: this.windowWidth - 100 - 16 - 22 + 'px',
constraintWidth: this.windowWidth - 150 - 16 - 22 + 'px',
})
this.titleHeight = info?.height as number || 0
... ... @@ -87,7 +87,12 @@ export struct PlayerTitleView {
*/
if (this.titleHeight > 200 || this.getSummary()) {
Text('查看详情 > ')
.padding({ left: 6, right: 6, top: 4, bottom: 4 })
.padding({
left: 6,
right: 6,
top: 4,
bottom: 4
})
.borderRadius(2)
.backgroundColor('#99636363')
.fontColor(Color.White)
... ... @@ -102,7 +107,7 @@ export struct PlayerTitleView {
}
}
.width(this.windowWidth - 100 + 'px')
.width(this.windowWidth - 150 + 'px')
.padding({ left: 16, right: 22 })
.alignItems(HorizontalAlign.Start)
.visibility(this.isOpenDetail || this.isDragging ? Visibility.None : Visibility.Visible)
... ...
... ... @@ -62,7 +62,7 @@ export class HWLocationUtils {
if (requestGrant) {
HWLocationUtils.getCurrentLocation()
} else {
PermissionUtils.openPermissionsInSystemSettings(context)
// PermissionUtils.openPermissionsInSystemSettings(context)
}
}
... ...
... ... @@ -2,11 +2,10 @@ import { Logger } from 'wdKit/src/main/ets/utils/Logger'
import { LoginInputComponent } from './LoginInputComponent'
import { LoginViewModel } from './LoginViewModel'
import router from '@ohos.router'
import promptAction from '@ohos.promptAction'
import { WDRouterRule, WDRouterPage } from 'wdRouter';
import { SettingPasswordParams } from './SettingPasswordLayout'
import { Router } from '@ohos.arkui.UIContext'
import { EmitterEventId, EmitterUtils, SPHelper, ToastUtils } from 'wdKit/Index'
import { CustomToast, EmitterEventId, EmitterUtils, SPHelper, ToastUtils } from 'wdKit/Index'
import { SpConstants } from 'wdConstant/Index'
import { emitter } from '@kit.BasicServicesKit'
... ... @@ -31,6 +30,18 @@ struct ForgetPasswordPage {
this.sendVerifyCode()
}
}
@State toastText:string = ""
dialogToast: CustomDialogController = new CustomDialogController({
builder: CustomToast({
msg: this.toastText,
}),
autoCancel: false,
alignment: DialogAlignment.Center,
offset: { dx: 0, dy: -20 },
gridCount: 1,
customStyle: true,
maskColor:"#00000000"
})
... ... @@ -100,11 +111,11 @@ struct ForgetPasswordPage {
if(this.pageType == 1){
this.loginViewModel.sendVerifyCodeByToken().then(()=>{
promptAction.showToast({ message: "已发送" })
this.showToastTip("已发送")
this.codeStateSuccess=true
this.isCodeSend=false
}).catch((message: string)=>{
promptAction.showToast({ message: message })
this.showToastTip(message)
this.codeStateSuccess=false
this.isCodeSend=false
})
... ... @@ -112,12 +123,12 @@ struct ForgetPasswordPage {
}
this.loginViewModel.sendVerifyCode(this.phoneContent).then((verifyCode) => {
promptAction.showToast({ message: "已发送" })
this.showToastTip("已发送")
this.codeStateSuccess=true
this.isCodeSend=false
Logger.debug(TAG, "sendVerifyCode: " + verifyCode)
}).catch((message: string)=>{
promptAction.showToast({ message: message })
this.showToastTip(message)
this.codeStateSuccess=false
this.isCodeSend=false
})
... ... @@ -146,7 +157,7 @@ struct ForgetPasswordPage {
}
WDRouterRule.jumpWithPage(WDRouterPage.settingPasswordPage, params)
}).catch((message: string)=>{
promptAction.showToast({ message: message })
this.showToastTip(message)
})
return
}
... ... @@ -159,10 +170,10 @@ struct ForgetPasswordPage {
}
WDRouterRule.jumpWithReplacePage(WDRouterPage.settingPasswordPage, params)
promptAction.showToast({message:"校验成功,准备跳转设置页面"})
this.showToastTip("校验成功,准备跳转设置页面")
Logger.debug(TAG,"校验成功")
}).catch((error:string)=>{
promptAction.showToast({message:error})
this.showToastTip(error)
Logger.debug(TAG,"校验失败")
})
}
... ... @@ -217,4 +228,9 @@ struct ForgetPasswordPage {
// 发送eventId为1的事件,事件内容为eventData
emitter.emit(event, eventData);
}
showToastTip(msg:string){
this.toastText = msg
this.dialogToast.open()
}
}
\ No newline at end of file
... ...
... ... @@ -22,13 +22,13 @@ export struct LoginInputComponent {
async aboutToAppear(){
if (this.pageType == 1) {
this.phoneContent = await SPHelper.default.get(SpConstants.USER_PHONE,"") as string;
Logger.debug("ddd")
}
}
@Builder
addCodeLayout() {
if (this.pageType == 1){
TextInput({ placeholder: this.securityPhone(this.phoneContent) })
.placeholderColor("#CCCCCC")
.fontSize(16)
.height(48)
.maxLength(11)
... ... @@ -47,9 +47,10 @@ export struct LoginInputComponent {
}
})
}else{
TextInput({ placeholder: "请输入手机号" })
TextInput({text: this.phoneContent, placeholder: "请输入手机号" })
.fontSize(16)
.height(48)
.placeholderColor("#CCCCCC")
.maxLength(11)
.margin({ top: 36 })
.backgroundColor("#F5F5F5")
... ... @@ -68,7 +69,8 @@ export struct LoginInputComponent {
Row() {
TextInput({ placeholder: "验证码" })
TextInput({ text: this.codeContent,placeholder: "验证码" })
.placeholderColor("#CCCCCC")
.layoutWeight(1)
.fontSize(16)
.height(48)
... ...
import { Logger, EmitterEventId, EmitterUtils, DateTimeUtils } from 'wdKit'
import { Logger, EmitterEventId, EmitterUtils, DateTimeUtils,CustomToast, StringUtils } from 'wdKit'
import { CustomProtocolDialog } from './CustomProtocolDialog'
import router from '@ohos.router'
import { LoginViewModel } from './LoginViewModel'
import { LoginInputComponent } from './LoginInputComponent'
import promptAction from '@ohos.promptAction'
import { ErrorToastUtils, SPHelper } from 'wdKit'
import { WDRouterPage } from 'wdRouter/src/main/ets/router/WDRouterPage';
import { WDRouterRule } from 'wdRouter/src/main/ets/router/WDRouterRule';
... ... @@ -39,14 +38,26 @@ struct LoginPage {
@State phoneContent: string = "" //手机号
@State codeContent: string = "" //验证码
@State protocolState: boolean = false //协议勾选状态
accountContent = '' //账号
passwordContent = ''
@State accountContent: string = '' //账号
@State passwordContent: string = ''
@State isSubmit: boolean = false
@State checkCodePage: boolean = true //判断是否是验证码页面 默认验证码登录
@State passwordSwitch: boolean = true //密码显示
// @State isPasswordSubmit: boolean = false //账户密码状态 是否出发登录
lastTime: number = 0
@State codeStateSuccess:boolean=false
@State toastText:string = ""
dialogToast: CustomDialogController = new CustomDialogController({
builder: CustomToast({
msg: this.toastText,
}),
autoCancel: false,
alignment: DialogAlignment.Center,
offset: { dx: 0, dy: -20 },
gridCount: 1,
customStyle: true,
maskColor:"#00000000"
})
dialogController: CustomDialogController = new CustomDialogController({
builder: CustomProtocolDialog({
... ... @@ -202,8 +213,9 @@ struct LoginPage {
@Builder
addPassword() {
Column() {
TextInput({ placeholder: "请输入账号", controller: this.phoneController })
TextInput({ text: this.accountContent,placeholder: "请输入账号", controller: this.phoneController })
.fontSize(16)
.placeholderColor("#CCCCCC")
.height(48)
.backgroundColor("#F5F5F5")
.borderRadius(4)
... ... @@ -243,6 +255,7 @@ struct LoginPage {
@Builder
addPasswordInputLayout() {
TextInput({ placeholder: "请输入密码", text: this.passwordContent })
.placeholderColor("#CCCCCC")
.layoutWeight(1)
.fontSize(16)
.height(48)
... ... @@ -299,8 +312,8 @@ struct LoginPage {
.size({ width: 20, height: 20 })
}.backgroundImage($r('app.media.login_other_right'), ImageRepeat.NoRepeat)
.otherStyle().onClick(() => {
this.updateAccount()
this.checkCodePage = !this.checkCodePage;
this.passwordContent = ''
this.passwordSwitch = true
this.isSubmit = false
})
... ... @@ -313,15 +326,29 @@ struct LoginPage {
}.width('100%').margin({ bottom: 40 })
}
updateAccount(){
if(this.checkCodePage){
//验证码切换 密码
if(StringUtils.photoMatch(this.phoneContent)){
this.accountContent = this.phoneContent
}
}else{
//密码切换 验证码
if(StringUtils.photoMatch(this.accountContent)){
this.phoneContent = this.accountContent
}
}
}
//发送验证码
sendVerifyCode() {
this.loginViewModel.sendVerifyCode(this.phoneContent).then((verifyCode) => {
promptAction.showToast({ message: "已发送" })
this.showToastTip("已发送")
Logger.debug(TAG, "sendVerifyCode: " + verifyCode)
this.codeStateSuccess=true
this.isCodeSend=false
}).catch((message:string)=>{
promptAction.showToast({ message: message })
this.showToastTip(message)
this.codeStateSuccess=false
this.isCodeSend=false
Logger.debug(TAG, "sendVerifyCode: " + message)
... ... @@ -339,12 +366,13 @@ struct LoginPage {
this.queryUserDetail()
EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION)
}).catch((error:string)=>{
promptAction.showToast({ message: error })
this.showToastTip(error)
})
} else {
this.loginViewModel.appLoginByPassword(this.accountContent, 0, this.passwordContent, "").then((data) => {
Logger.debug(TAG, "requestLogin: " + data.jwtToken)
promptAction.showToast({ message: '登录成功' })
this.showToastTip('登录成功')
///同步兴趣tag
let interestsModel = new InterestsHobbiesModel()
interestsModel.updateInterests()
... ... @@ -357,12 +385,17 @@ struct LoginPage {
// url: `${WDRouterPage.getBundleInfo()}`
// })
}).catch((value: string) => {
promptAction.showToast({ message: value })
this.showToastTip(value)
})
}
}
showToastTip(msg:string){
this.toastText = msg
this.dialogToast.open()
}
queryUserDetail(){
this.loginViewModel.queryUserDetail().then(()=>{
router.back({
... ... @@ -490,4 +523,4 @@ struct ProtocolComponent {
.backgroundColor('#66000000')
}
}
\ No newline at end of file
}
... ...
... ... @@ -16,11 +16,15 @@ struct LoginProtocolWebview {
privateProtocol = 'https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1001.html'
logoutProtocol = 'https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1003.html'
huaweiAuthProtocol = 'https://privacy.consumer.huawei.com/legal/id/authentication-terms.htm?code=CN&language=zh-CN'
@State contentID:string = "0"
async aboutToAppear() {
if (router.getParams()) {
let params = router.getParams() as Params
Logger.info(TAG, 'params.contentID:' + params.contentID);
if(params.contentID != undefined){
this.contentID = params.contentID
}
if (params.contentID == "1") { //"人民日报客户端网络服务使用协议"
this.webUrl = await SPHelper.default.get(SpConstants.NET_SERVICE_PROTOCOL, this.userProtocol) as string
this.webviewController.loadUrl(this.webUrl)
... ... @@ -71,6 +75,7 @@ struct LoginProtocolWebview {
Logger.info(TAG, 'onHttpErrorReceive event.request.getRequestUrl:' + event?.request.getRequestUrl());
Logger.info(TAG, 'onHttpErrorReceive event.response.getResponseCode:' + event?.response.getResponseCode());
})
.padding({bottom:this.contentID === "2" ? "40lpx" : 0 })
}
}
}
\ No newline at end of file
... ...
import ArrayList from '@ohos.util.ArrayList';
import promptAction from '@ohos.promptAction';
import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/Index';
import router from '@ohos.router';
import { LoginViewModel } from './LoginViewModel';
import { Logger, SPHelper, ToastUtils } from 'wdKit';
import { CustomToast, Logger, SPHelper, ToastUtils } from 'wdKit';
import {
SpConstants
} from '../../../../../../../commons/wdNetwork/oh_modules/wdConstant/src/main/ets/constants/SpConstants'
... ... @@ -58,6 +57,19 @@ export struct SettingPasswordLayout {
loginViewModel = new LoginViewModel()
pageType?:number; //0、登录->忘记密码 1、设置->重置密码 2、设置->更换手机
@State toastText:string = ""
dialogToast: CustomDialogController = new CustomDialogController({
builder: CustomToast({
msg: this.toastText,
}),
autoCancel: false,
alignment: DialogAlignment.Center,
offset: { dx: 0, dy: -20 },
gridCount: 1,
customStyle: true,
maskColor:"#00000000"
})
aboutToAppear() {
let params:SettingPasswordParams = router.getParams() as SettingPasswordParams;
this.pageId = parseInt(params.pageID);
... ... @@ -187,6 +199,7 @@ export struct SettingPasswordLayout {
Row() {
Row() {
TextInput({ placeholder: item.inputPlacholder })
.placeholderColor("#CCCCCC")
.type(InputType.Password)
.showPasswordIcon(true)
.backgroundColor('#00000000')
... ... @@ -194,7 +207,7 @@ export struct SettingPasswordLayout {
this.inputTextChange(value, item.inputTag)
})
.onSubmit((EnterKeyType) => {
promptAction.showToast({ message: 'submit' })
this.showToastTip('submit')
})
}
.alignItems(VerticalAlign.Center)
... ... @@ -213,12 +226,13 @@ export struct SettingPasswordLayout {
Row() {
Row() {
TextInput({ placeholder: item.inputPlacholder })
.placeholderColor("#CCCCCC")
.backgroundColor('#00000000')
.onChange((value: string) => {
this.inputTextChange(value, item.inputTag)
})
.onSubmit((EnterKeyType) => {
promptAction.showToast({ message: 'submit' })
this.showToastTip('submit')
})
}
.alignItems(VerticalAlign.Center)
... ... @@ -239,6 +253,7 @@ export struct SettingPasswordLayout {
Image($r('app.media.get_code_bg')).width('100%').borderRadius('4vp')
Row() {
TextInput({ placeholder: item.inputPlacholder })
.placeholderColor("#CCCCCC")
.backgroundColor('#00000000')
.width('67.28%')
.onChange((value: string) => {
... ... @@ -264,7 +279,7 @@ export struct SettingPasswordLayout {
Text(item.compDesc).fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'})
.onClick(()=>{
if (item.compDesc == '忘记密码') {
promptAction.showToast({ message: '密码不符合密码规范' })
this.showToastTip('密码不符合密码规范')
}
})
}
... ... @@ -307,11 +322,11 @@ export struct SettingPasswordLayout {
if (this.btnStatus) {
// 需要+手机号校验
if (this.password01.length < 6 || this.password01.length > 20) {
promptAction.showToast({ message: '密码不符合密码规范' })
this.showToastTip('密码不符合密码规范')
return
}
if (this.password01 != this.password02) {
promptAction.showToast({ message: '密码不一致' })
this.showToastTip('密码不一致')
return
}
if(this.pageId == 1){ //设置密码
... ... @@ -339,7 +354,6 @@ export struct SettingPasswordLayout {
Logger.error(TAG, 'catch err:' + JSON.stringify(err));
});
}
// promptAction.showToast({ message: '请求接口' })
}
... ... @@ -363,5 +377,10 @@ export struct SettingPasswordLayout {
}
}
}
showToastTip(msg:string){
this.toastText = msg
this.dialogToast.open()
}
}
... ...
/node_modules
/oh_modules
/.preview
/build
/.cxx
/.test
\ No newline at end of file
... ...
export { TrackingModule } from "./src/main/ets/TrackingModule"
export { ParamType } from "./src/main/ets/common/PublicParams"
export { TrackConstants } from "./src/main/ets/common/TrackConstants"
export { TrackParamConvert } from "./src/main/ets/common/TrackParamConvert"
export { Tracking } from "./src/main/ets/tracking/Tracking"
export { TrackingButton } from "./src/main/ets/tracking/TrackingButton"
export { TrackingContent } from "./src/main/ets/tracking/TrackingContent"
export { TrackingPageBrowse } from "./src/main/ets/tracking/TrackingPageBrowse"
export { TrackingPlay } from "./src/main/ets/tracking/TrackingPlay"
\ No newline at end of file
... ...
{
"apiType": "stageMode",
"buildOption": {
},
"buildOptionSet": [
{
"name": "release",
"arkOptions": {
"obfuscation": {
"ruleOptions": {
"enable": true,
"files": [
"./obfuscation-rules.txt"
]
}
}
},
},
],
"targets": [
{
"name": "default"
}
]
}
\ No newline at end of file
... ...
import { hspTasks } from '@ohos/hvigor-ohos-plugin';
export default {
system: hspTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
}
... ...
# Define project specific obfuscation rules here.
# You can include the obfuscation configuration files in the current module's build-profile.json5.
#
# For more details, see
# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md
# Obfuscation options:
# -disable-obfuscation: disable all obfuscations
# -enable-property-obfuscation: obfuscate the property names
# -enable-toplevel-obfuscation: obfuscate the names in the global scope
# -compact: remove unnecessary blank spaces and all line feeds
# -remove-log: remove all console.* statements
# -print-namecache: print the name cache that contains the mapping from the old names to new names
# -apply-namecache: reuse the given cache file
# Keep options:
# -keep-property-name: specifies property names that you want to keep
# -keep-global-name: specifies names that you want to keep in the global scope
\ No newline at end of file
... ...
../../../../oh_modules/.ohpm/@sensorsdata+analytics@0.0.2/oh_modules/@sensorsdata/analytics
\ No newline at end of file
../../wdBean
\ No newline at end of file
../../../commons/wdConstant
\ No newline at end of file
../../../commons/wdKit
\ No newline at end of file
../../../commons/wdNetwork
\ No newline at end of file
import sensors from '@sensorsdata/analytics';
import { common } from '@kit.AbilityKit';
import { HostEnum, HostManager } from 'wdNetwork/Index';
/// 统计埋点模块
export class TrackingModule {
private static SA_DATA_SERVER_URL_PRODUCT = "https://data.pdnews.cn/sa?project=PDChinese"
private static SA_DATA_SERVER_URL_TEST = "https://data.pdnews.cn/sa?project=PDChineseTest"
private static _init = false
static getHasInit() {
return TrackingModule._init;
}
/// 初始化
static startup(context: common.UIAbilityContext) : Promise<void> {
return new Promise((resolve) => {
const isOnlineEnv = HostManager.getHost() === HostEnum.HOST_PRODUCT
sensors.init({
//TODO: 服务器接收地址 暂时用测试环境的
server_url: isOnlineEnv ? TrackingModule.SA_DATA_SERVER_URL_TEST : TrackingModule.SA_DATA_SERVER_URL_TEST,
// Ability 上下文
context: context,
// 是否显示日志
show_log: true,
// 是否开启采集位置信息,需要 app 授权,默认 false
enable_track_location: true,
// 是否开启批量发送,默认 false
batch_send: true,
// 数据发送超时时间
datasend_timeout: 10000,
// 开启 App 打通 H5
app_js_bridge: false
}).then((inited) => {
TrackingModule._init = inited
resolve()
});
})
}
}
\ No newline at end of file
... ...
import { SpConstants } from 'wdConstant/Index';
import { AccountManagerUtils, AppUtils, DeviceUtil, SPHelper, StringUtils } from 'wdKit/Index';
import { HostEnum, HostManager } from 'wdNetwork/Index';
export type ParamType = Record<string, string | number | boolean | Array<string>>
export class PublicParams {
getPublicParams() : Promise<ParamType> {
return new Promise((resolve) => {
let pub: ParamType = {
"userName": SPHelper.default.getSync(SpConstants.USER_NAME, '') as string,
"pdUseId": SPHelper.default.getSync(SpConstants.USER_ID, '') as string,
"creatorId": SPHelper.default.getSync(SpConstants.USER_CREATOR_ID, '') as string,
"pdCnsBirthday": SPHelper.default.getSync(SpConstants.USER_BIRTHDAY, '') as string,
"city": PublicParams.getLocationCity(),
"sex":` ${SPHelper.default.getSync(SpConstants.USER_SEX, 0) as number}`,
"isSign": AccountManagerUtils.isLoginSync() ? "1" : "0",
"environment": PublicParams.getEnv(),
"os": AppUtils.getOSName(),
"actionTime": new Date().getTime() * 0.001,
"channel": AppUtils.getAppChannel(),
"version": AppUtils.getAppVersionName(),
"deviceId": DeviceUtil.clientId(),
"model": DeviceUtil.getMarketName() || "未知",
"mpaasId": PublicParams.getMpaasId(),
}
resolve(pub)
})
}
private static getEnv() {
switch (HostManager.getHost()) {
case HostEnum.HOST_UAT:
return "uat"
case HostEnum.HOST_SIT:
return "sit"
case HostEnum.HOST_PRODUCT:
return "prod"
case HostEnum.HOST_DEV:
return "dev"
default:
return "prod"
}
}
private static getLocationCity() {
let cityName = SPHelper.default.getSync(SpConstants.LOCATION_CITY_NAME, '') as string
if (StringUtils.isNotEmpty(cityName)) {
return encodeURI(cityName)
}
return ""
}
private static getMpaasId() {
// TODO: 新增mpaasId utdid
return 'alsjdflajxaljdlfjaldjfa';
}
}
... ...
export namespace TrackConstants {
export enum EventType {
Show = 0,
Click = 1
}
// 行为类型
export enum ActionType {
Show = "show", // 曝光/展示
DetailPageShow = "detailPageShow",
Collect = "collect",
CollectTag = "collectTag",
UnCollect = "uncollect",
Follow = "follow",
UnFollow = "unfollow",
Like = "like",
DisLike = "dislike",
Share = "share",
Comment = "comment",
Browse = "browse",
Download = "download",
Subscribe = "subscribe",
UnSubscribe = "unSubscribe",
CloseInterestCard = "closeInterestCard",
SelectInterestCard = "selectInterestCard",
}
// 分享聚道
export enum ShareChannelType {
Poster = "poster",
Wechat = "wechat",
Moments = "moments",
Sina = "sinaweibo",
Dingtalk = "dingTalk",
QQ = "qq",
Qzone = "qzone",
CopyLink = "copyLink",
}
// 专题类型
export enum SummaryType {
Live = "liveTopic",
Article = "articleTopic",
Audio = "audioTopic",
Talk = "talkTopic",
MorningAndEveningNews = "morningAndEveningNewsTopic",
TimeAxis = "timeAxisTopic"
}
// 直播类别
export enum LiveType {
Subscribe = "liveSubscribe",
Running = "livePlaying",
End = "liveEnd"
}
// 所属区域
export enum RegionName{
KaiPing = "0",
GuaJiao = "1",
Feed = "2",
CaiDan = "3",
}
// 页面名称或页面id。这里是不包含运营配置页面的pageid的
export enum PageName {
DynamicDetail = "dynamicDetailPage",
VideoDetail = "videoDetailPage",
Live_Detail = "liveDetailPage",
/// 音频详情页
Audio_Detail = "audioDetailPage",
/// 音频正文页
Audio_Detail_Text = "audioTextPage",
/// 图文详情页
Article_Detail = "articleDetailPage",
/// 图集详情页
Atlas_Detail = "atlasDetailPage",
///电子报页面
Eletronic_Paper = "newsPaperPage",
/// 金刚位详情
KeyPosition = "diamondDetailPage",
/// 问政详情页
Ask_Detail = "questionAnswerPage",
/// 专题详情页
Summary_Detail = "summaryDetailPage",
/// 搜索页
Search = "searchPage",
/// 我的
My = "myPage",
/// 设置页
Setting = "settingPage",
/// 账号管理
Account_Management = "accountManagementPage",
/// 注销账户
Cancel_Account = "cancelAccountPage",
/// 隐私设置
Privacy_Setting = "privacySettingPage",
/// 意见反馈
Feedback = "feedbackPage",
/// 关于
About = "aboutPage",
/// 编辑资料
Edit_Information = "editInformationPage",
/// 登录页
Login_Page = "loginPage",
/// 手机号登录
Phone_Login_Page = "phoneNumberLoginPage",
/// 我的评论
My_Comment = "myCommentPage",
///草稿箱
My_DraftBox = "draftBoxPage",
/// 我的关注
My_Follow = "myFollowPage",
/// 我的收藏
My_Collect = "myCollectPage",
/// 浏览历史
My_History = "myHistoryPage",
/// 消息
My_Notification = "myNotificationPage",
/// 我的预约
My_Saved_Live = "mySavedLivePage",
/// 兴趣选择
Preference_Selection = "preferenceSelectionPage",
/// 升级页面
Update = "updatePage",
/// 开屏广告页
Open_Screen = "openScreenPage",
/// 新手引导页
Guide = "guidePage",
/// 启动页
Launch = "launchPage",
/// 个人主页(主态)
Main_Personal = "mainPersonalPage",
/// 个人主页(客态)
Customer_Personal = "customerPersonalPage",
/// 个人资料页
Personal_Data = "personalDataPage",
/// H5下载页面
H5download = "H5DownloadPage",
/// 找回密码
Retrieve_Password = "retrievePasswordPage",
/// 重置密码
Reset_Password = "resetPasswordPage",
/// 一键登录
OneClick_Login = "oneClickLoginPage",
/// 二维码扫描
QR_Scan = "QRCodeLoginPage",
/// 绑定手机号
Bind_PhoneNum = "bindPhoneNumberPage",
/// 验证当前手机号
Checking_PhoneNum = "checkingPhoneNumberPage",
/// 更改手机号
Change_PhoneNum = "changePhoneNumberPage",
/// 设置密码
Setup_Passwd = "setPasswordPage",
/// 修改密码
Change_Passwd = "changePasswordPage",
/// 第三方账号绑定手机号
Third_Part_Account_Bind_PhoneNum = "bindingThirdNumberPage",
/// 实名认证
RealName_Authentication = "realNameAuthenticationPage",
/// 发布文章
Publish_Article = "publishArticlePage",
/// 发布视频
Publish_Video = "publishVideoPage",
/// 发布动态
Publish_Dynamic = "publishDynamicPage",
/// 发布图集
Publish_Atlas = "publishAtlasPage",
/// 举报评论
Report_Comment = "reportCommentsPage",
/// 优质评论
Best_Comment = "bestCommentsPage",
/// 举报内容
Report_Content = "reportContentPage",
///兴趣偏好页
Interest = "preferenceSelectionPage",
}
}
\ No newline at end of file
... ...
import { ContentDetailDTO } from 'wdBean/Index';
import { ParamType } from './PublicParams';
export class TrackParamConvert {
static convertContentDetail(detail: ContentDetailDTO) : ParamType {
let param: ParamType = {
"contentType": detail.newsType.toFixed(0),
"contentId": detail.newsId,
"contentName": detail.newsTitle
//TODO: 添加更多参数
}
TrackParamConvert.appendRecommend(detail, param)
return param
}
private static appendRecommend(detail: ContentDetailDTO, to: ParamType) {
to["sceneId"] = "9999"
to["subSceneId"] = ""
to["cnsTraceId"] = "selfHold"
to["itemId"] = ""
to["expIds"] = ""
/// 这里填写默认值,后续在分享处 再重写
to["shareChannel"] = ""
/// 这里填写默认值,后续在action=browse时,再重写
to["duration"] = 0
}
}
\ No newline at end of file
... ...
@Entry
@Component
struct Index {
@State message: string = 'Hello World';
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
... ...
import { Logger } from 'wdKit/Index';
import { TrackingModule } from '../TrackingModule';
import sensors from '@sensorsdata/analytics';
import { ParamType, PublicParams } from '../common/PublicParams';
import { HashMap } from '@kit.ArkTS';
import { TrackConstants } from '../common/TrackConstants';
const TAG = "WDTracking"
export class Tracking {
static event(eventId: string, params?: ParamType) {
if (!TrackingModule.getHasInit()) {
Logger.warn(TAG, "还没有初始化 " + eventId + " " + JSON.stringify(params))
return
}
//TODO: 添加运行单独线程?
let publicParams = new PublicParams()
publicParams.getPublicParams().then((pubParams) => {
if (params) {
for (const obj of Object.entries(params)) {
// Logger.info(TAG, ` ${obj[0]} => ` + `${obj[1]}`);
pubParams[obj[0]] = obj[1]
}
}
sensors.track(eventId, pubParams)
})
}
}
\ No newline at end of file
... ...
import { ParamType } from '../common/PublicParams';
import { Tracking } from './Tracking';
export class TrackingButton {
static click(buttonName: string, pageId: string, pageName: string, extParams?: ParamType) {
if (!extParams) {
extParams = {}
}
extParams["pageName"] = pageName
extParams["pageId"] = pageId
extParams["clickButtonName"] = buttonName
Tracking.event("name_click", extParams)
}
}
\ No newline at end of file
... ...
import { ParamType } from '../common/PublicParams'
import { TrackConstants } from "../common/TrackConstants"
export class TrackingContent {
/// 内容曝光/内容点击 事件
/// eventType 曝光 / 点击类型
/// pageName 如果是统一业务值 见 TrackConstants
/// pageId
/// extParams 模型转换成字段参数传值 转换方法见 TrackParamConvert
static common(eventType: TrackConstants.EventType, pageId: string, pageName: string, extParams: ParamType) {
}
static commonShare(shareType: number, pageId: string, pageName: string, extParams: ParamType) {
}
static like(like: boolean, pageId: string, pageName: string, extParams: ParamType) {
}
static collect(collect: boolean, pageId: string, pageName: string, extParams: ParamType) {
}
static follow(follow: boolean, followUserId: string, followUserName: string, pageId: string, pageName: string, extParams: ParamType) {
}
static commentClick(pageId: string, pageName: string, extParams: ParamType) {
}
static commentShare(pageId: string, pageName: string, extParams: ParamType) {
}
// 内容下载点击事件 1.图片 2.音频 3.视频
static download(donwloadContentType: number, pageId: string, pageName: string, extParams: ParamType) {
}
}
\ No newline at end of file
... ...
export class TrackingPageBrowse {
}
\ No newline at end of file
... ...
import { ParamType } from '../common/PublicParams';
/*
* 处理音频、视频、直播 正片播放、播放结束、播放错误等
* */
export class TrackingPlay {
// 视频
static videoPositivePlay(prepareTime: number, pageId: string, pageName: string, extParams: ParamType) {
}
static videoPlayEnd(currentPlayTime: number, totalTime: number, browseTime: number, pageId: string, pageName: string, extParams: ParamType) {
}
static videoPlayError(errorInfo: string, pageId: string, pageName: string, extParams: ParamType) {
}
// 音频
static audioPositivePlay(prepareTime: number, pageId: string, pageName: string, extParams: ParamType) {
}
static audioPlayEnd(currentPlayTime: number, totalTime: number, browseTime: number, pageId: string, pageName: string, extParams: ParamType) {
}
static audioPlayError(errorInfo: string, pageId: string, pageName: string, extParams: ParamType) {
}
// 直播
static liveVideoPositivePlay(prepareTime: number, pageId: string, pageName: string, extParams: ParamType) {
}
static liveVideoPlayEnd(currentPlayTime: number, totalTime: number, browseTime: number, pageId: string, pageName: string, extParams: ParamType) {
}
}
\ No newline at end of file
... ...
{
"module": {
"name": "wdTracking",
"type": "shared",
"description": "$string:shared_desc",
"deviceTypes": [
"phone",
"tablet",
"2in1"
],
"deliveryWithInstall": true,
"pages": "$profile:main_pages"
}
}
\ No newline at end of file
... ...
{
"color": [
{
"name": "white",
"value": "#FFFFFF"
}
]
}
\ No newline at end of file
... ...
{
"string": [
{
"name": "shared_desc",
"value": "埋点封装库"
}
]
}
\ No newline at end of file
... ...
import localUnitTest from './LocalUnit.test';
export default function testsuite() {
localUnitTest();
}
\ No newline at end of file
... ...
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
export default function localUnitTest() {
describe('localUnitTest',() => {
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
beforeAll(() => {
// Presets an action, which is performed only once before all test cases of the test suite start.
// This API supports only one parameter: preset action function.
});
beforeEach(() => {
// Presets an action, which is performed before each unit test case starts.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: preset action function.
});
afterEach(() => {
// Presets a clear action, which is performed after each unit test case ends.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: clear action function.
});
afterAll(() => {
// Presets a clear action, which is performed after all test cases of the test suite end.
// This API supports only one parameter: clear action function.
});
it('assertContain', 0, () => {
// Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
let a = 'abc';
let b = 'b';
// Defines a variety of assertion methods, which are used to declare expected boolean conditions.
expect(a).assertContain(b);
expect(a).assertEqual(a);
});
});
}
\ No newline at end of file
... ...
... ... @@ -17,6 +17,7 @@
"wdNetwork": "file:../../commons/wdNetwork",
"wdHwAbility": "file:../../features/wdHwAbility",
"wdJsBridge": "file:../../commons/wdJsBridge",
"wdLogin": "file:../../features/wdLogin"
"wdLogin": "file:../../features/wdLogin",
"wdTracking": "file:../../features/wdTracking"
}
}
... ...
... ... @@ -12,6 +12,7 @@ import {
NetworkType,
SPHelper,
StringUtils,
UmengStats,
WindowModel
} from 'wdKit';
import { HostEnum, HostManager, WDHttp } from 'wdNetwork';
... ... @@ -21,6 +22,7 @@ import { WDPushNotificationManager } from 'wdHwAbility/Index';
export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
UmengStats.preInit(this.context)
SPHelper.init(this.context);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
registerRouter();
... ...
... ... @@ -68,7 +68,7 @@ struct LaunchInterestsHobbiesPage {
Stack(){
Column({}){
Text(item.name)
.fontSize('35lpx')
.fontSize(18)
.fontColor('#FFFFFF')
.margin({top:'21lpx',left:'19lpx'})
.width('100%')
... ... @@ -140,7 +140,7 @@ struct LaunchInterestsHobbiesPage {
promptAction.showToast({
message : '请先选择您感兴趣的内容哦',
duration: 2000,
bottom: 50
bottom: '50%'
})
return
}
... ...
... ... @@ -11,8 +11,9 @@ import { WDRouterPage } from 'wdRouter';
import { LaunchModel } from '../viewModel/LaunchModel'
import { LaunchPageModel } from '../viewModel/LaunchPageModel'
import LaunchDataModel from '../viewModel/LaunchDataModel'
import { Logger, SPHelper } from 'wdKit/Index';
import { Logger, SPHelper, UmengStats } from 'wdKit/Index';
import { SpConstants } from 'wdConstant/Index';
import { TrackingModule } from 'wdTracking/Index'
@Entry
@Component
... ... @@ -44,6 +45,8 @@ struct LaunchPage {
}
onConfirm() {
UmengStats.initAfterAgreeProtocol()
TrackingModule.startup(getContext(this) as common.UIAbilityContext)
// Save privacy agreement status.
this.saveIsPrivacy();
//跳转引导页
... ... @@ -94,6 +97,10 @@ struct LaunchPage {
this.dialogController.open();
// }
} else {
UmengStats.initAfterAgreeProtocol()
TrackingModule.startup(getContext(this) as common.UIAbilityContext)
//需要根据请求数据判断是否需要进入广告页,广告数据为nil则直接跳转到首页
//获取本地存储的启动页数据
... ...