| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import { createStore } from 'vuex';
- import storage from '@/utils/storage';
- const store = createStore({
- state: () => ({
- isShowToast: false, // 是否在展示Toast中
- remark: [], // 填写订单备注
- shareLink: "", // 分享链接
- verificationKey: "", // 获取key表示验证通过
- distributionId: "", // 分销员Id
- hasLogin: storage.getHasLogin(),
- userInfo: storage.getUserInfo(),
- uuid: storage.getUuid(),
- token: "",
- userName: "",
- }),
- mutations: {
- login(state, userInfo) {
- state.userInfo = userInfo || {};
- state.userName =
- userInfo.Name || userInfo.Nickname || userInfo.Username || "匿名用户";
- state.hasLogin = true;
- },
- logout(state) {
- state.userName = "";
- state.hasLogin = false;
- state.userInfo = {};
- },
- // 设置填写订单中备注
- setRemark(state, remark) {
- state.remark = remark;
- },
- },
- actions: {
- // 可在此添加异步登录逻辑
- },
- });
- export default store;
|