Commit 6d9a94bc authored by Xuguangxing's avatar Xuguangxing

feat: 增加团购信息组件

parent 74a12b6a
<template>
<transition :name="`slide-fade-${direction}`">
<div v-if="value" class="swipe-customer-info-container">
<div class="swipe-customer-info-container-icon">
<cr-image width="24px" :src="avatar" class="avatar" />
</div>
<p class="swipe-customer-info-container-info" :style="textStyle">
{{ handleName(name) + ' ' + desc }}
</p>
</div>
</transition>
</template>
<script>
export default {
props: {
value: {
type: Boolean,
default: false
},
avatar: {
type: String,
default: 'https://himg.bdimg.com/sys/portraitn/item/19e96973556e646566696e6564d8bcc080'
},
name: {
type: String,
default: '易烊千玺'
},
color: {
type: String,
default: '#fff'
},
desc: {
type: String,
default: '参与拼团'
},
direction: {
type: String,
default: 'left'
}
},
computed: {
textStyle() {
return {
color: this.color
};
}
},
watch: {
value(v) {
console.log(v);
}
},
methods: {
handleName(name) {
try {
name = name.toString();
const phoneNumReg = /^1\d{10}$/;
if (phoneNumReg.test(name)) {
// 手机号展示前两位+两个星号
return name.slice(0, 2) + '**';
}
// 其余情况先裁剪到最大4位
name = name.slice(0, 4);
if (name.length == 4) return name.slice(0, 2) + '**';
if (name.length == 3) return name.slice(0, 1) + '**';
if (name.length == 2) return name.slice(0, 1) + '*';
if (name.length == 1) return name.slice(0, 1);
return name;
} catch (err) {
return name.slice(0, 1) + '**';
}
}
}
};
</script>
<style scoped lang="less">
.swipe-customer-info-container {
box-sizing: border-box;
display: inline-flex;
align-items: center;
height: 30px;
background: rgba(0, 0, 0, 0.2);
border-radius: 15px;
padding: @padding-unit;
&-icon {
flex-shrink: 0;
width: 24px;
height: 24px;
margin-right: @padding-unit + 2;
.avatar {
/deep/ img {
border-radius: 50%;
}
}
}
&-info {
flex-shrink: 0;
padding-right: @padding-unit - 2;
.text-12();
}
}
.slide-fade-left-enter-active {
transition: all 0.3s ease;
}
.slide-fade-left-leave-active {
transition: all 0.2s cubic-bezier(1, 0.5, 0.8, 1);
}
.slide-fade-left-enter {
transform: translateX(-20px);
opacity: 0;
}
.slide-fade-left-leave-to {
opacity: 0;
}
.slide-fade-right-enter-active {
transition: all 0.3s ease;
}
.slide-fade-right-leave-active {
transition: all 0.2s cubic-bezier(1, 0.5, 0.8, 1);
}
.slide-fade-right-enter {
transform: translateX(20px);
opacity: 0;
}
.slide-fade-right-leave-to {
opacity: 0;
}
</style>
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
const protocol = window.location.protocol; const protocol = window.location.protocol;
const qiniuHost = protocol + '//kdspstatic.q-gp.com/'; const qiniuHost = protocol + '//kdspstatic.q-gp.com/';
const shenceHost = 'https://bn.xyqb.com/sa?project=default'; // 测试地址 const shenceHost = 'https://bn.xyqb.com/sa?project=default'; // 测试地址
const talosHost = 'https://talos-tob.liangkebang.net'; const talosHost = 'https://talos-vcc2.liangkebang.net';
const faceHost = 'https://auth-tob.liangkebang.net'; const faceHost = 'https://auth-vcc2.liangkebang.net';
const kdspHost = 'https://kdsp-api-tob.liangkebang.net'; const kdspHost = 'https://kdsp-api-vcc2.liangkebang.net';
const VCC_CHANNEL = ''; const VCC_CHANNEL = '';
const TERMINAL = 'H5'; const TERMINAL = 'H5';
const VERSION = '7.9.00'; const VERSION = '7.9.00';
......
<template> <template>
<div class="goods-bottom"> <div class="goods-bottom">
<cr-button shape="circle" :disabled="disabled" type="primary" block @click="buy"> <cr-button shape="circle" :disabled="disabled" type="primary" block @click="buy">
{{ shopBtnName }} 立即参团
</cr-button> </cr-button>
<cr-button shape="circle" :disabled="disabled" type="primary" block @click="buy"> <cr-button shape="circle" :disabled="disabled" type="primary" block @click="buy">
{{ shopBtnName }} 立即开团
</cr-button> </cr-button>
</div> </div>
</template> </template>
......
...@@ -39,12 +39,9 @@ ...@@ -39,12 +39,9 @@
.goods { .goods {
padding-bottom: 60px;
&-detail-imgs {
padding-bottom: 40px;
}
&-container { &-container {
height: calc(100% - 60px); padding-bottom: 60px;
box-sizing: border-box;
font-size: 16px; font-size: 16px;
&-lose { &-lose {
&-container { &-container {
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<div class="custom-indicator">{{ swiperCurrent + 1 }}/{{ imgList.length }}</div> <div class="custom-indicator">{{ swiperCurrent + 1 }}/{{ imgList.length }}</div>
</template> </template>
</cr-swipe> </cr-swipe>
<swipe-customer-info v-model="showInfo" />
</div> </div>
<!-- 商品名称/价格 --> <!-- 商品名称/价格 -->
<div class="goods-info"> <div class="goods-info">
...@@ -151,12 +152,7 @@ ...@@ -151,12 +152,7 @@
</div> </div>
</div> </div>
</cr-popup> </cr-popup>
<bottom-nav <bottom-nav type="shoppingCar" :disabled="false" @buy="goVccOrDetail" />
type="shoppingCar"
:disabled="false"
:shop-btn-name="buttonName"
@buy="goVccOrDetail"
/>
</div> </div>
</template> </template>
<script> <script>
...@@ -165,13 +161,15 @@ import goodsCell from './components/goodsCell'; ...@@ -165,13 +161,15 @@ import goodsCell from './components/goodsCell';
import detailInfoArea from './components/detailInfo.vue'; import detailInfoArea from './components/detailInfo.vue';
import Img2Thumb from '@/filters/img2Thumb.filter'; import Img2Thumb from '@/filters/img2Thumb.filter';
import bottomNav from './components/bottomNav'; import bottomNav from './components/bottomNav';
import swipeCustomerInfo from '@/components/swipeCustomerInfo';
export default { export default {
// eslint-disable-next-line vue/name-property-casing // eslint-disable-next-line vue/name-property-casing
name: 'goodDetail', name: 'goodDetail',
components: { components: {
detailInfoArea, detailInfoArea,
goodsCell, goodsCell,
bottomNav bottomNav,
swipeCustomerInfo
// tipModal // tipModal
}, },
filters: { filters: {
...@@ -180,6 +178,7 @@ export default { ...@@ -180,6 +178,7 @@ export default {
data() { data() {
return { return {
flag: false, flag: false,
showInfo: false,
detailParam: { detailParam: {
skuNo: '', skuNo: '',
receiverId: '', receiverId: '',
...@@ -237,6 +236,12 @@ export default { ...@@ -237,6 +236,12 @@ export default {
}, },
mounted() { mounted() {
// todo 曝光埋点 // todo 曝光埋点
setTimeout(() => {
this.showInfo = true;
}, 3000);
setTimeout(() => {
this.showInfo = false;
}, 5000);
}, },
methods: { methods: {
onChange(index) { onChange(index) {
......
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