| xqd
@@ -1,175 +1,183 @@
|
|
|
import user from '../../core/user.js';
|
|
|
|
|
|
const state = {
|
|
|
- accessToken: null,
|
|
|
- info: null,
|
|
|
- showLoginModal: false,
|
|
|
- tempParentId: 0,
|
|
|
- showAttention: false,
|
|
|
- showAttentionTwo:false,
|
|
|
- sign: {
|
|
|
- mobile: '',
|
|
|
- pic_captcha: '',
|
|
|
- sms_captcha: '',
|
|
|
- validate_code_id: -1
|
|
|
- },
|
|
|
- isSign: false,
|
|
|
-
|
|
|
- selectedProperties:{
|
|
|
- name:'绑定楼盘'
|
|
|
- },
|
|
|
-
|
|
|
- isEnterSales:false,//是否进入销售端
|
|
|
+ accessToken: null,
|
|
|
+ info: null,
|
|
|
+ showLoginModal: false,
|
|
|
+ tempParentId: 0,
|
|
|
+ cart_nums: 0,
|
|
|
+ showAttention: false,
|
|
|
+ showAttentionTwo: false,
|
|
|
+ sign: {
|
|
|
+ mobile: '',
|
|
|
+ pic_captcha: '',
|
|
|
+ sms_captcha: '',
|
|
|
+ validate_code_id: -1
|
|
|
+ },
|
|
|
+ isSign: false,
|
|
|
+
|
|
|
+ selectedProperties: {
|
|
|
+ name: '绑定楼盘'
|
|
|
+ },
|
|
|
+
|
|
|
+ isEnterSales: false, //是否进入销售端
|
|
|
};
|
|
|
|
|
|
const getters = {
|
|
|
- accessToken(state) {
|
|
|
- return state.accessToken;
|
|
|
- },
|
|
|
- info(state) {
|
|
|
- return state.info;
|
|
|
- },
|
|
|
- showLoginModal(state) {
|
|
|
- return state.showLoginModal;
|
|
|
- },
|
|
|
- tempParentId(state) {
|
|
|
- return state.tempParentId;
|
|
|
- },
|
|
|
- is_vip(state) {
|
|
|
- return state.is_vip_card_user;
|
|
|
- },
|
|
|
- showAttention(state) {
|
|
|
- return state.showAttention;
|
|
|
- },
|
|
|
- showAttentionTwo(state) {
|
|
|
- return state.showAttentionTwo;
|
|
|
- },
|
|
|
- sign(state) {
|
|
|
- return state.sign;
|
|
|
- },
|
|
|
- isSign(state) {
|
|
|
- return state.isSign;
|
|
|
- },
|
|
|
+ accessToken(state) {
|
|
|
+ return state.accessToken;
|
|
|
+ },
|
|
|
+ info(state) {
|
|
|
+ return state.info;
|
|
|
+ },
|
|
|
+ cart_nums(state) {
|
|
|
+ return state.cart_nums;
|
|
|
+ },
|
|
|
+ showLoginModal(state) {
|
|
|
+ return state.showLoginModal;
|
|
|
+ },
|
|
|
+ tempParentId(state) {
|
|
|
+ return state.tempParentId;
|
|
|
+ },
|
|
|
+ is_vip(state) {
|
|
|
+ return state.is_vip_card_user;
|
|
|
+ },
|
|
|
+ showAttention(state) {
|
|
|
+ return state.showAttention;
|
|
|
+ },
|
|
|
+ showAttentionTwo(state) {
|
|
|
+ return state.showAttentionTwo;
|
|
|
+ },
|
|
|
+ sign(state) {
|
|
|
+ return state.sign;
|
|
|
+ },
|
|
|
+ isSign(state) {
|
|
|
+ return state.isSign;
|
|
|
+ },
|
|
|
getIsEnterSales(state) {
|
|
|
- return state.isEnterSales;
|
|
|
+ return state.isEnterSales;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
const mutations = {
|
|
|
- accessToken(state, data) {
|
|
|
- state.accessToken = data;
|
|
|
- },
|
|
|
- info(state, data) {
|
|
|
- state.info = data;
|
|
|
- },
|
|
|
- showLoginModal(state, data) {
|
|
|
- state.showLoginModal = data;
|
|
|
- },
|
|
|
- tempParentId(state, data) {
|
|
|
- state.tempParentId = data;
|
|
|
- },
|
|
|
- showAttention(state, data) {
|
|
|
- state.showAttention = data;
|
|
|
- },
|
|
|
- showAttentionTwo(state, data) {
|
|
|
- state.showAttentionTwo = data;
|
|
|
- },
|
|
|
- sign(state, data) {
|
|
|
- state.sign = data;
|
|
|
- },
|
|
|
- isSign(state, data) {
|
|
|
- state.isSign = data;
|
|
|
- },
|
|
|
- isEnterSales(state,data) {
|
|
|
- if(data){
|
|
|
- console.log('进入销售端',data)
|
|
|
- }else{
|
|
|
- console.log('退出销售端',data)
|
|
|
+ accessToken(state, data) {
|
|
|
+ state.accessToken = data;
|
|
|
+ },
|
|
|
+ info(state, data) {
|
|
|
+ state.info = data;
|
|
|
+ },
|
|
|
+ cart_nums(state, data) {
|
|
|
+ state.cart_nums = data;
|
|
|
+ },
|
|
|
+ showLoginModal(state, data) {
|
|
|
+ state.showLoginModal = data;
|
|
|
+ },
|
|
|
+ tempParentId(state, data) {
|
|
|
+ state.tempParentId = data;
|
|
|
+ },
|
|
|
+ showAttention(state, data) {
|
|
|
+ state.showAttention = data;
|
|
|
+ },
|
|
|
+ showAttentionTwo(state, data) {
|
|
|
+ state.showAttentionTwo = data;
|
|
|
+ },
|
|
|
+ sign(state, data) {
|
|
|
+ state.sign = data;
|
|
|
+ },
|
|
|
+ isSign(state, data) {
|
|
|
+ state.isSign = data;
|
|
|
+ },
|
|
|
+ isEnterSales(state, data) {
|
|
|
+ if (data) {
|
|
|
+ console.log('进入销售端', data)
|
|
|
+ } else {
|
|
|
+ console.log('退出销售端', data)
|
|
|
}
|
|
|
- state.isEnterSales = data;
|
|
|
+ state.isEnterSales = data;
|
|
|
},
|
|
|
- selectedProperties(state,data){
|
|
|
- state.selectedProperties=data
|
|
|
+ selectedProperties(state, data) {
|
|
|
+ state.selectedProperties = data
|
|
|
}
|
|
|
};
|
|
|
|
|
|
const actions = {
|
|
|
isEnterSales(context, data) {
|
|
|
- context.commit('isEnterSales', data);
|
|
|
- },
|
|
|
- sign(context, data) {
|
|
|
- context.commit('sign', data);
|
|
|
- },
|
|
|
- isSign(context, data) {
|
|
|
- context.commit('isSign', data);
|
|
|
- },
|
|
|
- accessToken(context) {
|
|
|
- if (!user.isLogin()) {
|
|
|
- context.commit('accessToken', null);
|
|
|
- }
|
|
|
- user.getAccessToken().then(accessToken => {
|
|
|
- context.commit('accessToken', accessToken);
|
|
|
- });
|
|
|
- },
|
|
|
- info(context, options) {
|
|
|
- if (!user.isLogin()) {
|
|
|
- context.commit('accessToken', null);
|
|
|
- }
|
|
|
- user.getAccessToken().then(accessToken => {
|
|
|
- context.commit('accessToken', accessToken);
|
|
|
- user.getInfo(options).then(data => {
|
|
|
- context.commit('info', data);
|
|
|
- });
|
|
|
- }).catch((err) => {
|
|
|
- context.commit('showLoginModal', true);
|
|
|
- });
|
|
|
- },
|
|
|
- refreshInfo(context) {
|
|
|
- context.commit('accessToken', null);
|
|
|
- },
|
|
|
- refresh(context) {
|
|
|
- if (!user.isLogin()) {
|
|
|
- context.commit('accessToken', null);
|
|
|
- }
|
|
|
- user.getAccessToken().then(accessToken => {
|
|
|
- context.commit('accessToken', accessToken);
|
|
|
- user.getInfo({
|
|
|
- refresh: true,
|
|
|
- }).then(data => {
|
|
|
- context.commit('info', data);
|
|
|
- }).catch(e => {
|
|
|
- });
|
|
|
- }).catch(e => {
|
|
|
- });
|
|
|
- },
|
|
|
- setTempParentId(context, data) {
|
|
|
- context.commit('tempParentId', data);
|
|
|
- },
|
|
|
- loadAccessTokenFormCache(context) {
|
|
|
- if (context.accessToken) return;
|
|
|
- user.getAccessToken({
|
|
|
- cacheOnly: true,
|
|
|
- }).then(e => {
|
|
|
- if (!e) return;
|
|
|
- context.commit('accessToken', e);
|
|
|
- });
|
|
|
- },
|
|
|
- logout(context) {
|
|
|
- context.commit('accessToken', null);
|
|
|
- user.loginByToken(null);
|
|
|
- },
|
|
|
- showAttention(context, data) {
|
|
|
- context.commit('showAttention', data);
|
|
|
- },
|
|
|
- showAttentionTwo(context, data) {
|
|
|
- context.commit('showAttentionTwo', data);
|
|
|
- }
|
|
|
+ context.commit('isEnterSales', data);
|
|
|
+ },
|
|
|
+ sign(context, data) {
|
|
|
+ context.commit('sign', data);
|
|
|
+ },
|
|
|
+ isSign(context, data) {
|
|
|
+ context.commit('isSign', data);
|
|
|
+ },
|
|
|
+ cart_nums(context, data) {
|
|
|
+ context.commit('cart_nums', data);
|
|
|
+ },
|
|
|
+ accessToken(context) {
|
|
|
+ if (!user.isLogin()) {
|
|
|
+ context.commit('accessToken', null);
|
|
|
+ }
|
|
|
+ user.getAccessToken().then(accessToken => {
|
|
|
+ context.commit('accessToken', accessToken);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ info(context, options) {
|
|
|
+ if (!user.isLogin()) {
|
|
|
+ context.commit('accessToken', null);
|
|
|
+ }
|
|
|
+ user.getAccessToken().then(accessToken => {
|
|
|
+ context.commit('accessToken', accessToken);
|
|
|
+ user.getInfo(options).then(data => {
|
|
|
+ context.commit('info', data);
|
|
|
+ });
|
|
|
+ }).catch((err) => {
|
|
|
+ context.commit('showLoginModal', true);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ refreshInfo(context) {
|
|
|
+ context.commit('accessToken', null);
|
|
|
+ },
|
|
|
+ refresh(context) {
|
|
|
+ if (!user.isLogin()) {
|
|
|
+ context.commit('accessToken', null);
|
|
|
+ }
|
|
|
+ user.getAccessToken().then(accessToken => {
|
|
|
+ context.commit('accessToken', accessToken);
|
|
|
+ user.getInfo({
|
|
|
+ refresh: true,
|
|
|
+ }).then(data => {
|
|
|
+ context.commit('info', data);
|
|
|
+ }).catch(e => {});
|
|
|
+ }).catch(e => {});
|
|
|
+ },
|
|
|
+ setTempParentId(context, data) {
|
|
|
+ context.commit('tempParentId', data);
|
|
|
+ },
|
|
|
+ loadAccessTokenFormCache(context) {
|
|
|
+ if (context.accessToken) return;
|
|
|
+ user.getAccessToken({
|
|
|
+ cacheOnly: true,
|
|
|
+ }).then(e => {
|
|
|
+ if (!e) return;
|
|
|
+ context.commit('accessToken', e);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ logout(context) {
|
|
|
+ context.commit('accessToken', null);
|
|
|
+ user.loginByToken(null);
|
|
|
+ },
|
|
|
+ showAttention(context, data) {
|
|
|
+ context.commit('showAttention', data);
|
|
|
+ },
|
|
|
+ showAttentionTwo(context, data) {
|
|
|
+ context.commit('showAttentionTwo', data);
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
export default {
|
|
|
- namespaced: true,
|
|
|
- state,
|
|
|
- getters,
|
|
|
- mutations,
|
|
|
- actions
|
|
|
+ namespaced: true,
|
|
|
+ state,
|
|
|
+ getters,
|
|
|
+ mutations,
|
|
|
+ actions
|
|
|
}
|