liyubing

Merge remote-tracking branch 'origin/main'

... ... @@ -85,8 +85,8 @@ export default struct CustomLayout {
name: this.animateName,
path: "lottie/refresh_step1.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径
})
this.animateItem.goToAndStop(1)
}
this.animateItem.goToAndStop(1)
let total = CustomLayout.REFRESH_HEIGHT
let progress = offset * 100 / total
this.animateItem?.goToAndStop(this.getFramesByProgress(progress), true);
... ... @@ -103,9 +103,6 @@ export default struct CustomLayout {
path: "lottie/refresh_step2.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径
})
}
// this.animateItem2.isLoaded
// TODO 是否拦截重复触发
this.animateItem2.goToAndPlay(1)
}
getFramesByProgress(progress: number): number {
... ...
... ... @@ -18,14 +18,18 @@ export struct CustomPullToRefresh {
.setAnimDuration(500);
private refreshSettings: RenderingContextSettings = new RenderingContextSettings(true)
private refreshContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.refreshSettings)
private refreshingSettings: RenderingContextSettings = new RenderingContextSettings(true)
private refreshingContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.refreshingSettings)
private loadMoreSettings: RenderingContextSettings = new RenderingContextSettings(true)
private loadMoreContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.loadMoreSettings)
private refreshAnimation: AnimationItem | null = null;
private refreshingAnimation: AnimationItem | null = null;
private loadMoreAnimation: AnimationItem | null = null;
private refreshAnimName: string = "refresh";
private refreshingAnimName: string = "refreshing";
private loadMoreAnimName: string = "loadMore";
private refreshAnimationDestroy = true
private refreshingAnimationDestroy = true
// refresh-1,refreshing-2,refreshed-3,idle-4
@State @Watch('stateChange') private refreshState: number = 4;
... ... @@ -120,9 +124,23 @@ export struct CustomPullToRefresh {
})
.onDisAppear(() => {
lottie.destroy(this.refreshAnimName);
})
.visibility(this.refreshState == 1 ? Visibility.Visible : Visibility.Hidden)
Canvas(this.refreshingContext)
.width(60)
.height(60)
.backgroundColor(Color.Transparent)
.onReady(() => {
// 可在此生命回调周期中加载动画,可以保证动画尺寸正确
//抗锯齿的设置
this.refreshContext.imageSmoothingEnabled = true;
this.refreshContext.imageSmoothingQuality = 'medium'
})
.onDisAppear(() => {
lottie.destroy(this.refreshingAnimName);
})
.visibility((this.refreshState == 1 || this.refreshState == 2) ? Visibility.Visible : Visibility.Hidden)
.visibility(this.refreshState == 2 ? Visibility.Visible : Visibility.Hidden)
Text('已更新至最新')
.fontSize(14)
... ... @@ -175,10 +193,7 @@ export struct CustomPullToRefresh {
}
private refreshAnim(percent: number) {
if (this.refreshAnimation == null || this.refreshAnimation.name != this.refreshAnimName ||
this.refreshAnimationDestroy) {
this.refreshAnimation?.destroy(this.refreshAnimName)
this.refreshAnimation?.destroy(this.refreshingAnimName)
if (this.refreshAnimation == null || this.refreshAnimationDestroy) {
this.refreshAnimation = lottie.loadAnimation({
container: this.refreshContext,
renderer: 'canvas', // canvas 渲染模式
... ... @@ -212,21 +227,19 @@ export struct CustomPullToRefresh {
}
private refreshingAnim() {
// Logger.error('zzzz', 'animate2, 1')
// 先销毁之前的动画
if (this.refreshAnimation == null || this.refreshAnimation.name != this.refreshingAnimName ||
this.refreshAnimationDestroy) {
this.refreshAnimation?.destroy(this.refreshAnimName)
this.refreshAnimation?.destroy(this.refreshingAnimName)
this.refreshAnimation = lottie.loadAnimation({
container: this.refreshContext,
if (this.refreshingAnimation == null || this.refreshingAnimationDestroy) {
this.refreshingAnimation?.destroy(this.refreshingAnimName)
this.refreshingAnimation = lottie.loadAnimation({
container: this.refreshingContext,
renderer: 'canvas', // canvas 渲染模式
loop: 10,
autoplay: true,
name: this.refreshingAnimName,
path: "lottie/refresh_step2.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径
})
this.addRefreshAnimListener()
this.refreshingAnimationDestroy = false
this.addRefreshingAnimListener()
}
// Logger.error('zzzz', 'animate2, 2')
}
... ... @@ -242,6 +255,13 @@ export struct CustomPullToRefresh {
});
}
private addRefreshingAnimListener() {
this.refreshingAnimation?.addEventListener('destroy', (args: Object): void => {
// Logger.error('zzzz', "lottie destroy");
this.refreshingAnimationDestroy = true
});
}
loadMoreAnimate() {
if (this.loadMoreAnimation == null) {
this.loadMoreAnimation = lottie.loadAnimation({
... ...
... ... @@ -66,31 +66,31 @@ export struct SearchComponent {
this.breakpointSystem.unregister();
}
getRelatedSearchContent() {
if (StringUtils.isNotEmpty(this.searchText)) {
SearcherAboutDataModel.getRelatedSearchContentData(encodeURI(this.searchText), getContext(this)).then((value) => {
getRelatedSearchContent(searchText: string) {
if (StringUtils.isNotEmpty(searchText)) {
SearcherAboutDataModel.getRelatedSearchContentData(encodeURI(searchText), getContext(this)).then((value) => {
if (value != null && value.length > 0) {
this.relatedSearchContentsData = []
value.forEach(item => {
let tempValue: string = item
let tempArr: string[] = []
if (tempValue.indexOf(this.searchText) === -1) {
if (tempValue.indexOf(searchText) === -1) {
tempArr.push(item)
this.relatedSearchContentsData.push(new SearchRelatedItem(item, tempArr))
} else {
while (tempValue.indexOf(this.searchText) != -1) {
let index = tempValue.indexOf(this.searchText)
while (tempValue.indexOf(searchText) != -1) {
let index = tempValue.indexOf(searchText)
if (index === 0) {
try {
tempArr.push(this.searchText)
tempValue = tempValue.substring(this.searchText.length, tempValue.length)
tempArr.push(searchText)
tempValue = tempValue.substring(searchText.length, tempValue.length)
} catch (e) {
}
} else {
try {
tempArr.push(tempValue.substring(0, index))
tempArr.push(this.searchText)
tempValue = tempValue.substring(index + this.searchText.length, tempValue.length)
tempArr.push(searchText)
tempValue = tempValue.substring(index + searchText.length, tempValue.length)
} catch (e) {
}
}
... ... @@ -356,7 +356,7 @@ export struct SearchComponent {
this.resetSearch()
} else {
if (this.hasInputContent) {
this.getRelatedSearchContent()
this.getRelatedSearchContent(value)
}
}
})
... ...
... ... @@ -36,6 +36,7 @@ struct GuidePages {
ChildItem(index: number) {
RelativeContainer() {
Image(this.guideImage[index])
.objectFit(ImageFit.Contain)
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom }
... ...
... ... @@ -91,11 +91,11 @@ struct LaunchAdvertisingPage {
Text('广告')
.fontColor(Color.White)
.textAlign(TextAlign.Center)
.fontSize('24lpx')
.width('72lpx')
.height('36lpx')
.fontSize(12)
.width(36)
.height(18)
.borderRadius(2)
.margin({top:'15lpx',left:'19lpx'})
.margin({top:'8px',left:'10px'})
.backgroundColor('#80000000')
.margin({left:16})
}
... ... @@ -104,13 +104,13 @@ struct LaunchAdvertisingPage {
Button(){
Text(this.time + 's 跳过')
.fontSize('27lpx')
.fontSize(14)
.fontColor(Color.White)
.margin({left:'28lpx',right:'28lpx'})
.margin({left:14,right:14})
}
.width('148lpx')
.height('56lpx')
.margin({top:'10lpx',right:'19lpx'})
.width(74)
.height(28)
.margin({top:5,right:10})
.backgroundColor('#80000000')
.onClick(() => {
this.trackingLaunchJumpOver()
... ... @@ -125,21 +125,21 @@ struct LaunchAdvertisingPage {
Button(){
Row(){
Text(this.defaultModel.isAd == '1'?'点击跳转至详情或第三方应用':'点击跳转至详情')
.fontSize('31lpx')
.fontSize(16)
.fontColor(Color.White)
.margin({
left:'55lpx'
left:28
})
Image($r('app.media.Slice'))
.width('46lpx')
.height('46lpx')
.margin({right:'55lpx'})
.width(28)
.height(23)
.margin({right:28})
}.alignItems(VerticalAlign.Center)
}
.width('566lpx')
.height('111lpx')
.width(284)
.height(56)
.margin({
bottom: '51lpx'
bottom: 26
})
.borderWidth(1)
.borderColor(Color.White)
... ... @@ -151,8 +151,8 @@ struct LaunchAdvertisingPage {
if(this.defaultModel.screenType == '1') {
Column(){
Image($r('app.media.LaunchPage_logo'))
.width('278lpx')
.height('154lpx')
.width(140)
.height(77)
.margin({top:20})
}.width('100%').height('16%').backgroundColor(Color.White)
// .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
... ...
... ... @@ -40,11 +40,11 @@ struct LaunchInterestsHobbiesPage {
Row(){
Blank()
Text('跳过')
.fontSize('27lpx')
.fontSize(14)
.fontColor('#333333')
.width('54lpx')
.height('35lpx')
.margin({top:'30lpx',right:'46lpx'})
.width(30)
.height(18)
.margin({top:15,right:23})
.onClick(()=>{
//直接跳过到首页
//跳转首页
... ... @@ -58,20 +58,20 @@ struct LaunchInterestsHobbiesPage {
.justifyContent(FlexAlign.End)
Text('选择感兴趣的内容')
.fontSize('46lpx')
.fontSize(23)
.fontWeight(FontWeight.Bold)
.textAlign(TextAlign.Center)
.fontColor('#333333')
.width('100%')
.height('61lpx')
.margin({top:'54lpx'})
.height(30)
.margin({top:27})
Text('完善信息,将为您推荐个性化的内容')
.fontSize('27lpx')
.fontSize(14)
.textAlign(TextAlign.Center)
.fontColor('#9E9E9E')
.width('100%')
.height('35lpx')
.margin({top:'12lpx'})
.height(17)
.margin({top:6})
if(!this.isConnectNetwork){
EmptyComponent({ emptyType: 1,emptyHeight:"60%" ,retry: () => {
... ... @@ -141,39 +141,36 @@ struct LaunchInterestsHobbiesPage {
})
}
.width('90%')
.margin({top:'61lpx',bottom:'300lpx'})
.margin({top:30,bottom:150})
.columnsTemplate('1fr 1fr 1fr')
.columnsGap('23lpx')
.rowsGap('23lpx')
.scrollBar(BarState.Off)
}
}
.width('100%')
.height('100%')
}
.width('100%')
.height(`calc(100% - ${158 + 'lpx'})`)
// .backgroundColor(Color.Red)
.height(`calc(100% - ${260 + 'px'})`)
Stack({alignContent:Alignment.Center}){
Button(this.selectCount == 0?'选好了':'选好了(' + this.selectCount + ')')
.fontSize('35lpx')
.fontSize(18)
.fontColor('#FFFFFF')
.backgroundColor('#ED2800')
.type(ButtonType.Normal)
.borderRadius('10lpx')
.width('662lpx')
.height('84lpx')
.margin({top:'10lpx'})
.borderRadius(5)
.width(320)
.height(44)
.margin({top:5})
Image('')
.width('662lpx')
.height('84lpx')
.margin({top:'10lpx'})
.width(320)
.height(44)
.margin({top:5})
.backgroundColor(Color.White)
.opacity(this.selectCount == 0 ? 0.6 : 0)
.borderRadius('10lpx')
.borderRadius(5)
.onClick(()=>{
if (this.selectCount == 0) {
this.dialogToast.open()
... ... @@ -188,8 +185,8 @@ struct LaunchInterestsHobbiesPage {
})
}
.width('100%')
.height('108lpx')
.margin({top:0})
.height(54)
.margin({top:5})
// .backgroundColor(Color.Orange)
}
.width('100%')
... ...
... ... @@ -166,10 +166,10 @@ struct LaunchPage {
Stack({alignContent:Alignment.Bottom}){
Image($r('app.media.LaunchPage_logo'))
.width('278lpx')
.height('154lpx')
.width(139)
.height(87)
.margin({
bottom:'48lpx'
bottom:24
})
}
... ...