Showing
5 changed files
with
100 additions
and
19 deletions
src/components/ContactField/index.vue
0 → 100644
| 1 | +<!-- | ||
| 2 | + * @Date: 2022-11-23 14:41:53 | ||
| 3 | + * @LastEditors: hookehuyr hookehuyr@gmail.com | ||
| 4 | + * @LastEditTime: 2022-11-23 14:42:16 | ||
| 5 | + * @FilePath: /data-table/src/components/ContactField/index.vue | ||
| 6 | + * @Description: 联系我们控件 | ||
| 7 | +--> | ||
| 8 | +<template> | ||
| 9 | + <div class="contact-field-page"> | ||
| 10 | + <van-popover v-model:show="showPopover" placement="left"> | ||
| 11 | + <div class="contact-content"> | ||
| 12 | + <div class="text-tel">电话联系</div> | ||
| 13 | + <div> | ||
| 14 | + <a style="color: #1989fa" :href="`tel:${item.component_props.tel}`">{{ | ||
| 15 | + item.component_props.tel | ||
| 16 | + }}</a> | ||
| 17 | + </div> | ||
| 18 | + <div class="text-qr_code">微信联系</div> | ||
| 19 | + <van-image width="100" height="100" :src="item.component_props.qr_code" /> | ||
| 20 | + </div> | ||
| 21 | + <template #reference> | ||
| 22 | + <div class="wrapper"> | ||
| 23 | + <van-icon name="phone-o" size="2rem" color="#1989fa" /> | ||
| 24 | + </div> | ||
| 25 | + </template> | ||
| 26 | + </van-popover> | ||
| 27 | + </div> | ||
| 28 | +</template> | ||
| 29 | + | ||
| 30 | +<script setup> | ||
| 31 | +import { ref } from "vue"; | ||
| 32 | +import { useRoute, useRouter } from "vue-router"; | ||
| 33 | +const props = defineProps({ | ||
| 34 | + item: Object, | ||
| 35 | +}); | ||
| 36 | +const showPopover = ref(false); | ||
| 37 | +</script> | ||
| 38 | + | ||
| 39 | +<style lang="less" scoped> | ||
| 40 | +.contact-field-page { | ||
| 41 | + position: fixed; | ||
| 42 | + bottom: 10rem; | ||
| 43 | + right: 0.5rem; | ||
| 44 | + // height: 100%; | ||
| 45 | + z-index: 9; | ||
| 46 | + .wrapper { | ||
| 47 | + background: white; | ||
| 48 | + width: 3rem; | ||
| 49 | + height: 3rem; | ||
| 50 | + border-radius: 50%; | ||
| 51 | + text-align: center; | ||
| 52 | + box-shadow: 0rem -0.17rem 0.67rem 0.08rem rgba(0, 0, 0, 0.05); | ||
| 53 | + /deep/.van-icon { | ||
| 54 | + line-height: 1.5; | ||
| 55 | + } | ||
| 56 | + } | ||
| 57 | +} | ||
| 58 | + | ||
| 59 | +.contact-content { | ||
| 60 | + padding: 1rem 0.85rem; | ||
| 61 | + text-align: center; | ||
| 62 | + .text-tel { | ||
| 63 | + color: gray; | ||
| 64 | + font-size: 0.9rem; | ||
| 65 | + margin-bottom: 0.5rem; | ||
| 66 | + } | ||
| 67 | + .text-qr_code { | ||
| 68 | + color: gray; | ||
| 69 | + font-size: 0.9rem; | ||
| 70 | + margin-bottom: 0.5rem; | ||
| 71 | + margin-top: 0.5rem; | ||
| 72 | + } | ||
| 73 | +} | ||
| 74 | +</style> |
| ... | @@ -21,6 +21,7 @@ import DesField from '@/components/DesField/index.vue' | ... | @@ -21,6 +21,7 @@ import DesField from '@/components/DesField/index.vue' |
| 21 | import DividerField from '@/components/DividerField/index.vue' | 21 | import DividerField from '@/components/DividerField/index.vue' |
| 22 | import VideoField from '@/components/VideoField/index.vue' | 22 | import VideoField from '@/components/VideoField/index.vue' |
| 23 | import MarqueeField from '@/components/MarqueeField/index.vue' | 23 | import MarqueeField from '@/components/MarqueeField/index.vue' |
| 24 | +import ContactField from '@/components/ContactField/index.vue' | ||
| 24 | 25 | ||
| 25 | /** | 26 | /** |
| 26 | * 生成自定义组件类型 | 27 | * 生成自定义组件类型 |
| ... | @@ -133,5 +134,9 @@ export function createComponentType(data) { | ... | @@ -133,5 +134,9 @@ export function createComponentType(data) { |
| 133 | item.name = item.key; | 134 | item.name = item.key; |
| 134 | item.component = MarqueeField; | 135 | item.component = MarqueeField; |
| 135 | } | 136 | } |
| 137 | + if (item.component_props.name === 'contact') { | ||
| 138 | + item.name = item.key; | ||
| 139 | + item.component = ContactField; | ||
| 140 | + } | ||
| 136 | }) | 141 | }) |
| 137 | } | 142 | } | ... | ... |
| ... | @@ -2,12 +2,12 @@ | ... | @@ -2,12 +2,12 @@ |
| 2 | * @Author: hookehuyr hookehuyr@gmail.com | 2 | * @Author: hookehuyr hookehuyr@gmail.com |
| 3 | * @Date: 2022-05-31 12:06:19 | 3 | * @Date: 2022-05-31 12:06:19 |
| 4 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 4 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 5 | - * @LastEditTime: 2022-11-22 14:12:00 | 5 | + * @LastEditTime: 2022-11-23 15:05:10 |
| 6 | * @FilePath: /data-table/src/main.js | 6 | * @FilePath: /data-table/src/main.js |
| 7 | * @Description: | 7 | * @Description: |
| 8 | */ | 8 | */ |
| 9 | import { createApp } from 'vue'; | 9 | import { createApp } from 'vue'; |
| 10 | -import { Button, Image as VanImage, Col, Row, Icon, Form, Field, CellGroup, ConfigProvider, Toast, Uploader, Empty, Tab, Tabs, Overlay, NumberKeyboard, Lazyload, List, PullRefresh, Popup, Picker, Sticky, Stepper, Tag, Swipe, SwipeItem, Dialog, ActionSheet, Loading, Checkbox, Search, NavBar, Collapse, CollapseItem, RadioGroup, Radio, CheckboxGroup, Area, DatePicker, TimePicker, PickerGroup, Rate, Calendar, Divider } from 'vant'; | 10 | +import { Button, Image as VanImage, Col, Row, Icon, Form, Field, CellGroup, ConfigProvider, Toast, Uploader, Empty, Tab, Tabs, Overlay, NumberKeyboard, Lazyload, List, PullRefresh, Popup, Picker, Sticky, Stepper, Tag, Swipe, SwipeItem, Dialog, ActionSheet, Loading, Checkbox, Search, NavBar, Collapse, CollapseItem, RadioGroup, Radio, CheckboxGroup, Area, DatePicker, TimePicker, PickerGroup, Rate, Calendar, Divider, Popover } from 'vant'; |
| 11 | import router from './router'; | 11 | import router from './router'; |
| 12 | import App from './App.vue'; | 12 | import App from './App.vue'; |
| 13 | // import axios from './utils/axios'; | 13 | // import axios from './utils/axios'; |
| ... | @@ -25,6 +25,6 @@ app.config.warnHandler = () => null; | ... | @@ -25,6 +25,6 @@ app.config.warnHandler = () => null; |
| 25 | 25 | ||
| 26 | app.config.globalProperties.$http = axios; // 关键语句 | 26 | app.config.globalProperties.$http = axios; // 关键语句 |
| 27 | 27 | ||
| 28 | -app.use(pinia).use(router).use(Button).use(VanImage).use(Col).use(Row).use(Icon).use(Form).use(Field).use(CellGroup).use(Toast).use(Uploader).use(Empty).use(Tab).use(Tabs).use(Overlay).use(NumberKeyboard).use(Lazyload).use(List).use(PullRefresh).use(Popup).use(Picker).use(Sticky).use(Stepper).use(Tag).use(Swipe).use(SwipeItem).use(Dialog).use(ActionSheet).use(Loading).use(Checkbox).use(Search).use(ConfigProvider).use(NavBar).use(Collapse).use(CollapseItem).use(Radio).use(RadioGroup).use(CheckboxGroup).use(Area).use(DatePicker).use(TimePicker).use(PickerGroup).use(Rate).use(Calendar).use(Divider); | 28 | +app.use(pinia).use(router).use(Button).use(VanImage).use(Col).use(Row).use(Icon).use(Form).use(Field).use(CellGroup).use(Toast).use(Uploader).use(Empty).use(Tab).use(Tabs).use(Overlay).use(NumberKeyboard).use(Lazyload).use(List).use(PullRefresh).use(Popup).use(Picker).use(Sticky).use(Stepper).use(Tag).use(Swipe).use(SwipeItem).use(Dialog).use(ActionSheet).use(Loading).use(Checkbox).use(Search).use(ConfigProvider).use(NavBar).use(Collapse).use(CollapseItem).use(Radio).use(RadioGroup).use(CheckboxGroup).use(Area).use(DatePicker).use(TimePicker).use(PickerGroup).use(Rate).use(Calendar).use(Divider).use(Popover); |
| 29 | app.use(vueEsign) | 29 | app.use(vueEsign) |
| 30 | app.mount('#app'); | 30 | app.mount('#app'); | ... | ... |
| ... | @@ -79,23 +79,20 @@ onMounted(async () => { | ... | @@ -79,23 +79,20 @@ onMounted(async () => { |
| 79 | table_cover.value = "https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg"; | 79 | table_cover.value = "https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg"; |
| 80 | table_title.value = form_data.name; | 80 | table_title.value = form_data.name; |
| 81 | formData.value = formatData(form_data.field_list); | 81 | formData.value = formatData(form_data.field_list); |
| 82 | - // mockData.value = [ | 82 | + mockData.value = [ |
| 83 | - // { | 83 | + { |
| 84 | - // key: "video", | 84 | + key: "", |
| 85 | - // value: "false", | 85 | + value: "", |
| 86 | - // component: "", | 86 | + component: "", |
| 87 | - // component_props: { | 87 | + component_props: { |
| 88 | - // name: "video", | 88 | + name: "contact", |
| 89 | - // label: "视频标题", | 89 | + tel: "13765765676", |
| 90 | - // src: | 90 | + qr_code: "https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg", |
| 91 | - // "https://gd-pri.jinshujufiles.com/en/NAGn1D/FjyggcxvTB9HJ6yFBv4i7-HDuW8F_field_20_1653095134.mp4?token=7NK_Z1IEoKaIY6I9RXzO4b9uQPwuwdvnlGbzHZmF:1fnWx_k8UBYJJ_XjunwCp93N7GI=:eyJTIjoiZ2QtcHJpLmppbnNodWp1ZmlsZXMuY29tL2VuL05BR24xRC9GanlnZ2N4dlRCOUhKNnlGQnY0aTctSER1VzhGX2ZpZWxkXzIwXzE2NTMwOTUxMzQubXA0KiIsIkUiOjE5Njg2NjQ2Njh9", | 91 | + }, |
| 92 | - // cover: | 92 | + }, |
| 93 | - // "https://gd-pri.jinshujufiles.com/en/NAGn1D/FgYwXBnKzvOcLNoojqrpwYGsppQI_field_74_1653095136.png?token=7NK_Z1IEoKaIY6I9RXzO4b9uQPwuwdvnlGbzHZmF:PLQaeVUgpZ-rgvD37DE0Yq9W5-o=:eyJTIjoiZ2QtcHJpLmppbnNodWp1ZmlsZXMuY29tL2VuL05BR24xRC9GZ1l3WEJuS3p2T2NMTm9vanFycHdZR3NwcFFJX2ZpZWxkXzc0XzE2NTMwOTUxMzYucG5nKiIsIkUiOjE5Njg2NjQ2Njh9", | 93 | + ]; |
| 94 | - // }, | ||
| 95 | - // }, | ||
| 96 | - // ]; | ||
| 97 | // 生成自定义组件 | 94 | // 生成自定义组件 |
| 98 | - // createComponentType(mockData.value); | 95 | + createComponentType(mockData.value); |
| 99 | createComponentType(formData.value); | 96 | createComponentType(formData.value); |
| 100 | }); | 97 | }); |
| 101 | 98 | ... | ... |
-
Please register or login to post a comment