Commit 43b13382 authored by 郭志伟's avatar 郭志伟

Merge branch 'feat/v1.3' into 'master'

Feat/v1.3

See merge request !40
parents 9def40d4 2e68f83b
......@@ -28,3 +28,5 @@ app/view/*
yarn.lock
*.log
coverage
.yalc/
yalc.lock
\ No newline at end of file
......@@ -4,7 +4,7 @@ export default class ActivityController extends Controller {
public async home(ctx: Context) {
// 开发环境不走redis缓存
if (process.env.NODE_ENV === 'development') {
ctx.body = await ctx.renderView('activity.js', { url: ctx.url });
ctx.body = await ctx.renderToHtml('activity.js', { url: ctx.url });
return;
}
const redisKey = `quantum-blocks:page:${ctx.params.id}`;
......@@ -17,7 +17,7 @@ export default class ActivityController extends Controller {
if (process.env.NODE_ENV === 'production' && process.env.EGG_SERVER_ENV === 'sit') {
apollo = ctx.app.config.apollo || {};
}
body = await ctx.renderView('activity.js', { url: ctx.url, apollo });
body = await ctx.renderToHtml('activity.js', { url: ctx.url, apollo });
await ctx.service.redis.set(redisKey, body);
}
ctx.body = body;
......
......@@ -5,6 +5,9 @@ export default {
getPageById(params) {
return http.get(`${config.apiHost}/editor/get/${params.pageId}`);
},
getShopCartCount() {
return http.get(`${config.kdspHost}/api/kdsp/shop-cart/count`);
},
getMpSchema(params) {
return http.post(`${config.kdspHost}/api/kdsp/ka/info/getShareMiniUrl`, params, { emulateJSON: true });
},
......
......@@ -2,7 +2,7 @@ import apolloSsr from '../../../config/apollo.ssr.json';
const protocol = EASY_ENV_IS_BROWSER ? window.location.protocol : 'https';
const hostMap = {
apiHost: `${protocol}//quantum-blocks-vcc2.liangkebang.net`,
apiHost: `${protocol}//quantum-blocks-test1.liangkebang.net`,
kdspHost: `${protocol}//talos-test1.liangkebang.net`,
shenceUrl: `${protocol}//bn.xyqb.com/sa?project=default`,
mallHost: `${protocol}://mall-test1.liangkebang.net`,
......
......@@ -59,12 +59,16 @@ export default {
request(cfg) {
const { method, hideVccChannel } = cfg;
cfg.headers['X-Auth-Token'] = localStorage.get('vccToken') || '';
cfg.headers['version'] = '8.2.00';
if (cfg.customHeader) {
Object.assign(cfg.headers, cfg.customHeader);
}
if (cfg.creditToken) {
cfg.headers['X-Auth-Token'] = localStorage.get('creditToken');
}
if (!cfg.hideTerminal) {
cfg.headers['x-user-terminal'] = isWxMp ? 'MINI-APP' : 'H5'; // 全局暂定H5
}
if (!hideVccChannel) {
cfg.headers['vccChannel'] = getVccChannel();
cfg.headers['sonVccChannel'] = getVccChannel('sonVccChannel');
......@@ -76,32 +80,4 @@ export default {
return cfg;
}
}
// unique: {
// response(res) {
// const { data, config } = res;
// if (data.code === 0) {
// return [data.data, null];
// }
// if (!config.hideToast) {
// Toast(data.msg);
// }
// let error = new Error(data.msg);
// error.response = data;
// console.error(error);
// return [null, error];
// },
// request(cfg) {
// const { method } = cfg;
// cfg.headers['X-Auth-Token'] = localStorage.get('vccToken') || '';
// if (cfg.creditToken) {
// cfg.headers['X-Auth-Token'] = localStorage.get('creditToken');
// }
// cfg.headers['vccChannel'] = getVccChannel();
// if (method === 'post' && cfg.emulateJSON) {
// cfg.headers['Content-Type'] = 'application/x-www-form-urlencoded';
// cfg.data = getURLSearchParams(cfg.data);
// }
// return cfg;
// }
// }
};
......@@ -2,7 +2,7 @@ import apolloSsr from '../../../config/apollo.ssr.json';
const protocol = EASY_ENV_IS_BROWSER ? window.location.protocol : 'https';
const hostMap = {
apiHost: `${protocol}//quantum-blocks-vcc2.liangkebang.net`,
apiHost: `${protocol}//quantum-blocks-test1.liangkebang.net`,
kdspHost: `${protocol}//talos-test1.liangkebang.net`,
shenceUrl: `${protocol}//bn.xyqb.com/sa?project=default`,
mallHost: `${protocol}://mall-test1.liangkebang.net`,
......
<template>
<wx-open-launch-app
class="launch-btn"
@launch="launch"
@error="launchError"
id="launch-btn"
appid="wx75d5a207551d0b4d"
:extinfo="extinfo"
>
<script type="text/wxtag-template">
<style>.btn {height: 100vh;width: 100vw;}</style>
<div class="btn">打开APP</div>
</script>
</wx-open-launch-app>
</template>
<script>
import { navToDlApp } from '@qg/citrus-ui/src/helper/service/utils';
export default {
name: "LaunchApp",
props: {
jumpUrl: String,
appSchema: String
},
computed: {
extinfo() {
return JSON.stringify({
url: this.jumpUrl,
data: {}
});
}
},
methods: {
launch() {
setTimeout(() => {
navToDlApp();
}, 2500);
window.location.href = this.appSchema;
},
launchError(e) {
if (e.detail.errMsg === "launch:fail") {
navToDlApp();
}
},
}
};
</script>
<style lang="less">
.launch-btn {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
opacity: 0;
z-index: 100;
left: 0;
}
</style>
<template>
<wx-open-launch-weapp
class="launch-btn"
username="gh_a976018bfb9e"
:path="jumpUrl"
@launch="launch"
@error="launchError"
>
<script type="text/wxtag-template">
<style>.btn {height: 100vh;width: 100vw;}</style>
<div class="btn">打开小程序</div>
</script>
</wx-open-launch-weapp>
</template>
<script>
export default {
name: "LaunchWeapp",
props: {
jumpUrl: String
},
data() {
return {};
},
methods: {
launch() {
console.log("launch");
},
launchError() {
console.log("launchError");
}
}
};
</script>
<style lang="less">
.launch-btn {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
opacity: 0;
z-index: 100;
left: 0;
}
</style>
......@@ -18,19 +18,15 @@
<script>
import Bridge from '@qg/js-bridge';
import { mapGetters } from 'vuex';
import { isApp, isWxMp, isWechat, isH5Normal } from '@/service/utils.service';
import { isApp, isWxMp, debounce, isWechat, isH5Normal, isDef } from '@/service/utils.service';
import { registeredEvents } from '@/service/sa.service';
import api from '@/api/editor.api';
import cfg from '@/config/index';
import localStorage from '@/service/localStorage.service';
import DisableTouchMixin from '../../../mixins/disableTouch.mixin';
import { navToDlApp } from '@qg/citrus-ui/src/helper/service/utils';
import { EventBus } from '@qg/citrus-ui/src/helper/service/eventBus';
const SHARE_CONFIG = {
name: 'share',
txt: '',
icon: 'share',
url: '',
};
const WEAPP_PATH = 'pages/webview/webview';
const APP_PATH = 'xyqb://openHttp';
......@@ -42,11 +38,13 @@ export default {
},
data() {
return {
renderTpl: false,
showMpTip: false,
tipTimer: null,
jsBridge: null,
wx: null,
cartIndex: null,
cartCount: 0,
getCartCountDebounce: debounce(this.getCartCount, 2000),
mpSchema: '',
link: '',
shareInfo: {},
......@@ -56,18 +54,23 @@ export default {
},
computed: {
...mapGetters(['pageData', 'pageInfo']),
backTopList() {
const btAttachVal = this.pageData.props?.btAttachVal || [];
if (isDef(this.cartIndex) && this.cartIndex !== -1 && btAttachVal.length) {
btAttachVal[this.cartIndex].info = this.cartCount;
}
return isApp ? btAttachVal : isWxMp ? btAttachVal.filter(item => item.persets !== '购物车') : [];
// if (this.pageData.props && this.pageData.props.btAttachVal) {
// const { btAttachVal, showShare } = this.pageData.props;
// const btAttachValDeep = JSON.parse(JSON.stringify(btAttachVal));
// showShare && (isApp || isWxMp) && btAttachValDeep.push(SHARE_CONFIG);
// return btAttachValDeep;
// }
// return [];
},
showTop() {
return this.showBackTop && this.pageData.props && this.pageData.props.showBackTop;
},
backTopList() {
if (this.pageData.props && this.pageData.props.btAttachVal) {
const { btAttachVal, showShare } = this.pageData.props;
const btAttachValDeep = JSON.parse(JSON.stringify(btAttachVal));
showShare && (isApp || isWxMp) && btAttachValDeep.push(SHARE_CONFIG);
return btAttachValDeep;
}
return [];
},
appSchema() {
return `${APP_PATH}?jumpUrl=${this.link}`;
},
......@@ -75,14 +78,31 @@ export default {
return this.pageInfo.shareOpenMethod;
}
},
watch: {
backTopList: {
immediate: true,
handler(val) {
this.cartIndex = (val || []).findIndex(item => item.persets === '购物车');
this.getCartCountDebounce();
}
}
},
created() {
if (!EASY_ENV_IS_NODE) {
this.renderTpl = true;
this.jsBridge = new Bridge();
this.initShareInfo();
this.getMpSchema();
}
},
mounted() {
EventBus.$on("PAGE_VISIBILITY_STATE", state => {
if (!state) {
this.getCartCountDebounce();
}
});
},
methods: {
async getMpSchema() {
if (isH5Normal && EASY_ENV_IS_BROWSER) {
......@@ -110,9 +130,14 @@ export default {
window.location.href = `${cfg.mallHost}/common/launch?jumpUrl=${jumpUrl}&terminal=${shareOpenMethod}&extraInfo=${encodeURIComponent(JSON.stringify({ url }))}`;
}
},
handleBackTopClick(e) {
handleBackTopClick(e = {}) {
// ! 此处以1.3为准,但需要对齐分享功能
if (e && e.name === 'share') {
registeredEvents('PD_WUXIEC_H5ActivityPageSuspendedBtnClick', {
activity_id: this.pageInfo.uuid,
jump_link: e.url,
window_name: e.name,
});
if (e && e.persets === '分享') {
if (this.tipTimer) {
clearTimeout(this.tipTimer);
}
......@@ -164,6 +189,15 @@ export default {
setTimeout(() => {
this.showMpTip = false;
}, 10000);
},
async getCartCount() {
if (localStorage.get('vccToken') && isDef(this.cartIndex) && isApp) {
const [res] = await api.getShopCartCount();
this.cartCount = res.count;
this.$nextTick(() => {
this.$refs.crBackTop.$forceUpdate();
});
}
}
},
}
......@@ -171,6 +205,10 @@ export default {
<style lang="less" scoped>
@deep: ~'>>>';
.cr-back-top {
z-index: 103;
}
.wxmp-tip {
position: fixed !important;
top: -32px;
......@@ -180,6 +218,7 @@ export default {
background-color: #fff;
color: #333;
box-shadow: 0 2px 12px 0 rgba(100, 101, 102, 28%);
z-index: 102;
&__reference {
font-size: 0;
......@@ -206,6 +245,6 @@ export default {
left: 0;
height: 100%;
width: 100%;
z-index: 8;
z-index: 999;
}
</style>
<template>
<cr-empty
class="empty-state"
image="error"
description="你访问的页面不存在"
/>
</template>
<script>
export default {
name: 'EmptyState',
mounted() {
const loadingEle = document.querySelector('.mainload');
if (!loadingEle) { return; }
loadingEle.style.display = 'none';
}
}
</script>
<style lang="less" scoped>
.empty-state {
padding-top: 100px;
}
</style>
\ No newline at end of file
......@@ -26,6 +26,11 @@
left: 0;
right: auto;
}
.vue-grid-item.no-transforms {
transform: none !important;
z-index: 3 !important;
overflow: visible !important;
}
.vue-grid-item.cssTransforms.render-rtl {
left: auto;
......@@ -133,6 +138,9 @@
required: false,
default: null
},
noTransforms: {
type: Boolean
},
/*useCssTransforms: {
type: Boolean,
required: true
......@@ -412,7 +420,8 @@
'cssTransforms' : this.useCssTransforms,
'render-rtl' : this.renderRtl,
'disable-userselect': this.isDragging,
'no-touch': this.isAndroid && this.draggableOrResizableAndNotStatic
'no-touch': this.isAndroid && this.draggableOrResizableAndNotStatic,
'no-transforms': this.noTransforms
}
},
resizableAndNotStatic(){
......
import { Vue, Component, Watch, Provide, Mixins } from 'vue-property-decorator';
import { Getter, State, Mutation } from 'vuex-class';
import FreedomContainer from '../../component/FreedomContainer/index.vue';
import PageBottomTip from '../../component/PageBottomTip/index.vue';
import BackTop from '../../component/BackTop/index.vue';
import EmptyState from '../../component/EmptyState/index.vue';
import PageBottomTip from '../../component/PageBottomTip/index.vue';
import GridLayout from '../../component/VueGridLayout/GridLayout.vue';
import GridItem from '../../component/VueGridLayout/GridItem.vue';
import TransformStyleMixin from '@/page/mixins/transformStyle.mixin';
import SaMixin from '@/page/mixins/sa.mixin';
import { getStyle, debounce, isApp, isWxMp } from '@/service/utils.service';
import DisableTouchMixin from '@/page/mixins/disableTouch.mixin';
import { getStyle, debounce, isApp } from '@/service/utils.service';
import { EventBus } from '@qg/citrus-ui/src/helper/service/eventBus';
import { setAppTitleColor } from '@/service/color.service';
import { EventBus } from '@qg/citrus-ui/src/helper/service/eventBus';
import localStorage from '@/service/localStorage.service';
@Component({ components: { FreedomContainer, GridLayout, GridItem, PageBottomTip, BackTop }, name: 'Activity'})
@Component({ components: { FreedomContainer, GridLayout, GridItem, PageBottomTip, BackTop, EmptyState }, name: 'Activity'})
export default class Activity extends Mixins(TransformStyleMixin, SaMixin, DisableTouchMixin) {
@Getter('pageData') pageData;
@State(state => state.activity.pageInfo.pageName) pageName;
@State(state => state.activity.noPageData) noPageData;
@State(state => state.activity.pageInfo.appLoginState) appLoginState;
@State(state => state.activity.gridLayout.rowHeight) rowHeight;
@Mutation('SET_PAGE_ELEMENTS') setPageElement;
......@@ -36,13 +39,16 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin, Disab
loading: boolean = true;
modfiTabsStyleDebounce = debounce(this.modfiTabsStyle, 300);
get layout() {
if (!isApp && !isWxMp && !EASY_ENV_IS_NODE) {
this.pageData.elements = this.pageData.elements.filter(v => v.name !== 'cs-search-bar');
}
return this.pageData && this.pageData.elements.map(v => v.point) || [];
}
@Watch('pageData', { deep: true })
onPageDataChange(val) {
const lastGridItem = val.elements[val.elements.length - 1];
const lastGridItemPoint = lastGridItem.point;
const lastGridItemPoint = lastGridItem?.point;
if (lastGridItemPoint && lastGridItemPoint.w) {
this.bottomInfo = {
x: 0,
......@@ -80,8 +86,10 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin, Disab
this.modifyPoints();
}
}
mounted() {
if (!isApp && !isWxMp && !EASY_ENV_IS_NODE) {
this.pageData.elements = this.pageData.elements.filter(v => v.name !== 'cs-search-bar');
}
this.targetEle = document.querySelector('body');
if (EASY_ENV_IS_BROWSER) { this.showBackTop = true; }
this.pageVisibilityChange();
......@@ -100,13 +108,20 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin, Disab
}
});
}
this.layoutReadyEvent();
}
fetchApi(options) {
const { store, route } = options;
const { pageId } = route.params;
return store.dispatch('getPageDate', { pageId });
}
updateShopCartCount() {
if (EASY_ENV_IS_BROWSER) {
this.$nextTick(() => {
this.$refs.backTop.getCartCount();
});
}
}
modifyPoints() {
const clientWidth = document.documentElement.clientWidth > 768 ? 375 : document.documentElement.clientWidth;
const elements = this.pageData?.elements?.map(v => {
......@@ -125,22 +140,37 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin, Disab
}
layoutReadyEvent(newLayout) {
this.$nextTick(() => {
console.log('layoutReadyEvent');
const loadingEle = document.querySelector('.mainload');
console.log('loadingEle', loadingEle);
// console.log('loadingEle', loadingEle);
if (!loadingEle) { return; }
loadingEle.style.display = 'none';
if (isApp) {
setAppTitleColor(this.pageData.props.titleBgColor);
}
});
}
layoutUpdatedEvent() {
console.log('layoutUpdatedEvent');
// console.log('layoutUpdatedEvent');
// 高度更新时重新计算导航组件样式
this.modfiTabsStyleDebounce();
}
// overlay遮罩显示时隐藏悬浮窗
hideBottomBtns(state) {
this.showBackTop = state;
}
// overlay遮罩显示时,降低其他sticky的z-index (通过设置transform实现)
setDownOtherEleZIndex(state, id) {
const HAVE_Z_INDEX_EL = ['cs-floor-nav', 'cs-goods-tabs'];
const elements = this.pageData?.elements?.map(item => {
if (item.id !== id && HAVE_Z_INDEX_EL.includes(item.name)) {
item.commonStyle.transform = state ? 'rotateZ(0)' : 'none';
}
return item;
});
this.setPageElement(elements);
this.hideBottomBtns(!state);
}
// 处理页面隐藏
pageVisibilityChange() {
if (EASY_ENV_IS_NODE) { return; }
let hidden = 'hidden';
......@@ -154,6 +184,7 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin, Disab
}
window.addEventListener(visibilityChange, () => {
this.handleChange(document[hidden]);
EventBus.$emit('PAGE_VISIBILITY_STATE', document[hidden]);
}, false);
}
handleChange(state) {
......@@ -175,7 +206,7 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin, Disab
gridItemEle.classList.remove('del_transform');
}
const transform = getStyle(gridItemEle, 'transform');
if (transform && transform.length) {
if (transform && transform.length && transform !== 'none') {
const transformY = transform.split('(')[1].split(')')[0].split(',')[5];
gridItemEle.style.top = `${transformY}px`;
gridItemEle.className += ' del_transform';
......
<template>
<div class="activity" :style="transformStyle(pageData.commonStyle)">
<grid-layout
:layout.sync="layout"
:isDraggable="false"
:isResizable="false"
:col-num="12"
:row-height="rowHeight"
:margin="[0, 0]"
:is-draggable="true"
:is-resizable="true"
:is-mirrored="false"
:vertical-compact="true"
:use-css-transforms="true"
@layout-mounted="layoutReadyEvent"
@layout-updated="layoutUpdatedEvent"
>
<grid-item :style="transformStyle(item.commonStyle)" v-for="(item, index) in pageData.elements"
:x="item.point.x"
:y="item.point.y"
:w="item.point.w"
:h="item.point.h"
:i="item.point.i"
<template v-if="!noPageData">
<div class="layout">
<div :style="transformStyle(item.commonStyle, item.point, item.name)" v-for="(item, index) in pageData.elements"
:key="item.point.i"
@click.native="dot(item.title)"
@touchend.native="disTouch"
:id="`item_${item.id}`"
@click="dot(item.title)"
@touchend="disTouch"
>
<component :data-index="index" :id="item.id" :containerIndex="index" :childItem="item" :is="item.name" :key="item.id" :sa-info="getSaInfo(item)" v-bind="item.props"></component>
</grid-item>
<grid-item
<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
v-if="pageData.props.showPageBottomTip"
:x="bottomInfo.x"
:y="bottomInfo.y"
:w="bottomInfo.w"
:h="bottomInfo.h"
:i="bottomInfo.i"
:static="true"
:id="bottomInfo.i + pageData.elements.length"
:key="bottomInfo.i + pageData.elements.length"
>
<page-bottom-tip />
</grid-item>
</grid-layout>
</div>
</div>
<back-top v-if="showBackTop" :show-back-top="showBackTop" ref="backTop" />
</template>
<empty-state v-else />
</div>
</template>
<script lang="ts" src="./index.ts"></script>
<style lang="less" scoped>
@deep: ~'>>>';
.activity {
width: 100%;
min-height: 100%;
......@@ -79,29 +60,5 @@
overflow: visible !important;
transform: none !important;
}
.wxmp-tip {
position: fixed !important;
top: -32px;
right: 10%;
z-index: 99;
@{deep} .cr-popover {
background-color: #fff;
color: #333;
box-shadow: 0 2px 12px 0 rgba(100, 101, 102, 28%);
&__reference {
font-size: 0;
}
&__angle::before {
border-color: transparent transparent rgb(255 255 255);
}
}
&__content {
width: 160px;
.cr-icon--weapp-nav {
vertical-align: sub;
margin: 0 5px;
}
}
}
</style>
......@@ -6,8 +6,7 @@ import { Mutation } from 'vuex-class';
export default class TransformStyleMixin extends Vue {
@Mutation('SET_ELEMENT_POINT') setElementPoint;
transformStyle(styleObj, element) {
// console.log('transformStyle', styleObj, element);
transformStyle(styleObj, point = {}, name) {
const style = {
backgroundRepeat: 'no-repeat',
backgroundSize: 'cover'
......@@ -23,7 +22,10 @@ export default class TransformStyleMixin extends Vue {
style.backgroundImage = `url(${style.backgroundImage})`;
}
}
style.zIndex = 2;
if (name === 'freedom-container' && point) {
style.height = point?.h ? `${(point.h / 37.5).toFixed(2)}rem` : null;
}
// style.zIndex = 2;
return style;
}
......@@ -37,10 +39,9 @@ export default class TransformStyleMixin extends Vue {
const eleId = element.getAttribute('id');
const component = this.pageData.elements.find(v => v.id === eleId);
if (!component) { return; }
const point = { ...component.point, h: component.name === 'cs-goods-tabs' ? Math.floor(+height) : Math.ceil(+height) };
const calcHeight = +height + (component.commonStyle.paddingTop || 0) + (component.commonStyle.paddingBottom || 0);
const point = { ...component.point, h: component.name === 'cs-goods-tabs' ? Math.floor(+calcHeight) : Math.ceil(+calcHeight) };
this.setElementPoint({ id: eleId, data: point });
console.log('adjustHeight', height, component, element.getAttribute('id'), point);
// this.updatePageInfo({ containerIndex: this.curEleIndex, data: { ...elements, point: { ...elements.point, h: +height || elements.point.h } } });
// console.log('adjustHeight', height, component, element.getAttribute('id'), point);
}
}
......@@ -8,7 +8,6 @@ Vue.use(Vuex);
export default function createStore(initState: any = {}) {
const { title, url, origin, locale, csrf, activity } = initState;
console.log('store', title, url, origin, locale, csrf, activity);
const state = { title, url, origin, locale, csrf };
return new Vuex.Store<RootState>({
state,
......
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 } 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';
......@@ -21,8 +21,13 @@ export default class EditorModule implements Module<EditorState, RootState> {
actions: ActionTree<EditorState, RootState> = {
async getPageDate({ commit }, condition) {
const [res] = await api.getPageById(condition);
if (res) {
const { page, ...rest } = res as PageInfo;
commit(SET_PAGE_INFO, { ...rest, page: JSON.parse(page as string) });
commit(SET_EMPTY_PAGE, false);
} else {
commit(SET_EMPTY_PAGE, true);
}
}
};
......@@ -47,6 +52,9 @@ export default class EditorModule implements Module<EditorState, RootState> {
[SET_PAGE_ELEMENTS](state, data) {
if (data) { (state.pageInfo.page as Page).elements = data; }
},
[SET_EMPTY_PAGE](state, data) {
state.noPageData = data;
},
[SET_ELEMENT_POINT](state, { id, data }) {
const elements = (state.pageInfo.page as Page).elements;
const element = elements.find(ele => ele.id === id);
......
......@@ -53,7 +53,7 @@ export interface PageInfo {
}
export const defaultState = {
curEleIndex: null,
noPageData: false,
curChildIndex: null,
pageInfo: {
id: 0,
......@@ -95,7 +95,7 @@ export const defaultState = {
export default interface EditorState {
pageInfo: PageInfo;
draggable: boolean;
curEleIndex: number | null;
noPageData: boolean;
curChildIndex: number | null;
templateList: any[];
rowHeight: number;
......
......@@ -14,4 +14,5 @@ export const UPDATE_PAGE_STYLE = 'UPDATE_PAGE_STYLE';
export const UPDATE_PAGE_PROPS = 'UPDATE_PAGE_PROPS';
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';
......@@ -87,12 +87,24 @@ export function setAppTitleColor(bgcolor = "#fff") {
const colors = isGradient
? [bgcolor[0].substr(1), bgcolor[1].substr(1)]
: [bgcolor.substr(1), bgcolor.substr(1)];
jsBridge.run({
changeColor();
function changeColor() {
if (!jsBridge) return;
try {
const jbInstance = jsBridge.run({
event: "resetNavigationBarColor",
data: {
isDarkContent,
colors
}
});
if (!jbInstance) {
changeColor();
} else {
jsBridge = null;
}
} catch (error) {
jsBridge = null;
}
}
}
import Vue from 'vue';
// import {
// Button,
// Image,
// Icon,
// Cell,
// CellGroup,
// Row,
// Col,
// Dialog,
// Popup,
// Overlay,
// Divider,
// Loading,
// Picker,
// NavBar,
// Field,
// Checkbox,
// CardList,
// List,
// Form,
// Sticky,
// Tab,
// Tabs,
// Notify,
// Swipe,
// SwipeItem,
// Toast,
// BackTop
// } from '@qg/cherry-ui';
// import { KaLoginForm } from '@qg/citrus-ui';
import Button from '@qg/cherry-ui/src/button';
import Image from '@qg/cherry-ui/src/image';
import Field from '@qg/cherry-ui/src/field';
......@@ -44,37 +15,25 @@ import Text from '@qg/cherry-ui/src/text';
import Tag from '@qg/cherry-ui/src/tag';
import Popover from '@qg/cherry-ui/src/popover';
import Icon from '@qg/cherry-ui/src/icon';
import Empty from '@qg/cherry-ui/src/empty';
import NoticeBar from '@qg/cherry-ui/src/notice-bar';
Vue.use(Button);
Vue.use(Image);
Vue.use(Popover);
Vue.use(Icon);
// Vue.use(Cell);
// Vue.use(CellGroup);
// Vue.use(Row);
// Vue.use(Col);
// Vue.use(Popup);
// Vue.use(Divider);
// Vue.use(Picker);
Vue.use(NoticeBar);
Vue.use(Field);
// Vue.use(Dialog);
// Vue.use(Checkbox);
// Vue.use(Icon);
// Vue.use(Sticky);
// Vue.use(Overlay);
Vue.use(Form);
// Vue.use(CardList);
Vue.use(Loading);
// Vue.use(List);
Vue.use(Tab);
Vue.use(Tabs);
// Vue.use(Toast);
// Vue.use(Swipe);
// Vue.use(SwipeItem);
// Vue.use(Swipe);
Vue.use(BackTop);
Vue.use(Text);
Vue.use(Tag);
Vue.use(Popover);
Vue.use(Icon);
Vue.use(Empty);
Vue.use(citrusUi);
......
......@@ -4,11 +4,11 @@ import Storage from '@/service/localStorage.service';
import { getParameterByName, isWxMp, isApp } from '@/service/utils.service';
export function initSa(router) {
console.log('initSa', EASY_ENV_IS_BROWSER, config, window.location.pathname);
if (process.env.NODE_ENV === 'development') { return; }
const sa = require('sa-sdk-javascript');
const activityId = window.location.pathname.split('/')?.[2] || '';
const vccChannel = getParameterByName('vccChannel') || getParameterByName('registerFrom');
const sonVccChannel = getParameterByName('sonVccChannel');
const sa = require('sa-sdk-javascript');
sa.init({
server_url: config.shenceUrl,
heatmap: {
......
......@@ -31,6 +31,10 @@ export function isNull(str) {
return str === undefined || str.length === 0 || str === null;
}
export function isDef(val) {
return val !== undefined && val !== null;
}
// 判断手机号
export function isPhone(str) {
if (!isNull(str)) {
......
......@@ -19,8 +19,8 @@
}
},
"redis": {
"port": "32625",
"host": "172.17.6.7",
"port": "172.17.5.2",
"host": "32625",
"password": "",
"db": 0
},
......
......@@ -8,7 +8,6 @@ export default (appInfo: EggAppConfig) => {
const siteFile = wxVertify;
siteFile['/favicon.ico'] = fs.readFileSync(path.join(appInfo.baseDir, 'app/web/asset/images/favicon.ico'));
config.siteFile = siteFile;
config.view = {
......
......@@ -30,7 +30,7 @@ export default (appInfo: EggAppConfig) => {
exports.redis = {
client: {
port: 32625, // Redis port
host: '172.17.5.17', // Redis host
host: '172.17.5.2', // Redis host
password: '',
db: 0
}
......
{
"name": "quantum-blocks-h5",
"version": "0.0.1",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......@@ -1638,9 +1638,9 @@
"integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw=="
},
"@popperjs/core": {
"version": "2.10.1",
"resolved": "http://npmprivate.quantgroups.com/@popperjs%2fcore/-/core-2.10.1.tgz",
"integrity": "sha1-co7NlasgequKmk5CHwQi2zKSMr4="
"version": "2.10.2",
"resolved": "http://npmprivate.quantgroups.com/@popperjs%2fcore/-/core-2.10.2.tgz",
"integrity": "sha1-B5jAM1Hw3qGlpMq93yalWny+5ZA="
},
"@qg/apollo-nodejs": {
"version": "2.1.2",
......@@ -1648,9 +1648,9 @@
"integrity": "sha512-uOCUKu5mvX3PWee+7ZFXQSNIR1V5SN2JVE2yANmW9/wQOgpEct291gXGok8VMw0009HlTWB4JATURPwyOP2DFg=="
},
"@qg/cherry-ui": {
"version": "2.23.7",
"resolved": "http://npmprivate.quantgroups.com/@qg%2fcherry-ui/-/cherry-ui-2.23.7.tgz",
"integrity": "sha512-ZQ5valaspUkQfyUzoj7nzGqGW287NkK5WH7BB1q5LIb3kAaL/1YSF5J1j8Azn8aqtHq/xNqYMFIfb8YBsq00nw==",
"version": "2.23.9",
"resolved": "http://npmprivate.quantgroups.com/@qg%2fcherry-ui/-/cherry-ui-2.23.9.tgz",
"integrity": "sha512-czpyl06OfKKnfUls4o5vX8chpeddc87l06E6lDiPks+mM47PJdhobGgvwDWZBIeYETBnlI+VqvUhAXeQ/ISTKg==",
"requires": {
"@popperjs/core": "^2.5.4",
"vue-lazyload": "^1.3.3",
......@@ -1658,13 +1658,13 @@
}
},
"@qg/citrus-ui": {
"version": "0.2.29",
"resolved": "http://npmprivate.quantgroups.com/@qg%2fcitrus-ui/-/citrus-ui-0.2.29.tgz",
"integrity": "sha512-inMPAWHzFvNZSCqotDVlKnONmeYps98yGRck5V3cV/1dAiScBhWovyvxXGAnfCk0dfmjcm/5Tpw4pmjt04Xjnw==",
"version": "0.3.7",
"resolved": "http://npmprivate.quantgroups.com/@qg%2fcitrus-ui/-/citrus-ui-0.3.7.tgz",
"integrity": "sha512-BZw+Cr2rbPNocUGfE0rDiee74EOVmmfHZ8NwdGaYKnmMjKPTKmGEZx/cziuri+SBo7RlYNEAiYy5YG3CIPtgww==",
"requires": {
"@better-scroll/core": "^2.1.1",
"@qg/cherry-ui": "^2.23.7",
"@qg/js-bridge": "^1.1.11",
"@qg/cherry-ui": "^2.23.9",
"@qg/js-bridge": "^1.1.12",
"axios": "^0.21.1",
"intersection-observer": "^0.12.0",
"js-cookie": "^2.2.1",
......@@ -20930,9 +20930,9 @@
}
},
"sa-sdk-javascript": {
"version": "1.18.19",
"resolved": "http://npmprivate.quantgroups.com/sa-sdk-javascript/-/sa-sdk-javascript-1.18.19.tgz",
"integrity": "sha1-AkfLYb/Vu4Y6+s4JtNIAKPDl8U0="
"version": "1.19.3",
"resolved": "http://npmprivate.quantgroups.com/sa-sdk-javascript/-/sa-sdk-javascript-1.19.3.tgz",
"integrity": "sha1-9XUy7rqlRBee5Jc9joq43QDMlr4="
},
"safe-buffer": {
"version": "5.2.1",
......
{
"name": "quantum-blocks-h5",
"version": "0.0.1",
"version": "1.0.0",
"description": "低代码平台",
"scripts": {
"start": "cross-env NODE_ENV=production APOLLO_CLUSTER=3C egg-scripts start --port 9050",
......@@ -23,9 +23,9 @@
"dependencies": {
"@better-scroll/core": "^2.0.5",
"@qg/apollo-nodejs": "^2.1.2",
"@qg/cherry-ui": "2.23.7",
"@qg/citrus-ui": "0.2.29",
"@qg/js-bridge": "1.1.12",
"@qg/cherry-ui": "2.23.9",
"@qg/citrus-ui": "0.3.7",
"@qg/js-bridge": "^1.1.12",
"babel-plugin-transform-vue-jsx": "^4.0.1",
"cos-nodejs-sdk-v5": "^2.9.12",
"egg": "^2.3.0",
......
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