修改發送名片問題

main
Wayne 3 years ago
parent 71ead16745
commit 345da1f3f3

@ -1,12 +1,12 @@
NODE_ENV = development NODE_ENV = development
VITE_ENV = stage VITE_ENV = development
VITE_APP_BASE_URL = https://utel.zltest.com.tw VITE_APP_BASE_URL = https://utel.zltest.com.tw
VITE_APP_LINE_LIFF_ID = 1656948609-xMp7dWAz VITE_APP_LINE_LIFF_ID = 1656948609-xMp7dWAz
VITE_APP_SEND_URL = https://liff.line.me/1656948609-BYr8Nynp VITE_APP_SEND_URL = https://liff.line.me/1656948609-xMp7dWAz
VITE_APP_API_URL = https://utel.zltest.com.tw/appapi/v1 VITE_APP_API_URL = https://utel.zltest.com.tw/appapi/v1

@ -4,7 +4,7 @@ import router from "./router";
import store from "./store"; import store from "./store";
import pinia from './store/pinia' import pinia from './store/pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate' import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import { initStore } from './utils/initStore'; // import { initStore } from './utils/initStore';
import liff from '@line/liff'; import liff from '@line/liff';
import { VueClipboard } from "@soerenmartius/vue3-clipboard"; import { VueClipboard } from "@soerenmartius/vue3-clipboard";
@ -25,7 +25,6 @@ liff.init({
vue.use(VueClipboard); vue.use(VueClipboard);
vue.use(pinia); vue.use(pinia);
// 初始化Store // 初始化Store
initStore(pinia);
vue.use(store).use(router).mount("#app"); vue.use(store).use(router).mount("#app");

@ -1,17 +1,32 @@
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import { updateCusCard } from "@/api"; import { updateCusCard } from "@/api";
import { getCardData } from "@/api/card";
export const useCardStore = defineStore('card', { export const useCardStore = defineStore('card', {
state: () => { state: () => {
return { return {
cusCard: '', cusCard: {
vipCard: '', card_title: '',
show_cus: 1,
cus_card: '',
},
vipCard: [],
} }
}, },
getters: { getters: {
}, },
actions: { actions: {
async getCardData() {
let res = await getCardData();
if (res.code === 200) {
this.cusCard = res.data.cus_card;
return true;
}
return false;
},
async updateCusCard(payload) { async updateCusCard(payload) {
let res = await updateCusCard(payload); let res = await updateCusCard(payload);
if (res.code === 200) { if (res.code === 200) {

@ -91,7 +91,7 @@ function genCard(vcard) {
], ],
"margin": "md", "margin": "md",
"paddingStart": "lg" "paddingStart": "lg"
} },
`; `;
} else { } else {
vcardAddr = ""; vcardAddr = "";
@ -419,6 +419,15 @@ function genCard(vcard) {
${vcardLink} ${vcardLink}
${vcardEmail} ${vcardEmail}
${vcardAddr} ${vcardAddr}
{
"type": "box",
"layout": "vertical",
"contents": [
{
"type": "separator"
}
]
}
], ],
"margin": "xs" "margin": "xs"
} }

@ -46,7 +46,7 @@ function genCard(vcard) {
}, },
"wrap": true, "wrap": true,
"align": "end" "align": "end"
} },
`; `;
} else { } else {
vcardAddr = ""; vcardAddr = "";
@ -253,6 +253,15 @@ function genCard(vcard) {
${vcardLink} ${vcardLink}
${vcardEmail} ${vcardEmail}
${vcardAddr} ${vcardAddr}
{
"type": "box",
"layout": "vertical",
"contents": [
{
"type": "separator"
}
]
}
], ],
"alignItems": "flex-end", "alignItems": "flex-end",
"paddingEnd": "xl" "paddingEnd": "xl"

@ -1,12 +1,5 @@
import { useCardStore } from '@/store/card.js'; // import { useCardStore } from '@/store/card.js';
import { getCardData } from '@/api/card.js'; // import { getCardData } from '@/api/card.js';
export const initStore = async (pinia) => { // export const initStore = async (pinia) => {
const cardStore = useCardStore(); // };
let res = await getCardData();
if (res.code === 200) {
cardStore.cusCard = res.data.cus_card;
cardStore.vipCard = res.data.vip_card;
}
};

@ -6,6 +6,7 @@ import { toClipboard } from "@soerenmartius/vue3-clipboard";
import { ref, computed, onBeforeMount } from "vue"; import { ref, computed, onBeforeMount } from "vue";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { useUserStore } from '@/store/user'; import { useUserStore } from '@/store/user';
import { useCardStore } from '@/store/card';
import { showToast, showSuccessToast, showConfirmDialog } from "vant"; import { showToast, showSuccessToast, showConfirmDialog } from "vant";
import 'vant/es/toast/style'; import 'vant/es/toast/style';
@ -20,6 +21,7 @@ const router = useRouter();
const route = useRoute(); const route = useRoute();
const userStore = useUserStore(); const userStore = useUserStore();
const cardStore = useCardStore();
const showShare = ref(false); const showShare = ref(false);
const showNfcQrcode = ref(false); const showNfcQrcode = ref(false);
@ -112,6 +114,7 @@ onBeforeMount(async () => {
} }
await userStore.getUserData(); await userStore.getUserData();
await cardStore.getCardData();
handleAD(); handleAD();

@ -1,7 +1,7 @@
<script setup> <script setup>
import liff from "@line/liff"; import liff from "@line/liff";
import { showToast,showSuccessToast } from 'vant'; import { showToast, showSuccessToast,showFailToast } from 'vant';
import { onMounted, reactive, ref, toRefs, computed, watch } from 'vue' import { onMounted, reactive, ref, toRefs, computed, watch } from 'vue'
@ -59,7 +59,6 @@ watch(() => cardStore.cusCard.cus_card, function (newVal, oldVal) {
}, { immediate: true }) }, { immediate: true })
watch(() => userInfo.value.nc_template, function (newVal, oldVal) { watch(() => userInfo.value.nc_template, function (newVal, oldVal) {
console.log('new', newVal)
showFlex('0') showFlex('0')
}) })
@ -123,31 +122,33 @@ const sendEcard = async () => {
let content = JSON.parse(JSON.stringify(state.value.flexContent)) let content = JSON.parse(JSON.stringify(state.value.flexContent))
console.log(JSON.stringify(state.value.flexContent)) try {
let res
let res if (activeName.value === '0') {
res = await liff.shareTargetPicker([content,
if (activeName.value === '0') { {
res = await liff.shareTargetPicker([content, 'type': 'text',
{ 'text': '名片的連結都可以點擊!'
'type': 'text', }])
'text': '名片的連結都可以點擊!' } else {
}]) res = await liff.shareTargetPicker([content])
} else { }
res = await liff.shareTargetPicker([content])
}
if (res.status === 'success') { if (res.status === 'success') {
let result = await updateSendCount(userInfo.value.user_id) let result = await updateSendCount(userInfo.value.user_id)
showSuccessToast('傳送成功') showSuccessToast('傳送成功')
// .then(() => { // .then(() => {
// // on confirm // // on confirm
// }) // })
// .catch(() => { // .catch(() => {
// // on cancel // // on cancel
// }) // })
} else { } else {
showToast.fail('傳送失敗') showFailToast('傳送失敗')
}
}catch(err){
console.log('send error',err)
} }
} }
@ -185,7 +186,7 @@ const changeTpl = (val) => {
<h5 class="text-white mb-1"><strong>名片分享</strong></h5> <h5 class="text-white mb-1"><strong>名片分享</strong></h5>
</template> </template>
<template #left> <template #left>
<h4><i class="fa-solid fa-angle-left text-white" :style="{opacity:0.5}"></i></h4> <h4><i class="fa-solid fa-angle-left text-white" :style="{ opacity: 0.5 }"></i></h4>
</template> </template>
</van-nav-bar> </van-nav-bar>
@ -205,7 +206,7 @@ const changeTpl = (val) => {
<template #title> <template #title>
<div class="tab_item"> <div class="tab_item">
<i class="fa-solid fa-clipboard fa-2x mb-1"></i> <i class="fa-solid fa-clipboard fa-2x mb-1"></i>
<p class="mb-3">{{state.card_title}}</p> <p class="mb-3">{{ state.card_title }}</p>
</div> </div>
</template> </template>
</van-tab> </van-tab>
@ -214,7 +215,7 @@ const changeTpl = (val) => {
<template #title> <template #title>
<div class="tab_item"> <div class="tab_item">
<i class="fa-regular fa-file-lines fa-2x mb-1"></i> <i class="fa-regular fa-file-lines fa-2x mb-1"></i>
<p class="mb-3">{{card.title}}</p> <p class="mb-3">{{ card.title }}</p>
</div> </div>
</template> </template>
</van-tab> </van-tab>
@ -291,8 +292,9 @@ const changeTpl = (val) => {
.tpl-list { .tpl-list {
.tpl-item { .tpl-item {
width:150px; width: 150px;
padding: 10px; padding: 10px;
img { img {
width: 100%; width: 100%;
} }

Loading…
Cancel
Save