海报:修复海报保存报错
parent
6b8a4fec29
commit
f00a8052ea
|
@ -29,6 +29,7 @@
|
||||||
<!-- 海报画板:默认隐藏只用来生成海报。生成方式为主动调用 -->
|
<!-- 海报画板:默认隐藏只用来生成海报。生成方式为主动调用 -->
|
||||||
<l-painter
|
<l-painter
|
||||||
isCanvasToTempFilePath
|
isCanvasToTempFilePath
|
||||||
|
pathType="url"
|
||||||
@success="setPainterImageUrl"
|
@success="setPainterImageUrl"
|
||||||
hidden
|
hidden
|
||||||
ref="painterRef"
|
ref="painterRef"
|
||||||
|
@ -65,7 +66,7 @@
|
||||||
css: {
|
css: {
|
||||||
// 根节点若无尺寸,自动获取父级节点
|
// 根节点若无尺寸,自动获取父级节点
|
||||||
width: sheep.$platform.device.windowWidth * 0.9,
|
width: sheep.$platform.device.windowWidth * 0.9,
|
||||||
height: 600,
|
height: 550,
|
||||||
},
|
},
|
||||||
views: [],
|
views: [],
|
||||||
});
|
});
|
||||||
|
@ -92,6 +93,7 @@
|
||||||
sheep.$helper.toast('请长按图片保存');
|
sheep.$helper.toast('请长按图片保存');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 非H5 保存到相册
|
// 非H5 保存到相册
|
||||||
uni.saveImageToPhotosAlbum({
|
uni.saveImageToPhotosAlbum({
|
||||||
filePath: painterImageUrl.value,
|
filePath: painterImageUrl.value,
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import third from '@/sheep/api/migration/third';
|
import { formatImageUrlProtocol, getWxaQrcode } from './index';
|
||||||
import { formatImageUrlProtocol } from './index';
|
|
||||||
|
|
||||||
const goods = async (poster) => {
|
const goods = async (poster) => {
|
||||||
const width = poster.width;
|
const width = poster.width;
|
||||||
const userInfo = sheep.$store('user').userInfo;
|
const userInfo = sheep.$store('user').userInfo;
|
||||||
const wxa_qrcode = 'data:image/png;base64,' + (await third.wechat.getWxacode(poster.shareInfo.path, poster.shareInfo.query)).data;
|
const wxa_qrcode = await getWxaQrcode(poster.shareInfo.path, poster.shareInfo.query);
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
type: 'image',
|
type: 'image',
|
||||||
|
@ -62,7 +61,7 @@ const goods = async (poster) => {
|
||||||
top: width * 1.18,
|
top: width * 1.18,
|
||||||
color: '#333',
|
color: '#333',
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
lineHeight: 5,
|
lineHeight: 15,
|
||||||
maxWidth: width * 0.91,
|
maxWidth: width * 0.91,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -72,7 +71,7 @@ const goods = async (poster) => {
|
||||||
css: {
|
css: {
|
||||||
position: 'fixed',
|
position: 'fixed',
|
||||||
left: width * 0.04,
|
left: width * 0.04,
|
||||||
top: width * 1.3,
|
top: width * 1.31,
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
fontFamily: 'OPPOSANS',
|
fontFamily: 'OPPOSANS',
|
||||||
color: '#333',
|
color: '#333',
|
||||||
|
@ -87,7 +86,7 @@ const goods = async (poster) => {
|
||||||
css: {
|
css: {
|
||||||
position: 'fixed',
|
position: 'fixed',
|
||||||
left: width * 0.3,
|
left: width * 0.3,
|
||||||
top: width * 1.32,
|
top: width * 1.33,
|
||||||
color: '#999',
|
color: '#999',
|
||||||
fontSize: 10,
|
fontSize: 10,
|
||||||
fontFamily: 'OPPOSANS',
|
fontFamily: 'OPPOSANS',
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import { formatImageUrlProtocol } from './index';
|
import { formatImageUrlProtocol, getWxaQrcode } from './index';
|
||||||
import third from '@/sheep/api/migration/third';
|
|
||||||
|
|
||||||
const groupon = async (poster) => {
|
const groupon = async (poster) => {
|
||||||
const width = poster.width;
|
const width = poster.width;
|
||||||
const userInfo = sheep.$store('user').userInfo;
|
const userInfo = sheep.$store('user').userInfo;
|
||||||
const wxa_qrcode = 'data:image/png;base64,' + (await third.wechat.getWxacode(poster.shareInfo.path, poster.shareInfo.query)).data;
|
const wxa_qrcode = await getWxaQrcode(poster.shareInfo.path, poster.shareInfo.query);
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
type: 'image',
|
type: 'image',
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import user from './user';
|
import user from './user';
|
||||||
import goods from './goods';
|
import goods from './goods';
|
||||||
import groupon from './groupon';
|
import groupon from './groupon';
|
||||||
|
import third from '@/sheep/api/migration/third';
|
||||||
|
|
||||||
export function getPosterData(options) {
|
export function getPosterData(options) {
|
||||||
switch (options.shareInfo.poster.type) {
|
switch (options.shareInfo.poster.type) {
|
||||||
|
@ -30,3 +31,9 @@ export function formatImageUrlProtocol(url) {
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获得微信小程序码 (Base64 image)
|
||||||
|
export async function getWxaQrcode(path, query) {
|
||||||
|
const res = await third.wechat.getWxacode(path, query);
|
||||||
|
return 'data:image/png;base64,' + res.data;
|
||||||
|
}
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import { formatImageUrlProtocol } from './index';
|
import { formatImageUrlProtocol, getWxaQrcode } from './index';
|
||||||
import third from '@/sheep/api/migration/third';
|
|
||||||
|
|
||||||
const user = async (poster) => {
|
const user = async (poster) => {
|
||||||
const width = poster.width;
|
const width = poster.width;
|
||||||
const userInfo = sheep.$store('user').userInfo;
|
const userInfo = sheep.$store('user').userInfo;
|
||||||
const wxa_qrcode = 'data:image/png;base64,' + (await third.wechat.getWxacode(poster.shareInfo.path, poster.shareInfo.query)).data;
|
const wxa_qrcode = await getWxaQrcode(poster.shareInfo.path, poster.shareInfo.query);
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
type: 'image',
|
type: 'image',
|
||||||
|
|
Loading…
Reference in New Issue