reactor:getSystemInfoSync =》 getWindowInfo,解决 device

pull/147/head
YunaiV 2025-04-29 20:38:50 +08:00
parent 9582d5944e
commit c95f621144
7 changed files with 16 additions and 22 deletions

View File

@ -11,9 +11,6 @@
</template> </template>
<script setup> <script setup>
import sheep from '@/sheep';
const { safeAreaInsets } = sheep.$platform.device;
const props = defineProps({ const props = defineProps({
content: { content: {
type: String, type: String,

View File

@ -45,7 +45,7 @@
import { onPageScroll } from '@dcloudio/uni-app'; import { onPageScroll } from '@dcloudio/uni-app';
import sheep from '@/sheep'; import sheep from '@/sheep';
import throttle from '@/sheep/helper/throttle.js'; import throttle from '@/sheep/helper/throttle.js';
import { showMenuTools, closeMenuTools } from '@/sheep/hooks/useModal'; import { showMenuTools } from '@/sheep/hooks/useModal';
const sys_statusBar = sheep.$platform.device.statusBarHeight; const sys_statusBar = sheep.$platform.device.statusBarHeight;
const sys_navBar = sheep.$platform.navbar; const sys_navBar = sheep.$platform.navbar;
@ -98,7 +98,8 @@
function getCommentCardNode() { function getCommentCardNode() {
return new Promise((res, rej) => { return new Promise((res, rej) => {
uni.createSelectorQuery() uni
.createSelectorQuery()
.select('.detail-comment-selector') .select('.detail-comment-selector')
.boundingClientRect((data) => { .boundingClientRect((data) => {
if (data) { if (data) {

View File

@ -47,13 +47,6 @@ export function sleep(value = 30) {
export function os() { export function os() {
return uni.getDeviceInfo().platform.toLowerCase(); return uni.getDeviceInfo().platform.toLowerCase();
} }
/**
* @description 获取系统信息同步接口
* @link 获取系统信息同步接口 https://uniapp.dcloud.io/api/system/info?id=getsysteminfosync
*/
export function sys() {
return uni.getSystemInfoSync();
}
/** /**
* @description 取一个区间数 * @description 取一个区间数
@ -679,7 +672,6 @@ export default {
getPx, getPx,
sleep, sleep,
os, os,
sys,
random, random,
guid, guid,
$parent, $parent,

View File

@ -18,7 +18,7 @@ import apple from './provider/apple';
import share from './share'; import share from './share';
import Pay from './pay'; import Pay from './pay';
const device = uni.getSystemInfoSync(); const device = uni.getWindowInfo();
const os = uni.getDeviceInfo().platform; const os = uni.getDeviceInfo().platform;

View File

@ -5,7 +5,7 @@
</template> </template>
<script> <script>
import { deepMerge, addStyle, addUnit, sleep, guid, getPx, os, sys } from '@/sheep/helper'; import { deepMerge, addStyle, addUnit, guid, getPx, os } from '@/sheep/helper';
import sheep from '@/sheep'; import sheep from '@/sheep';
/** /**
* sticky 吸顶 * sticky 吸顶
@ -130,7 +130,8 @@
}, },
$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) => {
@ -194,7 +195,7 @@
// #endif // #endif
// 8.0css sticky(7sticky) // 8.0css sticky(7sticky)
if (os() === 'android' && Number(sys().system) > 8) { if (os() === 'android' && Number(uni.getDeviceInfo().system) > 8) {
this.cssSticky = true; this.cssSticky = true;
} }
@ -218,7 +219,8 @@
// //
// #ifdef APP-VUE || MP-WEIXIN // #ifdef APP-VUE || MP-WEIXIN
return new Promise((resolve) => { return new Promise((resolve) => {
uni.createSelectorQuery() uni
.createSelectorQuery()
.in(this) .in(this)
.select('.u-sticky') .select('.u-sticky')
.fields({ .fields({

View File

@ -64,7 +64,7 @@
</block> </block>
</view> </view>
</view> </view>
<!-- 富文本 --> <!-- 富文本 -->
<!-- #ifdef H5 || ((MP-WEIXIN || MP-QQ || APP-PLUS || MP-360) && VUE2) --> <!-- #ifdef H5 || ((MP-WEIXIN || MP-QQ || APP-PLUS || MP-360) && VUE2) -->
<rich-text v-else-if="!n.c&&!handler.isInline(n.name, n.attrs.style)" :id="n.attrs.id" :style="n.f" :user-select="opts[4]" :nodes="[n]" /> <rich-text v-else-if="!n.c&&!handler.isInline(n.name, n.attrs.style)" :id="n.attrs.id" :style="n.f" :user-select="opts[4]" :nodes="[n]" />
@ -125,7 +125,7 @@ export default {
return { return {
ctrl: {}, ctrl: {},
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
isiOS: uni.getSystemInfoSync().system.includes('iOS') isiOS: uni.getDeviceInfo().system.includes('iOS')
// #endif // #endif
} }
}, },

View File

@ -77,11 +77,13 @@ const config = {
} }
const tagSelector={} const tagSelector={}
const { const {
windowWidth,
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
system system
// #endif // #endif
} = uni.getSystemInfoSync() } = uni.getDeviceInfo()
const {
windowWidth
} = uni.getWindowInfo()
const blankChar = makeMap(' ,\r,\n,\t,\f') const blankChar = makeMap(' ,\r,\n,\t,\f')
let idIndex = 0 let idIndex = 0