uniapp简单可分享的电子名片

打印 上一主题 下一主题

主题 1025|帖子 1025|积分 3075

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

x
微信小步伐右上角三个点,分享好友和朋友圈,点击内容可以复制手机号,邮箱等,长按手机号可以直接到拨打电话界面
  1. <template>
  2.         <view class="dianziminpianclass">
  3.                 <view class="card" >
  4.                         <u-line></u-line>
  5.                         <p  style="font-size: 20px;font-weight: bold;" @click="getDetail('xxx公司', '公司名')">xxx公司</p>
  6.                         <h1 @click="getDetail("XXX",'姓名')">XXX</h1>
  7.                         <p style="margin-left: 40%;">职位</p>
  8.                         <view class="contact-info" style="margin-left: 10%;">
  9.                                 <view style="display: flex; ">
  10.                                         <u-icon name="email-fill" color="white"></u-icon><p @click="getDetail("xxx@xxx.com",'邮箱')">xxx@xxx.com</p>
  11.                                 </view>
  12.                                 <view style="display: flex; ">
  13.                                         <u-icon name="phone-fill" color="white"></u-icon><p @click="getDetail("1xxxxxxxxx",'手机')" @longpress="bodaPhone("1xxxxxxxxx")">1xxxxxxxxx</p>
  14.                                 </view>
  15.                                 <view style="display: flex; ">
  16.                                         <u-icon name="phone" color="white"></u-icon><p @click="getDetail('xxxxxxx','座机')" @longpress="bodaPhone("xxxxxxx")">xxxxx</p>
  17.                                 </view>
  18.                                 <view style="display: flex; ">
  19.                                         <u-icon name="map-fill" color="white"></u-icon><p @click="getDetail('地址111', '地址')">地址111</p>
  20.                                 </view>
  21.                                 <view style="display: flex; ">
  22.                                         <u-icon name="server-fill" color="white"></u-icon><p @click="getDetail('4006-xx-xx', '客服电话')" @longpress="bodaPhone('4006-xx-xx')">4006-xx-xx</p>
  23.                                 </view>
  24.                                 <view style="display: flex; ">
  25.                                         <u-icon name="coupon-fill" color="white"></u-icon><p @click="getDetail('xxxx', '税号')" @longpress="bodaPhone('xxx')">xxx</p>
  26.                                 </view>
  27.                         </view>
  28.                 </view>
  29.         </view>
  30. </template>
  31. <script>
  32.         export default {
  33.                 data() {
  34.                         return {
  35.                         }
  36.                 },
  37.                 mounted(){
  38.                        
  39.                 },
  40.                
  41.                 onLoad(options) {
  42.                        
  43.                         // 设置默认的转发参数
  44.                         this.share = {
  45.                                 title: `XX的名片`, // 默认为小程序名称
  46.                                 path: `/pages/xxx/xx`, // 默认为当前页面路径
  47.                                 imageUrl: 'https://xxxx/名片分享缩略图.png', // 默认为当前页面的截图
  48.                                 desc: '公司名',
  49.                                 content: `公司-XXX`
  50.                         }
  51.                 },
  52.                 //分享好友
  53.                 onShareAppMessage() {
  54.                         return this.share
  55.                 },
  56.                 //朋友圈
  57.                 onShareTimeline() {
  58.                         return this.share
  59.                 },
  60.                 methods: {
  61.                         // 点击复制
  62.                         getDetail(info, name) {
  63.                                 uni.setClipboardData({
  64.                                                 data: info,
  65.                                                 success: function() {
  66.                                                         // console.log('success');
  67.                                                         uni.showToast({
  68.                                                                 title: '复制'+name,
  69.                                                                 icon: 'success',
  70.                                                                 duration: 2000
  71.                                                         });
  72.                                                 },
  73.                                                 fail:(error)=> {
  74.                                                         // console.log('失败',error);
  75.                                                         uni.showToast({
  76.                                                                 title: '复制'+name+'失败',
  77.                                                                 icon: 'none'
  78.                                                         });
  79.                                                 }
  80.                                
  81.                                         })
  82.                         },
  83.                        
  84.                         // 长按拨打电话
  85.                         bodaPhone(phone){
  86.                                 uni.makePhoneCall({
  87.                                         phoneNumber: phone //仅为示例 this.servicePhone是你要拨打的电话号码
  88.                                 });
  89.                         }
  90.                 }
  91.         }
  92. </script>
  93. <style scoped>
  94.         *{
  95.                 user-select: all;
  96.                 -moz-user-select: all;
  97.                 -webkit-user-select: all;
  98.                 -ms-user-select: all;
  99.                 -ms-user-select: all;
  100.         }
  101. .dianziminpianclass {
  102.        
  103.         background: url('https://xxxxx/电子名片背景.jpg') no-repeat center center fixed; /* 替换为你的图片URL */
  104.         background-size: cover; /* 图片适应屏幕 */
  105.         margin: 0;
  106.         padding: 0;
  107.         height: 100vh;
  108.         display: flex;
  109.         justify-content: center;
  110.         align-items: center;
  111.        
  112. }
  113. .dianziminpianclass .card {
  114.         background: rgba(0, 0, 0, 0.1);
  115.         border-radius: 10px;
  116.         box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  117.         width: 90%;
  118.         max-width: 360px;
  119.         padding: 30px 20px;
  120.         text-align: center;
  121.         position: relative;
  122.         overflow: hidden;
  123.         transition: transform 0.3s, box-shadow 0.3s;
  124.         backdrop-filter: blur(10px);
  125. }
  126. .dianziminpianclass .cardx {
  127.         background: linear-gradient(135deg, #b5bfca, #769ec5);
  128.         border-radius: 30px;
  129.         box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  130.         width: 90%;
  131.         max-width: 360px;
  132.         padding: 30px 20px;
  133.         text-align: center;
  134.         position: relative;
  135.         overflow: hidden;
  136.         transition: transform 0.3s, box-shadow 0.3s;
  137. }
  138. .dianziminpianclass .card:hover {
  139.         transform: translateY(-5px);
  140.         box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3);
  141. }
  142. .dianziminpianclass .card::before {
  143.         content: '';
  144.         position: absolute;
  145.         width: 200px;
  146.         height: 200px;
  147.         background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.2));
  148.         top: -60px;
  149.         left: -40px;
  150.         transform: rotate(30deg);
  151.         z-index: -1;
  152.         border-radius: 50% 50% 50% 50%;
  153. }
  154. .dianziminpianclass .card h1 {
  155.         font-size: 24px;
  156.         margin: 10px 0;
  157.         color: rgb(245, 245, 245);
  158.         font-weight: 700;
  159.         padding: 0 20px;
  160.         position: relative;
  161. }
  162. .dianziminpianclass .card p {
  163.         font-size: 16px;
  164.         color: rgba(255, 255, 255, 0.8);
  165.         margin: 10px 0;
  166.         padding: 0 20px;
  167. }
  168. </style>
复制代码
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

惊雷无声

论坛元老
这个人很懒什么都没写!
快速回复 返回顶部 返回列表