Selaa lähdekoodia

device

master
HolyKnightIX 1 vuosi sitten
vanhempi
commit
7dbaef517b
3 muutettua tiedostoa jossa 47 lisäystä ja 6 poistoa
  1. +27
    -2
      src/App.vue
  2. +1
    -1
      src/pages/uploadPhoto/uploadPhoto.vue
  3. +19
    -3
      src/store/modules/userInfo.js

+ 27
- 2
src/App.vue Näytä tiedosto

@@ -12,8 +12,33 @@ onLaunch(() => {
// 获取平台及系统信息 // 获取平台及系统信息
uni.getSystemInfo({ uni.getSystemInfo({
success: function (res) { success: function (res) {
userInfoModulesPinia.equipment = res.uniPlatform; //平台
userInfoModulesPinia.mySystem = res.osName; //应用
let uniPlatform = "";
let osName = "";
if (res.uniPlatform == "web") {
uniPlatform = 1;
} else if (res.uniPlatform == "mp-weixin") {
uniPlatform = 2;
} else if (res.uniPlatform == "mp-toutiao") {
uniPlatform = 3;
}
if (res.osName == "windows") {
osName = 1;
} else if (res.osName == "ios") {
osName = 2;
} else if (res.osName == "android") {
osName = 3;
} else if (res.osName == "mac") {
osName = 4;
} else if (res.osName == "linux") {
osName = 5;
}
userInfoModulesPinia.platForm = uniPlatform; // 平台
userInfoModulesPinia.hostSystem = osName; // 系统
console.log(res.uniPlatform, uniPlatform, "PlatForm");
console.log(res.osName, osName, "System");
}, },
}); });
}); });


+ 1
- 1
src/pages/uploadPhoto/uploadPhoto.vue Näytä tiedosto

@@ -91,7 +91,7 @@ function toCloseStyle() {
}); });
} }
} }
console.log(userInfoModulesPinia.mySystem, "XT");
console.log(userInfoModulesPinia.hostSystem, "System");
//#endregion --------------------- //#endregion ---------------------
//#region //#region


+ 19
- 3
src/store/modules/userInfo.js Näytä tiedosto

@@ -3,8 +3,24 @@ import { ref, reactive } from "vue";
export const userInfoModules = defineStore("userInfoStore", () => { export const userInfoModules = defineStore("userInfoStore", () => {
// state // state
const userInfo = ref(null) const userInfo = ref(null)
const equipment = ref(null) //平台 : web、mp-weixin、mp-toutiao
const mySystem = ref(null) //安卓和ios : ios、android、windows、macos
/**
* @description:依托平台:(web、mp-weixin、mp-toutiao)
* @example 平台名:web-H5,枚举值:1
* @example 平台名:mp-weixin,枚举值:2
* @example 平台名:mp-toutiao,枚举值:3
*/
const platForm = ref(null)
/**
* @description:宿主系统:(windows、ios、android、mac、linux)
* @example 系统名:windows,值:1
* @example 系统名:ios,值:2
* @example 系统名:android,值:3
* @example 系统名:mac,值:4
* @example 系统名:linux,值:5
*/
const hostSystem = ref(null)
// 登录获取用户信息 // 登录获取用户信息
async function getUserInfo() { async function getUserInfo() {
@@ -14,7 +30,7 @@ export const userInfoModules = defineStore("userInfoStore", () => {
function loginOut(params) { function loginOut(params) {
} }
return { userInfo, equipment, mySystem, getUserInfo, loginOut };
return { userInfo, platForm, hostSystem, getUserInfo, loginOut };
}, },
{ {
persist: true, persist: true,

Ladataan…
Peruuta
Tallenna