|
|
@@ -0,0 +1,58 @@ |
|
|
|
|
|
|
|
import { defineStore } from "pinia"; |
|
|
|
import { ref, reactive } from "vue"; |
|
|
|
|
|
|
|
// import { request } from "../../utils/request" |
|
|
|
/** |
|
|
|
* @description:用户信息持久化数据 |
|
|
|
*/ |
|
|
|
|
|
|
|
export const userInfoModules = defineStore("userInfoStore", () => { |
|
|
|
// state |
|
|
|
const userInfo = ref(null) |
|
|
|
const openId = ref(null) |
|
|
|
const token = ref(null) |
|
|
|
const myAvatar = ref('') |
|
|
|
const myGlod = ref(0) |
|
|
|
/** |
|
|
|
* @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 getMyAvatar() { |
|
|
|
|
|
|
|
// } |
|
|
|
// 退出清除用户信息 |
|
|
|
// async function getMyGlod(params) { |
|
|
|
|
|
|
|
// } |
|
|
|
return { userInfo, openId, token, myAvatar, myGlod, platForm, hostSystem }; |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
// persist: true |
|
|
|
unistorage: true, |
|
|
|
} |
|
|
|
// persist: { |
|
|
|
// storage: { |
|
|
|
// // getItem: uni.getStorageSync, |
|
|
|
// token: uni.getStorageSync, |
|
|
|
// setItem: uni.setStorageSync |
|
|
|
// } |
|
|
|
// }, |
|
|
|
|
|
|
|
); |