Showing
3 changed files
with
105 additions
and
15 deletions
| ... | @@ -35,6 +35,7 @@ declare module '@vue/runtime-core' { | ... | @@ -35,6 +35,7 @@ declare module '@vue/runtime-core' { |
| 35 | NutDatePicker: typeof import('@nutui/nutui-taro')['DatePicker'] | 35 | NutDatePicker: typeof import('@nutui/nutui-taro')['DatePicker'] |
| 36 | NutDialog: typeof import('@nutui/nutui-taro')['Dialog'] | 36 | NutDialog: typeof import('@nutui/nutui-taro')['Dialog'] |
| 37 | NutDivider: typeof import('@nutui/nutui-taro')['Divider'] | 37 | NutDivider: typeof import('@nutui/nutui-taro')['Divider'] |
| 38 | + NutFixedNav: typeof import('@nutui/nutui-taro')['FixedNav'] | ||
| 38 | NutForm: typeof import('@nutui/nutui-taro')['Form'] | 39 | NutForm: typeof import('@nutui/nutui-taro')['Form'] |
| 39 | NutFormItem: typeof import('@nutui/nutui-taro')['FormItem'] | 40 | NutFormItem: typeof import('@nutui/nutui-taro')['FormItem'] |
| 40 | NutInput: typeof import('@nutui/nutui-taro')['Input'] | 41 | NutInput: typeof import('@nutui/nutui-taro')['Input'] |
| ... | @@ -42,6 +43,7 @@ declare module '@vue/runtime-core' { | ... | @@ -42,6 +43,7 @@ declare module '@vue/runtime-core' { |
| 42 | NutNumberKeyboard: typeof import('@nutui/nutui-taro')['NumberKeyboard'] | 43 | NutNumberKeyboard: typeof import('@nutui/nutui-taro')['NumberKeyboard'] |
| 43 | NutOverlay: typeof import('@nutui/nutui-taro')['Overlay'] | 44 | NutOverlay: typeof import('@nutui/nutui-taro')['Overlay'] |
| 44 | NutPicker: typeof import('@nutui/nutui-taro')['Picker'] | 45 | NutPicker: typeof import('@nutui/nutui-taro')['Picker'] |
| 46 | + NutPopover: typeof import('@nutui/nutui-taro')['Popover'] | ||
| 45 | NutPopup: typeof import('@nutui/nutui-taro')['Popup'] | 47 | NutPopup: typeof import('@nutui/nutui-taro')['Popup'] |
| 46 | NutRadio: typeof import('@nutui/nutui-taro')['Radio'] | 48 | NutRadio: typeof import('@nutui/nutui-taro')['Radio'] |
| 47 | NutRadioGroup: typeof import('@nutui/nutui-taro')['RadioGroup'] | 49 | NutRadioGroup: typeof import('@nutui/nutui-taro')['RadioGroup'] |
| ... | @@ -68,3 +70,7 @@ declare module '@vue/runtime-core' { | ... | @@ -68,3 +70,7 @@ declare module '@vue/runtime-core' { |
| 68 | VideoField: typeof import('./src/components/VideoField/index.vue')['default'] | 70 | VideoField: typeof import('./src/components/VideoField/index.vue')['default'] |
| 69 | } | 71 | } |
| 70 | } | 72 | } |
| 73 | +ex.vue')['default'] | ||
| 74 | + VideoField: typeof import('./src/components/VideoField/index.vue')['default'] | ||
| 75 | + } | ||
| 76 | +} | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2022-11-23 14:41:53 | 2 | * @Date: 2022-11-23 14:41:53 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2023-01-06 19:04:00 | 4 | + * @LastEditTime: 2023-04-13 18:19:36 |
| 5 | - * @FilePath: /data-table/src/components/ContactField/index.vue | 5 | + * @FilePath: /custom_form/src/components/ContactField/index.vue |
| 6 | * @Description: 联系我们控件 | 6 | * @Description: 联系我们控件 |
| 7 | --> | 7 | --> |
| 8 | <template> | 8 | <template> |
| 9 | <div v-if="HideShow" class="contact-field-page"> | 9 | <div v-if="HideShow" class="contact-field-page"> |
| 10 | - <van-popover v-model:show="showPopover" placement="left"> | 10 | + <!-- <van-popover v-model:show="showPopover" placement="left"> |
| 11 | <div class="contact-content"> | 11 | <div class="contact-content"> |
| 12 | <div class="text-tel">电话联系</div> | 12 | <div class="text-tel">电话联系</div> |
| 13 | <div> | 13 | <div> |
| ... | @@ -28,14 +28,37 @@ | ... | @@ -28,14 +28,37 @@ |
| 28 | <van-icon name="phone-o" size="2rem" :color="styleColor.baseColor" /> | 28 | <van-icon name="phone-o" size="2rem" :color="styleColor.baseColor" /> |
| 29 | </div> | 29 | </div> |
| 30 | </template> | 30 | </template> |
| 31 | - </van-popover> | 31 | + </van-popover> --> |
| 32 | + | ||
| 33 | + <div class="wrapper"> | ||
| 34 | + <Service size="25" :color="styleColor.baseColor" @click="onClick" /> | ||
| 35 | + <div class="triangle"></div> | ||
| 36 | + <div v-if="showPopover" class="contact-content"> | ||
| 37 | + <div class="text-tel">电话联系</div> | ||
| 38 | + <div @click="onTel"> | ||
| 39 | + <a | ||
| 40 | + :style="{ color: styleColor.baseColor }" | ||
| 41 | + :href="`tel:${item.component_props.tel}`" | ||
| 42 | + > | ||
| 43 | + {{ item.component_props.tel }} | ||
| 44 | + </a> | ||
| 45 | + </div> | ||
| 46 | + <div v-if="item.component_props.image_url"> | ||
| 47 | + <div class="text-qr_code">微信联系</div> | ||
| 48 | + <image id="qr_code" :src="item.component_props.image_url" style="width: 80px; height: 80px;" /> | ||
| 49 | + </div> | ||
| 50 | + </div> | ||
| 51 | + </div> | ||
| 32 | </div> | 52 | </div> |
| 33 | </template> | 53 | </template> |
| 34 | 54 | ||
| 35 | <script setup> | 55 | <script setup> |
| 36 | -import { ref } from "vue"; | 56 | +import { ref, computed, onMounted, nextTick } from "vue"; |
| 37 | import { useRoute, useRouter } from "vue-router"; | 57 | import { useRoute, useRouter } from "vue-router"; |
| 38 | import { styleColor } from "@/constant.js"; | 58 | import { styleColor } from "@/constant.js"; |
| 59 | +import { Service } from '@nutui/icons-vue-taro'; | ||
| 60 | +import Taro from '@tarojs/taro' | ||
| 61 | +import { $ } from '@tarojs/extend' | ||
| 39 | 62 | ||
| 40 | const props = defineProps({ | 63 | const props = defineProps({ |
| 41 | item: Object, | 64 | item: Object, |
| ... | @@ -45,9 +68,53 @@ const HideShow = computed(() => { | ... | @@ -45,9 +68,53 @@ const HideShow = computed(() => { |
| 45 | return !props.item.component_props.disabled | 68 | return !props.item.component_props.disabled |
| 46 | }) | 69 | }) |
| 47 | const showPopover = ref(false); | 70 | const showPopover = ref(false); |
| 71 | + | ||
| 72 | +const onClick = () => { | ||
| 73 | + showPopover.value = !showPopover.value; | ||
| 74 | + | ||
| 75 | + // 给每张图片添加查看事件 | ||
| 76 | + nextTick(() => { | ||
| 77 | + var img = $('#qr_code'); | ||
| 78 | + console.warn(img); | ||
| 79 | + $(img).on('longpress', function (e) { | ||
| 80 | + Taro.previewImage({ | ||
| 81 | + // 需要预览的图片链接列表 | ||
| 82 | + urls: [$(img).attr('src')], | ||
| 83 | + // 为当前显示图片的链接/索引值 | ||
| 84 | + current: $(img).attr('src'), | ||
| 85 | + // 图片指示器样式 | ||
| 86 | + indicator: 'default', | ||
| 87 | + // 是否可循环预览 | ||
| 88 | + loop: false, | ||
| 89 | + // 长按图片显示操作菜单,如不填默认为保存相册 | ||
| 90 | + // longPressActions:{ | ||
| 91 | + // itemList:[this.l('发送给朋友'),this.l] | ||
| 92 | + // }, | ||
| 93 | + success: res => { | ||
| 94 | + console.warn('res', res); | ||
| 95 | + }, | ||
| 96 | + fail: err => { | ||
| 97 | + console.error('err', err); | ||
| 98 | + } | ||
| 99 | + }) | ||
| 100 | + }) | ||
| 101 | + }) | ||
| 102 | +} | ||
| 103 | +const onTel = () => { | ||
| 104 | + if (process.env.TARO_ENV === 'weapp') { | ||
| 105 | + Taro.makePhoneCall({ | ||
| 106 | + phoneNumber: props.item.component_props.tel, | ||
| 107 | + success () {}, | ||
| 108 | + fail () {} | ||
| 109 | + }) | ||
| 110 | + } | ||
| 111 | +} | ||
| 112 | + | ||
| 113 | +onMounted(async () => { | ||
| 114 | +}) | ||
| 48 | </script> | 115 | </script> |
| 49 | 116 | ||
| 50 | -<style lang="less" scoped> | 117 | +<style lang="less"> |
| 51 | .contact-field-page { | 118 | .contact-field-page { |
| 52 | position: fixed; | 119 | position: fixed; |
| 53 | bottom: 10rem; | 120 | bottom: 10rem; |
| ... | @@ -55,9 +122,10 @@ const showPopover = ref(false); | ... | @@ -55,9 +122,10 @@ const showPopover = ref(false); |
| 55 | // height: 100%; | 122 | // height: 100%; |
| 56 | z-index: 9; | 123 | z-index: 9; |
| 57 | .wrapper { | 124 | .wrapper { |
| 125 | + position: relative; | ||
| 58 | background: white; | 126 | background: white; |
| 59 | - width: 3rem; | 127 | + width: 100px; |
| 60 | - height: 3rem; | 128 | + height: 100px; |
| 61 | border-radius: 50%; | 129 | border-radius: 50%; |
| 62 | text-align: center; | 130 | text-align: center; |
| 63 | box-shadow: 0rem -0.17rem 0.67rem 0.08rem rgba(0, 0, 0, 0.05); | 131 | box-shadow: 0rem -0.17rem 0.67rem 0.08rem rgba(0, 0, 0, 0.05); |
| ... | @@ -68,18 +136,34 @@ const showPopover = ref(false); | ... | @@ -68,18 +136,34 @@ const showPopover = ref(false); |
| 68 | } | 136 | } |
| 69 | 137 | ||
| 70 | .contact-content { | 138 | .contact-content { |
| 139 | + background-color: white; | ||
| 140 | + box-shadow: 0 2px 12px rgba(50,50,51,.12); | ||
| 141 | + position: absolute; | ||
| 142 | + right: 115px; | ||
| 71 | padding: 1rem 0.85rem; | 143 | padding: 1rem 0.85rem; |
| 144 | + font-size: 20px; | ||
| 72 | text-align: center; | 145 | text-align: center; |
| 146 | + border-radius: 10px; | ||
| 73 | .text-tel { | 147 | .text-tel { |
| 74 | color: gray; | 148 | color: gray; |
| 75 | - font-size: 0.9rem; | 149 | + |
| 76 | margin-bottom: 0.5rem; | 150 | margin-bottom: 0.5rem; |
| 77 | } | 151 | } |
| 78 | .text-qr_code { | 152 | .text-qr_code { |
| 79 | color: gray; | 153 | color: gray; |
| 80 | - font-size: 0.9rem; | ||
| 81 | margin-bottom: 0.5rem; | 154 | margin-bottom: 0.5rem; |
| 82 | margin-top: 0.5rem; | 155 | margin-top: 0.5rem; |
| 83 | } | 156 | } |
| 84 | } | 157 | } |
| 158 | +.triangle { | ||
| 159 | + width: 0; | ||
| 160 | + height: 0; | ||
| 161 | + border-left: 20px solid white; | ||
| 162 | + border-top: 20px solid transparent; | ||
| 163 | + border-bottom: 20px solid transparent; | ||
| 164 | + position: absolute; | ||
| 165 | + top: 40%; | ||
| 166 | + right: 100%; | ||
| 167 | + z-index: 999; | ||
| 168 | +} | ||
| 85 | </style> | 169 | </style> | ... | ... |
| ... | @@ -21,7 +21,7 @@ import NumberField from '@/components/NumberField/index.vue' | ... | @@ -21,7 +21,7 @@ import NumberField from '@/components/NumberField/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 | +import ContactField from '@/components/ContactField/index.vue' |
| 25 | // import RuleField from '@/components/RuleField/index.vue' | 25 | // import RuleField from '@/components/RuleField/index.vue' |
| 26 | import MultiRuleField from '@/components/MultiRuleField/index.vue' | 26 | import MultiRuleField from '@/components/MultiRuleField/index.vue' |
| 27 | // import ButtonField from '@/components/ButtonField/index.vue' | 27 | // import ButtonField from '@/components/ButtonField/index.vue' |
| ... | @@ -151,10 +151,10 @@ export function createComponentType(data) { | ... | @@ -151,10 +151,10 @@ export function createComponentType(data) { |
| 151 | // item.name = item.key | 151 | // item.name = item.key |
| 152 | // item.component = MarqueeField | 152 | // item.component = MarqueeField |
| 153 | // } | 153 | // } |
| 154 | - // if (item.component_props.tag === 'contact') { | 154 | + if (item.component_props.tag === 'contact') { |
| 155 | - // item.name = item.key | 155 | + item.name = item.key |
| 156 | - // item.component = ContactField | 156 | + item.component = ContactField |
| 157 | - // } | 157 | + } |
| 158 | // if (item.component_props.tag === 'rule') { | 158 | // if (item.component_props.tag === 'rule') { |
| 159 | // item.name = item.key | 159 | // item.name = item.key |
| 160 | // item.component = RuleField | 160 | // item.component = RuleField | ... | ... |
-
Please register or login to post a comment