|
|
@ -2,10 +2,10 @@
|
|
|
|
* @Author: ch
|
|
|
|
* @Author: ch
|
|
|
|
* @Date: 2022-05-04 20:35:20
|
|
|
|
* @Date: 2022-05-04 20:35:20
|
|
|
|
* @LastEditors: ch
|
|
|
|
* @LastEditors: ch
|
|
|
|
* @LastEditTime: 2022-05-07 22:33:28
|
|
|
|
* @LastEditTime: 2022-06-09 18:50:16
|
|
|
|
* @Description: file content
|
|
|
|
* @Description: file content
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
import { TOKEN_KEY } from "@/constants";
|
|
|
|
import { TOKEN_KEY,UUID_KEY } from "@/constants";
|
|
|
|
import { ApiGetCurrentUser, ApiPostLogout } from "@/plugins/api/account";
|
|
|
|
import { ApiGetCurrentUser, ApiPostLogout } from "@/plugins/api/account";
|
|
|
|
import { ApiGetCartList } from "@/plugins/api/cart";
|
|
|
|
import { ApiGetCartList } from "@/plugins/api/cart";
|
|
|
|
import { ApiGetCategoryOneList } from "@/plugins/api/goods";
|
|
|
|
import { ApiGetCategoryOneList } from "@/plugins/api/goods";
|
|
|
@ -13,6 +13,7 @@ const ONE_DAY = 86400000; // 一天的毫秒数 24 * 60 * 60 * 1000;
|
|
|
|
|
|
|
|
|
|
|
|
const state = () => ({
|
|
|
|
const state = () => ({
|
|
|
|
token: "",
|
|
|
|
token: "",
|
|
|
|
|
|
|
|
uuid : '',
|
|
|
|
userInfo: {},
|
|
|
|
userInfo: {},
|
|
|
|
loginVisible: false, // 是否展示登录弹窗
|
|
|
|
loginVisible: false, // 是否展示登录弹窗
|
|
|
|
seckillTabVisible: false, // 公共头是否展示秒杀tab
|
|
|
|
seckillTabVisible: false, // 公共头是否展示秒杀tab
|
|
|
@ -25,6 +26,14 @@ const mutations = {
|
|
|
|
setUserInfo(state, info) {
|
|
|
|
setUserInfo(state, info) {
|
|
|
|
state.userInfo = info;
|
|
|
|
state.userInfo = info;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setUUID(state, uuid) {
|
|
|
|
|
|
|
|
state.uuid = uuid;
|
|
|
|
|
|
|
|
this.$cookies.set(UUID_KEY, uuid, {
|
|
|
|
|
|
|
|
path: "/",
|
|
|
|
|
|
|
|
maxAge: ONE_DAY,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
setToken(state, token) {
|
|
|
|
setToken(state, token) {
|
|
|
|
state.token = token;
|
|
|
|
state.token = token;
|
|
|
|
this.$cookies.set(TOKEN_KEY, token, {
|
|
|
|
this.$cookies.set(TOKEN_KEY, token, {
|
|
|
|