|
|
|
|
@ -1,15 +1,8 @@
|
|
|
|
|
<script>
|
|
|
|
|
<script setup>
|
|
|
|
|
import Footer from "@/components/Footer.vue";
|
|
|
|
|
import FlexView from "@/components/FlexView.vue";
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
ref,
|
|
|
|
|
reactive,
|
|
|
|
|
toRefs,
|
|
|
|
|
watch,
|
|
|
|
|
onBeforeMount,
|
|
|
|
|
defineComponent,
|
|
|
|
|
} from "vue";
|
|
|
|
|
import { ref, reactive, watch } from "vue";
|
|
|
|
|
|
|
|
|
|
import { updateCusCard } from "@/api";
|
|
|
|
|
import { useStore } from "vuex";
|
|
|
|
|
@ -19,21 +12,13 @@ import axios from "axios";
|
|
|
|
|
import _ from "lodash";
|
|
|
|
|
|
|
|
|
|
import { showToast } from "vant";
|
|
|
|
|
import { showLoadingToast,showSuccessToast } from 'vant';
|
|
|
|
|
import { showLoadingToast, showSuccessToast } from "vant";
|
|
|
|
|
|
|
|
|
|
import { Cropper } from "vue-advanced-cropper";
|
|
|
|
|
import "vue-advanced-cropper/dist/style.css";
|
|
|
|
|
|
|
|
|
|
const URL = window.URL || window.webkitURL;
|
|
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
|
name: "EditCard",
|
|
|
|
|
components: {
|
|
|
|
|
Footer,
|
|
|
|
|
Cropper,
|
|
|
|
|
FlexView,
|
|
|
|
|
},
|
|
|
|
|
async setup() {
|
|
|
|
|
const store = useStore();
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
|
|
|
|
|
@ -47,8 +32,8 @@ export default defineComponent({
|
|
|
|
|
let flexRef = ref(null);
|
|
|
|
|
|
|
|
|
|
const showMvPopup = () => {
|
|
|
|
|
console.log('test');
|
|
|
|
|
showMovie = true;
|
|
|
|
|
console.log("test");
|
|
|
|
|
showMovie.value = true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const crop = ref({
|
|
|
|
|
@ -60,17 +45,19 @@ export default defineComponent({
|
|
|
|
|
autoCropHeight: 200,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let state = reactive({
|
|
|
|
|
imagePath: "",
|
|
|
|
|
previewImage: null,
|
|
|
|
|
fileList: [],
|
|
|
|
|
showFooter: true,
|
|
|
|
|
form: {
|
|
|
|
|
// let state = reactive({
|
|
|
|
|
// imagePath: "",
|
|
|
|
|
// previewImage: null,
|
|
|
|
|
// fileList: [],
|
|
|
|
|
// showFooter: true,
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
const form = ref({
|
|
|
|
|
page: 1,
|
|
|
|
|
title: "商務卡片",
|
|
|
|
|
showNfc: true,
|
|
|
|
|
json5: {
|
|
|
|
|
altText: '',
|
|
|
|
|
altText: "",
|
|
|
|
|
btnHeight: "md",
|
|
|
|
|
descSize: "sm",
|
|
|
|
|
titleSize: "xl",
|
|
|
|
|
@ -89,35 +76,37 @@ export default defineComponent({
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const sizeColumns = ref([
|
|
|
|
|
{text:'xxs',value:'xxs'},
|
|
|
|
|
{text:'xs',value: 'xs'},
|
|
|
|
|
{text:'sm',value: 'sm'},
|
|
|
|
|
{text:'md',value: 'md'},
|
|
|
|
|
{text:'lg',value: 'lg'},
|
|
|
|
|
{text:'xl',value: 'xl'},
|
|
|
|
|
{text:'xxl',value:'xxl'},
|
|
|
|
|
{text:'3xl',value:'3xl'},
|
|
|
|
|
{text:'4xl',value:'4xl'},
|
|
|
|
|
{text:'5xl',value:'5xl'}
|
|
|
|
|
{ text: "xxs", value: "xxs" },
|
|
|
|
|
{ text: "xs", value: "xs" },
|
|
|
|
|
{ text: "sm", value: "sm" },
|
|
|
|
|
{ text: "md", value: "md" },
|
|
|
|
|
{ text: "lg", value: "lg" },
|
|
|
|
|
{ text: "xl", value: "xl" },
|
|
|
|
|
{ text: "xxl", value: "xxl" },
|
|
|
|
|
{ text: "3xl", value: "3xl" },
|
|
|
|
|
{ text: "4xl", value: "4xl" },
|
|
|
|
|
{ text: "5xl", value: "5xl" },
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
store.state.user.userInfo.cus_card &&
|
|
|
|
|
store.state.user.userInfo.cus_card.length > 0
|
|
|
|
|
) {
|
|
|
|
|
state.form = JSON.parse(_.clone(store.state.user.userInfo.cus_card));
|
|
|
|
|
form.value = JSON.parse(_.clone(store.state.user.userInfo.cus_card));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
watch(()=>state.form.title,(newVal)=>{
|
|
|
|
|
state.form.json5.altText = newVal
|
|
|
|
|
})
|
|
|
|
|
watch(
|
|
|
|
|
() => form.value.title,
|
|
|
|
|
(newVal) => {
|
|
|
|
|
form.value.json5.altText = newVal;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const addCard = () => {
|
|
|
|
|
state.form.json5.cards.push({
|
|
|
|
|
form.value.json5.cards.push({
|
|
|
|
|
bgColor: "#ffffff",
|
|
|
|
|
desc: "",
|
|
|
|
|
descColor: "#000000",
|
|
|
|
|
@ -129,71 +118,70 @@ export default defineComponent({
|
|
|
|
|
titleColor: "#000000",
|
|
|
|
|
ratio: "20:13",
|
|
|
|
|
});
|
|
|
|
|
state.form.page = state.form.json5.cards.length;
|
|
|
|
|
form.value.page = form.value.json5.cards.length;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const delCard = (page) => {
|
|
|
|
|
if (page > 1) {
|
|
|
|
|
state.form.page = page - 1;
|
|
|
|
|
form.value.page = page - 1;
|
|
|
|
|
}
|
|
|
|
|
state.form.json5.cards.splice(page - 1, 1);
|
|
|
|
|
form.value.json5.cards.splice(page - 1, 1);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const addBtn = (page) => {
|
|
|
|
|
if (!state.form.json5.cards[page - 1].btns) {
|
|
|
|
|
state.form.json5.cards[page - 1].btns = [];
|
|
|
|
|
if (!form.value.json5.cards[page - 1].btns) {
|
|
|
|
|
form.value.json5.cards[page - 1].btns = [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
state.form.json5.cards[page - 1].btns.push({
|
|
|
|
|
form.value.json5.cards[page - 1].btns.push({
|
|
|
|
|
color: "#42659a",
|
|
|
|
|
link: "",
|
|
|
|
|
style: "primary",
|
|
|
|
|
text: "",
|
|
|
|
|
btnHeight: "md"
|
|
|
|
|
btnHeight: "md",
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const addShareBtn = (page) => {
|
|
|
|
|
if (!state.form.json5.cards[page - 1].btns) {
|
|
|
|
|
state.form.json5.cards[page - 1].btns = [];
|
|
|
|
|
if (!form.value.json5.cards[page - 1].btns) {
|
|
|
|
|
form.value.json5.cards[page - 1].btns = [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
state.form.json5.cards[page - 1].btns.push({
|
|
|
|
|
form.value.json5.cards[page - 1].btns.push({
|
|
|
|
|
color: "#42659a",
|
|
|
|
|
link: `${import.meta.env.VITE_APP_SEND_URL}?userid=${sessionStorage.getItem(
|
|
|
|
|
"uid"
|
|
|
|
|
)}&cardid=2`,
|
|
|
|
|
style: "primary",
|
|
|
|
|
text: "分享好友",
|
|
|
|
|
btnHeight: "md"
|
|
|
|
|
btnHeight: "md",
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const moveCard = (type, page) => {
|
|
|
|
|
if (type === 0) {
|
|
|
|
|
if (page !== 1) {
|
|
|
|
|
[state.form.json5.cards[page - 1], state.form.json5.cards[page - 2]] =
|
|
|
|
|
[
|
|
|
|
|
state.form.json5.cards[page - 2],
|
|
|
|
|
state.form.json5.cards[page - 1],
|
|
|
|
|
[form.value.json5.cards[page - 1], form.value.json5.cards[page - 2]] = [
|
|
|
|
|
form.value.json5.cards[page - 2],
|
|
|
|
|
form.value.json5.cards[page - 1],
|
|
|
|
|
];
|
|
|
|
|
state.form.page = page - 1;
|
|
|
|
|
form.value.page = page - 1;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (page !== state.form.json5.cards.length) {
|
|
|
|
|
[state.form.json5.cards[page], state.form.json5.cards[page - 1]] = [
|
|
|
|
|
state.form.json5.cards[page - 1],
|
|
|
|
|
state.form.json5.cards[page],
|
|
|
|
|
if (page !== form.value.json5.cards.length) {
|
|
|
|
|
[form.value.json5.cards[page], form.value.json5.cards[page - 1]] = [
|
|
|
|
|
form.value.json5.cards[page - 1],
|
|
|
|
|
form.value.json5.cards[page],
|
|
|
|
|
];
|
|
|
|
|
state.form.page = page + 1;
|
|
|
|
|
form.value.page = page + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const delBtn = (index) => {
|
|
|
|
|
state.form.json5.cards[state.form.page - 1].btns.splice(index, 1);
|
|
|
|
|
if (state.form.json5.cards[state.form.page - 1].btns.length === 0) {
|
|
|
|
|
delete state.form.json5.cards[state.form.page - 1].btns;
|
|
|
|
|
form.value.json5.cards[form.value.page - 1].btns.splice(index, 1);
|
|
|
|
|
if (form.value.json5.cards[form.value.page - 1].btns.length === 0) {
|
|
|
|
|
delete form.value.json5.cards[form.value.page - 1].btns;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@ -201,24 +189,21 @@ export default defineComponent({
|
|
|
|
|
if (type === 0) {
|
|
|
|
|
if (index !== 0) {
|
|
|
|
|
[
|
|
|
|
|
state.form.json5.cards[state.form.page - 1].btns[index],
|
|
|
|
|
state.form.json5.cards[state.form.page - 1].btns[index - 1],
|
|
|
|
|
form.value.json5.cards[form.value.page - 1].btns[index],
|
|
|
|
|
form.value.json5.cards[form.value.page - 1].btns[index - 1],
|
|
|
|
|
] = [
|
|
|
|
|
state.form.json5.cards[state.form.page - 1].btns[index - 1],
|
|
|
|
|
state.form.json5.cards[state.form.page - 1].btns[index],
|
|
|
|
|
form.value.json5.cards[form.value.page - 1].btns[index - 1],
|
|
|
|
|
form.value.json5.cards[form.value.page - 1].btns[index],
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (
|
|
|
|
|
index + 1 !==
|
|
|
|
|
state.form.json5.cards[state.form.page - 1].btns.length
|
|
|
|
|
) {
|
|
|
|
|
if (index + 1 !== form.value.json5.cards[form.value.page - 1].btns.length) {
|
|
|
|
|
[
|
|
|
|
|
state.form.json5.cards[state.form.page - 1].btns[index + 1],
|
|
|
|
|
state.form.json5.cards[state.form.page - 1].btns[index],
|
|
|
|
|
form.value.json5.cards[form.value.page - 1].btns[index + 1],
|
|
|
|
|
form.value.json5.cards[form.value.page - 1].btns[index],
|
|
|
|
|
] = [
|
|
|
|
|
state.form.json5.cards[state.form.page - 1].btns[index],
|
|
|
|
|
state.form.json5.cards[state.form.page - 1].btns[index + 1],
|
|
|
|
|
form.value.json5.cards[form.value.page - 1].btns[index],
|
|
|
|
|
form.value.json5.cards[form.value.page - 1].btns[index + 1],
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -246,7 +231,7 @@ export default defineComponent({
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (res.data.code == 200) {
|
|
|
|
|
state.form.json5.cards[state.form.page - 1].image = res.data.data;
|
|
|
|
|
form.value.json5.cards[form.value.page - 1].image = res.data.data;
|
|
|
|
|
|
|
|
|
|
showSuccessToast("上傳成功");
|
|
|
|
|
} else {
|
|
|
|
|
@ -257,24 +242,26 @@ export default defineComponent({
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleDelete = () => {
|
|
|
|
|
state.form.json5.cards[state.form.page - 1].image = "";
|
|
|
|
|
form.value.json5.cards[form.value.page - 1].image = "";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handlePreview = () => {
|
|
|
|
|
router.push({
|
|
|
|
|
name: "CardPreview",
|
|
|
|
|
params: { content: JSON.stringify(state.form) },
|
|
|
|
|
state: { content: JSON.stringify(form.value) },
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const onTitleSizeConfirm = ({ selectedOptions }) => {
|
|
|
|
|
showTitleSizePicker.value = false;
|
|
|
|
|
state.form.json5.cards[state.form.page - 1].titleSize = selectedOptions[0].text;
|
|
|
|
|
form.value.json5.cards[form.value.page - 1].titleSize =
|
|
|
|
|
selectedOptions[0].text;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const onDescSizeConfirm = ({ selectedOptions }) => {
|
|
|
|
|
showDescSizePicker.value = false;
|
|
|
|
|
state.form.json5.cards[state.form.page - 1].descSize = selectedOptions[0].text;
|
|
|
|
|
form.value.json5.cards[form.value.page - 1].descSize =
|
|
|
|
|
selectedOptions[0].text;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleSubmit = async () => {
|
|
|
|
|
@ -288,56 +275,38 @@ export default defineComponent({
|
|
|
|
|
|
|
|
|
|
let res = await updateCusCard({
|
|
|
|
|
user_id: user_id,
|
|
|
|
|
card_title: state.form.title,
|
|
|
|
|
show_cus: state.form.showNfc,
|
|
|
|
|
cus_card: JSON.stringify(state.form),
|
|
|
|
|
card_title: form.value.title,
|
|
|
|
|
show_cus: form.value.showNfc,
|
|
|
|
|
cus_card: JSON.stringify(form.value),
|
|
|
|
|
});
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
store.commit("user/setCusCard", JSON.stringify(state.form));
|
|
|
|
|
store.commit("user/setCusCard", JSON.stringify(form.value));
|
|
|
|
|
showSuccessToast("建立成功");
|
|
|
|
|
} else {
|
|
|
|
|
showToast.fail("建立失敗");
|
|
|
|
|
}
|
|
|
|
|
router.push("/");
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
...toRefs(state),
|
|
|
|
|
sizeColumns,
|
|
|
|
|
showPreview,
|
|
|
|
|
showMovie,
|
|
|
|
|
showMvPopup,
|
|
|
|
|
showTitleSizePicker,
|
|
|
|
|
showDescSizePicker,
|
|
|
|
|
flexRef,
|
|
|
|
|
crop,
|
|
|
|
|
addCard,
|
|
|
|
|
delCard,
|
|
|
|
|
moveCard,
|
|
|
|
|
addBtn,
|
|
|
|
|
addShareBtn,
|
|
|
|
|
delBtn,
|
|
|
|
|
moveBtn,
|
|
|
|
|
afterRead,
|
|
|
|
|
handlePreview,
|
|
|
|
|
handleDelete,
|
|
|
|
|
onTitleSizeConfirm,
|
|
|
|
|
onDescSizeConfirm,
|
|
|
|
|
handleSubmit,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div class="edit page">
|
|
|
|
|
<van-form @submit="handleSubmit">
|
|
|
|
|
<van-nav-bar class="bg-skyBlue py-1" left-arrow @click-left="$router.push('/')">
|
|
|
|
|
<van-nav-bar
|
|
|
|
|
class="bg-skyBlue py-1"
|
|
|
|
|
left-arrow
|
|
|
|
|
@click-left="$router.push('/')"
|
|
|
|
|
>
|
|
|
|
|
<template #title>
|
|
|
|
|
<h5 class="text-white mb-1"><strong>商務卡片設定</strong></h5>
|
|
|
|
|
</template>
|
|
|
|
|
<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>
|
|
|
|
|
</van-nav-bar>
|
|
|
|
|
|
|
|
|
|
@ -349,16 +318,35 @@ export default defineComponent({
|
|
|
|
|
</template>
|
|
|
|
|
<template #value>
|
|
|
|
|
<!-- <van-button size="small" class="ml-1 btn-moBlue" icon="tv-o" hairline @click="$router.push('/card/video')">教學影片</van-button> -->
|
|
|
|
|
<van-button size="small" class="ml-1 btn-moBlue" icon="tv-o" hairline @click="showMovie = true">教學影片</van-button>
|
|
|
|
|
<van-button size="small" class="ml-1 btn-skyBlue" icon="eye-o" hairline @click="handlePreview">預覽</van-button>
|
|
|
|
|
<van-button
|
|
|
|
|
size="small"
|
|
|
|
|
class="ml-1 btn-moBlue"
|
|
|
|
|
icon="tv-o"
|
|
|
|
|
hairline
|
|
|
|
|
@click="showMovie = true"
|
|
|
|
|
>教學影片</van-button
|
|
|
|
|
>
|
|
|
|
|
<van-button
|
|
|
|
|
size="small"
|
|
|
|
|
class="ml-1 btn-skyBlue"
|
|
|
|
|
icon="eye-o"
|
|
|
|
|
hairline
|
|
|
|
|
@click="handlePreview"
|
|
|
|
|
>預覽</van-button
|
|
|
|
|
>
|
|
|
|
|
</template>
|
|
|
|
|
</van-cell>
|
|
|
|
|
|
|
|
|
|
<van-popup v-model:show="showMovie" class="p-3" closeable>
|
|
|
|
|
<iframe width="375" height="215" src="https://www.youtube.com/embed/fjZsQ0Rh6yk" title="Utel電子名片教學"
|
|
|
|
|
<iframe
|
|
|
|
|
width="375"
|
|
|
|
|
height="215"
|
|
|
|
|
src="https://www.youtube.com/embed/fjZsQ0Rh6yk"
|
|
|
|
|
title="Utel電子名片教學"
|
|
|
|
|
frameborder="0"
|
|
|
|
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
|
|
|
|
allowfullscreen></iframe>
|
|
|
|
|
allowfullscreen
|
|
|
|
|
></iframe>
|
|
|
|
|
</van-popup>
|
|
|
|
|
|
|
|
|
|
<van-field
|
|
|
|
|
@ -370,7 +358,11 @@ export default defineComponent({
|
|
|
|
|
placeholder="請輸入您在名片切換時顯示的文字"
|
|
|
|
|
:rules="[{ required: true, message: '標題文字必填' }]"
|
|
|
|
|
/>
|
|
|
|
|
<van-field label="是否顯示於感應名片" class="longText" input-align="right">
|
|
|
|
|
<van-field
|
|
|
|
|
label="是否顯示於感應名片"
|
|
|
|
|
class="longText"
|
|
|
|
|
input-align="right"
|
|
|
|
|
>
|
|
|
|
|
<template #input>
|
|
|
|
|
<van-switch
|
|
|
|
|
v-model="form.showNfc"
|
|
|
|
|
@ -380,13 +372,11 @@ export default defineComponent({
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</van-field>
|
|
|
|
|
|
|
|
|
|
</van-cell-group>
|
|
|
|
|
|
|
|
|
|
<van-cell-group inset class="mt-3">
|
|
|
|
|
<keep-alive>
|
|
|
|
|
<div id="app">
|
|
|
|
|
|
|
|
|
|
<!-- tab -->
|
|
|
|
|
<div class="bg-lightPink px-2 pt-3">
|
|
|
|
|
<ul class="nav nav-tabs">
|
|
|
|
|
@ -418,15 +408,43 @@ export default defineComponent({
|
|
|
|
|
<!-- /tab -->
|
|
|
|
|
|
|
|
|
|
<div class="py-2">
|
|
|
|
|
<van-field label="調整卡片順序" :border="false" v-if="form.json5.cards.length > 1">
|
|
|
|
|
<van-field
|
|
|
|
|
label="調整卡片順序"
|
|
|
|
|
:border="false"
|
|
|
|
|
v-if="form.json5.cards.length > 1"
|
|
|
|
|
>
|
|
|
|
|
<template #button>
|
|
|
|
|
<van-button size="small" class="ml-1 btn-skyBlue" icon="arrow-left" @click="moveCard(0, form.page)">前移</van-button>
|
|
|
|
|
<van-button size="small" class="ml-1 btn-skyBlue" icon="arrow" @click="moveCard(1, form.page)">後移</van-button>
|
|
|
|
|
<van-button size="small" class="ml-1 btn-tomatoRed" icon="delete-o" @click="delCard(form.page)"></van-button>
|
|
|
|
|
<van-button
|
|
|
|
|
size="small"
|
|
|
|
|
class="ml-1 btn-skyBlue"
|
|
|
|
|
icon="arrow-left"
|
|
|
|
|
@click="moveCard(0, form.page)"
|
|
|
|
|
>前移</van-button
|
|
|
|
|
>
|
|
|
|
|
<van-button
|
|
|
|
|
size="small"
|
|
|
|
|
class="ml-1 btn-skyBlue"
|
|
|
|
|
icon="arrow"
|
|
|
|
|
@click="moveCard(1, form.page)"
|
|
|
|
|
>後移</van-button
|
|
|
|
|
>
|
|
|
|
|
<van-button
|
|
|
|
|
size="small"
|
|
|
|
|
class="ml-1 btn-tomatoRed"
|
|
|
|
|
icon="delete-o"
|
|
|
|
|
@click="delCard(form.page)"
|
|
|
|
|
></van-button>
|
|
|
|
|
</template>
|
|
|
|
|
</van-field>
|
|
|
|
|
|
|
|
|
|
<van-divider :style="{ color: '#345068', borderColor: '#345068', padding: '0 16px' }"><strong>卡片設定</strong></van-divider>
|
|
|
|
|
<van-divider
|
|
|
|
|
:style="{
|
|
|
|
|
color: '#345068',
|
|
|
|
|
borderColor: '#345068',
|
|
|
|
|
padding: '0 16px',
|
|
|
|
|
}"
|
|
|
|
|
><strong>卡片設定</strong></van-divider
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
<van-field
|
|
|
|
|
v-model="form.json5.cards[form.page - 1].ratio"
|
|
|
|
|
@ -448,12 +466,20 @@ export default defineComponent({
|
|
|
|
|
<template #button>
|
|
|
|
|
<input
|
|
|
|
|
v-model="form.json5.cards[form.page - 1].bgColor"
|
|
|
|
|
type="color" class="form-control-color"
|
|
|
|
|
type="color"
|
|
|
|
|
class="form-control-color"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</van-field>
|
|
|
|
|
|
|
|
|
|
<van-divider :style="{ color: '#345068', borderColor: '#345068', padding: '0 16px' }"><strong>內容圖片設定</strong></van-divider>
|
|
|
|
|
<van-divider
|
|
|
|
|
:style="{
|
|
|
|
|
color: '#345068',
|
|
|
|
|
borderColor: '#345068',
|
|
|
|
|
padding: '0 16px',
|
|
|
|
|
}"
|
|
|
|
|
><strong>內容圖片設定</strong></van-divider
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
<van-field
|
|
|
|
|
v-model="form.json5.cards[form.page - 1].ratio"
|
|
|
|
|
@ -475,7 +501,9 @@ export default defineComponent({
|
|
|
|
|
:src="form.json5.cards[form.page - 1].image"
|
|
|
|
|
alt=""
|
|
|
|
|
/>
|
|
|
|
|
<p class="ml-3 px-2 py-1 text-white bg-skyBlue rounded-pill">
|
|
|
|
|
<p
|
|
|
|
|
class="ml-3 px-2 py-1 text-white bg-skyBlue rounded-pill"
|
|
|
|
|
>
|
|
|
|
|
<i class="fa-solid fa-arrow-left"></i> 點擊更換圖片
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
@ -487,7 +515,9 @@ export default defineComponent({
|
|
|
|
|
src="@/assets/images/upload.jpg"
|
|
|
|
|
/>
|
|
|
|
|
<p class="ml-3">請上傳圖片</p>
|
|
|
|
|
<p class="ml-3 px-2 py-1 text-white bg-skyBlue rounded-pill">
|
|
|
|
|
<p
|
|
|
|
|
class="ml-3 px-2 py-1 text-white bg-skyBlue rounded-pill"
|
|
|
|
|
>
|
|
|
|
|
請上傳圖片
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
@ -504,7 +534,14 @@ export default defineComponent({
|
|
|
|
|
placeholder="連結(需輸入完整網址,http://..,https://...)"
|
|
|
|
|
/> -->
|
|
|
|
|
|
|
|
|
|
<van-divider :style="{ color: '#345068', borderColor: '#345068', padding: '0 16px' }"><strong>卡片標題</strong></van-divider>
|
|
|
|
|
<van-divider
|
|
|
|
|
:style="{
|
|
|
|
|
color: '#345068',
|
|
|
|
|
borderColor: '#345068',
|
|
|
|
|
padding: '0 16px',
|
|
|
|
|
}"
|
|
|
|
|
><strong>卡片標題</strong></van-divider
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
<van-field
|
|
|
|
|
v-model="form.json5.cards[form.page - 1].title"
|
|
|
|
|
@ -525,7 +562,11 @@ export default defineComponent({
|
|
|
|
|
placeholder="請輸入標題文字的色碼,如:#333333"
|
|
|
|
|
@click="showTitleSizePicker = true"
|
|
|
|
|
/>
|
|
|
|
|
<van-popup v-model:show="showTitleSizePicker" round position="bottom">
|
|
|
|
|
<van-popup
|
|
|
|
|
v-model:show="showTitleSizePicker"
|
|
|
|
|
round
|
|
|
|
|
position="bottom"
|
|
|
|
|
>
|
|
|
|
|
<van-picker
|
|
|
|
|
:columns="sizeColumns"
|
|
|
|
|
@cancel="showTitleSizePicker = false"
|
|
|
|
|
@ -544,12 +585,20 @@ export default defineComponent({
|
|
|
|
|
<template #button>
|
|
|
|
|
<input
|
|
|
|
|
v-model="form.json5.cards[form.page - 1].titleColor"
|
|
|
|
|
type="color" class="form-control-color"
|
|
|
|
|
type="color"
|
|
|
|
|
class="form-control-color"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</van-field>
|
|
|
|
|
|
|
|
|
|
<van-divider :style="{ color: '#345068', borderColor: '#345068', padding: '0 16px' }"><strong>卡片說明文字</strong></van-divider>
|
|
|
|
|
<van-divider
|
|
|
|
|
:style="{
|
|
|
|
|
color: '#345068',
|
|
|
|
|
borderColor: '#345068',
|
|
|
|
|
padding: '0 16px',
|
|
|
|
|
}"
|
|
|
|
|
><strong>卡片說明文字</strong></van-divider
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
<van-field
|
|
|
|
|
v-model="form.json5.cards[form.page - 1].desc"
|
|
|
|
|
@ -573,7 +622,11 @@ export default defineComponent({
|
|
|
|
|
placeholder="請輸入說明文字的色碼,如:#333333"
|
|
|
|
|
@click="showDescSizePicker = true"
|
|
|
|
|
/>
|
|
|
|
|
<van-popup v-model:show="showDescSizePicker" round position="bottom">
|
|
|
|
|
<van-popup
|
|
|
|
|
v-model:show="showDescSizePicker"
|
|
|
|
|
round
|
|
|
|
|
position="bottom"
|
|
|
|
|
>
|
|
|
|
|
<van-picker
|
|
|
|
|
:columns="sizeColumns"
|
|
|
|
|
@cancel="showDescSizePicker = false"
|
|
|
|
|
@ -591,34 +644,77 @@ export default defineComponent({
|
|
|
|
|
<template #button>
|
|
|
|
|
<input
|
|
|
|
|
v-model="form.json5.cards[form.page - 1].descColor"
|
|
|
|
|
type="color" class="form-control-color"
|
|
|
|
|
type="color"
|
|
|
|
|
class="form-control-color"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</van-field>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<van-divider :style="{ color: '#345068', borderColor: '#345068', padding: '0 16px' }"><strong>按鈕連結設定</strong></van-divider>
|
|
|
|
|
|
|
|
|
|
<van-field
|
|
|
|
|
label="新增按鈕"
|
|
|
|
|
input-align="right"
|
|
|
|
|
:border="false"
|
|
|
|
|
<van-divider
|
|
|
|
|
:style="{
|
|
|
|
|
color: '#345068',
|
|
|
|
|
borderColor: '#345068',
|
|
|
|
|
padding: '0 16px',
|
|
|
|
|
}"
|
|
|
|
|
><strong>按鈕連結設定</strong></van-divider
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
<van-field label="新增按鈕" input-align="right" :border="false">
|
|
|
|
|
<template #button>
|
|
|
|
|
<van-button size="small" class="ml-1 btn-outline-skyBlue" icon="add-o" @click="addBtn(form.page)"><h6>新增按鈕</h6></van-button>
|
|
|
|
|
<van-button size="small" class="ml-1 btn-outline-skyBlue" icon="share-o" @click="addShareBtn(form.page)"><h6>新增分享按鈕</h6></van-button>
|
|
|
|
|
<van-button
|
|
|
|
|
size="small"
|
|
|
|
|
class="ml-1 btn-outline-skyBlue"
|
|
|
|
|
icon="add-o"
|
|
|
|
|
@click="addBtn(form.page)"
|
|
|
|
|
><h6>新增按鈕</h6></van-button
|
|
|
|
|
>
|
|
|
|
|
<van-button
|
|
|
|
|
size="small"
|
|
|
|
|
class="ml-1 btn-outline-skyBlue"
|
|
|
|
|
icon="share-o"
|
|
|
|
|
@click="addShareBtn(form.page)"
|
|
|
|
|
><h6>新增分享按鈕</h6></van-button
|
|
|
|
|
>
|
|
|
|
|
</template>
|
|
|
|
|
</van-field>
|
|
|
|
|
|
|
|
|
|
<div class="p-3">
|
|
|
|
|
<div class="card shadow-sm" v-for="(btn, index) in form.json5.cards[form.page - 1].btns" :key="index">
|
|
|
|
|
<div class="card-header" :style="{backgroundColor:btn.color}">
|
|
|
|
|
<van-field :label="`控制按鈕 ${ index + 1 }`" :border="false" class="bg-transparent">
|
|
|
|
|
<div
|
|
|
|
|
class="card shadow-sm"
|
|
|
|
|
v-for="(btn, index) in form.json5.cards[form.page - 1].btns"
|
|
|
|
|
:key="index"
|
|
|
|
|
>
|
|
|
|
|
<div
|
|
|
|
|
class="card-header"
|
|
|
|
|
:style="{ backgroundColor: btn.color }"
|
|
|
|
|
>
|
|
|
|
|
<van-field
|
|
|
|
|
:label="`控制按鈕 ${index + 1}`"
|
|
|
|
|
:border="false"
|
|
|
|
|
class="bg-transparent"
|
|
|
|
|
>
|
|
|
|
|
<template #button>
|
|
|
|
|
<van-button size="small" class="bg-transparent border-0" icon="arrow-up" @click="moveBtn(0, index)" v-if="form.json5.cards[form.page - 1].btns.length > 1"></van-button>
|
|
|
|
|
<van-button size="small" class="bg-transparent border-0" icon="arrow-down" @click="moveBtn(1, index)" v-if="form.json5.cards[form.page - 1].btns.length > 1"></van-button>
|
|
|
|
|
<van-button size="small" class="bg-transparent border-0" icon="delete-o" @click="delBtn(index)"></van-button>
|
|
|
|
|
<van-button
|
|
|
|
|
size="small"
|
|
|
|
|
class="bg-transparent border-0"
|
|
|
|
|
icon="arrow-up"
|
|
|
|
|
@click="moveBtn(0, index)"
|
|
|
|
|
v-if="form.json5.cards[form.page - 1].btns.length > 1"
|
|
|
|
|
></van-button>
|
|
|
|
|
<van-button
|
|
|
|
|
size="small"
|
|
|
|
|
class="bg-transparent border-0"
|
|
|
|
|
icon="arrow-down"
|
|
|
|
|
@click="moveBtn(1, index)"
|
|
|
|
|
v-if="form.json5.cards[form.page - 1].btns.length > 1"
|
|
|
|
|
></van-button>
|
|
|
|
|
<van-button
|
|
|
|
|
size="small"
|
|
|
|
|
class="bg-transparent border-0"
|
|
|
|
|
icon="delete-o"
|
|
|
|
|
@click="delBtn(index)"
|
|
|
|
|
></van-button>
|
|
|
|
|
</template>
|
|
|
|
|
</van-field>
|
|
|
|
|
</div>
|
|
|
|
|
@ -653,7 +749,8 @@ export default defineComponent({
|
|
|
|
|
<template #button>
|
|
|
|
|
<input
|
|
|
|
|
v-model="btn.color"
|
|
|
|
|
type="color" class="form-control-color"
|
|
|
|
|
type="color"
|
|
|
|
|
class="form-control-color"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</van-field>
|
|
|
|
|
@ -668,15 +765,22 @@ export default defineComponent({
|
|
|
|
|
:rules="[{ required: true, message: '標題文字色碼必填' }]"
|
|
|
|
|
>
|
|
|
|
|
<template #input>
|
|
|
|
|
<van-radio-group direction="horizontal" v-model="btn.btnHeight" checked-color="#345068">
|
|
|
|
|
<van-radio name="sm" @click="btn.btnHeight='sm'">sm</van-radio>
|
|
|
|
|
<van-radio name="md" @click="btn.btnHeight='md'">md</van-radio>
|
|
|
|
|
<van-radio-group
|
|
|
|
|
direction="horizontal"
|
|
|
|
|
v-model="btn.btnHeight"
|
|
|
|
|
checked-color="#345068"
|
|
|
|
|
>
|
|
|
|
|
<van-radio name="sm" @click="btn.btnHeight = 'sm'"
|
|
|
|
|
>sm</van-radio
|
|
|
|
|
>
|
|
|
|
|
<van-radio name="md" @click="btn.btnHeight = 'md'"
|
|
|
|
|
>md</van-radio
|
|
|
|
|
>
|
|
|
|
|
</van-radio-group>
|
|
|
|
|
</template>
|
|
|
|
|
</van-field>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="px-5 pb-4">
|
|
|
|
|
@ -690,11 +794,11 @@ export default defineComponent({
|
|
|
|
|
</div>
|
|
|
|
|
</van-form>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
.form-control-color,.form-control-color:valid {
|
|
|
|
|
.form-control-color,
|
|
|
|
|
.form-control-color:valid {
|
|
|
|
|
appearance: none;
|
|
|
|
|
background: 0 0;
|
|
|
|
|
border: 1px solid #ced4da;
|
|
|
|
|
|