|
@@ -34,10 +34,8 @@ const store = new Vuex.Store({
|
|
|
* 是否需要强制登录
|
|
|
*/
|
|
|
forcedLogin: false,
|
|
|
- hasLogin: true,
|
|
|
- openid: "",
|
|
|
+ hasLogin: false,
|
|
|
isOpenLocation: false, // 用户是否开启授权开启定位
|
|
|
- orderStatusList: [], // 服务订单状态数据字典数据
|
|
|
// 如果上面从本地获取的lifeData对象下有对应的属性,就赋值给state中对应的变量
|
|
|
// 加上vuex_前缀,是防止变量名冲突,也让人一目了然
|
|
|
vuex_carBrandList: lifeData.vuex_carBrandList ? lifeData.vuex_carBrandList : [] ,// 车型品牌数据
|
|
@@ -49,25 +47,32 @@ const store = new Vuex.Store({
|
|
|
vuex_shelfChoosePart: [], // 数字货架临配选择配件
|
|
|
vuex_allLookUp: [], // 数据字典
|
|
|
vuex_paymentTypeList: [], // 支付方式
|
|
|
+ vuex_userInfo: null,
|
|
|
+ vuex_openid: ""
|
|
|
},
|
|
|
getters:{
|
|
|
getOpeid(state){
|
|
|
- return state.openid
|
|
|
+ return state.vuex_openid
|
|
|
}
|
|
|
},
|
|
|
mutations: {
|
|
|
- login(state, userInfo) {
|
|
|
+ login(state, data) {
|
|
|
+ console.log(data)
|
|
|
state.hasLogin = true;
|
|
|
- uni.setStorageSync('token', userInfo.token);
|
|
|
- uni.setStorageSync('userInfo', userInfo.user);
|
|
|
+ uni.setStorageSync('token', data.access_token);
|
|
|
+ uni.setStorageSync('userInfo', data.auth_user);
|
|
|
+ state.vuex_userInfo = data.auth_user
|
|
|
},
|
|
|
logout(state) {
|
|
|
state.hasLogin = false;
|
|
|
uni.removeStorageSync('token')
|
|
|
uni.removeStorageSync('userInfo')
|
|
|
+ state.vuex_userInfo = null
|
|
|
},
|
|
|
openId(state,id) {
|
|
|
- state.openid = id
|
|
|
+ console.log(id,'----------')
|
|
|
+ state.vuex_openid = id
|
|
|
+ uni.setStorageSync('openid', id);
|
|
|
},
|
|
|
$uStore(state, payload) {
|
|
|
// 判断是否多层级调用,state中为对象存在的情况,诸如user.info.score = 1
|
|
@@ -92,9 +97,6 @@ const store = new Vuex.Store({
|
|
|
isOpenLocation(state,isOpenLocation){
|
|
|
state.isOpenLocation = isOpenLocation
|
|
|
},
|
|
|
- orderStatusList(state,orderStatusList){
|
|
|
- state.orderStatusList = orderStatusList
|
|
|
- },
|
|
|
},
|
|
|
actions: {
|
|
|
wxLogin(context,provider){
|
|
@@ -106,8 +108,8 @@ const store = new Vuex.Store({
|
|
|
code2Session({
|
|
|
code: result.code
|
|
|
}).then(res => {
|
|
|
+ console.log(res)
|
|
|
if (res.status === '200') {
|
|
|
- uni.setStorageSync('openid', res.data);
|
|
|
context.commit('openId',res.data)
|
|
|
};
|
|
|
});
|
|
@@ -164,12 +166,6 @@ const store = new Vuex.Store({
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // 获取订单状态数据字典
|
|
|
- getOrderStatusList(context,data) {
|
|
|
- getLookUpDatas({type:'ORDER_ON_CALL_STATUS'}).then(res =>{
|
|
|
- context.commit('orderStatusList', res.data || [])
|
|
|
- })
|
|
|
- },
|
|
|
}
|
|
|
})
|
|
|
|