This commit is contained in:
lvyuankang 2024-08-19 14:56:36 +08:00
parent 9a618adeff
commit 05f31c4b7c
2 changed files with 144 additions and 0 deletions

View 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]';
}

View File

@ -0,0 +1,76 @@
@CustomDialog
export default struct errorMsgDialog {
private controller?: CustomDialogController
cancel: () => void = () => {
}
confirm: () => void = () => {
}
title?: string
type: string //1 tip 2loading 3Dialog
@State angle: number = 0
build() {
Column() {
if(this.title){
Text(this.title)
.fontSize(30)
.margin(120)
}
if (this.type=='3') {
Row() {
Button('取消')
.onClick(() => {
if (this.controller != undefined) {
this.confirm()
this.controller.close()
}
})
.margin(20)
Button('确定')
.onClick(() => {
if (this.controller != undefined) {
this.cancel()
this.controller.close()
}
})
.margin(20)
}
}
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)
}
}.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
}
}