|
@@ -9,7 +9,7 @@ import order from './order/index';
|
|
import invoice from './invoice';
|
|
import invoice from './invoice';
|
|
import { lbsDictionary } from '@/common/js/BaseDictionary';
|
|
import { lbsDictionary } from '@/common/js/BaseDictionary';
|
|
import { updateUnionId } from '@/api/parking/index'
|
|
import { updateUnionId } from '@/api/parking/index'
|
|
-import {backLbsHome, getGroupIdAndMallIdByLsbId} from '@/utils';
|
|
|
|
|
|
+import {backLbsHome, getGroupIdAndMallIdByLsbId, toLogin} from '@/utils';
|
|
// import { parkingLots } from '@/utils/api-crm-ms';
|
|
// import { parkingLots } from '@/utils/api-crm-ms';
|
|
|
|
|
|
Vue.use(Vuex);
|
|
Vue.use(Vuex);
|
|
@@ -342,26 +342,37 @@ const store = new Vuex.Store({
|
|
commit('SET_CUST_TYPE_ID', custTypeId);
|
|
commit('SET_CUST_TYPE_ID', custTypeId);
|
|
commit('SET_GROUP_ID', groupId);
|
|
commit('SET_GROUP_ID', groupId);
|
|
commit('SET_MALL_ID', mallId);
|
|
commit('SET_MALL_ID', mallId);
|
|
- commit('SET_OPENID', openId || uni.getStorageSync('openid'));
|
|
|
|
commit('SET_ACCESS_TOKEN', accessToken);
|
|
commit('SET_ACCESS_TOKEN', accessToken);
|
|
commit('SET_KIP_USER_ID', kipUserId);
|
|
commit('SET_KIP_USER_ID', kipUserId);
|
|
commit('SET_MOBILE', mobile);
|
|
commit('SET_MOBILE', mobile);
|
|
if (unionId) {
|
|
if (unionId) {
|
|
commit('SET_SOURCE_ID', unionId);
|
|
commit('SET_SOURCE_ID', unionId);
|
|
}
|
|
}
|
|
|
|
+ if (openId) {
|
|
|
|
+ commit('SET_OPENID', openId);
|
|
|
|
+ }
|
|
if(isLogin) {
|
|
if(isLogin) {
|
|
commit('SET_IS_LOGIN', isLogin);
|
|
commit('SET_IS_LOGIN', isLogin);
|
|
}
|
|
}
|
|
|
|
+ if(!unionId || unionId ==='undefined') {
|
|
|
|
+ toLogin()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ // 已经登录
|
|
if(isLogin === 'haveLoggedIn') {
|
|
if(isLogin === 'haveLoggedIn') {
|
|
|
|
+ // 如果 openId,为空或者是 undefined ,重新获取 openId
|
|
|
|
+ if(!openId || openId ==='undefined') {
|
|
|
|
+ dispatch('getOpenId')
|
|
|
|
+ }
|
|
dispatch('memberInit', {
|
|
dispatch('memberInit', {
|
|
- openid: openId || uni.getStorageSync('openid'),
|
|
|
|
|
|
+ openid: openId,
|
|
unionId,
|
|
unionId,
|
|
isError: true
|
|
isError: true
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
dispatch('updateUnionIdActive', {
|
|
dispatch('updateUnionIdActive', {
|
|
unionId: unionId,
|
|
unionId: unionId,
|
|
- openId: openId || uni.getStorageSync('openid')
|
|
|
|
|
|
+ openId: openId
|
|
})
|
|
})
|
|
}
|
|
}
|
|
callback && callback();
|
|
callback && callback();
|
|
@@ -402,6 +413,18 @@ const store = new Vuex.Store({
|
|
const member = uni.getStorageSync('member')
|
|
const member = uni.getStorageSync('member')
|
|
return JSON.stringify(member) === '{}'
|
|
return JSON.stringify(member) === '{}'
|
|
},
|
|
},
|
|
|
|
+ async getOpenId({commit}, callback) {
|
|
|
|
+ try {
|
|
|
|
+ const res = await kipGetUserDetail()
|
|
|
|
+ console.log('416 kipGetUserDetail ', res);
|
|
|
|
+ openId = res.data.openId
|
|
|
|
+ commit('SET_OPENID', res.data.openId)
|
|
|
|
+ callback(res.data.openId)
|
|
|
|
+ } catch (err) {
|
|
|
|
+ toLogin()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ },
|
|
// updateUnionId
|
|
// updateUnionId
|
|
async updateUnionIdActive({ commit }, { openId, unionId, vipCode = null }) {
|
|
async updateUnionIdActive({ commit }, { openId, unionId, vipCode = null }) {
|
|
try {
|
|
try {
|