|
-
- 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)
- const wxappid = "wx75cf14e3a0d45821"
- const dyappid = "tt2eba5807b1883f9f01"
- const photoPath = ref(null) //自定义相机拍照得到照片路径
- /**
- * @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) {
-
- // }
- function getAppId() {
- if (platForm.value == 2) {
- return wxappid
- } else if (platForm.value == 3) {
- return dyappid
- }
- }
- return { userInfo, openId, token, myAvatar, myGlod, platForm, hostSystem, wxappid, dyappid, getAppId };
- },
-
- {
- // persist: true
- unistorage: true,
- }
- // persist: {
- // storage: {
- // // getItem: uni.getStorageSync,
- // token: uni.getStorageSync,
- // setItem: uni.setStorageSync
- // }
- // },
-
- );
|