EASYAIuniappNewUI/dist/dev/mp-weixin/stores/appStore.js
2025-02-08 18:50:38 +08:00

49 lines
1.3 KiB
JavaScript

"use strict";
const common_vendor = require("../common/vendor.js");
const composables_useCommon = require("../composables/useCommon.js");
const useAppStore = common_vendor.defineStore("app", {
state: () => ({
showExecuting: false,
//显示任务正在执行的得进度提示
workflows_all: [],
//所有的工作流
home_tagActiveIndex: 0,
//首页激活的tag编号
home_tagsList: [],
tabbarIndex: 0,
//底部菜单栏的index
user: {},
localTasks: [],
//本地的任务
// 展示支付页面
showPay: false
}),
actions: {
init() {
this.getUser();
},
toggleShowExecuting() {
this.showExecuting = !this.showExecuting;
},
async initWorkFlows_All() {
this.workflows_all = await composables_useCommon.getApps();
},
setUser(user) {
this.user = { ...this.user, ...user };
common_vendor.index.setStorageSync("user", JSON.stringify(this.user));
},
clearUser() {
this.user = {};
common_vendor.index.removeStorageSync("user");
},
getUser() {
const userString = common_vendor.index.getStorageSync("user");
if (userString) {
this.user = JSON.parse(userString);
}
return this.user;
}
}
});
exports.useAppStore = useAppStore;