dev #63
							
								
								
									
										
											BIN
										
									
								
								entry/src/main/ets/.DS_Store
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								entry/src/main/ets/.DS_Store
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							@ -40,9 +40,8 @@ export default async function request(req: any) {
 | 
				
			|||||||
    try {
 | 
					    try {
 | 
				
			||||||
        let baseUrl=host?host:globalThis.host
 | 
					        let baseUrl=host?host:globalThis.host
 | 
				
			||||||
        // let baseUrl=host?config.csptHost:config.host'
 | 
					        // let baseUrl=host?config.csptHost:config.host'
 | 
				
			||||||
 | 
					        console.log('optionsoptions',JSON.stringify(data).length)
 | 
				
			||||||
        console.log('响应头地址' + baseUrl,url)
 | 
					        console.log('响应头地址' + baseUrl,url)
 | 
				
			||||||
 | 
					 | 
				
			||||||
        const {result,responseCode} = await httpRequest.request(`${baseUrl}${url}${paramsStr}`, options);
 | 
					        const {result,responseCode} = await httpRequest.request(`${baseUrl}${url}${paramsStr}`, options);
 | 
				
			||||||
        // fileUtil.editFile(`${folderPath}/request.txt`, JSON.stringify(arrList))
 | 
					        // fileUtil.editFile(`${folderPath}/request.txt`, JSON.stringify(arrList))
 | 
				
			||||||
        // writeLog({
 | 
					        // writeLog({
 | 
				
			||||||
 | 
				
			|||||||
@ -5,6 +5,7 @@ import Md5 from '../common/utils/md5';
 | 
				
			|||||||
import promptAction from '@ohos.promptAction';
 | 
					import promptAction from '@ohos.promptAction';
 | 
				
			||||||
import errorMsgDialog from './compontents/errorMsgDialog'
 | 
					import errorMsgDialog from './compontents/errorMsgDialog'
 | 
				
			||||||
import { voiceService } from '../common/service/voiceService';
 | 
					import { voiceService } from '../common/service/voiceService';
 | 
				
			||||||
 | 
					import imageBtn from './compontents/imageBtn'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Entry
 | 
					@Entry
 | 
				
			||||||
@Component
 | 
					@Component
 | 
				
			||||||
@ -72,7 +73,8 @@ export default struct Index {
 | 
				
			|||||||
            alignContent: FlexAlign.SpaceAround }) {
 | 
					            alignContent: FlexAlign.SpaceAround }) {
 | 
				
			||||||
            ForEach(this.imgArr1, (item: Resource, index: number) => {
 | 
					            ForEach(this.imgArr1, (item: Resource, index: number) => {
 | 
				
			||||||
              if (index === this.imgArr1.length - 1) {
 | 
					              if (index === this.imgArr1.length - 1) {
 | 
				
			||||||
                Image(item).width('38%').height('24%').onClick(() => {
 | 
					                imageBtn({btnWidth:'38%',btnHeight:'24%',imgSrc:item})
 | 
				
			||||||
 | 
					                .onClick(() => {
 | 
				
			||||||
                  if (this.inputTextArr[0].trim() == '' || this.inputTextArr[1].trim() == '') {
 | 
					                  if (this.inputTextArr[0].trim() == '' || this.inputTextArr[1].trim() == '') {
 | 
				
			||||||
                    promptAction.showToast({
 | 
					                    promptAction.showToast({
 | 
				
			||||||
                      message: '请输入用户名和密码',
 | 
					                      message: '请输入用户名和密码',
 | 
				
			||||||
 | 
				
			|||||||
@ -21,6 +21,7 @@ import GetDistance from '../common/utils/GetDistance'
 | 
				
			|||||||
import UdpEvent from '../common/utils/UdpEvent'
 | 
					import UdpEvent from '../common/utils/UdpEvent'
 | 
				
			||||||
import UIAbility from '@ohos.app.ability.UIAbility';
 | 
					import UIAbility from '@ohos.app.ability.UIAbility';
 | 
				
			||||||
import { endRecordVideo, getUserAlbumItemByDisplayName, saveStartRecordVideo } from '../common/service/videoService';
 | 
					import { endRecordVideo, getUserAlbumItemByDisplayName, saveStartRecordVideo } from '../common/service/videoService';
 | 
				
			||||||
 | 
					import imageBtn from './compontents/imageBtn'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
 | 
					// import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -106,9 +107,7 @@ struct Index {
 | 
				
			|||||||
      Column() {
 | 
					      Column() {
 | 
				
			||||||
        Row() {
 | 
					        Row() {
 | 
				
			||||||
          if (!this.isSingle) {
 | 
					          if (!this.isSingle) {
 | 
				
			||||||
            Image($r('app.media.index_lw'))
 | 
					            imageBtn({btnWidth:'28%',btnHeight:'71%',imgSrc:$r('app.media.index_lw')})
 | 
				
			||||||
              .width('28%')
 | 
					 | 
				
			||||||
              .height('71%')
 | 
					 | 
				
			||||||
              .margin({ left: 80 * globalThis.ratio })
 | 
					              .margin({ left: 80 * globalThis.ratio })
 | 
				
			||||||
              .onClick(async () => {
 | 
					              .onClick(async () => {
 | 
				
			||||||
                // this.vocObj.playAudio({
 | 
					                // this.vocObj.playAudio({
 | 
				
			||||||
@ -153,9 +152,7 @@ struct Index {
 | 
				
			|||||||
              })
 | 
					              })
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          if (this.isSingle) {
 | 
					          if (this.isSingle) {
 | 
				
			||||||
            Image($r('app.media.index_dj'))
 | 
					            imageBtn({btnWidth:'28%',btnHeight:'71%',imgSrc:$r('app.media.index_dj')})
 | 
				
			||||||
              .width('28%')
 | 
					 | 
				
			||||||
              .height('71%')
 | 
					 | 
				
			||||||
              .margin({ left: 80 * globalThis.ratio })
 | 
					              .margin({ left: 80 * globalThis.ratio })
 | 
				
			||||||
              .onClick(() => {
 | 
					              .onClick(() => {
 | 
				
			||||||
                if (this.loading) {
 | 
					                if (this.loading) {
 | 
				
			||||||
@ -184,9 +181,7 @@ struct Index {
 | 
				
			|||||||
                });
 | 
					                });
 | 
				
			||||||
              })
 | 
					              })
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          Image($r('app.media.index_zj'))
 | 
					          imageBtn({btnWidth:'28%',btnHeight:'71%',imgSrc:$r('app.media.index_zj')})
 | 
				
			||||||
            .width('28%')
 | 
					 | 
				
			||||||
            .height('71%')
 | 
					 | 
				
			||||||
            .margin({ right: 80 * globalThis.ratio })
 | 
					            .margin({ right: 80 * globalThis.ratio })
 | 
				
			||||||
            .onClick(() => {
 | 
					            .onClick(() => {
 | 
				
			||||||
              if (this.loading) {
 | 
					              if (this.loading) {
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
import router from '@ohos.router';
 | 
					import router from '@ohos.router';
 | 
				
			||||||
import { getCurrentTime } from '../../common/service/timeService';
 | 
					import { getCurrentTime } from '../../common/service/timeService';
 | 
				
			||||||
import { voiceService } from '../../common/service/voiceService';
 | 
					import { voiceService } from '../../common/service/voiceService';
 | 
				
			||||||
 | 
					import imageBtn from '../compontents/imageBtn'
 | 
				
			||||||
@Component
 | 
					@Component
 | 
				
			||||||
export default struct TopLogo {
 | 
					export default struct TopLogo {
 | 
				
			||||||
  @State ratio: number = 850 / 960
 | 
					  @State ratio: number = 850 / 960
 | 
				
			||||||
@ -33,15 +33,14 @@ export default struct TopLogo {
 | 
				
			|||||||
            .fontColor('#CCB48F')
 | 
					            .fontColor('#CCB48F')
 | 
				
			||||||
            .margin({ top: -15 * this.ratio, left: 14 * this.ratio }) //fontsize40
 | 
					            .margin({ top: -15 * this.ratio, left: 14 * this.ratio }) //fontsize40
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        imageBtn({btnWidth:'16.7%',btnHeight:'12.2%',imgSrc:$r('app.media.topB_back')})
 | 
				
			||||||
        Image($r('app.media.topB_back')).width('16.7%').height('12.2%')
 | 
					 | 
				
			||||||
          .onClick(() => {
 | 
					          .onClick(() => {
 | 
				
			||||||
            this.vocObj.playAudio({
 | 
					            this.vocObj.playAudio({
 | 
				
			||||||
              type: 1,
 | 
					              type: 1,
 | 
				
			||||||
              name: 'button_media.wav'
 | 
					              name: 'button_media.wav'
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
            router.back()
 | 
					 | 
				
			||||||
            this.outFlag = true
 | 
					            this.outFlag = true
 | 
				
			||||||
 | 
					            router.back()
 | 
				
			||||||
          })
 | 
					          })
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      .position({ x: 0, y: 0 })
 | 
					      .position({ x: 0, y: 0 })
 | 
				
			||||||
@ -71,3 +70,4 @@ export default struct TopLogo {
 | 
				
			|||||||
    console.log('jiangsong: topLogo aboutToDisappear222222222')
 | 
					    console.log('jiangsong: topLogo aboutToDisappear222222222')
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										75
									
								
								entry/src/main/ets/pages/compontents/imageBtn.ets
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										75
									
								
								entry/src/main/ets/pages/compontents/imageBtn.ets
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,75 @@
 | 
				
			|||||||
 | 
					@Component
 | 
				
			||||||
 | 
					export default struct imageBtn {
 | 
				
			||||||
 | 
					  //状态变量unPressed,用于控制按钮的状态
 | 
				
			||||||
 | 
					  @State unPressed: boolean = true
 | 
				
			||||||
 | 
					  btnWidth: string
 | 
				
			||||||
 | 
					  btnHeight: string
 | 
				
			||||||
 | 
					  imgSrc:Resource
 | 
				
			||||||
 | 
					  opacityNum:number=1
 | 
				
			||||||
 | 
					  @Styles customStyle(){
 | 
				
			||||||
 | 
					    .width('100%')
 | 
				
			||||||
 | 
					    .height('100%')
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  build() {
 | 
				
			||||||
 | 
					    Column() {
 | 
				
			||||||
 | 
					      Column() {
 | 
				
			||||||
 | 
					        Stack() {
 | 
				
			||||||
 | 
					          // Image($r('app.media.topB_back'))
 | 
				
			||||||
 | 
					          Row() {
 | 
				
			||||||
 | 
					            // 判断当前组件为放开状态
 | 
				
			||||||
 | 
					            if (this.unPressed) {
 | 
				
			||||||
 | 
					              // 插入Row组件,配置过渡效果
 | 
				
			||||||
 | 
					              Image(this.imgSrc)
 | 
				
			||||||
 | 
					                // 水波纹扩散动画:Row组件backgroundColor属性变更(#fff -> #ccc),系统插入动画过渡效果,从组建的中心点开始放大,scale{0,0}变更scale{1,1}
 | 
				
			||||||
 | 
					                .transition({
 | 
				
			||||||
 | 
					                  type: TransitionType.Insert,
 | 
				
			||||||
 | 
					                  opacity: 0,
 | 
				
			||||||
 | 
					                })
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            // 判断当前组件为按下状态
 | 
				
			||||||
 | 
					            else if (!this.unPressed) {
 | 
				
			||||||
 | 
					              // 插入Row组件,配置过渡效果
 | 
				
			||||||
 | 
					              Image(this.imgSrc)
 | 
				
			||||||
 | 
					                .opacity(this.opacityNum)
 | 
				
			||||||
 | 
					                .onAppear(() => {
 | 
				
			||||||
 | 
					                  // 水波纹聚拢动画:Row组件backgroundColor属性变更(#ccc -> #fff),插入动画过渡效果,scale{1,1}变化为scale{0,0}
 | 
				
			||||||
 | 
					                  animateTo({
 | 
				
			||||||
 | 
					                    duration: 500,
 | 
				
			||||||
 | 
					                    // 聚拢动画播放完成后,需要衔接扩散动画,此时Row组件backgroundColor属性变更(#fff -> #ccc),插入动画过渡效果,scale{0,0}变化为scale{1,1}
 | 
				
			||||||
 | 
					                    onFinish: () => {
 | 
				
			||||||
 | 
					                      this.opacityNum=1
 | 
				
			||||||
 | 
					                    } },
 | 
				
			||||||
 | 
					                    () => {
 | 
				
			||||||
 | 
					                      this.opacityNum=0.2
 | 
				
			||||||
 | 
					                    })
 | 
				
			||||||
 | 
					                })
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            // 其他状态
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					          .justifyContent(FlexAlign.Center)
 | 
				
			||||||
 | 
					          .alignItems(VerticalAlign.Center)
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        .customStyle()
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      .width(this.btnWidth)
 | 
				
			||||||
 | 
					      .height(this.btnHeight)
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    // onTouch事件,监听状态
 | 
				
			||||||
 | 
					    .onTouch((event: TouchEvent) => {
 | 
				
			||||||
 | 
					      // 当按钮按下时,更新按钮的状态(unPressed:true -> false)
 | 
				
			||||||
 | 
					      if (event.type == TouchType.Down) {
 | 
				
			||||||
 | 
					        animateTo({ duration: 400 }, () => {
 | 
				
			||||||
 | 
					          this.unPressed = !this.unPressed
 | 
				
			||||||
 | 
					        })
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      // 当按钮放开时,更新按钮的状态(unPressed:false -> true)
 | 
				
			||||||
 | 
					      if (event.type == TouchType.Up) {
 | 
				
			||||||
 | 
					        animateTo({ duration: 400 }, () => {
 | 
				
			||||||
 | 
					          this.unPressed = !this.unPressed
 | 
				
			||||||
 | 
					        })
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user