"use strict"; const common_vendor = require("../../common/vendor.js"); common_vendor.defineStore("user", { state: () => { return { token: null, nickname: null, avatar: null, ad: null, adUnitId: null }; }, actions: { /* 记录token */ login(info) { this.$state = info; this.save(); }, /* 个人信息 */ setInfo(info) { this.nickname = info.nickname; this.avatar = info.avatar; }, /* 本地保存 */ save() { common_vendor.index.setStorageSync("userInfo", { token: this.token, nickname: this.nickname, avatar: this.avatar }); } } });