测试判断ios和android

This commit is contained in:
2025-07-16 09:02:45 +08:00
parent 58807eb0da
commit a9f7d9a962
2 changed files with 12 additions and 2 deletions
+10 -1
View File
@@ -116,7 +116,16 @@ export const getUserInfo = (key = '') => {
const userInfo = uni.getStorageSync('userInfo')
return '' === key ? userInfo : userInfo[key];
}
export const getPhoneEnvBool = (flag) => _ENV.VITE_APP_ENV === flag
export const getPhoneEnvBool = (flag) => {
const {platform} = uni.getSystemInfoSync();
if (platform === 'ios') {
return flag === 'IOS'
} else if (platform === 'android') {
return flag === 'AND'
} else {
return false
}
}
// 将对象和字符串相互转换
+2 -1
View File
@@ -60,7 +60,7 @@ import { encryptByAES } from '@/api/encryptAndDecryptData.js';
import { useSocketStore } from '@/store/socket.js';
import { storeToRefs } from 'pinia';
import {getPhoneEnvBool} from '@/common/common.js'
const socketStore = useSocketStore();
const { taskSocket } = storeToRefs(socketStore);
@@ -147,6 +147,7 @@ onMounted(() => {
back_state.value = true;
const systemInfo = uni.getSystemInfoSync();
console.log(systemInfo);
console.log(getPhoneEnvBool('IOS'));
});
// 跳进了登录页,禁止返回操作
onBackPress(() => back_state.value);