reactor:osName 的获取,从 getSystemInfoSync 迁移到 getDeviceInfo

reactor:pixelRatio/windowHeight/windowWidth 的获取,从 getSystemInfoSync 迁移到 getWindowInfo
pull/147/head
YunaiV 2025-04-29 20:13:18 +08:00
parent 04bb5e65d3
commit 82aada5ecd
8 changed files with 21 additions and 22 deletions

View File

@ -72,7 +72,7 @@
</template> </template>
<script> <script>
import { deepMerge, addStyle, addUnit, sleep, getPx, sys } from '@/sheep/helper'; import { deepMerge, addStyle, addUnit, sleep, getPx } from '@/sheep/helper';
// #ifdef APP-NVUE // #ifdef APP-NVUE
const animation = uni.requireNativePlugin('animation'); const animation = uni.requireNativePlugin('animation');
const dom = uni.requireNativePlugin('dom'); const dom = uni.requireNativePlugin('dom');
@ -221,7 +221,8 @@
methods: { methods: {
$uGetRect(selector, all) { $uGetRect(selector, all) {
return new Promise((resolve) => { return new Promise((resolve) => {
uni.createSelectorQuery() uni
.createSelectorQuery()
.in(this) .in(this)
[all ? 'selectAll' : 'select'](selector) [all ? 'selectAll' : 'select'](selector)
.boundingClientRect((rect) => { .boundingClientRect((rect) => {
@ -301,7 +302,7 @@
return total + curr.rect.width; return total + curr.rect.width;
}, 0); }, 0);
// //
const windowWidth = sys().windowWidth; const windowWidth = uni.getWindowInfo().windowWidth;
// tabs-itemscroll-view // tabs-itemscroll-view
let scrollLeft = let scrollLeft =
offsetLeft - offsetLeft -

View File

@ -60,7 +60,7 @@
} }
}, },
dpr() { dpr() {
return this.pixelRatio || uni.getSystemInfoSync().pixelRatio; return this.pixelRatio || uni.getWindowInfo().pixelRatio;
}, },
boardWidth() { boardWidth() {
const {width = 0} = (this.elements && this.elements.css) || this.elements || this const {width = 0} = (this.elements && this.elements.css) || this.elements || this

View File

@ -6,16 +6,13 @@ import {
networkReg networkReg
} from './utils'; } from './utils';
const dom = weex.requireModule('dom') const dom = weex.requireModule('dom')
import {
version
} from '../../package.json'
export default { export default {
data() { data() {
return { return {
tempFilePath: [], tempFilePath: [],
isInitFile: false, isInitFile: false,
osName: uni.getSystemInfoSync().osName osName: uni.getDeviceInfo().osName
} }
}, },
methods: { methods: {

View File

@ -3,7 +3,8 @@ export const isBase64 = (path) => /^data:image\/(\w+);base64/.test(path);
export function sleep(delay) { export function sleep(delay) {
return new Promise(resolve => setTimeout(resolve, delay)) return new Promise(resolve => setTimeout(resolve, delay))
} }
let {platform, SDKVersion} = uni.getSystemInfoSync() let platform = uni.getDeviceInfo().platform
let SDKVersion = uni.getSystemInfoSync().SDKVersion
export const isPC = /windows|mac/.test(platform) export const isPC = /windows|mac/.test(platform)
// 缓存图片 // 缓存图片
let cache = {} let cache = {}
@ -316,7 +317,7 @@ export function getImageInfo(path, useCORS) {
// #ifdef APP-PLUS // #ifdef APP-PLUS
// console.log('getImageInfo', +new Date() - time) // console.log('getImageInfo', +new Date() - time)
// ios 比较严格 可能需要设置跨域 // ios 比较严格 可能需要设置跨域
if(uni.getSystemInfoSync().osName == 'ios' && useCORS) { if(uni.getDeviceInfo().osName === 'ios' && useCORS) {
pathToBase64(image.path).then(base64 => { pathToBase64(image.path).then(base64 => {
image.path = base64 image.path = base64
cache[path] = image cache[path] = image

View File

@ -432,7 +432,7 @@
mounted() { mounted() {
// #ifdef APP-NVUE // #ifdef APP-NVUE
const res = uni.getSystemInfoSync(); const res = uni.getWindowInfo();
this.fixNvueBug = { this.fixNvueBug = {
top: res.windowHeight / 2, top: res.windowHeight / 2,
left: res.windowWidth / 2 left: res.windowWidth / 2

View File

@ -473,7 +473,7 @@
right.setDate(this.$refs.right.nowDate.fullDate) right.setDate(this.$refs.right.nowDate.fullDate)
}, },
platform() { platform() {
const systemInfo = uni.getSystemInfoSync() const systemInfo = uni.getWindowInfo()
this.isPhone = systemInfo.windowWidth <= 500 this.isPhone = systemInfo.windowWidth <= 500
this.windowWidth = systemInfo.windowWidth this.windowWidth = systemInfo.windowWidth
}, },

View File

@ -13,7 +13,7 @@
} }
}, },
mounted() { mounted() {
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px' this.statusBarHeight = uni.getWindowInfo().statusBarHeight + 'px'
} }
} }
</script> </script>

View File

@ -187,7 +187,7 @@
// #endif // #endif
// #ifdef APP-NVUE // #ifdef APP-NVUE
dom.getComponentRect(this.$refs['animationEle'], (res) => { dom.getComponentRect(this.$refs['animationEle'], (res) => {
let winWidth = uni.getSystemInfoSync().windowWidth let winWidth = uni.getWindowInfo().windowWidth
this.textWidth = res.size.width this.textWidth = res.size.width
animation.transition(this.$refs['animationEle'], { animation.transition(this.$refs['animationEle'], {
styles: { styles: {