Authored by 陈峰

commit

... ... @@ -31,6 +31,9 @@ if (cluster.isMaster) {
if (msg.action === 'ssr_request') {
realyPromise.then(() => {
renderer.renderToString(msg.context, (err, html) => {
if (err) {
console.error(err);
}
worker.send({action: 'ssr_request', html, err: err && JSON.stringify(err)});
});
});
... ...
<template>
<div class="header">
<div class="back" @touchend="onBack"></div>
</div>
</template>
<script>
export default {
name: 'HeaderUfo',
methods: {
onBack() {
this.$yoho.finishPage({});
}
}
};
</script>
<style lang="scss" scoped>
.header {
width: 100%;
height: 45PX;
display: flex;
padding-left: 20PX;
padding-right: 20PX;
align-items: center;
background-color: #fff;
.back {
width: 24PX;
height: 24PX;
background: url(~statics/image/order/back@3x.png) no-repeat;
background-size: cover;
}
}
</style>
... ...
<template>
<div class="layout">
<slot></slot>
<LayoutHeader class="layout-header"></LayoutHeader>
<div class="layout-context">
<slot></slot>
</div>
</div>
</template>
<script>
import LayoutHeader from './header-ufo';
export default {
name: 'LayoutApp',
methods: {
components: {
LayoutHeader
}
};
</script>
... ... @@ -21,5 +27,12 @@ export default {
bottom: 0;
overflow: hidden;
font-size: 24px;
display: flex;
flex-direction: column;
.layout-context {
flex: 1;
overflow: hidden;
}
}
</style>
... ...
... ... @@ -13,7 +13,7 @@
<span>{{pullUpTxt}}</span>
</div>
<div class="after-trigger" v-else>
<span>...</span>
<span>加载中</span>
</div>
</div>
</slot>
... ... @@ -148,6 +148,7 @@ export default {
beforePullDown: true,
isRebounding: false,
isPullUpLoad: false,
isPullingDown: false,
pullUpDirty: true,
pullDownStyle: '',
bubbleY: 0
... ... @@ -155,7 +156,7 @@ export default {
},
computed: {
pullUpTxt() {
const moreTxt = (this.pullUpLoad && this.pullUpLoad.txt && this.pullUpLoad.txt.more) || '加载完成';
const moreTxt = (this.pullUpLoad && this.pullUpLoad.txt && this.pullUpLoad.txt.more) || '下拉加载';
const noMoreTxt = (this.pullUpLoad && this.pullUpLoad.txt && this.pullUpLoad.txt.noMore) || '没有更多了';
return this.pullUpDirty ? moreTxt : noMoreTxt;
... ... @@ -241,7 +242,8 @@ export default {
this.scroll.destroy();
},
forceUpdate(dirty) {
if (this.pullDownRefresh) {
if (this.pullDownRefresh && this.isPullingDown) {
this.isPullingDown = false;
this._reboundPullDown().then(() => {
this._afterPullDown();
});
... ... @@ -274,22 +276,25 @@ export default {
_initPullDownRefresh() {
this.scroll.on('pullingDown', () => {
this.beforePullDown = false;
this.isPullingDown = true;
this.$emit('pullingDown');
});
this.scroll.on('scroll', (pos) => {
if (!this.pullDownRefresh) {
return;
}
if (this.beforePullDown) {
if (pos.y > 43) {
this.lottieBefore.goToAndStop(Math.abs(pos.y - 43) * 15);
} else {
this.lottieBefore.goToAndStop(0);
if (pos.y > 0) {
if (this.beforePullDown) {
if (pos.y > 43) {
this.lottieBefore.goToAndStop(Math.abs(pos.y - 43) * 15);
} else {
this.lottieBefore.goToAndStop(0);
}
}
this.pullDownStyle = `top:${Math.min(pos.y + this.pullDownInitTop, 0)}px`;
if (this.isRebounding) {
this.pullDownStyle = `top:${0 - (this.pullDownRefresh.stop || 40 - pos.y)}px`;
}
}
this.pullDownStyle = `top:${Math.min(pos.y + this.pullDownInitTop, 0)}px`;
if (this.isRebounding) {
this.pullDownStyle = `top:${0 - (this.pullDownRefresh.stop || 40 - pos.y)}px`;
}
});
},
... ...
... ... @@ -55,27 +55,7 @@ export default {
this.visiable = false;
},
onSure() {
if (this.storageNum <= 1) {
this.$createDialog({
type: 'confirm',
content: '您确定不卖此商品吗?',
confirmBtn: {
text: '确定',
active: true,
disabled: false,
},
cancelBtn: {
text: '取消',
active: false,
disabled: false,
},
onConfirm: () => {
this.$emit('on-no-sale', {skc: this.skc, num: this.unStockNum});
},
}).show();
} else {
this.$emit('on-no-sale', {skc: this.skc, num: this.unStockNum});
}
this.$emit('on-no-sale', {skc: this.skc, num: this.unStockNum});
},
onInput(val) {
this.$emit('input', val);
... ...
<template>
<div class="product-item" :class="{['has-tip']: value.tip}">
<div class="item-content" :style="itemStyle" @touchstart="onTouchStart" @touchmove="onTouchMove" @touchend="onTouchEnd">
<div class="tip" v-if="showTip">超出建议售价将被限制超出建议售价将被限制展示</div>
<div class="tip" v-if="showTip">超出建议售价将被限制展示,建议下调至合理价格区间</div>
<div class="info">
<div class="left">
<span class="size">{{value.goodsInfo.sizeName}}</span>
... ...
... ... @@ -42,6 +42,7 @@ import ModalPrice from './components/modal-price';
import ModalUnstock from './components/modal-unstock';
import ImgSize from 'components/img-size';
import {Button} from 'cube-ui';
import {get} from 'lodash';
import ScrollView from '../../components/layout/scroll-ufo';
import ProductList from './components/product-list';
import {createNamespacedHelpers} from 'vuex';
... ... @@ -74,7 +75,7 @@ export default {
async onPullingUp() {
const beginCount = this.skcs.length;
await this.fetchProduct({
const result = await this.fetchProduct({
productId: this.$route.params.orderId,
page: this.page + 1,
pageSize: this.pageSize
... ... @@ -84,18 +85,29 @@ export default {
if (afterCount > beginCount) {
this.page++;
}
this.$refs.scroll.forceUpdate();
const noMore = get(result, 'data.data', []).length;
this.$refs.scroll.forceUpdate(noMore > 0);
},
onPullingDown() {
setTimeout(() => {
this.fetchProduct({
productId: this.$route.params.orderId,
page: 1,
pageSize: this.pageSize,
refresh: true
}).then(() => {
this.$refs.scroll.forceUpdate();
}, 2000);
});
},
onChangePrice(skc) {
this.$refs.modalPrice.show({skc, product: this.productInfo});
},
onNoSale(skc) {
this.$refs.modalUnstock.show({skc});
if (skc.storageNum <= 1) {
this.onNoSaleSure({skc, num: 1});
} else {
this.$refs.modalUnstock.show({skc});
}
},
refreshProduct() {
this.fetchProduct({
... ... @@ -129,6 +141,29 @@ export default {
}
},
async onNoSaleSure({skc, num}) {
if (skc.storageNum <= num) {
this.$createDialog({
type: 'confirm',
content: '您确定不卖此商品吗?',
confirmBtn: {
text: '确定',
active: true,
disabled: false,
},
cancelBtn: {
text: '取消',
active: false,
disabled: false,
},
onConfirm: () => {
this.postNoSaleSure({skc, num});
},
}).show();
} else {
this.postNoSaleSure({skc, num});
}
},
async postNoSaleSure({skc, num}) {
const result = await this.postNoSale({
product_id: this.productInfo.productId,
storage_id: skc.storageId,
... ... @@ -151,7 +186,7 @@ export default {
}).show();
}
this.slideSkc = {};
},
}
},
components: {Button, ScrollView, ProductList, ImgSize, ModalPrice, ModalUnstock}
};
... ...
... ... @@ -6,7 +6,7 @@ const logger = global.yoho.logger;
*/
exports.serverError = (err, req, res, next) => { // eslint-disable-line
logger.error(`error at path: ${req.url}`);
logger.error(`${req.url},${err}`);
logger.error(`${req.url},${typeof err === 'object' ? JSON.stringify(err) : err}`);
res.status(err.code || 500);
... ...