parent
3e2fcfafeb
commit
1750234318
File diff suppressed because it is too large
Load Diff
@ -1,339 +1,451 @@
|
||||
function genCard(vcard) {
|
||||
// 名片預覽
|
||||
let vcardLink;
|
||||
if (vcard.url.trim().length > 0) {
|
||||
if (vcard.nc_func.indexOf("nourl") !== -1) {
|
||||
vcardLink = {
|
||||
type: "text",
|
||||
text: vcard.url,
|
||||
color: "#FFFFFF",
|
||||
align: "end",
|
||||
};
|
||||
vcardLink = `
|
||||
{
|
||||
"type": "box",
|
||||
"layout": "baseline",
|
||||
"contents": [
|
||||
{
|
||||
"type": "icon",
|
||||
"url": "https://369cycle.zltest.com.tw/tggo/template/icon/link.png",
|
||||
"size": "sm",
|
||||
"offsetTop": "xs",
|
||||
"offsetEnd": "md"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"text": "${vcard.url}",
|
||||
"color": "#6c6664",
|
||||
"size": "md"
|
||||
}
|
||||
],
|
||||
"margin": "md",
|
||||
"paddingStart": "lg"
|
||||
},
|
||||
`;
|
||||
} else {
|
||||
vcardLink = {
|
||||
type: "text",
|
||||
text: vcard.url,
|
||||
color: "#FFFFFF",
|
||||
align: "end",
|
||||
action: {
|
||||
type: "uri",
|
||||
label: "action",
|
||||
uri: vcard.url,
|
||||
vcardLink = `
|
||||
{
|
||||
"type": "box",
|
||||
"layout": "baseline",
|
||||
"contents": [
|
||||
{
|
||||
"type": "icon",
|
||||
"url": "https://369cycle.zltest.com.tw/tggo/template/icon/link.png",
|
||||
"size": "sm",
|
||||
"offsetTop": "xs",
|
||||
"offsetEnd": "md"
|
||||
},
|
||||
};
|
||||
{
|
||||
"type": "text",
|
||||
"text": "${vcard.url}",
|
||||
"color": "#6c6664",
|
||||
"size": "md",
|
||||
"action": {
|
||||
"type": "uri",
|
||||
"label": "yahoo",
|
||||
"uri": "${vcard.url}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"margin": "md",
|
||||
"paddingStart": "lg"
|
||||
},
|
||||
`;
|
||||
}
|
||||
} else {
|
||||
vcardLink = {
|
||||
type: "text",
|
||||
text: " ",
|
||||
color: "#FFFFFF",
|
||||
align: "end",
|
||||
};
|
||||
vcardLink = "";
|
||||
}
|
||||
|
||||
let vcardAddr;
|
||||
if (vcard.address.trim().length > 0) {
|
||||
vcardAddr = {
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [
|
||||
{
|
||||
type: "text",
|
||||
text: vcard.address.substr(0, 3),
|
||||
size: "sm",
|
||||
},
|
||||
vcardAddr = `
|
||||
{
|
||||
"type": "box",
|
||||
"layout": "baseline",
|
||||
"contents": [
|
||||
{
|
||||
type: "text",
|
||||
text:
|
||||
vcard.address.substr(3).length > 0 ? vcard.address.substr(3) : " ",
|
||||
size: "sm",
|
||||
wrap: true,
|
||||
maxLines: 2,
|
||||
"type": "icon",
|
||||
"url": "https://369cycle.zltest.com.tw/tggo/template/icon/map.png",
|
||||
"size": "sm",
|
||||
"offsetTop": "xs",
|
||||
"offsetEnd": "md"
|
||||
},
|
||||
],
|
||||
position: "absolute",
|
||||
offsetTop: "30%",
|
||||
offsetStart: "25%",
|
||||
width: "40%",
|
||||
height: "60px",
|
||||
action: {
|
||||
type: "uri",
|
||||
label: "action",
|
||||
uri: `https://www.google.com.tw/maps/place/${encodeURIComponent(
|
||||
{
|
||||
"type": "text",
|
||||
"text": "${vcard.address}",
|
||||
"color": "#6c6664",
|
||||
"size": "md",
|
||||
"action": {
|
||||
"type": "uri",
|
||||
"label": "action",
|
||||
"uri": "https://www.google.com.tw/maps/place/${encodeURIComponent(
|
||||
vcard.address
|
||||
)}`,
|
||||
},
|
||||
};
|
||||
} else {
|
||||
vcardAddr = {
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [
|
||||
{
|
||||
type: "text",
|
||||
text: " ",
|
||||
size: "sm",
|
||||
)}"
|
||||
},
|
||||
"wrap": true
|
||||
}
|
||||
],
|
||||
position: "absolute",
|
||||
offsetTop: "30%",
|
||||
offsetStart: "25%",
|
||||
width: "40%",
|
||||
height: "60px",
|
||||
};
|
||||
"margin": "md",
|
||||
"paddingStart": "lg"
|
||||
}
|
||||
|
||||
if (vcard.title.trim().length == 0) {
|
||||
vcard.title = " ";
|
||||
`;
|
||||
} else {
|
||||
vcardAddr = "";
|
||||
}
|
||||
|
||||
let vcardTel;
|
||||
|
||||
if (vcard.tel.trim().length == 0) {
|
||||
vcardTel = {
|
||||
type: "text",
|
||||
text: " ",
|
||||
align: "end",
|
||||
};
|
||||
} else {
|
||||
vcardTel = {
|
||||
type: "text",
|
||||
text: vcard.tel,
|
||||
align: "end",
|
||||
action: {
|
||||
type: "uri",
|
||||
label: "action",
|
||||
uri: "tel:" + vcard.tel,
|
||||
if (vcard.tel.trim().length > 0) {
|
||||
vcardTel = `
|
||||
{
|
||||
"type": "box",
|
||||
"layout": "baseline",
|
||||
"contents": [
|
||||
{
|
||||
"type": "icon",
|
||||
"url": "https://369cycle.zltest.com.tw/tggo/template/icon/phone.png",
|
||||
"size": "sm",
|
||||
"offsetTop": "xs",
|
||||
"offsetEnd": "md"
|
||||
},
|
||||
};
|
||||
{
|
||||
"type": "text",
|
||||
"text": "${vcard.tel}",
|
||||
"color": "#6c6664",
|
||||
"size": "md",
|
||||
"action": {
|
||||
"type": "uri",
|
||||
"label": "action",
|
||||
"uri": "tel:${vcard.tel}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"margin": "md",
|
||||
"paddingStart": "lg"
|
||||
},
|
||||
`;
|
||||
} else {
|
||||
vcardTel = "";
|
||||
}
|
||||
|
||||
let vcardPhone;
|
||||
|
||||
if (vcard.phone.trim().length == 0) {
|
||||
vcardPhone = {
|
||||
type: "text",
|
||||
text: " ",
|
||||
align: "end",
|
||||
};
|
||||
} else {
|
||||
vcardPhone = {
|
||||
type: "text",
|
||||
text: vcard.phone,
|
||||
align: "end",
|
||||
action: {
|
||||
type: "uri",
|
||||
label: "action",
|
||||
uri: "tel:" + vcard.phone,
|
||||
if (vcard.phone.trim().length > 0) {
|
||||
vcardPhone = `
|
||||
{
|
||||
"type": "box",
|
||||
"layout": "vertical",
|
||||
"contents": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "${vcard.phone}",
|
||||
"size": "xxl",
|
||||
"color": "#93476e",
|
||||
"action": {
|
||||
"type": "uri",
|
||||
"label": "action",
|
||||
"uri": "tel:${vcard.phone}"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
};
|
||||
`;
|
||||
} else {
|
||||
vcardPhone = "";
|
||||
}
|
||||
|
||||
let vcardAvatar;
|
||||
|
||||
if (vcard.avatar.trim().length > 0) {
|
||||
vcardAvatar = {
|
||||
type: "image",
|
||||
url: vcard.avatar,
|
||||
action: {
|
||||
type: "uri",
|
||||
label: "action",
|
||||
uri: vcard.nfcurl + "&cardid=1",
|
||||
},
|
||||
aspectMode: "cover",
|
||||
size: "full",
|
||||
};
|
||||
vcardAvatar = `
|
||||
{
|
||||
"type": "image",
|
||||
"url": "${vcard.avatar}",
|
||||
"size": "full",
|
||||
"aspectRatio": "1:1",
|
||||
"aspectMode": "cover",
|
||||
"action": {
|
||||
"type": "uri",
|
||||
"label": "action",
|
||||
"uri": "${vcard.nfcurl}&cardid=1"
|
||||
}
|
||||
}
|
||||
`;
|
||||
} else {
|
||||
vcardAvatar = {
|
||||
type: "text",
|
||||
text: " ",
|
||||
size: "xs",
|
||||
};
|
||||
vcardAvatar = "";
|
||||
}
|
||||
|
||||
let vcardEmail;
|
||||
|
||||
if (vcard.email.trim().length > 0) {
|
||||
vcardEmail = {
|
||||
type: "text",
|
||||
text: vcard.email,
|
||||
color: "#333334",
|
||||
size: "sm",
|
||||
weight: "bold",
|
||||
action: {
|
||||
type: "uri",
|
||||
label: "action",
|
||||
uri: `mailto:${vcard.email}`,
|
||||
vcardEmail = `
|
||||
{
|
||||
"type": "box",
|
||||
"layout": "baseline",
|
||||
"contents": [
|
||||
{
|
||||
"type": "icon",
|
||||
"url": "https://369cycle.zltest.com.tw/tggo/template/icon/mail.png",
|
||||
"size": "sm",
|
||||
"offsetTop": "xs",
|
||||
"offsetEnd": "md"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"text": "${vcard.email}",
|
||||
"color": "#6c6664",
|
||||
"size": "md",
|
||||
"action": {
|
||||
"type": "uri",
|
||||
"label": "action",
|
||||
"uri": "mailto:${vcard.email}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"margin": "md",
|
||||
"paddingStart": "lg"
|
||||
},
|
||||
align: "end",
|
||||
};
|
||||
`;
|
||||
} else {
|
||||
vcardEmail = {
|
||||
type: "text",
|
||||
text: " ",
|
||||
color: "#333334",
|
||||
size: "sm",
|
||||
weight: "bold",
|
||||
align: "end",
|
||||
};
|
||||
vcardEmail = "";
|
||||
}
|
||||
|
||||
let card = {
|
||||
altText: "UTel電子名片",
|
||||
type: "flex",
|
||||
contents: {
|
||||
type: "bubble",
|
||||
size: "giga",
|
||||
body: {
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [
|
||||
{
|
||||
type: "image",
|
||||
url: process.env.VUE_APP_BASE_URL+"/images/tpl02_bg.png",
|
||||
size: "full",
|
||||
aspectMode: "cover",
|
||||
aspectRatio: "4:3",
|
||||
gravity: "top",
|
||||
},
|
||||
// 名片發送
|
||||
|
||||
let card = `
|
||||
{
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [vcardAvatar],
|
||||
position: "absolute",
|
||||
offsetTop: "13%",
|
||||
offsetStart: "3%",
|
||||
width: "75px",
|
||||
height: "75px",
|
||||
cornerRadius: "100px",
|
||||
},
|
||||
"altText": "UTel電子名片",
|
||||
"type": "flex",
|
||||
"contents":
|
||||
{
|
||||
"type": "bubble",
|
||||
"size": "giga",
|
||||
"body": {
|
||||
"type": "box",
|
||||
"layout": "vertical",
|
||||
"contents": [
|
||||
{
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [
|
||||
{
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [
|
||||
{
|
||||
type: "text",
|
||||
text: "加入好友",
|
||||
align: "center",
|
||||
color: "#ffffff",
|
||||
weight: "bold",
|
||||
margin: "xs",
|
||||
size: "xs",
|
||||
"type": "box",
|
||||
"layout": "vertical",
|
||||
"contents": [
|
||||
{
|
||||
"type": "box",
|
||||
"layout": "vertical",
|
||||
"contents": [],
|
||||
"height": "45%"
|
||||
},
|
||||
{
|
||||
"type": "box",
|
||||
"layout": "vertical",
|
||||
"contents": [
|
||||
{
|
||||
"type": "image",
|
||||
"size": "full",
|
||||
"position": "relative",
|
||||
"url": "https://369cycle.zltest.com.tw/tggo/template/bg-03h.png"
|
||||
}
|
||||
],
|
||||
backgroundColor: "#ffcc5b",
|
||||
width: "100%",
|
||||
cornerRadius: "5px",
|
||||
action: {
|
||||
type: "uri",
|
||||
label: "action",
|
||||
uri: "https://line.naver.jp/ti/p/~" + vcard.line,
|
||||
},
|
||||
paddingTop: "5px",
|
||||
paddingBottom: "5px",
|
||||
"height": "55%"
|
||||
}
|
||||
],
|
||||
"height": "100%",
|
||||
"position": "absolute",
|
||||
"width": "100%"
|
||||
},
|
||||
{
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [
|
||||
{
|
||||
type: "text",
|
||||
text: "分享名片",
|
||||
align: "center",
|
||||
color: "#ffffff",
|
||||
weight: "bold",
|
||||
margin: "xs",
|
||||
size: "xs",
|
||||
"type": "box",
|
||||
"layout": "vertical",
|
||||
"contents": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "Company",
|
||||
"size": "3xl",
|
||||
"weight": "bold",
|
||||
"offsetBottom": "md",
|
||||
"color": "#c6b0c9"
|
||||
},
|
||||
{
|
||||
"type": "box",
|
||||
"layout": "vertical",
|
||||
"contents": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "${vcard.company}",
|
||||
"color": "#ffffff",
|
||||
"size": "md"
|
||||
}
|
||||
],
|
||||
backgroundColor: "#ffcc5b",
|
||||
width: "100%",
|
||||
cornerRadius: "5px",
|
||||
margin: "md",
|
||||
paddingTop: "5px",
|
||||
paddingBottom: "5px",
|
||||
},
|
||||
"backgroundColor": "#6c6d8b",
|
||||
"paddingTop": "sm",
|
||||
"paddingBottom": "sm",
|
||||
"paddingStart": "lg",
|
||||
"cornerRadius": "xxl",
|
||||
"paddingEnd": "lg",
|
||||
"offsetBottom": "xl"
|
||||
}
|
||||
],
|
||||
position: "absolute",
|
||||
offsetStart: "10%",
|
||||
width: "20%",
|
||||
offsetBottom: "16%",
|
||||
action: {
|
||||
type: "uri",
|
||||
label: "action",
|
||||
uri: `${process.env.VUE_APP_SEND_URL}/?userid=${vcard.user_id}&cardid=1`,
|
||||
"cornerRadius": "15px",
|
||||
"paddingStart": "10px",
|
||||
"paddingEnd": "10px",
|
||||
"alignItems": "flex-end",
|
||||
"offsetEnd": "none",
|
||||
"position": "absolute",
|
||||
"offsetTop": "none"
|
||||
},
|
||||
{
|
||||
"type": "box",
|
||||
"layout": "horizontal",
|
||||
"contents": [
|
||||
{
|
||||
"type": "box",
|
||||
"layout": "vertical",
|
||||
"contents": [
|
||||
{
|
||||
"type": "box",
|
||||
"layout": "vertical",
|
||||
"contents": [${vcardAvatar}],
|
||||
"cornerRadius": "10px",
|
||||
"margin": "none",
|
||||
"width": "100%"
|
||||
},
|
||||
{
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [
|
||||
"type": "box",
|
||||
"layout": "vertical",
|
||||
"justifyContent": "space-between",
|
||||
"contents": [
|
||||
{
|
||||
type: "text",
|
||||
text: vcard.name,
|
||||
"type": "button",
|
||||
"action": {
|
||||
"type": "uri",
|
||||
"label": "加入好友",
|
||||
"uri": "http://linecorp.com/"
|
||||
},
|
||||
],
|
||||
position: "absolute",
|
||||
offsetTop: "13%",
|
||||
offsetStart: "25%",
|
||||
width: "90px",
|
||||
"color": "#755483",
|
||||
"height": "sm",
|
||||
"style": "primary",
|
||||
"margin": "md"
|
||||
},
|
||||
{
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [
|
||||
"type": "button",
|
||||
"action": {
|
||||
"type": "uri",
|
||||
"label": "分享名片",
|
||||
"uri": "http://linecorp.com/"
|
||||
},
|
||||
"color": "#93476e",
|
||||
"height": "sm",
|
||||
"style": "primary",
|
||||
"margin": "md"
|
||||
},
|
||||
{
|
||||
type: "text",
|
||||
text: vcard.title,
|
||||
"type": "button",
|
||||
"action": {
|
||||
"type": "uri",
|
||||
"label": "其他連結",
|
||||
"uri": "http://linecorp.com/"
|
||||
},
|
||||
"color": "#c73f6d",
|
||||
"height": "sm",
|
||||
"style": "primary",
|
||||
"margin": "md"
|
||||
}
|
||||
],
|
||||
position: "absolute",
|
||||
offsetTop: "13%",
|
||||
offsetStart: "51%",
|
||||
width: "50%",
|
||||
},
|
||||
vcardAddr,
|
||||
{
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [vcardPhone, vcardTel],
|
||||
position: "absolute",
|
||||
offsetTop: "30%",
|
||||
offsetEnd: "5%",
|
||||
width: "30%",
|
||||
"margin": "xxl"
|
||||
}
|
||||
],
|
||||
"paddingTop": "5%",
|
||||
"paddingBottom": "8%",
|
||||
"justifyContent": "flex-start",
|
||||
"width": "30%",
|
||||
"alignItems": "center",
|
||||
"height": "95%"
|
||||
},
|
||||
{
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [
|
||||
"type": "box",
|
||||
"layout": "vertical",
|
||||
"contents": [
|
||||
{
|
||||
type: "text",
|
||||
text: vcard.company,
|
||||
size: "lg",
|
||||
color: "#EFEFEF",
|
||||
align: "end",
|
||||
weight: "bold",
|
||||
},
|
||||
vcardLink,
|
||||
],
|
||||
position: "absolute",
|
||||
offsetTop: "65%",
|
||||
offsetEnd: "5%",
|
||||
width: "60%",
|
||||
"type": "box",
|
||||
"layout": "horizontal",
|
||||
"contents": [
|
||||
{
|
||||
"type": "box",
|
||||
"layout": "vertical",
|
||||
"contents": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "${vcard.name}",
|
||||
"size": "xxl",
|
||||
"weight": "bold"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "box",
|
||||
"layout": "vertical",
|
||||
"contents": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "${vcard.title}",
|
||||
"size": "md",
|
||||
"weight": "bold",
|
||||
"color": "#888888",
|
||||
"action": {
|
||||
"type": "uri",
|
||||
"label": "action",
|
||||
"uri": "${vcard.nfcurl}&cardid=1"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
paddingAll: "0px",
|
||||
action: {
|
||||
type: "uri",
|
||||
label: "action",
|
||||
uri: vcard.nfcurl + "&cardid=1",
|
||||
"alignItems": "center"
|
||||
},
|
||||
{
|
||||
"type": "separator",
|
||||
"color": "#93476e",
|
||||
"margin": "sm"
|
||||
},
|
||||
{
|
||||
"type": "box",
|
||||
"layout": "vertical",
|
||||
"contents": [
|
||||
${vcardPhone}
|
||||
${vcardTel}
|
||||
${vcardLink}
|
||||
${vcardEmail}
|
||||
${vcardAddr}
|
||||
],
|
||||
"margin": "xs"
|
||||
}
|
||||
],
|
||||
"height": "84%",
|
||||
"paddingStart": "xxl"
|
||||
}
|
||||
],
|
||||
"paddingAll": "xl",
|
||||
"height": "100%",
|
||||
"alignItems": "flex-end"
|
||||
}
|
||||
],
|
||||
"paddingAll": "0px",
|
||||
"action": {
|
||||
"type": "uri",
|
||||
"label": "action",
|
||||
"uri": "https://utel.zltest.com.tw/card/?params=i7Kq7O59hPX1MJ%2Bqd8zQKBwuyc%2F%2BZ%2BZs%2BZXtXBy4zvg%3D&cardid=1"
|
||||
},
|
||||
};
|
||||
return { card: JSON.stringify(card) };
|
||||
"justifyContent": "center",
|
||||
"alignItems": "center",
|
||||
"height": "420px"
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
return { card };
|
||||
}
|
||||
|
||||
export { genCard };
|
||||
|
||||
@ -1,368 +1,342 @@
|
||||
function genCard(vcard) {
|
||||
// 名片預覽
|
||||
let vcardLink;
|
||||
if (vcard.url.trim().length > 0) {
|
||||
if (vcard.nc_func.indexOf("nourl") !== -1) {
|
||||
vcardLink = {
|
||||
type: "box",
|
||||
layout: "baseline",
|
||||
contents: [
|
||||
{
|
||||
type: "text",
|
||||
text: vcard.url,
|
||||
color: "#333334",
|
||||
size: "sm",
|
||||
weight: "bold",
|
||||
align: "end",
|
||||
vcardLink = `{
|
||||
"type": "text",
|
||||
"text": "${vcard.url}",
|
||||
"color": "#6c6664",
|
||||
"size": "md"
|
||||
},
|
||||
],
|
||||
spacing: "lg",
|
||||
margin: "xs",
|
||||
};
|
||||
`;
|
||||
} else {
|
||||
vcardLink = {
|
||||
type: "box",
|
||||
layout: "baseline",
|
||||
contents: [
|
||||
vcardLink = `
|
||||
{
|
||||
type: "text",
|
||||
text: vcard.url,
|
||||
color: "#333334",
|
||||
size: "sm",
|
||||
action: {
|
||||
type: "uri",
|
||||
label: "action",
|
||||
uri: vcard.url,
|
||||
},
|
||||
weight: "bold",
|
||||
align: "end",
|
||||
"type": "text",
|
||||
"text": "${vcard.url}",
|
||||
"color": "#6c6664",
|
||||
"size": "md",
|
||||
"action": {
|
||||
"type": "uri",
|
||||
"label": "yahoo",
|
||||
"uri": "${vcard.url}"
|
||||
}
|
||||
},
|
||||
],
|
||||
spacing: "lg",
|
||||
margin: "xs",
|
||||
};
|
||||
`;
|
||||
}
|
||||
} else {
|
||||
vcardLink = {
|
||||
type: "box",
|
||||
layout: "baseline",
|
||||
contents: [
|
||||
{
|
||||
type: "text",
|
||||
text: " ",
|
||||
color: "#333334",
|
||||
size: "sm",
|
||||
weight: "bold",
|
||||
align: "end",
|
||||
},
|
||||
],
|
||||
spacing: "lg",
|
||||
margin: "xs",
|
||||
};
|
||||
vcardLink = "";
|
||||
}
|
||||
|
||||
let vcardAddr;
|
||||
if (vcard.address.trim().length > 0) {
|
||||
vcardAddr = {
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [
|
||||
vcardAddr = `
|
||||
{
|
||||
type: "text",
|
||||
text: vcard.address,
|
||||
weight: "bold",
|
||||
color: "#333334",
|
||||
size: "sm",
|
||||
align: "end",
|
||||
action: {
|
||||
type: "uri",
|
||||
label: "action",
|
||||
uri: `https://www.google.com.tw/maps/place/${encodeURIComponent(
|
||||
"type": "text",
|
||||
"text": "${vcard.address}",
|
||||
"color": "#6c6664",
|
||||
"size": "md",
|
||||
"action": {
|
||||
"type": "uri",
|
||||
"label": "action",
|
||||
"uri": "https://www.google.com.tw/maps/place/${encodeURIComponent(
|
||||
vcard.address
|
||||
)}`,
|
||||
)}"
|
||||
},
|
||||
wrap: true,
|
||||
},
|
||||
],
|
||||
spacing: "lg",
|
||||
margin: "xs",
|
||||
};
|
||||
"wrap": true,
|
||||
"align": "end"
|
||||
}
|
||||
`;
|
||||
} else {
|
||||
vcardAddr = {
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [
|
||||
{
|
||||
type: "text",
|
||||
text: " ",
|
||||
weight: "bold",
|
||||
color: "#333334",
|
||||
size: "sm",
|
||||
align: "end",
|
||||
wrap: true,
|
||||
},
|
||||
],
|
||||
spacing: "lg",
|
||||
margin: "xs",
|
||||
};
|
||||
vcardAddr = "";
|
||||
}
|
||||
|
||||
if (vcard.title.trim().length == 0) {
|
||||
vcard.title = " ";
|
||||
}
|
||||
let vcardTel;
|
||||
|
||||
if (vcard.tel.trim().length == 0) {
|
||||
vcard.tel = " ";
|
||||
if (vcard.tel.trim().length > 0) {
|
||||
vcardTel = `
|
||||
{
|
||||
"type": "text",
|
||||
"text": "${vcard.tel}",
|
||||
"color": "#6c6664",
|
||||
"size": "md",
|
||||
"action": {
|
||||
"type": "uri",
|
||||
"label": "action",
|
||||
"uri": "tel:${vcard.tel}"
|
||||
}
|
||||
},
|
||||
`;
|
||||
} else {
|
||||
vcardTel = "";
|
||||
}
|
||||
|
||||
let vcardPhone;
|
||||
|
||||
if (vcard.phone.trim().length == 0) {
|
||||
vcard.phone = " ";
|
||||
if (vcard.phone.trim().length > 0) {
|
||||
vcardPhone = `
|
||||
{
|
||||
"type": "text",
|
||||
"text": "${vcard.phone}",
|
||||
"size": "lg",
|
||||
"color": "#ffffff",
|
||||
"action": {
|
||||
"type": "uri",
|
||||
"label": "action",
|
||||
"uri": "tel:${vcard.phone}"
|
||||
}
|
||||
}
|
||||
`;
|
||||
} else {
|
||||
vcardPhone = "";
|
||||
}
|
||||
|
||||
let vcardAvatar;
|
||||
|
||||
if (vcard.avatar.trim().length > 0) {
|
||||
vcardAvatar = {
|
||||
type: "image",
|
||||
url: vcard.avatar,
|
||||
action: {
|
||||
type: "uri",
|
||||
label: "action",
|
||||
uri: vcard.nfcurl + "&cardid=1",
|
||||
},
|
||||
};
|
||||
vcardAvatar = `
|
||||
{
|
||||
"type": "image",
|
||||
"url": "${vcard.avatar}",
|
||||
"size": "full",
|
||||
"aspectRatio": "1:1",
|
||||
"aspectMode": "cover",
|
||||
"action": {
|
||||
"type": "uri",
|
||||
"label": "action",
|
||||
"uri": "${vcard.nfcurl}&cardid=1"
|
||||
}
|
||||
}
|
||||
`;
|
||||
} else {
|
||||
vcardAvatar = {
|
||||
type: "text",
|
||||
text: " ",
|
||||
size: "xs",
|
||||
};
|
||||
vcardAvatar = "";
|
||||
}
|
||||
|
||||
let vcardEmail;
|
||||
|
||||
if (vcard.email.trim().length > 0) {
|
||||
vcardEmail = {
|
||||
type: "text",
|
||||
text: vcard.email,
|
||||
color: "#333334",
|
||||
size: "sm",
|
||||
weight: "bold",
|
||||
action: {
|
||||
type: "uri",
|
||||
label: "action",
|
||||
uri: `mailto:${vcard.email}`,
|
||||
vcardEmail = `
|
||||
{
|
||||
"type": "text",
|
||||
"text": "${vcard.email}",
|
||||
"color": "#6c6664",
|
||||
"size": "md",
|
||||
"action": {
|
||||
"type": "postback",
|
||||
"label": "action",
|
||||
"uri": "mailto:${vcard.email}"
|
||||
}
|
||||
},
|
||||
align: "end",
|
||||
};
|
||||
`;
|
||||
} else {
|
||||
vcardEmail = {
|
||||
type: "text",
|
||||
text: " ",
|
||||
color: "#333334",
|
||||
size: "sm",
|
||||
weight: "bold",
|
||||
align: "end",
|
||||
};
|
||||
vcardEmail = "";
|
||||
}
|
||||
|
||||
let card = {
|
||||
altText: "UTel電子名片",
|
||||
type: "flex",
|
||||
contents: {
|
||||
type: "bubble",
|
||||
size: "giga",
|
||||
body: {
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [
|
||||
// 名片發送
|
||||
|
||||
let card = `
|
||||
{
|
||||
type: "image",
|
||||
url: process.env.VUE_APP_BASE_URL+"/images/jcibg.png",
|
||||
size: "full",
|
||||
aspectMode: "fit",
|
||||
aspectRatio: "4:3",
|
||||
gravity: "top",
|
||||
},
|
||||
"altText": "UTel電子名片",
|
||||
"type": "flex",
|
||||
"contents":
|
||||
{
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [
|
||||
vcardAvatar,
|
||||
"type": "bubble",
|
||||
"size": "giga",
|
||||
"body": {
|
||||
"type": "box",
|
||||
"layout": "vertical",
|
||||
"contents": [
|
||||
{
|
||||
type: "text",
|
||||
text: "大同國際\n青年商會",
|
||||
wrap: true,
|
||||
align: "center",
|
||||
margin: "md",
|
||||
},
|
||||
],
|
||||
position: "absolute",
|
||||
offsetTop: "13%",
|
||||
offsetStart: "2%",
|
||||
width: "21%",
|
||||
"type": "image",
|
||||
"url": "https://369cycle.zltest.com.tw/tggo/template/bg-02.png",
|
||||
"size": "full",
|
||||
"position": "absolute",
|
||||
"aspectMode": "cover"
|
||||
},
|
||||
{
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [
|
||||
"type": "box",
|
||||
"layout": "vertical",
|
||||
"contents": [
|
||||
{
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [
|
||||
"type": "box",
|
||||
"layout": "horizontal",
|
||||
"contents": [
|
||||
{
|
||||
type: "text",
|
||||
text: "加入好友",
|
||||
align: "center",
|
||||
color: "#ffffff",
|
||||
weight: "bold",
|
||||
margin: "xs",
|
||||
},
|
||||
],
|
||||
backgroundColor: "#06c755",
|
||||
width: "100%",
|
||||
cornerRadius: "5px",
|
||||
action: {
|
||||
type: "uri",
|
||||
label: "action",
|
||||
uri: "https://line.naver.jp/ti/p/~" + vcard.line,
|
||||
},
|
||||
},
|
||||
"type": "box",
|
||||
"layout": "vertical",
|
||||
"contents": [
|
||||
{
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [
|
||||
"type": "box",
|
||||
"layout": "vertical",
|
||||
"contents": [
|
||||
{
|
||||
type: "text",
|
||||
text: "分享名片",
|
||||
align: "center",
|
||||
color: "#ffffff",
|
||||
weight: "bold",
|
||||
margin: "xs",
|
||||
},
|
||||
],
|
||||
backgroundColor: "#ffcc5b",
|
||||
width: "100%",
|
||||
cornerRadius: "5px",
|
||||
margin: "md",
|
||||
},
|
||||
"type": "text",
|
||||
"text": "${vcard.name}",
|
||||
"size": "xl",
|
||||
"weight": "bold",
|
||||
"color": "#ffffff",
|
||||
"margin": "sm"
|
||||
}
|
||||
],
|
||||
position: "absolute",
|
||||
offsetStart: "2%",
|
||||
width: "20%",
|
||||
offsetBottom: "8%",
|
||||
action: {
|
||||
type: "uri",
|
||||
label: "action",
|
||||
uri: `${process.env.VUE_APP_SEND_URL}/?userid=${vcard.user_id}&cardid=1`,
|
||||
},
|
||||
"backgroundColor": "#bf4c32",
|
||||
"paddingStart": "10px",
|
||||
"paddingEnd": "5px"
|
||||
},
|
||||
{
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [
|
||||
"type": "box",
|
||||
"layout": "vertical",
|
||||
"contents": [
|
||||
{
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [
|
||||
{
|
||||
type: "text",
|
||||
text: vcard.name,
|
||||
size: "lg",
|
||||
color: "#4EA2D9",
|
||||
weight: "bold",
|
||||
align: "end",
|
||||
},
|
||||
"type": "text",
|
||||
"text": "${vcard.title}",
|
||||
"size": "md",
|
||||
"weight": "regular",
|
||||
"color": "#ffffff",
|
||||
"action": {
|
||||
"type": "uri",
|
||||
"label": "action",
|
||||
"uri": "${vcard.nfcurl}&cardid=1"
|
||||
}
|
||||
}
|
||||
],
|
||||
"backgroundColor": "#e5b164",
|
||||
"paddingStart": "xxl",
|
||||
"paddingEnd": "5px",
|
||||
"offsetEnd": "5px",
|
||||
"margin": "sm",
|
||||
"paddingBottom": "xs",
|
||||
"paddingTop": "2px"
|
||||
},
|
||||
{
|
||||
type: "box",
|
||||
layout: "baseline",
|
||||
contents: [
|
||||
{
|
||||
type: "text",
|
||||
text: vcard.title,
|
||||
color: "#333334",
|
||||
size: "md",
|
||||
weight: "bold",
|
||||
align: "end",
|
||||
},
|
||||
"type": "box",
|
||||
"layout": "vertical",
|
||||
"contents": [${vcardPhone}],
|
||||
"backgroundColor": "#7aa567",
|
||||
"margin": "xs",
|
||||
"paddingStart": "5px",
|
||||
"paddingEnd": "5px"
|
||||
}
|
||||
],
|
||||
spacing: "lg",
|
||||
"alignItems": "flex-end",
|
||||
"width": "50%",
|
||||
"paddingEnd": "xl"
|
||||
},
|
||||
{
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [
|
||||
{
|
||||
type: "separator",
|
||||
},
|
||||
"type": "box",
|
||||
"layout": "vertical",
|
||||
"contents": [${vcardAvatar}],
|
||||
"cornerRadius": "150px",
|
||||
"borderWidth": "bold",
|
||||
"borderColor": "#ffffff",
|
||||
"margin": "none",
|
||||
"width": "30%"
|
||||
}
|
||||
],
|
||||
height: "20px",
|
||||
"alignItems": "center",
|
||||
"paddingTop": "3%",
|
||||
"justifyContent": "center"
|
||||
},
|
||||
{
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [
|
||||
"type": "box",
|
||||
"layout": "vertical",
|
||||
"contents": [
|
||||
{
|
||||
type: "text",
|
||||
text: vcard.company,
|
||||
color: "#4EA2D9",
|
||||
size: "md",
|
||||
weight: "bold",
|
||||
align: "end",
|
||||
},
|
||||
"type": "box",
|
||||
"layout": "horizontal",
|
||||
"contents": [
|
||||
{
|
||||
"type": "box",
|
||||
"layout": "vertical",
|
||||
"contents": [
|
||||
${vcardTel}
|
||||
${vcardLink}
|
||||
${vcardEmail}
|
||||
${vcardAddr}
|
||||
],
|
||||
spacing: "lg",
|
||||
margin: "xs",
|
||||
"alignItems": "flex-end",
|
||||
"paddingEnd": "xl"
|
||||
},
|
||||
vcardAddr,
|
||||
{
|
||||
type: "box",
|
||||
layout: "horizontal",
|
||||
contents: [
|
||||
"type": "box",
|
||||
"layout": "vertical",
|
||||
"justifyContent": "space-between",
|
||||
"contents": [
|
||||
{
|
||||
type: "text",
|
||||
text: vcard.tel,
|
||||
align: "end",
|
||||
size: "sm",
|
||||
color: "#333334",
|
||||
weight: "bold",
|
||||
"type": "button",
|
||||
"action": {
|
||||
"type": "uri",
|
||||
"label": "加入好友",
|
||||
"uri": "http://linecorp.com/"
|
||||
},
|
||||
{
|
||||
type: "text",
|
||||
text: vcard.phone,
|
||||
size: "sm",
|
||||
align: "end",
|
||||
weight: "bold",
|
||||
"color": "#6c6664",
|
||||
"height": "sm",
|
||||
"style": "primary"
|
||||
},
|
||||
{
|
||||
"type": "button",
|
||||
"action": {
|
||||
"type": "uri",
|
||||
"label": "分享名片",
|
||||
"uri": "http://linecorp.com/"
|
||||
},
|
||||
"color": "#6c6664",
|
||||
"height": "sm",
|
||||
"margin": "sm",
|
||||
"style": "primary"
|
||||
}
|
||||
],
|
||||
"width": "30%"
|
||||
}
|
||||
],
|
||||
"alignItems": "flex-end"
|
||||
}
|
||||
],
|
||||
"justifyContent": "space-between"
|
||||
}
|
||||
],
|
||||
"width": "95%",
|
||||
"height": "92%",
|
||||
"borderWidth": "light",
|
||||
"borderColor": "#bbbbbb",
|
||||
"paddingAll": "10px",
|
||||
"justifyContent": "space-between",
|
||||
"cornerRadius": "lg"
|
||||
},
|
||||
vcardLink,
|
||||
{
|
||||
type: "box",
|
||||
layout: "baseline",
|
||||
contents: [vcardEmail],
|
||||
spacing: "lg",
|
||||
margin: "xs",
|
||||
},
|
||||
"type": "box",
|
||||
"layout": "vertical",
|
||||
"contents": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "匯康科技",
|
||||
"color": "#e5b164",
|
||||
"size": "md"
|
||||
}
|
||||
],
|
||||
position: "absolute",
|
||||
offsetTop: "30%",
|
||||
offsetStart: "35%",
|
||||
offsetEnd: "5%",
|
||||
},
|
||||
"position": "absolute",
|
||||
"offsetTop": "sm",
|
||||
"offsetStart": "sm",
|
||||
"backgroundColor": "#ffffff",
|
||||
"cornerRadius": "15px",
|
||||
"paddingStart": "10px",
|
||||
"paddingEnd": "10px"
|
||||
}
|
||||
],
|
||||
paddingAll: "0px",
|
||||
action: {
|
||||
type: "uri",
|
||||
label: "action",
|
||||
uri: vcard.nfcurl + "&cardid=1",
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
return { card: JSON.stringify(card) };
|
||||
"paddingAll": "0px",
|
||||
"action": {
|
||||
"type": "uri",
|
||||
"label": "action",
|
||||
"uri": "https://utel.zltest.com.tw/card/?params=i7Kq7O59hPX1MJ%2Bqd8zQKBwuyc%2F%2BZ%2BZs%2BZXtXBy4zvg%3D&cardid=1"
|
||||
},
|
||||
"height": "280px",
|
||||
"justifyContent": "center",
|
||||
"alignItems": "center"
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
return { card };
|
||||
}
|
||||
|
||||
export { genCard };
|
||||
|
||||
Loading…
Reference in new issue