Compare commits

...

4 Commits

Author SHA1 Message Date
不如摸鱼去
ca58733786 refactor: ♻️ 更新二维码图片 2025-11-04 17:38:20 +08:00
不如摸鱼去
d85374833c refactor: ♻️ 更换部分二维码 2025-11-04 17:16:54 +08:00
不如摸鱼去
c913cf7a9a
refactor: ♻️ 完善 month-panel 的属性定义 (#1351)
* refactor: ♻️  完善 month-panel 的属性定义

* refactor: ♻️  解决潜在的跨天日期默认值异常问题
2025-11-04 16:54:28 +08:00
不如摸鱼去
c84af08cfd
refactor: ♻️ 适配微信小程序废弃 getSystemInfo 接口的逻辑 (#1348)
* refactor: ♻️  适配微信小程序废弃 getSystemInfo 接口的逻辑

* refactor: ♻️  消除 getSystemInfo 中冗余的字段赋值

* refactor: ♻️  lint cases
2025-11-02 13:33:37 +08:00
23 changed files with 1468 additions and 684 deletions

View File

@ -1,12 +1,3 @@
/*
* @Author: weisheng
* @Date: 2025-08-30 13:06:10
* @LastEditTime: 2025-09-21 19:53:02
* @LastEditors: weisheng
* @Description:
* @FilePath: /wot-design-uni/docs/.vitepress/theme/composables/cases.ts
*
*/
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue'
import axios from 'axios' import axios from 'axios'
@ -34,7 +25,7 @@ export function useCaseData() {
const response = await axios.get(url + path + '?t=' + Date.now(), { const response = await axios.get(url + path + '?t=' + Date.now(), {
timeout: 5000 // 设置5秒超时 timeout: 5000 // 设置5秒超时
}) })
const data = response.data && response.data.data ? response.data.data : [] const data: CaseData[] = response.data && response.data.data ? response.data.data : []
return data.map(item => { return data.map(item => {
return { return {
name: item.name, name: item.name,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 167 KiB

View File

@ -69,21 +69,22 @@
"test:workflow": "esno ./scripts/test-workflow.ts" "test:workflow": "esno ./scripts/test-workflow.ts"
}, },
"dependencies": { "dependencies": {
"@dcloudio/uni-app": "3.0.0-4050720250324001", "@dcloudio/uni-app": "3.0.0-4070620250821001",
"@dcloudio/uni-app-harmony": "3.0.0-4050720250324001", "@dcloudio/uni-app-harmony": "3.0.0-4070620250821001",
"@dcloudio/uni-app-plus": "3.0.0-4050720250324001", "@dcloudio/uni-app-plus": "3.0.0-4070620250821001",
"@dcloudio/uni-components": "3.0.0-4050720250324001", "@dcloudio/uni-components": "3.0.0-4070620250821001",
"@dcloudio/uni-h5": "3.0.0-4050720250324001", "@dcloudio/uni-h5": "3.0.0-4070620250821001",
"@dcloudio/uni-mp-alipay": "3.0.0-4050720250324001", "@dcloudio/uni-mp-alipay": "3.0.0-4070620250821001",
"@dcloudio/uni-mp-baidu": "3.0.0-4050720250324001", "@dcloudio/uni-mp-baidu": "3.0.0-4070620250821001",
"@dcloudio/uni-mp-jd": "3.0.0-4050720250324001", "@dcloudio/uni-mp-harmony": "3.0.0-4070620250821001",
"@dcloudio/uni-mp-kuaishou": "3.0.0-4050720250324001", "@dcloudio/uni-mp-jd": "3.0.0-4070620250821001",
"@dcloudio/uni-mp-lark": "3.0.0-4050720250324001", "@dcloudio/uni-mp-kuaishou": "3.0.0-4070620250821001",
"@dcloudio/uni-mp-qq": "3.0.0-4050720250324001", "@dcloudio/uni-mp-lark": "3.0.0-4070620250821001",
"@dcloudio/uni-mp-toutiao": "3.0.0-4050720250324001", "@dcloudio/uni-mp-qq": "3.0.0-4070620250821001",
"@dcloudio/uni-mp-weixin": "3.0.0-4050720250324001", "@dcloudio/uni-mp-toutiao": "3.0.0-4070620250821001",
"@dcloudio/uni-mp-xhs": "3.0.0-4050720250324001", "@dcloudio/uni-mp-weixin": "3.0.0-4070620250821001",
"@dcloudio/uni-quickapp-webview": "3.0.0-4050720250324001", "@dcloudio/uni-mp-xhs": "3.0.0-4070620250821001",
"@dcloudio/uni-quickapp-webview": "3.0.0-4070620250821001",
"element-plus": "^2.11.2", "element-plus": "^2.11.2",
"vite-plugin-compression": "^0.5.1", "vite-plugin-compression": "^0.5.1",
"vitepress": "^1.6.3", "vitepress": "^1.6.3",
@ -97,10 +98,10 @@
"@commitlint/cli": "^19.5.0", "@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0", "@commitlint/config-conventional": "^19.5.0",
"@dcloudio/types": "^3.4.12", "@dcloudio/types": "^3.4.12",
"@dcloudio/uni-automator": "3.0.0-4050720250324001", "@dcloudio/uni-automator": "3.0.0-4070620250821001",
"@dcloudio/uni-cli-shared": "3.0.0-4050720250324001", "@dcloudio/uni-cli-shared": "3.0.0-4070620250821001",
"@dcloudio/uni-stacktracey": "3.0.0-4050720250324001", "@dcloudio/uni-stacktracey": "3.0.0-4070620250821001",
"@dcloudio/vite-plugin-uni": "3.0.0-4050720250324001", "@dcloudio/vite-plugin-uni": "3.0.0-4070620250821001",
"@element-plus/icons-vue": "^2.3.1", "@element-plus/icons-vue": "^2.3.1",
"@rollup/pluginutils": "^5.1.4", "@rollup/pluginutils": "^5.1.4",
"@types/jsdom": "^21.1.7", "@types/jsdom": "^21.1.7",
@ -144,7 +145,7 @@
"typescript": "^5.5.4", "typescript": "^5.5.4",
"unplugin-auto-import": "^0.17.5", "unplugin-auto-import": "^0.17.5",
"unplugin-vue-components": "^0.26.0", "unplugin-vue-components": "^0.26.0",
"vite": "^5.4.19", "vite": "^5.2.8",
"vitepress-plugin-llms": "^1.1.3", "vitepress-plugin-llms": "^1.1.3",
"vitest": "^1.6.0", "vitest": "^1.6.0",
"vue-eslint-parser": "^9.1.0", "vue-eslint-parser": "^9.1.0",

1881
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: weisheng * @Author: weisheng
* @Date: 2024-10-12 13:07:08 * @Date: 2024-10-12 13:07:08
* @LastEditTime: 2025-04-08 11:13:02 * @LastEditTime: 2025-10-31 13:47:04
* @LastEditors: weisheng * @LastEditors: weisheng
* @Description: * @Description:
* @FilePath: /wot-design-uni/src/App.vue * @FilePath: /wot-design-uni/src/App.vue
@ -12,6 +12,7 @@ import { onLaunch, onShow, onHide, onThemeChange } from '@dcloudio/uni-app'
import { useDark } from './store' import { useDark } from './store'
import { useI18nSync } from './hooks/useI18nSync' import { useI18nSync } from './hooks/useI18nSync'
import { useIframeMessage } from './hooks/useIframeMessage' import { useIframeMessage } from './hooks/useIframeMessage'
import { getSystemInfo } from './uni_modules/wot-design-uni/components/common/util'
// //
const darkMode = useDark() const darkMode = useDark()
@ -32,7 +33,7 @@ onThemeChange((option) => {
}) })
onLaunch(() => { onLaunch(() => {
const systemInfo = uni.getSystemInfoSync() const systemInfo = getSystemInfo()
darkMode.setDark(systemInfo.theme === 'dark') darkMode.setDark(systemInfo.theme === 'dark')
}) })
onShow(() => { onShow(() => {

View File

@ -77,7 +77,8 @@ import { ref } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
const { t } = useI18n() const { t } = useI18n()
const minDate = ref<number>(new Date(new Date().getFullYear() - 20, new Date().getMonth() - 6, new Date().getDate()).getTime()) const now = new Date()
const minDate = ref<number>(new Date(now.getFullYear() - 20, now.getMonth() - 6, now.getDate()).getTime())
const value1 = ref<number>(Date.now()) const value1 = ref<number>(Date.now())
const value2 = ref<number[]>([Date.now() - 24 * 60 * 60 * 1000 * 3, Date.now()]) const value2 = ref<number[]>([Date.now() - 24 * 60 * 60 * 1000 * 3, Date.now()])

View File

@ -117,7 +117,8 @@ const valueClear2 = ref<any[]>([Date.now(), Date.now()])
const valueEllipsis = ref<number>(Date.now()) const valueEllipsis = ref<number>(Date.now())
const valueRangeEllipsis = ref<any[]>([Date.now(), Date.now() + 7 * 24 * 60 * 60 * 1000]) const valueRangeEllipsis = ref<any[]>([Date.now(), Date.now() + 7 * 24 * 60 * 60 * 1000])
const minDate = ref<number>(Date.now()) const minDate = ref<number>(Date.now())
const maxDate = ref<number>(new Date(new Date().getFullYear() + 1, new Date().getMonth(), new Date().getDate()).getTime()) const now = new Date()
const maxDate = ref<number>(new Date(now.getFullYear() + 1, now.getMonth(), now.getDate()).getTime())
const formatter: DatetimePickerViewFormatter = (type, value) => { const formatter: DatetimePickerViewFormatter = (type, value) => {
let formatValue = '' let formatValue = ''

View File

@ -1,3 +1,12 @@
<!--
* @Author: weisheng
* @Date: 2025-07-17 10:27:32
* @LastEditTime: 2025-10-31 13:46:40
* @LastEditors: weisheng
* @Description:
* @FilePath: /wot-design-uni/src/subPages/floatingPanel/Index.vue
* 记得注释
-->
<template> <template>
<wd-toast></wd-toast> <wd-toast></wd-toast>
<view class="floating-panel"> <view class="floating-panel">
@ -29,7 +38,7 @@
import { ref } from 'vue' import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import { useToast } from '@/uni_modules/wot-design-uni' import { useToast } from '@/uni_modules/wot-design-uni'
import { addUnit } from '@/uni_modules/wot-design-uni/components/common/util' import { addUnit, getSystemInfo } from '@/uni_modules/wot-design-uni/components/common/util'
const { show } = useToast() const { show } = useToast()
@ -45,7 +54,7 @@ const handleHeightChange = ({ height }: { height: number }) => {
} }
onLoad(() => { onLoad(() => {
windowHeight.value = uni.getSystemInfoSync().windowHeight windowHeight.value = getSystemInfo().windowHeight
anchors.value = [100, Math.round(0.4 * windowHeight.value), Math.round(0.7 * windowHeight.value)] anchors.value = [100, Math.round(0.4 * windowHeight.value), Math.round(0.7 * windowHeight.value)]
height.value = anchors.value[1] height.value = anchors.value[1]
}) })

View File

@ -28,7 +28,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { pause } from '@/uni_modules/wot-design-uni/components/common/util' import { getSystemInfo, pause } from '@/uni_modules/wot-design-uni/components/common/util'
import type { SignatureInstance, SignatureResult } from '@/uni_modules/wot-design-uni/components/wd-signature/types' import type { SignatureInstance, SignatureResult } from '@/uni_modules/wot-design-uni/components/wd-signature/types'
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue'
@ -38,7 +38,7 @@ const width = ref(0)
const inited = ref(false) const inited = ref(false)
onMounted(() => { onMounted(() => {
const { windowWidth, windowHeight } = uni.getSystemInfoSync() const { windowWidth, windowHeight } = getSystemInfo()
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
// 使 // 使
width.value = windowWidth width.value = windowWidth

View File

@ -776,3 +776,61 @@ export function easingFn(t: number = 0, b: number = 0, c: number = 0, d: number
export function closest(arr: number[], target: number) { export function closest(arr: number[], target: number) {
return arr.reduce((prev, curr) => (Math.abs(curr - target) < Math.abs(prev - target) ? curr : prev)) return arr.reduce((prev, curr) => (Math.abs(curr - target) < Math.abs(prev - target) ? curr : prev))
} }
/**
* 使
*/
export interface SystemInfo {
/** 窗口宽度 */
windowWidth: number
/** 窗口高度 */
windowHeight: number
/** 窗口顶部位置 */
windowTop: number
/** 设备像素比 */
pixelRatio: number
/** 平台信息 */
platform: string
/** 主题模式 */
theme?: string
/** 状态栏高度 */
statusBarHeight?: number
/** 安全区域信息 */
safeArea?: UniApp.SafeArea
/** 屏幕高度 */
screenHeight: number
/** 安全区域插入信息 */
safeAreaInsets?: UniApp.SafeAreaInsets
// 未尽字段
[key: string]: any
}
/**
*
* 使API替代getSystemInfoSync使getSystemInfoSync
* @returns
*/
export function getSystemInfo(): SystemInfo {
let systemInfo: SystemInfo
// #ifdef MP-WEIXIN
try {
// const systemSetting = uni.getSystemSetting() // 暂时不需要
const deviceInfo = uni.getDeviceInfo()
const windowInfo = uni.getWindowInfo()
const appBaseInfo = uni.getAppBaseInfo()
systemInfo = {
...deviceInfo,
...windowInfo,
...appBaseInfo
}
} catch (error) {
console.warn('获取系统信息失败降级使用uni.getSystemInfoSync:', error)
// 降级处理,使用原来的方法
systemInfo = uni.getSystemInfoSync()
}
// #endif
// #ifndef MP-WEIXIN
systemInfo = uni.getSystemInfoSync()
// #endif
return systemInfo
}

View File

@ -1,7 +1,11 @@
import type { ComponentPublicInstance, ExtractPropTypes, PropType } from 'vue' import type { ComponentPublicInstance, ExtractPropTypes, PropType } from 'vue'
import { makeBooleanProp, makeRequiredProp } from '../../common/props' import { makeBooleanProp, makeNumberProp, makeStringProp } from '../../common/props'
import type { CalendarFormatter, CalendarTimeFilter, CalendarType } from '../types' import type { CalendarFormatter, CalendarTimeFilter, CalendarType } from '../types'
const now = new Date()
const defaultMinDate = new Date(now.getFullYear(), now.getMonth() - 6, now.getDate()).getTime()
const defaultMaxDate = new Date(now.getFullYear(), now.getMonth() + 6, now.getDate(), 23, 59, 59).getTime()
/** /**
* *
*/ */
@ -11,22 +15,66 @@ export interface MonthInfo {
} }
export const monthPanelProps = { export const monthPanelProps = {
type: makeRequiredProp(String as PropType<CalendarType>), /**
value: makeRequiredProp([Number, Array, null] as PropType<number | (number | null)[] | null>), *
minDate: makeRequiredProp(Number), */
maxDate: makeRequiredProp(Number), type: makeStringProp<CalendarType>('date'),
firstDayOfWeek: makeRequiredProp(Number), /**
* 13
*/
value: {
type: [Number, Array, null] as PropType<number | (number | null)[] | null>,
default: null
},
/**
* 13
*/
minDate: makeNumberProp(defaultMinDate),
/**
* 13
*/
maxDate: makeNumberProp(defaultMaxDate),
/**
*
*/
firstDayOfWeek: makeNumberProp(0),
/**
*
*/
formatter: Function as PropType<CalendarFormatter>, formatter: Function as PropType<CalendarFormatter>,
/**
* type
*/
maxRange: Number, maxRange: Number,
/**
* type
*/
rangePrompt: String, rangePrompt: String,
/**
* type
*/
allowSameDay: makeBooleanProp(false), allowSameDay: makeBooleanProp(false),
/**
*
*/
showPanelTitle: makeBooleanProp(false), showPanelTitle: makeBooleanProp(false),
/**
* 使
*/
defaultTime: { defaultTime: {
type: [Array] as PropType<Array<number[]>> type: [Array] as PropType<Array<number[]>>
}, },
panelHeight: makeRequiredProp(Number), /**
// type 为 'datetime' 或 'datetimerange' 时有效,用于过滤时间选择器的数据 *
*/
panelHeight: makeNumberProp(378),
/**
* type 'datetime' 'datetimerange'
*/
timeFilter: Function as PropType<CalendarTimeFilter>, timeFilter: Function as PropType<CalendarTimeFilter>,
/**
* type 'datetime' 'datetimerange'
*/
hideSecond: makeBooleanProp(false), hideSecond: makeBooleanProp(false),
/** /**
* picker-view的 change change 1.2.25 * picker-view的 change change 1.2.25

View File

@ -1,6 +1,10 @@
import type { ComponentPublicInstance, ExtractPropTypes, PropType } from 'vue' import type { ComponentPublicInstance, ExtractPropTypes, PropType } from 'vue'
import { baseProps, makeBooleanProp, makeNumberProp, makeRequiredProp, makeStringProp } from '../common/props' import { baseProps, makeBooleanProp, makeNumberProp, makeRequiredProp, makeStringProp } from '../common/props'
const now = new Date()
const defaultMinDate = new Date(now.getFullYear(), now.getMonth() - 6, now.getDate()).getTime()
const defaultMaxDate = new Date(now.getFullYear(), now.getMonth() + 6, now.getDate(), 23, 59, 59).getTime()
export type CalendarType = 'date' | 'dates' | 'datetime' | 'week' | 'month' | 'daterange' | 'datetimerange' | 'weekrange' | 'monthrange' export type CalendarType = 'date' | 'dates' | 'datetime' | 'week' | 'month' | 'daterange' | 'datetimerange' | 'weekrange' | 'monthrange'
export const calendarViewProps = { export const calendarViewProps = {
@ -16,11 +20,11 @@ export const calendarViewProps = {
/** /**
* 13 * 13
*/ */
minDate: makeNumberProp(new Date(new Date().getFullYear(), new Date().getMonth() - 6, new Date().getDate()).getTime()), minDate: makeNumberProp(defaultMinDate),
/** /**
* 13 * 13
*/ */
maxDate: makeNumberProp(new Date(new Date().getFullYear(), new Date().getMonth() + 6, new Date().getDate(), 23, 59, 59).getTime()), maxDate: makeNumberProp(defaultMaxDate),
/** /**
* *
*/ */

View File

@ -12,6 +12,10 @@ import { baseProps, makeArrayProp, makeBooleanProp, makeNumberProp, makeRequired
import type { CalendarFormatter, CalendarTimeFilter, CalendarType } from '../wd-calendar-view/types' import type { CalendarFormatter, CalendarTimeFilter, CalendarType } from '../wd-calendar-view/types'
import type { FormItemRule } from '../wd-form/types' import type { FormItemRule } from '../wd-form/types'
const now = new Date()
const defaultMinDate = new Date(now.getFullYear(), now.getMonth() - 6, now.getDate()).getTime()
const defaultMaxDate = new Date(now.getFullYear(), now.getMonth() + 6, now.getDate(), 23, 59, 59).getTime()
export const calendarProps = { export const calendarProps = {
...baseProps, ...baseProps,
/** /**
@ -25,11 +29,11 @@ export const calendarProps = {
/** /**
* 13 * 13
*/ */
minDate: makeNumberProp(new Date(new Date().getFullYear(), new Date().getMonth() - 6, new Date().getDate()).getTime()), minDate: makeNumberProp(defaultMinDate),
/** /**
* 13 * 13
*/ */
maxDate: makeNumberProp(new Date(new Date().getFullYear(), new Date().getMonth() + 6, new Date().getDate(), 23, 59, 59).getTime()), maxDate: makeNumberProp(defaultMaxDate),
/** /**
* *
*/ */

View File

@ -29,7 +29,7 @@ export default {
</script> </script>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, getCurrentInstance, onBeforeMount, onMounted, onUnmounted, ref, watch } from 'vue' import { computed, getCurrentInstance, onBeforeMount, onMounted, onUnmounted, ref, watch } from 'vue'
import { addUnit, isObj, objToStyle, uuid } from '../common/util' import { addUnit, isObj, objToStyle, uuid, getSystemInfo } from '../common/util'
import { circleProps } from './types' import { circleProps } from './types'
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
import { canvas2dAdapter } from '../common/canvasHelper' import { canvas2dAdapter } from '../common/canvasHelper'
@ -115,7 +115,7 @@ watch(
) )
onBeforeMount(() => { onBeforeMount(() => {
pixelRatio.value = uni.getSystemInfoSync().pixelRatio pixelRatio.value = getSystemInfo().pixelRatio
}) })
onMounted(() => { onMounted(() => {

View File

@ -3,6 +3,10 @@ import { baseProps, makeArrayProp, makeBooleanProp, makeNumberProp, makeRequired
import type { DateTimeType, DatetimePickerViewFilter, DatetimePickerViewFormatter } from '../wd-datetime-picker-view/types' import type { DateTimeType, DatetimePickerViewFilter, DatetimePickerViewFormatter } from '../wd-datetime-picker-view/types'
import type { FormItemRule } from '../wd-form/types' import type { FormItemRule } from '../wd-form/types'
const now = new Date()
const defaultMinDate = new Date(now.getFullYear() - 10, 0, 1).getTime()
const defaultMaxDate = new Date(now.getFullYear() + 10, 11, 31, 23, 59, 59).getTime()
export const datetimePickerProps = { export const datetimePickerProps = {
...baseProps, ...baseProps,
/** /**
@ -96,11 +100,11 @@ export const datetimePickerProps = {
/** /**
* *
*/ */
minDate: makeNumberProp(new Date(new Date().getFullYear() - 10, 0, 1).getTime()), minDate: makeNumberProp(defaultMinDate),
/** /**
* *
*/ */
maxDate: makeNumberProp(new Date(new Date().getFullYear() + 10, 11, 31, 23, 59, 59).getTime()), maxDate: makeNumberProp(defaultMaxDate),
/** /**
* time类型时生效 * time类型时生效
*/ */

View File

@ -47,7 +47,7 @@ export default {
import { computed, getCurrentInstance, inject, onBeforeMount, ref, watch } from 'vue' import { computed, getCurrentInstance, inject, onBeforeMount, ref, watch } from 'vue'
import { closeOther } from '../common/clickoutside' import { closeOther } from '../common/clickoutside'
import { type Queue, queueKey } from '../composables/useQueue' import { type Queue, queueKey } from '../composables/useQueue'
import { getRect, uuid } from '../common/util' import { getRect, getSystemInfo, uuid } from '../common/util'
import { useChildren } from '../composables/useChildren' import { useChildren } from '../composables/useChildren'
import { DROP_MENU_KEY, dropMenuProps } from './types' import { DROP_MENU_KEY, dropMenuProps } from './types'
import wdOverlay from '../wd-overlay/wd-overlay.vue' import wdOverlay from '../wd-overlay/wd-overlay.vue'
@ -104,7 +104,7 @@ watch(
) )
onBeforeMount(() => { onBeforeMount(() => {
windowHeight.value = uni.getSystemInfoSync().windowHeight windowHeight.value = getSystemInfo().windowHeight
}) })
function noop() {} function noop() {}

View File

@ -44,7 +44,7 @@ import wdButton from '../wd-button/wd-button.vue'
import wdIcon from '../wd-icon/wd-icon.vue' import wdIcon from '../wd-icon/wd-icon.vue'
import wdTransition from '../wd-transition/wd-transition.vue' import wdTransition from '../wd-transition/wd-transition.vue'
import { type CSSProperties, computed, ref, watch, inject, getCurrentInstance, onBeforeUnmount, onMounted, nextTick } from 'vue' import { type CSSProperties, computed, ref, watch, inject, getCurrentInstance, onBeforeUnmount, onMounted, nextTick } from 'vue'
import { getRect, isDef, isH5, objToStyle } from '../common/util' import { getRect, getSystemInfo, isDef, isH5, objToStyle } from '../common/util'
import { type Queue, queueKey } from '../composables/useQueue' import { type Queue, queueKey } from '../composables/useQueue'
import { closeOther, pushToQueue, removeFromQueue } from '../common/clickoutside' import { closeOther, pushToQueue, removeFromQueue } from '../common/clickoutside'
import { fabProps, type FabExpose } from './types' import { fabProps, type FabExpose } from './types'
@ -103,7 +103,7 @@ const bounding = reactive({
}) })
async function getBounding() { async function getBounding() {
const sysInfo = uni.getSystemInfoSync() const sysInfo = getSystemInfo()
try { try {
const trigerInfo = await getRect('#trigger', false, proxy) const trigerInfo = await getRect('#trigger', false, proxy)
fabSize.width = trigerInfo.width || 56 fabSize.width = trigerInfo.width || 56

View File

@ -37,7 +37,7 @@ export default {
<script lang="ts" setup> <script lang="ts" setup>
import { computed, onBeforeMount, ref, watch, type CSSProperties } from 'vue' import { computed, onBeforeMount, ref, watch, type CSSProperties } from 'vue'
import { floatingPanelProps } from './type' import { floatingPanelProps } from './type'
import { addUnit, closest, objToStyle } from '../common/util' import { addUnit, closest, getSystemInfo, objToStyle } from '../common/util'
import { useTouch } from '../composables/useTouch' import { useTouch } from '../composables/useTouch'
const touch = useTouch() const touch = useTouch()
@ -130,7 +130,7 @@ watch(
) )
onBeforeMount(() => { onBeforeMount(() => {
const { windowHeight: _windowHeight } = uni.getSystemInfoSync() const { windowHeight: _windowHeight } = getSystemInfo()
windowHeight.value = _windowHeight windowHeight.value = _windowHeight
}) })
</script> </script>

View File

@ -80,7 +80,7 @@ export default {
import wdIcon from '../wd-icon/wd-icon.vue' import wdIcon from '../wd-icon/wd-icon.vue'
import wdButton from '../wd-button/wd-button.vue' import wdButton from '../wd-button/wd-button.vue'
import { computed, getCurrentInstance, ref, watch } from 'vue' import { computed, getCurrentInstance, ref, watch } from 'vue'
import { addUnit, objToStyle, uuid } from '../common/util' import { addUnit, getSystemInfo, objToStyle, uuid } from '../common/util'
import { useTranslate } from '../composables/useTranslate' import { useTranslate } from '../composables/useTranslate'
import { imgCropperProps, type ImgCropperExpose } from './types' import { imgCropperProps, type ImgCropperExpose } from './types'
@ -132,11 +132,11 @@ const imgScale = ref<number>(1)
// imgWidth: null, // imgWidth: null,
// imgHeight: null, // imgHeight: null,
// //
const imgLeft = ref<number>(uni.getSystemInfoSync().windowWidth / 2) const imgLeft = ref<number>(getSystemInfo().windowWidth / 2)
const imgTop = ref<number>((uni.getSystemInfoSync().windowHeight / 2) * TOP_PERCENT) const imgTop = ref<number>((getSystemInfo().windowHeight / 2) * TOP_PERCENT)
const imgInfo = ref<UniApp.GetImageInfoSuccessData | null>(null) const imgInfo = ref<UniApp.GetImageInfoSuccessData | null>(null)
const info = ref<UniApp.GetSystemInfoResult>(uni.getSystemInfoSync()) const info = ref(getSystemInfo())
// //
const IS_TOUCH_END = ref<boolean>(true) const IS_TOUCH_END = ref<boolean>(true)
@ -164,7 +164,7 @@ watch(
if (newValue) { if (newValue) {
INIT_IMGWIDTH = props.imgWidth INIT_IMGWIDTH = props.imgWidth
INIT_IMGHEIGHT = props.imgHeight INIT_IMGHEIGHT = props.imgHeight
info.value = uni.getSystemInfoSync() info.value = getSystemInfo()
// aspectRatio // aspectRatio
const [widthRatio, heightRatio] = props.aspectRatio.split(':').map(Number) const [widthRatio, heightRatio] = props.aspectRatio.split(':').map(Number)
@ -305,7 +305,7 @@ function setRoate(angle: number) {
* 初始化图片的大小和角度以及距离 * 初始化图片的大小和角度以及距离
*/ */
function resetImg() { function resetImg() {
const { windowHeight, windowWidth } = uni.getSystemInfoSync() const { windowHeight, windowWidth } = getSystemInfo()
imgScale.value = 1 imgScale.value = 1
imgAngle.value = 0 imgAngle.value = 0
imgLeft.value = windowWidth / 2 imgLeft.value = windowWidth / 2

View File

@ -44,7 +44,7 @@ export default {
<script lang="ts" setup> <script lang="ts" setup>
import wdIcon from '../wd-icon/wd-icon.vue' import wdIcon from '../wd-icon/wd-icon.vue'
import { type CSSProperties, computed, getCurrentInstance, nextTick, onMounted, ref, watch } from 'vue' import { type CSSProperties, computed, getCurrentInstance, nextTick, onMounted, ref, watch } from 'vue'
import { getRect, addUnit, isDef, objToStyle } from '../common/util' import { getRect, addUnit, isDef, objToStyle, getSystemInfo } from '../common/util'
import { navbarProps } from './types' import { navbarProps } from './types'
const props = defineProps(navbarProps) const props = defineProps(navbarProps)
@ -52,7 +52,7 @@ const emit = defineEmits(['click-left', 'click-right'])
const height = ref<number | ''>('') // const height = ref<number | ''>('') //
const { statusBarHeight } = uni.getSystemInfoSync() const { statusBarHeight } = getSystemInfo()
watch( watch(
[() => props.fixed, () => props.placeholder], [() => props.fixed, () => props.placeholder],

View File

@ -84,6 +84,7 @@ import wdTransition from '../wd-transition/wd-transition.vue'
import wdRootPortal from '../wd-root-portal/wd-root-portal.vue' import wdRootPortal from '../wd-root-portal/wd-root-portal.vue'
import { popupProps } from './types' import { popupProps } from './types'
import type { TransitionName } from '../wd-transition/types' import type { TransitionName } from '../wd-transition/types'
import { getSystemInfo } from '../common/util'
const props = defineProps(popupProps) const props = defineProps(popupProps)
const emit = defineEmits([ const emit = defineEmits([
@ -135,7 +136,7 @@ const rootClass = computed(() => {
onBeforeMount(() => { onBeforeMount(() => {
if (props.safeAreaInsetBottom) { if (props.safeAreaInsetBottom) {
const { safeArea, screenHeight, safeAreaInsets } = uni.getSystemInfoSync() const { safeArea, screenHeight, safeAreaInsets } = getSystemInfo()
if (safeArea) { if (safeArea) {
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN

View File

@ -69,7 +69,7 @@ export default {
</script> </script>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, getCurrentInstance, onBeforeMount, onMounted, reactive, ref, watch, type CSSProperties } from 'vue' import { computed, getCurrentInstance, onBeforeMount, onMounted, reactive, ref, watch, type CSSProperties } from 'vue'
import { addUnit, getRect, isDef, objToStyle, uuid } from '../common/util' import { addUnit, getRect, getSystemInfo, isDef, objToStyle, uuid } from '../common/util'
import { signatureProps, type SignatureExpose, type SignatureResult, type Point, type Line } from './types' import { signatureProps, type SignatureExpose, type SignatureResult, type Point, type Line } from './types'
import { useTranslate } from '../composables/useTranslate' import { useTranslate } from '../composables/useTranslate'
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
@ -502,7 +502,7 @@ onMounted(() => {
onBeforeMount(() => { onBeforeMount(() => {
// #ifdef MP // #ifdef MP
pixelRatio.value = uni.getSystemInfoSync().pixelRatio pixelRatio.value = getSystemInfo().pixelRatio
// #endif // #endif
}) })

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: weisheng * @Author: weisheng
* @Date: 2023-04-05 21:32:56 * @Date: 2023-04-05 21:32:56
* @LastEditTime: 2025-04-28 19:41:17 * @LastEditTime: 2025-10-31 13:46:23
* @LastEditors: weisheng * @LastEditors: weisheng
* @Description: 水印组件 * @Description: 水印组件
* @FilePath: /wot-design-uni/src/uni_modules/wot-design-uni/components/wd-watermark/wd-watermark.vue * @FilePath: /wot-design-uni/src/uni_modules/wot-design-uni/components/wd-watermark/wd-watermark.vue
@ -32,7 +32,7 @@ export default {
<script lang="ts" setup> <script lang="ts" setup>
import { computed, onMounted, ref, watch, nextTick, type CSSProperties } from 'vue' import { computed, onMounted, ref, watch, nextTick, type CSSProperties } from 'vue'
import { addUnit, buildUrlWithParams, isBase64Image, objToStyle, uuid } from '../common/util' import { addUnit, buildUrlWithParams, getSystemInfo, isBase64Image, objToStyle, uuid } from '../common/util'
import { watermarkProps } from './types' import { watermarkProps } from './types'
const props = defineProps(watermarkProps) const props = defineProps(watermarkProps)
@ -48,7 +48,7 @@ watch(
const canvasId = ref<string>(`water${uuid()}`) // canvas const canvasId = ref<string>(`water${uuid()}`) // canvas
const waterMarkUrl = ref<string>('') // canvasbase64 const waterMarkUrl = ref<string>('') // canvasbase64
const canvasOffScreenable = ref<boolean>(uni.canIUse('createOffscreenCanvas') && Boolean(uni.createOffscreenCanvas)) // 使canvas const canvasOffScreenable = ref<boolean>(uni.canIUse('createOffscreenCanvas') && Boolean(uni.createOffscreenCanvas)) // 使canvas
const pixelRatio = ref<number>(uni.getSystemInfoSync().pixelRatio) // const pixelRatio = ref<number>(getSystemInfo().pixelRatio) //
const canvasHeight = ref<number>((props.height + props.gutterY) * pixelRatio.value) // canvas const canvasHeight = ref<number>((props.height + props.gutterY) * pixelRatio.value) // canvas
const canvasWidth = ref<number>((props.width + props.gutterX) * pixelRatio.value) // canvas const canvasWidth = ref<number>((props.width + props.gutterX) * pixelRatio.value) // canvas
const showCanvas = ref<boolean>(true) // canvas const showCanvas = ref<boolean>(true) // canvas