Compare commits
2 Commits
9a618adeff
...
f61ec2bc2e
| Author | SHA1 | Date | |
|---|---|---|---|
| f61ec2bc2e | |||
| 05f31c4b7c |
68
entry/src/main/ets/common/constants/USERLIST.ts
Normal file
68
entry/src/main/ets/common/constants/USERLIST.ts
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||||
|
* Licensed under the Apache License,Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export default class
|
||||||
|
CommonConstants {
|
||||||
|
/**
|
||||||
|
* Rdb database config.
|
||||||
|
*/
|
||||||
|
static readonly STORE_CONFIG = { name: 'USERLIST.db' };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Account table config.
|
||||||
|
*/
|
||||||
|
static readonly ACCOUNT_TABLE = {
|
||||||
|
tableName: 'USERLIST',
|
||||||
|
sqlCreate: 'CREATE TABLE IF NOT EXISTS USERLIST(id TEXT,sfzmhm TEXT,xm CHAR(20), lsh TEXT, kszp TEXT,ksdd TEXT,kssycs TEXT,kslx TEXT,kscx TEXT,ksxl TEXT,ksy1 TEXT)',
|
||||||
|
columns: ['id','sfzmhm','xm','lsh','kszp','ksdd','kssycs','kslx','kscx','ksxl','ksy1']
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search text of Search component.
|
||||||
|
*/
|
||||||
|
// static readonly SEARCH_TEXT = '搜索';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* toast text of prompt component.
|
||||||
|
*/
|
||||||
|
// static readonly TOAST_TEXT_1 = '账目类型不能为空';
|
||||||
|
// static readonly TOAST_TEXT_2 = '账目金额不为正整数';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Component size.
|
||||||
|
*/
|
||||||
|
// static readonly FULL_WIDTH = '100%';
|
||||||
|
// static readonly FULL_HEIGHT = '100%';
|
||||||
|
// static readonly DIALOG_HEIGHT = '55%';
|
||||||
|
// static readonly TABS_HEIGHT = '45%';
|
||||||
|
// static readonly MINIMUM_SIZE = 0;
|
||||||
|
// static readonly FULL_SIZE = 1;
|
||||||
|
// static readonly PROMPT_BOTTOM = '70vp';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Component location.
|
||||||
|
*/
|
||||||
|
// static readonly EDIT_POSITION_X = '80%';
|
||||||
|
// static readonly EDIT_POSITION_Y = '90%';
|
||||||
|
// static readonly DELETE_POSITION_X = '50%';
|
||||||
|
// static readonly DELETE_POSITION_Y = '90%';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log tag.
|
||||||
|
*/
|
||||||
|
static readonly RDB_TAG = '[Debug.Rdb]';
|
||||||
|
static readonly TABLE_TAG = '[Debug.AccountTable]';
|
||||||
|
static readonly INDEX_TAG = '[Debug.Index]';
|
||||||
|
}
|
||||||
@ -16,7 +16,7 @@ import {
|
|||||||
} from '../../common/service/initable'
|
} from '../../common/service/initable'
|
||||||
import { GlobalConfig } from '../../config/index'
|
import { GlobalConfig } from '../../config/index'
|
||||||
import testNapi from '@ohos.hiserialsdk'
|
import testNapi from '@ohos.hiserialsdk'
|
||||||
|
import fs from '@ohos.file.fs';
|
||||||
let num = 0
|
let num = 0
|
||||||
|
|
||||||
export async function getliushuiNum(context) {
|
export async function getliushuiNum(context) {
|
||||||
@ -41,7 +41,37 @@ export async function getliushuiNum(context) {
|
|||||||
// return str
|
// return str
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
export async function deleteAllFIleLog(){
|
||||||
|
let options = {
|
||||||
|
"recursion": false,
|
||||||
|
"listNum": 0,
|
||||||
|
};
|
||||||
|
let filenames = fs.listFileSync(GlobalConfig.comoonfileWriteAddress+'/PLC/', options);
|
||||||
|
console.info("listFile succeed",JSON.stringify(filenames));
|
||||||
|
for (let i = 0; i < filenames.length; i++) {
|
||||||
|
if(isSevenDaysAgo(filenames[i])){
|
||||||
|
fs.rmdir(GlobalConfig.comoonfileWriteAddress+'/PLC/'+filenames[i], (err) => {
|
||||||
|
if (err) {
|
||||||
|
console.error("rmdir failed with error message: " + err.message + ", error code: " + err.code);
|
||||||
|
} else {
|
||||||
|
console.info("rmdir succeed");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// console.info("filename: %s", filenames[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
function isSevenDaysAgo(date) {
|
||||||
|
const today = new Date(); // 当前日期
|
||||||
|
const target = new Date(date); // 需要判断的日期
|
||||||
|
|
||||||
|
const diff = today.getTime() - target.getTime(); // 计算两个日期之间的毫秒数差异
|
||||||
|
const diffDays = diff / (1000 * 60 * 60 * 24); // 将毫秒转换为天数
|
||||||
|
|
||||||
|
// 如果差异天数正好是7,则原日期是当前日期的前七天
|
||||||
|
return diffDays > 7;
|
||||||
|
}
|
||||||
//配置流水号
|
//配置流水号
|
||||||
export async function setliushuiNum(context) {
|
export async function setliushuiNum(context) {
|
||||||
const fileUtil = new FileUtil(context)
|
const fileUtil = new FileUtil(context)
|
||||||
|
|||||||
@ -24,6 +24,8 @@ import hilog from '@ohos.hilog';
|
|||||||
import prompt from '@ohos.prompt'
|
import prompt from '@ohos.prompt'
|
||||||
import promptAction from '@ohos.promptAction';
|
import promptAction from '@ohos.promptAction';
|
||||||
import { getUDP } from './GlobalUdp';
|
import { getUDP } from './GlobalUdp';
|
||||||
|
import { dateFormat } from '../utils/tools'
|
||||||
|
import { formatTime } from '../../../chengmai/ets/common/utils/tools';
|
||||||
|
|
||||||
|
|
||||||
export default class UdpClientByCenter {
|
export default class UdpClientByCenter {
|
||||||
@ -32,6 +34,7 @@ export default class UdpClientByCenter {
|
|||||||
private oppositeIp: string = ''
|
private oppositeIp: string = ''
|
||||||
private oppositeIpPort: string = ''
|
private oppositeIpPort: string = ''
|
||||||
private udpMsg: any = ''
|
private udpMsg: any = ''
|
||||||
|
private chafenFlag: number = 0
|
||||||
private num: number = 0
|
private num: number = 0
|
||||||
private fileUtil: FileUtil
|
private fileUtil: FileUtil
|
||||||
private udp: UDPSocket = null
|
private udp: UDPSocket = null
|
||||||
@ -246,9 +249,10 @@ export default class UdpClientByCenter {
|
|||||||
callback({
|
callback({
|
||||||
id, length, body: list, sendId: this.sendId
|
id, length, body: list, sendId: this.sendId
|
||||||
})
|
})
|
||||||
this.interval=setInterval(()=>{
|
|
||||||
|
|
||||||
},3000)
|
// this.interval=setInterval(()=>{
|
||||||
|
//
|
||||||
|
// },3000)
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -303,18 +307,40 @@ export default class UdpClientByCenter {
|
|||||||
console.log(`${TAG} udp222 on message array buffer:${str}`);
|
console.log(`${TAG} udp222 on message array buffer:${str}`);
|
||||||
|
|
||||||
strachArr[28] = globalThis.chuankoMsg || strachArr[28]
|
strachArr[28] = globalThis.chuankoMsg || strachArr[28]
|
||||||
|
|
||||||
// this.stashFn(str)
|
// this.stashFn(str)
|
||||||
const newArr = JSON.parse(JSON.stringify(strachArr))
|
const newArr = JSON.parse(JSON.stringify(strachArr))
|
||||||
// this.stashFn=()=>{}
|
this.writeLog({
|
||||||
|
time:dateFormat(new Date()),
|
||||||
|
PLC: JSON.stringify(newArr.toString()),
|
||||||
|
})
|
||||||
|
if(strachArr[83]!='4'){
|
||||||
|
this.chafenFlag++
|
||||||
|
if(this.chafenFlag>=15&&!globalThis.dialogOpen){
|
||||||
|
globalThis.title='差分状态异常'
|
||||||
|
globalThis.type='3'
|
||||||
|
AppStorage.SetOrCreate('errorMsg', 1);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
globalThis.dialogOpen=false
|
||||||
|
}
|
||||||
|
this.chafenFlag=0
|
||||||
callback && callback(newArr.toString())
|
callback && callback(newArr.toString())
|
||||||
this.currentValue = newArr.toString();
|
this.currentValue = newArr.toString();
|
||||||
} else {
|
} else {
|
||||||
callback && callback('')
|
callback && callback('')
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('messageTimeEnd')
|
console.log('messageTimeEnd')
|
||||||
this.testIfUdpConnetced(callback)
|
this.testIfUdpConnetced(callback)
|
||||||
}
|
}
|
||||||
|
async writeLog(param){
|
||||||
|
const fileUtil = new FileUtil(globalThis.context)
|
||||||
|
const date=dateFormat(new Date).split(' ')[0]
|
||||||
|
const folderPath = await fileUtil.initFolder(`/PLC/${date}`);
|
||||||
|
fileUtil.editFile(`${folderPath}/plcLog.txt`, JSON.stringify(param)+`\n`)
|
||||||
|
|
||||||
|
}
|
||||||
//获取当前UDP信号
|
//获取当前UDP信号
|
||||||
getCurrentMessage = () => {
|
getCurrentMessage = () => {
|
||||||
return this.currentValue
|
return this.currentValue
|
||||||
@ -328,6 +354,8 @@ export default class UdpClientByCenter {
|
|||||||
const arrRedBuffer = Array2Byte(arrRed).buffer
|
const arrRedBuffer = Array2Byte(arrRed).buffer
|
||||||
const arrGreenBugger = Array2Byte(arrGreen).buffer
|
const arrGreenBugger = Array2Byte(arrGreen).buffer
|
||||||
let num = 0
|
let num = 0
|
||||||
|
globalThis.dialogOpen=false
|
||||||
|
|
||||||
//监听udp是否断开
|
//监听udp是否断开
|
||||||
clearInterval(globalThis.messageTimer)
|
clearInterval(globalThis.messageTimer)
|
||||||
globalThis.messageTimer = setInterval(() => {
|
globalThis.messageTimer = setInterval(() => {
|
||||||
@ -341,14 +369,19 @@ export default class UdpClientByCenter {
|
|||||||
console.log(TAG, 'plc udp信号丢失')
|
console.log(TAG, 'plc udp信号丢失')
|
||||||
if (num == 3) {
|
if (num == 3) {
|
||||||
getUDP(globalThis.context,true)
|
getUDP(globalThis.context,true)
|
||||||
|
|
||||||
num = 0
|
num = 0
|
||||||
}
|
}
|
||||||
|
globalThis.title='plc udp信号丢失'
|
||||||
|
globalThis.type='3'
|
||||||
|
if(!globalThis.dialogOpen){
|
||||||
|
AppStorage.SetOrCreate('errorMsg', 1);
|
||||||
|
}
|
||||||
prompt.showToast({
|
prompt.showToast({
|
||||||
message: 'plc udp信号丢失',
|
message: 'plc udp信号丢失',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.plcUdpError = true;
|
this.plcUdpError = true;
|
||||||
}, 2000)
|
}, 2000)
|
||||||
}, 3000)
|
}, 3000)
|
||||||
|
|||||||
@ -41,12 +41,7 @@ export default async function request(req: any) {
|
|||||||
// let baseUrl=host?config.csptHost:config.host'
|
// let baseUrl=host?config.csptHost:config.host'
|
||||||
|
|
||||||
console.log('响应头地址' + baseUrl,url)
|
console.log('响应头地址' + baseUrl,url)
|
||||||
// writeLog({
|
|
||||||
// time:dateFormat(new Date()),
|
|
||||||
// url,
|
|
||||||
// extraData: JSON.stringify(data),
|
|
||||||
// state:'start'
|
|
||||||
// })
|
|
||||||
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({
|
||||||
|
|||||||
@ -101,6 +101,9 @@ export default struct Index {
|
|||||||
}
|
}
|
||||||
router.pushUrl({
|
router.pushUrl({
|
||||||
url: 'pages/UserInfo',
|
url: 'pages/UserInfo',
|
||||||
|
params:{
|
||||||
|
type:1
|
||||||
|
}
|
||||||
}, router.RouterMode.Single);
|
}, router.RouterMode.Single);
|
||||||
|
|
||||||
console.log('res11', JSON.stringify(res))
|
console.log('res11', JSON.stringify(res))
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import FileUtil from '../common/utils/File';
|
|||||||
import { getUDP, getUDP2 } from '../common/utils/GlobalUdp';
|
import { getUDP, getUDP2 } from '../common/utils/GlobalUdp';
|
||||||
import { initJudgeUdp } from '../common/utils/UdpJudge';
|
import { initJudgeUdp } from '../common/utils/UdpJudge';
|
||||||
import { getTCP } from '../common/utils/GlobalTcp';
|
import { getTCP } from '../common/utils/GlobalTcp';
|
||||||
import { getliushuiNum, setliushuiNum, takePhotoFn } from '../common/service/indexService';
|
import { getliushuiNum, setliushuiNum, takePhotoFn,deleteAllFIleLog } from '../common/service/indexService';
|
||||||
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
|
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
|
||||||
import worker, { MessageEvents } from '@ohos.worker';
|
import worker, { MessageEvents } from '@ohos.worker';
|
||||||
import promptAction from '@ohos.promptAction'
|
import promptAction from '@ohos.promptAction'
|
||||||
@ -62,7 +62,7 @@ struct Index {
|
|||||||
.height(69 * this.ratio * this.dialogRatio)
|
.height(69 * this.ratio * this.dialogRatio)
|
||||||
.backgroundImage($r('app.media.button_nor'))
|
.backgroundImage($r('app.media.button_nor'))
|
||||||
.backgroundImageSize({ width: '100%', height: '100%' })
|
.backgroundImageSize({ width: '100%', height: '100%' })
|
||||||
.margin({ bottom: 12 * this.ratio })
|
// .margin({ bottom: 12 * this.ratio })
|
||||||
}
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
@ -421,6 +421,7 @@ struct Index {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async initParams() {
|
async initParams() {
|
||||||
|
deleteAllFIleLog()
|
||||||
//设置plc udp 同步requesthost
|
//设置plc udp 同步requesthost
|
||||||
await getUDP(this.context, false)
|
await getUDP(this.context, false)
|
||||||
this.loading = false
|
this.loading = false
|
||||||
@ -446,10 +447,14 @@ struct Index {
|
|||||||
this.heartMsg()
|
this.heartMsg()
|
||||||
}
|
}
|
||||||
const data=AppStorage.Get('errorMsg'); // returns 47
|
const data=AppStorage.Get('errorMsg'); // returns 47
|
||||||
console.log('1123',data)
|
console.log('1123',data,globalThis.type)
|
||||||
if(data==1){
|
if(data==1){
|
||||||
|
if(globalThis.type=='3'&&!globalThis.dialogOpen){
|
||||||
|
globalThis.dialogOpen=true
|
||||||
|
}else if(globalThis.type=='1'){
|
||||||
this.errorDialog.open()
|
this.errorDialog.open()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}, 1000)
|
}, 1000)
|
||||||
//下载模型
|
//下载模型
|
||||||
// await this.getModel()
|
// await this.getModel()
|
||||||
|
|||||||
@ -72,6 +72,7 @@ struct UserInfo {
|
|||||||
@State signNum: number = 0;
|
@State signNum: number = 0;
|
||||||
@State isCanClick: boolean = true;
|
@State isCanClick: boolean = true;
|
||||||
@State updateTimeLimit: boolean = false
|
@State updateTimeLimit: boolean = false
|
||||||
|
@State ksksLimit: boolean = false
|
||||||
@State faceFlag: string = '0';
|
@State faceFlag: string = '0';
|
||||||
@State FaceOpenStatue: string = '0'; //是否开启人脸识别
|
@State FaceOpenStatue: string = '0'; //是否开启人脸识别
|
||||||
@State faceCatchImg: string = ''
|
@State faceCatchImg: string = ''
|
||||||
@ -119,6 +120,7 @@ struct UserInfo {
|
|||||||
)
|
)
|
||||||
async onPageShow() {
|
async onPageShow() {
|
||||||
this.updateTimeLimit=false
|
this.updateTimeLimit=false
|
||||||
|
this.ksksLimit=false
|
||||||
console.log('响应头地址响应头地址')
|
console.log('响应头地址响应头地址')
|
||||||
const mediaTest = new FilePhoto(this.context);
|
const mediaTest = new FilePhoto(this.context);
|
||||||
this.filePhoto = new FilePhoto(this.context);
|
this.filePhoto = new FilePhoto(this.context);
|
||||||
@ -128,6 +130,10 @@ struct UserInfo {
|
|||||||
this.initData()
|
this.initData()
|
||||||
//身份证读卡器初始化
|
//身份证读卡器初始化
|
||||||
// this.openDeviceByIDCard()
|
// this.openDeviceByIDCard()
|
||||||
|
const routerParam=router.getParams()||{type :0};
|
||||||
|
console.log('routerParam',JSON.stringify(routerParam))
|
||||||
|
// @ts-ignore
|
||||||
|
if(routerParam.type!=1){
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
this.list =await getSyncData('USERLIST')
|
this.list =await getSyncData('USERLIST')
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@ -161,6 +167,10 @@ struct UserInfo {
|
|||||||
res.id=index.toString()
|
res.id=index.toString()
|
||||||
})
|
})
|
||||||
await upDateTableByArray('USERLIST', this.list||[])
|
await upDateTableByArray('USERLIST', this.list||[])
|
||||||
|
}else{
|
||||||
|
this.getExaminationStudentInfoFn()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 如果是单机模式则模拟假数据
|
// 如果是单机模式则模拟假数据
|
||||||
//获取sysset表数据
|
//获取sysset表数据
|
||||||
@ -353,7 +363,6 @@ struct UserInfo {
|
|||||||
carNo: globalThis.carInfo.carNo,
|
carNo: globalThis.carInfo.carNo,
|
||||||
placeId: globalThis.carInfo.examinationRoomId
|
placeId: globalThis.carInfo.examinationRoomId
|
||||||
}
|
}
|
||||||
|
|
||||||
globalThis.udpClient2.sendMsgExt(param, this.context)
|
globalThis.udpClient2.sendMsgExt(param, this.context)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -515,6 +524,7 @@ struct UserInfo {
|
|||||||
|
|
||||||
qkFn() {
|
qkFn() {
|
||||||
this.faceCompareSucess = 0
|
this.faceCompareSucess = 0
|
||||||
|
this.ksksLimit=false
|
||||||
if (globalThis.singlePlay) {
|
if (globalThis.singlePlay) {
|
||||||
this.qkFlag = false
|
this.qkFlag = false
|
||||||
return
|
return
|
||||||
@ -616,6 +626,7 @@ struct UserInfo {
|
|||||||
kString:keystr || ''
|
kString:keystr || ''
|
||||||
}
|
}
|
||||||
}, router.RouterMode.Single);
|
}, router.RouterMode.Single);
|
||||||
|
this.updateTimeLimit=false
|
||||||
this.stopDeviceById()
|
this.stopDeviceById()
|
||||||
this.stepFlag = false
|
this.stepFlag = false
|
||||||
})
|
})
|
||||||
@ -882,6 +893,10 @@ struct UserInfo {
|
|||||||
Image($r('app.media.qk_btn'))
|
Image($r('app.media.qk_btn'))
|
||||||
.commStyle()
|
.commStyle()
|
||||||
.onClick(() => {
|
.onClick(() => {
|
||||||
|
if(this.ksksLimit){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.ksksLimit=true
|
||||||
this.qkFlag = true
|
this.qkFlag = true
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -906,6 +921,10 @@ struct UserInfo {
|
|||||||
Image($r('app.media.ksks_btn'))
|
Image($r('app.media.ksks_btn'))
|
||||||
.commStyle()
|
.commStyle()
|
||||||
.onClick(async () => {
|
.onClick(async () => {
|
||||||
|
if(this.ksksLimit){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
console.log('routerParamrouterParam')
|
||||||
try {
|
try {
|
||||||
await this.checkSignal()
|
await this.checkSignal()
|
||||||
this.faceCompareSucess = 0
|
this.faceCompareSucess = 0
|
||||||
@ -913,6 +932,8 @@ struct UserInfo {
|
|||||||
if (!this.currentUser.xm) {
|
if (!this.currentUser.xm) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
this.ksksLimit=true
|
||||||
|
|
||||||
if (globalThis.singlePlay) {
|
if (globalThis.singlePlay) {
|
||||||
const {examSubject} = globalThis.carInfo;
|
const {examSubject} = globalThis.carInfo;
|
||||||
this.currentUser.id='0'
|
this.currentUser.id='0'
|
||||||
@ -924,6 +945,8 @@ struct UserInfo {
|
|||||||
kfdm: this.sczbkf,
|
kfdm: this.sczbkf,
|
||||||
}
|
}
|
||||||
}, router.RouterMode.Single);
|
}, router.RouterMode.Single);
|
||||||
|
this.ksksLimit=false
|
||||||
|
|
||||||
this.stopDeviceById()
|
this.stopDeviceById()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -963,6 +986,7 @@ struct UserInfo {
|
|||||||
}
|
}
|
||||||
.commStyle()
|
.commStyle()
|
||||||
.onClick(() => {
|
.onClick(() => {
|
||||||
|
this.ksksLimit=false
|
||||||
this.qkFlag = false
|
this.qkFlag = false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
98
entry/src/main/ets/pages/compontents/errorMsgDialog.ets
Normal file
98
entry/src/main/ets/pages/compontents/errorMsgDialog.ets
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
@CustomDialog
|
||||||
|
export default struct errorMsgDialog {
|
||||||
|
private controller?: CustomDialogController
|
||||||
|
cancel: () => void = () => {
|
||||||
|
}
|
||||||
|
confirm: () => void = () => {
|
||||||
|
}
|
||||||
|
dialogRatio:number=0.8
|
||||||
|
title?: string
|
||||||
|
type: string //1 tip 2loading 3Dialog
|
||||||
|
@State angle: number = 0
|
||||||
|
|
||||||
|
@Styles
|
||||||
|
commStyle(){
|
||||||
|
.width(220 * globalThis.ratio * this.dialogRatio )
|
||||||
|
.height(69 * globalThis.ratio * this.dialogRatio)
|
||||||
|
.backgroundImage($r('app.media.button_nor'))
|
||||||
|
.backgroundImageSize({ width: '100%', height: '100%' })
|
||||||
|
// .margin({ bottom: 12 * this.ratio })
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
Column() {
|
||||||
|
if(this.title){
|
||||||
|
Text(this.title)
|
||||||
|
.fontSize(30* this.dialogRatio)
|
||||||
|
.margin(120* this.dialogRatio)
|
||||||
|
}
|
||||||
|
if (this.type=='2') {
|
||||||
|
Image($r('app.media.open_loading'))
|
||||||
|
.width(200)
|
||||||
|
.rotate({ angle: this.angle })
|
||||||
|
.height(200)
|
||||||
|
.animation({
|
||||||
|
duration: 5000, // 动画时长
|
||||||
|
curve: Curve.EaseOut, // 动画曲线
|
||||||
|
delay: 500, // 动画延迟
|
||||||
|
iterations: -1, // 播放次数
|
||||||
|
playMode: PlayMode.Normal, // 动画模式
|
||||||
|
})
|
||||||
|
.margin(50)
|
||||||
|
}
|
||||||
|
if (this.type=='3') {
|
||||||
|
Row() {
|
||||||
|
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
|
||||||
|
Text(' 取 消 ')
|
||||||
|
.fontSize(24 * globalThis.ratio* this.dialogRatio )
|
||||||
|
.fontColor('#fff')
|
||||||
|
.width(100 * globalThis.ratio* this.dialogRatio)
|
||||||
|
}
|
||||||
|
.commStyle()
|
||||||
|
.onClick(() => {
|
||||||
|
if (this.controller != undefined) {
|
||||||
|
this.cancel()
|
||||||
|
this.controller.close()
|
||||||
|
}
|
||||||
|
}).margin({ right: 10 * globalThis.ratio * this.dialogRatio})
|
||||||
|
|
||||||
|
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
|
||||||
|
Text(' 确 定 ')
|
||||||
|
.fontSize(24 * globalThis.ratio* this.dialogRatio)
|
||||||
|
.fontColor('#fff')
|
||||||
|
.width(100 * globalThis.ratio* this.dialogRatio)
|
||||||
|
}
|
||||||
|
.commStyle()
|
||||||
|
.onClick(() => {
|
||||||
|
if (this.controller != undefined){
|
||||||
|
this.confirm()
|
||||||
|
this.controller.close()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}.backgroundColor('#E6E3DF')
|
||||||
|
.borderRadius(19 * globalThis.ratio)
|
||||||
|
.constraintSize({ minWidth: 520 })
|
||||||
|
}
|
||||||
|
|
||||||
|
aboutToAppear() {
|
||||||
|
AppStorage.SetOrCreate('errorMsg', 0);
|
||||||
|
setTimeout(() => {
|
||||||
|
console.log('this.type',this.type,this.angle)
|
||||||
|
if (this.type=='2') {
|
||||||
|
this.angle = 360
|
||||||
|
}
|
||||||
|
},1000)
|
||||||
|
if(this.type=='1'){
|
||||||
|
setTimeout(()=>{
|
||||||
|
this.controller.close()
|
||||||
|
},2000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
aboutToDisappear() {
|
||||||
|
this.title=''
|
||||||
|
this.angle = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user