Commit f84e6103 authored by Xuguangxing's avatar Xuguangxing

feat: 获取vcc开关状态改为异步

parent 932dd1f5
...@@ -11,7 +11,6 @@ export default class FreedomContainer extends Mixins(TransformStyleMixin, SaMixi ...@@ -11,7 +11,6 @@ export default class FreedomContainer extends Mixins(TransformStyleMixin, SaMixi
@Getter('pageData') pageData; @Getter('pageData') pageData;
@State(state => state.activity.curChildIndex) curChildIndex; @State(state => state.activity.curChildIndex) curChildIndex;
@Mutation('UPDATE_PAGE_INFO') updatePageInfo; @Mutation('UPDATE_PAGE_INFO') updatePageInfo;
@Prop({type: Object, default: () => ({ child: [] })}) childItem; @Prop({type: Object, default: () => ({ child: [] })}) childItem;
@Prop({type: Object, default: () => ({})}) saInfo; @Prop({type: Object, default: () => ({})}) saInfo;
@Prop(String) link; @Prop(String) link;
......
...@@ -19,6 +19,7 @@ import { isWxMp, isApp } from '@/service/utils.service'; ...@@ -19,6 +19,7 @@ import { isWxMp, isApp } from '@/service/utils.service';
import Bridge from '@qg/js-bridge'; import Bridge from '@qg/js-bridge';
import MpBridge from '@qg/citrus-ui/src/helper/service/mp'; import MpBridge from '@qg/citrus-ui/src/helper/service/mp';
import navigatorApi from '@/api/navigator.api'; import navigatorApi from '@/api/navigator.api';
import editorApi from '@/api/editor.api';
@Component({ components: { FreedomContainer, GridLayout, GridItem, PageBottomTip, BackTop, EmptyState }, name: 'Activity'}) @Component({ components: { FreedomContainer, GridLayout, GridItem, PageBottomTip, BackTop, EmptyState }, name: 'Activity'})
export default class Activity extends Mixins(TransformStyleMixin, BottomNavStyleMixin, SaMixin, DisableTouchMixin) { export default class Activity extends Mixins(TransformStyleMixin, BottomNavStyleMixin, SaMixin, DisableTouchMixin) {
...@@ -28,7 +29,7 @@ export default class Activity extends Mixins(TransformStyleMixin, BottomNavStyle ...@@ -28,7 +29,7 @@ export default class Activity extends Mixins(TransformStyleMixin, BottomNavStyle
@State(state => state.activity.pageInfo.appLoginState) appLoginState; @State(state => state.activity.pageInfo.appLoginState) appLoginState;
@State(state => state.activity.pageInfo.tenantId) tenantId; @State(state => state.activity.pageInfo.tenantId) tenantId;
@State(state => state.activity.gridLayout.rowHeight) rowHeight; @State(state => state.activity.gridLayout.rowHeight) rowHeight;
@State(state => state.activity.showFinanceComponents) showFinanceComponents;
@Mutation('SET_PAGE_ELEMENTS') setPageElement; @Mutation('SET_PAGE_ELEMENTS') setPageElement;
@Mutation('UPDATE_APP_LOGIN_STATE') updateAppLoginState; @Mutation('UPDATE_APP_LOGIN_STATE') updateAppLoginState;
...@@ -110,15 +111,9 @@ export default class Activity extends Mixins(TransformStyleMixin, BottomNavStyle ...@@ -110,15 +111,9 @@ export default class Activity extends Mixins(TransformStyleMixin, BottomNavStyle
} }
} }
mounted() { mounted() {
// console.log(this.$route, 'navIndex');
// const { index } = this.$route.query();
// console.log(this.navigatorConfig, 999);
if (!isApp && !isWxMp && !EASY_ENV_IS_NODE) { if (!isApp && !isWxMp && !EASY_ENV_IS_NODE) {
this.pageData.elements = this.pageData.elements.filter(v => v.name !== 'cs-search-bar' && v.name !== 'cs-snap-up'); this.pageData.elements = this.pageData.elements.filter(v => v.name !== 'cs-search-bar' && v.name !== 'cs-snap-up');
} }
if (this.showFinanceComponents == 0) {
this.pageData.elements = this.pageData.elements.filter(v => v.name !== 'freedom-container' || !v.props.isFinance);
}
this.targetEle = document.querySelector('body'); this.targetEle = document.querySelector('body');
if (EASY_ENV_IS_BROWSER) { this.showBackTop = true; } if (EASY_ENV_IS_BROWSER) { this.showBackTop = true; }
this.pageVisibilityChange(); this.pageVisibilityChange();
...@@ -145,12 +140,18 @@ export default class Activity extends Mixins(TransformStyleMixin, BottomNavStyle ...@@ -145,12 +140,18 @@ export default class Activity extends Mixins(TransformStyleMixin, BottomNavStyle
} }
this.layoutReadyEvent(); this.layoutReadyEvent();
} }
async created() {
const [res, ] = await editorApi.getFinanceSetting();
console.log(res);
if (res && res.showFlag === 0) {
this.pageData.elements = this.pageData.elements.filter(v => v.name !== 'freedom-container' || !v.props.isFinance);
}
}
async getNavigatorConfig(navId, index) { async getNavigatorConfig(navId, index) {
// 获取导航配置 // 获取导航配置
const [res] = await navigatorApi.getDetailById(navId); const [res] = await navigatorApi.getDetailById(navId);
this.navigatorConfig = res; this.navigatorConfig = res;
this.navIndex = index; this.navIndex = index;
// console.log(res, 'a123');
} }
async fetchApi(options) { async fetchApi(options) {
const { store, route } = options; const { store, route } = options;
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
<div class="activity" :class="{hasBottomNav: navigatorConfig}" :style="transformStyle(pageData.commonStyle)"> <div class="activity" :class="{hasBottomNav: navigatorConfig}" :style="transformStyle(pageData.commonStyle)">
<template v-if="!noPageData && tenantIdCorrect"> <template v-if="!noPageData && tenantIdCorrect">
<div class="layout"> <div class="layout">
<div :style="transformStyle(item.commonStyle, item.point, item.name)" v-for="(item, index) in pageData.elements" <template v-for="(item, index) in pageData.elements">
<div :style="transformStyle(item.commonStyle, item.point, item.name)"
:key="fixGridKey(item)" :key="fixGridKey(item)"
:id="`item_${item.id}`" :id="`item_${item.id}`"
@click="dot(item.title)" @click="dot(item.title)"
...@@ -11,6 +12,8 @@ ...@@ -11,6 +12,8 @@
> >
<component :data-index="index" :id="item.id" :containerIndex="index" :component-data="item" :childItem="item" :is="item.name" :sa-info="getSaInfo(item)" v-bind="item.props"></component> <component :data-index="index" :id="item.id" :containerIndex="index" :component-data="item" :childItem="item" :is="item.name" :sa-info="getSaInfo(item)" v-bind="item.props"></component>
</div> </div>
</template>
<div <div
v-if="pageData.props.showPageBottomTip" v-if="pageData.props.showPageBottomTip"
:id="bottomInfo.i + pageData.elements.length" :id="bottomInfo.i + pageData.elements.length"
......
import api from '@/api/editor.api'; import api from '@/api/editor.api';
import { Module, GetterTree, ActionTree, MutationTree } from 'vuex'; import { Module, GetterTree, ActionTree, MutationTree } from 'vuex';
import Vue from 'vue'; import Vue from 'vue';
import { UPDATE_PAGE_INFO, SET_PAGE_INFO, SET_PAGE_DATA, SET_PAGE_ELEMENTS, SET_ELEMENT_POINT, UPDATE_APP_LOGIN_STATE, SET_EMPTY_PAGE, SET_SHOW_FINANCE } from './type'; import { UPDATE_PAGE_INFO, SET_PAGE_INFO, SET_PAGE_DATA, SET_PAGE_ELEMENTS, SET_ELEMENT_POINT, UPDATE_APP_LOGIN_STATE, SET_EMPTY_PAGE } from './type';
import RootState from '../../state'; import RootState from '../../state';
import EditorState, { PageInfo, defaultState, Page, PageElement } from './state'; import EditorState, { PageInfo, defaultState, Page, PageElement } from './state';
...@@ -29,16 +29,6 @@ export default class EditorModule implements Module<EditorState, RootState> { ...@@ -29,16 +29,6 @@ export default class EditorModule implements Module<EditorState, RootState> {
commit(SET_EMPTY_PAGE, true); commit(SET_EMPTY_PAGE, true);
} }
}, },
async getFinanceSetting({ commit }, condition) {
const [res] = await api.getFinanceSetting();
if (res && res.showFlag) {
// const { page, ...rest } = res as PageInfo;
commit(SET_SHOW_FINANCE, res.showFlag);
// commit(SET_EMPTY_PAGE, false);
} else {
commit(SET_SHOW_FINANCE, 0);
}
},
}; };
mutations: MutationTree<EditorState> = { mutations: MutationTree<EditorState> = {
...@@ -70,9 +60,6 @@ export default class EditorModule implements Module<EditorState, RootState> { ...@@ -70,9 +60,6 @@ export default class EditorModule implements Module<EditorState, RootState> {
const element = elements.find(ele => ele.id === id); const element = elements.find(ele => ele.id === id);
if (element && data) { element.point = data; } if (element && data) { element.point = data; }
}, },
[SET_SHOW_FINANCE](state, data) {
state.showFinanceComponents = data;
},
}; };
constructor(initState: EditorState = JSON.parse(JSON.stringify(defaultState))) { constructor(initState: EditorState = JSON.parse(JSON.stringify(defaultState))) {
......
...@@ -104,5 +104,4 @@ export default interface EditorState { ...@@ -104,5 +104,4 @@ export default interface EditorState {
gridLayout: GridLayout; gridLayout: GridLayout;
navigatorConfig: any; navigatorConfig: any;
navIndex: any; navIndex: any;
showFinanceComponents: number;
} }
\ No newline at end of file
...@@ -16,4 +16,3 @@ export const SET_PAGE_ELEMENTS = 'SET_PAGE_ELEMENTS'; ...@@ -16,4 +16,3 @@ export const SET_PAGE_ELEMENTS = 'SET_PAGE_ELEMENTS';
export const SET_ELEMENT_POINT = 'SET_ELEMENT_POINT'; export const SET_ELEMENT_POINT = 'SET_ELEMENT_POINT';
export const SET_EMPTY_PAGE = 'SET_EMPTY_PAGE'; export const SET_EMPTY_PAGE = 'SET_EMPTY_PAGE';
export const UPDATE_APP_LOGIN_STATE = 'UPDATE_APP_LOGIN_STATE'; export const UPDATE_APP_LOGIN_STATE = 'UPDATE_APP_LOGIN_STATE';
export const SET_SHOW_FINANCE = 'SET_SHOW_FINANCE';
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment