Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
group-buy-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
group-buy-ui
Commits
75c5d4e0
Commit
75c5d4e0
authored
Oct 09, 2021
by
Xuguangxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 海报空图以及intersection-poilly的问题
parent
89429060
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
34 deletions
+61
-34
sharePic.vue
src/components/sharePic.vue
+46
-25
main.js
src/main.js
+1
-0
groupDescInfo.vue
src/views/goodsDetail/components/groupDescInfo.vue
+14
-9
No files found.
src/components/sharePic.vue
View file @
75c5d4e0
...
@@ -167,48 +167,69 @@ export default {
...
@@ -167,48 +167,69 @@ 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
=
raw
Data
.
skuName
||
''
;
const
originSkuName
=
sharePic
Data
.
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
(
raw
Data
);
const
[
qrcodeUrl
]
=
await
groupBuyApi
.
getQrcodeUrl
(
sharePic
Data
);
this
.
qrcodeUrl
=
qrcodeUrl
;
this
.
qrcodeUrl
=
qrcodeUrl
;
},
async
createAndUploadPic
(
sharePicData
)
{
this
.
$store
.
dispatch
(
'
change_loading_pic
'
,
true
);
await
this
.
prepare
(
sharePicData
);
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
html2canvas
(
this
.
$refs
.
sharePic
,
{
setTimeout
(()
=>
{
width
:
1080
,
html2canvas
(
this
.
$refs
.
sharePic
,
{
height
:
1920
,
width
:
1080
,
useCORS
:
true
,
height
:
1920
,
scale
:
1
,
useCORS
:
true
,
allowTaint
:
false
scale
:
1
,
})
allowTaint
:
false
.
then
(
canvas
=>
{
canvas
.
name
=
`
${
this
.
randomString
()}
.jpeg`
;
canvas
.
toBlob
(
blob
=>
this
.
uploadPic
(
blob
),
'
image/jpeg
'
,
0.85
);
})
})
.
catch
(
error
=>
{
.
then
(
canvas
=>
{
this
.
errorHandler
(
error
);
canvas
.
name
=
`
${
this
.
randomString
()}
.jpeg`
;
});
canvas
.
toBlob
(
blob
=>
this
.
uploadPic
(
blob
),
'
image/jpeg
'
,
0.85
);
})
.
catch
(
error
=>
{
this
.
errorHandler
(
error
);
});
},
300
);
});
});
},
},
// 上传海报到七牛,成功后触发outputPicUr事件,参数是七牛文件地址
// 上传海报到七牛,成功后触发outputPicUr事件,参数是七牛文件地址
...
...
src/main.js
View file @
75c5d4e0
...
@@ -12,6 +12,7 @@ import Raven from 'raven-js';
...
@@ -12,6 +12,7 @@ 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
'
;
import
'
intersection-observer
'
;
if
(
process
.
env
.
SENTRY_ENV
!==
'
test
'
&&
process
.
env
.
NODE_ENV
===
'
production
'
)
{
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
,
...
...
src/views/goodsDetail/components/groupDescInfo.vue
View file @
75c5d4e0
...
@@ -104,22 +104,27 @@ export default {
...
@@ -104,22 +104,27 @@ export default {
mounted
()
{
mounted
()
{
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
if
(
this
.
$refs
.
buttonArea
)
{
if
(
this
.
$refs
.
buttonArea
)
{
this
.
observer
=
new
IntersectionObserver
(
entries
=>
{
if
(
IntersectionObserver
)
{
entries
.
forEach
(
item
=>
{
this
.
observer
&&
if
(
item
.
intersectionRatio
==
0
)
{
this
.
observer
.
unobserve
&&
this
.
$emit
(
'
changeButtonVisible
'
,
true
);
this
.
observer
.
unobserve
(
this
.
$refs
.
buttonArea
);
}
else
{
this
.
observer
=
new
IntersectionObserver
(
entries
=>
{
this
.
$emit
(
'
changeButtonVisible
'
,
false
);
entries
.
forEach
(
item
=>
{
}
if
(
item
.
intersectionRatio
==
0
)
{
this
.
$emit
(
'
changeButtonVisible
'
,
true
);
}
else
{
this
.
$emit
(
'
changeButtonVisible
'
,
false
);
}
});
});
});
}
);
}
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
);
}
}
},
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment