Files
Gao xiaosong 728deeaa35 1、购买选择规格属性点不了
2、购物车列表点击管理 点击收藏功能去掉
3、下单点击积分抵扣没反应
4、待收货 列表查看物流点击没反应,详情查看物流可以点
5、添加地址选择地区无效
6、个人中心我的余额点进去点击账单记录一直正在加载中,点击下全部就出来了,应该你没带默认参数
8、订单点击评价没反应
9、小程序订单核销没上 你那边先根据路径判断隐藏下
10、我的推广,里面样式有问题,点击海报里面空白
11、分类点击 会分类Tab页分类一级比一级低
12、拼团详情客服功能隐藏去掉,其他地方有客服功能的都去掉
2020-04-11 01:44:10 +08:00

132 lines
2.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Vue from "vue";
import Vuex from "vuex";
Vue.use(Vuex);
const debug = process.env.NODE_ENV !== "production";
import cookie from "@/utils/store/cookie";
import {
getUserInfo
} from "@/api/user";
import dialog from "@/utils/dialog";
const LOGIN_KEY = "login_status";
const vuexStore = new Vuex.Store({
state: {
// 是否已经在授权页面
isAuthorizationPage: false,
// 是否授权
isAuthorization: false,
// 不建议从这里取 token但是删除掉会影响其他的页面
token: cookie.get(LOGIN_KEY) || null,
userInfo: cookie.get('userInfo'),
$deviceType: null,
},
mutations: {
SHOW_FOOTER(state) {
state.footer = true;
},
HIDE_FOOTER(state) {
state.footer = false;
},
SHOW_HOME(state) {
state.home = true;
},
HIDE_HOME(state) {
state.home = false;
},
OPEN_HOME(state) {
state.homeActive = true;
},
CLOSE_HOME(state) {
state.homeActive = false;
},
CHANGE_TABTAR(state, index) {
state.tabtarIndex = index;
},
LOGIN(state, token, expires_time) {
state.token = token;
cookie.set(LOGIN_KEY, token, expires_time);
},
LOGOUT(state) {
state.token = null;
state.userInfo = null
cookie.clearAll()
},
BACKGROUND_COLOR(state, color) {
state.color = color;
// document.body.style.backgroundColor = color;
},
UPDATE_USERINFO(state, userInfo) {
state.userInfo = userInfo;
},
UPDATE_AUTHORIZATIONPAGE(state, isAuthorizationPage) {
state.isAuthorizationPage = isAuthorizationPage;
},
UPDATE_AUTHORIZATION(state, isAuthorization) {
state.isAuthorization = isAuthorization;
},
UPDATE_DEVICETYPE(state, $deviceType) {
state.$deviceType = $deviceType;
},
},
actions: {
USERINFO({
state,
commit
}, force) {
if (state.userInfo !== null && !force)
return Promise.resolve(state.userInfo);
else
return new Promise(reslove => {
getUserInfo().then(res => {
commit("UPDATE_USERINFO", res.data);
reslove(res.data);
});
}).catch(() => {
dialog.error("获取信息失败!");
});
},
changeLogin({
state,
commit
}, data, date) {
commit("LOGIN", data, date);
},
setUserInfo({
state,
commit
}, user) {
commit("UPDATE_USERINFO", user);
if (user) {
cookie.set('userInfo', user)
} else {
cookie.set('userInfo', null)
}
},
changeAuthorizationPage({
state,
commit
}, index) {
commit("UPDATE_AUTHORIZATIONPAGE", index);
},
changeAuthorization({
state,
commit
}, index) {
commit("UPDATE_AUTHORIZATION", index);
},
},
getters: {
isAuthorizationPage: state => state.isAuthorizationPage,
isAuthorization: state => state.isAuthorization,
token: state => state.token,
isLogin: state => !!state.token,
userInfo: state => state.userInfo || {},
},
strict: debug
});
export default vuexStore