From a957d0847f36913eaf304753bbe76eca0492c5d4 Mon Sep 17 00:00:00 2001 From: Wayne Hsu Date: Sat, 27 May 2023 04:53:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=89=88=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.h888 | 13 +++ .env.slash | 2 +- package.json | 3 +- src/utils/card/card5.js | 243 +++++++++++++++++++++++++++++++++++++++ src/utils/card/index.js | 5 +- src/views/Send/Index.vue | 2 +- vue.config.js | 4 +- 7 files changed, 266 insertions(+), 6 deletions(-) create mode 100644 .env.h888 create mode 100644 src/utils/card/card5.js diff --git a/.env.h888 b/.env.h888 new file mode 100644 index 0000000..9c2cb34 --- /dev/null +++ b/.env.h888 @@ -0,0 +1,13 @@ +NODE_ENV = production + +VUE_ENV = h888 + +VUE_APP_LINE_LIFF_ID = 1657876696-564NGMxy + +VUE_APP_SEND_URL = https://liff.line.me/1657876696-564NGMxy + +VUE_APP_API_URL = https://card.h888.fun/appapi/v1 + +VUE_APP_IMAGE_URL = https://card.h888.fun/storage + +VUE_APP_MC_URL = https://liff.line.me/1657876696-564NGMxy \ No newline at end of file diff --git a/.env.slash b/.env.slash index 213c912..d8bd8f1 100644 --- a/.env.slash +++ b/.env.slash @@ -10,4 +10,4 @@ VUE_APP_API_URL = https://card.slash1000.com/appapi/v1 VUE_APP_IMAGE_URL = https://card.slash1000.com/storage -VUE_APP_MC_URL = https://liff.line.me/1657876696-MKYDJKgm \ No newline at end of file +VUE_APP_MC_URL = https://liff.line.me/1661025693-veEM0lwZ \ No newline at end of file diff --git a/package.json b/package.json index 6d44f94..8b23cfb 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "build": "vue-cli-service build", "build:dev": "vue-cli-service build --mode development", "build:sta": "vue-cli-service build --mode stage", - "build:slash": "vue-cli-service build --mode slash" + "build:slash": "vue-cli-service build --mode slash", + "build:h888": "vue-cli-service build --mode h888" }, "dependencies": { "@line/liff": "^2.19.0", diff --git a/src/utils/card/card5.js b/src/utils/card/card5.js new file mode 100644 index 0000000..3985d8d --- /dev/null +++ b/src/utils/card/card5.js @@ -0,0 +1,243 @@ +import store from '@/store' + +function genCard(vcard) { + + let action = { + address: null, + email: null, + tel: null, + phone: null, + } + + if (vcard.address) { + action.address = ` + ,"action": { + "type": "uri", + "label": "action", + "uri": "https://www.google.com.tw/maps/place/${encodeURIComponent( + vcard.address + )}" + } + ` + } + if (vcard.email) { + action.email = ` + ,"action": { + "type": "uri", + "label": "action", + "uri": "mailto:${vcard.email}" + } + ` + } + if (vcard.tel) { + action.tel = ` + ,"action": { + "type": "uri", + "label": "action", + "uri": "tel:${vcard.tel}" + } + ` + } + if (vcard.phone) { + action.phone = ` + ,"action": { + "type": "uri", + "label": "action", + "uri": "tel:${vcard.phone}" + } + ` + } + + + let card = ` + { + "altText": "SlashCard電子名片", + "type": "flex", + "contents": { + "type": "bubble", + "size": "giga", + "body": { + "type": "box", + "layout": "vertical", + "contents": [ + { + "type": "image", + "url": "https://card.h888.fun/images/background/jci.png?v=10", + "size": "full", + "aspectMode": "cover", + "aspectRatio": "544:308", + "gravity": "top" + }, + { + "type": "box", + "layout": "horizontal", + "contents": [ + { + "type": "box", + "layout": "vertical", + "contents": [ + { + "type": "box", + "layout": "vertical", + "contents": [ + { + "type": "image", + "url": "${vcard.avatar}" + } + ], + "width": "80%", + "offsetTop": "10%", + "position": "absolute", + "action": { + "type": "uri", + "label": "action", + "uri": "${vcard.nfcurl}&cardid=1" + } + }, + { + "type": "box", + "layout": "vertical", + "contents": [ + { + "type": "box", + "layout": "vertical", + "contents": [ + { + "type": "text", + "text": "加入好友", + "color": "#FFFFFF", + "size": "xs", + "align": "center" + } + ], + "backgroundColor": "#66B3FF", + "cornerRadius": "5px", + "paddingTop": "5px", + "paddingBottom": "5px", + "margin": "md", + "paddingStart": "5px", + "paddingEnd": "5px", + "action": { + "type": "uri", + "label": "action", + "uri": "https://line.naver.jp/ti/p/~${vcard.line}" + } + }, + { + "type": "box", + "layout": "vertical", + "contents": [ + { + "type": "text", + "text": "分享名片", + "color": "#FFFFFF", + "size": "xs" + } + ], + "backgroundColor": "#66B3FF", + "cornerRadius": "5px", + "paddingTop": "5px", + "paddingBottom": "5px", + "margin": "md", + "paddingStart": "5px", + "paddingEnd": "5px", + "action": { + "type": "uri", + "label": "action", + "uri": "${process.env.VUE_APP_SEND_URL}/?userid=${vcard.user_id}&cardid=1" + } + } + ], + "position": "absolute", + "offsetBottom": "10%" + } + ], + "width": "23%", + "alignItems": "center", + "height": "100%" + }, + { + "type": "box", + "layout": "vertical", + "contents": [ + { + "type": "box", + "layout": "vertical", + "contents": [ + { + "type": "text", + "text": " ${vcard.company}", + "color": "#0066cc", + "align": "end", + "weight": "regular", + "size": "md" + }, + { + "type": "text", + "text": " ${vcard.tel} ${vcard.address}", + "align": "end", + "size": "xxs" + ${action.address} + }, + { + "type": "text", + "text": " ${vcard.email}", + "align": "end", + "size": "xxs" + ${action.email} + } + ], + "width": "100%", + "offsetTop": "65%", + "offsetEnd": "5%" + }, + { + "type": "box", + "layout": "vertical", + "contents": [ + { + "type": "text", + "text": " ${vcard.name}", + "align": "end", + "color": "#66B3FF" + }, + { + "type": "text", + "text": " ${vcard.title}", + "size": "sm", + "align": "end" + }, + { + "type": "text", + "text": " ${vcard.phone}", + "size": "sm", + "align": "end" + ${action.phone} + } + ], + "width": "45%", + "offsetTop": "30%", + "position": "absolute", + "offsetEnd": "5%" + } + ], + "width": "77%" + } + ], + "position": "absolute", + "width": "100%", + "height": "100%" + } + ], + "position": "relative", + "spacing": "none", + "margin": "none", + "paddingAll": "none" + } + }} + ` + + return { card: card} +} + +export default genCard ; diff --git a/src/utils/card/index.js b/src/utils/card/index.js index d4bf83f..44ddc8b 100644 --- a/src/utils/card/index.js +++ b/src/utils/card/index.js @@ -2,7 +2,7 @@ import { genCard as Card0 } from "./card0.js"; import { genCard as Card1 } from "./card1.js"; import { genCard as Card2 } from "./card2.js"; import { genCard as Card3 } from "./card3.js"; -import { genCard as Card4 } from "./card4.js"; +import Card5 from "./card5.js"; export function genCard(opt) { switch (opt.tid) { @@ -21,6 +21,9 @@ export function genCard(opt) { case 4: return Card4(opt.vcard); break; + case 5: + return Card5(opt.vcard); + break; default: throw new Error("params error"); break; diff --git a/src/views/Send/Index.vue b/src/views/Send/Index.vue index b3bbc35..3eccf2c 100644 --- a/src/views/Send/Index.vue +++ b/src/views/Send/Index.vue @@ -75,7 +75,7 @@ onBeforeMount(async () => { if (card1Res.code !== 200) { Toast('操作錯誤!!!') console.log('error ec001') - window.location.replace('https://liff.line.me/1656948609-xMp7dWAz') + // window.location.replace(process.env.VUE_APP_SEND_URL) } state.value.user = card1Res.data diff --git a/vue.config.js b/vue.config.js index 84b3ca8..a8d2cd2 100644 --- a/vue.config.js +++ b/vue.config.js @@ -3,7 +3,7 @@ module.exports = { disableHostCheck: true }, publicPath: ["production", "stage", "slash"].includes(process.env.VUE_ENV) ? '/send' : '/send', - outputDir: ["production", "stage", "slash"].includes(process.env.VUE_ENV) ? '../api/public/send' : './dist', + outputDir: ["production", "stage", "slash"].includes(process.env.VUE_ENV) ? '../build/send' : './dist', } - \ No newline at end of file +