Commit fd1e0d8e authored by beisir's avatar beisir

Merge branch 'feat/group-buy' of git.quantgroup.cn:ui/group-buy-ui into feat/group-buy

parents d2c8f077 cf969ed1
...@@ -167,34 +167,54 @@ export default { ...@@ -167,34 +167,54 @@ export default {
} }
return n; return n;
}, },
async prepare(rawData) { // async prepare(rawData) {
this.sharePicData = rawData; // this.sharePicData = rawData;
this.handleAvator(rawData); // this.handleAvator(rawData);
// // 将每个字符套入行内标签,用于解决canvas fillText的不换行问题
// let skuName = '';
// const originSkuName = rawData.skuName || '';
// for (let i = 0; i < originSkuName.length; i++) {
// skuName += `<span>${originSkuName[i]}</span>`;
// }
// this.skuName = skuName;
// const [endTimeYMD, endTimeHMS = ''] = (rawData.endTime && rawData.endTime.split(' ')) || [];
// if (endTimeYMD) {
// const day = new Date(endTimeYMD);
// this.endTime = `${day.getMonth() + 1}月${day.getDate()}日 ${endTimeHMS}`;
// }
// const [qrcodeUrl] = await groupBuyApi.getQrcodeUrl(rawData);
// this.qrcodeUrl = qrcodeUrl;
// },
async createAndUploadPic(sharePicData) {
this.$store.dispatch('change_loading_pic', true);
this.sharePicData = sharePicData;
this.handleAvator(sharePicData);
// 将每个字符套入行内标签,用于解决canvas fillText的不换行问题 // 将每个字符套入行内标签,用于解决canvas fillText的不换行问题
let skuName = ''; let skuName = '';
const originSkuName = rawData.skuName || ''; const originSkuName = sharePicData.skuName || '';
for (let i = 0; i < originSkuName.length; i++) { for (let i = 0; i < originSkuName.length; i++) {
skuName += `<span>${originSkuName[i]}</span>`; skuName += `<span>${originSkuName[i]}</span>`;
} }
this.skuName = skuName; this.skuName = skuName;
const [endTimeYMD, endTimeHMS = ''] = (rawData.endTime && rawData.endTime.split(' ')) || []; const [endTimeYMD, endTimeHMS = ''] =
(sharePicData.endTime && sharePicData.endTime.split(' ')) || [];
if (endTimeYMD) { if (endTimeYMD) {
const day = new Date(endTimeYMD); const day = new Date(endTimeYMD);
this.endTime = `${day.getMonth() + 1}${day.getDate()}${endTimeHMS}`; this.endTime = `${day.getMonth() + 1}${day.getDate()}${endTimeHMS}`;
} }
const [qrcodeUrl] = await groupBuyApi.getQrcodeUrl(rawData); const [qrcodeUrl] = await groupBuyApi.getQrcodeUrl(sharePicData);
this.qrcodeUrl = qrcodeUrl; this.qrcodeUrl = qrcodeUrl;
},
async createAndUploadPic(sharePicData) {
this.$store.dispatch('change_loading_pic', true);
await this.prepare(sharePicData);
this.$nextTick(() => { this.$nextTick(() => {
setTimeout(() => {
html2canvas(this.$refs.sharePic, { html2canvas(this.$refs.sharePic, {
width: 1080, width: 1080,
height: 1920, height: 1920,
...@@ -209,6 +229,7 @@ export default { ...@@ -209,6 +229,7 @@ export default {
.catch(error => { .catch(error => {
this.errorHandler(error); this.errorHandler(error);
}); });
}, 300);
}); });
}, },
// 上传海报到七牛,成功后触发outputPicUr事件,参数是七牛文件地址 // 上传海报到七牛,成功后触发outputPicUr事件,参数是七牛文件地址
......
...@@ -12,7 +12,8 @@ import Raven from 'raven-js'; ...@@ -12,7 +12,8 @@ import Raven from 'raven-js';
import RavenVue from 'raven-js/plugins/vue'; import RavenVue from 'raven-js/plugins/vue';
import { release } from '../.sentryclirc'; import { release } from '../.sentryclirc';
import lazyload from '@qg/cherry-ui/src/lazyload/index'; import lazyload from '@qg/cherry-ui/src/lazyload/index';
if (process.env.SENTRY_ENV !== 'test' && process.env.NODE_ENV !== 'production') { import 'intersection-observer';
if (process.env.SENTRY_ENV !== 'test' && process.env.NODE_ENV === 'production') {
Raven.config('//8d1b2a5f74bb42ad806e52a11b1173f2@sentry.q-gp.com/80', { Raven.config('//8d1b2a5f74bb42ad806e52a11b1173f2@sentry.q-gp.com/80', {
release, release,
environment: process.env.NODE_ENV environment: process.env.NODE_ENV
......
...@@ -13,14 +13,6 @@ export default [ ...@@ -13,14 +13,6 @@ export default [
}, },
component: () => import('../components/error') component: () => import('../components/error')
}, },
{
path: '/share-test',
name: 'share-test',
meta: {
title: '出错了'
},
component: () => import('../views/test/share-test.vue')
},
{ {
path: '*', path: '*',
name: 'notFound', name: 'notFound',
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
v-model="address.receiverPhoneNo" v-model="address.receiverPhoneNo"
class="address-input" class="address-input"
name="手机号码" name="手机号码"
type="tel"
max-length="11"
label="手机号码" label="手机号码"
placeholder="请输入收货人手机号码" placeholder="请输入收货人手机号码"
/> />
...@@ -99,8 +97,8 @@ export default { ...@@ -99,8 +97,8 @@ export default {
firstGroupShare(); firstGroupShare();
this.type = this.$route.query.type || ''; this.type = this.$route.query.type || '';
this.order = this.$route.query.type || false; this.order = this.$route.query.type || false;
console.log(this.order);
if (this.type === 'edit') { if (this.type === 'edit') {
console.log(JSON.stringify(this.$route.params));
const data = { ...this.$route.params.editAddress }; const data = { ...this.$route.params.editAddress };
data.addrFullName = data.addrFullName data.addrFullName = data.addrFullName
.substring(0, data.addrFullName.length - data.detail.length) .substring(0, data.addrFullName.length - data.detail.length)
......
...@@ -104,6 +104,10 @@ export default { ...@@ -104,6 +104,10 @@ export default {
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
if (this.$refs.buttonArea) { if (this.$refs.buttonArea) {
if (IntersectionObserver) {
this.observer &&
this.observer.unobserve &&
this.observer.unobserve(this.$refs.buttonArea);
this.observer = new IntersectionObserver(entries => { this.observer = new IntersectionObserver(entries => {
entries.forEach(item => { entries.forEach(item => {
if (item.intersectionRatio == 0) { if (item.intersectionRatio == 0) {
...@@ -113,13 +117,14 @@ export default { ...@@ -113,13 +117,14 @@ export default {
} }
}); });
}); });
}
this.observer.USE_MUTATION_OBSERVER = false; this.observer.USE_MUTATION_OBSERVER = false;
this.observer.observe(this.$refs.buttonArea); this.observer.observe(this.$refs.buttonArea);
} }
}); });
}, },
beforeDestroy() { beforeDestroy() {
if (this.$refs.buttonArea) { if (this.$refs.buttonArea && this.observer) {
this.observer.unobserve(this.$refs.buttonArea); this.observer.unobserve(this.$refs.buttonArea);
} }
}, },
......
...@@ -345,7 +345,7 @@ export default { ...@@ -345,7 +345,7 @@ export default {
delete checkParams.activityHundredGroupId; delete checkParams.activityHundredGroupId;
} }
const [checkStatus] = await goods.checkGroupBuyCreateOrder(checkParams); const [checkStatus] = await goods.checkGroupBuyCreateOrder(checkParams);
if (!checkStatus.verifyResult) { if (checkStatus && !checkStatus.verifyResult) {
// 校验是否允许开团或者参团 // 校验是否允许开团或者参团
this.$dialog({ this.$dialog({
message: checkStatus.failedReason || '', message: checkStatus.failedReason || '',
......
...@@ -173,10 +173,13 @@ export default { ...@@ -173,10 +173,13 @@ export default {
invalidSkuList, invalidSkuList,
shopSkuList: [] shopSkuList: []
}; };
if (shopSkuList) {
shopSkuList.forEach(item => { shopSkuList.forEach(item => {
if (!item) return; if (!item) return;
orderInfo.shopSkuList = [...orderInfo.shopSkuList, ...item.skuList]; orderInfo.shopSkuList = [...orderInfo.shopSkuList, ...item.skuList];
}); });
}
console.log(orderInfo); console.log(orderInfo);
this.$set(this, 'orderInfo', orderInfo); this.$set(this, 'orderInfo', orderInfo);
this.isOutBuy = false; this.isOutBuy = false;
......
<template>
<button style="width: 80%; height: 35px; background:#f00" @click="share">分享</button>
</template>
<script>
import Bridge from '@qg/js-bridge';
export default {
methods: {
share() {
const nativeBridge = new Bridge();
const data = {
event: 'showShareView',
data: {
platform: ['weChat', 'timeLine', 'QQ', 'QQZone', 'CopyLink', 'GeneratePoster'], //依次分别是微信、朋友圈、QQ好友、QQ空间、复制链接
shareDic: {
title: 'aaaa',
desc: 'bbbb',
link: `https://www.baidu.com`, // 页面地址
imgUrl: 'https://kdspstatic.q-gp.com/FnPUaThQoK23qZjhXTG9C8XopI4y', // 图片地址
posterUrl: 'https://kdspstatic.q-gp.com/FnPUaThQoK23qZjhXTG9C8XopI4y' // 海报地址
}
}
};
nativeBridge.showShareView(data);
}
}
};
</script>
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