Commit bfa656ec authored by 郭志伟's avatar 郭志伟

fix: 修改高度计算方式, 更新组件库

parent d737ac1a
...@@ -12,7 +12,7 @@ export default class ActivityController extends Controller { ...@@ -12,7 +12,7 @@ export default class ActivityController extends Controller {
if (process.env.NODE_ENV === 'production' && process.env.EGG_SERVER_ENV === 'sit') { if (process.env.NODE_ENV === 'production' && process.env.EGG_SERVER_ENV === 'sit') {
apollo = ctx.app.config.apollo || {}; apollo = ctx.app.config.apollo || {};
} }
let body = await ctx.renderView('activity.js', { url: ctx.url, apollo }); body = await ctx.renderView('activity.js', { url: ctx.url, apollo });
await ctx.service.redis.set(redisKey, body); await ctx.service.redis.set(redisKey, body);
} }
ctx.body = body; ctx.body = body;
......
...@@ -24,23 +24,26 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin) { ...@@ -24,23 +24,26 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin) {
h: 60, h: 60,
i: 'page-bottom-top' i: 'page-bottom-top'
}; };
layout: object = [];
isLayoutComReady = false; isLayoutComReady = false;
showBackTop = false; showBackTop = false;
targetEle: HTMLElement | null = null; targetEle: HTMLElement | null = null;
loading: boolean = true; loading: boolean = true;
modfiTabsStyleDebounce = debounce(this.modfiTabsStyle, 300); modfiTabsStyleDebounce = debounce(this.modfiTabsStyle, 300);
get layout() {
return this.pageData && this.pageData.elements.map(v => v.point) || [];
}
get backTopList() { get backTopList() {
return this.pageData && this.pageData.props.showShopCart ? this.pageData.props.backTopAttachInfo : []; return this.pageData && this.pageData.props.showShopCart ? [
{
icon: 'shopping-cart-o',
url: 'xyqb://shoppingCartTab'
}
] : [];
} }
@Watch('layout') @Watch('pageData')
onLayoutChange(val) { onLayoutChange(val) {
const lastGridItemPoint = val[val.length - 1]; const layout = this.pageData && this.pageData.elements.map(v => v.point) || [];
const lastGridItemPoint = layout[layout.length - 1];
if (lastGridItemPoint.w) { if (lastGridItemPoint.w) {
this.bottomInfo = { this.bottomInfo = {
x: 0, x: 0,
...@@ -52,6 +55,8 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin) { ...@@ -52,6 +55,8 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin) {
if (lastGridItemPoint.w > this.bottomInfo.w) { this.bottomInfo.w = lastGridItemPoint.w; } if (lastGridItemPoint.w > this.bottomInfo.w) { this.bottomInfo.w = lastGridItemPoint.w; }
this.bottomInfo.y = this.bottomInfo.y + lastGridItemPoint.y + lastGridItemPoint.h; this.bottomInfo.y = this.bottomInfo.y + lastGridItemPoint.y + lastGridItemPoint.h;
} }
layout.push(this.bottomInfo);
this.layout = layout;
} }
@Watch('pageName', { immediate: true }) @Watch('pageName', { immediate: true })
......
...@@ -40,10 +40,6 @@ ...@@ -40,10 +40,6 @@
</grid-item> </grid-item>
</grid-layout> </grid-layout>
<cr-back-top v-if="showBackTop && pageData.props.showBackTop" :list="backTopList" /> <cr-back-top v-if="showBackTop && pageData.props.showBackTop" :list="backTopList" />
<div class="page-bottom">
<p><img src="" /></p>
<p>没有更多啦~</p>
</div>
</div> </div>
</template> </template>
<script lang="ts" src="./index.ts"></script> <script lang="ts" src="./index.ts"></script>
......
...@@ -64,7 +64,17 @@ export const defaultState = { ...@@ -64,7 +64,17 @@ export const defaultState = {
backgroundImage: '' backgroundImage: ''
}, },
props: { props: {
showBackTop: false showBackTop: true,
showShopCart: true,
backTopAttachInfo: [
{
icon: 'shopping-cart-o',
url: 'xyqb://shoppingCartTab'
}
],
showPageBottomTip: true,
pageBottomTxt: '没有更多啦~',
pageBottomColor: '#fff'
}, },
elements: [], elements: [],
} }
......
...@@ -92,7 +92,7 @@ export const convertPointStyle = (point, defaultStyle, directionKey = DK) => { ...@@ -92,7 +92,7 @@ export const convertPointStyle = (point, defaultStyle, directionKey = DK) => {
export const getStyle = function(oElement, sName) { export const getStyle = function(oElement, sName) {
const result = oElement.currentStyle ? oElement.currentStyle[sName] : getComputedStyle(oElement, null)[sName]; const result = oElement.currentStyle ? oElement.currentStyle[sName] : getComputedStyle(oElement, null)[sName];
return result.includes('px') ? result.slice(0, -2) : result; return result.indexOf('px') > -1 ? result.slice(0, -2) : result;
}; };
export const validateType = function(obj) { export const validateType = function(obj) {
......
...@@ -1648,9 +1648,9 @@ ...@@ -1648,9 +1648,9 @@
"integrity": "sha512-uOCUKu5mvX3PWee+7ZFXQSNIR1V5SN2JVE2yANmW9/wQOgpEct291gXGok8VMw0009HlTWB4JATURPwyOP2DFg==" "integrity": "sha512-uOCUKu5mvX3PWee+7ZFXQSNIR1V5SN2JVE2yANmW9/wQOgpEct291gXGok8VMw0009HlTWB4JATURPwyOP2DFg=="
}, },
"@qg/cherry-ui": { "@qg/cherry-ui": {
"version": "2.21.1-beta5", "version": "2.21.1-beta6",
"resolved": "http://npmprivate.quantgroups.com/@qg%2fcherry-ui/-/cherry-ui-2.21.1-beta5.tgz", "resolved": "http://npmprivate.quantgroups.com/@qg%2fcherry-ui/-/cherry-ui-2.21.1-beta6.tgz",
"integrity": "sha512-C43ydazyjqmsrq2uYJ2prcksnSTmeMyoracVw5dcyV1S9GGQku7C6CmpV1KXXpXiR6HLrXb7HcLyzgrCf/DzUA==", "integrity": "sha512-N99UjjwYrQj1AccZ+08lNRdHWKnlb7ZnKvAn4w48KWRERQNxJ1U2LwclVmQ3FRFlc9x5FRSUDccuoJ3CAf2ZMg==",
"requires": { "requires": {
"@popperjs/core": "^2.5.4", "@popperjs/core": "^2.5.4",
"vue-lazyload": "^1.3.3", "vue-lazyload": "^1.3.3",
......
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