Commit f84e6103 authored by Xuguangxing's avatar Xuguangxing

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

parent 932dd1f5
......@@ -11,7 +11,6 @@ export default class FreedomContainer extends Mixins(TransformStyleMixin, SaMixi
@Getter('pageData') pageData;
@State(state => state.activity.curChildIndex) curChildIndex;
@Mutation('UPDATE_PAGE_INFO') updatePageInfo;
@Prop({type: Object, default: () => ({ child: [] })}) childItem;
@Prop({type: Object, default: () => ({})}) saInfo;
@Prop(String) link;
......
......@@ -19,6 +19,7 @@ import { isWxMp, isApp } from '@/service/utils.service';
import Bridge from '@qg/js-bridge';
import MpBridge from '@qg/citrus-ui/src/helper/service/mp';
import navigatorApi from '@/api/navigator.api';
import editorApi from '@/api/editor.api';
@Component({ components: { FreedomContainer, GridLayout, GridItem, PageBottomTip, BackTop, EmptyState }, name: 'Activity'})
export default class Activity extends Mixins(TransformStyleMixin, BottomNavStyleMixin, SaMixin, DisableTouchMixin) {
......@@ -28,7 +29,7 @@ export default class Activity extends Mixins(TransformStyleMixin, BottomNavStyle
@State(state => state.activity.pageInfo.appLoginState) appLoginState;
@State(state => state.activity.pageInfo.tenantId) tenantId;
@State(state => state.activity.gridLayout.rowHeight) rowHeight;
@State(state => state.activity.showFinanceComponents) showFinanceComponents;
@Mutation('SET_PAGE_ELEMENTS') setPageElement;
@Mutation('UPDATE_APP_LOGIN_STATE') updateAppLoginState;
......@@ -110,15 +111,9 @@ export default class Activity extends Mixins(TransformStyleMixin, BottomNavStyle
}
}
mounted() {
// console.log(this.$route, 'navIndex');
// const { index } = this.$route.query();
// console.log(this.navigatorConfig, 999);
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');
}
if (this.showFinanceComponents == 0) {
this.pageData.elements = this.pageData.elements.filter(v => v.name !== 'freedom-container' || !v.props.isFinance);
}
this.targetEle = document.querySelector('body');
if (EASY_ENV_IS_BROWSER) { this.showBackTop = true; }
this.pageVisibilityChange();
......@@ -145,12 +140,18 @@ export default class Activity extends Mixins(TransformStyleMixin, BottomNavStyle
}
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) {
// 获取导航配置
const [res] = await navigatorApi.getDetailById(navId);
this.navigatorConfig = res;
this.navIndex = index;
// console.log(res, 'a123');
}
async fetchApi(options) {
const { store, route } = options;
......
......@@ -3,14 +3,17 @@
<div class="activity" :class="{hasBottomNav: navigatorConfig}" :style="transformStyle(pageData.commonStyle)">
<template v-if="!noPageData && tenantIdCorrect">
<div class="layout">
<div :style="transformStyle(item.commonStyle, item.point, item.name)" v-for="(item, index) in pageData.elements"
:key="fixGridKey(item)"
:id="`item_${item.id}`"
@click="dot(item.title)"
@touchend="disTouch"
>
<template v-for="(item, index) in pageData.elements">
<div :style="transformStyle(item.commonStyle, item.point, item.name)"
:key="fixGridKey(item)"
:id="`item_${item.id}`"
@click="dot(item.title)"
@touchend="disTouch"
>
<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>
</template>
<div
v-if="pageData.props.showPageBottomTip"
:id="bottomInfo.i + pageData.elements.length"
......
import api from '@/api/editor.api';
import { Module, GetterTree, ActionTree, MutationTree } from 'vuex';
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 EditorState, { PageInfo, defaultState, Page, PageElement } from './state';
......@@ -29,16 +29,6 @@ export default class EditorModule implements Module<EditorState, RootState> {
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> = {
......@@ -70,9 +60,6 @@ export default class EditorModule implements Module<EditorState, RootState> {
const element = elements.find(ele => ele.id === id);
if (element && data) { element.point = data; }
},
[SET_SHOW_FINANCE](state, data) {
state.showFinanceComponents = data;
},
};
constructor(initState: EditorState = JSON.parse(JSON.stringify(defaultState))) {
......
......@@ -104,5 +104,4 @@ export default interface EditorState {
gridLayout: GridLayout;
navigatorConfig: any;
navIndex: any;
showFinanceComponents: number;
}
\ No newline at end of file
......@@ -16,4 +16,3 @@ export const SET_PAGE_ELEMENTS = 'SET_PAGE_ELEMENTS';
export const SET_ELEMENT_POINT = 'SET_ELEMENT_POINT';
export const SET_EMPTY_PAGE = 'SET_EMPTY_PAGE';
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