@@ -4,8 +4,18 @@ | |||||
</style> | </style> | ||||
<script setup> | <script setup> | ||||
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app"; | import { onLaunch, onShow, onHide } from "@dcloudio/uni-app"; | ||||
import { userInfoModules } from "@/store/modules/userInfo"; | |||||
const userInfoModulesPinia = userInfoModules(); | |||||
onLaunch(() => { | onLaunch(() => { | ||||
console.log("App Launch!"); | console.log("App Launch!"); | ||||
// 获取平台及系统信息 | |||||
uni.getSystemInfo({ | |||||
success: function (res) { | |||||
userInfoModulesPinia.equipment = res.uniPlatform; //平台 | |||||
userInfoModulesPinia.mySystem = res.osName; //应用 | |||||
}, | |||||
}); | |||||
}); | }); | ||||
onShow(() => { | onShow(() => { | ||||
console.log("App Show!"); | console.log("App Show!"); | ||||
@@ -53,7 +53,9 @@ | |||||
//#region 导入 | //#region 导入 | ||||
import { ref, reactive } from "vue"; | import { ref, reactive } from "vue"; | ||||
import { voiceTotalApi } from "../../api/login.js"; | import { voiceTotalApi } from "../../api/login.js"; | ||||
import { userInfoModules } from "@/store/modules/userInfo"; | |||||
//#endregion | //#endregion | ||||
const userInfoModulesPinia = userInfoModules(); | |||||
//#region 上传 | //#region 上传 | ||||
const uploadState = ref(3); //上传状态 | const uploadState = ref(3); //上传状态 | ||||
@@ -89,7 +91,7 @@ function toCloseStyle() { | |||||
}); | }); | ||||
} | } | ||||
} | } | ||||
console.log(userInfoModulesPinia.mySystem, "XT"); | |||||
//#endregion --------------------- | //#endregion --------------------- | ||||
//#region | //#region | ||||
@@ -1,8 +1,10 @@ | |||||
import { defineStore } from "pinia"; | import { defineStore } from "pinia"; | ||||
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 | |||||
// 登录获取用户信息 | // 登录获取用户信息 | ||||
async function getUserInfo() { | async function getUserInfo() { | ||||
@@ -12,7 +14,7 @@ export const userInfoModules = defineStore("userInfoStore", () => { | |||||
function loginOut(params) { | function loginOut(params) { | ||||
} | } | ||||
return { userInfo, getUserInfo, loginOut }; | |||||
return { userInfo, equipment, mySystem, getUserInfo, loginOut }; | |||||
}, | }, | ||||
{ | { | ||||
persist: true, | persist: true, |