| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- import { LoginCollect } from './LoginCollect'
- import { display } from '@kit.ArkUI'
- export interface BasicType<T = undefined> {
- src?: ResourceStr,
- acSrc?: ResourceStr,
- text?: string,
- message?: string,
- color?: ResourceColor,
- click?: () => void,
- number?: number,
- generics?: T,
- date?: string,
- index?: number,
- loginType?: LoginCollect
- finally?: () => void
- }
- export type ReqString = Record<string, string>
- export interface AvoidType {
- top?: number,
- bottom?: number
- }
- export interface MessageType {
- text: string,
- header: ResourceStr,
- role: Role,
- id?: number
- }
- export enum Role {
- USER,
- OTHER,
- CARD
- }
- export interface DelPhotoParam {
- src: string,
- type: 'bill' | 'header' | 'image'
- }
- /**
- * @description 结果回调函数的类型别名
- * @param res 结果输出
- * @param err 错误输出
- */
- export type ResultCallBack<T> = (res?: T, err?: Error) => void
- /**
- * @description 断点字符串类型
- */
- export type BreakPointString = 'xs' | 'sm' | 'md' | 'lg'
- @ObservedV2
- export class Card {
- param: Resource;
- id: number
- @Trace isSubmit: boolean = false
- @Trace offsetX: number = 0
- @Trace offsetY: number = 0
- @Trace zIndex: number = 0
- @Trace size: number = 0
- @Trace opacity: number = 0
- constructor(img: Resource, id: number, uiContext: UIContext) {
- this.param = img
- this.id = id
- let displayClass: display.Display = display.getDefaultDisplaySync();
- let windowWidth = uiContext.px2vp(displayClass.width)
- let midCardOffsetX = 25
- let rightCardOffsetX = windowWidth - 32 - (windowWidth * 0.7833 * 0.83)
- if (id === 0) {
- this.offsetX = 0
- this.size = 0.83
- this.zIndex = 1
- this.opacity = 1
- } else if (id === 1) {
- this.offsetX = midCardOffsetX
- this.size = 1
- this.zIndex = 2
- this.opacity = 1
- } else if (id === 2) {
- this.offsetX = rightCardOffsetX
- this.size = 0.83
- this.zIndex = 1
- this.opacity = 1
- } else {
- this.offsetX = midCardOffsetX
- this.size = 0.83
- this.zIndex = 1
- this.opacity = 0
- }
- }
- }
- // 日期信息接口定义
- export interface DateInfo {
- year: number; // 年份
- month: number; // 月份(1-12)
- day: number; // 日期(1-31)
- week: string; // 星期(中文)
- id: Date ; // 唯一标识
- }
|